Example usage for com.google.gwt.user.client.ui HorizontalPanel setCellVerticalAlignment

List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setCellVerticalAlignment

Introduction

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

Prototype

public void setCellVerticalAlignment(IsWidget w, VerticalAlignmentConstant align) 

Source Link

Document

Overloaded version for IsWidget.

Usage

From source file:org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.ActionValueEditor.java

License:Apache License

private Widget wrap(Widget w) {
    HorizontalPanel wrapper = new HorizontalPanel();
    Image clear = DroolsGuvnorImages.INSTANCE.DeleteItemSmall();
    clear.setAltText(Constants.INSTANCE.RemoveActionValueDefinition());
    clear.setTitle(Constants.INSTANCE.RemoveActionValueDefinition());
    clear.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            //Reset Constraint's value and value type
            if (Window.confirm(Constants.INSTANCE.RemoveActionValueDefinitionQuestion())) {
                value.setNature(FieldNature.TYPE_UNDEFINED);
                value.setValue(null);/*from www . j a  v  a 2 s.  c  o m*/
                doTypeChosen();
            }
        }

    });

    wrapper.add(w);
    wrapper.add(clear);
    wrapper.setCellVerticalAlignment(clear, HasVerticalAlignment.ALIGN_MIDDLE);
    return wrapper;
}

From source file:org.drools.guvnor.client.asseteditor.drools.modeldriven.ui.ConstraintValueEditor.java

License:Apache License

private Widget wrap(Widget w) {
    HorizontalPanel wrapper = new HorizontalPanel();
    Image clear = DroolsGuvnorImages.INSTANCE.DeleteItemSmall();
    clear.setTitle(Constants.INSTANCE.RemoveConstraintValueDefinition());
    clear.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            //Reset Constraint's value and value type
            if (Window.confirm(Constants.INSTANCE.RemoveConstraintValueDefinitionQuestion())) {
                constraint.setConstraintValueType(BaseSingleFieldConstraint.TYPE_UNDEFINED);
                constraint.setValue(null);
                constraint.clearParameters();
                constraint.setExpressionValue(new ExpressionFormLine());
                doTypeChosen();/*from   ww w  . j  a v  a  2  s  .  c o m*/
            }
        }

    });

    wrapper.add(w);
    wrapper.add(clear);
    wrapper.setCellVerticalAlignment(clear, HasVerticalAlignment.ALIGN_MIDDLE);
    return wrapper;
}

From source file:org.drools.workbench.screens.guided.rule.client.editor.ActionValueEditor.java

License:Apache License

private Widget wrap(Widget w) {
    HorizontalPanel wrapper = new HorizontalPanel();
    Image clear = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
    clear.setAltText(GuidedRuleEditorResources.CONSTANTS.RemoveActionValueDefinition());
    clear.setTitle(GuidedRuleEditorResources.CONSTANTS.RemoveActionValueDefinition());
    clear.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            //Reset Constraint's value and value type
            if (Window.confirm(GuidedRuleEditorResources.CONSTANTS.RemoveActionValueDefinitionQuestion())) {
                value.setNature(FieldNatureType.TYPE_UNDEFINED);
                value.setValue(null);//from w ww . j  a v a 2s. c o  m
                doTypeChosen();
            }
        }

    });

    wrapper.add(w);
    if (!this.readOnly) {
        wrapper.add(clear);
        wrapper.setCellVerticalAlignment(clear, HasVerticalAlignment.ALIGN_MIDDLE);
    }
    return wrapper;
}

From source file:org.drools.workbench.screens.guided.rule.client.editor.ConstraintValueEditor.java

License:Apache License

private Widget wrap(Widget widget) {
    if (this.readOnly) {
        return widget;
    }/*from  www  .  j a  v a 2s . c  o  m*/
    HorizontalPanel wrapper = new HorizontalPanel();
    Image clear = GuidedRuleEditorImages508.INSTANCE.DeleteItemSmall();
    clear.setTitle(GuidedRuleEditorResources.CONSTANTS.RemoveConstraintValueDefinition());
    clear.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            //Reset Constraint's value and value type
            if (Window.confirm(GuidedRuleEditorResources.CONSTANTS.RemoveConstraintValueDefinitionQuestion())) {
                constraint.setConstraintValueType(BaseSingleFieldConstraint.TYPE_UNDEFINED);
                constraint.setValue(null);
                constraint.clearParameters();
                constraint.setExpressionValue(new ExpressionFormLine());
                doTypeChosen();
            }
        }

    });

    wrapper.add(widget);
    if (!this.readOnly) {
        wrapper.add(clear);
        wrapper.setCellVerticalAlignment(clear, HasVerticalAlignment.ALIGN_MIDDLE);
    }
    return wrapper;
}

From source file:org.freemedsoftware.gwt.client.screen.DashboardScreenNew.java

License:Open Source License

protected HorizontalPanel createHeaderPanel() {
    final HorizontalPanel headerHPanel = new HorizontalPanel();
    headerHPanel.setWidth("100%");
    //Adding quick text on top left corner

    final HorizontalPanel refreshDashBoardHPanel = new HorizontalPanel();
    refreshDashBoardHPanel.setWidth("100%");
    headerHPanel.add(refreshDashBoardHPanel);

    final HorizontalPanel refreshDashBoardSubHPanel = new HorizontalPanel();
    refreshDashBoardHPanel.add(refreshDashBoardSubHPanel);

    final Label lastUpdateLabel = new Label("Last updated on " + Util.getTodayDate());
    refreshDashBoardSubHPanel.add(lastUpdateLabel);
    refreshDashBoardSubHPanel.setCellVerticalAlignment(lastUpdateLabel, HasVerticalAlignment.ALIGN_MIDDLE);

    final CustomButton refreshDashBoardBtn = new CustomButton("Refresh", AppConstants.ICON_REFRESH);
    refreshDashBoardBtn.getElement().setAttribute("style", "float:right");
    refreshDashBoardSubHPanel.add(refreshDashBoardBtn);
    refreshDashBoardHPanel.setCellHorizontalAlignment(refreshDashBoardSubHPanel,
            HasHorizontalAlignment.ALIGN_RIGHT);

    refreshDashBoardBtn.addClickHandler(new ClickHandler() {

        @Override/* w  ww.  j a v  a2 s  .c om*/
        public void onClick(ClickEvent arg0) {
            // TODO Auto-generated method stub
            lastUpdateLabel.setText("Last updated on " + Util.getTodayDate());
            clearView();
            loadWidgets();
            reloadDashboard();
        }

    });

    return headerHPanel;
}

From source file:org.freemedsoftware.gwt.client.widget.AccordionPanel.java

License:Open Source License

public String getHeader(String title) {

    FlexTable flexTable = new FlexTable();
    flexTable.setWidth("100%");
    flexTable.setCellPadding(0);/*from w  w  w  . j  av a 2  s  . co  m*/
    flexTable.setCellSpacing(0);

    ///start creating top strip
    flexTable.getRowFormatter().setStyleName(0, "stackItemTop");
    HTML html = new HTML();
    html.setStyleName("stackItemTopLeftInner");
    flexTable.setWidget(0, 0, html);
    flexTable.getCellFormatter().setStyleName(0, 0, "stackItemTopLeft");
    html = new HTML();
    html.setStyleName("stackItemTopCenterInner");
    flexTable.setWidget(0, 1, html);
    flexTable.getCellFormatter().setStyleName(0, 1, "stackItemTopCenter");
    html = new HTML();
    html.setStyleName("stackItemTopRightInner");
    flexTable.setWidget(0, 2, html);
    flexTable.getCellFormatter().setStyleName(0, 2, "stackItemTopRight");

    ///stop creating top strip      

    //start creating main heading strip

    flexTable.getRowFormatter().setStyleName(0, "stackItemMiddle");
    html = new HTML();
    html.setStyleName("stackItemMiddleLeftInner");
    flexTable.setWidget(1, 0, html);
    flexTable.getCellFormatter().setStyleName(1, 0, "stackItemMiddleLeft");

    HorizontalPanel headerHPanel = new HorizontalPanel();
    headerHPanel.setWidth("100%");
    HTML innerHTML = new HTML(title);
    innerHTML.setStyleName("stackPanelHeader");
    headerHPanel.add(innerHTML);
    headerHPanel.setCellHorizontalAlignment(innerHTML, HasHorizontalAlignment.ALIGN_CENTER);
    headerHPanel.setCellVerticalAlignment(innerHTML, HasVerticalAlignment.ALIGN_MIDDLE);
    html = new HTML(headerHPanel.toString());
    html.setStyleName("stackItemMiddleCenterInner");
    flexTable.getCellFormatter().setStyleName(1, 1, "stackItemMiddleCenter");
    flexTable.setWidget(1, 1, html);

    html = new HTML();
    html.setStyleName("stackItemMiddleRightInner");
    flexTable.setWidget(1, 2, html);
    flexTable.getCellFormatter().setStyleName(1, 2, "stackItemMiddleRight");

    //stop creating main heading strip

    return flexTable.toString();
}

From source file:org.freemedsoftware.gwt.client.widget.ClosableTab.java

License:Open Source License

public ClosableTab(String labelText, Widget w, ClosableTabInterface cTI) {
    // Store in namespace where we can see it later
    widget = w;//from   w  ww.ja va  2s.  c  om
    closableTabInterface = cTI;

    final HorizontalPanel panel = new HorizontalPanel();
    initWidget(panel);

    final Label label = new Label(labelText);
    label.setStyleName(AppConstants.STYLE_LABEL_TAB);
    panel.add(label);
    panel.setTitle(labelText);
    panel.setCellHorizontalAlignment(label, HasHorizontalAlignment.ALIGN_LEFT);
    panel.setCellVerticalAlignment(label, HasVerticalAlignment.ALIGN_TOP);

    final Image image = new Image();
    image.setUrl("resources/images/close_x.16x16.png");

    // Create spacer
    panel.add(new HTML(" "));

    panel.add(image);
    panel.setCellVerticalAlignment(image, HasVerticalAlignment.ALIGN_TOP);
    panel.setCellHorizontalAlignment(image, HasHorizontalAlignment.ALIGN_RIGHT);

    image.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent evt) {
            boolean goodToGo = true;
            // If we have a ClosableTabInterface, make sure it's ready to
            // die
            if (closableTabInterface != null) {
                goodToGo = closableTabInterface.isReadyToClose();
            }
            if (goodToGo) {
                if (closableTabInterface != null) {
                    closableTabInterface.onClose();
                }
                TabPanel t = ((TabPanel) widget.getParent().getParent().getParent());
                t.selectTab(t.getWidgetIndex(widget) - 1);
                widget.removeFromParent();

                // If we're dealing with PatientScreen, remove from mapping
                if (widget instanceof ScreenInterface) {
                    ScreenInterface screen = (ScreenInterface) widget;
                    screen.closeScreen();
                }
            }
        }
    });
}

From source file:org.gss_project.gss.web.client.TopPanel.java

License:Open Source License

/**
 * The constructor for the top panel.//from  www  .ja  v a 2  s  .com
 *
 * @param images the supplied images
 */
public TopPanel(Images images) {
    fileMenu = new FileMenu(images);
    editMenu = new EditMenu(images);
    groupMenu = new GroupMenu(images);
    settingsMenu = new SettingsMenu(images);
    helpMenu = new HelpMenu(images);
    loading = new LoadingIndicator(images);
    HorizontalPanel outer = new HorizontalPanel();

    outer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    menu = new MenuBar();
    menu.setWidth("100%");
    menu.setAutoOpen(false);
    menu.setAnimationEnabled(true);
    menu.setStyleName("toolbarmenu");

    Command quitCommand = new Command() {
        @Override
        public void execute() {
            QuitDialog dlg = new QuitDialog();
            dlg.center();
        }
    };
    MenuItem quitItem = new MenuItem("<table style='font-size: 100%'><tr><td>"
            + AbstractImagePrototype.create(images.exit()).getHTML() + "</td><td>Quit</td></tr></table>", true,
            quitCommand);
    quitItem.getElement().setId("topMenu.quit");

    MenuItem fileItem = new MenuItem("<table style='font-size: 100%'><tr><td>"
            + AbstractImagePrototype.create(images.folder()).getHTML() + "</td><td>File</td></tr></table>",
            true, new MenuBar(true)) {
        @Override
        public MenuBar getSubMenu() {
            return fileMenu.createMenu();
        }
    };
    fileItem.getElement().setId("topMenu.file");

    MenuItem editItem = new MenuItem("<table style='font-size: 100%'><tr><td>"
            + AbstractImagePrototype.create(images.edit()).getHTML() + "</td><td>Edit</td></tr></table>", true,
            new MenuBar(true)) {
        @Override
        public MenuBar getSubMenu() {
            return editMenu.createMenu();
        }
    };
    editItem.getElement().setId("topMenu.edit");

    MenuItem groupItem = new MenuItem("<table style='font-size: 100%'><tr><td>"
            + AbstractImagePrototype.create(images.group()).getHTML() + "</td><td>Group</td></tr></table>",
            true, groupMenu.getContextMenu());
    groupItem.getElement().setId("topMenu.group");

    MenuItem configureItem = new MenuItem("<table style='font-size: 100%'><tr><td>"
            + AbstractImagePrototype.create(images.configure()).getHTML()
            + "</td><td>Settings</td></tr></table>", true, settingsMenu.getContextMenu());
    configureItem.getElement().setId("topMenu.settings");

    MenuItem helpItem = new MenuItem("<table style='font-size: 100%'><tr><td>"
            + AbstractImagePrototype.create(images.help()).getHTML() + "</td><td>Help</td></tr></table>", true,
            new MenuBar(true)) {
        @Override
        public MenuBar getSubMenu() {
            return helpMenu.createMenu();
        }
    };
    helpItem.getElement().setId("topMenu.help");

    menu.addItem(quitItem);
    menu.addItem(fileItem);
    menu.addItem(editItem);
    menu.addItem(groupItem);
    menu.addItem(configureItem);
    menu.addItem(helpItem);

    outer.setSpacing(2);
    outer.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    outer.setCellVerticalAlignment(menu, HasVerticalAlignment.ALIGN_MIDDLE);
    outer.add(menu);
    outer.setStyleName("toolbar");

    outer.add(loading);

    HTML logos = new HTML("<table><tr><td><a href='http://pithos.grnet.gr' target='gss'>"
            + AbstractImagePrototype.create(images.gssLogo()).getHTML() + "</a><a href='http://www.grnet.gr/' "
            + "target='grnet'>" + AbstractImagePrototype.create(images.grnetLogo()).getHTML()
            + "</a></td></tr></table>");
    outer.add(logos);

    outer.setCellHorizontalAlignment(logos, HasHorizontalAlignment.ALIGN_RIGHT);

    initWidget(outer);
}

From source file:org.gwm.client.impl.AbstractIconBar.java

License:Apache License

public void addFrame(GFrame gframe) {
    DefaultGFrame frame = (DefaultGFrame) (gframe);
    HorizontalPanel icon = new HorizontalPanel();

    HorizontalPanel iconLayout = new HorizontalPanel();
    icon.setStyleName(getItemTheme(frame, "DeskTop-MinimizedFrameBar"));
    Label label = new Label(frame.getCaption());
    label.setStyleName(getItemTheme(gframe, "Frame-TopBar-minimized"));
    Label restoreButton = new Label("");
    restoreButton.setStyleName(getItemTheme(gframe, "Frame-TopBar-RestoreButton"));

    Image titleIcon = frame.getTitleIcon();
    if (titleIcon != null) {
        iconLayout.add(titleIcon);//from  w  ww  .  ja v a 2  s  .  co  m
        iconLayout.setCellVerticalAlignment(titleIcon, HasVerticalAlignment.ALIGN_MIDDLE);
    }
    iconLayout.add(label);
    icon.add(iconLayout);
    icon.add(restoreButton);
    buttonFrame.put(restoreButton, frame);
    buttonIcon.put(restoreButton, icon);
    buttonByFrame.put(frame, restoreButton);
    iconByFrame.put(frame, icon);
    addMinimizedWindow(icon);
    restoreButton.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            GFrame myFrame = (GFrame) buttonFrame.get(sender);
            parent.deIconify(myFrame);
        }
    });
}

From source file:org.jboss.errai.bus.client.util.BusErrorDialog.java

License:Apache License

public BusErrorDialog(final ClientMessageBusImpl clientMessageBus) {
    hide();//from  ww w . j  a va  2 s.  c  o m
    setModal(false);

    final VerticalPanel panel = new VerticalPanel();

    final HorizontalPanel titleBar = new HorizontalPanel();
    titleBar.getElement().getStyle().setProperty("backgroundColor", "#A9A9A9");
    titleBar.getElement().getStyle().setWidth(100, Style.Unit.PCT);
    titleBar.getElement().getStyle().setProperty("borderBottom", "1px solid black");
    titleBar.getElement().getStyle().setProperty("marginBottom", "5px");

    final Label titleBarLabel = new Label("An Error Occurred in the Bus");
    titleBarLabel.getElement().getStyle().setFontSize(10, Style.Unit.PT);
    titleBarLabel.getElement().getStyle().setFontWeight(Style.FontWeight.BOLDER);
    titleBarLabel.getElement().getStyle().setColor("white");

    titleBar.add(titleBarLabel);
    titleBar.setCellVerticalAlignment(titleBarLabel, HasVerticalAlignment.ALIGN_MIDDLE);

    final HorizontalPanel buttonPanel = new HorizontalPanel();

    final CheckBox showFurtherErrors = new CheckBox();
    showFurtherErrors.setValue(showErrors);
    showFurtherErrors.setText("Show further errors");
    showFurtherErrors.getElement().getStyle().setFontSize(10, Style.Unit.PT);
    showFurtherErrors.getElement().getStyle().setColor("white");

    showFurtherErrors.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(final ValueChangeEvent<Boolean> booleanValueChangeEvent) {
            showErrors = booleanValueChangeEvent.getValue();
        }
    });

    final Button disconnectFromServer = new Button("Disconnect Bus");
    disconnectFromServer.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            if (Window.confirm(
                    "Are you sure you want to disconnect and de-federate the local bus from the server bus? "
                            + "This will permanently kill your session. You will need to refresh to reconnect. OK will proceed. Click "
                            + "Cancel to abort this operation")) {
                clientMessageBus.stop(true);
            }
        }
    });

    final Button clearErrors = new Button("Clear Log");
    clearErrors.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            contentPanel.clear();
        }
    });

    final Button closeButton = new Button("Dismiss Error");
    closeButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(final ClickEvent event) {
            BusErrorDialog.this.hide();
        }
    });

    buttonPanel.add(showFurtherErrors);
    buttonPanel.add(disconnectFromServer);
    buttonPanel.add(clearErrors);
    buttonPanel.add(closeButton);

    buttonPanel.setCellVerticalAlignment(showFurtherErrors, HasVerticalAlignment.ALIGN_MIDDLE);

    titleBar.add(buttonPanel);
    titleBar.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_RIGHT);

    panel.add(titleBar);

    final Style s = panel.getElement().getStyle();

    s.setProperty("border", "1px");
    s.setProperty("borderStyle", "solid");
    s.setProperty("borderColor", "black");
    s.setProperty("backgroundColor", "#ede0c3");

    resize();

    panel.add(contentPanel);
    add(panel);

    getElement().getStyle().setZIndex(16777271);
}