diff --git a/build.gradle b/build.gradle index 1455d44..55ae38b 100644 --- a/build.gradle +++ b/build.gradle @@ -10,7 +10,7 @@ description = "CST-Desktop" sourceCompatibility = 1.8 targetCompatibility = 1.8 -version = '1.0.4' +version = '1.0.5' repositories { flatDir { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 69a9715..070cb70 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/br/unicamp/cst/util/viewer/MemoryInspector.java b/src/main/java/br/unicamp/cst/util/viewer/MemoryInspector.java index 0d97dc0..0fb7352 100644 --- a/src/main/java/br/unicamp/cst/util/viewer/MemoryInspector.java +++ b/src/main/java/br/unicamp/cst/util/viewer/MemoryInspector.java @@ -243,11 +243,15 @@ public void updateAbstractObject(AbstractObject ao, String name, boolean setvalu } public void updateIdea(Idea ao, String name) { - if (ao.getType() == 1) updateString(ao.getValue().toString(),name); - else { - if (!ao.getName().equals(ToString.getSimpleName(name))) updateString(ao.getName(),name); - else updateString("",name); - } +// if (ao.getType() == 1) updateString(ao.getValue().toString(),name); +// else { +// if (!ao.getName().equals(ToString.getSimpleName(name))) updateString(ao.getName(),name); +// else updateString("",name); +// } + String bracketvalue = ""; + if (!ao.getValue().equals("")) bracketvalue = " ["+ao.getValue()+"]"; + if (!ao.getName().equals(ToString.getSimpleName(name))) updateString(ao.getName()+bracketvalue,name); + else updateString(ao.getValue().toString(),name); List parts = ao.getL(); for (Idea oo : parts) { updateIdea(oo,name+"."+oo.getName()); @@ -256,6 +260,7 @@ public void updateIdea(Idea ao, String name) { public void updateObject(Object o, String name) { if (!nodeAlreadyExists(name)) { + System.out.println("Trying to include node with type "+o.getClass().getName()+" with name "+name); includeNode(o,name); return; } diff --git a/src/main/java/br/unicamp/cst/util/viewer/ObjectTreeNode.java b/src/main/java/br/unicamp/cst/util/viewer/ObjectTreeNode.java index 9add73e..044712f 100644 --- a/src/main/java/br/unicamp/cst/util/viewer/ObjectTreeNode.java +++ b/src/main/java/br/unicamp/cst/util/viewer/ObjectTreeNode.java @@ -16,6 +16,7 @@ import br.unicamp.cst.representation.owrl.QualityDimension; import br.unicamp.cst.representation.idea.Idea; import br.unicamp.cst.support.ToString; +import br.unicamp.cst.util.viewer.representation.idea.IdeaTreeNode; import java.lang.reflect.Array; import java.lang.reflect.Field; @@ -24,6 +25,7 @@ import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import javax.swing.tree.DefaultMutableTreeNode; +import javax.swing.tree.TreeNode; /** * @@ -210,21 +212,12 @@ private DefaultMutableTreeNode addAffordance(String fullname, Affordance a) { private DefaultMutableTreeNode addIdea(String fullname, Idea wo) { DefaultMutableTreeNode objectNode; - switch(wo.getType()) { - default: - case 0: objectNode = addItem(fullname,wo.getValue().toString(),wo,TreeElement.ICON_OBJECT3); - break; - case 1: objectNode = addItem(fullname,wo.getValue().toString(),wo,TreeElement.ICON_QUALITYDIM); - break; - case 2: objectNode = addItem(fullname,wo.getValue().toString(),wo,TreeElement.ICON_OBJECT2); - break; - } - if (wo.getType() == 0) + objectNode = addItem(fullname,wo.getValue().toString(),wo,TreeElement.iconByType(wo.getType())); for (Idea oo : wo.getL()) { DefaultMutableTreeNode part = addIdea(fullname+"."+oo.getName(),oo); objectNode.add(part); } return(objectNode); - } + } } diff --git a/src/main/java/br/unicamp/cst/util/viewer/TreeElement.java b/src/main/java/br/unicamp/cst/util/viewer/TreeElement.java index 88c3d0c..5de58ca 100644 --- a/src/main/java/br/unicamp/cst/util/viewer/TreeElement.java +++ b/src/main/java/br/unicamp/cst/util/viewer/TreeElement.java @@ -156,5 +156,26 @@ public void setId_node(int id_node) { this.id_node = id_node; } + public static int iconByType(int type) { + switch(type) { + case 0: return(ICON_OBJECTEXISTENCE); + case 1: return(ICON_PROPERTY); + case 2: return(ICON_OBJECT2); + case 3: return(ICON_QUALITYDIM); + case 4: return(ICON_AFFORDANCE); + case 5: return(ICON_COMPOSITE); + case 6: return(ICON_AGGREGATE); + case 7: return(ICON_CONFIGURATION); + case 8: return(ICON_TIME); + case 9: return(ICON_PROPERTYCATEGORY); + case 10: return(ICON_OBJECTCATEGORY); + case 11: return(ICON_EPISODECATEGORY); + case 12: return(ICON_PROPERTYPOSSIBILITY); + case 13: return(ICON_OBJECTPOSSIBILITY); + case 14: return(ICON_EPISODEPOSSIBILITY); + default: return(ICON_OBJECT3); + } + } + } diff --git a/src/main/java/br/unicamp/cst/util/viewer/representation/idea/IdeaTreeNode.java b/src/main/java/br/unicamp/cst/util/viewer/representation/idea/IdeaTreeNode.java index 73cc1f8..8ee5e7c 100644 --- a/src/main/java/br/unicamp/cst/util/viewer/representation/idea/IdeaTreeNode.java +++ b/src/main/java/br/unicamp/cst/util/viewer/representation/idea/IdeaTreeNode.java @@ -51,6 +51,15 @@ public IdeaTreeNode(Idea idea) { representIdea(idea); } + public IdeaTreeNode(String fullname, Idea idea) { + super(new TreeElement(fullname+"."+idea.getName(),TreeElement.NODE_NORMAL,idea,TreeElement.ICON_OBJECT3)); + for (Idea i : idea.getL()) { + IdeaTreeNode ntn = new IdeaTreeNode(fullname+"."+idea.getName(),i); + add(ntn); + } + representIdea(idea); + } + public IdeaTreeNode addRootNode(String rootNodeName) { Idea rootWM = Idea.createIdea(rootNodeName,"",0); IdeaTreeNode root = new IdeaTreeNode(rootNodeName, TreeElement.NODE_NORMAL, rootWM, TreeElement.ICON_MIND);