Java Code Examples for com.google.gwt.user.client.ui.AbsolutePanel#add()

The following examples show how to use com.google.gwt.user.client.ui.AbsolutePanel#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MockMap.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
public MockMap(SimpleEditor editor) {
  super(editor, TYPE, images.map(), new MockMapLayout());
  initToolbarItems();

  rootPanel.setHeight("100%");

  mapWidget = new AbsolutePanel();
  mapWidget.setStylePrimaryName("ode-SimpleMockContainer");
  mapWidget.add(rootPanel);

  initComponent(mapWidget);
  mapWidget.addAttachHandler(new AttachEvent.Handler() {
    @Override
    public void onAttachOrDetach(AttachEvent arg0) {
      if (arg0.isAttached()) {
        initPanel();
        invalidateMap();
        for (MockComponent child : children) {
          ((MockMapFeature) child).addToMap(MockMap.this);
        }
      }
    }
  });
}
 
Example 2
Source File: MockForm.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
TitleBar() {
  title = new Label();
  title.setStylePrimaryName("ode-SimpleMockFormTitle");
  title.setHorizontalAlignment(Label.ALIGN_LEFT);

  menuButton = new Button();
  menuButton.setText("\u22ee");
  menuButton.setStylePrimaryName("ode-SimpleMockFormMenuButton");

  bar = new AbsolutePanel();
  bar.add(title);
  bar.add(menuButton);

  initWidget(bar);

  setStylePrimaryName("ode-SimpleMockFormTitleBar");
  setSize("100%", TITLEBAR_HEIGHT + "px");
}
 
Example 3
Source File: DiagramController.java    From EasyML with Apache License 2.0 5 votes vote down vote up
/**
 * Initialize the widget panel according to the canvas.
 * 
 * @param canvas
 */
protected void initWidgetPanel(final DiagramCanvas canvas) {
	widgetPanel = new AbsolutePanel();
	widgetPanel.getElement().getStyle().setWidth(canvas.getWidth(), Unit.PX);
	widgetPanel.getElement().getStyle().setHeight(canvas.getHeight(), Unit.PX);
	widgetPanel.add(canvas.asWidget());

	this.svgPanel = new SVGPanel();
	widgetPanel.add(svgPanel);
	focusPanel.add(widgetPanel);
	scrollPanel = new ScrollPanel(widgetPanel);

}
 
Example 4
Source File: MockCanvas.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new MockCanvas component.
 *
 * @param editor editor of source file the component belongs to
 */
public MockCanvas(SimpleEditor editor) {
  super(editor, TYPE, images.canvas(), new MockCanvasLayout());

  rootPanel.setHeight("100%");

  canvasWidget = new AbsolutePanel();
  canvasWidget.setStylePrimaryName("ode-SimpleMockContainer");
  canvasWidget.add(rootPanel);

  initComponent(canvasWidget);
}
 
Example 5
Source File: MockTableArrangement.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new MockTableArrangement component.
 *
 * @param editor  editor of source file the component belongs to
 */
public MockTableArrangement(SimpleEditor editor) {
  super(editor, TYPE, images.table(), new MockTableLayout());

  rootPanel.setHeight("100%");

  layoutWidget = new AbsolutePanel();
  layoutWidget.setStylePrimaryName("ode-SimpleMockContainer");
  layoutWidget.add(rootPanel);

  initComponent(layoutWidget);
}
 
Example 6
Source File: BoxView.java    From shortyz with GNU General Public License v3.0 5 votes vote down vote up
@Inject
public BoxView(Resources resources){
    AbsolutePanel main = new AbsolutePanel();
    
    number.setStyleName(resources.css().number());
    letter.setStyleName(resources.css().letter());
    main.add(number, 0,0);
    main.add(letter, 0,0);

    super.initWidget(main);
    this.setStyleName(resources.css().boxPanel());
}
 
Example 7
Source File: DiagramController.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
protected void initWidgetPanel(final DiagramCanvas canvas) {
	widgetPanel = new AbsolutePanel();
	widgetPanel.getElement().getStyle().setWidth(canvas.getWidth(), Unit.PX);
	widgetPanel.getElement().getStyle().setHeight(canvas.getHeight(), Unit.PX);
	widgetPanel.add(canvas.asWidget());
}
 
Example 8
Source File: PreviewPopupPanel.java    From EasyML with Apache License 2.0 4 votes vote down vote up
/**
 * Initialize
 * 
 * @param path  Result root address
 */
protected void init(String path) {
	this.setSize("650px", "400px");
	this.setGlassEnabled(true);
	this.setModal(true);
	closeButton.setSize("10px", "10px");
	closeButton.setStyleName("closebtn");
	closeButton.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			PreviewPopupPanel.this.hide();
		}
	});
	VerticalPanel verticalPanel = new VerticalPanel();
	verticalPanel.add(closeButton);
	verticalPanel.setCellHeight(closeButton, "13px");
	verticalPanel.setStyleName("vpanel");
	desc.setStyleName("popupTitle");
	verticalPanel.add(desc);
	verticalPanel.setCellHeight(desc, "30px");

	HorizontalPanel hPanel = new HorizontalPanel();
	savebtn.setStyleName("popupsavebtn");
	savebtn.setVisible(false);
	refreshBtn.setStyleName("popuprefreshbtn");
	refreshBtn.setVisible(false);
	uploadSubmitButton.setVisible(false);
	hPanel.add(uploadSubmitButton);
	hPanel.add(savebtn);
	hPanel.add(refreshBtn);
	hPanel.setCellVerticalAlignment(uploadSubmitButton,
			HasVerticalAlignment.ALIGN_BOTTOM);

	tabPanel.getElement().getStyle().setMarginBottom(10.0, Unit.PX);
	tabPanel.setSize("650px", "355px");
	dirPanel = new HorizontalPanel();
	resultDirTree = PopupRetDirTreeLoad.load(path);
	resultDirTree.getRoot().setState(false);
	ScrollPanel dirScrollPanel = new ScrollPanel();
	dirScrollPanel.add(resultDirTree);
	dirScrollPanel.setAlwaysShowScrollBars(true);
	dirScrollPanel.setSize("300px", "320px");

	VerticalPanel fileViewPanel = new VerticalPanel();
	fileLabel.setText("Please select a file to view!");
	fileLabel.setStyleName("popupFileSelectName");
	fileViewPanel.add(fileLabel);
	fileTextArea.setStyleName("popupMsg");
	fileTextArea.setSize("342px", "298px");
	fileTextArea.getElement().setAttribute("wrap", "off");    
	fileTextArea.setReadOnly(true);
	fileViewPanel.add(fileTextArea);
	dirPanel.add(dirScrollPanel);
	dirPanel.add(fileViewPanel);
	tabPanel.add(dirPanel,"Results directory");

	AbsolutePanel bottomPanel = new AbsolutePanel(); 
	bottomPanel.setSize("650px", "360px");
	bottomPanel.add(tabPanel, 0, 0);
	bottomPanel.add(hPanel,460,3);

	fileSizeLabel.setStyleName("popupFileSelectName");
	verticalPanel.add(bottomPanel); 
	verticalPanel.add(fileSizeLabel);
	this.add(verticalPanel);
	this.setStyleName("loading_container");
}
 
Example 9
Source File: MockForm.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a new MockForm component.
 *
 * @param editor  editor of source file the component belongs to
 */
public MockForm(SimpleEditor editor) {
  // Note(Hal): This helper thing is a kludge because I really want to write:
  // myLayout = new MockHVLayout(orientation);
  // super(editor, type, icon, myLayout);
  // but Java won't let me do that.

  super(editor, TYPE, images.form(), MockFormHelper.makeLayout());
  // Note(hal): There better not be any calls to MockFormHelper before the
  // next instruction.  Note that the Helper methods are synchronized to avoid possible
  // future problems if we ever have threads creating forms in parallel.
  myLayout = MockFormHelper.getLayout();

  phoneWidget = new AbsolutePanel();
  phoneWidget.setStylePrimaryName("ode-SimpleMockFormPhonePortrait");
  formWidget = new AbsolutePanel();
  formWidget.setStylePrimaryName("ode-SimpleMockForm");
  responsivePanel = new AbsolutePanel();

  // Initialize mock form UI by adding the phone bar and title bar.
  responsivePanel.add(new PhoneBar());
  titleBar = new TitleBar();
  responsivePanel.add(titleBar);

  // Put a ScrollPanel around the rootPanel.
  scrollPanel = new ScrollPanel(rootPanel);
  responsivePanel.add(scrollPanel);

  formWidget.add(responsivePanel);

  //Add navigation bar at the bottom of the viewer.
  navigationBar = new NavigationBar();
  formWidget.add(navigationBar);

  phoneWidget.add(formWidget);
  initComponent(phoneWidget);

  // Set up the initial state of the vertical alignment property editor and its dropdowns
  try {
    myVAlignmentPropertyEditor = PropertiesUtil.getVAlignmentEditor(properties);
  } catch (BadPropertyEditorException e) {
    OdeLog.log(MESSAGES.badAlignmentPropertyEditorForArrangement());
    return;
  }
  enableAndDisableDropdowns();
  initialized = true;
  // Now that the default for Scrollable is false, we need to force setting the property when creating the MockForm
  setScrollableProperty(getPropertyValue(PROPERTY_NAME_SCROLLABLE));
}