com.vaadin.data.Property.ValueChangeEvent Java Examples

The following examples show how to use com.vaadin.data.Property.ValueChangeEvent. 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: AttributeSelectionWindow.java    From XACML with MIT License 6 votes vote down vote up
protected void initializeOption() {
	//
	// Setup datasource and GUI properties
	//
	this.optionGroupAttribute.setImmediate(true);
	this.optionGroupAttribute.addItem(ATTRIBUTE_OPTION_DICTIONARY);
	this.optionGroupAttribute.addItem(ATTRIBUTE_OPTION_STANDARD);
	this.optionGroupAttribute.addItem(ATTRIBUTE_OPTION_INPUT);
	//
	// Respond to events
	//
	this.optionGroupAttribute.addValueChangeListener(new ValueChangeListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void valueChange(ValueChangeEvent event) {
			self.resetAttributeOption();
		}
	});
}
 
Example #2
Source File: PIPSQLResolverEditorWindow.java    From XACML with MIT License 6 votes vote down vote up
protected void initializeCheckBox() {
	this.checkBoxShortIds.setValue(true);
	this.checkBoxShortIds.setImmediate(true);
	this.checkBoxShortIds.addValueChangeListener(new ValueChangeListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void valueChange(ValueChangeEvent event) {
			if (self.checkBoxShortIds.getValue()) {
				self.tableRequiredAttributes.setColumnCollapsed("id", true);
				self.tableRequiredAttributes.setColumnCollapsed("category", true);
				self.tableRequiredAttributes.setColumnCollapsed("datatype", true);
				self.tableRequiredAttributes.setColumnCollapsed("shortId", false);
				self.tableRequiredAttributes.setColumnCollapsed("shortCategory", false);
				self.tableRequiredAttributes.setColumnCollapsed("shortDatatype", false);
			} else {
				self.tableRequiredAttributes.setColumnCollapsed("id", false);
				self.tableRequiredAttributes.setColumnCollapsed("category", false);
				self.tableRequiredAttributes.setColumnCollapsed("datatype", false);
				self.tableRequiredAttributes.setColumnCollapsed("shortId", true);
				self.tableRequiredAttributes.setColumnCollapsed("shortCategory", true);
				self.tableRequiredAttributes.setColumnCollapsed("shortDatatype", true);
			}
		}			
	});
}
 
Example #3
Source File: AddUpdateRolloutWindowLayout.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private void onGroupNumberChange(final ValueChangeEvent event) {
    if (editRolloutEnabled) {
        return;
    }
    if (event.getProperty().getValue() != null && noOfGroups.isValid() && totalTargetsCount != null
            && isNumberOfGroups()) {
        groupSizeLabel.setValue(getTargetPerGroupMessage(String.valueOf(getGroupSize())));
        groupSizeLabel.setVisible(true);
        updateGroupsChart(Integer.parseInt(noOfGroups.getValue()));
    } else {
        groupSizeLabel.setVisible(false);
        if (isNumberOfGroups()) {
            updateGroupsChart(0);
        }
    }
}
 
Example #4
Source File: AutoStartOptionGroupLayout.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private void addValueChangeListener() {
    autoStartOptionGroup.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        // Vaadin is returning object, so "==" might not work
        @SuppressWarnings("squid:S4551")
        public void valueChange(final ValueChangeEvent event) {
            if (event.getProperty().getValue().equals(AutoStartOption.SCHEDULED)) {
                startAtDateField.setEnabled(true);
                startAtDateField.setRequired(true);
            } else {
                startAtDateField.setEnabled(false);
                startAtDateField.setRequired(false);
            }
        }
    });
}
 
Example #5
Source File: VariableReferenceEditorWindow.java    From XACML with MIT License 6 votes vote down vote up
protected void initializeSelect(Map<VariableDefinitionType, PolicyType> vars) {
	//
	// Add existing variables into the table
	//
	if (vars != null) {
		for (VariableDefinitionType var : vars.keySet()) {
			this.listSelectVariables.addItem(var.getVariableId());
		}
	}
	//
	// Respond to changes
	//
	this.listSelectVariables.setImmediate(true);
	this.listSelectVariables.addValueChangeListener(new ValueChangeListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void valueChange(ValueChangeEvent event) {
			Object value = self.listSelectVariables.getValue();
			if (value != null) {
				self.textFieldVariable.setValue(value.toString());
			}
		}			
	});
}
 
Example #6
Source File: ActionTypeOptionGroupAssignmentLayout.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private void addValueChangeListener() {
    actionTypeOptionGroup.addValueChangeListener(new ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        // Vaadin is returning object so "==" might not work
        @SuppressWarnings("squid:S4551")
        public void valueChange(final ValueChangeEvent event) {
            if (event.getProperty().getValue().equals(ActionTypeOption.AUTO_FORCED)) {
                forcedTimeDateField.setEnabled(true);
                forcedTimeDateField.setRequired(true);
            } else {
                forcedTimeDateField.setEnabled(false);
                forcedTimeDateField.setRequired(false);
            }
        }
    });
}
 
Example #7
Source File: CheckboxListQuestion.java    From gazpachoquest with GNU General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
public void valueChange(ValueChangeEvent event) {
    Collection<String> newSelectedOptions = (Collection<String>) event.getProperty().getValue();
    Set<String> bag = new HashSet<>();
    String selectedOption = null;
    BooleanAnswer answer = null;
    if (newSelectedOptions.size() > selectedOptions.size()) {
        bag.addAll(newSelectedOptions);
        bag.removeAll(selectedOptions);
        selectedOption = bag.iterator().next();
        answer = BooleanAnswer.valueOf(selectedOption, Boolean.TRUE);
    } else {
        bag.addAll(selectedOptions);
        bag.removeAll(newSelectedOptions);
        selectedOption = bag.iterator().next();
        answer = BooleanAnswer.valueOf(selectedOption, Boolean.FALSE);
    }

    selectedOptions.clear();
    selectedOptions.addAll(newSelectedOptions);
    super.answerSavedEvent.fire(AnswerSavedEvent.with().questionCode(questionDTO.getCode()).answer(answer).build());

}
 
Example #8
Source File: PolicyEditor.java    From XACML with MIT License 6 votes vote down vote up
protected void initializeCheckboxes(boolean readOnly) {
	//
	// The readonly check box
	//
	this.checkBoxReadOnly.setImmediate(true);
	this.checkBoxReadOnly.setValue(readOnly);
	this.checkBoxReadOnly.addValueChangeListener(new ValueChangeListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void valueChange(ValueChangeEvent event) {
			self.resetComponents();
			self.setupCaption();
		}
		
	});
	//
	// The autosave check box
	//
	this.checkBoxAutoSave.setImmediate(true);
	this.checkBoxAutoSave.setValue(true);
}
 
Example #9
Source File: ValueEntryPopup.java    From sensorhub with Mozilla Public License 2.0 6 votes vote down vote up
@SuppressWarnings("serial")
public ValueEntryPopup(int width, final ValueCallback callback)
{
    super("New Value");
    VerticalLayout layout = new VerticalLayout();
    
    TextField text = new TextField();
    text.setWidth(width, Unit.PIXELS);
    layout.addComponent(text);
    text.focus();
    
    text.addValueChangeListener(new ValueChangeListener() {
        @Override
        public void valueChange(ValueChangeEvent event)
        {
            ValueEntryPopup.this.close();
            callback.newValue((String)event.getProperty().getValue());
        }
    });
    
    setContent(layout);
    center();
}
 
Example #10
Source File: ObadviceDictionary.java    From XACML with MIT License 5 votes vote down vote up
protected void initializeTable(boolean isReadOnly) {
	//
	// Set our container
	//
	this.table.setContainerDataSource(this.obadvice);
	//
	// Initialize GUI properties
	//
	this.table.setVisibleColumns(visibleColumns);
	this.table.setColumnHeaders(columnHeaders);
	this.table.setImmediate(true);
	this.table.setColumnCollapsingAllowed(true);
	//
	// Is read only
	//
	if (isReadOnly) {
		return;
	}
	this.table.setSelectable(true);
	//
	// Respond to selections
	//
	this.table.addValueChangeListener(new ValueChangeListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void valueChange(ValueChangeEvent event) {
			self.buttonRemove.setEnabled(self.table.getValue() != null);
			self.buttonClone.setEnabled(self.table.getValue() != null);
		}			
	});
}
 
Example #11
Source File: SelectPDPGroupWindow.java    From XACML with MIT License 5 votes vote down vote up
private void initializeSelect(Set<PDPGroup> groups) {
	//
	// Initialize GUI properties
	//
	this.listSelectPDPGroup.setImmediate(true);
	this.listSelectPDPGroup.setItemCaptionMode(ItemCaptionMode.EXPLICIT);
	this.listSelectPDPGroup.setNullSelectionAllowed(false);
	this.listSelectPDPGroup.setNewItemsAllowed(false);
	this.listSelectPDPGroup.setMultiSelect(false);
	//
	// Add items
	//
	for (PDPGroup group : groups) {
		this.listSelectPDPGroup.addItem(group);
		this.listSelectPDPGroup.setItemCaption(group, group.getName());
	}
	//
	// Listen to events
	//
	this.listSelectPDPGroup.addValueChangeListener(new ValueChangeListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void valueChange(ValueChangeEvent event) {
			self.setupButtons();
		}
	});
}
 
Example #12
Source File: PolicyUploadWindow.java    From XACML with MIT License 5 votes vote down vote up
/**
 * The constructor should first build the main layout, set the
 * composition root and then do any custom initialization.
 *
 * The constructor will not be automatically regenerated by the
 * visual editor.
 * @param directory 
 */
public PolicyUploadWindow(Path directory) {
	buildMainLayout();
	//
	// Create our main layout
	//
	this.setContent(mainLayout);
	//
	// Finish setting up the main layout
	//
	this.mainLayout.setSpacing(true);
	this.mainLayout.setMargin(true);
	
	this.checkBoxImportAdvice.setValue(true);
	this.checkBoxIgnoreStandard.setValue(true);
	this.checkBoxImportAttributes.setValue(true);
	this.checkBoxImportObligations.setValue(true);
	
	this.directory = directory;

	this.upload.addSucceededListener(this);
	this.upload.setReceiver(this);
	
	this.checkBoxImportAttributes.addValueChangeListener(new ValueChangeListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void valueChange(ValueChangeEvent event) {
			if (self.checkBoxImportAttributes.getValue()) {
				self.checkBoxIgnoreStandard.setEnabled(true);
			} else {
				self.checkBoxIgnoreStandard.setEnabled(false);
			}
		}
		
	});
}
 
Example #13
Source File: ExpressionBuilderComponent.java    From XACML with MIT License 5 votes vote down vote up
protected void initializeCheckbox() {
	this.checkBoxShortName.setValue(true);
	this.checkBoxShortName.setImmediate(true);
	this.checkBoxShortName.addValueChangeListener(new ValueChangeListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void valueChange(ValueChangeEvent event) {
			self.treeExpressions.setColumnCollapsed(ExpressionContainer.PROPERTY_ID, self.checkBoxShortName.getValue());
			self.treeExpressions.setColumnCollapsed(ExpressionContainer.PROPERTY_DATATYPE, self.checkBoxShortName.getValue());
			self.treeExpressions.setColumnCollapsed(ExpressionContainer.PROPERTY_ID_SHORT, ! self.checkBoxShortName.getValue());
			self.treeExpressions.setColumnCollapsed(ExpressionContainer.PROPERTY_DATATYPE_SHORT, ! self.checkBoxShortName.getValue());
		}
	});
}
 
Example #14
Source File: RegexpEditorComponent.java    From XACML with MIT License 5 votes vote down vote up
private void initializeTextField() {
	//
	// Find our reg expression value if it exists
	//
	for (ConstraintValue value : this.attribute.getConstraintValues()) {
		if (value.getProperty().equals(ConstraintType.REGEXP_TYPE)) {
			if (this.value == null) {
				this.textFieldExpression.setValue(value.getValue());
				this.value = value;
			} else {
				logger.warn("Multiple regexp constraint values: " + value);
				value.setAttribute(null);
				this.attribute.removeConstraintValue(value);
			}
		} else {
			value.setAttribute(null);
			this.attribute.removeConstraintValue(value);
		}
	}
	//
	// Was something found?
	//
	if (this.value == null) {
		ConstraintValue newValue = new ConstraintValue(ConstraintType.REGEXP_TYPE, "");
		newValue.setAttribute(this.attribute);
		this.attribute.addConstraintValue(newValue);
		this.value = newValue;
	}
	//
	// Save the values when they changes
	//
	this.textFieldExpression.addValueChangeListener(new ValueChangeListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void valueChange(ValueChangeEvent event) {
			self.value.setValue(self.textFieldExpression.getValue());
		}
	});
}
 
Example #15
Source File: AttributeSimpleCreatorComponent.java    From XACML with MIT License 5 votes vote down vote up
private void initializeCategories() {
	//
	// Remove any filters
	//
	AttributeSimpleCreatorComponent.categories.removeAllContainerFilters();
	//
	// Initialize data source & GUI properties
	//
	this.tableCategory.setContainerDataSource(AttributeSimpleCreatorComponent.categories);
	this.tableCategory.setVisibleColumns(new Object[] {"xacmlId"});
	this.tableCategory.setColumnHeaders(new String[] {"XACML ID"});
	this.tableCategory.setImmediate(true);
	this.tableCategory.setNullSelectionAllowed(false);
	this.tableCategory.setPageLength(10);
	this.tableCategory.setSelectable(true);
	//
	// Default selection
	//
	Category defaultCategory;
	if (this.attribute == null || this.attribute.getCategoryBean() == null || this.attribute.getCategoryBean().getIdentifer() == null) {
		defaultCategory = JPAUtils.findCategory(XACML3.ID_SUBJECT_CATEGORY_ACCESS_SUBJECT);
		assert(defaultCategory != null);
	} else {
		defaultCategory = JPAUtils.findCategory(this.attribute.getCategoryBean().getIdentifer());
	}
	if (defaultCategory != null) {
		this.tableCategory.select(defaultCategory.getId());
	}
	//
	// Respond to changes
	//
	this.tableCategory.addValueChangeListener(new ValueChangeListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void valueChange(ValueChangeEvent event) {
			self.fireAttributeChanged(self.getAttribute());
		}
	});
}
 
Example #16
Source File: AttributeStandardSelectorComponent.java    From XACML with MIT License 5 votes vote down vote up
private void initializeCategories() {
	//
	// Remove any filters
	//
	AttributeStandardSelectorComponent.categories.removeAllContainerFilters();
	//
	// Initialize data source & GUI properties
	//
	this.comboBoxCategories.setContainerDataSource(AttributeStandardSelectorComponent.categories);
	this.comboBoxCategories.setItemCaptionMode(ItemCaptionMode.PROPERTY);
	this.comboBoxCategories.setItemCaptionPropertyId("xacmlId");
	this.comboBoxCategories.setImmediate(true);
	this.comboBoxCategories.setNullSelectionAllowed(false);
	//
	// Set default selection
	//
	Category defaultCategory;
	if (this.attribute == null || this.attribute.getCategoryBean() == null) {
		defaultCategory = JPAUtils.findCategory(XACML3.ID_SUBJECT_CATEGORY_ACCESS_SUBJECT);
	} else {
		defaultCategory = this.attribute.getCategoryBean();
	}
	if (defaultCategory != null) {
		this.comboBoxCategories.select(defaultCategory.getId());
	}
	//
	// Respond to events
	//
	this.comboBoxCategories.addValueChangeListener(new ValueChangeListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void valueChange(ValueChangeEvent event) {
			self.setupAttributeIDs();
			self.fireAttributeChanged(self.getAttribute());
		}
	});
}
 
Example #17
Source File: AttributeStandardSelectorComponent.java    From XACML with MIT License 5 votes vote down vote up
private void initializeAttributes() {
	//
	// Initialize GUI properties
	//
	this.tableAttributes.setImmediate(true);
	this.tableAttributes.setNullSelectionAllowed(false);
	this.tableAttributes.setPageLength(10);
	//
	// Setup
	//
	this.tableAttributes.setContainerDataSource(this.container);
	this.tableAttributes.setVisibleColumns(new Object[] {"attributeId"});
	this.tableAttributes.setColumnHeaders(new String[] {"Attribute Id"});
	this.tableAttributes.setSelectable(true);
	this.setupAttributeIDs();
	//
	// Respond
	//
	this.tableAttributes.addValueChangeListener(new ValueChangeListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void valueChange(ValueChangeEvent event) {
			self.fireAttributeChanged(self.getAttribute());
		}
	});
}
 
Example #18
Source File: CustomPIPConfigurationComponent.java    From XACML with MIT License 5 votes vote down vote up
protected void initializeText() {
	this.textFieldClassname.setRequired(true);
	this.textFieldClassname.setRequiredError("You must declare the Java classname for the PIP Factory Loader");
	this.textFieldClassname.setImmediate(true);
	final Object entity = this.entity.getEntity();
	if (entity instanceof PIPConfiguration) {
		this.textFieldClassname.setValue(((PIPConfiguration)entity).getClassname());
	} else if (entity instanceof PIPResolver) {
		this.textFieldClassname.setValue(((PIPResolver)entity).getClassname());
	}
	//
	// Respond to events
	//
	this.textFieldClassname.addValueChangeListener(new ValueChangeListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void valueChange(ValueChangeEvent event) {
			if (entity instanceof PIPConfiguration) {
				((PIPConfiguration) entity).setClassname(self.textFieldClassname.getValue());
			} else if (entity instanceof PIPResolver) {
				((PIPResolver) entity).setClassname(self.textFieldClassname.getValue());
			}
			self.fireFormChangedEvent();
		}
	});
}
 
Example #19
Source File: AttributeDictionarySelectorComponent.java    From XACML with MIT License 5 votes vote down vote up
protected void initializeCategoryFilter() {
	//
	// Remove any filters
	//
	AttributeDictionarySelectorComponent.categories.removeAllContainerFilters();
	//
	// Initialize data source and GUI properties
	//
	this.comboBoxCategoryFilter.setContainerDataSource(AttributeDictionarySelectorComponent.categories);
	this.comboBoxCategoryFilter.setItemCaptionMode(ItemCaptionMode.PROPERTY);
	this.comboBoxCategoryFilter.setItemCaptionPropertyId("xacmlId");
	this.comboBoxCategoryFilter.setImmediate(true);
	//
	// Respond to events
	//
	this.comboBoxCategoryFilter.addValueChangeListener(new ValueChangeListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void valueChange(ValueChangeEvent event) {
			//
			// Clear any existing filters
			//
			AttributeDictionarySelectorComponent.attributes.removeAllContainerFilters();
			//
			// Get the current selection
			//
			Object id = self.comboBoxCategoryFilter.getValue();
			//
			// Is anything currently selected?
			//
			if (id != null) {
				//
				// Yes - add the new filter into the container
				//
				AttributeDictionarySelectorComponent.attributes.addContainerFilter(new Compare.Equal("categoryBean", AttributeDictionarySelectorComponent.categories.getItem(id).getEntity()));
			}
		}
	});
}
 
Example #20
Source File: RepositoryConfigurationView.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void valueChange(final ValueChangeEvent event) {

    if (!(event.getProperty() instanceof CheckBox)) {
        return;
    }

    notifyConfigurationChanged();

    final CheckBox checkBox = (CheckBox) event.getProperty();
    BooleanConfigurationItem configurationItem;

    if (actionAutocloseCheckBox.equals(checkBox)) {
        configurationItem = actionAutocloseConfigurationItem;
    } else if (actionAutocleanupCheckBox.equals(checkBox)) {
        configurationItem = actionAutocleanupConfigurationItem;
    } else if (multiAssignmentsCheckBox.equals(checkBox)) {
        configurationItem = multiAssignmentsConfigurationItem;
        actionAutocloseCheckBox.setEnabled(!checkBox.getValue());
        actionAutocloseConfigurationItem.setEnabled(!checkBox.getValue());
    } else {
        return;
    }

    if (checkBox.getValue()) {
        configurationItem.configEnable();
    } else {
        configurationItem.configDisable();
    }
}
 
Example #21
Source File: ObadviceDictionary.java    From XACML with MIT License 5 votes vote down vote up
protected void initializeCombo() {
	//
	// Add filter values
	//
	this.comboBoxFilter.addItem(Obadvice.OBLIGATION);
	this.comboBoxFilter.addItem(Obadvice.ADVICE);
	//
	// Initialize GUI properties
	//
	this.comboBoxFilter.setImmediate(true);
	this.comboBoxFilter.setNullSelectionAllowed(true);
	//
	//
	this.comboBoxFilter.addValueChangeListener(new ValueChangeListener() {
		private static final long serialVersionUID = 1L;

		@Override
		public void valueChange(ValueChangeEvent event) {
			//
			// Remove filters
			//
			self.obadvice.removeAllContainerFilters();
			//
			// What was selected?
			//
			Object id = self.comboBoxFilter.getValue();
			if (id != null) {
				//
				// Add filter
				//
				if (id.equals(Obadvice.OBLIGATION)) {
					self.obadvice.addContainerFilter(new Compare.Equal("type", Obadvice.OBLIGATION));
				} else if (id.equals(Obadvice.ADVICE)) {
					self.obadvice.addContainerFilter(new Compare.Equal("type", Obadvice.ADVICE));
				}
			}
		}
	});
}
 
Example #22
Source File: ListRadioQuestion.java    From gazpachoquest with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void valueChange(ValueChangeEvent event) {
    String option = (String) event.getProperty().getValue();
    Answer answer = null;
    if (option.equals("NULL")) {
        answer = NoAnswer.create();
    } else {
        answer = TextAnswer.fromValue((String) event.getProperty().getValue());
    }
    super.answerSavedEvent.fire(AnswerSavedEvent.with().questionCode(questionDTO.getCode()).answer(answer).build());
}
 
Example #23
Source File: CSCTypeValueChangeListener.java    From chipster with MIT License 5 votes vote down vote up
@Override
public void valueChange(ValueChangeEvent event) {
	String text = getValue(model.getNameValue()) + " " + getValue(model.getTypeValue());
	model.setTitleDescriptionValue(text);
	model.getToolEditor().getToolEditorUI().getTreeToolEditor().setItemCaption(model, text);
	
}
 
Example #24
Source File: InputOutputUI.java    From chipster with MIT License 5 votes vote down vote up
protected void initElements() {
	type2 = new ComboBox();
	type2.setImmediate(true);
	type2.setWidth(WIDTH);
	lbMeta = new Label("Meta:");
	cbMeta = new CheckBox();
	cbMeta.setDescription("Is this element Meta data");
	
	optional.setWidth(WIDTH);
	type = new ComboBox();
	type.setWidth(WIDTH);
	type.setNullSelectionAllowed(false);
	type.setImmediate(true);
	type.addItem(SINGLE_FILE);
	type.addItem(MULTI_FILE);
	type.select(SINGLE_FILE);
	type.addValueChangeListener(new ValueChangeListener() {
		private static final long serialVersionUID = -1134955257251483403L;

		@Override
		public void valueChange(ValueChangeEvent event) {
			if(type.getValue().toString().contentEquals(SINGLE_FILE)) {
				getSingleFileUI();
			} else if(type.getValue().toString().contentEquals(MULTI_FILE)){
				getMultipleFilesUI();
			}
		}
	});
}
 
Example #25
Source File: StorageView.java    From chipster with MIT License 5 votes vote down vote up
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: FormUtils.java    From jdal with Apache License 2.0 5 votes vote down vote up
/**
 * Add a link on primary and dependent ComboBoxes by property name. 
 * When selection changes on primary use propertyName to get a Collection and fill dependent ComboBox with it
 * @param primary ComboBox when selection changes
 * @param dependent ComboBox that are filled with collection   
 * @param propertyName the property name for get the collection from primary selected item
 * @param addNull if true, add a null as first combobox item
 */
@SuppressWarnings("rawtypes")
public static void link(final ComboBox primary, final ComboBox dependent,
		final String propertyName, final boolean addNull) {

	primary.addValueChangeListener(new ValueChangeListener() {

		public void valueChange(ValueChangeEvent event) {
			Object selected = event.getProperty().getValue();
			if (selected != null) {
				BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(selected);
				if (wrapper.isReadableProperty(propertyName)) {
					Collection items = (Collection) wrapper.getPropertyValue(propertyName);
					dependent.removeAllItems();
					
					if (addNull)
						dependent.addItem(null);
					
					for (Object item : items)
						dependent.addItem(item);
				}
				else {
					log.error("Can't write on propety '" + propertyName + "' of class: '" + selected.getClass() + "'");
				}
			}

		}
	});
}
 
Example #27
Source File: MyWindow.java    From java-course-ee with MIT License 5 votes vote down vote up
@Override
public void valueChange(ValueChangeEvent event) {
    if (!datetime.isValid()) {
        textField.setValue("Дата не выбрана");
    } else if (event.getProperty().getType() == Date.class) {
        Date date = (Date) event.getProperty().getValue();
        SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy");
        textField.setValue(sdf.format(date));
    }
}
 
Example #28
Source File: TagAssignementComboBox.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void onSelectionChanged(final ValueChangeEvent event) {
    final Object selectedValue = event.getProperty().getValue();
    if (!isValidTagSelection(selectedValue) || readOnlyMode) {
        return;
    }
    assignTag((String) selectedValue);
}
 
Example #29
Source File: ServerPanel.java    From primecloud-controller with GNU General Public License v2.0 5 votes vote down vote up
public void tableRowSelected(ValueChangeEvent event) {
    InstanceDto instance = (InstanceDto) serverTable.getValue();
    if (instance != null) {
        serverButtonsBottom.refresh(instance);
        serverDesc.show(instance);
    } else {
        serverButtonsBottom.initialize();
        serverDesc.initialize();
    }
}
 
Example #30
Source File: CommonDialogWindow.java    From hawkbit with Eclipse Public License 1.0 5 votes vote down vote up
private void removeValueChangeListener(final AbstractField<?> field) {
    for (final Object listener : field.getListeners(ValueChangeEvent.class)) {
        if (listener instanceof ChangeListener) {
            field.removeValueChangeListener((ChangeListener) listener);
        }
    }
}