Thread: [graphl-cvs] graphl/src/org/mediavirus/graphl/gui NodeContextMenu.java EdgeContextMenu.java TypeMenu
Status: Pre-Alpha
Brought to you by:
flo1
From: Flo L. <fl...@us...> - 2005-01-11 13:27:06
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25738/src/org/mediavirus/graphl/gui Modified Files: NodeContextMenu.java EdgeContextMenu.java TypeMenu.java Log Message: - FEATURE: implemented generic type menu that reads from RDF vocabs - FEATURE: RDFGraph now imports files referenced with owl:imports statements - BUG: fixed saving of literal properties - BUG: fixed Swing look and feel for JDK 1.5 - CODE: GraphlPane now stores vocabularies - CODE: added first (dummy) implementation of node mainpulator - CODE: added getProperties() mehtod to PropertySet interface Index: EdgeContextMenu.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/gui/EdgeContextMenu.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** EdgeContextMenu.java 10 Dec 2004 16:13:03 -0000 1.16 --- EdgeContextMenu.java 11 Jan 2005 13:26:42 -0000 1.17 *************** *** 356,361 **** currentEdge = edge; ! this.add(buildTypeSubMenu(edge)); ! this.add(buildControllerSubMenu(edge, DISPLAY)); this.add(buildControllerSubMenu(edge, LAYOUT)); --- 356,366 ---- currentEdge = edge; ! //this.add(buildTypeSubMenu(edge)); ! TypeMenu typeSubMenu = new TypeMenu("Type", graphlPane.getVocabularies()); ! typeSubMenu.updateMenu(TypeMenu.PROPERTIES); ! this.add(typeSubMenu); ! typeSubMenu.addResourceListener(this); ! ! this.add(buildControllerSubMenu(edge, DISPLAY)); this.add(buildControllerSubMenu(edge, LAYOUT)); *************** *** 375,379 **** public void resourceChanged(String property) { currentEdge.setType(property); ! graphlPane.getGraph().notifyLayoutUpdated(); graphlPane.repaint(); } --- 380,384 ---- public void resourceChanged(String property) { currentEdge.setType(property); ! graphlPane.getGraph().notifyPropertyChanged(); graphlPane.repaint(); } Index: NodeContextMenu.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/gui/NodeContextMenu.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** NodeContextMenu.java 29 Dec 2004 14:31:28 -0000 1.17 --- NodeContextMenu.java 11 Jan 2005 13:26:42 -0000 1.18 *************** *** 122,126 **** private JMenu buildTypeSubMenu(Node node) { ! JMenu typeSubMenu = new JMenu("Type"); --- 122,126 ---- private JMenu buildTypeSubMenu(Node node) { ! JMenu typeSubMenu = new JMenu("Type"); *************** *** 365,369 **** currentNode = node; ! this.add(buildTypeSubMenu(node)); this.add(buildControllerSubMenu(node, DISPLAY)); this.add(buildControllerSubMenu(node, LAYOUT)); --- 365,375 ---- currentNode = node; ! //this.add(buildTypeSubMenu(node)); ! TypeMenu typeSubMenu = new TypeMenu("Type", graphlPane.getVocabularies()); ! typeSubMenu.updateMenu(TypeMenu.CLASSES); ! this.add(typeSubMenu); ! typeSubMenu.addResourceListener(this); ! ! this.add(buildControllerSubMenu(node, DISPLAY)); this.add(buildControllerSubMenu(node, LAYOUT)); *************** *** 384,389 **** public void resourceChanged(String property) { currentNode.setType(property); ! graphlPane.getGraph().notifyLayoutUpdated(); graphlPane.repaint(); } } --- 390,396 ---- public void resourceChanged(String property) { currentNode.setType(property); ! graphlPane.getGraph().notifyPropertyChanged(); graphlPane.repaint(); } + } Index: TypeMenu.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/gui/TypeMenu.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TypeMenu.java 29 Dec 2004 14:31:29 -0000 1.1 --- TypeMenu.java 11 Jan 2005 13:26:42 -0000 1.2 *************** *** 5,23 **** package org.mediavirus.graphl.gui; ! import java.awt.event.ActionEvent; ! import java.awt.event.ActionListener; import java.util.Iterator; import java.util.List; - import javax.swing.JCheckBoxMenuItem; import javax.swing.JMenu; import org.mediavirus.graphl.graph.Node; /** * @author flo */ ! public class TypeMenu extends JMenu { public TypeMenu() { super(); --- 5,29 ---- package org.mediavirus.graphl.gui; ! import java.util.ArrayList; import java.util.Iterator; import java.util.List; import javax.swing.JMenu; + import javax.swing.JRadioButtonMenuItem; import org.mediavirus.graphl.graph.Node; + import org.mediavirus.graphl.vocabulary.ResourceActionListener; /** * @author flo */ ! public class TypeMenu extends JMenu implements ResourceListener{ ! ! static final int CLASSES = 1, PROPERTIES = 2, ALL = 3; ! Node types = null; ! String currentType = null; + ArrayList listeners = new ArrayList(); + public TypeMenu() { super(); *************** *** 34,62 **** public void setTypes(Node types){ removeAll(); ! List groups = types.getNeighbours("http://www.mediavirus.org/graphl#typeGroup", true); ! for (Iterator iter = groups.iterator(); iter.hasNext();) { ! Node group = (Node) iter.next(); ! if (group.hasType("http://www.mediavirus.org/graphl#TypeGroup")) { ! this.add(new TypeMenu(group.getProperty("http://www.mediavirus.org/graphl#name","<unnamed>")), group); ! } ! } ! List items = types.getNeighbours("http://www.mediavirus.org/graphl#containsType", true); for (Iterator iter = items.iterator(); iter.hasNext();) { Node item = (Node) iter.next(); ! if (item.hasType("rdf:Class")) { ! JCheckBoxMenuItem mItem = new JCheckBoxMenuItem(item.getProperty("http://www.mediavirus.org/graphl#name",item.getId())); ! mItem.addActionListener(new ActionListener() { ! public void actionPerformed(ActionEvent e) { ! // TODO } ! }); this.add(mItem); } } } ! public void setCurrentType(String currentType){ ! // TODO } } --- 40,126 ---- public void setTypes(Node types){ + this.types = types; + } + + public void updateMenu(int which){ removeAll(); ! ! if (types != null) { ! addItem(types, which, false); ! } ! } ! ! /** ! * @param item ! * @param which ! */ ! protected void addItem(Node node, int which, boolean deep) { ! List items = node.getNeighbours("http://www.mediavirus.org/graphl#contains", true); ! for (Iterator iter = items.iterator(); iter.hasNext();) { Node item = (Node) iter.next(); ! if (item.hasType("http://www.mediavirus.org/graphl#Vocabulary")) { ! TypeMenu menu = new TypeMenu(item.getProperty("http://www.mediavirus.org/graphl#name","<unnamed>"), item); ! menu.updateMenu(which); ! menu.setToolTipText(item.getProperty("http://www.mediavirus.org/graphl#description","")); ! this.add(menu); ! menu.addResourceListener(this); ! } ! else if ( (((which & CLASSES) > 0) && item.hasType("http://www.w3.org/2000/01/rdf-schema#Class")) ! || (((which & PROPERTIES) > 0) && item.hasType("http://www.w3.org/1999/02/22-rdf-syntax-ns#Property"))) { ! if (item.hasType("http://www.w3.org/1999/02/22-rdf-syntax-ns#Property")) { ! Node range = item.getFirstNeighbour("http://www.w3.org/2000/01/rdf-schema#range",true); ! if (range != null && range.getId().equals("http://www.w3.org/2000/01/rdf-schema#Literal")) { ! // skip properties that have a range of literal ! continue; } ! } ! JRadioButtonMenuItem mItem = new JRadioButtonMenuItem(item.getProperty("http://www.w3.org/2000/01/rdf-schema#label",item.getId())); ! if (item.getId().equals(currentType)) mItem.setSelected(true); ! mItem.setToolTipText(item.getProperty("http://www.w3.org/2000/01/rdf-schema#comment",null)); ! mItem.addActionListener(new ResourceActionListener(item.getId(), this)); this.add(mItem); } + else if ( (((which & CLASSES) > 0) && item.hasType("http://www.mediavirus.org/graphl#ClassGroup")) + || (((which & PROPERTIES) > 0) && item.hasType("http://www.mediavirus.org/graphl#PropertyGroup"))) { + if (deep) { + TypeMenu menu = new TypeMenu(item.getProperty("http://www.mediavirus.org/graphl#name","<unnamed>"), item); + menu.updateMenu(which); + menu.setToolTipText(item.getProperty("http://www.mediavirus.org/graphl#description","<unnamed>")); + this.add(menu); + menu.addResourceListener(this); + } + else { + if (this.getItemCount() > 0) addSeparator(); + addItem(item, which, deep); + } + } } } ! public void setCurrentType(String currentType){ ! this.currentType = currentType; ! } ! ! public void addResourceListener(ResourceListener listener) { ! listeners.add(listener); ! } ! ! public void removeResourceListener(ResourceListener listener){ ! listeners.remove(listener); ! } ! ! private void fireResourceEvent(String resource) { ! for (Iterator iter = listeners.iterator(); iter.hasNext();) { ! ResourceListener l = (ResourceListener) iter.next(); ! l.resourceChanged(resource); ! } ! } ! ! /** ! * @see org.mediavirus.graphl.gui.ResourceListener#resourceChanged(java.lang.String) ! */ ! public void resourceChanged(String resource) { ! fireResourceEvent(resource); } } |
From: Flo L. <fl...@us...> - 2005-12-18 11:12:25
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl/gui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2618/src/org/mediavirus/graphl/gui Modified Files: NodeContextMenu.java EdgeContextMenu.java TypeMenu.java Log Message: - FEATURE: RXPath landed! you can assign properties of facets through XPath-like expressions based on the currently rendered node - CODE: Remove LabelGenerator classes - this can now done with RXPath - CODE: migrated to JDK 1.5, added class specifiers for all collections (generics) - CODE: added a singleton GraphlRegistry, currently only holding the vocabularyRegistry instance Index: EdgeContextMenu.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/gui/EdgeContextMenu.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** EdgeContextMenu.java 5 Sep 2005 15:47:18 -0000 1.18 --- EdgeContextMenu.java 18 Dec 2005 11:11:40 -0000 1.19 *************** *** 17,20 **** --- 17,21 ---- import org.mediavirus.graphl.GraphlPane; + import org.mediavirus.graphl.GraphlRegistry; import org.mediavirus.graphl.graph.Edge; import org.mediavirus.graphl.layout.EdgeLayouter; *************** *** 154,158 **** typeSubMenu.addSeparator(); ! Enumeration vocabs = graphlPane.getVocabularyRegistry().getRegisteredVocabularies(); while (vocabs.hasMoreElements()) { Vocabulary vocab = (Vocabulary) vocabs.nextElement(); --- 155,159 ---- typeSubMenu.addSeparator(); ! Enumeration vocabs = GraphlRegistry.instance().getVocabularyRegistry().getRegisteredVocabularies(); while (vocabs.hasMoreElements()) { Vocabulary vocab = (Vocabulary) vocabs.nextElement(); Index: NodeContextMenu.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/gui/NodeContextMenu.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** NodeContextMenu.java 5 Sep 2005 15:47:18 -0000 1.19 --- NodeContextMenu.java 18 Dec 2005 11:11:40 -0000 1.20 *************** *** 17,20 **** --- 17,21 ---- import org.mediavirus.graphl.GraphlPane; + import org.mediavirus.graphl.GraphlRegistry; import org.mediavirus.graphl.graph.Node; import org.mediavirus.graphl.layout.NodeLayouter; *************** *** 158,162 **** typeSubMenu.addSeparator(); ! Enumeration vocabs = graphlPane.getVocabularyRegistry().getRegisteredVocabularies(); while (vocabs.hasMoreElements()) { Vocabulary vocab = (Vocabulary) vocabs.nextElement(); --- 159,163 ---- typeSubMenu.addSeparator(); ! Enumeration vocabs = GraphlRegistry.instance().getVocabularyRegistry().getRegisteredVocabularies(); while (vocabs.hasMoreElements()) { Vocabulary vocab = (Vocabulary) vocabs.nextElement(); Index: TypeMenu.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/gui/TypeMenu.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TypeMenu.java 17 Aug 2005 15:52:55 -0000 1.3 --- TypeMenu.java 18 Dec 2005 11:11:40 -0000 1.4 *************** *** 25,29 **** String currentType = null; ! ArrayList listeners = new ArrayList(); public TypeMenu() { --- 25,29 ---- String currentType = null; ! ArrayList<ResourceListener> listeners = new ArrayList<ResourceListener>(); public TypeMenu() { |