/* * SIPRPTracker.java * * Created on 18 de Maio de 2004, 19:46 */ package siprp; import javax.swing.*; import javax.swing.tree.*; import java.util.*; import com.evolute.utils.*; import com.evolute.utils.tracker.*; import siprp.*; import siprp.ficha.*; import siprp.clientes.*; import siprp.estatistica.*; import siprp.pesquisas.*; /** * * @author fpalma */ public class SIPRPTracker extends WindowTracker { public static final String FICHA_APTIDAO = "Ficha de Aptid\u00e3o"; public static final String GESTAO_CLIENTES = "Gest\u00e3o de Clientes"; public static final String RELATORIO_ANUAL = "Relat\u00f3rio Anual"; public static final String LISTAGENS = "Listagens"; private final AvisosPanel avisos; private ClientesWindow clientesWindow; /** Creates a new instance of SIPRPTracker */ public SIPRPTracker( AvisosPanel avisosP ) { this.avisos = avisosP; avisos.setTracker( this ); Hashtable creators = new Hashtable(); DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode( Singleton.getInstance( SingletonConstants.COMPANY_ACRONYM ) ); boolean hasFicha = ( (Boolean)Singleton.getInstance( SingletonConstants.MODULE_FICHA ) ).booleanValue(); boolean hasGestao = ( (Boolean)Singleton.getInstance( SingletonConstants.MODULE_CLIENTES ) ).booleanValue(); boolean hasRelatorio = ( (Boolean)Singleton.getInstance( SingletonConstants.MODULE_RELATORIO ) ).booleanValue(); boolean hasListagens = ( (Boolean)Singleton.getInstance( SingletonConstants.MODULE_LISTAGENS ) ).booleanValue(); if( hasGestao ) { try { clientesWindow = new ClientesWindow( avisos ); } catch( Exception ex ) { clientesWindow = null; ex.printStackTrace(); } } else { clientesWindow = null; } if( hasFicha ) { rootNode.add( new DefaultMutableTreeNode( FICHA_APTIDAO ) ); creators.put( FICHA_APTIDAO, new WindowCreator() { public TrackableWindow create() throws Exception { return new FichaWindow(); } } ); } if( hasGestao ) { rootNode.add( new DefaultMutableTreeNode( GESTAO_CLIENTES ) ); creators.put( GESTAO_CLIENTES, new WindowCreator() { public TrackableWindow create() throws Exception { if( clientesWindow == null ) { clientesWindow = new ClientesWindow( avisos ); } return clientesWindow; } } ); } if( hasRelatorio ) { rootNode.add( new DefaultMutableTreeNode( RELATORIO_ANUAL ) ); creators.put( RELATORIO_ANUAL, new WindowCreator() { public TrackableWindow create() throws Exception { return new PesquisasWindow(); } } ); } if( hasListagens ) { rootNode.add( new DefaultMutableTreeNode( LISTAGENS ) ); creators.put( LISTAGENS, new WindowCreator() { public TrackableWindow create() throws Exception { return new EstatisticaWindow(); } } ); } setRoot( rootNode ); setCreators( creators ); } public ClientesWindow getClientesWindow() { return clientesWindow; } }