[8780cbec] | 1 | package com.algomagic.atn; |
---|
| 2 | |
---|
| 3 | import att.grappa.*; |
---|
| 4 | |
---|
| 5 | public class ClusterUpdate extends AbstractUpdate implements Update { |
---|
| 6 | private int _cluster; |
---|
| 7 | private boolean _start; |
---|
| 8 | private boolean _local; |
---|
| 9 | |
---|
| 10 | public ClusterUpdate( int cluster, boolean start, boolean local, int side ) { |
---|
| 11 | _cluster = cluster; |
---|
| 12 | _start = start; |
---|
| 13 | _local = local; |
---|
| 14 | _side = side; |
---|
| 15 | } |
---|
| 16 | |
---|
| 17 | public int initialize( VisualizationPanel visPanel ) { |
---|
| 18 | // Graph graph = visPanel.getGraph( ); |
---|
| 19 | // Subgraph sg = graph.findSubgraphByName( _cluster ); |
---|
| 20 | // if( sg == null ) { |
---|
| 21 | // new Subgraph( graph, _cluster ); |
---|
| 22 | // } |
---|
| 23 | |
---|
| 24 | return 3; |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | public boolean apply( VisualizationPanel visPanel ) { |
---|
| 28 | |
---|
| 29 | // Subgraph sg = visPanel.getGraph( ).findSubgraphByName( _cluster ); |
---|
| 30 | // if( sg == null ) { |
---|
| 31 | // return; |
---|
| 32 | // } |
---|
| 33 | |
---|
| 34 | |
---|
| 35 | // Subgraph current = visPanel.getCurrentCluster( ); |
---|
| 36 | // if( current != null && _start ) { |
---|
| 37 | // hide( current ); |
---|
| 38 | // } |
---|
| 39 | |
---|
| 40 | // visPanel.setCurrentCluster( sg ); |
---|
| 41 | if( _start && _local ) { |
---|
| 42 | // System.out.println( "raising local tab" ); |
---|
| 43 | visPanel.setRaised( _local ); |
---|
| 44 | |
---|
| 45 | visPanel.setLocal( true ); |
---|
| 46 | } else { |
---|
| 47 | visPanel.setLocal( false ); |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | |
---|
| 51 | // if( _start && _local ) { |
---|
| 52 | // hide( sg ); |
---|
| 53 | // } |
---|
| 54 | |
---|
| 55 | // if( _start && !_local ) { |
---|
| 56 | // show( sg ); |
---|
| 57 | // } |
---|
| 58 | |
---|
| 59 | // if( !_start ) { |
---|
| 60 | // show( sg ); |
---|
| 61 | // } |
---|
| 62 | |
---|
| 63 | return true; |
---|
| 64 | |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | |
---|
| 68 | public void undo( VisualizationPanel visPanel ) { |
---|
| 69 | if( _start && _local ) { |
---|
| 70 | visPanel.setLocal( false ); |
---|
| 71 | } else if( !_start && _local ) { |
---|
| 72 | visPanel.setLocal( true ); |
---|
| 73 | } else if( _start && !_local ) { |
---|
| 74 | visPanel.setLocal( true ); |
---|
| 75 | } else { |
---|
| 76 | visPanel.setLocal( false ); |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | |
---|
| 82 | |
---|
| 83 | // private void show( Subgraph sg ) { |
---|
| 84 | // sg.setAttribute( "style", "solid" ); |
---|
| 85 | // sg.setAttribute( "color", "black" ); |
---|
| 86 | // } |
---|
| 87 | |
---|
| 88 | // private void hide( Subgraph sg ) { |
---|
| 89 | // sg.setAttribute( "style", "dotted" ); |
---|
| 90 | // sg.setAttribute( "color", "whitesmoke" ); |
---|
| 91 | // } |
---|
| 92 | |
---|
| 93 | public int getCluster( ) { |
---|
| 94 | return _cluster; |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | |
---|
| 99 | public boolean getLocal( ) { |
---|
| 100 | return _local; |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | |
---|
| 104 | public boolean getStart( ) { |
---|
| 105 | return _start; |
---|
| 106 | } |
---|
| 107 | |
---|
| 108 | public Element getElement( VisualizationPanel visPanel ) { |
---|
| 109 | throw new RuntimeException( ); |
---|
| 110 | } |
---|
| 111 | |
---|
| 112 | |
---|
| 113 | } |
---|