List of usage examples for com.vaadin.ui Component addStyleName
public void addStyleName(String style);
From source file:com.esofthead.mycollab.vaadin.ui.ServiceMenu.java
License:Open Source License
public void selectService(int index) { Iterator<Component> iterator = this.iterator(); int i = 0;//w w w . ja va 2 s . c om while (iterator.hasNext()) { Component comp = iterator.next(); if (i == index) { comp.addStyleName(SELECTED_STYLENAME); } else { comp.removeStyleName(SELECTED_STYLENAME); } i++; } }
From source file:com.esofthead.mycollab.vaadin.web.ui.AbstractBeanPagedList.java
License:Open Source License
public void setSelectedRow(Component row) { for (int i = 0; i < listContainer.getComponentCount(); i++) { listContainer.getComponent(i).removeStyleName("selected"); }/*from ww w. ja v a2 s . com*/ row.addStyleName("selected"); }
From source file:com.esofthead.mycollab.vaadin.web.ui.NotificationComponent.java
License:Open Source License
@Override public void popupVisibilityChange(PopupVisibilityEvent event) { notificationContainer.removeAllComponents(); if (notificationItems.size() > 0) { for (int i = 0; i < notificationItems.size(); i++) { AbstractNotification item = notificationItems.get(i); Component comp = buildComponentFromNotification(item); comp.setStyleName("notification-type"); comp.addStyleName("notification-type-" + item.getType()); notificationContainer.addComponent(comp); if (i < notificationItems.size() - 1) { notificationContainer.addComponent(ELabel.hr()); }/* w ww . j a va 2 s . c o m*/ } } else { Label noItemLbl = new Label(AppContext.getMessage(ShellI18nEnum.OPT_NO_NOTIFICATION)); notificationContainer.addComponent(noItemLbl); notificationContainer.setComponentAlignment(noItemLbl, Alignment.MIDDLE_CENTER); } }
From source file:com.esofthead.mycollab.vaadin.web.ui.OptionPopupContent.java
License:Open Source License
public void addDangerOption(Component btn) { CssLayout wrap = new CssLayout(); btn.setWidth("100%"); btn.addStyleName("action"); wrap.addStyleName("action-wrap danger"); wrap.addComponent(btn);/*from www . j a v a 2s . c om*/ ((ComponentContainer) this.getCompositionRoot()).addComponent(wrap); }
From source file:com.esofthead.mycollab.vaadin.web.ui.ServiceMenu.java
License:Open Source License
public void selectService(int index) { Iterator<Component> iterator = this.iterator(); int i = 0;/*from ww w .j a v a 2 s . c o m*/ while (iterator.hasNext()) { Component comp = iterator.next(); if (i == index) { comp.addStyleName(SELECTED_STYLENAME); } else { comp.removeStyleName(SELECTED_STYLENAME); } i++; } }
From source file:com.example.bbs.vaadin.view.ValoMenuLayout.java
License:Apache License
public void addMenu(Component menu) { menu.addStyleName(ValoTheme.MENU_PART); menuArea.addComponent(menu); }
From source file:com.foc.vaadin.gui.FocXMLGuiComponentStatic.java
License:Apache License
public static void applyAttributes(FocXMLGuiComponent xmlComponent, Attributes attributes) { if (attributes != null && xmlComponent != null) { try {//from w ww. ja v a 2s .c o m Component component = (Component) xmlComponent; String visible = attributes.getValue(FXML.ATT_VISIBLE); if (visible != null) { if (visible.equals("false")) { component.setVisible(false); } else { component.setVisible(true); } } String captionMode = attributes.getValue(FXML.ATT_CAPTION_MODE); if (captionMode != null) { if (captionMode.equals("vertical")) { component.addStyleName("vertical"); } } applyAttributes_WidthHeight(component, attributes); if (component instanceof AbstractOrderedLayout) { String spacing = attributes.getValue(FXML.ATT_SPACING); if (spacing == null || spacing.equals("false")) { ((AbstractOrderedLayout) component).setSpacing(false); } else { ((AbstractOrderedLayout) component).setSpacing(true); } } if (component instanceof AbstractLayout) { String margin = attributes.getValue(FXML.ATT_MARGIN); if (Globals.isValo()) { if (margin != null && margin.equals("true")) { ((AbstractLayout) component).addStyleName("focMargin"); } } else { if (margin == null || margin.equals("false")) { ((AbstractLayout) component).addStyleName("focNoMargin"); } } } String description = attributes.getValue(FXML.ATT_DESCRIPTION); if (description != null && !description.isEmpty() && component instanceof AbstractComponent) { AbstractComponent abstractComponent = (AbstractComponent) component; abstractComponent.setDescription(description); } String caption = attributes.getValue(FXML.ATT_CAPTION); String captPos = attributes.getValue(FXML.ATT_CAPTION_POSITION); if (caption != null) { if (captPos != null) { if (!captPos.equals("left") && !captPos.equals("right")) component.setCaption(caption); } else { component.setCaption(caption); } } String captMargin = attributes.getValue(FXML.ATT_CAPTION_MARGIN); if (captMargin != null && captMargin.equals("0") && (caption == null || (captPos != null && !captPos.equals("top")))) { setCaptionMargin_Zero(component); } //Style Attribute String style = attributes.getValue(FXML.ATT_STYLE); applyStyle(component, style); xmlComponent.refreshEditable(); if (attributes != null) { String border = attributes.getValue(FXML.ATT_BORDER); if (border != null) { border = border.toLowerCase(); if (border.equals("true")) { component.addStyleName("border"); } else { component.addStyleName("foc-border-" + border); } } } String tabIndexString = attributes.getValue(FXML.ATT_TABINDEX); if (!Utils.isStringEmpty(tabIndexString) && xmlComponent.getFormField() != null) { int tabIndex = Utils.parseInteger(tabIndexString, -1); xmlComponent.getFormField().setTabIndex(tabIndex); } String iconName = attributes.getValue(FXML.ATT_ICON); if (!Utils.isStringEmpty(iconName)) { FontIcon icon = FontAwesome.valueOf(iconName.toUpperCase()); if (icon != null) { component.setIcon(icon); } } if (!(component instanceof Layout) && ConfigInfo.isGuiRTL() && !(component instanceof FVTextField) && !(component instanceof FVDateField) && !(component instanceof FVComboBox) && !(component instanceof FVTextArea) && !(component instanceof FVObjectComboBox) && !(component instanceof FVMultipleChoiceComboBox)) { component.addStyleName("foc-floatNone"); } } catch (Exception e) { Globals.logException(e); } } }
From source file:com.foc.vaadin.gui.FocXMLGuiComponentStatic.java
License:Apache License
public static void setCaptionMargin_Zero(Component component) { component.setCaption(null);//from w w w . j av a 2 s . c om component.addStyleName("focNoCaptionMargin"); if (Globals.isValo()) { if (component instanceof AbstractOrderedLayout) { AbstractOrderedLayout lay = (AbstractOrderedLayout) component; lay.setMargin(false); } } }
From source file:com.foc.vaadin.gui.FocXMLGuiComponentStatic.java
License:Apache License
public static void applyStyle(Component component, String style) { if (component != null && style != null) { String[] styleArray = style.split(","); for (int i = 0; i < styleArray.length; i++) { component.addStyleName("foc-" + styleArray[i]); }//from ww w.j a va 2 s. co m } }
From source file:com.foc.vaadin.gui.layouts.FVTabbedLayout.java
License:Apache License
@Override public void addComponent(Component comp, Attributes attributes) { comp.addStyleName("padding"); String title = attributes.getValue(FXML.ATT_TITLE); if (title == null) { title = attributes.getValue(FXML.ATT_NAME); }//ww w. ja va2s . c o m String positionString = attributes.getValue(FXML.ATT_TAB_POSITION); if (positionString != null) { int position = 0; try { position = Integer.parseInt(positionString); } catch (NumberFormatException e) { Globals.logException(e); } addTab(comp, title, null, position); } else { addTab(comp, title); } if (delegate != null && delegate.isConstructionMode()) { removeTab(getTab(addTabLayout)); addTab(addTabLayout, "+"); } }