List of usage examples for com.vaadin.ui GridLayout getRows
public int getRows()
From source file:com.klwork.explorer.project.MyCalendarView.java
License:Apache License
private void initLayoutContent() { initNavigationButtons();//w w w. j a va 2 s .c o m initHideWeekEndButton(); initReadOnlyButton(); initDisabledButton(); initAddNewEventButton(); HorizontalLayout hl = new HorizontalLayout(); hl.setWidth("100%"); hl.setSpacing(true); hl.setMargin(new MarginInfo(false, false, true, false)); hl.addComponent(prevButton); hl.addComponent(captionLabel); hl.addComponent(monthButton); hl.addComponent(weekButton); hl.addComponent(nextButton); hl.setComponentAlignment(prevButton, Alignment.MIDDLE_LEFT); hl.setComponentAlignment(captionLabel, Alignment.MIDDLE_CENTER); hl.setComponentAlignment(monthButton, Alignment.MIDDLE_CENTER); hl.setComponentAlignment(weekButton, Alignment.MIDDLE_CENTER); hl.setComponentAlignment(nextButton, Alignment.MIDDLE_RIGHT); monthButton.setVisible(viewMode == Mode.WEEK); weekButton.setVisible(viewMode == Mode.DAY); HorizontalLayout controlPanel = new HorizontalLayout(); controlPanel.setSpacing(true); controlPanel.setMargin(new MarginInfo(false, false, true, false)); controlPanel.setWidth("100%"); //controlPanel.addComponent(localeSelect); //controlPanel.addComponent(timeZoneSelect); controlPanel.addComponent(formatSelect); controlPanel.addComponent(hideWeekendsButton); //controlPanel.addComponent(readOnlyButton); //controlPanel.addComponent(disabledButton); controlPanel.addComponent(addNewEvent); /*controlPanel.setComponentAlignment(timeZoneSelect, Alignment.MIDDLE_LEFT);*/ controlPanel.setComponentAlignment(formatSelect, Alignment.MIDDLE_LEFT); /*controlPanel.setComponentAlignment(localeSelect, Alignment.MIDDLE_LEFT);*/ controlPanel.setComponentAlignment(hideWeekendsButton, Alignment.MIDDLE_LEFT); /* controlPanel.setComponentAlignment(readOnlyButton, Alignment.MIDDLE_LEFT); controlPanel.setComponentAlignment(disabledButton, Alignment.MIDDLE_LEFT);*/ controlPanel.setComponentAlignment(addNewEvent, Alignment.MIDDLE_LEFT); GridLayout layout = (GridLayout) getContent(); layout.addComponent(controlPanel); layout.addComponent(hl); layout.addComponent(calendarComponent); layout.setRowExpandRatio(layout.getRows() - 1, 1.0f); }
From source file:de.metas.ui.web.vaadin.window.editor.FieldEditorsContainer.java
License:Open Source License
private void addChildEditor(final Label label, final Component editorComp, final PropertyLayoutInfo layoutInfo) { final GridLayout content = getContent(); int labelColumn = contentNextColumn * 2; int labelRow = contentNextRow; if (layoutInfo.isNextColumn()) { labelColumn = content.getColumns(); labelRow = 0;//from w w w . ja va2 s .co m } final int editorRowsSpan = layoutInfo.getRowsSpan(); final int editorColumnFrom = labelColumn + 1; final int editorColumnTo = editorColumnFrom; final int editorRowFrom = labelRow; final int editorRowTo = editorRowFrom + (editorRowsSpan - 1); if (editorColumnTo >= content.getColumns()) { content.setColumns(editorColumnTo + 1); } if (editorRowTo >= content.getRows()) { content.setRows(editorRowTo + 1); } // // if (label != null) { content.addComponent(label, labelColumn, labelRow); content.setComponentAlignment(label, Alignment.MIDDLE_RIGHT); } content.addComponent(editorComp, editorColumnFrom, editorRowFrom, editorColumnTo, editorRowTo); content.setComponentAlignment(editorComp, Alignment.MIDDLE_LEFT); editorComp.setSizeFull(); // // // contentNextColumn; contentNextRow = editorRowTo + 1; }
From source file:edu.kit.dama.ui.admin.utils.UIComponentTools.java
License:Apache License
/** * *///w w w . j a v a2s .c o m private static void setLockedGridComponents(GridLayout layout, boolean locked) { for (int i = 0; i < layout.getColumns(); i++) { for (int j = 0; j < layout.getRows(); j++) { if (layout.getComponent(i, j) == null) { continue; } if (layout.getComponent(i, j).getClass().equals(Button.class)) { layout.getComponent(i, j).setEnabled(!locked); } else if (layout.getComponent(i, j).getClass().equals(ComboBox.class)) { layout.getComponent(i, j).setEnabled(!locked); layout.getComponent(i, j).setReadOnly(false); } else { layout.getComponent(i, j).setReadOnly(locked); } } } }
From source file:org.ikasan.dashboard.ui.administration.panel.PlatformConfigurationPanel.java
License:BSD License
protected Panel createMapPanel(final ConfigurationParameterMapImpl parameter) { Panel paramPanel = new Panel(); paramPanel.setStyleName("dashboard"); paramPanel.setWidth("100%"); GridLayout paramLayout = new GridLayout(2, 3); paramLayout.setSpacing(true);// w w w . ja v a2 s . com paramLayout.setSizeFull(); paramLayout.setMargin(true); paramLayout.setColumnExpandRatio(0, .25f); paramLayout.setColumnExpandRatio(1, .75f); Label label = new Label("Platform Configuration"); label.addStyleName(ValoTheme.LABEL_HUGE); label.setSizeUndefined(); paramLayout.addComponent(label, 0, 0, 1, 0); paramLayout.setComponentAlignment(label, Alignment.TOP_LEFT); final Map<String, String> valueMap = parameter.getValue(); final GridLayout mapLayout = new GridLayout(5, (valueMap.size() != 0 ? valueMap.size() : 1) + 1); mapLayout.setColumnExpandRatio(0, .05f); mapLayout.setColumnExpandRatio(1, .425f); mapLayout.setColumnExpandRatio(2, .05f); mapLayout.setColumnExpandRatio(3, .425f); mapLayout.setColumnExpandRatio(4, .05f); mapLayout.setMargin(true); mapLayout.setSpacing(true); mapLayout.setWidth("100%"); int i = 0; for (final String key : valueMap.keySet()) { final Label keyLabel = new Label("Name:"); final Label valueLabel = new Label("Value:"); final TextField keyField = new TextField(); keyField.setValue(key); keyField.setWidth("100%"); keyField.setNullSettingAllowed(false); keyField.addValidator( new NonZeroLengthStringValidator("Then configuration value name cannot be empty!")); keyField.setValidationVisible(false); final TextField valueField = new TextField(); valueField.setWidth("100%"); valueField.setValue(valueMap.get(key)); valueField.setNullSettingAllowed(false); valueField.addValidator(new NonZeroLengthStringValidator("Then configuration value cannot be empty!")); valueField.setValidationVisible(false); mapLayout.addComponent(keyLabel, 0, i); mapLayout.setComponentAlignment(keyLabel, Alignment.MIDDLE_RIGHT); mapLayout.addComponent(keyField, 1, i); mapLayout.addComponent(valueLabel, 2, i); mapLayout.setComponentAlignment(valueLabel, Alignment.MIDDLE_RIGHT); mapLayout.addComponent(valueField, 3, i); final String mapKey = parameter.getName() + i; TextFieldKeyValuePair pair = new TextFieldKeyValuePair(); pair.key = keyField; pair.value = valueField; this.mapTextFields.put(mapKey, pair); final Button removeButton = new Button("remove"); removeButton.setStyleName(ValoTheme.BUTTON_LINK); removeButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { valueMap.remove(key); mapLayout.removeComponent(keyLabel); mapLayout.removeComponent(valueLabel); mapLayout.removeComponent(keyField); mapLayout.removeComponent(valueField); mapLayout.removeComponent(removeButton); mapTextFields.remove(mapKey); } }); mapLayout.addComponent(removeButton, 4, i); i++; } final Button addButton = new Button("add"); addButton.setStyleName(ValoTheme.BUTTON_LINK); addButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { final Label keyLabel = new Label("Name:"); final Label valueLabel = new Label("Value:"); final TextField keyField = new TextField(); keyField.setWidth("100%"); keyField.setNullSettingAllowed(false); keyField.addValidator( new NonZeroLengthStringValidator("Then configuration value name cannot be empty!")); keyField.setValidationVisible(false); final TextField valueField = new TextField(); valueField.setWidth("100%"); valueField.setNullSettingAllowed(false); valueField.addValidator( new NonZeroLengthStringValidator("Then configuration value cannot be empty!")); valueField.setValidationVisible(false); mapLayout.insertRow(mapLayout.getRows()); mapLayout.removeComponent(addButton); mapLayout.addComponent(keyLabel, 0, mapLayout.getRows() - 2); mapLayout.setComponentAlignment(keyLabel, Alignment.MIDDLE_RIGHT); mapLayout.addComponent(keyField, 1, mapLayout.getRows() - 2); mapLayout.addComponent(valueLabel, 2, mapLayout.getRows() - 2); mapLayout.setComponentAlignment(valueLabel, Alignment.MIDDLE_RIGHT); mapLayout.addComponent(valueField, 3, mapLayout.getRows() - 2); final String mapKey = parameter.getName() + mapTextFields.size(); TextFieldKeyValuePair pair = new TextFieldKeyValuePair(); pair.key = keyField; pair.value = valueField; mapTextFields.put(mapKey, pair); final Button removeButton = new Button("remove"); removeButton.setStyleName(ValoTheme.BUTTON_LINK); removeButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { mapLayout.removeComponent(keyLabel); mapLayout.removeComponent(valueLabel); mapLayout.removeComponent(keyField); mapLayout.removeComponent(valueField); mapLayout.removeComponent(removeButton); mapTextFields.remove(mapKey); } }); mapLayout.addComponent(removeButton, 4, mapLayout.getRows() - 2); mapLayout.addComponent(addButton, 0, mapLayout.getRows() - 1); } }); mapLayout.addComponent(addButton, 0, mapLayout.getRows() - 1); Panel mapPanel = new Panel(); mapPanel.setStyleName(ValoTheme.PANEL_BORDERLESS); mapPanel.setContent(mapLayout); Button saveButton = new Button("Save"); saveButton.addStyleName(ValoTheme.BUTTON_SMALL); saveButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { try { for (TextFieldKeyValuePair textField : mapTextFields.values()) { textField.key.validate(); textField.value.validate(); } } catch (InvalidValueException e) { for (TextFieldKeyValuePair textField : mapTextFields.values()) { textField.key.setValidationVisible(true); textField.value.setValidationVisible(true); } Notification.show("Validation errors have occurred!", Type.ERROR_MESSAGE); return; } HashMap<String, String> map = new HashMap<String, String>(); logger.info("Saving map: " + mapTextFields.size()); for (String key : mapTextFields.keySet()) { if (key.startsWith(parameter.getName())) { TextFieldKeyValuePair pair = mapTextFields.get(key); logger.info("Saving for key: " + key); if (pair.key.getValue() != "") { map.put(pair.key.getValue(), pair.value.getValue()); } } } parameter.setValue(map); PlatformConfigurationPanel.this.configurationManagement.saveConfiguration(platformConfiguration); Notification notification = new Notification("Saved", "The configuration has been saved successfully!", Type.HUMANIZED_MESSAGE); notification.setStyleName(ValoTheme.NOTIFICATION_CLOSABLE); notification.show(Page.getCurrent()); } }); paramLayout.addComponent(mapPanel, 0, 1, 1, 1); paramLayout.setComponentAlignment(mapPanel, Alignment.TOP_CENTER); paramLayout.addComponent(saveButton, 0, 2, 1, 2); paramLayout.setComponentAlignment(saveButton, Alignment.TOP_CENTER); paramPanel.setContent(paramLayout); return paramPanel; }
From source file:org.ikasan.dashboard.ui.topology.window.ComponentConfigurationWindow.java
License:BSD License
protected Panel createMapPanel(final ConfigurationParameterMapImpl parameter) { Panel paramPanel = new Panel(); paramPanel.setStyleName("dashboard"); paramPanel.setWidth("100%"); GridLayout paramLayout = new GridLayout(2, 3); paramLayout.setSpacing(true);// ww w.j ava 2s . c o m paramLayout.setSizeFull(); paramLayout.setMargin(true); paramLayout.setColumnExpandRatio(0, .25f); paramLayout.setColumnExpandRatio(1, .75f); Label label = new Label(parameter.getName()); label.setIcon(VaadinIcons.COG); label.addStyleName(ValoTheme.LABEL_LARGE); label.addStyleName(ValoTheme.LABEL_BOLD); label.setSizeUndefined(); paramLayout.addComponent(label, 0, 0, 1, 0); paramLayout.setComponentAlignment(label, Alignment.TOP_LEFT); final Map<String, String> valueMap = parameter.getValue(); final GridLayout mapLayout = new GridLayout(5, (valueMap.size() != 0 ? valueMap.size() : 1) + 1); mapLayout.setMargin(true); mapLayout.setSpacing(true); int i = 0; for (final String key : valueMap.keySet()) { final Label keyLabel = new Label("Key"); final Label valueLabel = new Label("Value"); final TextField keyField = new TextField(); keyField.setValue(key); final TextField valueField = new TextField(); valueField.setValue(valueMap.get(key)); mapLayout.addComponent(keyLabel, 0, i); mapLayout.addComponent(keyField, 1, i); mapLayout.addComponent(valueLabel, 2, i); mapLayout.addComponent(valueField, 3, i); final String mapKey = parameter.getName() + i; TextFieldKeyValuePair pair = new TextFieldKeyValuePair(); pair.key = keyField; pair.value = valueField; this.mapTextFields.put(mapKey, pair); final Button removeButton = new Button("remove"); removeButton.setStyleName(ValoTheme.BUTTON_LINK); removeButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { valueMap.remove(key); mapLayout.removeComponent(keyLabel); mapLayout.removeComponent(valueLabel); mapLayout.removeComponent(keyField); mapLayout.removeComponent(valueField); mapLayout.removeComponent(removeButton); mapTextFields.remove(mapKey); } }); mapLayout.addComponent(removeButton, 4, i); i++; } final Button addButton = new Button("add"); addButton.setStyleName(ValoTheme.BUTTON_LINK); addButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { final Label keyLabel = new Label("Key"); final Label valueLabel = new Label("Value"); final TextField keyField = new TextField(); final TextField valueField = new TextField(); mapLayout.insertRow(mapLayout.getRows()); mapLayout.removeComponent(addButton); mapLayout.addComponent(keyLabel, 0, mapLayout.getRows() - 2); mapLayout.addComponent(keyField, 1, mapLayout.getRows() - 2); mapLayout.addComponent(valueLabel, 2, mapLayout.getRows() - 2); mapLayout.addComponent(valueField, 3, mapLayout.getRows() - 2); final String mapKey = parameter.getName() + mapTextFields.size(); TextFieldKeyValuePair pair = new TextFieldKeyValuePair(); pair.key = keyField; pair.value = valueField; mapTextFields.put(mapKey, pair); final Button removeButton = new Button("remove"); removeButton.setStyleName(ValoTheme.BUTTON_LINK); removeButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { mapLayout.removeComponent(keyLabel); mapLayout.removeComponent(valueLabel); mapLayout.removeComponent(keyField); mapLayout.removeComponent(valueField); mapLayout.removeComponent(removeButton); mapTextFields.remove(mapKey); } }); mapLayout.addComponent(removeButton, 4, mapLayout.getRows() - 2); mapLayout.addComponent(addButton, 0, mapLayout.getRows() - 1); } }); mapLayout.addComponent(addButton, 0, mapLayout.getRows() - 1); Panel mapPanel = new Panel(); mapPanel.setStyleName("dashboard"); mapPanel.setContent(mapLayout); paramLayout.addComponent(mapPanel, 0, 1, 1, 1); paramLayout.setComponentAlignment(mapPanel, Alignment.TOP_CENTER); paramPanel.setContent(paramLayout); Label paramDescriptionLabel = new Label("Description:"); paramDescriptionLabel.setSizeUndefined(); TextArea descriptionTextField = new TextArea(); descriptionTextField.setRows(4); descriptionTextField.setWidth("80%"); descriptionTextField.setId(parameter.getName()); paramLayout.addComponent(paramDescriptionLabel, 0, 2); paramLayout.addComponent(descriptionTextField, 1, 2); paramLayout.setComponentAlignment(paramDescriptionLabel, Alignment.TOP_RIGHT); descriptionTextFields.put(parameter.getName(), descriptionTextField); if (parameter.getDescription() != null) { descriptionTextField.setValue(parameter.getDescription()); } return paramPanel; }
From source file:org.ikasan.dashboard.ui.topology.window.ComponentConfigurationWindow.java
License:BSD License
protected Panel createListPanel(final ConfigurationParameterListImpl parameter) { Panel paramPanel = new Panel(); paramPanel.setStyleName("dashboard"); paramPanel.setWidth("100%"); GridLayout paramLayout = new GridLayout(2, 3); paramLayout.setSpacing(true);//from www . jav a2 s . c o m paramLayout.setSizeFull(); paramLayout.setMargin(true); paramLayout.setColumnExpandRatio(0, .25f); paramLayout.setColumnExpandRatio(1, .75f); Label label = new Label(parameter.getName()); label.setIcon(VaadinIcons.COG); label.addStyleName(ValoTheme.LABEL_LARGE); label.addStyleName(ValoTheme.LABEL_BOLD); label.setSizeUndefined(); paramLayout.addComponent(label, 0, 0, 1, 0); paramLayout.setComponentAlignment(label, Alignment.TOP_LEFT); final List<String> valueList = parameter.getValue(); final GridLayout listLayout = new GridLayout(3, (valueList.size() != 0 ? valueList.size() : 1) + 1); listLayout.setWidth("450px"); listLayout.setMargin(true); listLayout.setSpacing(true); listLayout.setColumnExpandRatio(0, 0.25f); listLayout.setColumnExpandRatio(1, 0.5f); listLayout.setColumnExpandRatio(2, 0.25f); int i = 0; for (final String value : valueList) { final Label valueLabel = new Label("Value"); final TextField valueField = new TextField(); valueField.setValue(value); valueField.setWidth("90%"); listLayout.addComponent(valueLabel, 0, i); listLayout.addComponent(valueField, 1, i); final String mapKey = parameter.getName() + i; this.valueTextFields.put(mapKey, valueField); final Button removeButton = new Button("remove"); removeButton.setStyleName(ValoTheme.BUTTON_LINK); removeButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { valueList.remove(value); listLayout.removeComponent(valueLabel); listLayout.removeComponent(valueField); listLayout.removeComponent(removeButton); valueTextFields.remove(mapKey); } }); listLayout.addComponent(removeButton, 2, i); i++; } final Button addButton = new Button("add"); addButton.setStyleName(ValoTheme.BUTTON_LINK); addButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { final Label valueLabel = new Label("Value"); final TextField valueField = new TextField(); valueField.setWidth("90%"); listLayout.insertRow(listLayout.getRows()); listLayout.removeComponent(addButton); listLayout.addComponent(valueLabel, 0, listLayout.getRows() - 2); listLayout.addComponent(valueField, 1, listLayout.getRows() - 2); final String mapKey = parameter.getName() + valueTextFields.size(); valueTextFields.put(mapKey, valueField); final Button removeButton = new Button("remove"); removeButton.setStyleName(ValoTheme.BUTTON_LINK); removeButton.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { listLayout.removeComponent(valueLabel); listLayout.removeComponent(valueField); listLayout.removeComponent(removeButton); valueTextFields.remove(mapKey); } }); listLayout.addComponent(removeButton, 2, listLayout.getRows() - 2); listLayout.addComponent(addButton, 0, listLayout.getRows() - 1); } }); listLayout.addComponent(addButton, 0, listLayout.getRows() - 1); Panel mapPanel = new Panel(); mapPanel.setStyleName("dashboard"); mapPanel.setContent(listLayout); paramLayout.addComponent(mapPanel, 0, 1, 1, 1); paramLayout.setComponentAlignment(mapPanel, Alignment.TOP_CENTER); paramPanel.setContent(paramLayout); Label paramDescriptionLabel = new Label("Description:"); paramDescriptionLabel.setSizeUndefined(); TextArea descriptionTextField = new TextArea(); descriptionTextField.setRows(4); descriptionTextField.setWidth("80%"); descriptionTextField.setId(parameter.getName()); paramLayout.addComponent(paramDescriptionLabel, 0, 2); paramLayout.addComponent(descriptionTextField, 1, 2); paramLayout.setComponentAlignment(paramDescriptionLabel, Alignment.TOP_RIGHT); descriptionTextFields.put(parameter.getName(), descriptionTextField); if (parameter.getDescription() != null) { descriptionTextField.setValue(parameter.getDescription()); } return paramPanel; }
From source file:probe.com.view.core.SingleStudyFilterLayout.java
/** * * @param dataset// w w w. jav a2 s. c o m * @param datasetIndex * @param uniqueAttr * @param view */ public SingleStudyFilterLayout(QuantDatasetObject dataset, int datasetIndex, boolean[] uniqueAttr, boolean view) { init(); this.setMargin(new MarginInfo(false, false, false, false)); VerticalLayout miniLayout = new VerticalLayout(); Label miniAttrLabel = new Label(); if (!dataset.getUniqueValues().equalsIgnoreCase("")) { miniAttrLabel.setValue("[ " + dataset.getUniqueValues() + "]"); } miniLayout.addComponent(miniAttrLabel); GridLayout studyInfo = new GridLayout(); studyInfo.setColumns(3); studyInfo.setWidth("100%"); SubTreeHideOnClick layout = new SubTreeHideOnClick("Dataset " + datasetIndex, studyInfo, miniLayout, view); this.addComponent(layout); this.setComponentAlignment(layout, Alignment.MIDDLE_CENTER); for (int i = 0; i < uniqueAttr.length; i++) { boolean check = uniqueAttr[i]; if (check) { if (!dataset.getProperty(i).toString().trim().equalsIgnoreCase("Not Available") && !dataset.getProperty(i).toString().trim().equalsIgnoreCase("0") && !dataset.getProperty(i).toString().trim().equalsIgnoreCase("-1")) { if (publicationInfoLayoutComponents[i] != null) { studyInfo.addComponent(publicationInfoLayoutComponents[i]); ((InformationField) publicationInfoLayoutComponents[i]) .setValue(dataset.getProperty(i).toString(), null); } } } } Button btn = new Button("Load Dataset"); btn.setStyleName(Reindeer.BUTTON_SMALL); VerticalLayout btnLayout = new VerticalLayout(); btnLayout.setMargin(true); btnLayout.setHeight("30px"); btnLayout.addComponent(btn); int rowNum = studyInfo.getRows(); if (studyInfo.getComponentCount() % 3 != 0) { studyInfo.addComponent(btnLayout, 2, rowNum - 1); } else { studyInfo.setRows(rowNum + 1); studyInfo.addComponent(btnLayout, 2, rowNum); } studyInfo.setComponentAlignment(btnLayout, Alignment.BOTTOM_LEFT); }