List of usage examples for com.vaadin.ui Window getContent
@Override
public Component getContent()
From source file:org.escidoc.browser.ui.maincontent.ContextRightPanel.java
License:Open Source License
@SuppressWarnings("serial") private Panel buildOrganizationUnit() { final Panel pnlOrgUnit = new Panel(); pnlOrgUnit.setSizeFull();//from www . ja va 2 s . com VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); final CssLayout cssLayout = new CssLayout(); buildPanelHeader(cssLayout, ViewConstants.ORGANIZATIONAL_UNIT); ThemeResource ICON = new ThemeResource("images/assets/plus.png"); if (contextController.canAddOUs()) { final Button addResourceButton = new Button(); addResourceButton.setStyleName(BaseTheme.BUTTON_LINK); addResourceButton.addStyleName("floatright paddingtop3"); addResourceButton.setWidth("20px"); addResourceButton.setIcon(ICON); addResourceButton.addListener(new ClickListener() { @Override public void buttonClick(@SuppressWarnings("unused") final ClickEvent event) { 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, contextController, resourceProxy.getOrganizationalUnit())); } catch (EscidocClientException e) { contextController.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); } }); cssLayout.addComponent(addResourceButton); } vl.addComponent(cssLayout); OrganizationalUnitsTableVH orgUnitTable = new OrganizationalUnitsTableVH(contextController, resourceProxy.getOrganizationalUnit(), router, resourceProxy); orgUnitTable.buildTable(); vl.addComponent(orgUnitTable); vl.setComponentAlignment(orgUnitTable, Alignment.TOP_LEFT); vl.setExpandRatio(orgUnitTable, 9f); pnlOrgUnit.setContent(vl); return pnlOrgUnit; }
From source file:org.escidoc.browser.ui.maincontent.ContextView.java
License:Open Source License
/** * Called in the reSwapComponents()/*from w ww .j av a2s .c om*/ * * @return String */ public void addCommentWindow(final String status) { final Window subwindow = new Window(ViewConstants.SUBWINDOW_EDIT); subwindow.setModal(true); // Configure the windws layout; by default a VerticalLayout VerticalLayout layout = (VerticalLayout) subwindow.getContent(); layout.setMargin(true); layout.setSpacing(true); layout.setSizeUndefined(); final TextArea editor = new TextArea("Your Comment"); editor.setRequired(true); editor.setRequiredError("The Field may not be empty."); HorizontalLayout hl = new HorizontalLayout(); Button close = new Button("Update", new Button.ClickListener() { @Override public void buttonClick(@SuppressWarnings("unused") com.vaadin.ui.Button.ClickEvent event) { // close the window by removing it from the parent window String comment = editor.getValue().toString(); try { contextController.updatePublicStatus(status, resourceProxy.getId(), comment); mainWindow.showNotification("Context Status updated successfully", Notification.TYPE_TRAY_NOTIFICATION); } catch (EscidocClientException e) { mainWindow.showNotification( "Could not update Context Type, an error occurred" + e.getLocalizedMessage(), Notification.TYPE_ERROR_MESSAGE); } (subwindow.getParent()).removeWindow(subwindow); } }); Button cancel = new Button("Cancel", new Button.ClickListener() { @Override public void buttonClick(@SuppressWarnings("unused") com.vaadin.ui.Button.ClickEvent event) { (subwindow.getParent()).removeWindow(subwindow); } }); hl.addComponent(close); hl.addComponent(cancel); subwindow.addComponent(editor); subwindow.addComponent(hl); mainWindow.addWindow(subwindow); }
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();//from w w w . j av a2 s.co 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);// ww w .j a va 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.UserGroupView.java
License:Open Source License
private void addOrgUnitTable(VerticalLayout layout) { selectorTable = new Table(); selectorTable.setWidth("60%"); selectorTable.setPageLength(7);//w ww . j a va 2 s .c o m 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.OrganizationalUnitsTableVH.java
License:Open Source License
@Override protected void addActionLists() { // if (contextController.canUpdateContext()) { table.addActionHandler(new Action.Handler() { @Override//from www . ja v a 2s . 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/*from w ww . j a va 2s.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);/* ww w . j a v 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.metawidget.example.vaadin.addressbook.AddressBook.java
License:BSD License
@Override public void init() { setTheme("addressbook"); Window mainWindow = new Window("Address Book (Metawidget Vaadin Example)"); ((Layout) mainWindow.getContent()).setMargin(false); mainWindow.addComponent(mContent);/* ww w. j a v a 2 s .c o m*/ setMainWindow(mainWindow); }
From source file:org.opencms.ui.dialogs.history.CmsHistoryDialog.java
License:Open Source License
/** * Replaces the contents of the window containing a given component with a basic dialog * consisting of a back button to restore the previous window state and another user provided widget.<p> * * @param currentComponent the component whose parent window's content should be replaced * @param newView the user supplied part of the new window content * @param newCaption the caption for the child dialog *//*from w ww . j av a 2s . c o m*/ public static void openChildDialog(Component currentComponent, Component newView, String newCaption) { final Window window = CmsVaadinUtils.getWindow(currentComponent); final String oldCaption = window.getCaption(); CmsBasicDialog dialog = new CmsBasicDialog(); VerticalLayout vl = new VerticalLayout(); dialog.setContent(vl); Button backButton = new Button(CmsVaadinUtils.getMessageText(Messages.GUI_CHILD_DIALOG_GO_BACK_0)); HorizontalLayout buttonBar = new HorizontalLayout(); buttonBar.addComponent(backButton); buttonBar.setMargin(true); vl.addComponent(buttonBar); vl.addComponent(newView); final Component oldContent = window.getContent(); if (oldContent instanceof CmsBasicDialog) { List<CmsResource> infoResources = ((CmsBasicDialog) oldContent).getInfoResources(); dialog.displayResourceInfo(infoResources); if (oldContent instanceof CmsHistoryDialog) { dialog.addButton(((CmsHistoryDialog) oldContent).createCloseButton()); } } backButton.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { window.setContent(oldContent); window.setCaption(oldCaption); window.center(); } }); window.setContent(dialog); window.setCaption(newCaption); window.center(); }