package com.algomagic.atn; import att.grappa.*; public class ClusterUpdate extends AbstractUpdate implements Update { private int _cluster; private boolean _start; private boolean _local; public ClusterUpdate( int cluster, boolean start, boolean local, int side ) { _cluster = cluster; _start = start; _local = local; _side = side; } public int initialize( VisualizationPanel visPanel ) { // Graph graph = visPanel.getGraph( ); // Subgraph sg = graph.findSubgraphByName( _cluster ); // if( sg == null ) { // new Subgraph( graph, _cluster ); // } return 3; } public boolean apply( VisualizationPanel visPanel ) { // Subgraph sg = visPanel.getGraph( ).findSubgraphByName( _cluster ); // if( sg == null ) { // return; // } // Subgraph current = visPanel.getCurrentCluster( ); // if( current != null && _start ) { // hide( current ); // } // visPanel.setCurrentCluster( sg ); if( _start && _local ) { // System.out.println( "raising local tab" ); visPanel.setRaised( _local ); visPanel.setLocal( true ); } else { visPanel.setLocal( false ); } // if( _start && _local ) { // hide( sg ); // } // if( _start && !_local ) { // show( sg ); // } // if( !_start ) { // show( sg ); // } return true; } public void undo( VisualizationPanel visPanel ) { if( _start && _local ) { visPanel.setLocal( false ); } else if( !_start && _local ) { visPanel.setLocal( true ); } else if( _start && !_local ) { visPanel.setLocal( true ); } else { visPanel.setLocal( false ); } } // private void show( Subgraph sg ) { // sg.setAttribute( "style", "solid" ); // sg.setAttribute( "color", "black" ); // } // private void hide( Subgraph sg ) { // sg.setAttribute( "style", "dotted" ); // sg.setAttribute( "color", "whitesmoke" ); // } public int getCluster( ) { return _cluster; } public boolean getLocal( ) { return _local; } public boolean getStart( ) { return _start; } public Element getElement( VisualizationPanel visPanel ) { throw new RuntimeException( ); } }