List of usage examples for com.vaadin.ui Component setCaption
public void setCaption(String caption);
From source file:com.esofthead.mycollab.mobile.ui.grid.GridCellWrapper.java
License:Open Source License
public void addComponent(Component component) { if (!(component instanceof Button)) component.setCaption(null); if (component instanceof AbstractTextField || component instanceof RichTextArea) { component.setWidth("100%"); }/*from ww w . j a v a 2 s. c om*/ super.addComponent(component); }
From source file:com.esofthead.mycollab.mobile.ui.GridFormLayoutHelper.java
License:Open Source License
public Component addComponent(final Component field, final String caption, final int columns, final int rows, final int colspan, final int rowspan, final Alignment alignment) { if (caption != null) { final Label l = new Label(caption); l.setSizeUndefined();//ww w . ja va 2s .c o m this.layout.addComponent(l, 2 * columns, rows); this.layout.setComponentAlignment(l, alignment); this.layout.addComponent(field, 2 * columns + 1, rows, 2 * (columns + colspan - 1) + 1, rows + rowspan); this.layout.setColumnExpandRatio(2 * columns + 1, 1.0f); if (!(field instanceof Button)) field.setCaption(null); return field; } this.layout.addComponent(field, 2 * columns, rows, 2 * (columns + colspan - 1) + 1, rows + rowspan); this.layout.setColumnExpandRatio(2 * columns + 1, 1.0f); if (!(field instanceof Button)) field.setCaption(null); field.setWidth("100%"); return field; }
From source file:com.esofthead.mycollab.mobile.ui.GridFormLayoutHelper.java
License:Open Source License
public Component addComponent(final Component field, final String caption, final int columns, final int rows, final int colspan, final String width, final Alignment alignment) { if (caption != null) { final Label l = new Label(caption); final HorizontalLayout captionWrapper = new HorizontalLayout(); captionWrapper.addComponent(l);// w w w . jav a2 s . c o m captionWrapper.setComponentAlignment(l, alignment); captionWrapper.setStyleName("gridform-caption"); captionWrapper.setMargin(true); captionWrapper.setWidth(this.defaultCaptionWidth); if (columns == 0) { captionWrapper.addStyleName("first-col"); } if (rows == 0) { captionWrapper.addStyleName("first-row"); } if ((rows + 1) % 2 == 0) captionWrapper.addStyleName("even-row"); this.layout.addComponent(captionWrapper, 2 * columns, rows); captionWrapper.setHeight("100%"); } final HorizontalLayout fieldWrapper = new HorizontalLayout(); fieldWrapper.setStyleName("gridform-field"); fieldWrapper.setMargin(true); fieldWrapper.addComponent(field); if (!(field instanceof Button)) field.setCaption(null); field.setWidth(width); fieldWrapper.setWidth("100%"); if (rows == 0) { fieldWrapper.addStyleName("first-row"); } if ((rows + 1) % 2 == 0) { fieldWrapper.addStyleName("even-row"); } this.layout.addComponent(fieldWrapper, 2 * columns + 1, rows, 2 * (columns + colspan - 1) + 1, rows); this.layout.setColumnExpandRatio(2 * columns + 1, 1.0f); return field; }
From source file:com.esofthead.mycollab.mobile.ui.GridFormLayoutHelper.java
License:Open Source License
public Component addComponent(final Component field, final String caption, final int columns, final int rows, final int colspan, final String width, final String height, final Alignment alignment) { final Label l = new Label(caption); l.setSizeUndefined();//from w w w.j av a 2 s .c o m this.layout.addComponent(l, 2 * columns, rows); this.layout.setComponentAlignment(l, alignment); this.layout.addComponent(field, 2 * columns + 1, rows, 2 * (columns + colspan - 1) + 1, rows); this.layout.setColumnExpandRatio(2 * columns + 1, 1.0f); if (!(field instanceof Button)) field.setCaption(null); field.setWidth(width); return field; }
From source file:com.esofthead.mycollab.mobile.ui.GridFormLayoutHelper.java
License:Open Source License
public Component addComponent(final Component field, final String caption, final int columns, final int rows, final String width, final Alignment alignment) { if (caption != null) { final Label l = new Label(caption); // l.setHeight("100%"); final HorizontalLayout captionWrapper = new HorizontalLayout(); captionWrapper.addComponent(l);//ww w .j a va 2s. c o m captionWrapper.setComponentAlignment(l, alignment); captionWrapper.setWidth(this.defaultCaptionWidth); captionWrapper.setHeight("100%"); captionWrapper.setStyleName("gridform-caption"); captionWrapper.setMargin(true); if (columns == 0) { captionWrapper.addStyleName("first-col"); } if (rows == 0) { captionWrapper.addStyleName("first-row"); } this.layout.addComponent(captionWrapper, 2 * columns, rows); } final HorizontalLayout fieldWrapper = new HorizontalLayout(); fieldWrapper.setStyleName("gridform-field"); if (!(field instanceof Button)) field.setCaption(null); fieldWrapper.addComponent(field); field.setWidth(width); fieldWrapper.setWidth("100%"); fieldWrapper.setMargin(true); if (rows == 0) { fieldWrapper.addStyleName("first-row"); } this.layout.addComponent(fieldWrapper, 2 * columns + 1, rows); this.layout.setColumnExpandRatio(2 * columns + 1, 1.0f); return field; }
From source file:com.esofthead.mycollab.mobile.ui.GridFormLayoutHelper.java
License:Open Source License
public Component addComponentNoWrapper(final Component field, final String caption, final int columns, final int rows) { if (caption != null) { final Label l = new Label(caption); l.setWidth(this.defaultCaptionWidth); this.layout.addComponent(l, 2 * columns, rows); this.layout.setComponentAlignment(l, this.captionAlignment); }/*from w w w. j av a 2 s.co m*/ if (!(field instanceof Button)) field.setCaption(null); field.setWidth(fieldControlWidth); this.layout.addComponent(field, 2 * columns + 1, rows); this.layout.setColumnExpandRatio(2 * columns + 1, 1.0f); return field; }
From source file:com.esofthead.mycollab.mobile.ui.GridFormLayoutHelper.java
License:Open Source License
public Component addComponent(Component fieldValue, Component fieldCaption, String defaultCaptionWidth, String fieldValueWidth, int columns, int rows, Alignment alignment) { final HorizontalLayout captionWrapper = new HorizontalLayout(); captionWrapper.addComponent(fieldCaption); captionWrapper.setComponentAlignment(fieldCaption, alignment); captionWrapper.setWidth(defaultCaptionWidth); captionWrapper.setHeight("100%"); captionWrapper.setMargin(true);//from w w w . ja va2 s . co m captionWrapper.setStyleName("gridform-caption"); if (columns == 0) { captionWrapper.addStyleName("first-col"); } if (rows == 0) { captionWrapper.addStyleName("first-row"); } this.layout.addComponent(captionWrapper, 2 * columns, rows); final HorizontalLayout fieldWrapper = new HorizontalLayout(); fieldWrapper.setStyleName("gridform-field"); if (!(fieldValue instanceof Button)) fieldValue.setCaption(null); fieldWrapper.addComponent(fieldValue); fieldValue.setWidth(fieldValueWidth); fieldWrapper.setWidth("100%"); fieldWrapper.setMargin(true); if (rows == 0) { fieldWrapper.addStyleName("first-row"); } this.layout.addComponent(fieldWrapper, 2 * columns + 1, rows); this.layout.setColumnExpandRatio(2 * columns + 1, 1.0f); return fieldValue; }
From source file:com.esofthead.mycollab.vaadin.ui.GridFormLayoutHelper.java
License:Open Source License
public void addComponentNoWrapper(final Component field, final String caption, final int columns, final int rows) { if (caption != null) { final Label l = new Label(caption); l.setWidth(this.defaultCaptionWidth); this.layout.addComponent(l, 2 * columns, rows); this.layout.setComponentAlignment(l, this.captionAlignment); }//w w w . j a v a 2 s . c om if (!(field instanceof Button)) field.setCaption(null); if (field instanceof MultiSelectComp) { field.setWidth("200px"); } else { field.setWidth(fieldControlWidth); } this.layout.addComponent(field, 2 * columns + 1, rows); this.layout.setColumnExpandRatio(2 * columns + 1, 1.0f); }
From source file:com.esofthead.mycollab.vaadin.web.ui.grid.GridCellWrapper.java
License:Open Source License
public void addComponent(Component component) { if (!(component instanceof Button)) component.setCaption(null); if (component instanceof MultiSelectComp) { component.setWidth("200px"); } else if (component instanceof AbstractTextField || component instanceof RichTextArea) { component.setWidth("100%"); }/* ww w. ja v a2 s . c o m*/ super.addComponent(component); }
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 va 2s. com 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); } } }