List of usage examples for com.vaadin.ui CssLayout addComponent
@Override public void addComponent(Component c)
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);/* ww w . j av 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; }//from w w w .j a v 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);// w ww . j a v a2s. c o m 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.UserView.java
License:Open Source License
private void addDetailView(VerticalLayout left) { CssLayout cssLayout = new CssLayout(); cssLayout.setSizeFull();//from ww w. j a v a 2s . com 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 a 2 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 static void buildPanelHeader(CssLayout cssLayout, String name) { cssLayout.addStyleName("v-accordion-item-caption v-caption v-captiontext"); cssLayout.setWidth("100%"); cssLayout.setMargin(false);/* ww w .ja v a2 s . com*/ final Label nameofPanel = new Label(name, Label.CONTENT_RAW); nameofPanel.setStyleName("accordion v-captiontext"); nameofPanel.setWidth("70%"); cssLayout.addComponent(nameofPanel); }
From source file:org.escidoc.browser.ui.maincontent.ContainerMetadataRecordsView.java
License:Open Source License
private Panel lblMetadaRecs() { panel.setSizeFull();// www . ja v a2s. co 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
/** * Binding Context Properties 2 sets of labels in 2 rows * /*from ww w.j a v a 2s .c o m*/ * @param cssLayout */ private void bindProperties(CssLayout cssLayout) { Panel pnlPropertiesLeft = buildLeftPropertiesPnl(); Panel pnlPropertiesRight = buildRightPnlProperties(); final Label descMetadata1 = new Label("ID: " + resourceProxy.getId()); status = resourceProxy.getType().getLabel() + " is "; lockStatus = status; lblStatus = new Label(status + resourceProxy.getStatus(), Label.CONTENT_RAW); lblStatus.setDescription(ViewConstants.DESC_STATUS); lblLockstatus = new Label(status + resourceProxy.getLockStatus(), Label.CONTENT_RAW); lblLockstatus.setDescription(ViewConstants.DESC_LOCKSTATUS); if (hasAccess()) { lblLockstatus.setStyleName("inset"); } final Label descMetadata2 = new Label(ViewConstants.CREATED_BY + " " + resourceProxy.getCreator() + " on " + resourceProxy.getCreatedOn() + "<br/>" + ViewConstants.LAST_MODIFIED_BY + " " + resourceProxy.getModifier() + " on " + resourceProxy.getModifiedOn() + "<br />" + "Released by " + resourceProxy.getReleasedBy() + " on " + resourceProxy.getLatestVersionModifiedOn(), Label.CONTENT_XHTML); vlPropertiesLeft.addComponent(descMetadata1); if (hasAccess()) { status = "Latest status is "; lblCurrentVersionStatus = new Label(status + resourceProxy.getVersionStatus()); lblCurrentVersionStatus.setDescription(ViewConstants.DESC_STATUS); lblCurrentVersionStatus.setStyleName("inset"); vlPropertiesLeft.addComponent(lblCurrentVersionStatus); } else { vlPropertiesLeft.addComponent(lblStatus); } vlPropertiesLeft.addComponent(lblLockstatus); pnlPropertiesLeft.addComponent(vlPropertiesLeft); cssLayout.addComponent(pnlPropertiesLeft); pnlPropertiesRight.addComponent(descMetadata2); cssLayout.addComponent(pnlPropertiesRight); }
From source file:org.escidoc.browser.ui.maincontent.ContainerView.java
License:Open Source License
private static void addHorizontalRuler(CssLayout cssLayout) { final Label descRuler = new Label("<hr />", Label.CONTENT_RAW); descRuler.setStyleName("hr"); cssLayout.addComponent(descRuler); }
From source file:org.escidoc.browser.ui.maincontent.ContainerView.java
License:Open Source License
private void bindDescription(CssLayout cssLayout) { final Label description = new Label(ViewConstants.DESCRIPTION_LBL + resourceProxy.getDescription()); description.setStyleName(ViewConstants.FULLWIDHT_STYLE_NAME); cssLayout.addComponent(description); }