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:next.interfaces.controller.animation.DragController.java

License:Apache License

@Override
public IsWidget getViewContent() {
    XFlexTable panel = new XFlexTable("100%", null);
    panel.addWidgets(new Image("images/icons/simpsonXY.jpg"), null);
    //      panel.setWidth("1000px");
    FlexCellFormatter fcf = panel.getFlexCellFormatter();
    fcf.setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);
    return panel;
}

From source file:next.interfaces.controller.animation.HorizontalController.java

License:Apache License

@Override
public IsWidget getViewContent() {
    XFlexTable panel = new XFlexTable("100%", null);
    panel.addWidgets(new Image("images/icons/wideimg.jpg"), null);
    panel.setWidth("1000px");
    FlexCellFormatter fcf = panel.getFlexCellFormatter();
    fcf.setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);
    return panel;
}

From source file:nl.mpi.tg.eg.experiment.client.view.ColourPickerCanvasView.java

License:Open Source License

public ColourPickerCanvasView() throws CanvasError {
    setStylePrimaryName("stimulusScreen");
    final int clientHeight = Window.getClientHeight();
    final int clientWidth = Window.getClientWidth();
    final int minClient = (clientHeight > clientWidth) ? clientWidth : clientHeight;
    stimulusTextHeight = (int) (minClient * 0.08);
    selectedColourPanelHeight = (int) (minClient * 0.25);
    selectedColourPanelWidth = (int) (minClient * 0.47);
    //        buttonTextHeight = (int) (minClient * 0.05);
    buttonHeight = (int) (minClient * 0.1);
    buttonWidth = (int) (minClient * 0.47);
    stimulusPanel = new VerticalPanel();
    stimulusPanel.addStyleName("stimulusPanel");
    stimulusPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    outerGrid = new Grid(2, 2);
    innerGrid = new Grid(6, 2);
    pickerPanel = new Grid(1, 2);
    progressPanel = new Grid(1, 3);
    progressPanel.setWidth("100%");
    infoButton = new Button();
    infoButton.addStyleName("stimulusHelpButton");
    //        infoButton.getElement().getStyle().setFontSize(buttonTextHeight, Unit.PX);
    selectedColourPanel = new VerticalPanel();
    progressLabel = new Label();
    progressLabel.addStyleName("stimulusProgressLabel");
    mainCanvas = Canvas.createIfSupported();
    hueCanvas = Canvas.createIfSupported();

    if (mainCanvas == null || hueCanvas == null) {
        throw new CanvasError("Failed to create a canvas for the stimulus screen.");
    } else {//  w w  w .  j ava2s  . co m
        pickerPanel.setCellPadding(5);
        pickerPanel.setWidget(0, 0, mainCanvas);
        pickerPanel.setWidget(0, 1, hueCanvas);
        final Label selectedColourLabel = new Label("");
        selectedColourLabel.setHeight(selectedColourPanelHeight + "px");
        selectedColourLabel.setWidth(selectedColourPanelWidth + "px");
        selectedColourPanel.add(selectedColourLabel);
        mainCanvas.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                event.preventDefault();
                setColour(event, mainCanvas, selectedColourPanel);
            }
        });
        hueCanvas.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                event.preventDefault();
                setHue(event, hueCanvas);
                setColour(event, hueCanvas, selectedColourPanel);
            }
        });
        mainCanvas.addTouchStartHandler(new TouchStartHandler() {

            @Override
            public void onTouchStart(TouchStartEvent event) {
                event.preventDefault();
                setColour(event, mainCanvas, selectedColourPanel);
            }
        });
        mainCanvas.addTouchMoveHandler(new TouchMoveHandler() {

            @Override
            public void onTouchMove(TouchMoveEvent event) {
                event.preventDefault();
                setColour(event, mainCanvas, selectedColourPanel);
            }
        });
        mainCanvas.addTouchEndHandler(new TouchEndHandler() {

            @Override
            public void onTouchEnd(TouchEndEvent event) {
                event.preventDefault();
                setColour(event, mainCanvas, selectedColourPanel);
            }
        });
        hueCanvas.addTouchStartHandler(new TouchStartHandler() {

            @Override
            public void onTouchStart(TouchStartEvent event) {
                event.preventDefault();
                setHue(event, hueCanvas);
                setColour(event, hueCanvas, selectedColourPanel);
            }
        });
        hueCanvas.addTouchMoveHandler(new TouchMoveHandler() {

            @Override
            public void onTouchMove(TouchMoveEvent event) {
                event.preventDefault();
                setHue(event, hueCanvas);
                setColour(event, hueCanvas, selectedColourPanel);
            }
        });
        hueCanvas.addTouchEndHandler(new TouchEndHandler() {

            @Override
            public void onTouchEnd(TouchEndEvent event) {
                event.preventDefault();
                setHue(event, hueCanvas);
                setColour(event, hueCanvas, selectedColourPanel);
            }
        });
    }
    progressPanel.setWidget(0, 1, progressLabel);
    progressPanel.setWidget(0, 2, infoButton);
    progressPanel.setStylePrimaryName("headerPanel");
    progressPanel.getColumnFormatter().setWidth(1, "100%");
    addNorth(progressPanel, 50);
    add(outerGrid);
}

From source file:nl.mpi.tg.eg.experiment.client.view.ComplexView.java

License:Open Source License

public void startHorizontalPanel() {
    horizontalPanel = new HorizontalPanel();
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    outerPanel.add(horizontalPanel);//from   w w w  . ja  v a  2  s . c  o m
}

From source file:nl.ru.languageininteraction.synaesthesia.client.view.ColourPickerCanvasView.java

License:Open Source License

public ColourPickerCanvasView() throws CanvasError {
    setStylePrimaryName("stimulusScreen");
    final int clientHeight = Window.getClientHeight();
    final int clientWidth = Window.getClientWidth();
    final int minClient = (clientHeight > clientWidth) ? clientWidth : clientHeight;
    stimulusTextHeight = (int) (minClient * 0.08);
    selectedColourPanelHeight = (int) (minClient * 0.25);
    selectedColourPanelWidth = (int) (minClient * 0.47);
    buttonTextHeight = (int) (minClient * 0.05);
    buttonHeight = (int) (minClient * 0.1);
    buttonWidth = (int) (minClient * 0.47);
    stimulusPanel = new VerticalPanel();
    stimulusPanel.addStyleName("stimulusPanel");
    stimulusPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    outerGrid = new Grid(2, 2);
    innerGrid = new Grid(6, 2);
    pickerPanel = new Grid(1, 2);
    progressPanel = new Grid(1, 2);
    progressPanel.setWidth("100%");
    infoButton = new Button();
    infoButton.addStyleName("stimulusHelpButton");
    infoButton.getElement().getStyle().setFontSize(buttonTextHeight, Unit.PX);
    quitButton = new Button();
    quitButton.addStyleName("stimulusQuitButton");
    quitButton.getElement().getStyle().setFontSize(buttonTextHeight, Unit.PX);
    selectedColourPanel = new VerticalPanel();
    progressLabel = new Label();
    progressLabel.addStyleName("stimulusProgressLabel");
    mainCanvas = Canvas.createIfSupported();
    hueCanvas = Canvas.createIfSupported();

    if (mainCanvas == null || hueCanvas == null) {
        throw new CanvasError("Failed to create a canvas for the stimulus screen.");
    } else {// ww w.  j  a v  a 2  s  .  co  m
        pickerPanel.setCellPadding(5);
        pickerPanel.setWidget(0, 0, mainCanvas);
        pickerPanel.setWidget(0, 1, hueCanvas);
        final Label selectedColourLabel = new Label("");
        selectedColourLabel.setHeight(selectedColourPanelHeight + "px");
        selectedColourLabel.setWidth(selectedColourPanelWidth + "px");
        selectedColourPanel.add(selectedColourLabel);
        mainCanvas.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                event.preventDefault();
                setColour(event, mainCanvas, selectedColourPanel);
            }
        });
        hueCanvas.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                event.preventDefault();
                setHue(event, hueCanvas);
                setColour(event, hueCanvas, selectedColourPanel);
            }
        });
        mainCanvas.addTouchStartHandler(new TouchStartHandler() {

            @Override
            public void onTouchStart(TouchStartEvent event) {
                event.preventDefault();
                setColour(event, mainCanvas, selectedColourPanel);
            }
        });
        mainCanvas.addTouchMoveHandler(new TouchMoveHandler() {

            @Override
            public void onTouchMove(TouchMoveEvent event) {
                event.preventDefault();
                setColour(event, mainCanvas, selectedColourPanel);
            }
        });
        mainCanvas.addTouchEndHandler(new TouchEndHandler() {

            @Override
            public void onTouchEnd(TouchEndEvent event) {
                event.preventDefault();
                setColour(event, mainCanvas, selectedColourPanel);
            }
        });
        hueCanvas.addTouchStartHandler(new TouchStartHandler() {

            @Override
            public void onTouchStart(TouchStartEvent event) {
                event.preventDefault();
                setHue(event, hueCanvas);
                setColour(event, hueCanvas, selectedColourPanel);
            }
        });
        hueCanvas.addTouchMoveHandler(new TouchMoveHandler() {

            @Override
            public void onTouchMove(TouchMoveEvent event) {
                event.preventDefault();
                setHue(event, hueCanvas);
                setColour(event, hueCanvas, selectedColourPanel);
            }
        });
        hueCanvas.addTouchEndHandler(new TouchEndHandler() {

            @Override
            public void onTouchEnd(TouchEndEvent event) {
                event.preventDefault();
                setHue(event, hueCanvas);
                setColour(event, hueCanvas, selectedColourPanel);
            }
        });
    }
    outerGrid.setWidget(0, 0, pickerPanel);
    add(outerGrid);
}

From source file:org.apache.openjpa.trader.client.MatchWindow.java

License:Apache License

public MatchWindow(final OpenTrader session, final Tradable tradable, final List<Match> matches) {
    super(false, true);
    this.session = session;
    setAnimationEnabled(true);/*w  ww.j a  va2 s .c o m*/

    DockPanel panel = new DockPanel();
    panel.setHorizontalAlignment(DockPanel.ALIGN_CENTER);

    final HTML header = new HTML();
    final boolean ask = (tradable instanceof Ask);
    String txt = (matches.isEmpty() ? "No" : "" + matches.size()) + " matching " + (ask ? "Bid" : "Ask")
            + " for " + toString(tradable) + "<br>";
    header.setHTML(txt);
    header.addStyleName("table-caption");

    Button close = new Button(matches.isEmpty() ? "OK" : "Cancel");
    close.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            hide();
        }
    });

    FlexTable body = new FlexTable();
    final RadioButton[] buttons = new RadioButton[matches.size()];
    if (!matches.isEmpty()) {
        for (int i = 0; i < matches.size(); i++) {
            Match match = matches.get(i);
            Tradable t2 = ask ? match.getBid() : match.getAsk();
            Trader cpty = ask ? match.getBid().getBuyer() : match.getAsk().getSeller();
            buttons[i] = new RadioButton("matches");
            buttons[i].setValue(i == 0);
            body.setWidget(i, 0, buttons[i]);
            body.setWidget(i, 1, FormatUtil.formatPrice(t2.getPrice()));
            body.setWidget(i, 2, FormatUtil.formatVolume(t2.getVolume()));
            body.setText(i, 3, " by " + cpty.getName());
        }

        Button act = new Button(ask ? "Sell" : "Buy");
        act.setFocus(true);
        body.setWidget(matches.size() + 1, 1, act);
        act.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                for (int i = 0; i < buttons.length; i++) {
                    if (buttons[i].getValue()) {
                        Match match = matches.get(i);
                        Tradable t = ask ? match.getAsk() : match.getBid();
                        session.getService().trade(match, new TradeCallback(t));
                        hide(true);
                    }
                }
            }
        });
        body.setWidget(matches.size() + 1, 2, close);
    } else {
        body.setWidget(0, 0, new HTML("<p>Open a new browser page and login with a different Trader name<br>"
                + "to create a matching " + (ask ? "Bid" : "Ask") + "<p>"));

        close.setFocus(true);
        body.setWidget(1, 0, close);
        body.getFlexCellFormatter().setAlignment(1, 0, HasHorizontalAlignment.ALIGN_CENTER,
                HasVerticalAlignment.ALIGN_MIDDLE);
    }

    panel.add(header, DockPanel.NORTH);
    panel.add(body, DockPanel.CENTER);
    setWidget(panel);
}

From source file:org.apache.openjpa.trader.client.TradeOrderWindow.java

License:Apache License

public void addHelp(final String url) {
    HelpLink help = new HelpLink(url);
    setWidget(0, 6, help);//w w  w.  j  a v  a2  s  .com
    getCellFormatter().setAlignment(0, 6, HasHorizontalAlignment.ALIGN_RIGHT,
            HasVerticalAlignment.ALIGN_MIDDLE);
}

From source file:org.apache.sling.explorer.client.SlingExplorerApplication.java

License:Apache License

/**
 * Create the title bar at the top of the application.
 *
 * @param constants the constant values to use
 *//*from  w w w  .  ja v  a2  s. c o m*/
private void setupTitlePanel(ExplorerConstants constants) {
    // Get the title from the internationalized constants
    String pageTitle = "<h1>" + constants.mainTitle() + "</h1><h2>" + constants.mainSubTitle() + "</h2>";

    // Add the title and some images to the title bar
    HorizontalPanel titlePanel = new HorizontalPanel();
    titlePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    titlePanel.add(images.explorerLogo().createImage());
    titlePanel.add(new HTML(pageTitle));
    explorerPage.setTitleWidget(titlePanel);
}

From source file:org.bonitasoft.console.client.view.cases.AbstractCaseEditorWidget.java

License:Open Source License

protected void buildHeader() {
    myHeader.setStylePrimaryName("case_editor_header");
    myHeader.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    myHeader.add(myStarWidgetContainer);
    if (myConfiguration == null || myConfiguration.isStarEnabled()) {
        myStarWidgetContainer.add(new StarWidget(myLabelDataSource, myCase));
    }/*from ww  w . ja va  2  s .co m*/
    final HorizontalPanel theWrapper = new HorizontalPanel();
    theWrapper.add(new LabelViewer(myLabelDataSource, myCase, true));
    theWrapper.add(new CategoryViewer(myCase.getProcessUUID(), myProcessDataSource, myCategoryDataSource));
    myHeader.add(theWrapper);
}

From source file:org.bonitasoft.console.client.view.categories.CategoryViewer.java

License:Open Source License

/**
 * Default constructor./*  w w  w  . ja va  2  s . c  o  m*/
 * 
 * @param aDataSource
 * @param aCaseItem
 * @param isDeletable
 */
public CategoryViewer(final BonitaProcessUUID aProcessUUID, final ProcessDataSource aProcessDataSource,
        final CategoryDataSource aCategoryDataSource) {

    myProcessUUID = aProcessUUID;
    myProcessDataSource = aProcessDataSource;
    myCategoryDataSource = aCategoryDataSource;

    // Create an empty horizontal panel to layout. It will be filled in
    // later.
    myOuterPanel = new HorizontalPanel();
    myOuterPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    myOuterPanel.setSpacing(5);
    myOuterPanel.setStyleName("label_viewer_readonly");

    myProcessDataSource.getItem(myProcessUUID, new AsyncHandler<BonitaProcess>() {
        public void handleFailure(Throwable aT) {

        }

        public void handleSuccess(BonitaProcess aResult) {
            myProcess = aResult;
            myProcess.addModelChangeListener(BonitaProcess.CATEGORIES_PROPERTY, CategoryViewer.this);

            final List<String> theCategories = myProcess.getCategoriesName();
            myCategoryDataSource.getVisibleItemsByName(theCategories, new AsyncHandler<List<Category>>() {
                public void handleFailure(Throwable aT) {
                    myCategoryTable.clear();
                    fillInTable();
                }

                public void handleSuccess(List<Category> aResult) {
                    myCategoryTable.clear();
                    for (Category theCategory : aResult) {
                        theCategory.addModelChangeListener(Category.CSS_CLASS_NAME_PROPERTY,
                                CategoryViewer.this);
                        myCategoryTable.put(theCategory.getUUID(), buildCategoryTable(theCategory));
                    }

                    fillInTable();
                }
            });
        }
    });

    initWidget(myOuterPanel);
}