Example usage for com.google.gwt.user.client.ui ListBox ListBox

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

Introduction

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

Prototype

protected ListBox(Element element) 

Source Link

Document

This constructor may be used by subclasses to explicitly use an existing element.

Usage

From source file:ar.com.kyol.jet.client.JetCombo.java

License:Open Source License

/**
 * A disabled JetCombo with a "Cargando" unique item. It will be enabled again when add or addAll is called.
 * @param hasSelectedItem - if true, adds "Seleccione..." as first item.
 * @param descriptor - the property to display in the combo box
 * @param isMultipleSelect - if true, makes the combo as multiple select.
 *//* w  ww  .ja  v a 2  s. c  o m*/
public JetCombo(String descriptor, boolean hasSelectedItem, boolean isMultipleSelect) {
    listBox = new ListBox(isMultipleSelect);
    this.hasSeleccioneItem = hasSelectedItem;
    this.cargando = true;
    initGetter(descriptor);
    listBox.addItem("Cargando...", "");
    listBox.setEnabled(false);

    registerChangeHandler();

    initWidget(listBox);
}

From source file:asquare.gwt.tk.uitest.popuppanel.client.Demo.java

License:Apache License

private Widget createTransparencyTest() {
    RowPanel outer = new RowPanel();
    BasicToolTip toolTip = new BasicToolTip();
    Controller ttController = new BasicToolTipController(toolTip);

    outer.add(new HTML("<h3>Popup transparency</h3><p>Hover over a widget</p>"));

    ListBox list = new ListBox(true);
    list.setVisibleItemCount(4);//from   w  ww . j a v  a 2 s  . c  om
    list.addItem("ListBox");
    list.addItem("1");
    list.addItem("2");
    list.addItem("3");
    list.addItem("4");
    list.addItem("5");
    outer.add(new ToolTipWrapper(list, "Popup transparency over a ListBox").addController(ttController));

    outer.add(new ToolTipWrapper(new Frame("FrameContents.html"), "Popup transparency over a Frame")
            .addController(ttController));

    outer.add(new ToolTipWrapper(new RadioButton("radioGroup", "RadioButton a"), "Choice a")
            .addController(ttController));
    outer.add(new ToolTipWrapper(new RadioButton("radioGroup", "RadioButton b"), "Choice b")
            .addController(ttController));
    outer.add(new ToolTipWrapper(new RadioButton("radioGroup", "RadioButton c"), "Choice c")
            .addController(ttController));
    return outer;
}

From source file:com.agnie.useradmin.main.client.ui.DomainReadView.java

License:Open Source License

@Inject
public DomainReadView(RolesManager appRolesManager, RolesManager ctxRolesManager, DomainEditView dev) {
    this.dev = dev;
    this.appRolesManager = appRolesManager;
    this.ctxRolesManager = ctxRolesManager;
    initWidget(uiBinder.createAndBindUi(this));
    editPencilImgsVisible(false);//from   w w w. j  av  a  2  s .  com

    defAppRolesList = new ListBox(true);
    defAppRolesCont.add(defAppRolesList);

    defContextRolesList = new ListBox(true);
    defContextRolesCont.add(defContextRolesList);

    editPopUp = new DialogBox(I18.messages.editDomain(), dev);
    editPopUp.addCloseHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            editPopUp.hide();
        }
    });

    appRolesManager.getCancelBtn().addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            popUpPan.hide();
        }
    });

    appRolesManager.getUpdateBtn().addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            presenter.updateDefAppRoles(DomainReadView.this.appRolesManager.getSelUnsel().getSelected());
        }
    });

    ctxRolesManager.getCancelBtn().addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            popUpPan.hide();
        }
    });

    ctxRolesManager.getUpdateBtn().addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            presenter.updateDefCTXRoles(DomainReadView.this.ctxRolesManager.getSelUnsel().getSelected());
        }
    });
}

From source file:com.appspot.socialinquirer.client.view.XmppSettingsViewImpl.java

License:Apache License

/**
 * Instantiates a new xmpp settings view impl.
 *
 * @param oracle the oracle/*  w ww  . j a  va2  s  .  co m*/
 */
public XmppSettingsViewImpl(SingleWordSuggestOracle oracle) {
    showRelatedMode = new ListBox(false);
    translateMode = new ListBox(false);
    textToSpeechMode = new ListBox(false);
    summarizeMode = new ListBox(false);
    spellCheckMode = new ListBox(false);
    grammarCheckMode = new ListBox(false);
    for (ReplyMode mode : ReplyMode.values()) {
        showRelatedMode.addItem(mode.value(), mode.name());
        translateMode.addItem(mode.value(), mode.name());
        textToSpeechMode.addItem(mode.value(), mode.name());
        summarizeMode.addItem(mode.value(), mode.name());
    }
    for (CheckMode mode : CheckMode.values()) {
        spellCheckMode.addItem(mode.value(), mode.name());
        grammarCheckMode.addItem(mode.value(), mode.name());
    }

    identifyingTags = new SuggestBox(oracle);
    initWidget(uiBinder.createAndBindUi(this));
    advancedOptions.setAnimationEnabled(true);
}

From source file:com.cognitivemedicine.metricsdashboard.client.dashboard.DashboardMainPanel.java

License:Apache License

private void initUi() {
    mainPanel = new VerticalPanel();
    mainPanel.setWidth("300px");
    mainPanel.setSpacing(4);//  w w w . ja  va2  s . c o  m

    VerticalPanel titlePanel = new VerticalPanel();
    titlePanel.setWidth("100%");
    HorizontalPanel logoutPanel = new HorizontalPanel();
    Image logoutImage = new Image(MdConstants.IMG_LOGOUT);
    logoutImage.getElement().getStyle().setCursor(Cursor.POINTER);
    logoutImage.setSize("16px", "16px");
    logoutImage.setTitle("Log Out");
    logoutImage.getElement().getStyle().setProperty("cursor", "hand");
    logoutImage.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            controller.logOut();
        }
    });

    HTML logOutLabel = new HTML("<u><font size=-2>Log Out </font></u>");
    logOutLabel.setHeight("10px");
    // logOutLabel.setStyleName("logoutButton");
    logOutLabel.setStylePrimaryName("logoutButton");
    logOutLabel.getElement().getStyle().setProperty("right", "5px");
    // logOutLabel.getElement().getStyle().setProperty("cursor", "hand");
    logOutLabel.getElement().getStyle().setCursor(Cursor.POINTER);
    logOutLabel.setWidth("100%");
    logOutLabel.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            controller.logOut();
        }
    });

    logoutPanel.add(logOutLabel);
    logoutPanel.add(logoutImage);
    logoutPanel.setSpacing(2);

    logoutPanel.setCellHorizontalAlignment(logoutImage, HasHorizontalAlignment.ALIGN_RIGHT);
    logoutPanel.setCellHorizontalAlignment(logOutLabel, HasHorizontalAlignment.ALIGN_RIGHT);

    titlePanel.getElement().getStyle().setProperty("marginLeft", "50");
    titleLabel = new HTML("<font size=4>&nbsp;</font>");
    titleLabel.getElement().setId("dashboardTitleLabel");

    titlePanel.add(logoutPanel);
    titlePanel.add(titleLabel);

    titlePanel.setCellHorizontalAlignment(logoutPanel, HasHorizontalAlignment.ALIGN_RIGHT);

    DecoratorPanel titleDecor = new DecoratorPanel();
    titleDecor.setWidth("250px");
    titleDecor.setHeight("30px");
    mainPanel.add(titlePanel);

    mainPanel.setCellVerticalAlignment(logOutLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    mainPanel.setCellHorizontalAlignment(logOutLabel, HasHorizontalAlignment.ALIGN_RIGHT);
    mainPanel.setCellHorizontalAlignment(titleLabel, HasHorizontalAlignment.ALIGN_LEFT);
    mainPanel.setCellVerticalAlignment(titleLabel, HasVerticalAlignment.ALIGN_MIDDLE);

    Image image = new Image(MdConstants.IMG_TOOLS);
    image.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE);
    adminConsoleButton = new PushButton(image);
    adminConsoleButton.getElement().setId("adminConsoleButton");
    adminConsoleButton.setSize("50px", MdConstants.IMG_SIZE);
    adminConsoleButton.setTitle("Show Admin Console");
    adminConsoleButton.setEnabled(false);
    adminConsoleButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            AdminConsole console = new AdminConsole(controller);
        }
    });

    editorDecorator = new DecoratorPanel();
    editorDecorator.setTitle("Dashboard Editor");
    editorDecorator.setWidth("315px");

    toolstripPanel = new DashboardToolStripBar(this);

    dashboardListBox = new ListBox(false);
    dashboardListBox.getElement().setId("dashboardListBox");
    dashboardListBox.setWidth("295px");
    dashboardListBox.setVisibleItemCount(10);
    dashboardListBox.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            dashboardListChanged();
        }
    });

    notesArea = new TextArea();
    notesArea.setVisibleLines(2);
    notesArea.setWidth("290px");
    notesArea.setHeight("50px");
    notesArea.getElement().setId("notesTextArea");

    VerticalPanel editorVerticalPanel = new VerticalPanel();
    editorVerticalPanel.setSpacing(4);
    editorVerticalPanel.add(toolstripPanel);
    editorVerticalPanel.add(dashboardListBox);
    editorVerticalPanel.add(new HTML("<font size=-1><b>Dashboard Notes:</b></font></br>"));
    editorVerticalPanel.add(notesArea);
    editorVerticalPanel.setCellVerticalAlignment(toolstripPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    editorVerticalPanel.setCellHorizontalAlignment(toolstripPanel, HasHorizontalAlignment.ALIGN_CENTER);
    editorDecorator.setWidget(editorVerticalPanel);

    settingsPanel = new DashboardSettingsPanel(this);

    mainPanel.add(editorDecorator);
    mainPanel.add(settingsPanel);
    // mainPanel.add(adminConsoleButton);

    mainPanel.setCellVerticalAlignment(editorDecorator, HasVerticalAlignment.ALIGN_MIDDLE);
    mainPanel.setCellHorizontalAlignment(editorDecorator, HasHorizontalAlignment.ALIGN_CENTER);
    mainPanel.setCellVerticalAlignment(settingsPanel, HasVerticalAlignment.ALIGN_TOP);
    mainPanel.setCellHorizontalAlignment(settingsPanel, HasHorizontalAlignment.ALIGN_CENTER);
    mainPanel.setCellVerticalAlignment(adminConsoleButton, HasVerticalAlignment.ALIGN_MIDDLE);
    mainPanel.setCellHorizontalAlignment(adminConsoleButton, HasHorizontalAlignment.ALIGN_CENTER);

    this.add(mainPanel);
}

From source file:com.controlj.addon.gwttree.client.TreeOptions.java

License:Open Source License

public void showDialog() {
    VerticalPanel dialogContents = new VerticalPanel();
    dialogContents.setSpacing(4);/*from ww w.  j a  v a  2s. c  o  m*/

    // Add the tree type radio buttons
    RadioButton dynamicChoice = createTreeChoice("treeTypeGroup", "Dynamic Tree", false);
    RadioButton staticChoice = createTreeChoice("treeTypeGroup", "Static Tree", true);
    if (state.isStaticTree)
        staticChoice.setValue(true);
    else
        dynamicChoice.setValue(true);
    dialogContents.add(dynamicChoice);
    dialogContents.add(staticChoice);

    // Add filtering support
    dialogContents.add(new Label("Filter by trend name (leave empty to not filter)"));
    HorizontalPanel sourcesPanel = new HorizontalPanel();
    sourcesPanel.setSpacing(10);
    final ListBox sourceListBox = new ListBox(true);
    sourceListBox.setSize("10em", "5em");
    for (String sourceName : state.sourceNames)
        sourceListBox.addItem(sourceName);
    sourcesPanel.add(sourceListBox);
    VerticalPanel sourcesButtonPanel = new VerticalPanel();
    sourcesButtonPanel.add(new Button("Add...", new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            final TextBox textBox = new TextBox();
            Dialog.showInputDialog("Add Filter", textBox, new Dialog.Handler() {
                @Override
                public void setupButtons(final Button ok, final Button cancel) {
                    textBox.addKeyPressHandler(new KeyPressHandler() {
                        @Override
                        public void onKeyPress(KeyPressEvent keyPressEvent) {
                            if (keyPressEvent.getCharCode() == (char) 13)
                                ok.click();
                            else if (keyPressEvent.getCharCode() == (char) 27)
                                cancel.click();
                        }
                    });
                }

                @Override
                public void dialogClosed(boolean wasCancelled) {
                    String name = textBox.getText().trim();
                    if (!wasCancelled && !name.isEmpty()) {
                        state.sourceNames.add(name);
                        sourceListBox.addItem(name);
                    }
                }
            });
            textBox.setFocus(true);
        }
    }));
    sourcesButtonPanel.add(new Button("Remove", new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            int count = sourceListBox.getItemCount();
            for (int i = count - 1; i >= 0; i--)
                if (sourceListBox.isItemSelected(i)) {
                    state.sourceNames.remove(sourceListBox.getItemText(i));
                    sourceListBox.removeItem(i);
                }
        }
    }));
    sourcesPanel.add(sourcesButtonPanel);
    dialogContents.add(sourcesPanel);

    final State originalState = state.copy();
    Dialog.showInputDialog("Tree Options", dialogContents, new Dialog.Handler() {
        @Override
        public void setupButtons(Button ok, Button cancel) {
        }

        @Override
        public void dialogClosed(boolean wasCancelled) {
            if (wasCancelled)
                state = originalState;
            else if (!state.equals(originalState))
                handler.optionsChanged(TreeOptions.this);
        }
    });
}

From source file:com.ephesoft.dcma.gwt.admin.bm.client.view.batch.EditBatchClassView.java

License:Open Source License

/**
 * Constructor./*from ww w . j  a  v a 2s . co m*/
 */
public EditBatchClassView() {
    super();
    initWidget(BINDER.createAndBindUi(this));
    saveButton.setText(AdminConstants.OK_BUTTON);
    cancelButton.setText(AdminConstants.CANCEL_BUTTON);
    validateTextBox = new ValidatableWidget<TextBox>(priority);
    role = new ListBox(true);
    validateTextBox.getWidget().addValueChangeHandler(new ValueChangeHandler<String>() {

        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            validateTextBox.toggleValidDateBox();
        }
    });

    validateDescTextBox = new ValidatableWidget<TextBox>(description);
    validateDescTextBox.getWidget().addValueChangeHandler(new ValueChangeHandler<String>() {

        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            validateDescTextBox.toggleValidDateBox();
        }
    });

    nameLabel.setText(
            LocaleDictionary.get().getConstantValue(BatchClassManagementConstants.NAME) + AdminConstants.COLON);
    priorityLabel.setText(LocaleDictionary.get().getConstantValue(BatchClassManagementConstants.PRIORITY)
            + AdminConstants.COLON);
    descLabel.setText(LocaleDictionary.get().getConstantValue(BatchClassManagementConstants.DESCRIPTION)
            + AdminConstants.COLON);
    uncLabel.setText(LocaleDictionary.get().getConstantValue(BatchClassManagementConstants.UNC_FOLDER)
            + AdminConstants.COLON);
    versionLabel.setText(LocaleDictionary.get().getConstantValue(BatchClassManagementConstants.VERSION)
            + AdminConstants.COLON);
    roleLabel.setText(
            LocaleDictionary.get().getConstantValue(BatchClassManagementConstants.ROLE) + AdminConstants.COLON);
    star.setText(AdminConstants.STAR);
    descStar.setText(AdminConstants.STAR);

    nameLabel.setStyleName(AdminConstants.BOLD_TEXT_STYLE);
    priorityLabel.setStyleName(AdminConstants.BOLD_TEXT_STYLE);
    descLabel.setStyleName(AdminConstants.BOLD_TEXT_STYLE);
    uncLabel.setStyleName(AdminConstants.BOLD_TEXT_STYLE);
    versionLabel.setStyleName(AdminConstants.BOLD_TEXT_STYLE);
    roleLabel.setStyleName(AdminConstants.BOLD_TEXT_STYLE);
    star.setStyleName(AdminConstants.FONT_RED_STYLE);
    descStar.setStyleName(AdminConstants.FONT_RED_STYLE);
    listBoxPanel.add(role);
    saveButton.setHeight(AdminConstants.BUTTON_HEIGHT);
    cancelButton.setHeight(AdminConstants.BUTTON_HEIGHT);

    systemFolderLabel
            .setText(LocaleDictionary.get().getConstantValue(BatchClassManagementConstants.SYSTEM_FOLDER)
                    + AdminConstants.COLON);
    systemFolderLabel.setStyleName(AdminConstants.BOLD_TEXT_STYLE);
    systemFolderStar.setText(AdminConstants.STAR);
    systemFolderStar.setStyleName(AdminConstants.FONT_RED_STYLE);

    validateSystemFolderTextBox = new ValidatableWidget<TextBox>(systemFolder);
    validateSystemFolderTextBox.getWidget().addValueChangeHandler(new ValueChangeHandler<String>() {

        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            validateSystemFolderTextBox.toggleValidDateBox();
        }
    });
}

From source file:com.ephesoft.dcma.gwt.admin.bm.client.view.plugin.EditPluginView.java

License:Open Source License

/**
 * To add Multiple Select List Box./*from   w  ww.  j  a  v  a2  s .  c o m*/
 * 
 * @param row int
 * @param sampleValueList List<String>
 * @param MAX_VISIBLE_ITEM_COUNT int
 * @param value String
 * @return ListBox
 */
public ListBox addMultipleSelectListBox(int row, List<String> sampleValueList, int MAX_VISIBLE_ITEM_COUNT,
        String value) {
    ListBox fieldValue = new ListBox(true);
    fieldValue.setVisibleItemCount(MAX_VISIBLE_ITEM_COUNT);
    for (String item : sampleValueList) {
        fieldValue.addItem(item);
    }
    String[] selectedValue = value.split(";");
    for (String string : selectedValue) {
        fieldValue.setItemSelected(sampleValueList.indexOf(string), true);
    }
    return fieldValue;
}

From source file:com.ephesoft.dcma.gwt.batchinstance.client.view.BatchInstanceView.java

License:Open Source License

/**
 * Constructor.//from  w  w  w  .  j a  v a2s .  c  o m
 */
public BatchInstanceView() {
    super();
    initWidget(binder.createAndBindUi(this));
    restartBatchButton = new Button();

    deleteBatchButton = new Button();

    openBatchButton = new Button();

    refreshButtonPanel = new VerticalPanel();

    priorityListBox = new ListBox(Boolean.TRUE);

    batchInstanceListBox = new ListBox(Boolean.TRUE);

    priorityLabel = new Label();

    batchInstanceLabel = new Label();

    searchBatchButton = new Button();

    searchBatchLabel = new Label();

    deleteButtonPanel = new HorizontalPanel();

    searchBatchTextBox = new TextBox();

    refreshButton = new Button();

    restartOptions = new ListBox();

    restartAllButton = new Button();

    deleteAllButton = new Button();

    unlockButton = new Button();

    nextButton = new Button(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.NEXT_TEXT));

    previousButton = new Button(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.PREVIOUS_TEXT));

    unlockButtonPanel = new HorizontalPanel();

    deleteOpenPanel = new VerticalPanel();

    unlockRestartPanel = new VerticalPanel();

    refreshButton.setText(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.BUTTON_REFRESH));
    refreshButton.setWidth(BatchInstanceConstants.BUTTON_WIDTH);
    refreshButton
            .setTitle(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.BUTTON_REFRESH_TOOLTIP));
    refreshButton.addStyleName(CoreCommonConstants.MARGIN_BOTTOM_5_CSS);
    restartAllButton
            .setText(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.BUTTON_RESTART_ALL));
    deleteAllButton.setText(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.BUTTON_DELETE_ALL));
    deleteAllButton
            .setTitle(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.BUTTON_DELETE_TOOLTIP));
    deleteAllButton.setWidth(BatchInstanceConstants.BUTTON_WIDTH);

    unlockButton.setText(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.BUTTON_UNLOCK));
    unlockButton.addStyleName(CoreCommonConstants.MARGIN_BOTTOM_5_CSS);
    unlockButton
            .setTitle(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.BUTTON_UNLOCK_TOOLTIP));
    searchBatchLabel.setText(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.LABEL_SEARCH_BATCH)
            + BatchInstanceConstants.COLON);
    searchBatchButton
            .setText(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.BUTTON_SEARCH_BATCH));
    searchBatchButton.addStyleName(CoreCommonConstants.MARGIN_LEFT_5_CSS);
    restartBatchButton
            .setText(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.BUTTON_RESTART_BATCH));
    restartBatchButton.setTitle(
            LocaleDictionary.get().getConstantValue(BatchInstanceConstants.BUTTON_RESTART_BATCH_TITLE));
    restartBatchButton.addStyleName(CoreCommonConstants.MARGIN_LEFT_5_CSS);
    deleteBatchButton
            .setText(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.BUTTON_DELETE_BATCH));
    deleteBatchButton.addStyleName(CoreCommonConstants.MARGIN_BOTTOM_5_CSS);
    deleteBatchButton.setTitle(
            LocaleDictionary.get().getConstantValue(BatchInstanceConstants.BUTTON_DELETE_BATCH_TOOLTIP));
    openBatchButton.setText(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.BUTTON_OPEN_BATCH));
    openBatchButton
            .setTitle(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.BUTTON_OPEN_BATCH_TITLE));
    openBatchButton.setWidth(CoreCommonConstants._58PX);
    deleteBatchButton.setWidth(CoreCommonConstants._58PX);
    restartAllButton.setWidth(CoreCommonConstants._97PX);
    unlockButton.setWidth(CoreCommonConstants._97PX);
    totalBatchesLabel.setText(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.TOTAL_BATCHES));
    deletedBatchesLabel
            .setText(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.DELETED_BATCHES));
    totalBatchesLabel.addStyleName(CoreCommonConstants.BOLD_TEXT_CSS);
    deletedBatchesLabel.addStyleName(CoreCommonConstants.BOLD_TEXT_CSS);
    searchBatchTextBox.setText(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.SEARCH_CRITERIA));
    searchBatchTextBox.setTitle(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.SEARCH_TYPE));
    batchAlerts.setText(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.BATCH_ALERTS));
    batchInstanceListView = new BatchInstanceListView();
    batchInstanceLayoutPanel.add(batchInstanceListView.listView);
    searchBatchTextBox.setWidth(CoreCommonConstants._120PX);
    batchInstanceControlPanel.addStyleName(CoreCommonConstants.OPTIONS_PANEL);
    batchInstanceControlPanel.addStyleName(CoreCommonConstants.OPTION_PANEL_MARGIN_CSS);
    fillPriorityListBox();
    fillBatchInstanceListBox(batchInstanceListBox);
    setDefaultFilters();
    batchInstanceListPanel.addStyleName("mainPanelLayout");
    topPanelContainer.addStyleName(CoreCommonConstants.TOP_PANEL_CSS);
    searchPanel.addStyleName(BatchInstanceConstants.GRP_PANEL_STYLE_NAME);
    searchPanel.setWidth(CoreCommonConstants._100_PERCENTAGE);
    filterPanel.addStyleName(BatchInstanceConstants.GRP_PANEL_STYLE_NAME);
    filterPanel.setWidth(CoreCommonConstants._100_PERCENTAGE);
    restartPanel.addStyleName(BatchInstanceConstants.GRP_PANEL_STYLE_NAME);
    restartPanel.setWidth(CoreCommonConstants._100_PERCENTAGE);
    deleteButtonPanel.addStyleName(CoreCommonConstants.LAST_GRP_PANEL_CSS);
    unlockButtonPanel.addStyleName(CoreCommonConstants.LAST_GRP_PANEL_CSS);
    filterPanel.add(priorityLabel);
    filterPanel.add(priorityListBox);
    filterPanel.add(batchInstanceLabel);
    filterPanel.add(batchInstanceListBox);

    refreshButtonPanel.add(refreshButton);
    refreshButtonPanel.add(deleteAllButton);

    filterPanel.add(refreshButtonPanel);
    filterPanel.setCellVerticalAlignment(priorityLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    filterPanel.setCellVerticalAlignment(batchInstanceLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    filterPanel.setCellVerticalAlignment(refreshButton, HasVerticalAlignment.ALIGN_MIDDLE);
    filterPanel.setCellVerticalAlignment(deleteAllButton, HasVerticalAlignment.ALIGN_MIDDLE);

    searchPanel.add(searchBatchLabel);
    searchPanel.add(searchBatchTextBox);
    searchPanel.add(searchBatchButton);
    searchPanel.setCellVerticalAlignment(searchBatchLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    searchPanel.setCellVerticalAlignment(searchBatchTextBox, HasVerticalAlignment.ALIGN_MIDDLE);
    searchPanel.setCellVerticalAlignment(searchBatchButton, HasVerticalAlignment.ALIGN_MIDDLE);

    restartPanel.add(restartOptions);
    restartPanel.add(restartBatchButton);
    restartPanel.setCellVerticalAlignment(restartBatchButton, HasVerticalAlignment.ALIGN_MIDDLE);
    restartPanel.setCellVerticalAlignment(restartOptions, HasVerticalAlignment.ALIGN_MIDDLE);

    deleteOpenPanel.add(deleteBatchButton);
    deleteOpenPanel.add(openBatchButton);
    deleteButtonPanel.add(deleteOpenPanel);
    deleteButtonPanel.add(nextButton);
    deleteButtonPanel.setCellVerticalAlignment(deleteBatchButton, HasVerticalAlignment.ALIGN_MIDDLE);
    deleteButtonPanel.setCellVerticalAlignment(nextButton, HasVerticalAlignment.ALIGN_MIDDLE);

    restartAllButton.setEnabled(false);

    unlockRestartPanel.add(unlockButton);
    unlockRestartPanel.add(restartAllButton);
    unlockButtonPanel.add(unlockRestartPanel);
    unlockButtonPanel.add(previousButton);
    unlockButtonPanel.setCellVerticalAlignment(unlockButton, HasVerticalAlignment.ALIGN_MIDDLE);
    unlockButtonPanel.setCellVerticalAlignment(restartAllButton, HasVerticalAlignment.ALIGN_MIDDLE);
    unlockButtonPanel.setCellVerticalAlignment(openBatchButton, HasVerticalAlignment.ALIGN_MIDDLE);
    unlockButtonPanel.setCellVerticalAlignment(previousButton, HasVerticalAlignment.ALIGN_MIDDLE);
    actionPanel.add(deleteButtonPanel);

    controlPanel.setWidth("100%");
    controlPanel.add(unlockButtonPanel);
    controlPanel.setCellHorizontalAlignment(unlockButtonPanel, HasHorizontalAlignment.ALIGN_LEFT);

    batchAlertPanel.setBorderWidth(0);
    setLabelsStyle();
    batchAlerts.setStyleName(CoreCommonConstants.HEADER_BOLD_TEXT_CSS);
    batchInstanceLabel
            .setText(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.LABEL_TABLE_COLUMN_STATUS)
                    + BatchInstanceConstants.COLON);
    priorityLabel
            .setText(LocaleDictionary.get().getConstantValue(BatchInstanceConstants.LABEL_TABLE_COLUMN_PRIORITY)
                    + BatchInstanceConstants.COLON);
    mainLayoutPanel.addStyleName(CoreCommonConstants.MAIN_CONTAINER_CSS);
    priorityListBox.setVisibleItemCount(BatchInstanceConstants.THREE);
    batchInstanceListBox.setVisibleItemCount(BatchInstanceConstants.THREE);
    clearRestartOptions();
    restartOptions.setWidth(CoreCommonConstants._100_PERCENTAGE);
    slidingPanel.setWidget(actionPanel);
    slidingPanel.setVisible(true);

    refreshButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            clearSearchBatchBox();
            presenter.updateTable();

        }
    });

    deleteAllButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent clickEvent) {
            final List<DataFilter> statusFilters = new ArrayList<DataFilter>();

            List<String> selectedBatchInstanceStatus = getBatchInstanceSelected();

            statusFilters.clear();
            boolean isValidSelection = true;
            boolean foundInAllStatusList = false;
            BatchInstanceStatus[] allStatusList = BatchInstanceStatus.values();

            for (String batchInstanceStat : selectedBatchInstanceStatus) {
                for (BatchInstanceStatus batchInstanceStatus : allStatusList) {
                    if (batchInstanceStatus.getId() == Integer.parseInt(batchInstanceStat)) {
                        foundInAllStatusList = true;
                        if (!ActionableStatus.valuesAsString().contains(batchInstanceStatus.name())) {
                            isValidSelection = false;
                            break;
                        }
                    }
                }
            }

            if (!isValidSelection || !foundInAllStatusList) {
                ConfirmationDialogUtil.showConfirmationDialogError(LocaleDictionary.get()
                        .getMessageValue(BatchInstanceMessages.MSG_DELETE_ALL_STATUS_IMPROPER));
            } else {
                if (batchInstanceDTOMap == null || batchInstanceDTOMap.size() == 0) {
                    ConfirmationDialogUtil.showConfirmationDialogError(LocaleDictionary.get()
                            .getMessageValue(BatchInstanceMessages.MSG_DELETE_ALL_NO_RECORD));
                } else {
                    for (String batchInstance : selectedBatchInstanceStatus) {
                        statusFilters.add(new DataFilter(BatchInstanceConstants.STATUS, batchInstance));
                    }
                    List<String> priorities = getPrioritySelected();
                    for (String priority : priorities) {
                        statusFilters.add(new DataFilter(BatchInstanceConstants.PRIORITY, priority));
                    }

                    final ConfirmationDialog confirmationDialog = ConfirmationDialogUtil.showConfirmationDialog(
                            LocaleDictionary.get()
                                    .getMessageValue(BatchInstanceMessages.MSG_DELETE_ALL_CONFIRM),
                            LocaleDictionary.get().getMessageValue(BatchInstanceMessages.MSG_DELETE_ALL_TITLE),
                            false);
                    confirmationDialog.addDialogListener(new DialogListener() {

                        @Override
                        public void onOkClick() {
                            presenter.onDeleteAllBatchButtonClick(statusFilters);
                        }

                        @Override
                        public void onCancelClick() {
                            confirmationDialog.hide();
                        }
                    });
                }
            }

        }
    });

    addButtonHandlers();

    addBoxHandlers();

}

From source file:com.ephesoft.dcma.gwt.core.client.view.MultipleSelectTwoSidedListBox.java

License:Open Source License

public MultipleSelectTwoSidedListBox(HandlerManager eventBus) {
    super();/*from w  ww. j a v  a  2s. co m*/
    initWidget(BINDER.createAndBindUi(this));

    leftHandSideListBox = new ListBox(true);
    rightHandSideListBox = new ListBox(true);

    availableLabel = new Label();
    selectedLabel = new Label();

    /* Add handlers to buttons */

    addUpButtonPressHandler(moveUpButton, rightHandSideListBox);
    addDownButtonPressHandler(moveDownButton, rightHandSideListBox);

    /* Add list to their panels */
    leftHandSideListBoxPanel.add(availableLabel);
    rightHandSideListBoxPanel.add(selectedLabel);

    leftHandSideListBoxPanel.add(leftHandSideListBox);
    rightHandSideListBoxPanel.add(rightHandSideListBox);

    addCSSStyles();
    moveLeftButton.setText(REMOVE);
    moveRightButton.setText(ADD);

    moveUpButton.setText(UP_BUTTON);
    moveDownButton.setText(DOWN_BUTTON);

    leftHandSideListBox.setVisibleItemCount(VISIBLE_COUNT_13);
    rightHandSideListBox.setVisibleItemCount(VISIBLE_COUNT_13);
    this.setEventBus(eventBus);

}