List of usage examples for com.vaadin.ui Component setWidth
public void setWidth(String width);
From source file:com.emuanalytics.vaadin.enhancedjavascript.BasicTestUI.java
License:Apache License
private Component createTestPanel() { TextField valueField = new TextField("Server value to send:"); valueField.setId("server-value-input"); Button setValueButton = new Button("Set Value From Server", clickEvent -> { sampleComponent.setValue(valueField.getValue()); });//from w ww. j a v a 2 s. c o m setValueButton.setId("set-value-button"); Button setTitleButton = new Button("Set Title From Server", clickEvent -> { sampleComponent.setTitle(valueField.getValue()); }); setTitleButton.setId("set-title-button"); Button setValueRPCButton = new Button("Set Value Via RPC", clickEvent -> { sampleComponent.setValueViaRPC(valueField.getValue()); }); setValueRPCButton.setId("set-value-rpc-button"); CheckBox immediateCheckbox = new CheckBox("Immediate variable notification"); immediateCheckbox.addValueChangeListener(e -> { sampleComponent.setImmediate(immediateCheckbox.getValue()); }); immediateCheckbox.setId("immediate-checkbox"); lastEventField = new TextField("Last event:"); lastEventField.setId("last-event-field"); lastVariableChangeField = new TextField("Last variable change:"); lastVariableChangeField.setId("last-variable-change-field"); VerticalLayout testLayout = new VerticalLayout(valueField, setValueButton, setTitleButton, setValueRPCButton, immediateCheckbox, lastEventField, lastVariableChangeField); testLayout.setWidth("300px"); testLayout.setSpacing(true); for (Component c : testLayout) { c.setWidth("100%"); } return testLayout; }
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);//from w w w .java 2s . co m if (component instanceof AbstractTextField || component instanceof RichTextArea) { component.setWidth("100%"); } 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();//from w ww . jav a 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);//from w w w . j av a 2 s.c om 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();/* ww w .j a va2s. c om*/ 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);// w w w . j a v a 2 s . com 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); }//w ww. j a v a 2 s .c o 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);// w w w . j a v a 2 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.BeanList.java
License:Open Source License
public void loadItems(List<T> currentListData) { contentLayout.removeAllComponents(); try {// ww w .j a v a2 s . c om if (CollectionUtils.isEmpty(currentListData) && isDisplayEmptyListText) { Label noItemLbl = new Label(AppContext.getMessage(GenericI18Enum.EXT_NO_ITEM)); final VerticalLayout widgetFooter = new VerticalLayout(); widgetFooter.addStyleName("widget-footer"); widgetFooter.setWidth("100%"); widgetFooter.addComponent(noItemLbl); widgetFooter.setComponentAlignment(noItemLbl, Alignment.MIDDLE_CENTER); contentLayout.addComponent(widgetFooter); } else { int i = 0; for (T item : currentListData) { RowDisplayHandler<T> rowHandler = constructRowDisplayHandler(); Component row = rowHandler.generateRow(item, i); if (row != null) { row.setWidth("100%"); contentLayout.addComponent(row); } i++; } } } catch (Exception e) { LOG.error("Error while generate column display", e); } }
From source file:com.esofthead.mycollab.vaadin.ui.FormContainer.java
License:Open Source License
public void addSection(Component sectionHeader, ComponentContainer container) { sectionHeader.addStyleName("section"); sectionHeader.setWidth("100%"); container.setWidth("100%"); this.addComponent(sectionHeader); this.addComponent(container); }