public final void setRepresentativeName() { if (property == null) { return; } PropertyValue value = property.get(); if (value == null) { setText(property.name()); } else { if (value instanceof FromConfigurationPropertyValue) { String name = ""; FromConfigurationPropertyValue fcpv = (FromConfigurationPropertyValue) value; Property confName = fcpv.getValue().get("name") == null ? fcpv.getValue().get("Name") : fcpv.getValue().get("name"); if (confName != null) { name = " [" + (confName.get() == null ? "" : confName.get().stringValue()) + "]"; } setText(fcpv.getValue().registeredName() + name); } else { setText("??? SOMETHING ???"); } } }
private void updateModelValue() { if (property.get() == null || !(property.get() instanceof FromConfigurationPropertyValue)) { try { String defaultName = (String) choiceBox.getItems().get(0); Configuration defaultValue = Registery.get().getConfiguration(defaultName); property.set(new FromConfigurationPropertyValue(defaultValue)); } catch (Exception ex) { Logger.getLogger(ConfigurationPropertyEditor.class.getName()).log(Level.SEVERE, null, ex); } } FromConfigurationPropertyValue fcpv = (FromConfigurationPropertyValue) property.get(); if (fcpv != null && fcpv.getValue() != null) { // in case property is a dummy (came from collection property editor) Class implementor = fcpv.getValue().configuredType(); String className = Registery.get().getRegisteredClassName(implementor); Property temp = property; property = null; choiceBox.getSelectionModel().select(className); property = temp; if (parentCollection != null && choiceBox.getItems().size() <= 1) { setText(className); } confEditor.setModel(fcpv.getValue(), readOnly, filter); } else { choiceBox.getSelectionModel().select("NULL"); } }