Example usage for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE

List of usage examples for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE.

Prototype

VerticalAlignmentConstant ALIGN_MIDDLE

To view the source code for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE.

Click Source Link

Document

Specifies that the widget's contents should be aligned in the middle.

Usage

From source file:com.ephesoft.gxt.core.client.ui.widget.VerticalToolbar.java

License:Open Source License

/**
 * Constructor with the Rotatable Image.
 * //from  w  w  w.  j a v a  2 s.co m
 * @param image {@link RotatableImage}
 */
public VerticalToolbar(final RotatableImage image) {
    super();
    imagePanel = new VerticalPanel();
    imagePanel.addStyleName("overlayPanel");
    imagePanel.addStyleName("overlayPanelInitialView");
    toolbarPanel = new VerticalPanel();
    toolbarPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    // setting swap toolbar button.
    final Button moveToolbarButton = new Button();
    moveToolbarButton.setStyleName(BUTTON_CSS);
    moveToolbarButton.setTitle(LocaleConstants.MOVE_RIGHT);
    moveToolbarButton.addStyleName("btnfirst");
    toolbarPanel.add(moveToolbarButton);

    borderLayoutContainer = new BorderLayoutContainer();
    if (null == image) {
        overlayImage = new RotatableImage();
    } else {
        overlayImage = image;
    }
    imageScrollPanel = new ScrollPanel();
    imageScrollPanel.addStyleName("overlayImageScrollPanel");
    imagePanel.addStyleName("overlayImagePanel");
    imagePanel.add(overlayImage);
    imageScrollPanel.add(imagePanel);
    borderLayoutContainer.setCenterWidget(imageScrollPanel);

    final VerticalPanel toolbarPanelContainer = new VerticalPanel();
    toolbarPanelContainer.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    toolbarPanelContainer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    toolbarPanelContainer.setStyleName(TOOLBAR_CONTAINER_CSS);
    toolbarPanelContainer.add(toolbarPanel);
    final BorderLayoutData regionLayout = new BorderLayoutData(BORDER_LAYOUT_DATA_SIZE);
    borderLayoutContainer.setWestWidget(toolbarPanelContainer, regionLayout);

    final ClickHandler switchToolbar = new ClickHandler() {

        public void onClick(final ClickEvent event) {
            final Widget toolbar = borderLayoutContainer.getEastWidget();
            imagePanel.removeStyleName("overlayPanelInitialView");
            if (null == toolbar) {
                toolbarPanelContainer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
                borderLayoutContainer.setWestWidget(null);
                borderLayoutContainer.setEastWidget(toolbarPanelContainer);
                toolbarPanelContainer.addStyleName("toolbarEast");
                moveToolbarButton.addStyleName("move_toolbar_button_east");
                moveToolbarButton.setTitle(LocaleConstants.MOVE_LEFT);
            } else {
                borderLayoutContainer.setEastWidget(null);
                toolbarPanelContainer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
                borderLayoutContainer.setWestWidget(toolbarPanelContainer);
                toolbarPanelContainer.removeStyleName("toolbarEast");
                moveToolbarButton.removeStyleName("move_toolbar_button_east");
                moveToolbarButton.setTitle(LocaleConstants.MOVE_RIGHT);
            }
            toolbarPanelContainer.add(getToolbaarPanel());
            borderLayoutContainer.forceLayout();
        }
    };
    moveToolbarButton.addClickHandler(switchToolbar);
    initWidget(borderLayoutContainer);
    this.addStyleName("imageOverlayContainer");
}

From source file:com.ephesoft.gxt.uploadbatch.client.view.AssociateBCFView.java

License:Open Source License

public void formatRow(final int row) {
    editTable.getCellFormatter().setWidth(row, 0, CoreCommonConstants._50_PERCENTAGE);
    editTable.getFlexCellFormatter().addStyleName(row, 0, CoreCommonConstants.BOLD_TEXT_CSS);
    editTable.getFlexCellFormatter().setAlignment(row, 0, HasHorizontalAlignment.ALIGN_RIGHT,
            HasVerticalAlignment.ALIGN_MIDDLE);
    // editTable.getCellFormatter().setWidth(row, 1, "1%");
    editTable.getCellFormatter().setWidth(row, 1, CoreCommonConstants._50_PERCENTAGE);
    editTable.getFlexCellFormatter().addStyleName(row, 0, CoreCommonConstants.BOLD_TEXT_CSS);
}

From source file:com.fullmetalgalaxy.client.game.context.MAppContext.java

License:Open Source License

public MAppContext() {
    super();/*  ww  w  .  ja va  2  s.  co m*/

    AppRoot.getEventBus().addHandler(ModelUpdateEvent.TYPE, this);
    VerticalPanel vpanel = new VerticalPanel();
    vpanel.add(m_panelAction);
    vpanel.setCellHorizontalAlignment(m_panelAction, HasHorizontalAlignment.ALIGN_RIGHT);
    HorizontalPanel hpanel = new HorizontalPanel();

    hpanel.add(m_panelExtra);
    hpanel.setCellHeight(m_panelExtra, "100%");
    m_panelExtra.setHeight("100%");
    hpanel.add(m_panelMiniMap);

    vpanel.add(hpanel);

    m_panelAction.add(new WgtContextAction());
    m_panelAction.setStylePrimaryName("fmp-context-action");
    m_panelMiniMap.setStylePrimaryName("fmp-context-minimap");
    m_panelMiniMap.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    m_panelMiniMap.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    // m_panelMiniMap.addStyleName( "transparent50" );
    m_panelExtra.add(new WgtContextExtra());
    m_panelExtra.setStylePrimaryName("fmp-context-extra");
    // m_panelExtra.addStyleName( "transparent50" );

    initWidget(vpanel);
    hpanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
}

From source file:com.fullmetalgalaxy.client.game.context.WgtContextAction.java

License:Open Source License

/**
 * /*from   w  w w  .  j  a  va 2s . co  m*/
 */
public WgtContextAction() {
    m_btnOk.addClickHandler(this);
    m_btnOk.setTitle(MAppBoard.s_messages.validAction());
    m_btnOk.setStyleName("fmp-PushButton32");
    m_btnCancel.addClickHandler(this);
    m_btnCancel.setTitle(MAppBoard.s_messages.cancelAction());
    m_btnCancel.setStyleName("fmp-PushButton32");
    m_btnRepairTurret.addClickHandler(this);
    m_btnRepairTurret.setTitle(MAppBoard.s_messages.repairTurret());
    m_btnRepairTurret.setStyleName("fmp-PushButton32");
    m_btnTakeOff.addClickHandler(this);
    m_btnTakeOff.setTitle(MAppBoard.s_messages.takeOff());
    m_btnTakeOff.setStyleName("fmp-PushButton32");
    m_btnFire.addClickHandler(this);
    m_btnFire.setTitle(MAppBoard.s_messages.fire());
    m_btnFire.setStyleName("fmp-PushButton32");
    m_btnControl.addClickHandler(this);
    m_btnControl.setTitle(MAppBoard.s_messages.control());
    m_btnControl.setStyleName("fmp-PushButton32");
    m_btnFireCoverOn.addClickHandler(this);
    m_btnFireCoverOn.setTitle(MAppBoard.s_messages.displayFireCover());
    m_btnFireCoverOn.setStyleName("fmp-PushButton32");
    m_btnFireCoverOff.addClickHandler(this);
    m_btnFireCoverOff.setTitle(MAppBoard.s_messages.hideFireCover());
    m_btnFireCoverOff.setStyleName("fmp-PushButton32");
    m_btnEndTurn.addClickHandler(this);
    m_btnEndTurn.setTitle(MAppBoard.s_messages.endTurn());
    m_btnEndTurn.setStyleName("fmp-PushButton32");
    m_btnZoomIn.addClickHandler(this);
    m_btnZoomIn.setTitle(MAppBoard.s_messages.tacticalZoom());
    m_btnZoomIn.setStyleName("fmp-PushButton32");
    m_btnZoomOut.addClickHandler(this);
    m_btnZoomOut.setTitle(MAppBoard.s_messages.strategyZoom());
    m_btnZoomOut.setStyleName("fmp-PushButton32");
    m_btnGridOn.addClickHandler(this);
    m_btnGridOn.setTitle(MAppBoard.s_messages.displayGrid());
    m_btnGridOn.setStyleName("fmp-PushButton32");
    m_btnGridOff.addClickHandler(this);
    m_btnGridOff.setTitle(MAppBoard.s_messages.hideGrid());
    m_btnGridOff.setStyleName("fmp-PushButton32");
    m_btnRegister.addClickHandler(this);
    m_btnRegister.setTitle(MAppBoard.s_messages.joinGame());
    m_btnRegister.setStyleName("fmp-PushButton32");
    m_btnPractice.addClickHandler(this);
    m_btnPractice.setTitle(MAppBoard.s_messages.trainningMode());
    m_btnPractice.setStyleName("fmp-PushButton32");
    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.add(new Image(Icons.s_instance.register32()));
    hPanel.add(new Label(MAppBoard.s_messages.joinThisGame()));
    m_pnlRegister = new FocusPanel(hPanel);
    m_pnlRegister.addClickHandler(this);
    hPanel = new HorizontalPanel();
    hPanel.add(new Image(Icons.s_instance.pause32()));
    hPanel.add(new Label(MAppBoard.s_messages.waitGameStarting()));
    m_pnlWait = new FocusPanel(hPanel);
    hPanel = new HorizontalPanel();
    hPanel.add(new Image(Icons.s_instance.takeOff32()));
    hPanel.add(new Label(MAppBoard.s_messages.mustLandFreighter()));
    m_pnlLand = new FocusPanel(hPanel);
    m_pnlLand.addClickHandler(this);
    hPanel = new HorizontalPanel();
    hPanel.add(new Image(Icons.s_instance.takeOff32()));
    hPanel.add(new Label(MAppBoard.s_messages.mustDeployUnits()));
    m_pnlDeploy = new FocusPanel(hPanel);
    m_pnlDeploy.addClickHandler(this);
    hPanel = new HorizontalPanel();
    hPanel.add(new Image(Icons.s_instance.pause32()));
    hPanel.add(new Label(MAppBoard.s_messages.pauseGameAllowNewPlayer()));
    m_pnlPause = new FocusPanel(hPanel);
    hPanel = new HorizontalPanel();
    hPanel.add(new Image(Icons.s_instance.endTurn32()));
    hPanel.add(new Label(MAppBoard.s_messages.mustEndYourTurn()));
    m_pnlEndTurn = new FocusPanel(hPanel);
    m_pnlEndTurn.addClickHandler(this);
    hPanel = new HorizontalPanel();
    hPanel.add(new Image(Icons.s_instance.takeOff32()));
    hPanel.add(new Label(MAppBoard.s_messages.SelectFreighterToTakeOff()));
    m_pnlTakeOff = new FocusPanel(hPanel);
    m_pnlTakeOff.addClickHandler(this);
    hPanel = new HorizontalPanel();
    hPanel.add(new Image(Icons.s_instance.practice32()));
    hPanel.add(new Label(MAppBoard.s_messages.trainningMode()));
    hPanel.add(m_btnPracticeCancel);
    m_btnPracticeCancel.addClickHandler(this);
    hPanel.add(m_btnPracticeOk);
    m_btnPracticeOk.addClickHandler(this);
    m_pnlPractice = new FocusPanel(hPanel);

    m_iconAction.setTitle(MAppBoard.s_messages.costInPA());
    m_lblAction.setStyleName("fmp-status-text");

    // subscribe all needed models update event
    AppRoot.getEventBus().addHandler(ModelUpdateEvent.TYPE, this);

    m_panel.setSize("100%", "100%");
    m_panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    m_panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    initWidget(m_panel);
}

From source file:com.fullmetalgalaxy.client.game.tabmenu.MAppTabMenu.java

License:Open Source License

/**
 * /* w w  w . j a v a  2s .c  om*/
 */
public MAppTabMenu() {
    super();
    m_btnSwitchOff.setStyleName("fmp-tab-switchoff");
    m_btnSwitchOff.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent p_event) {
            closeAllTab();
        }
    });

    m_hPanel.add(m_vTabPanel);
    addTabButton(m_btnWebLinks, "Menu du site web");
    addTabButton(m_btnInfo, "Autre info");
    addTabButton(m_btnMessage, "Messages");
    addTabButton(m_btnPlayer, "Afficher les joueurs");
    addTabButton(m_btnReserve, "Rserve");
    addTabButton(m_btnTime, "Voir l'historique");

    m_vTabPanel.setSize("100%", "100%");
    m_vTabPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    m_vTabPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    m_hPanel.setHeight("100%");
    initWidget(m_hPanel);
    AppMain.getEventBus().addHandler(GameActionEvent.TYPE, this);

    if (GameEngine.model().getGame().getGameType() != GameType.MultiPlayer
            && GameEngine.model().getGame().getGameType() != GameType.Initiation
            && GameEngine.model().getGame().getMessage() != null
            && !GameEngine.model().getGame().getMessage().isEmpty()) {
        openTab(m_btnMessage);
    } else if ((GameEngine.model().getGame().getGameType() == GameType.MultiPlayer
            || GameEngine.model().getGame().getGameType() == GameType.Initiation)
            && GameEngine.model().getMyRegistration() != null && GameEngine.model().getGame()
                    .haveNewMessage(GameEngine.model().getMyRegistration().getLastConnexion())) {
        openTab(m_btnMessage);
    } else {
        openTab(m_btnWebLinks);
        m_hideTimer.schedule(4000);
    }
}

From source file:com.github.gwtbootstrap.client.ui.SimplePager.java

License:Apache License

/**
 * Construct a {@link SimplePager} with the specified resources.
 *
 * @param location/*from  www. ja va  2  s.com*/
 *            the location of the text relative to the buttons
 * @param resources
 *            the {@link Resources} to use
 * @param showFastForwardButton
 *            if true, show a fast-forward button that advances by a larger
 *            increment than a single page
 * @param fastForwardRows
 *            the number of rows to jump when fast forwarding
 * @param showLastPageButton
 *            if true, show a button to go the the last page
 * @param imageButtonConstants
 *            Constants that contain the image button names
 */
public SimplePager(TextLocation location, Resources resources, boolean showFastForwardButton,
        final int fastForwardRows, boolean showLastPageButton, ImageButtonsConstants imageButtonConstants) {
    this.resources = resources;
    this.fastForwardRows = fastForwardRows;
    this.style = this.resources.simplePagerStyle();
    this.style.ensureInjected();

    // Create the buttons.
    firstPage = new Button();
    firstPage.setType(ButtonType.LINK);
    firstPage.setIcon(IconType.FAST_BACKWARD);
    firstPage.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            firstPage();
        }
    });
    firstPageTooltip = new Tooltip(imageButtonConstants.firstPage());
    firstPageTooltip.setWidget(firstPage);
    firstPageTooltip.setPlacement(tooltipPlacement);
    firstPageTooltip.setShowDelay(tooltipDelay);

    nextPage = new Button();
    nextPage.setType(ButtonType.LINK);
    nextPage.setIcon(IconType.STEP_FORWARD);
    nextPage.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            nextPage();
        }
    });
    nextPageTooltip = new Tooltip(imageButtonConstants.nextPage());
    nextPageTooltip.setWidget(nextPage);
    nextPageTooltip.setPlacement(tooltipPlacement);
    nextPageTooltip.setShowDelay(tooltipDelay);

    prevPage = new Button();
    prevPage.setType(ButtonType.LINK);
    prevPage.setIcon(IconType.STEP_BACKWARD);
    prevPage.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            previousPage();
        }
    });
    prevPageTooltip = new Tooltip(imageButtonConstants.prevPage());
    prevPageTooltip.setWidget(prevPage);
    prevPageTooltip.setPlacement(tooltipPlacement);
    prevPageTooltip.setShowDelay(tooltipDelay);

    if (showLastPageButton) {
        lastPage = new Button();
        lastPage.setType(ButtonType.LINK);
        lastPage.setIcon(IconType.FAST_FORWARD);
        lastPage.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                lastPage();
            }
        });
        lastPageTooltip = new Tooltip(imageButtonConstants.lastPage());
        lastPageTooltip.setWidget(lastPage);
        lastPageTooltip.setPlacement(tooltipPlacement);
        lastPageTooltip.setShowDelay(tooltipDelay);
    } else {
        lastPage = null;
        lastPageTooltip = null;
    }
    if (showFastForwardButton) {
        fastForward = new Button();
        fastForward.setType(ButtonType.LINK);
        fastForward.setIcon(IconType.FORWARD);
        fastForward.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                setPage(getPage() + getFastForwardPages());
            }
        });
        fastForwardTooltip = new Tooltip(imageButtonConstants.fastForward());
        fastForwardTooltip.setWidget(fastForward);
        fastForwardTooltip.setPlacement(tooltipPlacement);
        fastForwardTooltip.setShowDelay(tooltipDelay);
    } else {
        fastForward = null;
        fastForwardTooltip = null;
    }

    // Construct the widget.
    HorizontalPanel layout = new HorizontalPanel();
    layout.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    initWidget(layout);
    if (location == TextLocation.LEFT) {
        layout.add(label);
    }
    layout.add(firstPage);
    layout.add(prevPage);
    if (location == TextLocation.CENTER) {
        layout.add(label);
    }
    layout.add(nextPage);
    if (showFastForwardButton) {
        layout.add(fastForward);
    }
    if (showLastPageButton) {
        layout.add(lastPage);
    }

    layout.add(firstPageTooltip);
    layout.add(prevPageTooltip);
    layout.add(nextPageTooltip);
    if (showFastForwardButton) {
        layout.add(fastForwardTooltip);
    }
    if (showLastPageButton) {
        layout.add(lastPageTooltip);
    }

    if (location == TextLocation.RIGHT) {
        layout.add(label);
    }

    // Add style names to the cells.
    firstPage.getElement().getParentElement().addClassName(style.button());
    prevPage.getElement().getParentElement().addClassName(style.button());
    label.getElement().getParentElement().addClassName(style.pageDetails());
    nextPage.getElement().getParentElement().addClassName(style.button());
    if (showFastForwardButton) {
        fastForward.getElement().getParentElement().addClassName(style.button());
    }
    if (showLastPageButton) {
        lastPage.getElement().getParentElement().addClassName(style.button());
    }

    // Disable the buttons by default.
    setDisplay(null);
}

From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.AbstractMenuDialog.java

License:Open Source License

/**
 * Add two widgets to a horizontal panel
 * @param leftWidget//w w  w.  j  ava 2s .co  m
 * @param rightWidget
 * @return the horizontal panel containing both widgets
 */
protected HorizontalPanel createHorizontalHolder(Widget leftWidget, Widget rightWidget) {
    HorizontalPanel hpanel = new HorizontalPanel();
    hpanel.setSpacing(10);
    hpanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hpanel.add(leftWidget);
    hpanel.add(rightWidget);
    return hpanel;
}

From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.DeleteProjectDialogWidget.java

License:Open Source License

private HorizontalPanel createHorizontalHolder(Widget leftWidget, Widget rightWidget) {
    HorizontalPanel hpanel = new HorizontalPanel();
    hpanel.setSpacing(10);/*w w w  . j  av a 2 s  .c o m*/
    hpanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hpanel.add(leftWidget);
    hpanel.add(rightWidget);
    return hpanel;
}

From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.git.GitCommitLocalChangesDialogWidget.java

License:Open Source License

/**
 * Helper Method to add two widgets to a horizontal panel
 * TODO Refactor To Utility Class//  w  w w . j a  v a 2  s.c o m
 * @param leftWidget
 * @param rightWidget
 * @return
 */
private HorizontalPanel createHorizontalHolder(Widget leftWidget, Widget rightWidget) {
    HorizontalPanel hpanel = new HorizontalPanel();
    hpanel.setSpacing(10);
    hpanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hpanel.add(leftWidget);
    hpanel.add(rightWidget);
    return hpanel;
}

From source file:com.google.appinventor.client.Ode.java

License:Open Source License

/**
 * Creates, visually centers, and optionally displays the dialog box
 * that informs the user how to start learning about using App Inventor
 * or create a new project./* www  .  j a v a2 s.c  om*/
 * @param showDialog Convenience variable to show the created DialogBox.
 * @return The created and optionally displayed Dialog box.
 */
public DialogBox createNoProjectsDialog(boolean showDialog) {
    // Create the UI elements of the DialogBox
    final DialogBox dialogBox = new DialogBox(true, false); //DialogBox(autohide, modal)
    dialogBox.setStylePrimaryName("ode-DialogBox");
    dialogBox.setText(MESSAGES.createNoProjectsDialogText());

    Grid mainGrid = new Grid(2, 2);
    mainGrid.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER,
            HasVerticalAlignment.ALIGN_MIDDLE);
    mainGrid.getCellFormatter().setAlignment(0, 1, HasHorizontalAlignment.ALIGN_CENTER,
            HasVerticalAlignment.ALIGN_MIDDLE);
    mainGrid.getCellFormatter().setAlignment(1, 1, HasHorizontalAlignment.ALIGN_RIGHT,
            HasVerticalAlignment.ALIGN_MIDDLE);

    Image dialogImage = new Image(Ode.getImageBundle().androidGreenSmall());

    Grid messageGrid = new Grid(2, 1);
    messageGrid.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_JUSTIFY,
            HasVerticalAlignment.ALIGN_MIDDLE);
    messageGrid.getCellFormatter().setAlignment(1, 0, HasHorizontalAlignment.ALIGN_LEFT,
            HasVerticalAlignment.ALIGN_MIDDLE);

    Label messageChunk1 = new HTML(MESSAGES.createNoProjectsDialogMessage1());

    messageChunk1.setWidth("23em");
    Label messageChunk2 = new Label(MESSAGES.createNoprojectsDialogMessage2());

    // Add the elements to the grids and DialogBox.
    messageGrid.setWidget(0, 0, messageChunk1);
    messageGrid.setWidget(1, 0, messageChunk2);
    mainGrid.setWidget(0, 0, dialogImage);
    mainGrid.setWidget(0, 1, messageGrid);

    dialogBox.setWidget(mainGrid);
    dialogBox.center();

    if (showDialog) {
        dialogBox.show();
    }

    return dialogBox;
}