List of usage examples for com.vaadin.ui Component addStyleName
public void addStyleName(String style);
From source file:com.github.wolfie.detachedtabs.DetachedTabs.java
License:Open Source License
private void adjustTabStyles() { if (!tabs.isEmpty()) { final Component first = tabs.get(0); Component last = first;/* ww w . j a v a 2 s . c o m*/ for (final Component tab : tabs) { tab.setStyleName(TAB_CLASS); last = tab; } first.addStyleName(TAB_FIRST_CLASS); last.addStyleName(TAB_LAST_CLASS); if (shownTab != null) { shownTab.addStyleName(TAB_SELECTED_CLASS); } } }
From source file:com.google.code.vaadin.internal.preconfigured.VaadinComponentsInjector.java
License:Apache License
private void configureComponentApi(Component component, Preconfigured preconfigured) { component.setEnabled(preconfigured.enabled()); component.setVisible(preconfigured.visible()); component.setReadOnly(preconfigured.readOnly()); String[] styleName = preconfigured.styleName(); if (styleName.length > 0) { for (String style : styleName) { component.addStyleName(style); }//from w ww .ja v a 2 s .c om } configureLocalization(component, preconfigured); String id = preconfigured.id(); if (!id.isEmpty()) { component.setId(id); } if (preconfigured.sizeFull()) { component.setSizeFull(); } else if (preconfigured.sizeUndefined()) { component.setSizeUndefined(); } else { float width = preconfigured.width(); if (width > -1.0f) { Sizeable.Unit widthUnits = preconfigured.widthUnits(); component.setWidth(width, widthUnits); } float height = preconfigured.height(); if (height > -1.0f) { Sizeable.Unit heightUnits = preconfigured.heightUnits(); component.setHeight(height, heightUnits); } } }
From source file:com.haulmont.cuba.web.gui.components.mainwindow.WebAppWorkArea.java
License:Apache License
@Override public void setInitialLayout(VBoxLayout initialLayout) { if (state == State.WINDOW_CONTAINER) { throw new IllegalStateException( "Unable to change AppWorkArea initial layout in WINDOW_CONTAINER state"); }// ww w. j a va 2 s. c om Preconditions.checkNotNullArgument(initialLayout); if (this.initialLayout != null) { component.removeComponent(WebComponentsHelper.getComposition(this.initialLayout)); } this.initialLayout = initialLayout; initialLayout.setParent(this); initialLayout.setSizeFull(); Component vInitialLayout = WebComponentsHelper.getComposition(initialLayout); vInitialLayout.addStyleName(INITIAL_LAYOUT_STYLENAME); component.addComponent(vInitialLayout); }
From source file:com.haulmont.cuba.web.toolkit.ui.CubaManagedTabSheet.java
License:Apache License
protected void hideTabContent(Component component) { component.removeStyleName(VISIBLE_TAB); component.addStyleName(HIDDEN_TAB); }
From source file:com.haulmont.cuba.web.toolkit.ui.CubaManagedTabSheet.java
License:Apache License
protected void showTabContent(Component component) { component.removeStyleName(HIDDEN_TAB); component.addStyleName(VISIBLE_TAB); }
From source file:com.haulmont.ext.web.ui.Call.CallBrowser.java
License:Open Source License
protected void addLocStateColumn() { MetaPropertyPath pp = callDs.getMetaClass().getPropertyEx("locState"); com.vaadin.ui.Table vTable = (com.vaadin.ui.Table) WebComponentsHelper.unwrap(callTable); vTable.removeGeneratedColumn(pp);/* w w w. j av a2 s . c o m*/ vTable.addGeneratedColumn(pp, new com.vaadin.ui.Table.ColumnGenerator() { public com.vaadin.ui.Component generateCell(com.vaadin.ui.Table source, Object itemId, Object columnId) { UUID uuid = (UUID) itemId; com.vaadin.ui.Component component; Doc doc = callDs.getItem(uuid); boolean containsCard = cards != null ? cards.contains(doc) : false; if (doc != null && !WfUtils.isCardInStateList(doc, "Finished", "Canceled", "Obrabotan") && (containsCard || (!containsCard && WfUtils.isCardInState(doc, "New")))) { final PopupButton popupButton = new WebPopupButton(); popupButton.setCaption(callDs.getItem((UUID) itemId).getLocState()); int a = callTable.getSelected().size(); popupButton.addAction(new AbstractAction("onChange") { public void actionPerform(Component component) { if (callTable.getSelected().size() >= 1) { popupButton.setEnabled(false); } else popupButton.setEnabled(true); } }); component = WebComponentsHelper.unwrap(popupButton); ((org.vaadin.hene.popupbutton.PopupButton) component) .addListener(createProcessMenuBuilder(doc, callTable, popupButton)); component.addStyleName("link"); component.addStyleName("dashed"); } else { component = new com.vaadin.ui.Label(doc == null ? "" : doc.getLocState(), com.vaadin.ui.Label.CONTENT_XHTML); } component.setWidth("-1px"); return component; } }); }
From source file:com.haulmont.ext.web.ui.Call.CallBrowser.java
License:Open Source License
protected void addCommentColumn() { MetaPropertyPath pp = callDs.getMetaClass().getPropertyPath("comment"); com.vaadin.ui.Table vTable = (com.vaadin.ui.Table) WebComponentsHelper.unwrap(callTable); vTable.removeGeneratedColumn(pp);/*from w w w . j a v a2 s. c o m*/ vTable.addGeneratedColumn(pp, new com.vaadin.ui.Table.ColumnGenerator() { public com.vaadin.ui.Component generateCell(com.vaadin.ui.Table source, Object itemId, Object columnId) { UUID uuid = (UUID) itemId; com.vaadin.ui.Component component; Doc doc = callDs.getItem(uuid); String descr = doc.getComment(); int enterIdx = descr != null ? (descr.length() > 40 ? 40 : descr.indexOf('\n')) : -1; //? ?? if (enterIdx != -1) { com.vaadin.ui.TextField content = new com.vaadin.ui.TextField(null, descr); content.setReadOnly(true); content.setWidth("300px"); content.setHeight("300px"); component = new com.vaadin.ui.PopupView("<span>" + descr.substring(0, enterIdx) + "...</span>", content); component.addStyleName("longtext"); } else { component = new com.vaadin.ui.Label(descr == null ? "" : descr); } component.setWidth("-1px"); return component; } }); }
From source file:com.haulmont.ext.web.ui.CauseGIBDD.CauseGIBDDBrowser.java
License:Open Source License
protected void addLocStateColumn() { MetaPropertyPath pp = docsDs.getMetaClass().getPropertyEx("locState"); com.vaadin.ui.Table vTable = (com.vaadin.ui.Table) WebComponentsHelper.unwrap(docsTable); vTable.removeGeneratedColumn(pp);//w w w . j av a 2 s . c o m vTable.addGeneratedColumn(pp, new com.vaadin.ui.Table.ColumnGenerator() { public com.vaadin.ui.Component generateCell(com.vaadin.ui.Table source, Object itemId, Object columnId) { UUID uuid = (UUID) itemId; com.vaadin.ui.Component component; Doc doc = docsDs.getItem(uuid); boolean containsCard = cards != null ? cards.contains(doc) : false; if (doc != null && !WfUtils.isCardInStateList(doc, "Finished", "Canceled", "Obrabotan") && (containsCard || (!containsCard && WfUtils.isCardInState(doc, "New")))) { final PopupButton popupButton = new WebPopupButton(); popupButton.setCaption(docsDs.getItem((UUID) itemId).getLocState()); int a = docsTable.getSelected().size(); popupButton.addAction(new AbstractAction("onChange") { public void actionPerform(Component component) { if (docsTable.getSelected().size() >= 1) { popupButton.setEnabled(false); } else popupButton.setEnabled(true); } }); component = WebComponentsHelper.unwrap(popupButton); ((org.vaadin.hene.popupbutton.PopupButton) component) .addListener(createProcessMenuBuilder(doc, docsTable, popupButton)); component.addStyleName("link"); component.addStyleName("dashed"); } else { component = new com.vaadin.ui.Label(doc == null ? "" : doc.getLocState(), com.vaadin.ui.Label.CONTENT_XHTML); } component.setWidth("-1px"); return component; } }); }
From source file:com.haulmont.ext.web.ui.CauseGIBDD.CauseGIBDDBrowser.java
License:Open Source License
protected void addCommentColumn() { MetaPropertyPath pp = docsDs.getMetaClass().getPropertyPath("comment"); com.vaadin.ui.Table vTable = (com.vaadin.ui.Table) WebComponentsHelper.unwrap(docsTable); vTable.removeGeneratedColumn(pp);//from ww w. j av a 2s. com vTable.addGeneratedColumn(pp, new com.vaadin.ui.Table.ColumnGenerator() { public com.vaadin.ui.Component generateCell(com.vaadin.ui.Table source, Object itemId, Object columnId) { UUID uuid = (UUID) itemId; com.vaadin.ui.Component component; Doc doc = docsDs.getItem(uuid); String descr = doc.getComment(); int enterIdx = descr != null ? (descr.length() > 40 ? 40 : descr.indexOf('\n')) : -1; //? ?? if (enterIdx != -1) { com.vaadin.ui.TextField content = new com.vaadin.ui.TextField(null, descr); content.setReadOnly(true); content.setWidth("300px"); content.setHeight("300px"); component = new com.vaadin.ui.PopupView("<span>" + descr.substring(0, enterIdx) + "...</span>", content); component.addStyleName("longtext"); } else { component = new com.vaadin.ui.Label(descr == null ? "" : descr); } component.setWidth("-1px"); return component; } }); }
From source file:com.javashop.snippets.ui.dashboard.DashboardMenuLayout.java
License:Apache License
public void addMenu(final Component menu) { menu.addStyleName("valo-menu-part"); menuArea.addComponent(menu); }