List of usage examples for com.vaadin.ui Button setWidth
@Override public void setWidth(String width)
From source file:com.etest.view.tq.TQCoverageUI.java
Window getTopicWindow(Item item) { Window sub = new Window("TOPIC: "); sub.setWidth("500px"); sub.setModal(true);/*from w w w . j a v a2 s. c o m*/ sub.center(); sub.setResizable(false); VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); v.setSpacing(true); topic.setInputPrompt("Select a Topic.."); topic.addStyleName(ValoTheme.COMBOBOX_SMALL); topic.setWidth("100%"); topic.addValueChangeListener((Property.ValueChangeEvent event) -> { if (event.getProperty().getValue() == null) { } else { syllabusId = (int) event.getProperty().getValue(); topicStr = topic.getItem(topic.getValue()).toString(); } }); v.addComponent(topic); Button button = new Button("CLOSE"); button.setWidth("50%"); button.setIcon(FontAwesome.TASKS); button.addStyleName(ValoTheme.BUTTON_PRIMARY); button.addStyleName(ValoTheme.BUTTON_SMALL); button.addClickListener((Button.ClickEvent event) -> { if (topic.getValue() == null) { Notification.show("Select a Topic!", Notification.Type.WARNING_MESSAGE); } else { populateGridRow(item); populateGridFooter(); } sub.close(); }); v.addComponent(button); v.setComponentAlignment(button, Alignment.MIDDLE_RIGHT); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.etest.view.tq.TQCoverageUI.java
Window getPickWindow(Item item, String propertyId) { Window sub = new Window("Field Value: "); sub.setWidth("150px"); sub.setModal(true);/* w ww. j a v a2s. com*/ sub.center(); sub.setResizable(false); VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); v.setSpacing(true); TextField field = new CommonTextField("Enter Value..", "Enter a Value: "); v.addComponent(field); Button button = new Button("CLOSE"); button.setWidth("100%"); button.setIcon(FontAwesome.TASKS); button.addStyleName(ValoTheme.BUTTON_PRIMARY); button.addStyleName(ValoTheme.BUTTON_SMALL); button.addClickListener((Button.ClickEvent event) -> { boolean isNumeric = CommonUtilities.isNumeric(field.getValue().trim()); if (!isNumeric) { return; } boolean isGreaterThanInTB = tq.isGreaterThanInTB(item, propertyId, field.getValue().trim()); if (isGreaterThanInTB) { Notification.show("Not allowed to exceed in total Items in Test Bank!", Notification.Type.ERROR_MESSAGE); return; } else { item.getItemProperty(CommonUtilities.replaceStringTBToPick(propertyId)) .setValue(CommonUtilities.convertStringToInt(field.getValue())); footer.getCell(CommonUtilities.replaceStringTBToPick(propertyId)).setText(String.valueOf( tq.calculateTotalPickItems(grid, CommonUtilities.replaceStringTBToPick(propertyId)))); } sub.close(); }); v.addComponent(button); v.setComponentAlignment(button, Alignment.BOTTOM_CENTER); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.etest.view.tq.TQCoverageUI.java
Window getMaxItemsWindow(Item item, double previousValue) { Window sub = new Window("Field Value: "); sub.setWidth("150px"); sub.setModal(true);//from w w w . j a v a 2 s . c o m sub.center(); sub.setResizable(false); VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); v.setSpacing(true); TextField field = new CommonTextField("Enter Value..", "Enter a Value: "); v.addComponent(field); Button button = new Button("CLOSE"); button.setWidth("100%"); button.setIcon(FontAwesome.TASKS); button.addStyleName(ValoTheme.BUTTON_PRIMARY); button.addStyleName(ValoTheme.BUTTON_SMALL); button.addClickListener((Button.ClickEvent event) -> { boolean isNumeric = CommonUtilities.isNumeric(field.getValue().trim()); if (!isNumeric) { return; } item.getItemProperty("Max Items").setValue(CommonUtilities.convertStringToDouble(field.getValue())); if (tq.calculateTotalMaxItems(grid) == CommonUtilities .convertStringToDouble(totalItems.getValue().trim())) { footer.getCell("Max Items").setText(String.valueOf(tq.calculateTotalMaxItems(grid))); } else { item.getItemProperty("Max Items").setValue(previousValue); footer.getCell("Max Items").setText(String.valueOf(tq.calculateTotalMaxItems(grid))); ShowErrorNotification.warning("Total Max Items should be equal to Total Test Items"); return; } sub.close(); }); v.addComponent(button); v.setComponentAlignment(button, Alignment.BOTTOM_CENTER); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.etest.view.tq.TQCoverageWindow.java
FormLayout buildForms() { FormLayout form = new FormLayout(); form.setWidth("100%"); form.setMargin(true);/*w w w.j a va 2 s .co m*/ int itemNo = 1; Label caseTopic; Label stem; Map<Integer, Map<Integer, Integer>> tqCoverage = tq.getTQCoverage(getTQCoverageId()); for (Map.Entry<Integer, Map<Integer, Integer>> tqCases : tqCoverage.entrySet()) { Integer tqCaseId = tqCases.getKey(); caseTopic = new Label(); caseTopic.setValue(ccs.getCellCaseById(tqCaseId).getCaseTopic()); caseTopic.setContentMode(ContentMode.HTML); form.addComponent(caseTopic); Map<Integer, Integer> value = tqCases.getValue(); for (Map.Entry<Integer, Integer> itemIds : value.entrySet()) { Integer itemId = itemIds.getKey(); Integer itemKeyId = itemIds.getValue(); List<String> keyList = k.getAllItemKey(itemId); if (keyList.isEmpty()) { ShowErrorNotification .error("No Item Key was found for STEM: \n" + cis.getCellItemById(itemId).getItem()); return null; } stem = new Label(); // stem.setValue(itemNo+". "+cis.getCellItemById(itemId).getItem().replace("{key}", keyList.get(0))); stem.setValue(itemNo + ". " + cis.getCellItemById(itemId).getItem().replace("{key}", k.getItemKeyById(itemKeyId))); stem.setContentMode(ContentMode.HTML); form.addComponent(stem); GridLayout glayout = new GridLayout(2, 2); glayout.setWidth("100%"); glayout.setSpacing(true); glayout.addComponent(new Label("A) " + cis.getCellItemById(itemId).getOptionA(), ContentMode.HTML), 0, 0); glayout.addComponent(new Label("C) " + cis.getCellItemById(itemId).getOptionC(), ContentMode.HTML), 0, 1); glayout.addComponent(new Label("B) " + cis.getCellItemById(itemId).getOptionB(), ContentMode.HTML), 1, 0); glayout.addComponent(new Label("D) " + cis.getCellItemById(itemId).getOptionD(), ContentMode.HTML), 1, 1); form.addComponent(glayout); itemNo++; } } HorizontalLayout h = new HorizontalLayout(); h.setWidth("100%"); Button delete = new Button("DELETE"); delete.setWidth("200px"); delete.setIcon(FontAwesome.TRASH_O); delete.addStyleName(ValoTheme.BUTTON_PRIMARY); delete.addStyleName(ValoTheme.BUTTON_SMALL); delete.addClickListener(buttonClickListener); h.addComponent(delete); Button approve = new Button("APPROVE"); approve.setWidth("200px"); approve.setIcon(FontAwesome.THUMBS_UP); approve.addStyleName(ValoTheme.BUTTON_PRIMARY); approve.addStyleName(ValoTheme.BUTTON_SMALL); approve.addClickListener(buttonClickListener); h.addComponent(approve); if (tq.isTQCoverageApproved(getTQCoverageId())) { approve.setVisible(false); } else { approve.setVisible(true); } form.addComponent(h); return form; }
From source file:com.etest.view.tq.TQCoverageWindow.java
Window confirmDeleteWindow() { Window sub = new Window("TQ Coverage"); sub.setWidth("250px"); sub.setResizable(false);// w w w . j av a2 s .co m sub.setModal(true); sub.center(); VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true); Button delete = new Button("DELETE TQ?"); delete.setWidth("100%"); delete.setIcon(FontAwesome.TRASH_O); delete.addStyleName(ValoTheme.BUTTON_PRIMARY); delete.addStyleName(ValoTheme.BUTTON_SMALL); delete.addClickListener((Button.ClickEvent event) -> { boolean result = tq.deleteTQCoverage(getTQCoverageId()); if (result) { sub.close(); close(); } }); v.addComponent(delete); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.fnc.view.ui.AlphaListMainUI.java
Button alphaListButton() { Button button = new Button("ALPHA LIST"); button.setWidth("100%"); button.setIcon(FontAwesome.SPINNER); button.addStyleName(ValoTheme.BUTTON_PRIMARY); button.addStyleName(ValoTheme.BUTTON_SMALL); button.addClickListener((Button.ClickEvent event) -> { status.setValue(" Loading..."); current = 0.0;//from ww w. j a v a2s . c o m dataSize = es.getEmployeeByBranch(getBranchId()).size(); populateDataGrid(); }); return button; }
From source file:com.fnc.view.ui.thirteenth.ThirteenthMonthUI.java
Button button() { Button button = new Button("ALPHA LIST"); button.setWidth("100%"); button.setIcon(FontAwesome.SPINNER); button.addStyleName(ValoTheme.BUTTON_PRIMARY); button.addStyleName(ValoTheme.BUTTON_SMALL); button.addClickListener((Button.ClickEvent event) -> { status.setValue(" Loading..."); current = 0.0;//from w w w.j a va 2s. co m // dataSize = es.getEmployeeByBranch(getBranchId()).size(); // populateDataGrid(); }); return button; }
From source file:com.foc.vaadin.gui.components.tableAndTree.FVColGen_FocProperty.java
License:Apache License
private Object getDisplayObject_ForProperty_Editable(FocObject focObject, FProperty property, FVTableColumn column, Object columnId) { Object objReturned = null;/*from w w w . j av a 2s. c o m*/ FField field = property != null ? property.getFocField() : null; if (field instanceof FImageField) { objReturned = (AbstractComponent) getTableTreeDelegate().newGuiComponent(focObject, column, property); FVImageField imageField = (FVImageField) objReturned; imageField.setWidth("60px"); imageField.setHeight("50px"); } else if (field instanceof FCloudStorageField) { FCloudStorageProperty csProp = (FCloudStorageProperty) property; if (csProp != null) { FVImageField imageField = new FVImageField(csProp, column.getAttributes()); if (imageField.getBufferedImage() == null) { Resource resource = imageField.getResourceAndSetIcon(); if (resource != null) { Button docIcon = new Button(); docIcon.setStyleName(Runo.BUTTON_LINK); docIcon.setWidth("-1px"); docIcon.setHeight("-1px"); docIcon.setIcon(resource); objReturned = docIcon; } } else { Image image = imageField.getEmbedded(); if (image != null) { int maxWidth = 150; int maxHeight = 150; imageField.resizeImage(image, maxWidth, maxHeight); } objReturned = imageField; } } } else { objReturned = ""; if (property != null) { AbstractComponent abstractComponent = (AbstractComponent) getTableTreeDelegate() .newGuiComponent(focObject, column, property); if (abstractComponent != null) { objReturned = abstractComponent; abstractComponent.addStyleName("editableStyle"); if (abstractComponent instanceof FVTextField) { // ((FVTextField) abstractComponent).selectAll(); /* * ((FVTextField) abstractComponent).addFocusListener(new * FocusListener() { private boolean updating = false; public void * focus(FocusEvent event) { if(!updating){ updating = true; * ((FVTextField) abstractComponent).selectAll(); updating = false; * } } }); */ // Adding the focus listener on the component to be used in the // formula layout if (getFormulaFocusListener() != null) { ((FVTextField) abstractComponent).addFocusListener(getFormulaFocusListener()); } if (isUseReadOnlyFlag()) { ((FVTextField) abstractComponent).addFocusListener(getReadOnlyFocusListener(true)); ((FVTextField) abstractComponent).addBlurListener(getReadOnlyBlurListener(true)); } } else if (abstractComponent instanceof FVCheckBox) { abstractComponent.setCaption(""); } else if (abstractComponent instanceof FVComboBox) { // Adding the focus listener on the component to be used in the // formula layout if (getFormulaFocusListener() != null) { ((FVComboBox) abstractComponent).addFocusListener(getFormulaFocusListener()); } if (isUseReadOnlyFlag()) { ((FVComboBox) abstractComponent).addFocusListener(getReadOnlyFocusListener(true)); ((FVComboBox) abstractComponent).addBlurListener(getReadOnlyBlurListener(true)); } } else if (abstractComponent instanceof FVObjectPopupView) { // Adding the focus listener on the component to be used in the // formula layout FVObjectPopupView popupView = ((FVObjectPopupView) abstractComponent); if (popupView != null && getFormulaFocusListener() != null) { popupView.addPopupVisibilityListener(new PopupVisibilityListener() { @Override public void popupVisibilityChange(PopupVisibilityEvent event) { if (getTableTreeDelegate() != null && event != null && event.getPopupView() != null && event.getPopupView() instanceof FVObjectPopupView) { FVObjectPopupView popupView = (FVObjectPopupView) event.getPopupView(); getTableTreeDelegate().adjustFormulaLayoutForComponent(popupView); } } }); // popupView.addFocusListener(getFormulaFocusListener()); } // if(isUseReadOnlyFlag()){ // popupView.addFocusListener(getReadOnlyFocusListener(true)); // popupView.addBlurListener(getReadOnlyBlurListener(true)); // } } else if (abstractComponent instanceof FVObjectSelector) { // Adding the focus listener on the component to be used in the // formula layout FVObjectComboBox comboBox = ((FVObjectSelector) abstractComponent).getComboBox(); if (comboBox != null && getFormulaFocusListener() != null) { comboBox.addFocusListener(getFormulaFocusListener()); } if (isUseReadOnlyFlag()) { comboBox.addFocusListener(getReadOnlyFocusListener(true)); comboBox.addBlurListener(getReadOnlyBlurListener(true)); } } else if (abstractComponent instanceof FVObjectComboBox && getFormulaFocusListener() != null) { FVObjectComboBox comboBox = (FVObjectComboBox) abstractComponent; if (comboBox != null) { comboBox.addFocusListener(getFormulaFocusListener()); } if (isUseReadOnlyFlag()) { comboBox.addFocusListener(getReadOnlyFocusListener(true)); comboBox.addBlurListener(getReadOnlyBlurListener(true)); } } else if (abstractComponent instanceof FVMultipleChoiceComboBox && getFormulaFocusListener() != null) { FVMultipleChoiceComboBox comboBox = (FVMultipleChoiceComboBox) abstractComponent; if (comboBox != null) { comboBox.addFocusListener(getFormulaFocusListener()); } if (isUseReadOnlyFlag()) { comboBox.addFocusListener(getReadOnlyFocusListener(true)); comboBox.addBlurListener(getReadOnlyBlurListener(true)); } } // Setting the column and row Ids of component FocXMLGuiComponent focXMLGuiComponent = (FocXMLGuiComponent) abstractComponent; FocXMLGuiComponentDelegate focXMLGuiComponentDelegate = focXMLGuiComponent.getDelegate(); if (focXMLGuiComponentDelegate != null) { focXMLGuiComponentDelegate.setColumnId(columnId); if (focObject != null && focObject.getReference() != null) { focXMLGuiComponentDelegate.setRowId(focObject.getReference().getLong()); } } abstractComponent.setId(column.getDataPath()); abstractComponent.setWidth("100%");// This was added to get the node // name text field in the BKDN // tree big enough to enter or see // the value // If we put 100% in the xml we get a small width extendable. but with // this solution we have a fixed minimum width in the xml + the 100% // allows us to change the width if (isUseReadOnlyFlag()) { abstractComponent.setReadOnly(true); } } } } if (property != null && property.isInherited()) { FProperty inheritedProp = null; try { inheritedProp = property.getFocField().getInheritedPropertyGetter() .getInheritedProperty(property.getFocObject(), property); } catch (Exception e) { Globals.logException(e); } if (inheritedProp != null) { objReturned = inheritedProp; } } return objReturned; }
From source file:com.foc.vaadin.gui.components.tableAndTree.FVColGen_FocProperty.java
License:Apache License
private Object getDisplayObject_ForProperty_NonEditable(FocObject focObject, FProperty property, FVTableColumn column, Object columnId) { Object objReturned = null;/*from w w w . j ava2 s .co m*/ FField field = property != null ? property.getFocField() : null; if (property != null) { // Remove the editable component in case the editing status has changed // -------------------------------------------------------------------- String objRef = focObject != null && focObject.getReference() != null ? focObject.getReference().toString() : null; String compName = TableTreeDelegate.newComponentName(getTableName(), objRef, (String) column.getName()); FocXMLLayout focXMLLayout = getFocXMLLayout(); if (focXMLLayout != null) { FocXMLGuiComponent comp = focXMLLayout.removeComponentByName(compName); if (comp != null) { comp.dispose(); } } // -------------------------------------------------------------------- objReturned = property.vaadin_TableDisplayObject(column.getFormat(), column.getCaptionProp()); if (objReturned instanceof Boolean) { if (((Boolean) objReturned).booleanValue()) { objReturned = new Embedded("", new ThemeResource("../runo/icons/16/ok.png")); } else { // objReturned = new Embedded("", new // ThemeResource("../runo/icons/16/cancel.png")); objReturned = FVIconFactory.getInstance().getFVIcon_Embedded(FVIconFactory.ICON_EMPTY, FVIconFactory.SIZE_SMALL); } } else if (field instanceof FCloudStorageField) { FCloudStorageProperty csProp = (FCloudStorageProperty) property; if (csProp != null) { FVImageField imageField = new FVImageField(csProp, column.getAttributes()); if (imageField.getBufferedImage() == null) { Resource resource = imageField.getResourceAndSetIcon(); if (resource != null) { Button docIcon = new Button(); docIcon.setStyleName(Runo.BUTTON_LINK); docIcon.setWidth("-1px"); docIcon.setHeight("-1px"); docIcon.setIcon(resource); objReturned = docIcon; } } else { Image image = imageField.getEmbedded(); if (image != null) { int maxWidth = 150; int maxHeight = 150; imageField.resizeImage(image, maxWidth, maxHeight); } objReturned = imageField; } } } else if (property instanceof FObject || property instanceof FDate || property instanceof FString || property instanceof FDouble || property instanceof FInt || property instanceof FMultipleChoice) { if (property instanceof FMultipleChoice) { objReturned = property.getString(); } FVLabel lbl = null; String styleAttrib = column.getAttributes() != null ? column.getAttributes().getValue(FXML.ATT_STYLE) : null; int maxCharacters = column.getMaxCharacters(); String ttt = null; if (styleAttrib != null && !styleAttrib.isEmpty()) { lbl = new FVLabel((String) objReturned); lbl.parseStyleAttributeValue(styleAttrib); objReturned = lbl; } else if (property instanceof FDouble || (property instanceof FInt && !(property instanceof FMultipleChoice))) { lbl = new FVLabelInTable(property, focObject, column); lbl.copyMemoryToGui(); lbl.addStyleName("foc-text-right"); objReturned = lbl; } if (property instanceof FMultipleChoice) { Object itemObj = ((FMultipleChoice) property).getValue(); if (itemObj != null && itemObj instanceof FMultipleChoiceItem) { FMultipleChoiceItem item = (FMultipleChoiceItem) itemObj; if (lbl == null) { String iconNameInFontAwesome = item != null ? item.getIconFontAwesomeName() : null; if (iconNameInFontAwesome == null) { lbl = new FVLabel(item.getTitle()); // lbl.setIcon(FVIconFactory.getInstance().getFVIcon_Small(path)); } else { FontAwesome icon = FontAwesome.valueOf(iconNameInFontAwesome); lbl = new FVLabel(""); lbl.setCaption(null); lbl.setContentMode(ContentMode.HTML); lbl.setValue(item.getTitle() + " " + icon.getHtml()); } objReturned = lbl; } } } //If RTL I have t put the String in a label to align right if (lbl == null && getFocXMLLayout().isRTL()) { lbl = new FVLabelInTable(property, focObject, column); lbl.copyMemoryToGui(); lbl.addStyleName("foc-text-right"); objReturned = lbl; } //Setting the TTT is necessary //We have 2 conditions: either the objReturned is String or Label. //---------------------------- if (lbl != null) { String originalValue = lbl.getValue(); if (maxCharacters > 0 && originalValue != null && originalValue.length() > maxCharacters) { ttt = originalValue; // lbl.setLocale(); if (getFocXMLLayout().isRTL()) { lbl.addStyleName("foc-cellComment-left"); // lbl.setLocale(new Locale("ar")); StringBuffer buff = new StringBuffer(ttt.substring(0, maxCharacters)); // buff.append("..."); buff.append("..."); lbl.setValue(buff.toString()); } else { lbl.addStyleName("foc-cellComment-right"); lbl.setValue(ttt.substring(0, maxCharacters) + "..."); } } } else if (objReturned instanceof String) { String originalValue = (String) objReturned; if (maxCharacters > 0 && originalValue != null && originalValue.length() > maxCharacters) { ttt = originalValue; if (getFocXMLLayout().isRTL()) { objReturned = ttt.substring(0, maxCharacters) + "..."; } else { objReturned = ttt.substring(0, maxCharacters) + "..."; } } } if (ttt != null && getTableTreeDelegate() != null) { getTableTreeDelegate().addCellTooltipText(focObject.getReference(), columnId, ttt); } //---------------------------- if (lbl != null) { if (getFocXMLLayout().isRTL()) lbl.addStyleName("foc-text-right"); FocXMLGuiComponent focXMLGuiComponent = lbl; FocXMLGuiComponentDelegate componentDelegate = focXMLGuiComponent.getDelegate(); if (componentDelegate != null) { componentDelegate.setColumnId(columnId); if (focObject != null && focObject.getReference() != null) { componentDelegate.setRowId(focObject.getReference().getLong()); } } } if (lbl != null && getFocXMLLayout() != null) getFocXMLLayout().putComponent(compName, lbl); FocXMLAttributes attributes = column.getAttributes(); if (attributes != null && attributes.getValue(FXML.ATT_LINK) != null && attributes.getValue(FXML.ATT_LINK).equals("true")) { HyperLinkButton button = new HyperLinkButton(focObject, objReturned, compName); button.addClickListener(hyperLinkButtonListener); button.addStyleName("focLinkInTable"); objReturned = button; // if(getTableTreeDelegate().getViewContainer_ForOpen() == ITableTree.VIEW_CONTAINER_NEW_BROWSER_TAB){ // BrowserWindowOpener opener = null; // opener = new BrowserWindowOpener(UI.getCurrent().getClass()); // opener.extend(button); // } } } else { objReturned = property; // if((property instanceof FMultipleChoice)){ // FocXMLAttributes attributes = column.getAttributes(); // if(attributes != null && attributes.getValue(FXML.ATT_LINK) != null && attributes.getValue(FXML.ATT_LINK).equals("true")){ // HyperLinkButton button = new HyperLinkButton(focObject, property.getString()); // button.addClickListener(hyperLinkButtonListener); // button.addStyleName("focLinkInTable"); // objReturned = button; // } // } } } // if(objReturned instanceof String){ // objReturned = new Label(objReturned.toString()); // } return objReturned; }
From source file:com.foo01.ui.ReservationDetailView.java
@Override protected final void onBecomingVisible() { getNavigationBar().setCaption("Detail Rezervace"); //buttony pod navbarem HorizontalLayout buttonsLayout = new HorizontalLayout(); buttonsLayout.setStyleName("buttonToolBarLayout"); buttonsLayout.setWidth("100%"); Button deleteButton = new Button(); deleteButton.setCaption("SMAZAT"); deleteButton.setWidth(null); buttonsLayout.addComponent(deleteButton); Label plug = new Label(); buttonsLayout.addComponent(plug);/*from w ww . j a va 2s . c o m*/ Button saveButton = new Button(); saveButton.setCaption("ULOIT"); saveButton.setWidth(null); buttonsLayout.addComponent(saveButton); buttonsLayout.setExpandRatio(plug, 1.0f); List<Source> sourcesList = MockSource.mockSources(); //combobox na zdroje a jmeno uzivatele HorizontalLayout sourceAndNameLayout = new HorizontalLayout(); sourceAndNameLayout.setWidth("100%"); sourceAndNameLayout.setStyleName("sourceAndNameLayout"); NativeSelect select = new NativeSelect(); select.setNullSelectionAllowed(false); System.out.println(Page.getCurrent().getBrowserWindowWidth()); String width = Page.getCurrent().getBrowserWindowWidth() / 2.5 + "px"; select.setWidth(width); select.addItems(sourcesList); for (Source s : sourcesList) { if (reservation.getSource().equals(s)) { select.select(s); break; } } sourceAndNameLayout.addComponent(select); Label plug2 = new Label(); sourceAndNameLayout.addComponent(plug2); Label name = new Label(reservation.getUser()); name.setWidth(null); sourceAndNameLayout.addComponent(name); sourceAndNameLayout.setExpandRatio(plug2, 1.0f); //datepickery DatePicker dateFrom = new DatePicker(); dateFrom.setStyleName("datePickerDetailView"); dateFrom.setValue(reservation.getBeginning()); dateFrom.setUseNative(true); dateFrom.setResolution(Resolution.TIME); dateFrom.setWidth("100%"); DatePicker dateTo = new DatePicker(); dateTo.setStyleName("datePickerDetailView"); dateTo.setValue(reservation.getEnding()); dateTo.setUseNative(true); dateTo.setResolution(Resolution.TIME); dateTo.setWidth("100%"); //layout pro slider a popisky HorizontalLayout sliderLayout = new HorizontalLayout(); sliderLayout.setStyleName("sliderLayout"); sliderLayout.setWidth("100%"); sliderLayout.setSpacing(true); Label sliderCaption = new Label("Po?et: "); sliderCaption.addStyleName("sliderCaption"); sliderCaption.setWidth(null); sliderLayout.addComponent(sliderCaption); final Label horvalue = new Label(); horvalue.setWidth("45px"); horvalue.setStyleName("value"); sliderLayout.addComponent(horvalue); final Slider horslider = new Slider(1, 10); horslider.setOrientation(SliderOrientation.HORIZONTAL); horslider.setValue(Double.valueOf(1)); horslider.getState(); horslider.getValue(); horslider.setImmediate(true); horslider.setWidth("100%"); sliderLayout.addComponent(horslider); sliderLayout.setExpandRatio(horslider, 1.0f); horvalue.setValue(String.valueOf(horslider.getValue().intValue())); horslider.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { int value = horslider.getValue().intValue(); horvalue.setValue(String.valueOf(value)); } }); //switch schvaleno HorizontalLayout switchLayout = new HorizontalLayout(); switchLayout.setStyleName("switchLayout"); switchLayout.addComponent(new Label("Schvleno:")); switchLayout.setSpacing(true); Switch checkbox = new Switch(null, true); switchLayout.addComponent(checkbox); //popis rezervace TextArea description = new TextArea(); description.setStyleName("descriptionDetailView"); description.setWidth("100%"); description.setImmediate(false); description.setCaption("Popis:"); description.setValue(reservation.getDescription()); //description.setRequired(true); description.setRequiredError("Popis mus bt zadn!"); description.setNullRepresentation(""); description.setReadOnly(true); //description.setRows(0); final VerticalLayout content = new VerticalLayout(); content.setMargin(true); content.setSpacing(true); content.setStyleName(width); content.addComponent(buttonsLayout); content.addComponent(sourceAndNameLayout); content.addComponent(dateFrom); content.addComponent(dateTo); content.addComponent(sliderLayout); content.addComponent(switchLayout); content.addComponent(description); setContent(content); }