com.vaadin.data.Property Java Examples
The following examples show how to use
com.vaadin.data.Property.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DistributionSetSelectComboBox.java From hawkbit with Eclipse Public License 1.0 | 6 votes |
/** * Overriden in order to get the selected distibution set's option caption * (name:version) from container and preventing multiple calls by saving the * selected Id. * * @param selectedItemId * the Id of the selected distribution set */ @Override public void setValue(final Object selectedItemId) { if (selectedItemId != null) { // Can happen during validation, leading to multiple database // queries, in order to get the caption property if (selectedItemId.equals(previousValue)) { return; } selectedValueCaption = Optional.ofNullable(getContainerProperty(selectedItemId, getItemCaptionPropertyId())) .map(Property::getValue).map(String.class::cast).orElse(""); } super.setValue(selectedItemId); previousValue = (Long) selectedItemId; }
Example #2
Source File: TargetAssignmentOperations.java From hawkbit with Eclipse Public License 1.0 | 6 votes |
private static void addValueChangeListener(final ActionTypeOptionGroupAssignmentLayout actionTypeOptionGroupLayout, final CheckBox enableMaintenanceWindowControl, final Link maintenanceWindowHelpLinkControl) { actionTypeOptionGroupLayout.getActionTypeOptionGroup() .addValueChangeListener(new Property.ValueChangeListener() { private static final long serialVersionUID = 1L; @Override // Vaadin is returning object so "==" might not work @SuppressWarnings("squid:S4551") public void valueChange(final Property.ValueChangeEvent event) { if (event.getProperty().getValue() .equals(AbstractActionTypeOptionGroupLayout.ActionTypeOption.DOWNLOAD_ONLY)) { enableMaintenanceWindowControl.setValue(false); enableMaintenanceWindowControl.setEnabled(false); maintenanceWindowHelpLinkControl.setEnabled(false); } else { enableMaintenanceWindowControl.setEnabled(true); maintenanceWindowHelpLinkControl.setEnabled(true); } } }); }
Example #3
Source File: PDPPIPContainer.java From XACML with MIT License | 6 votes |
@Override public Property<?> getContainerProperty(Object itemId, Object propertyId) { if (this.isSupported(itemId) == false) { return null; } if (propertyId.equals(PROPERTY_ID)) { return new MethodProperty<Object>(getType(propertyId), new PDPPIPItem(itemId), PDPPIPITEM_ID, null); } if (propertyId.equals(PROPERTY_NAME)) { return new MethodProperty<Object>(getType(propertyId), new PDPPIPItem(itemId), PDPPIPITEM_NAME, null); } if (propertyId.equals(PROPERTY_DESCRIPTION)) { return new MethodProperty<Object>(getType(propertyId), new PDPPIPItem(itemId), PDPPIPITEM_DESCRIPTION, null); } return null; }
Example #4
Source File: DataSelectorView.java From RDFUnit with Apache License 2.0 | 6 votes |
private void setInputTypes() { inputTypeSelect.addItem(DataOption.SPARQL); inputTypeSelect.setItemCaption(DataOption.SPARQL, "SPARQL"); inputTypeSelect.addItem(DataOption.URI); inputTypeSelect.setItemCaption(DataOption.URI, "Remote Files"); inputTypeSelect.addItem(DataOption.TEXT); inputTypeSelect.setItemCaption(DataOption.TEXT, "Direct Input"); inputTypeSelect.setItemEnabled(DataOption.SPARQL, false); inputTypeSelect.addValueChangeListener((Property.ValueChangeListener) valueChangeEvent -> { DataOption value = (DataOption) valueChangeEvent.getProperty().getValue(); if (value.equals(DataOption.URI)) { inputFormatsSelect.setVisible(false); } else { inputFormatsSelect.setVisible(true); } }); }
Example #5
Source File: TestGenerationView.java From RDFUnit with Apache License 2.0 | 6 votes |
@Override public void sourceGenerationExecuted(final Source source, final TestGenerationType generationType, final long testsCreated) { UI.getCurrent().access(() -> { Item item = resultsTable.getItem(source); if (testsCreated == 0 || item == null) return; String column = (generationType.equals(TestGenerationType.AutoGenerated) ? "Automatic" : "Manual"); Property<Link> statusProperty = item.getItemProperty(column); String fileName; if (generationType.equals(TestGenerationType.AutoGenerated)) { fileName = CacheUtils.getSourceAutoTestFile(RDFUnitDemoSession.getBaseDir() + "tests/", source); statusProperty.setValue(new Link("" + testsCreated, new FileResource(new File(fileName)))); } else { fileName = CacheUtils.getSourceManualTestFile("/org/aksw/rdfunit/tests/", source); statusProperty.setValue(new Link("" + testsCreated, new ClassResource(fileName))); } CommonAccessUtils.pushToClient(); }); }
Example #6
Source File: AttributeValueContainer.java From XACML with MIT License | 6 votes |
@Override public Property<?> getContainerProperty(Object itemId, Object propertyId) { if (this.isObjectSupported(itemId) == false) { return null; } if (propertyId.equals(PROPERTY_VALUE)) { return new MethodProperty<Object>(getType(propertyId), new AttributeValueItem((ContainerAttribute) itemId), ATTRIBUTEVALUEITEM_VALUE, null); } if (propertyId.equals(PROPERTY_SOURCE)) { return new MethodProperty<Object>(getType(propertyId), new AttributeValueItem((ContainerAttribute) itemId), ATTRIBUTEVALUEITEM_SOURCE, null); } return null; }
Example #7
Source File: GitStatusContainer.java From XACML with MIT License | 6 votes |
@Override public Property<Object> getContainerProperty(Object itemId, Object propertyId) { GitEntry entry = this.map.get(itemId); if (entry == null) { // logger.error("unknown itemId: " + itemId); return null; } if (propertyId.equals(PROPERTY_NAME)) { return new MethodProperty<Object>(getType(propertyId), new StatusItem(entry), GITSTATUSITEM_NAME, null); } if (propertyId.equals(PROPERTY_STATUS)) { return new MethodProperty<Object>(getType(propertyId), new StatusItem(entry), GITSTATUSITEM_STATUS, null); } if (propertyId.equals(PROPERTY_ENTRY)) { return new MethodProperty<Object>(getType(propertyId), new StatusItem(entry), GITSTATUSITEM_ENTRY, null); } return null; }
Example #8
Source File: UserListWindow.java From usergrid with Apache License 2.0 | 6 votes |
private void addList( AbsoluteLayout mainLayout ) { ListSelect list = new ListSelect(); list.setWidth( "100%" ); list.setHeight( "420px" ); list.setNullSelectionAllowed( false ); list.setImmediate( true ); list.addValueChangeListener( new Property.ValueChangeListener() { @Override public void valueChange( Property.ValueChangeEvent event ) { Object value = event.getProperty().getValue(); if ( value != null ) { close(); selectedUser = ( String ) value; showUser( ( String ) value ); } } }); loadData( list ); mainLayout.addComponent( list, "left: 0px; top: 0px;" ); }
Example #9
Source File: JobLogTable.java From chipster with MIT License | 6 votes |
public Component generateCell(Table source, final Object itemId, Object columnId) { Property<?> prop = source.getItem(itemId).getItemProperty(columnId); if (prop != null && prop.getType() != null && prop.getType().equals(Integer.class)) { Integer wallClockTime = (Integer) prop.getValue(); if (wallClockTime != null) { return new Label(StringUtils.formatMinutes(wallClockTime)); } else { return new Label(); } } return null; }
Example #10
Source File: AttributeContainer.java From XACML with MIT License | 6 votes |
@Override public Property<?> getContainerProperty(Object itemId, Object propertyId) { if (this.isObjectSupported(itemId) == false) { return null; } if (propertyId.equals(PROPERTY_ID)) { return new MethodProperty<Object>(getType(propertyId), new AttributeItem(itemId), ATTRIBUTEITEM_ID, null); } if (propertyId.equals(PROPERTY_CATEGORY)) { return new MethodProperty<Object>(getType(propertyId), new AttributeItem(itemId), ATTRIBUTEITEM_CATEGORY, null); } if (propertyId.equals(PROPERTY_DATATYPE)) { return new MethodProperty<Object>(getType(propertyId), new AttributeItem(itemId), ATTRIBUTEITEM_DATATYPE, null); } if (propertyId.equals(PROPERTY_VALUES)) { return new MethodProperty<Object>(getType(propertyId), new AttributeItem(itemId), ATTRIBUTEITEM_VALUES, null); } return null; }
Example #11
Source File: HttpServerConfigForm.java From sensorhub with Mozilla Public License 2.0 | 6 votes |
@Override protected Field<?> buildAndBindField(String label, String propId, Property<?> prop) { Field<?> field = super.buildAndBindField(label, propId, prop); if (propId.equals(PROP_SERVLET_ROOT)) { field.addValidator(new StringLengthValidator(MSG_REQUIRED_FIELD, 2, 256, false)); } else if (propId.equals(PROP_HTTP_PORT)) { field.setWidth(100, Unit.PIXELS); //((TextField)field).getConverter(). field.addValidator(new Validator() { private static final long serialVersionUID = 1L; public void validate(Object value) throws InvalidValueException { int portNum = (Integer)value; if (portNum > 10000 || portNum <= 80) throw new InvalidValueException("Port number must be an integer number greater than 80 and lower than 10000"); } }); } return field; }
Example #12
Source File: WinServerNetworkConfig.java From primecloud-controller with GNU General Public License v2.0 | 5 votes |
private void changeIpMode(Property.ValueChangeEvent event) { String ipMode = (String) ipModeSelect.getValue(); if (StringUtils.isNotEmpty(ipMode)) { if ("MANUAL".equals(ipMode)) { ipAddressField.setReadOnly(false); ipAddressField.setValue(""); ipAddressField.setRequired(true); } else { ipAddressField.setReadOnly(false); ipAddressField.setValue(""); ipAddressField.setReadOnly(true); ipAddressField.setRequired(false); } } }
Example #13
Source File: PDPPolicyContainer.java From XACML with MIT License | 5 votes |
@Override public Property<?> getContainerProperty(Object itemId, Object propertyId) { if ((itemId instanceof PDPPolicy) == false) { return null; } if (propertyId.equals(PROPERTY_ID)) { return new MethodProperty<Object>(getType(propertyId), new PDPPolicyItem((PDPPolicy) itemId), PDPPOLICYITEM_ID, null); } if (propertyId.equals(PROPERTY_NAME)) { return new MethodProperty<Object>(getType(propertyId), new PDPPolicyItem((PDPPolicy) itemId), PDPPOLICYITEM_NAME, null); } if (propertyId.equals(PROPERTY_VERSION)) { return new MethodProperty<Object>(getType(propertyId), new PDPPolicyItem((PDPPolicy) itemId), PDPPOLICYITEM_VERSION, null); } if (propertyId.equals(PROPERTY_DESCRIPTION)) { return new MethodProperty<Object>(getType(propertyId), new PDPPolicyItem((PDPPolicy) itemId), PDPPOLICYITEM_DESCRIPTION, null); } if (propertyId.equals(PROPERTY_ISROOT)) { return new MethodProperty<Object>(getType(propertyId), new PDPPolicyItem((PDPPolicy) itemId), PDPPOLICYITEM_ISROOT, PDPPOLICYITEM_SETISROOT); } return null; }
Example #14
Source File: ExpressionContainer.java From XACML with MIT License | 5 votes |
@Override public Property<?> getContainerProperty(Object itemId, Object propertyId) { if (this.isObjectSupported(itemId) == false) { return null; } if (propertyId.equals(PROPERTY_NAME)) { return new MethodProperty<Object>(getType(propertyId), new ExpressionItem(itemId), EXPRESSIONITEM_NAME, null); } if (propertyId.equals(PROPERTY_ID)) { return new MethodProperty<Object>(getType(propertyId), new ExpressionItem(itemId), EXPRESSIONITEM_ID, null); } if (propertyId.equals(PROPERTY_DATATYPE)) { return new MethodProperty<Object>(getType(propertyId), new ExpressionItem(itemId), EXPRESSIONITEM_DATATYPE, null); } if (propertyId.equals(PROPERTY_ID_SHORT)) { return new MethodProperty<Object>(getType(propertyId), new ExpressionItem(itemId), EXPRESSIONITEM_ID_SHORT, null); } if (propertyId.equals(PROPERTY_DATATYPE_SHORT)) { return new MethodProperty<Object>(getType(propertyId), new ExpressionItem(itemId), EXPRESSIONITEM_DATATYPE_SHORT, null); } return null; }
Example #15
Source File: SOSConfigForm.java From sensorhub with Mozilla Public License 2.0 | 5 votes |
protected Field<?> buildAndBindField(String label, String propId, Property<?> prop) { Field<Object> field = (Field<Object>)super.buildAndBindField(label, propId, prop); if (propId.endsWith(PROP_ENDPOINT)) { field.addValidator(new StringLengthValidator(MSG_REQUIRED_FIELD, 1, 256, false)); } else if (propId.endsWith(PROP_ENABLED)) { field.setVisible(true); } else if (propId.endsWith(PROP_URI)) { field.addValidator(new StringLengthValidator(MSG_REQUIRED_FIELD, 1, 256, false)); } else if (propId.endsWith(PROP_STORAGEID)) { field = makeModuleSelectField(field, IStorageModule.class); } else if (propId.endsWith(PROP_SENSORID)) { field = makeModuleSelectField(field, ISensorModule.class); field.addValidator(new StringLengthValidator(MSG_REQUIRED_FIELD, 1, 256, false)); } else if (propId.endsWith(PROP_DATAPROVIDERS + PROP_SEP + PROP_NAME)) field.setVisible(true); return field; }
Example #16
Source File: WinServerNetworkConfig.java From primecloud-controller with GNU General Public License v2.0 | 5 votes |
private void changeNetwork(Property.ValueChangeEvent event) { NetworkDto network = (NetworkDto) networkSelect.getValue(); if (network != null) { ipModeSelect.setValue("POOL"); netmaskField.setReadOnly(false); netmaskField.setValue(network.getNetmask()); netmaskField.setReadOnly(true); gateWayField.setReadOnly(false); gateWayField.setValue(network.getGateWay()); gateWayField.setReadOnly(true); dns1Field.setReadOnly(false); dns1Field.setValue(network.getDns1()); dns1Field.setReadOnly(true); dns2Field.setReadOnly(false); dns2Field.setValue(network.getDns2()); dns2Field.setReadOnly(true); } else { ipModeSelect.setValue("POOL"); netmaskField.setReadOnly(false); netmaskField.setValue(""); netmaskField.setReadOnly(true); gateWayField.setReadOnly(false); gateWayField.setValue(""); gateWayField.setReadOnly(true); dns1Field.setReadOnly(false); dns1Field.setValue(""); dns1Field.setReadOnly(true); dns2Field.setReadOnly(false); dns2Field.setValue(""); dns2Field.setReadOnly(true); } }
Example #17
Source File: CommConfigForm.java From sensorhub with Mozilla Public License 2.0 | 5 votes |
@Override protected Field<?> buildAndBindField(String label, String propId, Property<?> prop) { Field<?> field = super.buildAndBindField(label, propId, prop); if (propId.endsWith(UIConstants.PROP_ID)) field.setVisible(false); else if (propId.endsWith(UIConstants.PROP_NAME)) field.setVisible(false); else if (propId.endsWith(UIConstants.PROP_ENABLED)) field.setVisible(false); return field; }
Example #18
Source File: WinServiceAdd.java From primecloud-controller with GNU General Public License v2.0 | 5 votes |
private void serviceTableSelect(Property.ValueChangeEvent event) { // 選択がない場合はサーバ選択をクリア if (serviceTable.getValue() == null) { serverSelect.removeAllItems(); return; } // 選択されたサービス種類で利用可能なサーバ情報を選択画面に表示 ComponentTypeDto componentType = findComponentType(serviceTable.getValue()); serverSelect.show(instances, componentType.getInstanceNos()); }
Example #19
Source File: WinLoadBalancerEdit.java From primecloud-controller with GNU General Public License v2.0 | 5 votes |
private void checkProtocolValueChange(Property.ValueChangeEvent event) { if ("HTTP".equals(checkProtocolSelect.getValue())) { checkPathField.setEnabled(true); } else { checkPathField.setValue(""); checkPathField.setEnabled(false); } }
Example #20
Source File: BeanWrapperItem.java From jdal with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings("rawtypes") public boolean addItemProperty(Object id, Property property) throws UnsupportedOperationException { this.properties.add((String) id); return true; }
Example #21
Source File: PDPContainer.java From XACML with MIT License | 5 votes |
@Override public Property<?> getContainerProperty(Object itemId, Object propertyId) { if (propertyId.equals(PROPERTY_ID)) { return new MethodProperty<Object>(getType(propertyId), new PDPItem((PDP) itemId), PDPITEM_ID, null); } if (propertyId.equals(PROPERTY_NAME)) { return new MethodProperty<Object>(getType(propertyId), new PDPItem((PDP) itemId), PDPITEM_NAME, null); } if (propertyId.equals(PROPERTY_DESCRIPTION)) { return new MethodProperty<Object>(getType(propertyId), new PDPItem((PDP) itemId), PDPITEM_DESCRIPTION, null); } if (propertyId.equals(PROPERTY_ICON)) { return new MethodProperty<Object>(getType(propertyId), new PDPItem((PDP) itemId), PDPITEM_ICON, null); } if (propertyId.equals(PROPERTY_STATUS)) { return new MethodProperty<Object>(getType(propertyId), new PDPItem((PDP) itemId), PDPITEM_STATUS, null); } if (propertyId.equals(PROPERTY_POLICIES)) { return new MethodProperty<Object>(getType(propertyId), new PDPItem((PDP) itemId), PDPITEM_POLICIES, null); } if (propertyId.equals(PROPERTY_PIPCONFIG)) { return new MethodProperty<Object>(getType(propertyId), new PDPItem((PDP) itemId), PDPITEM_PIPCONFIG, null); } return null; }
Example #22
Source File: RunsChartLayout.java From usergrid with Apache License 2.0 | 5 votes |
protected void addRunnersList() { runnersListSelect = UIUtil.addListSelect(this, "Runners:", "left: 10px; top: 300px;", "250px"); runnersListSelect.addValueChangeListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { Object value = event.getProperty().getValue(); if (value != null) { showRunner( value.toString() ); } } }); }
Example #23
Source File: JobLogTable.java From chipster with MIT License | 5 votes |
public Component generateCell(Table source, final Object itemId, Object columnId) { Property<?> prop = source.getItem(itemId).getItemProperty(JobLogContainer.ERROR_MESSAGE); if (prop != null && prop.getType() != null && prop.getType().equals(String.class)) { String errorMessage = (String) prop.getValue(); if (errorMessage != null) { Button link = new Button(); link.setIcon(new ThemeResource("../admin/crystal/agt_update_critical.png")); link.setStyleName(BaseTheme.BUTTON_LINK); link.setDescription("Show job error message"); link.addClickListener(new Button.ClickListener() { public void buttonClick(ClickEvent event) { select(itemId); view.showErrorOutput(itemId); } }); return link; } } return null; }
Example #24
Source File: DateColumnGenerator.java From chipster with MIT License | 5 votes |
public Component generateCell(Table source, final Object itemId, Object columnId) { Property<?> prop = source.getItem(itemId).getItemProperty(columnId); if (prop != null && prop.getType() != null && prop.getType().equals(Date.class)) { Date date = (Date) prop.getValue(); SimpleDateFormat dateFormat = new SimpleDateFormat("yyy-MM-dd HH:mm"); Label label = new Label(dateFormat.format(date)); return label; } return null; }
Example #25
Source File: StorageView.java From chipster with MIT License | 5 votes |
public void valueChange(ValueChangeEvent event) { Property<?> property = event.getProperty(); if (property == aggregateTable) { Object tableValue = aggregateTable.getValue(); if (tableValue instanceof StorageAggregate) { StorageAggregate storageUser = (StorageAggregate) tableValue; updateStorageEntries(storageUser.getUsername()); } } }
Example #26
Source File: JobLogView.java From chipster with MIT License | 5 votes |
public void showOutput(Object itemId) { String output = ""; Property<?> outputProperty = dataSource.getContainerProperty(itemId, JobLogContainer.OUTPUT_TEXT); if (outputProperty != null) { output = (String) outputProperty.getValue(); } showTextWindow("Job output", output); }
Example #27
Source File: JobLogView.java From chipster with MIT License | 5 votes |
public void showErrorOutput(Object itemId) { String error = ""; Property<?> errorProperty = dataSource.getContainerProperty(itemId, JobLogContainer.ERROR_MESSAGE); if (errorProperty != null) { error = (String) errorProperty.getValue(); } showTextWindow("Error message", error); }
Example #28
Source File: HumanReadableLongColumnGenerator.java From chipster with MIT License | 5 votes |
public Component generateCell(Table source, Object itemId, Object columnId) { Property<?> prop = source.getItem(itemId).getItemProperty(columnId); if (prop != null && prop.getType() != null && prop.getType().equals(Long.class)) { Long longSize = (Long)prop.getValue(); String stringSize = StringUtils.getHumanReadable(longSize); Label label = new Label(stringSize); return label; } return null; }
Example #29
Source File: ListBeanContainer.java From jdal with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings("rawtypes") public Property getContainerProperty(Object itemId, Object propertyId) { int index = getAsIndex(itemId); if (index > this.items.size() - 1) return null; return this.items.get(index).getItemProperty(propertyId); }
Example #30
Source File: ConfigurableTable.java From jdal with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @SuppressWarnings("rawtypes") @Override protected Object getPropertyValue(Object rowId, Object colId, Property property) { Column column = columnMap.get(colId); if (column != null) { if (isEditable()) { Class<?extends Component> editorClass = column.getCellEditor(); if (editorClass == null) return super.getPropertyValue(rowId, colId, property); else { return getComponentForProperty(property, editorClass); } } // Test cell component Class<?extends Component> cellComponentClass = column.getCellComponent(); if (cellComponentClass != null) { return getComponentForProperty(property, cellComponentClass); } // Last try, test property editor PropertyEditor pe = column.getPropertyEditor(); if (pe != null) { pe.setValue(property.getValue()); return pe.getAsText(); } } // Default behavior return super.getPropertyValue(rowId, colId, property); }