- Timestamp:
- 09/28/11 03:03:13 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/EventBenchConsole/src/de/ugoe/cs/eventbench/commands/CMDshowTrie.java
r171 r209 62 62 .getData(modelname); 63 63 if (dataObject == null) { 64 Console.printerrln("No model with name " + modelname + "found"); 65 } else { 66 TrieBasedModel model = (TrieBasedModel) dataObject; 67 Tree<TrieVertex, Edge> graph = model.getTrieGraph(); 68 Layout<TrieVertex, Edge> layout = new TreeLayout<TrieVertex, Edge>( 69 graph, 60); 70 // The BasicVisualizationServer<V,E> is parameterized by the edge 71 // types 72 BasicVisualizationServer<TrieVertex, Edge> vv = new BasicVisualizationServer<TrieVertex, Edge>( 73 layout); 74 vv.setPreferredSize(new Dimension(1100, 850)); // Sets the viewing 75 // area size 64 Console.printerrln("Object " + modelname + " not found in storage."); 65 return; 66 } 67 if (!(dataObject instanceof TrieBasedModel)) { 68 Console.printerr("Object " + modelname 69 + " not of type TrieBasedModel."); 70 } 71 TrieBasedModel model = (TrieBasedModel) dataObject; 72 Tree<TrieVertex, Edge> graph = model.getTrieGraph(); 73 Layout<TrieVertex, Edge> layout = new TreeLayout<TrieVertex, Edge>( 74 graph, 60); 75 // The BasicVisualizationServer<V,E> is parameterized by the edge 76 // types 77 BasicVisualizationServer<TrieVertex, Edge> vv = new BasicVisualizationServer<TrieVertex, Edge>( 78 layout); 79 vv.setPreferredSize(new Dimension(1100, 850)); // Sets the viewing 80 // area size 76 81 77 82 final Rectangle rect = new Rectangle(40, 20); 78 83 79 Transformer<TrieVertex, Shape> vertexShapeTransformer = new Transformer<TrieVertex, Shape>() { 80 public Shape transform(TrieVertex s) { 81 return rect; 82 } 83 }; 84 vv.getRenderer().getVertexLabelRenderer() 85 .setPosition(Position.CNTR); 86 vv.getRenderContext().setVertexShapeTransformer( 87 vertexShapeTransformer); 88 vv.getRenderContext().setVertexLabelTransformer( 89 new ToStringLabeller<TrieVertex>()); 84 Transformer<TrieVertex, Shape> vertexShapeTransformer = new Transformer<TrieVertex, Shape>() { 85 public Shape transform(TrieVertex s) { 86 return rect; 87 } 88 }; 89 vv.getRenderer().getVertexLabelRenderer().setPosition(Position.CNTR); 90 vv.getRenderContext().setVertexShapeTransformer(vertexShapeTransformer); 91 vv.getRenderContext().setVertexLabelTransformer( 92 new ToStringLabeller<TrieVertex>()); 90 93 91 JFrame frame = new JFrame("Trie"); 92 frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); 93 frame.getContentPane().add(vv); 94 frame.pack(); 95 frame.setVisible(true); 96 } 94 JFrame frame = new JFrame("Trie"); 95 frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); 96 frame.getContentPane().add(vv); 97 frame.pack(); 98 frame.setVisible(true); 97 99 } 98 100
Note: See TracChangeset
for help on using the changeset viewer.