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

The following examples show how to use com.google.gwt.user.client.ui.HorizontalPanel#setVerticalAlignment() . 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: JoinDataDialog.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
private void createSeparatorPanel() {
	separatorPanel = new HorizontalPanel();
	separatorPanel.setSpacing(1);
	separatorPanel.setWidth("100%");
	separatorPanel.addStyleName(ThemeStyles.get().style().borderTop());
	separatorPanel.addStyleName(ThemeStyles.get().style().borderBottom());
	separatorPanel
			.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	separatorPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
	separatorPanel.add(new Label(UIMessages.INSTANCE
			.separator(DEFAULT_CSV_SEPARATOR)));
	separatorTextField = new TextField();
	separatorTextField.setText(DEFAULT_CSV_SEPARATOR);
	separatorTextField.setWidth(30);

	separatorPanel.add(separatorTextField);
}
 
Example 2
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 3
Source File: PreviewFileCommand.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
@Override
public void execute(final ProjectNode node) {
  final DialogBox dialogBox = new DialogBox();
  dialogBox.setText(node.getName());
  dialogBox.setStylePrimaryName("ode-DialogBox");

  //setting position of dialog box
  dialogBox.center();
  dialogBox.setAnimationEnabled(true);

  //button element
  final Button closeButton = new Button(MESSAGES.closeFilePreview());
  closeButton.getElement().setId("closeButton");
  closeButton.addClickHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {
        dialogBox.hide();
      }
    });

  HorizontalPanel buttonPanel = new HorizontalPanel();
  buttonPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
  buttonPanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
  buttonPanel.add(closeButton);

  VerticalPanel dialogPanel = new VerticalPanel();
  dialogPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
  dialogPanel.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE);

  Widget filePreview = generateFilePreview(node);
  dialogPanel.clear();
  dialogPanel.add(filePreview);

  dialogPanel.add(buttonPanel);
  dialogPanel.setWidth("300px");

  dialogBox.setGlassEnabled(false);
  dialogBox.setModal(false);

  // Set the contents of the Widget
  dialogBox.setWidget(dialogPanel);
  dialogBox.center();
  dialogBox.show();
}
 
Example 4
Source File: TopToolbar.java    From appinventor-extensions with Apache License 2.0 4 votes vote down vote up
public TopToolbar() {
  /*
   * Layout is as follows:
   * +----------------------------------------------------------------+
   * | Project ▾ | Connect ▾ | Build ▾ | Settings ▾ | Help ▾| Admin ▾ |
   * +----------------------------------------------------------------+
   */
  HorizontalPanel toolbar = new HorizontalPanel();
  toolbar.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);

  // Should the UI be in read only mode?
  isReadOnly = Ode.getInstance().isReadOnly();

  // Create the TopToolbar drop down menus.
  fileDropDown = makeButton(WIDGET_NAME_PROJECT, MESSAGES.projectsTabName());
  connectDropDown = makeButton(WIDGET_NAME_CONNECT_TO, MESSAGES.connectTabName());
  buildDropDown = makeButton(WIDGET_NAME_BUILD, MESSAGES.buildTabName());
  settingsDropDown = makeButton(WIDGET_NAME_SETTINGS, MESSAGES.settingsTabName());
  helpDropDown = makeButton(WIDGET_NAME_HELP, MESSAGES.helpTabName());

  createProjectsMenu();
  createConnectMenu();
  createBuildMenu();
  createSettingsMenu();
  createHelpMenu();

  // Add the Buttons to the Toolbar.
  toolbar.add(fileDropDown);
  toolbar.add(connectDropDown);
  toolbar.add(buildDropDown);
  toolbar.add(settingsDropDown);
  toolbar.add(helpDropDown);

  //Only if logged in as an admin, add the Admin Button
  if (Ode.getInstance().getUser().getIsAdmin()) {
    adminDropDown = makeButton(WIDGET_NAME_ADMIN, MESSAGES.adminTabName());
    createAdminMenu();
    toolbar.add(adminDropDown);
  }

  initWidget(toolbar);
}
 
Example 5
Source File: GeocodingPanelWidget.java    From geowe-core with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Widget asWidget() {

	if (panel == null) {
		panel = new ContentPanel();
		panel.setBorders(true);
		panel.setPixelSize(490, 47);
		panel.setHeaderVisible(false);
		panel.setPosition(300, 0);
		panel.getElement().getStyle().setPosition(Position.ABSOLUTE);

		StyleInjector.inject(".statusBarStyle { " + "position: absolute; " + "bottom: 35 px;"
				+ "background: #E0ECF8;" + "border-radius: 5px 10px;" + "opacity: 0.8}");
		panel.setStyleName("geocodingPanelStyle");

		final HorizontalPanel horizontalGroup = new HorizontalPanel();
		horizontalGroup.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
		horizontalGroup.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
		horizontalGroup.setSpacing(5);
		horizontalGroup.getElement().getStyle().setBackgroundColor("#E0ECF8");

		addressTextField.setWidth("320px");
		addressTextField.setEmptyText(UIMessages.INSTANCE.gcAddressTextField());
		addressTextField.getElement().setId("autocompletar");

		addressTextField.addKeyDownHandler(new KeyDownHandler() {
			@Override
			public void onKeyDown(final KeyDownEvent event) {
				if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
					searchGeocoding(addressTextField.getText());
				}
			}
		});

		horizontalGroup.add(addressTextField);
		horizontalGroup.add(getSearchButton());
		horizontalGroup.add(getW3WLocationButton());
		horizontalGroup.add(getLocationMenuButton());
		panel.setWidget(horizontalGroup);
		panel.setVisible(false);
	}
	return panel;
}
 
Example 6
Source File: GoogleTableDisplayerView.java    From dashbuilder with Apache License 2.0 4 votes vote down vote up
protected HorizontalPanel createTablePager() {
    HorizontalPanel pagerPanel = new HorizontalPanel();
    pagerPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    pagerPanel.getElement().setAttribute("cellpadding", "5");

    Pagination pagination = new Pagination();
    pagination.setPaginationSize(PaginationSize.NONE);

    for (int i = leftMostPageNumber; i <= rightMostPageNumber; i++) {
        AnchorListItem pageLink = new AnchorListItem(Integer.toString(i));
        final Integer _currentPage = i;
        if (currentPage != i) {
            pageLink.setActive(false);
            pageLink.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent event) {
                    getPresenter().gotoPage(_currentPage.intValue());
                }
            });
        } else {
            pageLink.setActive(true);
        }
        pagination.add(pageLink);
    }

    Icon leftPageIcon = new Icon(IconType.ANGLE_LEFT);
    leftPageIcon.setSize(IconSize.LARGE );
    leftPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
    leftPageIcon.sinkEvents(Event.ONCLICK);
    leftPageIcon.addHandler(createGotoPageHandler(currentPage - 1), ClickEvent.getType());
    Tooltip leftPageTooltip = new Tooltip(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoPreviousPage());
    leftPageTooltip.add(leftPageIcon);

    Icon rightPageIcon = new Icon(IconType.ANGLE_RIGHT);
    rightPageIcon.setSize(IconSize.LARGE);
    rightPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
    rightPageIcon.sinkEvents(Event.ONCLICK);
    rightPageIcon.addHandler(createGotoPageHandler(currentPage + 1), ClickEvent.getType());
    Tooltip rightPageTooltip = new Tooltip( GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoNextPage() );
    rightPageTooltip.add(rightPageIcon);

    Icon firstPageIcon = new Icon(IconType.ANGLE_DOUBLE_LEFT);
    firstPageIcon.setSize(IconSize.LARGE);
    firstPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
    firstPageIcon.sinkEvents(Event.ONCLICK);
    firstPageIcon.addHandler(createGotoPageHandler(1), ClickEvent.getType());
    Tooltip firstPageTooltip = new Tooltip(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoFirstPage());
    firstPageTooltip.add(firstPageIcon);

    Icon lastPageIcon = new Icon(IconType.ANGLE_DOUBLE_RIGHT);
    lastPageIcon.setSize(IconSize.LARGE);
    lastPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
    lastPageIcon.sinkEvents(Event.ONCLICK);
    lastPageIcon.addHandler(createGotoPageHandler(totalPages), ClickEvent.getType());
    Tooltip lastPageTooltip = new Tooltip(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoLastPage());
    lastPageTooltip.add(lastPageIcon);

    pagerPanel.add(firstPageTooltip);
    pagerPanel.add(leftPageTooltip);
    pagerPanel.add(pagination);
    pagerPanel.add(rightPageTooltip);
    pagerPanel.add(lastPageTooltip);

    if (totalPagesHintEnabled) {
        pagerPanel.add(new Label(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_pages(
                Integer.toString(leftMostPageNumber),
                Integer.toString(rightMostPageNumber),
                Integer.toString(totalPages))));
    }
    if (totalRowsHintEnabled) {
        int currentRowsShown = currentPage * pageSize > totalRows ? totalRows : currentPage * pageSize;
        pagerPanel.add(new Label(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_rows(
                Integer.toString(((currentPage - 1) * pageSize) + 1),
                Integer.toString(currentRowsShown),
                Integer.toString(totalRows))));
    }
    return pagerPanel;
}