[graphl-cvs] graphl/src/org/mediavirus/graphl GraphlRegistry.java GraphlApplication.java GraphlApple
Status: Pre-Alpha
Brought to you by:
flo1
From: Flo L. <fl...@us...> - 2005-12-18 11:11:53
|
Update of /cvsroot/graphl/graphl/src/org/mediavirus/graphl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2618/src/org/mediavirus/graphl Modified Files: GraphlApplication.java GraphlApplet.java GraphlPane.java GraphlPanel.java Added Files: GraphlRegistry.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: GraphlPanel.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/GraphlPanel.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** GraphlPanel.java 5 Sep 2005 15:46:38 -0000 1.24 --- GraphlPanel.java 18 Dec 2005 11:11:40 -0000 1.25 *************** *** 280,287 **** if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE || e.getKeyCode() == KeyEvent.VK_DELETE) { ! Iterator nodes = graphPane.getSelection().getSelectedNodes().iterator(); while (nodes.hasNext()) { ! Node node = (Node) nodes.next(); ! Vector edges = new Vector(); edges.addAll(node.getEdgesFrom()); edges.addAll(node.getEdgesTo()); --- 280,287 ---- if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE || e.getKeyCode() == KeyEvent.VK_DELETE) { ! Iterator<Node> nodes = graphPane.getSelection().getSelectedNodes().iterator(); while (nodes.hasNext()) { ! Node node = nodes.next(); ! Vector<Edge> edges = new Vector<Edge>(); edges.addAll(node.getEdgesFrom()); edges.addAll(node.getEdgesTo()); *************** *** 298,305 **** } ! public void nodesAddedToSelection(SelectionModel nodeSelectionModel, Collection nodes) { } ! public void nodesRemovedFromSelection(SelectionModel nodeSelectionModel, Collection nodes) { } --- 298,305 ---- } ! public void nodesAddedToSelection(SelectionModel nodeSelectionModel, Collection<Node> nodes) { } ! public void nodesRemovedFromSelection(SelectionModel nodeSelectionModel, Collection<Node> nodes) { } *************** *** 310,314 **** * @see org.mediavirus.graphl.selection.SelectionListener#edgesAddedToSelection(org.mediavirus.graphl.selection.SelectionModel, java.util.Collection) */ ! public void edgesAddedToSelection(SelectionModel nodeSelectionModel, Collection nodes) { } --- 310,314 ---- * @see org.mediavirus.graphl.selection.SelectionListener#edgesAddedToSelection(org.mediavirus.graphl.selection.SelectionModel, java.util.Collection) */ ! public void edgesAddedToSelection(SelectionModel nodeSelectionModel, Collection<Edge> edges) { } *************** *** 316,320 **** * @see org.mediavirus.graphl.selection.SelectionListener#edgesRemovedFromSelection(org.mediavirus.graphl.selection.SelectionModel, java.util.Collection) */ ! public void edgesRemovedFromSelection(SelectionModel nodeSelectionModel, Collection nodes) { } --- 316,320 ---- * @see org.mediavirus.graphl.selection.SelectionListener#edgesRemovedFromSelection(org.mediavirus.graphl.selection.SelectionModel, java.util.Collection) */ ! public void edgesRemovedFromSelection(SelectionModel nodeSelectionModel, Collection<Edge> edges) { } --- NEW FILE: GraphlRegistry.java --- /* * Created on 17.12.2005 */ package org.mediavirus.graphl; import java.util.HashMap; import org.mediavirus.graphl.vocabulary.SimpleVocabularyRegistry; import org.mediavirus.graphl.vocabulary.VocabularyRegistry; public class GraphlRegistry extends HashMap<String, Object>{ protected static GraphlRegistry instance; VocabularyRegistry vocabularyRegistry; protected GraphlRegistry(){} public static synchronized GraphlRegistry instance() { if (instance == null) { instance = new GraphlRegistry(); } return instance; } public synchronized VocabularyRegistry getVocabularyRegistry() { if (vocabularyRegistry == null) { vocabularyRegistry = new SimpleVocabularyRegistry(); } return vocabularyRegistry; } public void setVocabularyRegistry(VocabularyRegistry vocabularyRegistry) { this.vocabularyRegistry = vocabularyRegistry; } } Index: GraphlApplet.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/GraphlApplet.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** GraphlApplet.java 14 Dec 2005 12:43:51 -0000 1.12 --- GraphlApplet.java 18 Dec 2005 11:11:40 -0000 1.13 *************** *** 117,121 **** try { // if it is an absolute url, redirect through proxy servlet ! URL testurl = new URL(urlstr); urlstr = "proxy?url=" + urlstr; } --- 117,121 ---- try { // if it is an absolute url, redirect through proxy servlet ! @SuppressWarnings("unused") URL testurl = new URL(urlstr); urlstr = "proxy?url=" + urlstr; } *************** *** 153,157 **** try { // if it is an absolute url, redirect through proxy servlet ! URL testurl = new URL(urlstr); urlstr = "proxy?url=" + urlstr; } --- 153,157 ---- try { // if it is an absolute url, redirect through proxy servlet ! @SuppressWarnings("unused") URL testurl = new URL(urlstr); urlstr = "proxy?url=" + urlstr; } Index: GraphlApplication.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/GraphlApplication.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** GraphlApplication.java 14 Dec 2005 12:43:51 -0000 1.22 --- GraphlApplication.java 18 Dec 2005 11:11:40 -0000 1.23 *************** *** 32,35 **** --- 32,36 ---- import javax.swing.KeyStroke; + import org.apache.commons.jxpath.ri.JXPathContextReferenceImpl; import org.mediavirus.graphl.graph.Graph; import org.mediavirus.graphl.graph.Node; *************** *** 39,42 **** --- 40,44 ---- import org.mediavirus.graphl.gui.GenericDialog; import org.mediavirus.graphl.gui.OpenURLPanel; + import org.mediavirus.graphl.jxpath.GraphPointerFactory; import org.mediavirus.graphl.painter.NodePainter; import org.mediavirus.graphl.vocabulary.DC; *************** *** 191,199 **** // TODO (Future) the whole vocab. registration should be defined in RDF files ! mainPanel.graphPane.getVocabularyRegistry().registerVocabulary(Graphl.getVocabulary()); ! mainPanel.graphPane.getVocabularyRegistry().registerVocabulary(RDF.getVocabulary()); ! mainPanel.graphPane.getVocabularyRegistry().registerVocabulary(RDFS.getVocabulary()); ! mainPanel.graphPane.getVocabularyRegistry().registerVocabulary(DC.getVocabulary()); ! mainPanel.graphPane.getVocabularyRegistry().registerVocabulary(FOAF.getVocabulary()); } --- 193,203 ---- // TODO (Future) the whole vocab. registration should be defined in RDF files ! GraphlRegistry.instance().getVocabularyRegistry().registerVocabulary(Graphl.getVocabulary()); ! GraphlRegistry.instance().getVocabularyRegistry().registerVocabulary(RDF.getVocabulary()); ! GraphlRegistry.instance().getVocabularyRegistry().registerVocabulary(RDFS.getVocabulary()); ! GraphlRegistry.instance().getVocabularyRegistry().registerVocabulary(DC.getVocabulary()); ! GraphlRegistry.instance().getVocabularyRegistry().registerVocabulary(FOAF.getVocabulary()); ! ! GraphlRegistry.instance().getVocabularyRegistry().registerNamespace("ff", "http://www.funkfeuer.at/vocab#"); } *************** *** 568,571 **** --- 572,577 ---- System.setProperty("swing.metalTheme", "steel"); + JXPathContextReferenceImpl.addNodePointerFactory(new GraphPointerFactory()); + GraphlApplication app = new GraphlApplication(); int[] size = {1024, 768}; *************** *** 658,662 **** long starttime = 0; ! List persons = new ArrayList(200); public void run() { --- 664,668 ---- long starttime = 0; ! List<Node> persons = new ArrayList<Node>(200); public void run() { Index: GraphlPane.java =================================================================== RCS file: /cvsroot/graphl/graphl/src/org/mediavirus/graphl/GraphlPane.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** GraphlPane.java 14 Dec 2005 12:43:51 -0000 1.22 --- GraphlPane.java 18 Dec 2005 11:11:40 -0000 1.23 *************** *** 49,54 **** import org.mediavirus.graphl.view.SimpleFacetRegistry; import org.mediavirus.graphl.vocabulary.NS; - import org.mediavirus.graphl.vocabulary.SimpleVocabularyRegistry; - import org.mediavirus.graphl.vocabulary.VocabularyRegistry; /** --- 49,52 ---- *************** *** 58,63 **** public class GraphlPane extends JPanel implements GraphListener { ! private Set registeredEdgeTypes = new HashSet(); ! private Set registeredNodeTypes = new HashSet(); private boolean autoRegisterTypes = true; --- 56,61 ---- public class GraphlPane extends JPanel implements GraphListener { ! private Set<String> registeredEdgeTypes = new HashSet<String>(); ! private Set<String> registeredNodeTypes = new HashSet<String>(); private boolean autoRegisterTypes = true; *************** *** 74,78 **** FacetRegistry facetRegistry = new SimpleFacetRegistry(); - VocabularyRegistry vocabularyRegistry = new SimpleVocabularyRegistry(); /** The graph being visualized. */ --- 72,75 ---- *************** *** 81,85 **** protected GraphListener graphListener; /** The array of registered manipulators in the order they were registered. */ ! protected List manipulators; protected SelectionModel selection; --- 78,82 ---- protected GraphListener graphListener; /** The array of registered manipulators in the order they were registered. */ ! protected List<Manipulator> manipulators; protected SelectionModel selection; *************** *** 102,106 **** setSourceGraph(graph); graphListener=new GraphHandler(); ! manipulators=new ArrayList(); enableEvents(MouseEvent.MOUSE_EVENT_MASK | MouseEvent.MOUSE_MOTION_EVENT_MASK | KeyEvent.KEY_EVENT_MASK | FocusEvent.FOCUS_EVENT_MASK | ComponentEvent.COMPONENT_EVENT_MASK); setBackground(Color.white); --- 99,103 ---- setSourceGraph(graph); graphListener=new GraphHandler(); ! manipulators=new ArrayList<Manipulator>(); enableEvents(MouseEvent.MOUSE_EVENT_MASK | MouseEvent.MOUSE_MOTION_EVENT_MASK | KeyEvent.KEY_EVENT_MASK | FocusEvent.FOCUS_EVENT_MASK | ComponentEvent.COMPONENT_EVENT_MASK); setBackground(Color.white); *************** *** 141,158 **** this.comment = comment; } - - /** - * @return The VocabularyRegistry. - */ - public VocabularyRegistry getVocabularyRegistry() { - return vocabularyRegistry; - } - - /** - * @param vocabularyRegistry The VocabularyRegistry to set. - */ - public void setVocabularyRegistry(VocabularyRegistry vocabularyRegistry) { - this.vocabularyRegistry = vocabularyRegistry; - } Node vocabularies = null; --- 138,141 ---- *************** *** 206,210 **** g2.transform(transform); } ! long renderStartTime=System.currentTimeMillis(); Rectangle clipRectangle=g.getClipBounds(); Color oldColor=g.getColor(); --- 189,193 ---- g2.transform(transform); } ! //long renderStartTime=System.currentTimeMillis(); Rectangle clipRectangle=g.getClipBounds(); Color oldColor=g.getColor(); *************** *** 260,264 **** for (int i=0;i<manipulators.size();i++) ((Manipulator)manipulators.get(i)).paint(g2); ! long renderDuration = System.currentTimeMillis()-renderStartTime; //if (renderDuration > 0) System.out.println("render time: " + renderDuration + " FPS: " + 1000.0/renderDuration); } --- 243,247 ---- for (int i=0;i<manipulators.size();i++) ((Manipulator)manipulators.get(i)).paint(g2); ! //long renderDuration = System.currentTimeMillis()-renderStartTime; //if (renderDuration > 0) System.out.println("render time: " + renderDuration + " FPS: " + 1000.0/renderDuration); } *************** *** 475,479 **** public Set getNodesInRectangle(Rectangle rectangle) { synchronized (filteredGraph) { ! Set nodesInRectangle=new HashSet(); Rectangle nodeRectangle=new Rectangle(); Iterator nodes=filteredGraph.getNodes().iterator(); --- 458,462 ---- public Set getNodesInRectangle(Rectangle rectangle) { synchronized (filteredGraph) { ! Set<Node> nodesInRectangle=new HashSet<Node>(); Rectangle nodeRectangle=new Rectangle(); Iterator nodes=filteredGraph.getNodes().iterator(); *************** *** 801,805 **** /** A List with all configuration nodes in the settings graph */ ! private List configurations = new ArrayList(); private Node currentConfiguration = null; --- 784,788 ---- /** A List with all configuration nodes in the settings graph */ ! private List<Node> configurations = new ArrayList<Node>(); private Node currentConfiguration = null; |