List of usage examples for com.vaadin.ui CssLayout CssLayout
public CssLayout()
From source file:org.eclipse.skalli.view.internal.window.ProjectEditPanel.java
License:Open Source License
/** * Renders a OK/Cancel/Validate/Expand All/Collapse All button bar. *//*w w w . j a v a 2s . c om*/ @SuppressWarnings("serial") private Button renderButtons(VerticalLayout layout, boolean header) { CssLayout buttons = new CssLayout(); buttons.addStyleName(STYLE_EDIT_PROJECT_BUTTONS); String prefix = header ? HEADER : FOOTER; Button okButton = new Button("OK"); okButton.setIcon(ICON_BUTTON_OK); okButton.setDescription("Save the modified project"); okButton.addStyleName(prefix + BUTTON_OK); okButton.addListener(new OKButtonListener()); buttons.addComponent(okButton); Button cancelButton = new Button("Cancel"); cancelButton.setIcon(ICON_BUTTON_CANCEL); cancelButton.setDescription("Discard all changes to the project"); cancelButton.addStyleName(prefix + BUTTON_CANCEL); cancelButton.addListener(new CancelButtonListener()); buttons.addComponent(cancelButton); Button checkButton = new Button("Check"); checkButton.setIcon(ICON_BUTTON_VALIDATE); checkButton.setDescription("Checks the modified project for issues without saving it"); checkButton.addStyleName(prefix + BUTTON_VALIDATE); checkButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { validateModifiedProject(); } }); buttons.addComponent(checkButton); Button expandAllButton = new Button("Expand All"); expandAllButton.setIcon(ICON_BUTTON_EXPAND_ALL); expandAllButton.setDescription("Expand all panels"); expandAllButton.addStyleName(prefix + BUTTON_EXPAND_ALL); expandAllButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { expandAllPanels(); } }); buttons.addComponent(expandAllButton); Button collapseAllButton = new Button("Collapse All"); collapseAllButton.setIcon(ICON_BUTTON_COLLAPSE_ALL); collapseAllButton.setDescription("Collapse all panels"); collapseAllButton.addStyleName(prefix + BUTTON_COLLAPSE_ALL); collapseAllButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { collapseAllPanels(); } }); buttons.addComponent(collapseAllButton); layout.addComponent(buttons); layout.setComponentAlignment(buttons, Alignment.MIDDLE_CENTER); return checkButton; }
From source file:org.eclipse.skalli.view.internal.window.ProjectEditPanelEntry.java
License:Open Source License
@SuppressWarnings("serial") private ComponentContainer createTray() { CssLayout layout = new CssLayout(); layout.setStyleName(STYLE_TRAY);//from w ww .j a v a 2 s.c om layout.setMargin(true); HorizontalLayout header = new HorizontalLayout(); header.setSpacing(true); header.setStyleName(STYLE_TRAY_HEADER); header.setWidth("100%"); //$NON-NLS-1$ trayIcon = new Embedded(); trayIcon.setStyleName(STYLE_TRAY_HEADER_ICON); final String icon = formService.getIconPath(); if (StringUtils.isNotBlank(icon)) { trayIcon.setSource(new StreamResource(new ExtensionStreamSource(formService.getClass(), icon), FilenameUtils.getName(icon), application)); } header.addComponent(trayIcon); header.setComponentAlignment(trayIcon, Alignment.MIDDLE_LEFT); header.setExpandRatio(trayIcon, 0); Label captionLabel = new Label(getCaptionWithAnchor(), Label.CONTENT_XHTML); captionLabel.setStyleName(STYLE_TRAY_HEADER_LABEL); header.addComponent(captionLabel); header.setExpandRatio(captionLabel, 1); header.setComponentAlignment(captionLabel, Alignment.MIDDLE_LEFT); editButton = new Button(); layoutLinkButton(editButton, header, new ClickListener() { @Override public void buttonClick(ClickEvent event) { switch (state) { case DISABLED: setState(TrayState.EDITABLE_VISIBLE); break; case INHERITED_VISIBLE: setState(TrayState.EDITABLE_VISIBLE); break; case INHERITED_INVISIBLE: setState(TrayState.EDITABLE_VISIBLE); break; } } }); inheritButton = new Button(); layoutLinkButton(inheritButton, header, new ClickListener() { @Override public void buttonClick(ClickEvent event) { form.commit(); switch (state) { case DISABLED: setState(TrayState.INHERITED_VISIBLE); break; case EDITABLE_VISIBLE: setState(TrayState.INHERITED_VISIBLE); break; case EDITABLE_INVISIBLE: setState(TrayState.INHERITED_VISIBLE); break; } } }); disableButton = new Button(); layoutLinkButton(disableButton, header, new ClickListener() { @Override public void buttonClick(ClickEvent event) { form.commit(); switch (state) { case EDITABLE_INVISIBLE: setState(TrayState.DISABLED); break; case EDITABLE_VISIBLE: setState(TrayState.DISABLED); break; case INHERITED_INVISIBLE: setState(TrayState.DISABLED); break; case INHERITED_VISIBLE: setState(TrayState.DISABLED); break; } } }); visibleButton = new NativeButton(); layoutIconButton(visibleButton, header, new ClickListener() { @Override public void buttonClick(ClickEvent event) { switch (state) { case EDITABLE_INVISIBLE: setState(TrayState.EDITABLE_VISIBLE); break; case EDITABLE_VISIBLE: setState(TrayState.EDITABLE_INVISIBLE); break; case INHERITED_INVISIBLE: setState(TrayState.INHERITED_VISIBLE); break; case INHERITED_VISIBLE: setState(TrayState.INHERITED_INVISIBLE); break; } } }); layout.addComponent(header); CssLayout content = new CssLayout(); Label descriptionLabel = new Label(extensionService.getDescription(), Label.CONTENT_XHTML); descriptionLabel.setStyleName(STYLE_TRAY_DESCRIPTION); content.addComponent(descriptionLabel); layout.addComponent(content); return layout; }
From source file:org.escidoc.browser.elabsmodul.views.helpers.ResourcePropertiesViewHelper.java
License:Open Source License
public Panel generatePropertiesView() { // Item title String resourceType = resourceProxy.getType().toString(); if (this.type != null && this.type.length() > 0) { resourceType = this.type; }/* www . jav a 2 s .co m*/ final Label titleLabel = new Label(resourceType.substring(0, 1).toUpperCase() + resourceType.substring(1).toLowerCase() + ": " + resourceProxy.getName()); titleLabel.setDescription("header"); titleLabel.setStyleName("h2 fullwidth"); // HR Ruler final Label descRuler = new Label("<hr/>", Label.CONTENT_RAW); descRuler.setStyleName("hr"); // ItemProperties View final CssLayout propertiesView = new CssLayout(); propertiesView.setWidth("100%"); propertiesView.setHeight("100%"); final Label descMetadata1 = new Label("ID: " + resourceProxy.getId()); final Label descMetadata2 = new Label( LAST_MODIFIED_BY + " " + resourceProxy.getModifier() + " on " + resourceProxy.getModifiedOn(), Label.CONTENT_XHTML); final Panel pnlPropertiesLeft = buildLeftPanel(); pnlPropertiesLeft.setWidth("40%"); pnlPropertiesLeft.setHeight("20px"); pnlPropertiesLeft.setStyleName(FLOAT_LEFT); pnlPropertiesLeft.addStyleName(Runo.PANEL_LIGHT); pnlPropertiesLeft.getLayout().setMargin(false); pnlPropertiesLeft.addComponent(descMetadata1); final Panel pnlPropertiesRight = buildRightPanel(); pnlPropertiesRight.setWidth("60%"); pnlPropertiesRight.setHeight("20px"); pnlPropertiesRight.setStyleName(FLOAT_RIGHT); pnlPropertiesRight.addStyleName(Runo.PANEL_LIGHT); pnlPropertiesRight.getLayout().setMargin(false); pnlPropertiesRight.addComponent(descMetadata2); propertiesView.addComponent(pnlPropertiesLeft); propertiesView.addComponent(pnlPropertiesRight); Panel viewHandler = buildmainView(); new BreadCrumbMenu(viewHandler, breadCrumbModel, serviceLocation); viewHandler.addComponent(titleLabel); viewHandler.addComponent(descRuler); viewHandler.addComponent(propertiesView); return viewHandler; }
From source file:org.escidoc.browser.layout.NavigationSimpleLayout.java
License:Open Source License
private CssLayout newHeaderButton(final TreeDataSource ds) { CssLayout cssLayout = new CssLayout(); cssLayout.setWidth("97%"); cssLayout.setMargin(false);//from w w w. j a v a 2 s. com ThemeResource plusIcon = new ThemeResource("images/assets/plus.png"); final Button createGroupButton = new Button(); createGroupButton.setStyleName(BaseTheme.BUTTON_LINK); createGroupButton.addStyleName("floatright paddingtop3"); createGroupButton.setWidth("20px"); createGroupButton.setIcon(plusIcon); createGroupButton.addListener(new ClickListener() { @Override public void buttonClick(@SuppressWarnings("unused") final ClickEvent event) { showCreateGroupView(); } private void showCreateGroupView() { router.getMainWindow().addWindow( new CreateGroupView(repositories.group(), router.getMainWindow(), ds).modalWindow()); } }); cssLayout.addComponent(createGroupButton); return cssLayout; }
From source file:org.escidoc.browser.layout.SimpleLayout.java
License:Open Source License
private HorizontalSplitPanel buildContainer() throws EscidocClientException, UnsupportedOperationException, URISyntaxException { // common part: create layout container = new HorizontalSplitPanel(); container.setStyleName(Runo.SPLITPANEL_SMALL); container.setImmediate(false);/*from ww w . j a v a2s. co m*/ container.setMargin(false); container.setSplitPosition(20, Sizeable.UNITS_PERCENTAGE); container.setSizeFull(); container.setLocked(false); // navigationPanel NavigationSimpleLayout navigationLayout = new NavigationSimpleLayout(this, navigationPanel, vlNavigationPanel); navigationPanel = navigationLayout.buildNavigationPanel(); container.addComponent(navigationPanel); this.treeDataSource = navigationLayout.getTreeDataSource(); // TabContainer cssContent = new CssLayout(); cssContent.setSizeFull(); cssContent.setMargin(false); mainContentTabs = buildTabContainer(); cssContent.addComponent(mainContentTabs); container.addComponent(cssContent); return container; }
From source file:org.escidoc.browser.layout.UserView.java
License:Open Source License
private void addDetailView(VerticalLayout left) { CssLayout cssLayout = new CssLayout(); cssLayout.setSizeFull();// w w w . ja v a2 s .c o m left.addComponent(cssLayout); cssLayout.addComponent(name); }
From source file:org.escidoc.browser.ui.maincontent.ContainerMetadataRecordsView.java
License:Open Source License
@SuppressWarnings("serial") private Panel lblAddtionalResources() { final Panel pnl = new Panel(); pnl.setSizeFull();/* w w w.j av a2 s . c o m*/ VerticalLayout hl = new VerticalLayout(); hl.setSizeFull(); final Button btnVersionHistoryContainer = new Button("Container Version History", new VersionHistoryClickListener(resourceProxy, mainWindow, repositories)); btnVersionHistoryContainer.setStyleName(BaseTheme.BUTTON_LINK); btnVersionHistoryContainer.setDescription("Show Version history in a Pop-up"); final CssLayout cssLayout = new CssLayout(); buildPanelHeader(cssLayout, "Additional Resources"); ThemeResource ICON = new ThemeResource("images/assets/plus.png"); 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(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); subwindow.addComponent(new Label("Not yet implemented")); Button close = new Button("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); hl.addComponent(cssLayout); hl.addComponent(btnVersionHistoryContainer); pnl.setContent(hl); return pnl; }
From source file:org.escidoc.browser.ui.maincontent.ContainerMetadataRecordsView.java
License:Open Source License
private Panel lblMetadaRecs() { panel.setSizeFull();/*from www . ja va2s . c o m*/ VerticalLayout vl = new VerticalLayout(); vl.setSizeFull(); final CssLayout cssLayout = new CssLayout(); cssLayout.setHeight("20px"); buildPanelHeader(cssLayout, ViewConstants.METADATA); ThemeResource ICON = new ThemeResource("images/assets/plus.png"); if (containerController.hasAccess()) { final Button btnAddNew = new Button(); btnAddNew.addListener(new OnAddContainerMetadata(mainWindow, repositories, resourceProxy)); btnAddNew.setStyleName(BaseTheme.BUTTON_LINK); btnAddNew.addStyleName("floatright paddingtop3"); btnAddNew.setWidth("20px"); btnAddNew.setIcon(ICON); cssLayout.addComponent(btnAddNew); } vl.addComponent(cssLayout); ContainerMetadataTable metadataTable = new ContainerMetadataTable(resourceProxy.getMetadataRecords(), containerController, router, resourceProxy, repositories); metadataTable.buildTable(); vl.addComponent(metadataTable); vl.setComponentAlignment(metadataTable, Alignment.TOP_LEFT); vl.setExpandRatio(metadataTable, 0.9f); panel.setContent(vl); return panel; }
From source file:org.escidoc.browser.ui.maincontent.ContainerView.java
License:Open Source License
private VerticalLayout buildVlResourceProperties() { // common part: create layout VerticalLayout vlResourceProperties = new VerticalLayout(); vlResourceProperties.setImmediate(false); vlResourceProperties.setWidth("100.0%"); vlResourceProperties.setHeight("100.0%"); vlResourceProperties.setMargin(false); CssLayout cssLayout = new CssLayout(); cssLayout.setWidth("100%"); cssLayout.setHeight("100%"); // creating the properties / without the breadcrump createProperties(cssLayout);//from w ww .j ava 2 s. co m vlResourceProperties.addComponent(cssLayout); return vlResourceProperties; }
From source file:org.escidoc.browser.ui.maincontent.ContextRightPanel.java
License:Open Source License
@SuppressWarnings("serial") private Panel buildAdminDescription() { final Panel admDescriptors = new Panel(); admDescriptors.setWidth("100%"); admDescriptors.setHeight("100%"); VerticalLayout vl = new VerticalLayout(); vl.setSizeFull();/*from w ww.j av a 2 s. co m*/ final CssLayout cssLayout = new CssLayout(); buildPanelHeader(cssLayout, ViewConstants.ADMIN_DESCRIPTION); ThemeResource ICON = new ThemeResource("images/assets/plus.png"); if (contextController.canUpdateContext()) { 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") ClickEvent event) { new OnContextAdminDescriptor(router, contextController).adminDescriptorForm(); } }); cssLayout.addComponent(addResourceButton); } vl.addComponent(cssLayout); VerticalLayout vl2 = new VerticalLayout(); final AdminDescriptors admDesc = resourceProxy.getAdminDescription(); final AdminDescriptorsTable adminDescriptorTable = new AdminDescriptorsTable(contextController, admDesc, router); adminDescriptorTable.buildTable(); vl2.addComponent(adminDescriptorTable); vl.addComponent(vl2); vl.setExpandRatio(vl2, 9); admDescriptors.setContent(vl); return admDescriptors; }