public NetworkVertexNode(Children children, NetworkElementApi data, NetworkCaseSetApi caseData) { super(children, Lookups.singleton(data)); this.setVertexModelData(data); this.setCaseModelData(caseData); this.setDisplayName(data.getValue()); this.AddModelListeners(); }
@Override protected Sheet createSheet() { Sheet sheet = Sheet.createDefault(); Sheet.Set set = Sheet.createPropertiesSet(); NetworkElementApi obj = getLookup().lookup(NetworkElementApi.class); try { Property<String> valueProp = new PropertySupport.Reflection<String>(obj, String.class, "getValue", null); Property<String> caseIdListProp = new PropertySupport.Reflection<String>(obj, String.class, "getCaseIdListAsString", null); Property<NetworkElementType> elementTypeProp = new PropertySupport.Reflection<NetworkElementType>( obj, NetworkElementType.class, "getNetworkElementType", null); Property<Integer> caseIdListSizeProp = new PropertySupport.Reflection<Integer>(obj, Integer.class, "getCaseFrequency", null); Property<Double> MDPValueProp = new PropertySupport.Reflection<Double>(obj, Double.class, "getMDPValue", null); Property<Integer> ClusterIDProp = new PropertySupport.Reflection<Integer>(obj, int.class, "getClusterID", null); Property<Integer> uniqueCaseSizeProp = new PropertySupport.Reflection<Integer>(obj, Integer.class, "getUniqueFrequency", null); Property<String> uniqueCaseIdListProp = new PropertySupport.Reflection<String>( obj, String.class, "getUniqueCaseIdSetAsString", null); // Optional properties: Property<Boolean> errorProp = new PropertySupport.Reflection<Boolean>(obj, Boolean.class, "getErrorValue", null); Property<Boolean> goalProp = new PropertySupport.Reflection<Boolean>(obj, Boolean.class, "getGoalValue", null); Property<String> preConditionProp = new PropertySupport.Reflection<String>( obj, String.class, "getPreConditionStringList", null); // Property<String> postConditionProp = new PropertySupport.Reflection<String>(obj, // String.class, "getPostConditionStringList", null); PropertySupport.Reflection<MultiValueMap> postConditionProp = new PropertySupport.Reflection<MultiValueMap>( obj, MultiValueMap.class, "getPostCondition", null); postConditionProp.setPropertyEditorClass(MultiValueMapPropertyEditor.class); Property<Boolean> goalPathValueProp = new PropertySupport.Reflection<Boolean>(obj, Boolean.class, "getGoalPathValue", null); Property<Integer> goalCaseCountProp = new PropertySupport.Reflection<Integer>(obj, Integer.class, "getGoalCaseCount", null); valueProp.setName("Value"); caseIdListProp.setName("Case IDs"); elementTypeProp.setName("Type"); caseIdListSizeProp.setName("Case Count"); uniqueCaseSizeProp.setName("Unique Case Count"); uniqueCaseIdListProp.setName("Unique Case IDs"); MDPValueProp.setName("MDP Value"); ClusterIDProp.setName("ClusterID"); // TODO: it would be nice to have the list of the actions for the // currently selected node... // Optional properties: errorProp.setName("Error"); goalProp.setName("Goal"); preConditionProp.setName("Pre Condition"); postConditionProp.setName("Post Condition"); goalPathValueProp.setName("Goal Path"); goalCaseCountProp.setName("Goal Cases Count"); set.put(valueProp); set.put(caseIdListProp); set.put(elementTypeProp); set.put(caseIdListSizeProp); set.put(uniqueCaseSizeProp); set.put(uniqueCaseIdListProp); set.put(MDPValueProp); set.put(ClusterIDProp); if (mNEA.getOptionalData().contains("ERROR")) { set.put(errorProp); } if (mNEA.getOptionalData().contains("GOAL")) { set.put(goalProp); set.put(goalPathValueProp); set.put(goalCaseCountProp); } if (mNEA.getOptionalData().contains("PRE_CONDITION")) { set.put(preConditionProp); } if (mNEA.getOptionalData().contains("POST_CONDITION")) { set.put(postConditionProp); } } catch (NoSuchMethodException ex) { } sheet.put(set); return (sheet); }
private void AddModelListeners() { mNEA.addPropertyChangeListener(this); }