Search in sources :

Example 1 with ModalHiddenHandler

use of org.gwtbootstrap3.client.shared.event.ModalHiddenHandler in project kie-wb-common by kiegroup.

the class ModalFormDisplayerViewImpl method initialize.

@PostConstruct
public void initialize() {
    modal = new Modal();
    modal.setHideOtherModals(false);
    modal.setClosable(true);
    modal.setFade(true);
    modal.setDataKeyboard(true);
    modal.setDataBackdrop(ModalBackdrop.FALSE);
    modal.setSize(ModalSize.LARGE);
    modal.setRemoveOnHide(true);
    modalBody = new ModalBody();
    modalBody.add(this);
    modal.add(modalBody);
    submit = new Button(translationService.getTranslation(CrudComponentConstants.ModalFormDisplayerViewImplAccept));
    submit.setType(ButtonType.PRIMARY);
    cancel = new Button(translationService.getTranslation(CrudComponentConstants.ModalFormDisplayerViewImplCancel));
    modal.add(new ModalFooter() {

        {
            add(submit);
            add(cancel);
        }
    });
    submit.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            presenter.submitForm();
        }
    });
    cancel.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            doCancel();
        }
    });
    modal.addHiddenHandler(new ModalHiddenHandler() {

        @Override
        public void onHidden(ModalHiddenEvent evt) {
            doCancel();
        }
    });
}
Also used : ModalBody(org.gwtbootstrap3.client.ui.ModalBody) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Button(org.gwtbootstrap3.client.ui.Button) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ModalFooter(org.gwtbootstrap3.client.ui.ModalFooter) ModalHiddenHandler(org.gwtbootstrap3.client.shared.event.ModalHiddenHandler) Modal(org.gwtbootstrap3.client.ui.Modal) ModalHiddenEvent(org.gwtbootstrap3.client.shared.event.ModalHiddenEvent) PostConstruct(javax.annotation.PostConstruct)

Example 2 with ModalHiddenHandler

use of org.gwtbootstrap3.client.shared.event.ModalHiddenHandler in project kie-wb-common by kiegroup.

the class DataSourceSelectorViewImpl method init.

@PostConstruct
private void init() {
    dataGrid.setHeight("200px");
    dataGrid.setColumnPickerButtonVisible(false);
    dataGrid.setEmptyTableCaption(translationService.getTranslation(DataSourceManagementConstants.DataSourceSelector_NoAvailableDataSourcesMessage));
    Column<DataSourceSelectorPageRow, String> nameColumn = new Column<DataSourceSelectorPageRow, String>(new TextCell()) {

        @Override
        public String getValue(DataSourceSelectorPageRow row) {
            return row.getDataSourceDefInfo().getName();
        }
    };
    dataGrid.addColumn(nameColumn, translationService.getTranslation(DataSourceManagementConstants.DataSourceSelector_DataSourceColumn));
    Column<DataSourceSelectorPageRow, String> selectorColumn = new Column<DataSourceSelectorPageRow, String>(new ButtonCell(ButtonType.PRIMARY, ButtonSize.SMALL)) {

        @Override
        public String getValue(DataSourceSelectorPageRow row) {
            return translationService.getTranslation(DataSourceManagementConstants.DataSourceSelector_SelectButton);
        }
    };
    selectorColumn.setFieldUpdater(new FieldUpdater<DataSourceSelectorPageRow, String>() {

        @Override
        public void update(int index, DataSourceSelectorPageRow row, String value) {
            selectedRow = row;
            cancelNextHiddenEvent = true;
            modal.hide();
            presenter.onSelect();
        }
    });
    dataGrid.addColumn(selectorColumn, "");
    mainPanel.add(dataGrid);
    this.modal = new BaseModal();
    this.modal.setTitle(translationService.getTranslation(DataSourceManagementConstants.DataSourceSelector_Title));
    this.modal.setBody(this);
    this.modal.addHiddenHandler(new ModalHiddenHandler() {

        @Override
        public void onHidden(ModalHiddenEvent evt) {
            if (!cancelNextHiddenEvent) {
                presenter.onClose();
            }
            cancelNextHiddenEvent = false;
        }
    });
}
Also used : BaseModal(org.uberfire.ext.widgets.common.client.common.popups.BaseModal) Column(com.google.gwt.user.cellview.client.Column) ModalHiddenHandler(org.gwtbootstrap3.client.shared.event.ModalHiddenHandler) ButtonCell(org.gwtbootstrap3.client.ui.gwt.ButtonCell) ModalHiddenEvent(org.gwtbootstrap3.client.shared.event.ModalHiddenEvent) TextCell(com.google.gwt.cell.client.TextCell) PostConstruct(javax.annotation.PostConstruct)

Aggregations

PostConstruct (javax.annotation.PostConstruct)2 ModalHiddenEvent (org.gwtbootstrap3.client.shared.event.ModalHiddenEvent)2 ModalHiddenHandler (org.gwtbootstrap3.client.shared.event.ModalHiddenHandler)2 TextCell (com.google.gwt.cell.client.TextCell)1 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 Column (com.google.gwt.user.cellview.client.Column)1 Button (org.gwtbootstrap3.client.ui.Button)1 Modal (org.gwtbootstrap3.client.ui.Modal)1 ModalBody (org.gwtbootstrap3.client.ui.ModalBody)1 ModalFooter (org.gwtbootstrap3.client.ui.ModalFooter)1 ButtonCell (org.gwtbootstrap3.client.ui.gwt.ButtonCell)1 BaseModal (org.uberfire.ext.widgets.common.client.common.popups.BaseModal)1