Example usage for com.google.gwt.user.client.ui FlexTable getFlexCellFormatter

List of usage examples for com.google.gwt.user.client.ui FlexTable getFlexCellFormatter

Introduction

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

Prototype

public FlexCellFormatter getFlexCellFormatter() 

Source Link

Document

Explicitly gets the FlexCellFormatter .

Usage

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

License:Open Source License

public void showResults(StimulusResponseGroup stimuliGroup, GroupScoreData calculatedScores) {
    int columnCount = calculatedScores.getScoreDataList().get(0).getColourData().size();
    int row = 0;//from   w  w  w .ja v  a 2 s .  c o  m
    final FlexTable grid = new FlexTable();
    grid.setStylePrimaryName("resultsTablePanel");
    final Label titleLabel = new Label(stimuliGroup.getGroupLabel());
    titleLabel.setStylePrimaryName("resultsTableTitle");
    grid.setWidget(0, 0, titleLabel);
    grid.getFlexCellFormatter().setColSpan(0, 0, columnCount + 1);
    row++;
    for (ScoreData scoreData : calculatedScores.getScoreDataList()) {
        for (int column = 0; column < columnCount; column++) {
            final Label label = new Label(scoreData.getStimulus().getLabel());
            final ColourData colour = scoreData.getColourData().get(column);
            if (colour == null) {
                label.getElement().setAttribute("style", "color: grey;background: none;");
            } else {
                String foreground = (colour.getRed() + colour.getGreen() + colour.getBlue() > 128 * 3)
                        ? "#A9A9A9"
                        : "#D3D3D3";
                label.getElement().setAttribute("style",
                        "background:" + foreground + ";color:rgb(" + colour.getRed() + "," + colour.getGreen()
                                + "," + colour.getBlue() + "); padding:5px;");
            }
            grid.setWidget(row, column, label);
        }
        if (scoreData.getDistance() != null) {
            final HorizontalPanel bargraphOuter = new HorizontalPanel();
            final HorizontalPanel bargraphInner = new HorizontalPanel();
            bargraphOuter.setPixelSize(100, 10);
            bargraphInner.setPixelSize((int) (100.0 / 6 * scoreData.getDistance()), 10);
            bargraphOuter.setStyleName("bargraphOuter");
            bargraphInner.setStyleName("bargraphInner");
            bargraphOuter.add(bargraphInner);
            grid.setWidget(row, columnCount, bargraphOuter);
        }
        row++;
    }
    outerPanel.add(grid);
}

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

License:Open Source License

public void showResults(StimuliGroup stimuliGroup, GroupScoreData calculatedScores) {
    int columnCount = calculatedScores.getScoreDataList().get(0).getColourData().size();
    int row = 0;/*from  ww w  . jav  a  2 s. c  o  m*/
    final FlexTable grid = new FlexTable();
    grid.setStylePrimaryName("resultsTablePanel");
    final Label titleLabel = new Label(stimuliGroup.getGroupLabel());
    titleLabel.setStylePrimaryName("resultsTableTitle");
    grid.setWidget(0, 0, titleLabel);
    grid.getFlexCellFormatter().setColSpan(0, 0, columnCount + 1);
    row++;
    for (ScoreData scoreData : calculatedScores.getScoreDataList()) {
        for (int column = 0; column < columnCount; column++) {
            final Label label = new Label(scoreData.getStimulus().getValue());
            final ColourData colour = scoreData.getColourData().get(column);
            if (colour == null) {
                label.getElement().setAttribute("style", "color: grey;background: none;");
            } else {
                String foreground = (colour.getRed() + colour.getGreen() + colour.getBlue() > 128 * 3)
                        ? "#A9A9A9"
                        : "#D3D3D3";
                label.getElement().setAttribute("style", "background:" + foreground + ";color:rgb("
                        + colour.getRed() + "," + colour.getGreen() + "," + colour.getBlue() + ")");
            }
            grid.setWidget(row, column, label);
        }
        if (scoreData.getDistance() != null) {
            final HorizontalPanel bargraphOuter = new HorizontalPanel();
            final HorizontalPanel bargraphInner = new HorizontalPanel();
            bargraphOuter.setPixelSize(100, 10);
            bargraphInner.setPixelSize((int) (100.0 / 6 * scoreData.getDistance()), 10);
            bargraphOuter.setStyleName("bargraphOuter");
            bargraphInner.setStyleName("bargraphInner");
            bargraphOuter.add(bargraphInner);
            grid.setWidget(row, columnCount, bargraphOuter);
        }
        row++;
    }
    outerPanel.add(grid);
}

From source file:org.apache.hupa.client.mvp.LoginView.java

License:Apache License

@Inject
public LoginView(HupaConstants constants) {

    VerticalPanel mainContainer = new VerticalPanel();
    RndPanel rPanel = new RndPanel();
    FlexTable flexTable = new FlexTable();
    Panel buttonBar = new FlowPanel();
    submitButton = new SubmitButton(constants.loginButton());
    resetButton = new Button(constants.resetButton());
    submitButton.getElement().setClassName(HupaCSS.C_button);
    resetButton.getElement().setClassName(HupaCSS.C_button);
    submitButton.getElement().setClassName(resetButton.getElement().getClassName());
    loading = new Loading(constants.loading());

    mainContainer.setStyleName(HupaCSS.C_login_container);
    flexTable.addStyleName(HupaCSS.C_login_form);
    usernameTextBox.addStyleName(HupaCSS.C_login_box);
    passwordTextBox.addStyleName(HupaCSS.C_login_box);

    buttonBar.add(submitButton);//from  w w w . j a v a2s . c om
    buttonBar.add(resetButton);

    flexTable.setText(0, 0, constants.usernameLabel());
    flexTable.setWidget(0, 1, usernameTextBox);
    flexTable.setText(1, 0, constants.passwordLabel());
    flexTable.setWidget(1, 1, passwordTextBox);
    flexTable.getFlexCellFormatter().setColSpan(2, 0, 2);
    flexTable.setWidget(2, 0, buttonBar);

    rPanel.add(formPanel);
    formPanel.add(flexTable);
    mainContainer.add(rPanel);
    mainContainer.add(loading);
    initWidget(mainContainer);

    usernameTextBox.addKeyUpHandler(this);
    usernameTextBox.setFocus(true);
    passwordTextBox.addKeyUpHandler(this);

    loading.hide();

    // The user submits the form so as the browser detect it and displays
    // the save password dialog. Then we click on the hidden loginButton which
    // stores the presenter clickHandler.
    formPanel.addSubmitHandler(new FormPanel.SubmitHandler() {
        public void onSubmit(SubmitEvent event) {
            if (!usernameTextBox.getValue().trim().isEmpty() && !passwordTextBox.getValue().trim().isEmpty()) {
                loginButton.click();
            }
            //                event.cancel();
        }
    });
    // loginButton must be in the document to handle the click() method
    mainContainer.add(loginButton);
    loginButton.setVisible(false);
}

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

License:Apache License

public LoginDialog(final OpenTrader session) {
    super(false, true);

    setAnimationEnabled(true);/*from  ww w.  j av a 2s .  c o  m*/
    this.session = session;

    final FlexTable table = new FlexTable();
    final HTML header = new HTML("&nbsp;&nbsp;Welcome to OpenTrader&nbsp;&nbsp;");
    final Label label = new Label("Please enter name:");
    DOM.setStyleAttribute(label.getElement(), "textAlign", "right");
    final TextBox traderName = new TextBox();
    traderName.setText("OpenTrader");
    final Button enter = new Button("Enter");

    addStyleName("login");
    table.addStyleName("login");
    label.addStyleName("login");
    header.addStyleName("login-caption");

    table.setWidget(0, 0, header);
    table.setWidget(2, 0, label);
    table.setWidget(2, 1, traderName);
    table.setWidget(4, 1, enter);
    table.getFlexCellFormatter().setColSpan(0, 0, 2);

    enter.setEnabled(true);
    traderName.setFocus(true);

    enter.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            if (traderName.getText().trim().length() == 0) {
                MessageBox.alert("Trader's name must not be empty.");
                return;
            }
            hide();
            ProgressMonitor.showProgress("Connecting to OpenTrader Server...");
            session.getService().login(traderName.getText(), new LoginCallback());
        }
    });
    setWidget(table);
}

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);/*from  w  ww  .  ja va 2  s  . co  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.bonitasoft.console.client.view.categories.CategoryEditorPanel.java

License:Open Source License

public CategoryEditorPanel(CategoryDataSource categoryDataSource, CategoryUUID categoryUUID) {
    super();//from  ww w  . j av  a  2  s  .c  o m
    this.myCategoryDataSource = categoryDataSource;
    if (categoryUUID != null) {
        this.myCategory = categoryDataSource.getItem(categoryUUID);
    }
    FlowPanel myOuterPanel = new FlowPanel();
    FlexTable myCategoryEditor = new FlexTable();

    if (this.myCategory == null) {
        myCategoryNameTextBox.setValue("");
        myCategoryNameTextBox.setEnabled(true);
        myPreviewCSSStyle = LabelModel.DEFAULT_PREVIEW_CSS;
        myCSSStyle = LabelModel.DEFAULT_READONLY_CSS;
    } else {
        myCategoryNameTextBox.setValue(myCategory.getName());
        myCategoryNameTextBox.setEnabled(false);
        if (myCategory.getPreviewCSSStyleName() == null) {
            myPreviewCSSStyle = LabelModel.DEFAULT_PREVIEW_CSS;
        } else {
            myPreviewCSSStyle = myCategory.getPreviewCSSStyleName();
        }

        if (myCategory.getCSSStyleName() == null) {
            myCSSStyle = LabelModel.DEFAULT_READONLY_CSS;
        } else {
            myCSSStyle = myCategory.getCSSStyleName();
        }
    }

    myColorPicker = new Image(PICTURE_PLACE_HOLDER);
    myColorPicker.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent aEvent) {
            if (myCssStyleSelectorWidget == null) {
                myCssStyleSelectorWidget = new CSSStyleSelectorWidget();
                myCssStyleSelectorWidget.setStyleSelectionListener(new StyleSelectionListener() {

                    public void notifySelectionChange(String aEditableCSSStyle, String aPreviewCSSStyle,
                            String aReadOnlyCSSStyle) {
                        myPreviewCSSStyle = aPreviewCSSStyle;
                        myCSSStyle = aReadOnlyCSSStyle;
                        updateColorPickerStyle();
                        // hide the popup
                        myCssStyleSelectorWidget.hide();
                    }

                });
            }
            // Reposition the popup relative to the button
            Widget source = (Widget) aEvent.getSource();
            int left = source.getAbsoluteLeft();
            int top = source.getAbsoluteTop() + getOffsetHeight();
            myCssStyleSelectorWidget.setPopupPosition(left, top);

            // Show the popup
            myCssStyleSelectorWidget.show();
        }
    });
    myColorPickerContainer = new DecoratorPanel();
    myColorPickerContainer.add(myColorPicker);
    updateColorPickerStyle();

    int theRow = 0;
    myCategoryEditor.setWidget(theRow, 0, myErrorMessageLabel);
    myCategoryEditor.getFlexCellFormatter().setColSpan(theRow, 0, 3);

    theRow++;
    myCategoryEditor.setWidget(theRow, 0, categoryNameLabel);
    myCategoryEditor.getFlexCellFormatter().setStyleName(theRow, 0, "identity_form_label");
    myCategoryNameTextBox.setStyleName("category_dialog_input");
    myCategoryEditor.setWidget(theRow, 1, myCategoryNameTextBox);
    myCategoryEditor.setHTML(theRow, 2, constants.mandatorySymbol());

    theRow++;
    myCategoryEditor.setHTML(theRow, 0, constants.categoryColor());
    myCategoryEditor.getFlexCellFormatter().setStyleName(theRow, 0, "identity_form_label");
    myCategoryNameTextBox.setStyleName("category_dialog_input");
    myCategoryEditor.setWidget(theRow, 1, myColorPickerContainer);

    FlowPanel buttonPanel = new FlowPanel();
    mySaveButton.setStyleName("identity_form_button");
    buttonPanel.add(mySaveButton);
    mySaveButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            if (myCategory == null) {
                create();
            } else {
                update();
            }
        }
    });
    myCancelButton.setStyleName("identity_form_button");
    buttonPanel.add(myCancelButton);
    buttonPanel.setStyleName("identity_form_button_group");
    myCategoryEditor.setWidget(4, 0, buttonPanel);
    myCategoryEditor.getFlexCellFormatter().setColSpan(4, 0, 3);
    myOuterPanel.add(myCategoryEditor);
    initWidget(myOuterPanel);
}

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

License:Open Source License

private FlexTable buildContent() {
    FlexTable thePanel = new FlexTable();

    thePanel.setWidget(0, 0, myErrorMessageLabel);
    thePanel.getFlexCellFormatter().setStyleName(0, 0, CSSClassManager.VALIDATION_ERROR_MESSAGE);
    thePanel.getFlexCellFormatter().setColSpan(0, 0, 3);

    myInternalItemDataSource.setItemFilter(myItemFilter);
    CategoriesListWidget myItemList = new CategoriesListWidget(null, myInternalItemDataSource) {

        @Override// w  w w .j  ava 2  s.c om
        protected void initView() {
            myMinimalSize = 10;
            myMaximalSize = 50;
            super.initView();
            if (myBottomNavBar.getWidgetCount() == 2) {
                myBottomNavBar.remove(1);
            }
        }

        @Override
        public void notifyItemClicked(CategoryUUID anItem, ClickEvent anEvent) {
            // Modify item selection.
            if (anItem != null) {
                final Cell theCell = myInnerTable.getCellForEvent(anEvent);
                if (theCell != null) {
                    final int theCellIndex = theCell.getCellIndex();
                    if (theCellIndex != 0) {
                        if (mySelectionIsMultiple) {
                            if (myItemSelection.getSelectedItems().contains(anItem)) {
                                myItemSelection.removeItemFromSelection(anItem);
                            } else {
                                myItemSelection.addItemToSelection(anItem);
                            }
                        } else {
                            if (!myItemSelection.getSelectedItems().contains(anItem)) {
                                myItemSelection.clearSelection();
                                myItemSelection.addItemToSelection(anItem);
                            } else {
                                myItemSelection.clearSelection();
                            }
                        }
                    } else {
                        // The check box has already inserted the item into the selection.
                        if (mySelectionIsMultiple) {
                            // Nothing to do here.
                        } else {
                            if (myItemSelection.getSize() > 1) {
                                // I have to solve the inconsistency here.
                                myItemSelection.clearSelection();
                                myItemSelection.addItemToSelection(anItem);
                            }
                        }
                    }
                }
            }
        }

        @Override
        protected FlowPanel buildTopNavBar() {
            final FlowPanel theResult = new FlowPanel();
            final Label theRefreshLink = new Label(constants.refresh());
            theRefreshLink.setStyleName(CSSClassManager.LINK_LABEL);
            theRefreshLink.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent aEvent) {
                    myBonitaDataSource.reload();
                }
            });
            theResult.add(theRefreshLink);
            return theResult;
        }

        @Override
        protected FlowPanel buildBottomNavBar() {
            final FlowPanel theResult = new FlowPanel();

            final CustomMenuBar theActionMenu = new CustomMenuBar();
            theActionMenu.addItem(constants.add(), new Command() {
                public void execute() {
                    setSelectedItems(myItemSelection);
                }

            });
            theActionMenu.addItem(constants.cancel(), new Command() {
                public void execute() {
                    cancel();
                }
            });

            theResult.add(theActionMenu);
            return theResult;
        }
    };
    thePanel.setWidget(2, 0, myItemList);
    thePanel.getFlexCellFormatter().setColSpan(2, 0, 3);

    return thePanel;
}

From source file:org.bonitasoft.console.client.view.CSSStyleSelectorWidget.java

License:Open Source License

/**
 * /*from  www.j  a v  a 2 s .c  o  m*/
 * Default constructor.
 * 
 * @param aLabelDataSource
 * @param aLabelModel
 */
public CSSStyleSelectorWidget() {
    super();
    FlexTable theOuterPanel = new FlexTable();
    Label theLabel;
    DecoratorPanel theContainer;
    theLabel = new Label(TITLE_LABEL_KEY);
    theOuterPanel.setWidget(0, 0, theLabel);
    theOuterPanel.getFlexCellFormatter().setColSpan(0, 0, 4);

    if (editableCSSClassName.length != readonlyCSSClassName.length
            || editableCSSClassName.length != previewCSSClassName.length) {
        Window.alert("Invalid list of CSS style definitions in class LabelStyleSelectorWidget!");
    }

    int theRow = 1;
    int theCol = 0;
    for (int i = 0; i < editableCSSClassName.length; i++) {
        theContainer = new DecoratorPanel();
        theLabel = new Label(B_CHARACTER);
        theContainer.add(theLabel);
        theContainer.setStylePrimaryName(previewCSSClassName[i] + CONTAINER_CSS_SUFFIX);
        theLabel.setStyleName(previewCSSClassName[i]);
        theLabel.addClickHandler(new StyleClickHandler(editableCSSClassName[i], previewCSSClassName[i],
                readonlyCSSClassName[i]));
        theOuterPanel.setWidget(theRow, theCol, theContainer);
        // Go to a new line every 4 choices.
        if (theCol == 3) {
            theRow++;
            theCol = 0;
        } else {
            theCol++;
        }
    }

    this.add(theOuterPanel);
    // Set the auto hide feature.
    setAutoHideEnabled(true);
}

From source file:org.bonitasoft.console.client.view.identity.ContactInfoEditorPanel.java

License:Open Source License

private FlexTable buildContent() {
    FlexTable thePanel = new FlexTable();
    thePanel.setWidget(0, 1, errorMessageLabel);
    thePanel.getFlexCellFormatter().setStyleName(0, 1, "identity_form_mandatory");
    thePanel.getFlexCellFormatter().setColSpan(0, 1, 2);

    thePanel.setWidget(1, 0, myEmailLabel);
    thePanel.getFlexCellFormatter().setStyleName(1, 0, "bos_user_editor_identity_form_label");
    myEmailTextBox.setStyleName("identity_form_input");
    thePanel.setWidget(1, 1, myEmailTextBox);
    //    thePanel.setWidget(1, 2, new Label(constants.mandatorySymbol()));

    thePanel.setWidget(2, 0, myPhoneLabel);
    thePanel.getFlexCellFormatter().setStyleName(2, 0, "bos_user_editor_identity_form_label");
    myPhoneTextBox.setStyleName("identity_form_input");
    thePanel.setWidget(2, 1, myPhoneTextBox);

    thePanel.setWidget(3, 0, myMobileLabel);
    thePanel.getFlexCellFormatter().setStyleName(3, 0, "bos_user_editor_identity_form_label");
    myMobileTextBox.setStyleName("identity_form_input");
    thePanel.setWidget(3, 1, myMobileTextBox);

    thePanel.setWidget(4, 0, myFaxLabel);
    thePanel.getFlexCellFormatter().setStyleName(4, 0, "bos_user_editor_identity_form_label");
    myFaxTextBox.setStyleName("identity_form_input");
    thePanel.setWidget(4, 1, myFaxTextBox);

    thePanel.setWidget(5, 0, myWebsiteLabel);
    thePanel.getFlexCellFormatter().setStyleName(5, 0, "bos_user_editor_identity_form_label");
    myWebsiteTextBox.setStyleName("identity_form_input");
    thePanel.setWidget(5, 1, myWebsiteTextBox);

    thePanel.setWidget(6, 0, myRoomLabel);
    thePanel.getFlexCellFormatter().setStyleName(6, 0, "bos_user_editor_identity_form_label");
    myRoomTextBox.setStyleName("identity_form_input");
    thePanel.setWidget(6, 1, myRoomTextBox);

    thePanel.setWidget(7, 0, myBuildingLabel);
    thePanel.getFlexCellFormatter().setStyleName(7, 0, "bos_user_editor_identity_form_label");
    myBuildingTextBox.setStyleName("identity_form_input");
    thePanel.setWidget(7, 1, myBuildingTextBox);

    thePanel.setWidget(8, 0, myAddressLabel);
    thePanel.getFlexCellFormatter().setStyleName(8, 0, "bos_user_editor_identity_form_label");
    myAddressTextBox.setStyleName("identity_form_input");
    thePanel.setWidget(8, 1, myAddressTextBox);

    thePanel.setWidget(9, 0, myCityLabel);
    thePanel.getFlexCellFormatter().setStyleName(9, 0, "bos_user_editor_identity_form_label");
    myCityTextBox.setStyleName("identity_form_input");
    thePanel.setWidget(9, 1, myCityTextBox);

    thePanel.setWidget(10, 0, myZipLabel);
    thePanel.getFlexCellFormatter().setStyleName(10, 0, "bos_user_editor_identity_form_label");
    myZipTextBox.setStyleName("identity_form_input");
    thePanel.setWidget(10, 1, myZipTextBox);

    thePanel.setWidget(11, 0, myStateLabel);
    thePanel.getFlexCellFormatter().setStyleName(11, 0, "bos_user_editor_identity_form_label");
    myStateTextBox.setStyleName("identity_form_input");
    thePanel.setWidget(11, 1, myStateTextBox);

    thePanel.setWidget(12, 0, myCountryLabel);
    thePanel.getFlexCellFormatter().setStyleName(12, 0, "bos_user_editor_identity_form_label");
    myCountryTextBox.setStyleName("identity_form_input");
    thePanel.setWidget(12, 1, myCountryTextBox);

    return thePanel;
}

From source file:org.bonitasoft.console.client.view.identity.GroupFinderPanel.java

License:Open Source License

private FlexTable buildContent() {
    FlexTable thePanel = new FlexTable();

    thePanel.setWidget(0, 0, myErrorMessageLabel);
    thePanel.getFlexCellFormatter().setStyleName(0, 0, CSSClassManager.VALIDATION_ERROR_MESSAGE);
    thePanel.getFlexCellFormatter().setColSpan(0, 0, 3);

    myInternalItemDataSource.setItemFilter(myItemFilter);
    GroupsListWidget myUserList = new GroupsListWidget(null, myInternalItemDataSource) {

        @Override//w ww .  j  a  v a 2s .  co  m
        protected void initView() {
            myMinimalSize = 10;
            myMaximalSize = 10;
            super.initView();
            if (myBottomNavBar.getWidgetCount() == 2) {
                myBottomNavBar.remove(1);
            }
        }

        /*
         * (non-Javadoc)
         * 
         * @seeorg.bonitasoft.console.client.view.identity.UsersListWidget#
         * getContentRowTooltip()
         */
        @Override
        protected String getContentRowTooltip() {
            return "";
        }

        @Override
        public void notifyItemClicked(BonitaUUID anItem, ClickEvent anEvent) {
            // Modify item selection.
            if (anItem != null) {
                final Cell theCell = myInnerTable.getCellForEvent(anEvent);
                if (theCell != null) {
                    final int theCellIndex = theCell.getCellIndex();
                    if (theCellIndex != 0) {
                        if (mySelectionIsMultiple) {
                            if (myItemSelection.getSelectedItems().contains(anItem)) {
                                myItemSelection.removeItemFromSelection(anItem);
                            } else {
                                myItemSelection.addItemToSelection(anItem);
                            }
                        } else {
                            if (!myItemSelection.getSelectedItems().contains(anItem)) {
                                myItemSelection.clearSelection();
                                myItemSelection.addItemToSelection(anItem);
                            } else {
                                myItemSelection.clearSelection();
                            }
                        }
                    } else {
                        // The check box has already inserted the item into the selection.
                        if (mySelectionIsMultiple) {
                            // Nothing to do here.
                        } else {
                            if (myItemSelection.getSize() > 1) {
                                // I have to solve the inconsistency here.
                                myItemSelection.clearSelection();
                                myItemSelection.addItemToSelection(anItem);
                            }
                        }
                    }
                }
            }
        }

        @Override
        protected FlowPanel buildTopNavBar() {
            final FlowPanel theResult = new FlowPanel();
            final Label theRefreshLink = new Label(constants.refresh());
            theRefreshLink.setStyleName(CSSClassManager.LINK_LABEL);
            theRefreshLink.addClickHandler(new ClickHandler() {
                public void onClick(ClickEvent aEvent) {
                    myBonitaDataSource.reload();
                }
            });
            theResult.add(theRefreshLink);
            return theResult;
        }

        @Override
        protected FlowPanel buildBottomNavBar() {
            final FlowPanel theResult = new FlowPanel();

            final CustomMenuBar theActionMenu = new CustomMenuBar();
            theActionMenu.addItem(constants.add(), new Command() {
                public void execute() {
                    setSelectedItems(myItemSelection);
                }

            });
            theActionMenu.addItem(constants.cancel(), new Command() {
                public void execute() {
                    cancel();
                }
            });

            theResult.add(theActionMenu);
            return theResult;
        }

    };
    thePanel.setWidget(2, 0, myUserList);
    thePanel.getFlexCellFormatter().setColSpan(2, 0, 3);

    return thePanel;
}