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

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

Introduction

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

Prototype

public Button() 

Source Link

Document

Creates a button with no caption.

Usage

From source file:com.education.lessons.ui.client.login.utils.WebDialog.java

License:Open Source License

public Button getCloseButton() {
    if (closeButton == null) {
        closeButton = new Button();
        closeButton.addStyleName("closeButton");
        closeButton.addStyleName(css.closeButton());
        closeButton.addClickHandler(new ClickHandler() {

            @Override// w  w w .ja  va  2  s  .  c o  m
            public void onClick(ClickEvent event) {
                hide();
            }
        });
    }

    return closeButton;
}

From source file:com.eduworks.gwt.client.pagebuilder.PageAssembler.java

License:Apache License

/** preserves event handlers on element to be wrapped */
public static Widget elementToWidget(Element e, String typ) {
    Widget result = null;/* w  ww .j a v a2  s .  co m*/
    if (e != null) {
        int eventsSunk = DOM.getEventsSunk(e);
        EventListener el = DOM.getEventListener(e);
        if (typ == TEXT)
            result = TextBox.wrap(e);
        else if (typ == TEXT_AREA)
            result = TextArea.wrap(e);
        else if (typ == PASSWORD)
            result = PasswordTextBox.wrap(e);
        else if (typ == LABEL)
            result = Label.wrap(e);
        else if (typ == A)
            result = Anchor.wrap(e);
        else if (typ == IMAGE)
            result = Image.wrap(e);
        else if (typ == SELECT)
            result = ListBox.wrap(e);
        else if (typ == HIDDEN)
            result = Hidden.wrap(e);
        else if (typ == FILE)
            result = FileUpload.wrap(e);
        else if (typ == FORM)
            result = FormPanel.wrap(e, true);
        else if (typ == FRAME)
            result = Frame.wrap(e);
        else if (typ == SUBMIT)
            result = SubmitButton.wrap(e);
        else if (typ == BUTTON)
            result = Button.wrap(e);
        else if (typ == CHECK_BOX)
            result = SimpleCheckBox.wrap(e);
        DOM.sinkEvents(e, eventsSunk);
        DOM.setEventListener(e, el);
    } else {
        if (typ == TEXT)
            result = new TextBox();
        else if (typ == TEXT_AREA)
            result = new TextArea();
        else if (typ == PASSWORD)
            result = new PasswordTextBox();
        else if (typ == LABEL)
            result = new Label();
        else if (typ == A)
            result = new Anchor();
        else if (typ == SELECT)
            result = new ListBox();
        else if (typ == IMAGE)
            result = new Image();
        else if (typ == HIDDEN)
            result = new Hidden();
        else if (typ == FILE)
            result = new FileUpload();
        else if (typ == FORM)
            result = new FormPanel();
        else if (typ == FRAME)
            result = new Frame();
        else if (typ == SUBMIT)
            result = new SubmitButton();
        else if (typ == BUTTON)
            result = new Button();
        else if (typ == CHECK_BOX)
            result = SimpleCheckBox.wrap(e);
    }
    return result;
}

From source file:com.eduworks.gwt.client.pagebuilder.PageAssembler.java

License:Apache License

/** preserves event handlers on element to be wrapped  */
public static Widget elementToWidget(String elementName, String typ) {
    Widget result = null;/*from w  ww .ja v a 2s  . c  om*/
    Element e = DOM.getElementById(elementName);
    if (e != null) {
        int eventsSunk = DOM.getEventsSunk(e);
        EventListener el = DOM.getEventListener(e);
        if (typ == TEXT)
            result = TextBox.wrap(e);
        else if (typ == TEXT_AREA)
            result = TextArea.wrap(e);
        else if (typ == PASSWORD)
            result = PasswordTextBox.wrap(e);
        else if (typ == LABEL)
            result = Label.wrap(e);
        else if (typ == A)
            result = Anchor.wrap(e);
        else if (typ == SELECT)
            result = ListBox.wrap(e);
        else if (typ == IMAGE)
            result = Image.wrap(e);
        else if (typ == HIDDEN)
            result = Hidden.wrap(e);
        else if (typ == FILE)
            result = FileUpload.wrap(e);
        else if (typ == FORM)
            result = FormPanel.wrap(e, true);
        else if (typ == FRAME)
            result = Frame.wrap(e);
        else if (typ == SUBMIT)
            result = SubmitButton.wrap(e);
        else if (typ == BUTTON)
            result = Button.wrap(e);
        else if (typ == CHECK_BOX)
            result = SimpleCheckBox.wrap(e);
        DOM.sinkEvents(e, eventsSunk);
        DOM.setEventListener(e, el);
    } else {
        if (typ == TEXT)
            result = new TextBox();
        else if (typ == TEXT_AREA)
            result = new TextArea();
        else if (typ == PASSWORD)
            result = new PasswordTextBox();
        else if (typ == LABEL)
            result = new Label();
        else if (typ == A)
            result = new Anchor();
        else if (typ == IMAGE)
            result = new Image();
        else if (typ == SELECT)
            result = new ListBox();
        else if (typ == HIDDEN)
            result = new Hidden();
        else if (typ == FILE)
            result = new FileUpload();
        else if (typ == FORM)
            result = new FormPanel();
        else if (typ == FRAME)
            result = new Frame();
        else if (typ == SUBMIT)
            result = new SubmitButton();
        else if (typ == BUTTON)
            result = new Button();
        else if (typ == CHECK_BOX)
            result = SimpleCheckBox.wrap(e);
    }
    return result;
}

From source file:com.epam.feel.client.ui.util.gwtupload.FixedSingleUploader.java

License:Apache License

/**
 * Creates a standard button to send the file
 * /* www .j  ava2 s  .  c  om*/
 * @param type
 *            file input to use
 * @param status
 *            Customized status widget to use
 */
public FixedSingleUploader(FileInputType type, IUploadStatus status) {
    this(type, status, new Button());
}

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

License:Open Source License

/**
 * Constructor.//from  w ww .j ava  2s .  c  o  m
 * 
 * @param eventBus HandlerManager
 */
public BatchClassManagementView(HandlerManager eventBus) {
    super();
    initWidget(BINDER.createAndBindUi(this));

    editModulesPluginSelectView = new ConfigureModulesPluginSelectView(eventBus);
    addModuleView = new ConfigureModuleView(eventBus);

    editModulesPluginSelectViewLayoutPanel.add(editModulesPluginSelectView);
    addModulesViewLayoutPanel.add(addModuleView);
    Button edit = new Button();
    copy = new Button();
    Button delete = new Button();
    Button export = new Button();
    importButton = new Button();
    bottomPanel.addStyleName("leftPadding");
    bottomPanel.addStyleName("fullWidth");
    edit.setText(AdminConstants.EDIT_BUTTON);
    copy.setText(AdminConstants.COPY_BUTTON);
    delete.setText(AdminConstants.DELETE_BUTTON);
    export.setText(AdminConstants.EXPORT_BUTTON);
    importButton.setText(AdminConstants.IMPORT_BUTTON);
    apply.setText(AdminConstants.APPLY_BUTTON);

    validate.setText(VALIDATE);
    validate.addStyleName(BUTTON_STYLE);

    buttonPanel = new HorizontalPanel();
    buttonPanel.setWidth("100%");
    buttonPanel.setSpacing(BatchClassManagementConstants.FIVE);
    buttonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    buttonPanel.setVerticalAlignment(HasAlignment.ALIGN_TOP);
    buttonPanel.add(export);
    buttonPanel.add(importButton);
    buttonPanel.add(edit);
    buttonPanel.setCellWidth(edit, "95%");
    buttonPanel.add(new Label(BatchClassManagementConstants.EMPTY_STRING));
    buttonPanel.add(copy);
    buttonPanel.add(new Label(BatchClassManagementConstants.EMPTY_STRING));
    buttonPanel.add(delete);

    batchListPanel = new LayoutPanel();
    batchClassListView = new BatchClassListView();
    batchClassFieldListView = new BatchClassFieldListView();
    batchListPanel.add(batchClassListView.listView);
    submit.setText(AdminConstants.SAVE_BUTTON);
    cancel.setText(AdminConstants.CANCEL_BUTTON);
    deploy.setText(AdminConstants.DEPLOY_BUTTON);
    learn.setText(AdminConstants.LEARN_FILES_BUTTON);
    sample.setText(AdminConstants.GENERATE_FOLDERS_BUTTON);
    learnDB.setText(AdminConstants.LEARN_DB_BUTTON);
    bottomButtons.setVisible(false);
    batchClassBreadCrumbView.setVisible(false);
    toggleDeployButtonEnable(false);

    edit.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            presenter.onEditButtonClicked();
        }
    });

    copy.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            String identifier = batchClassListView.listView.getSelectedRowIndex();
            if (identifier == null || identifier.isEmpty()) {
                ConfirmationDialogUtil.showConfirmationDialogError(
                        LocaleDictionary.get().getMessageValue(BatchClassManagementMessages.NO_RECORD_TO_COPY));
                return;
            }
            final DialogBox dialogBox = new DialogBox();
            final CopyBatchClassView copyBatchClassView = new CopyBatchClassView();
            CopyBatchClassPresenter copyBatchClassPresenter = new CopyBatchClassPresenter(
                    presenter.getController(), copyBatchClassView);
            copyBatchClassPresenter
                    .setBatchClassDTO(presenter.getController().getBatchClassByIdentifier(identifier));
            copyBatchClassView.setDialogBox(dialogBox);
            copyBatchClassPresenter.bind();
            copyBatchClassPresenter.showBatchClassCopyView();
            copyBatchClassView.getSaveButton().setFocus(true);
        }
    });

    importButton.addClickHandler(new ClickHandler() {

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

        }
    });

    export.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            String identifier = batchClassListView.listView.getSelectedRowIndex();
            if (identifier == null || identifier.isEmpty()) {
                ConfirmationDialogUtil.showConfirmationDialogError(LocaleDictionary.get()
                        .getMessageValue(BatchClassManagementMessages.NO_RECORD_TO_EXPORT));
                return;
            }
            presenter.onExportButtonClicked(identifier);
        }
    });

    delete.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            final String identifier = batchClassListView.listView.getSelectedRowIndex();
            if (identifier == null || identifier.isEmpty()) {
                ConfirmationDialogUtil.showConfirmationDialogError(LocaleDictionary.get()
                        .getMessageValue(BatchClassManagementMessages.NO_RECORD_TO_DELETE));
                return;
            }
            final ConfirmationDialog confirmationDialog = ConfirmationDialogUtil.showConfirmationDialog(
                    LocaleDictionary.get()
                            .getMessageValue(BatchClassManagementMessages.DELETE_BATCH_CLASS_CONFORMATION),
                    LocaleDictionary.get().getConstantValue(
                            BatchClassManagementConstants.DELETE_BATCH_CLASS_TITLE),
                    Boolean.FALSE);

            confirmationDialog.addDialogListener(new DialogListener() {

                @Override
                public void onOkClick() {
                    confirmationDialog.hide();
                    presenter.onDeleteButtonClicked(identifier);
                }

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

        }
    });
}

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

License:Open Source License

/**
 * To set view./* www.j a  va  2s. c o m*/
 */
public void setView() {

    cancel = new Button();
    cancel.setText(AdminConstants.CANCEL_BUTTON);
    cancel.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            presenter.onCancel();
        }
    });
    save = new Button();
    save.setText(AdminConstants.OK_BUTTON);
    save.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            presenter.onSave();
        }
    });
    editTable = new FlexTable();
    editTable.setWidth("100%");
    flexEditTable.setWidget(0, 0, editTable);
    flexEditTable.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);
}

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

License:Open Source License

/**
 * Constructor./*from w  ww.j a v a  2 s .  c  o m*/
 */
public KV_PP_PropertiesView() {
    super();
    initWidget(BINDER.createAndBindUi(this));
    edit = new Button();
    noResultLabel = new Label();
    noResultLabel.setText(LocaleDictionary.get().getMessageValue(BatchClassManagementMessages.NO_RECORD_FOUND));
    noResultLabel.setVisible(false);
    edit.setText(AdminConstants.EDIT_BUTTON);
    kvppPluginConfigurationCaptionPanel.setCaptionHTML(AdminConstants.PLUGIN_CONFIGURATION_HTML);
    pluginDetailsCaptionPanel.setCaptionHTML(AdminConstants.PLUGIN_DETAILS_HTML);
    kvppEditButtonPanel.setStyleName(AdminConstants.PADDING_STYLE);
    kvppEditButtonPanel.add(edit);
    kvppPluginViewVerticalPanel.add(noResultLabel);
    configButton.setText(AdminConstants.CONFIG_BUTTON);
}

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

License:Open Source License

/**
 * Constructor./*  w  w w  . j  av  a 2  s  . 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.home.client.view.reviewtable.ReviewValidateTable.java

License:Open Source License

/**
 * Constructor.//from w  w  w .  j  a  va2 s .  c o  m
 */
public ReviewValidateTable() {
    super();
    mainPanel = new DockLayoutPanel(Unit.PCT);
    searchAndFilterContanier = new FlowPanel();
    filterAndSearchPanel = new HorizontalPanel();
    searchAndFilterContanier.addStyleName(CoreCommonConstants.OPTIONS_PANEL);
    filterAndSearchPanel.setWidth(CoreCommonConstants._100_PERCENTAGE);
    priorityListBox = createPriorityListBox();
    searchPanel = new HorizontalPanel();
    listView = new ListView();
    listView.setTableRowCount(BatchListConstants.FIFTEEN);
    addHeaders();
    HorizontalPanel listBoxPanel;
    listBoxPanel = new HorizontalPanel();

    searchBatchButton = new Button();
    searchBatchLabel = new Label();
    searchBatchTextBox = new TextBox();

    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);

    searchPanel.addStyleName(CoreCommonConstants.LAST_GRP_PANEL_NORMAL_CSS);
    searchBatchLabel.setText(LocaleDictionary.get().getConstantValue(BatchListConstants.LABEL_SEARCH_BATCH)
            + BatchListConstants.COLON);
    searchBatchButton.setText(LocaleDictionary.get().getConstantValue(BatchListConstants.BUTTON_SEARCH_BATCH));

    listBoxPanel.addStyleName(CoreCommonConstants.GRP_PANEL_NORMAL_CSS);
    searchAndFilterContanier.add(filterAndSearchPanel);
    mainPanel.addNorth(searchAndFilterContanier, BatchListConstants.FIFTEEN);
    mainPanel.addStyleName("padding0");
    mainPanel.add(listView);
    Label priorityLabel = new Label(
            LocaleDictionary.get().getConstantValue(BatchListConstants.LABEL_PRIORITY_LISTBOX));
    refreshButton = new Button(
            LocaleDictionary.get().getConstantValue(BatchListConstants.LABEL_REFRESH_BUTTON));

    listBoxPanel.add(priorityLabel);
    listBoxPanel.add(priorityListBox);
    listBoxPanel.add(refreshButton);
    listBoxPanel.setCellHorizontalAlignment(priorityLabel, HasHorizontalAlignment.ALIGN_RIGHT);
    listBoxPanel.setCellHorizontalAlignment(refreshButton, HasHorizontalAlignment.ALIGN_LEFT);
    listBoxPanel.setWidth(CoreCommonConstants._100_PERCENTAGE);

    filterAndSearchPanel.add(listBoxPanel);
    filterAndSearchPanel.add(searchPanel);
    filterAndSearchPanel.setCellHorizontalAlignment(listBoxPanel, HasHorizontalAlignment.ALIGN_LEFT);
    filterAndSearchPanel.setCellWidth(listBoxPanel, CoreCommonConstants._20_PERCENTAGE);
    filterAndSearchPanel.setCellHorizontalAlignment(searchPanel, HasHorizontalAlignment.ALIGN_LEFT);
    searchBatchTextBox.addKeyPressHandler(new KeyPressHandler() {

        @Override
        public void onKeyPress(KeyPressEvent event) {
            if (event.getCharCode() == KeyCodes.KEY_ENTER) {
                searchBatchButton.click();
            }
        }
    });
    searchBatchTextBox.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            searchBatchTextBox.setText(BatchListConstants.EMPTY_STRING);
        }
    });
}

From source file:com.ephesoft.dcma.gwt.rv.client.view.FuzzySearchResultView.java

License:Open Source License

public FuzzySearchResultView(final ReviewValidatePresenter reviewValidatePresenter, String width,
        String height) {// www.ja  va2s .  c  o m
    super();
    initWidget(BINDER.createAndBindUi(this));
    // fuzzySearchScrollPanel.setSize("100%", "100%");

    fuzzyTable = new FlexTable();
    fuzzyTable.setWidth("100%");

    buttonHorizontalPanel = new HorizontalPanel();
    Button cancelBtn = new Button();
    selectBtn = new Button();
    buttonHorizontalPanel.add(selectBtn);
    buttonHorizontalPanel.add(cancelBtn);
    buttonHorizontalPanel.setSpacing(5);
    buttonHorizontalPanel.setVerticalAlignment(HasAlignment.ALIGN_TOP);
    addStyleName("overflow_scroll");
    fuzzySearchListPanel.add(buttonHorizontalPanel);
    setWidth(width);
    setHeight(height);
    fuzzySearchListPanel.add(fuzzyTable);
    fuzzySearchListPanel.addStyleName("border");

    // cancelBtn.setText("Cancel");
    // selectBtn.setText("Select");

    cancelBtn.setText(LocaleDictionary.get().getConstantValue(ReviewValidateConstants.FUZZY_SEARCH_CANCEL_BTN));
    selectBtn.setText(LocaleDictionary.get().getConstantValue(ReviewValidateConstants.FUZZY_SEARCH_SELECT_BTN));

    selectBtn.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {

            // TODO remove this hard coding and get it from hash map.
            int returnIndex = getSelectedRowId();
            FuzzySearchResultView.this.fireEvent(new FuzzySearchEvent(returnIndex));
            dialogBox.hide(true);
            ScreenMaskUtility.unmaskScreen();
            reviewValidatePresenter.setFocus();
        }

    });

    cancelBtn.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent arg0) {
            dialogBox.hide(true);
            ScreenMaskUtility.unmaskScreen();
            reviewValidatePresenter.setFocus();
        }

    });

}