Example usage for com.vaadin.ui Window setModal

List of usage examples for com.vaadin.ui Window setModal

Introduction

In this page you can find the example usage for com.vaadin.ui Window setModal.

Prototype

public void setModal(boolean modal) 

Source Link

Document

Sets window modality.

Usage

From source file:org.escidoc.browser.ui.view.helpers.OrganizationalUnitsTableVH.java

License:Open Source License

@Override
protected void addActionLists() {
    // if (contextController.canUpdateContext()) {
    table.addActionHandler(new Action.Handler() {
        @Override//w w w. j  av  a  2 s  .  com
        public Action[] getActions(Object target, Object sender) {
            return ACTIONS_LIST;
        }

        @Override
        public void handleAction(Action action, Object sender, Object target) {
            if ((ACTION_DELETE == action) && (target != null)) {
                confirmActionWindow(target);
            } else {
                openViewAddRemoveOUs();
            }

        }

        private void openViewAddRemoveOUs() {
            final Window subwindow = new Window("A modal subwindow");
            subwindow.setModal(true);
            subwindow.setWidth("650px");
            VerticalLayout layout = (VerticalLayout) subwindow.getContent();
            layout.setMargin(true);
            layout.setSpacing(true);

            try {
                subwindow.addComponent(new AddOrgUnitstoContext(router, resourceProxy, controller,
                        resourceProxy.getOrganizationalUnit()));
            } catch (EscidocClientException e) {
                controller.showError(e);
            }
            Button close = new Button(ViewConstants.CLOSE, new Button.ClickListener() {
                @Override
                public void buttonClick(@SuppressWarnings("unused") ClickEvent event) {
                    subwindow.getParent().removeWindow(subwindow);
                }
            });
            layout.addComponent(close);
            layout.setComponentAlignment(close, Alignment.TOP_RIGHT);

            router.getMainWindow().addWindow(subwindow);
        }
    });
    // }
}

From source file:org.escidoc.browser.ui.view.helpers.OUParentTableVH.java

License:Open Source License

@Override
protected void addActionLists() {
    table.addActionHandler(new Action.Handler() {
        @Override/*from   w  w  w .j av  a 2 s  .  c  o  m*/
        public Action[] getActions(Object target, Object sender) {
            return ACTIONS_LIST;
        }

        @Override
        public void handleAction(Action action, Object sender, Object target) {
            if ((ACTION_DELETE == action) && (target != null)) {
                confirmActionWindow(target);
            } else {
                openViewAddRemoveOUs();
            }

        }

        private void openViewAddRemoveOUs() {
            final Window subwindow = new Window("A modal subwindow");
            subwindow.setModal(true);
            subwindow.setWidth("650px");
            VerticalLayout layout = (VerticalLayout) subwindow.getContent();
            layout.setMargin(true);
            layout.setSpacing(true);

            try {
                subwindow.addComponent(new OrgUnitParentEditView(orgUnitProxy, orgUnitProxy.getParentList(),
                        router, controller));
            } catch (EscidocClientException e) {
                controller.showError(e);
            }
            Button close = new Button(ViewConstants.CLOSE, new Button.ClickListener() {
                @Override
                public void buttonClick(@SuppressWarnings("unused") ClickEvent event) {
                    subwindow.getParent().removeWindow(subwindow);
                }
            });
            layout.addComponent(close);
            layout.setComponentAlignment(close, Alignment.TOP_RIGHT);

            router.getMainWindow().addWindow(subwindow);
        }
    });

}

From source file:org.escidoc.browser.ui.view.helpers.TableContainerVH.java

License:Open Source License

public void confirmActionWindow(final Object target) {
    final Window subwindow = new Window(ViewConstants.DELETE_RESOURCE_WINDOW_NAME);
    subwindow.setModal(true);
    subwindow.setWidth("500px");

    VerticalLayout layout = (VerticalLayout) subwindow.getContent();
    layout.setMargin(true);//from   w w  w.  j  av a  2s. com
    layout.setSpacing(true);
    Label message = new Label(ViewConstants.QUESTION_DELETE_RESOURCE);
    subwindow.addComponent(message);
    Button okBtn = new Button("Yes Remove", new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            removeAction(target);
            table.refreshRowCache();
            (subwindow.getParent()).removeWindow(subwindow);
        }
    });
    Button cancelBtn = new Button("Cancel", new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            (subwindow.getParent()).removeWindow(subwindow);

        }
    });
    HorizontalLayout hl = new HorizontalLayout();
    hl.addComponent(okBtn);
    hl.addComponent(cancelBtn);
    layout.addComponent(hl);

    this.getApplication().getMainWindow().addWindow(subwindow);
}

From source file:org.esn.esobase.view.MainView.java

private void openSearchInCatalogs() {
    if (searchInCatalogsTabContent == null) {
        searchInCatalogsTabContent = new SearchInCatalogsTab(service, dictionaryService);
    }/*  w  w  w  . ja  v  a2  s  .  c om*/
    Window subWindow = new Window(searchInCatalogsMenuItem.getText());
    subWindow.setModal(true);

    subWindow.center();
    this.getUI().addWindow(subWindow);
    subWindow.setResizable(false);
    subWindow.setSizeFull();
    subWindow.setContent(searchInCatalogsTabContent);
    searchInCatalogsTabContent.setWidth();
}

From source file:org.esn.esobase.view.MainView.java

private void openSearchInRaw() {
    if (searchInRawStringsTabContent == null) {
        searchInRawStringsTabContent = new SearchInRawStringsTab(service);
    }/* w w w . j  a va 2s. com*/
    Window subWindow = new Window(searchInRawStringsMenuItem.getText());
    subWindow.setModal(true);

    subWindow.center();
    this.getUI().addWindow(subWindow);
    subWindow.setResizable(false);
    subWindow.setSizeFull();
    subWindow.setContent(searchInRawStringsTabContent);
    searchInRawStringsTabContent.setWidth();
}

From source file:org.geant.sat.ui.EntityListViewer.java

License:BSD License

/**
 * Creates a subwindow for editing survey details of entity.
 * /* w  ww.  ja va2  s  .co m*/
 * @param details
 *            entity
 */
private void editSurveys(EntityDetails details) {
    Window subWindowNewEntity = new Window(getString("lang.window.newentity.editsids.title"));
    subWindowNewEntity.setModal(true);
    VerticalLayout subContent = new VerticalLayout();
    TwinColSelect<String> selectSids = new TwinColSelect<>(getString("lang.window.newentity.editsids.sids"));
    selectSids.setData(details);
    ListAllSurveysResponse resp = getMainUI().getSatApiClient().getSurveys();
    if (!verifySuccess(resp)) {
        return;
    }
    List<SurveyDetails> surveyDetails = resp.getSurveys();
    // parse active sids
    List<String> activeSurveyDetails = new ArrayList<String>();
    for (SurveyDetails surveyDetail : surveyDetails) {
        if (surveyDetail.getActive()) {
            activeSurveyDetails.add(surveyDetail.getSid());
        }
    }
    selectSids.setItems(activeSurveyDetails);
    // set current sids as selection
    selectSids.updateSelection(details.getSids(), new HashSet<String>());
    subContent.addComponent(selectSids, 0);
    Button editButton = new Button(getString("lang.window.newentity.buttonModify"));
    subContent.addComponent(editButton, 1);
    editButton.addClickListener(this::editedSurveys);
    Button cancelButton = new Button(getString("lang.window.newentity.buttonCancel"));
    subContent.addComponent(cancelButton, 2);
    cancelButton.addClickListener(this::canceledEditSurveys);
    subWindowNewEntity.setContent(subContent);
    getMainUI().addWindow(subWindowNewEntity);

}

From source file:org.geant.sat.ui.EntityListViewer.java

License:BSD License

/**
 * Creates a subwindow for editing assessor details of entity.
 * //from  ww  w.jav a 2 s . c o m
 * @param details
 *            entity
 */
private void editAssessors(EntityDetails details) {
    Window subWindowNewEntity = new Window(getString("lang.window.newentity.editassessors.title"));
    subWindowNewEntity.setWidth("80%");
    subWindowNewEntity.setModal(true);
    VerticalLayout subContent = new VerticalLayout();
    subContent.setWidth("100%");
    TwinColSelect<AssessorDetails> selectAssessors = new TwinColSelect<>(
            getString("lang.window.newentity.editassessors.assessors"));
    selectAssessors.setItemCaptionGenerator(new AssessorDetailsHelper());
    selectAssessors.setWidth("100%");
    selectAssessors.setData(details);
    ListAssessorsResponse resp = getMainUI().getSatApiClient().getAssessors();
    if (!verifySuccess(resp)) {
        return;
    }
    List<AssessorDetails> assessorDetails = resp.getAssessors();
    selectAssessors.setItems(assessorDetails);
    selectAssessors.updateSelection(
            AssessorDetailsHelper.selectionToSet(assessorDetails, details.getAssessors()),
            new HashSet<AssessorDetails>());
    subContent.addComponent(selectAssessors, 0);
    Button editButton = new Button(getString("lang.window.newentity.buttonModify"));
    subContent.addComponent(editButton, 1);
    editButton.addClickListener(this::editedAssessors);
    Button cancelButton = new Button(getString("lang.window.newentity.buttonCancel"));
    subContent.addComponent(cancelButton, 2);
    cancelButton.addClickListener(this::canceledEditAssessors);
    subWindowNewEntity.setContent(subContent);
    getMainUI().addWindow(subWindowNewEntity);
}

From source file:org.geant.sat.ui.EntityListViewer.java

License:BSD License

/**
 * Add entity click handler - creates a sub window for user to enter the
 * data./*from   w  w  w  .ja v a2  s.c  om*/
 * 
 * @param event
 *            button click event.
 */
private void addEntity(ClickEvent event) {

    // We create a simple window for user to enter entity information
    // no declarative design used, we form it locally
    Window subWindowNewEntity = new Window(getString("lang.window.newentity.title"));
    subWindowNewEntity.setModal(true);
    subWindowNewEntity.setWidth("50%");
    VerticalLayout subContent = new VerticalLayout();
    TextField field = new TextField(getString("lang.window.newentity.textFieldName"));
    field.setWidth("80%");
    subContent.addComponent(field, 0);
    field = new TextField(getString("lang.window.newentity.textFieldDescription"));
    field.setWidth("80%");
    subContent.addComponent(field, 1);
    Button okButton = new Button(getString("lang.window.newentity.buttonCreate"));
    subContent.addComponent(okButton, 2);
    okButton.addClickListener(this::addedEntity);
    Button cancelButton = new Button(getString("lang.window.newentity.buttonCancel"));
    subContent.addComponent(cancelButton, 3);
    cancelButton.addClickListener(this::canceledEntityAdd);
    subWindowNewEntity.setContent(subContent);
    subWindowNewEntity.center();
    getMainUI().addWindow(subWindowNewEntity);

}

From source file:org.geant.sat.ui.ScheduleSurveyViewer.java

License:BSD License

/**
 * Creates a subwindow for editing survey details of entity.
 * /*from www .  ja  va 2  s .c om*/
 * @param details
 *            entity
 */
private void editSurveys(EntityDetails details) {
    Window subWindowNewEntity = new Window(getString("lang.window.surveyschedule.editsids.title"));
    subWindowNewEntity.setModal(true);
    VerticalLayout subContent = new VerticalLayout();
    TwinColSelect<String> selectSids = new TwinColSelect<>(getString("lang.window.newentity.editsids.sids"));
    selectSids.setData(details);
    ListAllSurveysResponse resp = getMainUI().getSatApiClient().getSurveys();
    if (!verifySuccess(resp)) {
        return;
    }
    List<SurveyDetails> surveyDetails = resp.getSurveys();
    // parse active sids
    List<String> activeSurveyDetails = new ArrayList<String>();
    for (SurveyDetails surveyDetail : surveyDetails) {
        if (surveyDetail.getActive()) {
            activeSurveyDetails.add(surveyDetail.getSid());
        }
    }
    selectSids.setItems(activeSurveyDetails);
    // set current sids as selection
    selectSids.updateSelection(details.getSids(), new HashSet<String>());
    subContent.addComponent(selectSids, 0);
    Button editButton = new Button(getString("lang.window.newentity.buttonModify"));
    subContent.addComponent(editButton, 1);
    editButton.addClickListener(this::editedSurveys);
    Button cancelButton = new Button(getString("lang.window.newentity.buttonCancel"));
    subContent.addComponent(cancelButton, 2);
    cancelButton.addClickListener(this::canceledEditSurveys);
    subWindowNewEntity.setContent(subContent);
    getMainUI().addWindow(subWindowNewEntity);
}

From source file:org.geant.sat.ui.ScheduleSurveyViewer.java

License:BSD License

/**
 * Creates a subwindow for editing assessor details of entity.
 * /*from w ww  . ja va  2  s .co m*/
 * @param details
 *            entity
 */
private void editAssessors(EntityDetails details) {
    Window subWindowNewEntity = new Window(getString("lang.window.surveyschedule.editassessors.title"));
    subWindowNewEntity.setWidth("80%");
    subWindowNewEntity.setModal(true);
    VerticalLayout subContent = new VerticalLayout();
    subContent.setWidth("100%");
    TwinColSelect<AssessorDetails> selectAssessors = new TwinColSelect<>(
            getString("lang.window.newentity.editassessors.assessors"));
    selectAssessors.setItemCaptionGenerator(new AssessorDetailsHelper());
    selectAssessors.setWidth("100%");
    selectAssessors.setData(details);
    ListAssessorsResponse resp = getMainUI().getSatApiClient().getAssessors();
    if (!verifySuccess(resp)) {
        return;
    }
    List<AssessorDetails> assessorDetails = resp.getAssessors();
    selectAssessors.setItems(assessorDetails);
    selectAssessors.updateSelection(
            AssessorDetailsHelper.selectionToSet(assessorDetails, details.getAssessors()),
            new HashSet<AssessorDetails>());
    subContent.addComponent(selectAssessors, 0);
    Button editButton = new Button(getString("lang.window.newentity.buttonModify"));
    subContent.addComponent(editButton, 1);
    editButton.addClickListener(this::editedAssessors);
    Button cancelButton = new Button(getString("lang.window.newentity.buttonCancel"));
    subContent.addComponent(cancelButton, 2);
    cancelButton.addClickListener(this::canceledEditAssessors);
    subWindowNewEntity.setContent(subContent);
    getMainUI().addWindow(subWindowNewEntity);
}