Java Code Examples for com.google.gwt.user.client.ui.HorizontalPanel#setSize()

The following examples show how to use com.google.gwt.user.client.ui.HorizontalPanel#setSize() . 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: ZoomStatusWidget.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Widget asWidget() {
	if (widget == null) {
		final String width = "60px";
		final String height = "10px";
		widget = new HorizontalLayoutContainer();
		widget.getElement().getStyle().setPosition(Position.ABSOLUTE);
		widget.getElement().getStyle().setLeft(10, Unit.PX);
		widget.getElement().getStyle().setBottom(90, Unit.PX);
		widget.setSize(width, height);
		
		hp = new HorizontalPanel();
		hp.setSpacing(2);
		hp.getElement().getStyle().setBackgroundColor("#FFFFFF");
		hp.setSize(width, height);
		
		hp.add(getZoomLabel());
		
		widget.add(hp);
	}
	return widget;
}
 
Example 2
Source File: ColumnLayout.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
@Override
public void apply(WorkAreaPanel workArea) {

  // Clear base panel
  workArea.clear();

  // Horizontal panel to hold columns
  HorizontalPanel horizontalPanel = new HorizontalPanel();
  horizontalPanel.setSize("100%", "100%");
  workArea.add(horizontalPanel);

  // Initialize columns
  for (Column column : columns) {
    horizontalPanel.add(column.columnPanel);
    workArea.getWidgetDragController().registerDropController(column);

    // Add invisible dummy widget to prevent column from collapsing when it contains no boxes
    column.columnPanel.add(new Label());

    // Add boxes from layout
    List<BoxDescriptor> boxes = column.boxes;
    for (int index = 0; index < boxes.size(); index++) {
      BoxDescriptor bd = boxes.get(index);
      Box box = workArea.createBox(bd);
      if (box != null) {
        column.insert(box, index);
        box.restoreLayoutSettings(bd);
      }
    }
  }

  workArea.getWidgetDragController().addDragHandler(changeDetector);
}
 
Example 3
Source File: Welcome.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private HorizontalPanel getPanel(final HTML data) {
	HorizontalPanel panel = new HorizontalPanel();
	panel.setSize("520px", "310px");
	panel.setSpacing(5);
	panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
	Anchor anchor = new AnchorBuilder().setHref("http://www.geowe.org")
			.setImage(new Image(ImageProvider.INSTANCE.geoweSquareLogo()))
			.build();

	panel.add(anchor);
	panel.add(data);
	return panel;
}
 
Example 4
Source File: SimpleMapVerticalLegend.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private HorizontalPanel getColorPanel(Layer layer) {
	HorizontalPanel colorPanel = new HorizontalPanel();
	colorPanel.setSize("20px", "20px");
	colorPanel.getElement().getStyle()
			.setBackgroundColor(getColor(layer, "fillColor"));
	colorPanel.setBorderWidth(2);
	colorPanel.getElement().getStyle().setBorderStyle(BorderStyle.SOLID);
	colorPanel.getElement().getStyle()
			.setBorderColor(getColor(layer, "strokeColor"));
	return colorPanel;
}
 
Example 5
Source File: LinksWidget.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Widget asWidget() {
	if (widget == null) {
		//String width="320px";
		String width="370px";
		String height="50px";
		widget = new HorizontalLayoutContainer();
		widget.getElement().getStyle().setPosition(Position.ABSOLUTE);
		widget.getElement().getStyle().setRight(5, Unit.PX);
		widget.getElement().getStyle().setTop(0, Unit.PX);
		widget.setSize(width, height);
		
		hp = new HorizontalPanel();
		hp.setSpacing(10);
		StyleInjector.inject(".linkPanel { " + "background: #FFFFFF;"
				+ "border-radius: 5px 10px;" + "opacity: 0.8}");
		hp.setStyleName("linkPanel");
		hp.setSize(width, height);
		
		ScrollSupport scrollSupport = widget.getScrollSupport();
		scrollSupport.setScrollMode(ScrollMode.AUTOX);
		
		setDefaultLinks();
		
		widget.add(hp);
	}
	return widget;
}
 
Example 6
Source File: SimpleThemingVerticalLegend.java    From geowe-core with GNU General Public License v3.0 5 votes vote down vote up
private HorizontalPanel getColorPanel(String color) {
	HorizontalPanel colorPanel = new HorizontalPanel();
	colorPanel.setSize("20px", "20px");
	colorPanel.getElement().getStyle().setBackgroundColor(color);
	colorPanel.getElement().getStyle().setBorderColor(color);
	return colorPanel;
}
 
Example 7
Source File: ShowBarcodeCommand.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
BarcodeDialogBox(String projectName, String appInstallUrl) {
      super(false, true);
      setStylePrimaryName("ode-DialogBox");
      setText(MESSAGES.barcodeTitle(projectName));

      ClickHandler buttonHandler = new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
          hide();
        }
      };

      Button cancelButton = new Button(MESSAGES.cancelButton());
      cancelButton.addClickHandler(buttonHandler);
      Button okButton = new Button(MESSAGES.okButton());
      okButton.addClickHandler(buttonHandler);
      HTML barcodeQrcode = new HTML("<center>" + BlocklyPanel.getQRCode(appInstallUrl) + "</center>");
      HTML linkQrcode = new HTML("<center><a href=\"" + appInstallUrl + "\" target=\"_blank\">" + appInstallUrl + "</a></center>");
      HorizontalPanel buttonPanel = new HorizontalPanel();
      buttonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
      HTML warningLabel = new HTML(MESSAGES.barcodeWarning(
          "<a href=\"" + "http://appinventor.mit.edu/explore/ai2/share.html" +
          "\" target=\"_blank\">",
          "</a>"));
      warningLabel.setWordWrap(true);
      warningLabel.setWidth("200px");  // set width to get the text to wrap
      HorizontalPanel warningPanel = new HorizontalPanel();
      warningPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
      warningPanel.add(warningLabel);

      // The cancel button is removed from the panel since it has no meaning in this
      // context.  But the logic is still here in case we want to restore it, and as
      // an example of how to code this stuff in GWT.
      // buttonPanel.add(cancelButton);
      buttonPanel.add(okButton);
      buttonPanel.setSize("100%", "24px");
      VerticalPanel contentPanel = new VerticalPanel();
      contentPanel.add(barcodeQrcode);
      contentPanel.add(linkQrcode);
      contentPanel.add(buttonPanel);
      contentPanel.add(warningPanel);
//      contentPanel.setSize("320px", "100%");
      add(contentPanel);
    }
 
Example 8
Source File: ProgressBarDialogBox.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
public ProgressBarDialogBox(String serviceName, ProjectNode projectNode) {
  super(false, true);
  this.serviceName = serviceName;
  setStylePrimaryName("ode-DialogBox");
  setText(projectNode.getName() + " " + MESSAGES.ProgressBarFor());

  //click handler for the mini html buttons
  ClickHandler buttonHandler = new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      hide();
      progressBarShow++;
    }
  };

  //declare the ok button
  dismissButton.addClickHandler(buttonHandler);
  HorizontalPanel buttonPanel = new HorizontalPanel();
  buttonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
  dismissButton.setVisible(false); // we don't need the button unless we get an error

  //warning label
  warningLabel = new HTML("");
  warningLabel.setWordWrap(true);
  warningLabel.setWidth("60em");  // set width to get the text to wrap

  //warning panel
  HorizontalPanel warningPanel = new HorizontalPanel();
  warningPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
  warningPanel.add(warningLabel);

  // button panel
  buttonPanel.add(dismissButton);
  buttonPanel.setSize("100%", "24px");

  //content panel
  VerticalPanel contentPanel = new VerticalPanel();
  contentPanel.add(mpb);
  contentPanel.add(warningPanel);
  contentPanel.add(buttonPanel);
  setWidget(contentPanel);
}