Example usage for com.vaadin.ui Window setWidth

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

Introduction

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

Prototype

@Override
    public void setWidth(String width) 

Source Link

Usage

From source file:org.escidoc.browser.ui.maincontent.ParentsView.java

License:Open Source License

@SuppressWarnings("serial")
private Component buildParentsList() {
    // ViewConstants.PARENTS
    final Panel panel = new Panel();
    panel.setSizeFull();//  w w  w .jav a 2  s.c  o m
    panel.setStyleName(Runo.PANEL_LIGHT);

    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();

    final CssLayout cssLayout = new CssLayout();
    cssLayout.setHeight("20px");
    buildPanelHeader(cssLayout, ViewConstants.PARENTS);
    ThemeResource ICON = new ThemeResource("images/assets/plus.png");

    Button btnAdd = new Button();
    btnAdd.setStyleName(BaseTheme.BUTTON_LINK);
    btnAdd.addStyleName("floatright paddingtop3");
    btnAdd.setWidth("20px");
    btnAdd.setIcon(ICON);
    btnAdd.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {

            final Window subwindow = new Window("Manage Organizational Unit Parents");
            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, orgUnitController));
            } catch (EscidocClientException e) {
                orgUnitController.showError(e);
            }
            Button close = new Button("Close", new Button.ClickListener() {

                @Override
                public void buttonClick(@SuppressWarnings("unused") com.vaadin.ui.Button.ClickEvent event) {
                    (subwindow.getParent()).removeWindow(subwindow);
                }
            });
            layout.addComponent(close);
            layout.setComponentAlignment(close, Alignment.TOP_RIGHT);

            mainWindow.addWindow(subwindow);
        }
    });
    cssLayout.addComponent(btnAdd);
    vl.addComponent(cssLayout);
    List<ResourceModel> l = orgUnitProxy.getParentList();
    OUParentTableVH parentTable = new OUParentTableVH(orgUnitProxy, router, orgUnitController);
    parentTable.buildTable();
    vl.addComponent(parentTable);
    vl.setExpandRatio(parentTable, 9f);
    // TODO here comes table
    panel.setContent(vl);
    return panel;
}

From source file:org.escidoc.browser.ui.OrganizationSelectionView.java

License:Open Source License

public Window modalWindow() {
    final Window modalWindow = new Window("Select an Organization");
    modalWindow.setHeight("600px");
    modalWindow.setWidth("400px");
    VerticalLayout modalWindowLayout = (VerticalLayout) modalWindow.getContent();
    modalWindow.setModal(true);//from ww w  . jav a 2s  .  c o  m

    modalWindow.setContent(modalWindowLayout);

    modalWindowLayout.setMargin(true);
    modalWindowLayout.setSpacing(true);

    // modalWindowLayout.setWidth("400px");
    // modalWindowLayout.setHeight("600px");
    modalWindowLayout.setSizeUndefined();

    orgUnitFilter = new TextField(ViewConstants.ORGANIZATIONAL_UNIT);

    orgUnitFilter.setWidth("300px");
    modalWindowLayout.addComponent(orgUnitFilter);

    orgUnitFilter.addListener(new TextChangeListener() {

        private SimpleStringFilter filter;

        @Override
        public void textChange(TextChangeEvent event) {
            // // TODO refactor this, the list should not return the data
            // source
            Filterable ds = (Filterable) tree.getDataSource();
            ds.removeAllContainerFilters();
            filter = new SimpleStringFilter(PropertyId.NAME, event.getText(), true, false);
            ds.addContainerFilter(filter);
        }
    });

    buildOrganizationTreeView();
    modalWindowLayout.addComponent(tree);

    Button saveButton = new Button(ViewConstants.SAVE, new Button.ClickListener() {

        @Override
        public void buttonClick(@SuppressWarnings("unused") ClickEvent event) {
            try {
                ResourceModel selected = tree.getSelected();
                List<ResourceModel> list = new ArrayList<ResourceModel>();
                list.add(selected);

                UserGroup updateGroup = repositories.group().updateGroup(resourceProxy.getId(),
                        (String) nameField.getValue(), list);
                mw.showNotification("Group, " + updateGroup.getXLinkTitle() + ", is updated",
                        Window.Notification.TYPE_TRAY_NOTIFICATION);

                dataSource.addBean(selected);
                mw.removeWindow(modalWindow);
            } catch (EscidocClientException e) {
                StringBuilder errorMessage = new StringBuilder();
                errorMessage.append("Can not update a group. Reason: ");
                errorMessage.append(e.getMessage());
                mw.showNotification(ViewConstants.ERROR, errorMessage.toString(),
                        Window.Notification.TYPE_ERROR_MESSAGE);
            }
        }
    });
    modalWindowLayout.addComponent(saveButton);
    return modalWindow;
}

From source file:org.escidoc.browser.ui.tools.BulkDeleteListener.java

License:Open Source License

private static Window buildModalWindow() {
    final Window subWindow = new Window(ViewConstants.WARNING);
    subWindow.setWidth("600px");
    subWindow.setModal(true);/*  www  . j  a  va  2s  .c o  m*/
    return subWindow;
}

From source file:org.escidoc.browser.ui.tools.PurgeButtonListener.java

License:Open Source License

private Window buildModalDialog() {
    final Window subWindow = new Window(ViewConstants.WARNING);
    subWindow.setWidth("600px");
    subWindow.setModal(true);//from  w w  w .j  a v  a  2 s  .c o m

    subWindow.addComponent(new Label(ViewConstants.PURGE_WARNING_MESSAGE, Label.CONTENT_XHTML));
    final HorizontalLayout buttonLayout = new HorizontalLayout();
    subWindow.addComponent(buttonLayout);
    buttonLayout.setSpacing(true);
    buttonLayout.addComponent(new Button(ViewConstants.YES, new ClickListener() {

        @Override
        public void buttonClick(final ClickEvent event) {
            closeDialog(subWindow);
            tryPurge(getSelectedResourceIds(filterButtonListener.getSelectedResources()));
        }
    }));

    buttonLayout.addComponent(new Button(ViewConstants.NO, new ClickListener() {

        @Override
        public void buttonClick(final ClickEvent event) {
            closeDialog(subWindow);
        }

    }));
    return subWindow;
}

From source file:org.escidoc.browser.ui.UserGroupView.java

License:Open Source License

private void addOrgUnitTable(VerticalLayout layout) {
    selectorTable = new Table();
    selectorTable.setWidth("60%");
    selectorTable.setPageLength(7);//  w w w  . j  a  v  a 2 s  .com
    selectorTable.setSelectable(true);
    selectorTable.setImmediate(true);
    selectorTable.setColumnReorderingAllowed(true);

    final BeanItemContainer<ResourceModel> dataSource;
    dataSource = populateContainerTable();

    selectorTable.setContainerDataSource(dataSource);
    selectorTable.setVisibleColumns(new String[] { PropertyId.NAME, (String) PropertyId.ID });
    selectorTable.addActionHandler(new Action.Handler() {

        @Override
        public Action[] getActions(@SuppressWarnings("unused") Object target,
                @SuppressWarnings("unused") Object sender) {
            return ACTIONS_LIST;
        }

        @Override
        public void handleAction(Action action, @SuppressWarnings("unused") Object sender, Object target) {
            if (action.equals(ACTION_ADD)) {
                // mainWindow.addWindow(new OrganizationSelectionView(repositories, resourceProxy, nameField,
                // mainWindow, dataSource).modalWindow());
                openViewAddRemoveOUs();
            } else {
                try {
                    repositories.group().removeOrganization(resourceProxy.getId(),
                            ((ResourceModel) target).getId());
                    selectorTable.removeItem(target);
                    mainWindow.showNotification(
                            "Organization with the id " + resourceProxy.getId() + " is removed from the group.",
                            Window.Notification.TYPE_TRAY_NOTIFICATION);
                } catch (EscidocClientException e) {
                    mainWindow.showNotification("Error removing organizationunit: ", e.getMessage(),
                            Window.Notification.TYPE_ERROR_MESSAGE);

                }
            }
        }

        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 AddOrgUnitstoGroup(router, resourceProxy, 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);

        }
    });
    layout.addComponent(selectorTable);

}

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

License:Open Source License

public void showWindow() {
    final Window subwindow = new Window("Change Category Type");
    subwindow.setModal(true);/*www.  j  a va 2s  . c  om*/

    VerticalLayout layout = new VerticalLayout();
    layout.setMargin(true);
    layout.setSpacing(true);

    Table tblDeleted = new Table("Successfully deleted resources");
    tblDeleted.setWidth("90%");
    tblDeleted.addContainerProperty("Id", String.class, null);
    tblDeleted.addContainerProperty("Resource ", String.class, null);

    for (Map.Entry<String, String> entry : listDeleted.entrySet()) {
        tblDeleted.addItem(new Object[] { entry.getKey(), entry.getValue() }, entry.getKey());
    }
    layout.addComponent(tblDeleted);

    Table tblNotDeleted = new Table("Resources that could not be deleted");
    tblNotDeleted.setWidth("90%");
    tblNotDeleted.addContainerProperty("Resource Id", String.class, null);
    tblNotDeleted.addContainerProperty("Resource & Error", String.class, null);

    for (Map.Entry<String, String> entry : listNotDeleted.entrySet()) {
        tblNotDeleted.addItem(new Object[] { entry.getKey(), entry.getValue() }, entry.getKey());
    }
    layout.addComponent(tblNotDeleted);

    Button close = new Button("Close", new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            (subwindow.getParent()).removeWindow(subwindow);
        }
    });

    layout.addComponent(close);

    subwindow.setWidth("600px");
    subwindow.addComponent(layout);
    router.getMainWindow().addWindow(subwindow);

}

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//ww w . j  a v a2  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 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/* w  w  w . ja  v  a2 s. c  om*/
        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);/*from w w  w  .j  av  a 2 s . c  o m*/
    subwindow.setWidth("500px");

    VerticalLayout layout = (VerticalLayout) subwindow.getContent();
    layout.setMargin(true);
    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.geant.sat.ui.EntityListViewer.java

License:BSD License

/**
 * Creates a subwindow for editing assessor details of entity.
 * /*from w  w w.ja v  a2s  .c  om*/
 * @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);
}