List of usage examples for com.vaadin.ui Button setStyleName
@Override public void setStyleName(String style)
From source file:org.eclipse.skalli.view.ext.impl.internal.infobox.TagComponent.java
License:Open Source License
@SuppressWarnings({ "deprecation", "serial" }) private void paintEditTagList() { tagListLayout.removeAllComponents(); tagListLayout.setWidth("100%"); //$NON-NLS-1$ Label tagLabel = new Label("Tags:"); tagLabel.setSizeUndefined();//w w w . j a va2 s . c om tagListLayout.addComponent(tagLabel); SortedSet<String> tags = TaggingUtils.getTags(project); for (String tag : tags) { Layout l = new CssLayout() { @Override protected String getCss(Component c) { if (c instanceof Label) { return "float: left; line-height: 18px; padding-right: 3px"; //$NON-NLS-1$ } else { return "float: left; line-height: 18px; padding-right: 5px"; //$NON-NLS-1$ } } }; Label label = new Label(tag); label.setSizeUndefined(); l.addComponent(label); Button removeButton = new Button("(remove)", new ClickListener() { @Override public void buttonClick(ClickEvent event) { String tag = (String) event.getButton().getData(); TaggingUtils.removeTag(project, tag); util.persist(project); paintTagEdit(); } }); removeButton.setStyleName(Button.STYLE_LINK); removeButton.setData(tag); removeButton.setSizeUndefined(); l.addComponent(removeButton); tagListLayout.addComponent(l); } }
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 . jav a 2 s . 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 addSearch(VerticalLayout left) { HorizontalLayout horizontalLayout = new HorizontalLayout(); horizontalLayout.setMargin(true, true, true, true); horizontalLayout.setSpacing(true);// www. j a v a2s .c o m TextField c = new TextField(); c.setWidth("400px"); Button button = new Button("Search"); button.setStyleName(Reindeer.BUTTON_SMALL); horizontalLayout.addComponent(c); horizontalLayout.addComponent(button); left.addComponent(horizontalLayout); }
From source file:org.escidoc.browser.ui.landingview.LandingViewImpl.java
License:Open Source License
@Override public void addStartButton(final Button button) { Preconditions.checkNotNull(button, "button is null: %s", button); button.setClickShortcut(KeyCode.ENTER); button.setStyleName(Runo.BUTTON_SMALL); formLayout.addComponent(button);/*from w w w.j a v a 2 s. co m*/ }
From source file:org.escidoc.browser.ui.listeners.OnEditContainerMetadata.java
License:Open Source License
private Component buildMdUpdateLink(final Window modalWindow) { Button mdUpdateLink = new Button(ViewConstants.OPEN_METADATA_IN_EDITOR, new Button.ClickListener() { @Override//from ww w. ja va2s .co m public void buttonClick(@SuppressWarnings("unused") ClickEvent event) { closeModalWindow(modalWindow); openMetadataEditor(); } private void openMetadataEditor() { mainWindow.open(new ExternalResource(buildMdUpdateUri(getAppBaseUri()), "_blank")); } private String getAppBaseUri() { StringBuilder builder = new StringBuilder(); // @formatter:off builder.append(getAppUrl().getProtocol()).append("://").append(getAppUrl().getAuthority()); // @formatter:on return builder.toString(); } private URL getAppUrl() { return mainWindow.getApplication().getURL(); } private void closeModalWindow(final Window modalWindow) { mainWindow.removeWindow(modalWindow); } }); mdUpdateLink.setStyleName(BaseTheme.BUTTON_LINK); return mdUpdateLink; }
From source file:org.escidoc.browser.ui.listeners.RelationsClickListener.java
License:Open Source License
public Layout getRelations(final Repository cr, final String id, final Window subwindow) throws EscidocClientException { final Relations relations = cr.getRelations(id); final HorizontalLayout hl = new HorizontalLayout(); for (final Relation relation : relations) { String predicate;/*from ww w .j a va 2s .c om*/ if (relation.getPredicate().indexOf("#") != -1) { predicate = relation.getPredicate().substring(relation.getPredicate().lastIndexOf('#'), relation.getPredicate().length()); } else { predicate = relation.getPredicate(); } final String prefixPath = relation.getXLinkHref().substring(0, relation.getXLinkHref().lastIndexOf('/')); type = ResourceType.getValue(prefixPath); final Button btnRelation = new Button( itemProxy.getName() + " relation as " + predicate + " of " + relation.getXLinkTitle()); btnRelation.setStyleName(BaseTheme.BUTTON_LINK); btnRelation.addListener(new ClickListener() { @Override public void buttonClick(final ClickEvent event) { if (type.name().equals("CONTAINER")) { try { new ContainerController(repositories, router, repositories.container().findById(relation.getObjid())); } catch (final EscidocClientException e) { mainWindow.showNotification(e.getLocalizedMessage()); e.printStackTrace(); } } else if (type.name().equals("ITEM")) { try { new ItemController(repositories, router, repositories.item().findById(relation.getObjid())); } catch (final EscidocClientException e) { mainWindow.showNotification(e.getLocalizedMessage()); } } } }); hl.addComponent(btnRelation); LOG.debug("relation title: " + relation.getXLinkTitle()); } return hl; }
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();//from w w w . ja va2 s. c om 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 w w w .ja va 2s .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.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 a v a2s . c o 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; }
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();/* w w w . j a va 2s. co m*/ 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; }