forked from Coded/SIPRP
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
419 lines
12 KiB
419 lines
12 KiB
/*
|
|
* SIPRPTracker.java
|
|
*
|
|
* Created on 18 de Maio de 2004, 19:46
|
|
*/
|
|
|
|
package siprp;
|
|
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
import javax.swing.tree.DefaultMutableTreeNode;
|
|
|
|
import shst.SHSTPropertiesConstants;
|
|
import shst.SHSTTrackerInterface;
|
|
import shst.cursos.CursosWindowAdapter;
|
|
import shst.higiene.gestao.GestaoRelatorioWindow;
|
|
import shst.higiene.mapa.MapaHigieneWindow;
|
|
import shst.higiene.marcacoes.MarcacoesHigieneInterface;
|
|
import shst.higiene.marcacoes.MarcacoesHigieneWindow;
|
|
import shst.higiene.relatorio.RelatorioHigieneSegurancaWindow;
|
|
import shst.lembretes.LembretesMultiWindow;
|
|
import shst.medicina.MedicinaWindow;
|
|
import shst.medicina.MedicinaWindowInterface;
|
|
import shst.medicina.exames.ui.RecepcaoExamesWindow;
|
|
import shst.medicina.locais_analise.EnviarAnalisesWindow;
|
|
import shst.medicina.locais_realizacao.LocaisRealizacaoWindow;
|
|
import shst.medicina.multi.MultiMarcacoesWindow;
|
|
import shst.medicina.presencas.RegistarPresencasWindow;
|
|
import shst.medicina.prestadores.PrestadoresWindow;
|
|
import siprp.clientes.AvisosPanel;
|
|
import siprp.companydataloaders.SIPRPPropertiesLoader;
|
|
import siprp.cursos.SIPRPCursosInit;
|
|
import siprp.estatistica.EstatisticaWindow;
|
|
import siprp.ficha.FichaWindow;
|
|
import siprp.impressaofichas.ImpressaoFichasWindow;
|
|
import siprp.pesquisas.RelatorioAnualWindow;
|
|
|
|
import com.evolute.module.cursos.CursosWindow;
|
|
import com.evolute.utils.Singleton;
|
|
import com.evolute.utils.error.ErrorLogger;
|
|
import com.evolute.utils.tracker.TrackableWindow;
|
|
import com.evolute.utils.tracker.WindowCreator;
|
|
import com.evolute.utils.tracker.WindowTracker;
|
|
import com.evolute.utils.ui.window.LoginWindow;
|
|
/**
|
|
*
|
|
* @author fpalma
|
|
*/
|
|
public class SIPRPTracker extends WindowTracker implements SHSTTrackerInterface
|
|
{
|
|
public static final String FICHA_APTIDAO = "Ficha de Aptid\u00e3o";
|
|
public static final String CRIACAO_FICHA_APTIDAO = "Cria\u00e7\u00e3o de Fichas de Aptid\u00e3o";
|
|
public static final String GESTAO_CLIENTES = "Gest\u00e3o de Clientes";
|
|
public static final String MEDICINA = "Medicina";
|
|
public static final String MEDICINA_MARCACOES = "Marca\u00e7\u00f5es";
|
|
public static final String MEDICINA_MULTI_MARCACOES = MultiMarcacoesWindow.TITLE;
|
|
public static final String MEDICINA_LOCAIS = "Locais de Realiza\u00e7\u00e3o";
|
|
public static final String MEDICINA_ENVIO_ANALISES = EnviarAnalisesWindow.TITLE;
|
|
public static final String MEDICINA_PRESENCAS = "Presen\u00e7as";
|
|
public static final String HIGIENE_SEGURANCA = "Higiene e Seguran\u00e7a";
|
|
public static final String RELATORIO_ANUAL = "Relat\u00f3rio Anual";
|
|
public static final String LISTAGENS = "Listagens";
|
|
|
|
private final AvisosPanel avisos;
|
|
private shst.clientes.ClientesWindow clientesWindow;
|
|
private MedicinaWindowInterface medicinaWindow;
|
|
private MultiMarcacoesWindow multiMarcacoesWindow;
|
|
// private MedicinaProcessoWindow medicinaProcessoWindow;
|
|
private MarcacoesHigieneInterface higieneWindow;
|
|
|
|
/** Creates a new instance of SIPRPTracker */
|
|
public SIPRPTracker( AvisosPanel avisosP )
|
|
{
|
|
Singleton.setInstance( SingletonConstants.SIPRP_TRACKER, this );
|
|
Singleton.setInstance( Singleton.TRACKER, this );
|
|
this.avisos = avisosP;
|
|
avisos.setTracker( this );
|
|
Map<String, WindowCreator> creators = new HashMap<String, WindowCreator>();
|
|
DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(
|
|
Singleton.getInstance( SHSTPropertiesConstants.COMPANY_ACRONYM ) );
|
|
|
|
boolean hasFicha = ( (Boolean)Singleton.getInstance( SHSTPropertiesConstants.MODULE_FICHA ) ).booleanValue();
|
|
boolean hasGestao = ( (Boolean)Singleton.getInstance( SHSTPropertiesConstants.MODULE_CLIENTES ) ).booleanValue();
|
|
boolean hasRelatorio = ( (Boolean)Singleton.getInstance( SHSTPropertiesConstants.MODULE_RELATORIO ) ).booleanValue();
|
|
boolean hasListagens = ( (Boolean)Singleton.getInstance( SHSTPropertiesConstants.MODULE_LISTAGENS ) ).booleanValue();
|
|
boolean hasCursos = SIPRPPropertiesLoader.getInstance().findProperty( SHSTPropertiesConstants.MODULE_CURSOS, true );
|
|
|
|
if( hasGestao )
|
|
{
|
|
try
|
|
{
|
|
clientesWindow = new shst.clientes.ClientesWindow( avisos );
|
|
clientesWindow.setTracker( this );
|
|
medicinaWindow = new MedicinaWindow();
|
|
medicinaWindow.setTracker( this );
|
|
higieneWindow = new MarcacoesHigieneWindow();
|
|
higieneWindow.setTracker( this );
|
|
}
|
|
catch( Exception ex )
|
|
{
|
|
clientesWindow = null;
|
|
medicinaWindow = null;
|
|
higieneWindow = null;
|
|
ErrorLogger.logException(ex);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
clientesWindow = null;
|
|
medicinaWindow = null;
|
|
}
|
|
|
|
if( hasFicha )
|
|
{
|
|
DefaultMutableTreeNode fichaNode = new DefaultMutableTreeNode( FICHA_APTIDAO );
|
|
|
|
fichaNode.add( new DefaultMutableTreeNode( CRIACAO_FICHA_APTIDAO ) );
|
|
creators.put( CRIACAO_FICHA_APTIDAO, new WindowCreator() {
|
|
public TrackableWindow create()
|
|
throws Exception
|
|
{
|
|
return FichaWindow.getWindow();
|
|
}
|
|
} );
|
|
|
|
fichaNode.add( new DefaultMutableTreeNode( ImpressaoFichasWindow.TITLE ) );
|
|
creators.put( ImpressaoFichasWindow.TITLE, new WindowCreator() {
|
|
public TrackableWindow create()
|
|
throws Exception
|
|
{
|
|
return new ImpressaoFichasWindow();
|
|
}
|
|
} );
|
|
|
|
rootNode.add( fichaNode );
|
|
}
|
|
|
|
if( hasGestao )
|
|
{
|
|
rootNode.add( new DefaultMutableTreeNode( GESTAO_CLIENTES ) );
|
|
creators.put( GESTAO_CLIENTES, new WindowCreator() {
|
|
public TrackableWindow create()
|
|
throws Exception
|
|
{
|
|
return getClientesWindow();
|
|
}
|
|
} );
|
|
|
|
// rootNode.add( new DefaultMutableTreeNode( LembretesWindow.TITLE ) );
|
|
// creators.put( LembretesWindow.TITLE, new WindowCreator() {
|
|
// public TrackableWindow create()
|
|
// throws Exception
|
|
// {
|
|
// return new LembretesWindow();
|
|
// }
|
|
// } );
|
|
|
|
rootNode.add( new DefaultMutableTreeNode( LembretesMultiWindow.TITLE ) );
|
|
creators.put( LembretesMultiWindow.TITLE, new WindowCreator() {
|
|
@Override
|
|
public TrackableWindow create() throws Exception
|
|
{
|
|
return new LembretesMultiWindow();
|
|
}
|
|
});
|
|
|
|
DefaultMutableTreeNode medicinaNode = new DefaultMutableTreeNode( MEDICINA );
|
|
|
|
// medicinaNode.add( new DefaultMutableTreeNode( MedicinaProcessoWindow.TITLE ) );
|
|
// creators.put( MedicinaProcessoWindow.TITLE, new WindowCreator() {
|
|
// public TrackableWindow create()
|
|
// throws Exception
|
|
// {
|
|
// if( medicinaProcessoWindow == null )
|
|
// {
|
|
// medicinaProcessoWindow = new MedicinaProcessoWindow();
|
|
// }
|
|
// return medicinaProcessoWindow;
|
|
// }
|
|
// } );
|
|
|
|
medicinaNode.add( new DefaultMutableTreeNode( MEDICINA_MARCACOES ) );
|
|
creators.put( MEDICINA_MARCACOES, new WindowCreator() {
|
|
public TrackableWindow create()
|
|
throws Exception
|
|
{
|
|
return getMedicinaWindow();
|
|
}
|
|
} );
|
|
|
|
medicinaNode.add( new DefaultMutableTreeNode( MEDICINA_MULTI_MARCACOES ) );
|
|
creators.put( MEDICINA_MULTI_MARCACOES, new WindowCreator() {
|
|
public TrackableWindow create()
|
|
throws Exception
|
|
{
|
|
return getMultiMarcacoesWindow();
|
|
}
|
|
});
|
|
|
|
medicinaNode.add( new DefaultMutableTreeNode( MEDICINA_LOCAIS ) );
|
|
creators.put( MEDICINA_LOCAIS, new WindowCreator() {
|
|
public TrackableWindow create()
|
|
throws Exception
|
|
{
|
|
return new LocaisRealizacaoWindow();
|
|
}
|
|
} );
|
|
|
|
medicinaNode.add( new DefaultMutableTreeNode( MEDICINA_ENVIO_ANALISES ) );
|
|
creators.put( MEDICINA_ENVIO_ANALISES, new WindowCreator() {
|
|
public TrackableWindow create()
|
|
throws Exception
|
|
{
|
|
return new EnviarAnalisesWindow();
|
|
}
|
|
} );
|
|
|
|
medicinaNode.add( new DefaultMutableTreeNode( RecepcaoExamesWindow.TITLE ) );
|
|
creators.put( RecepcaoExamesWindow.TITLE, new WindowCreator() {
|
|
public TrackableWindow create()
|
|
throws Exception
|
|
{
|
|
return new RecepcaoExamesWindow();
|
|
}
|
|
} );
|
|
|
|
medicinaNode.add( new DefaultMutableTreeNode( MEDICINA_PRESENCAS ) );
|
|
creators.put( MEDICINA_PRESENCAS, new WindowCreator() {
|
|
public TrackableWindow create()
|
|
throws Exception
|
|
{
|
|
return new RegistarPresencasWindow();
|
|
}
|
|
} );
|
|
|
|
medicinaNode.add( new DefaultMutableTreeNode( PrestadoresWindow.TITLE ) );
|
|
creators.put( PrestadoresWindow.TITLE, new WindowCreator() {
|
|
public TrackableWindow create()
|
|
throws Exception
|
|
{
|
|
return new PrestadoresWindow();
|
|
}
|
|
} );
|
|
|
|
rootNode.add( medicinaNode );
|
|
|
|
DefaultMutableTreeNode higieneNode = new DefaultMutableTreeNode( HIGIENE_SEGURANCA );
|
|
|
|
higieneNode.add( new DefaultMutableTreeNode( MarcacoesHigieneWindow.TITLE ) );
|
|
creators.put( MarcacoesHigieneWindow.TITLE, new WindowCreator() {
|
|
public TrackableWindow create()
|
|
throws Exception
|
|
{
|
|
return getHigieneWindow();
|
|
}
|
|
} );
|
|
|
|
higieneNode.add( new DefaultMutableTreeNode( MapaHigieneWindow.TITLE ) );
|
|
creators.put( MapaHigieneWindow.TITLE, new WindowCreator() {
|
|
public TrackableWindow create()
|
|
throws Exception
|
|
{
|
|
return new MapaHigieneWindow();
|
|
}
|
|
} );
|
|
higieneNode.add( new DefaultMutableTreeNode( GestaoRelatorioWindow.TITLE ) );
|
|
creators.put( GestaoRelatorioWindow.TITLE, new WindowCreator() {
|
|
public TrackableWindow create()
|
|
throws Exception
|
|
{
|
|
return new GestaoRelatorioWindow();
|
|
}
|
|
} );
|
|
higieneNode.add( new DefaultMutableTreeNode( RelatorioHigieneSegurancaWindow.TITLE ) );
|
|
creators.put( RelatorioHigieneSegurancaWindow.TITLE, new WindowCreator() {
|
|
public TrackableWindow create()
|
|
throws Exception
|
|
{
|
|
return new RelatorioHigieneSegurancaWindow();
|
|
}
|
|
} );
|
|
rootNode.add( higieneNode );
|
|
}
|
|
|
|
if( hasRelatorio )
|
|
{
|
|
rootNode.add( new DefaultMutableTreeNode( RELATORIO_ANUAL ) );
|
|
creators.put( RELATORIO_ANUAL, new WindowCreator() {
|
|
public TrackableWindow create()
|
|
throws Exception
|
|
{
|
|
return new RelatorioAnualWindow();
|
|
}
|
|
} );
|
|
}
|
|
|
|
if( hasListagens )
|
|
{
|
|
rootNode.add( new DefaultMutableTreeNode( LISTAGENS ) );
|
|
creators.put( LISTAGENS, new WindowCreator() {
|
|
public TrackableWindow create()
|
|
throws Exception
|
|
{
|
|
return new EstatisticaWindow();
|
|
}
|
|
} );
|
|
}
|
|
|
|
|
|
try
|
|
{
|
|
SIPRPCursosInit.initFactory();
|
|
}
|
|
catch ( Exception e )
|
|
{
|
|
ErrorLogger.logException( e );
|
|
}
|
|
if( hasCursos )
|
|
{
|
|
rootNode.add( new DefaultMutableTreeNode( CursosWindow.TITLE ) );
|
|
creators.put( CursosWindow.TITLE, new WindowCreator() {
|
|
public TrackableWindow create()
|
|
throws Exception
|
|
{
|
|
return new CursosWindowAdapter();
|
|
}
|
|
} );
|
|
}
|
|
setRoot( rootNode );
|
|
setCreators( creators );
|
|
}
|
|
|
|
public shst.clientes.ClientesWindow getClientesWindow() throws Exception
|
|
{
|
|
if( clientesWindow == null )
|
|
{
|
|
clientesWindow = new shst.clientes.ClientesWindow( avisos );
|
|
clientesWindow.setTracker( SIPRPTracker.this );
|
|
}
|
|
return clientesWindow;
|
|
}
|
|
|
|
private shst.clientes.ClientesWindow clientesWindow2 = null;
|
|
|
|
private LoginWindow loginWindow = null;
|
|
|
|
public shst.clientes.ClientesWindow getClientesWindow2() throws Exception
|
|
{
|
|
if( clientesWindow2 == null )
|
|
{
|
|
clientesWindow2 = new shst.clientes.ClientesWindow( avisos );
|
|
clientesWindow2.setTracker( SIPRPTracker.this );
|
|
}
|
|
return clientesWindow2;
|
|
}
|
|
|
|
public MedicinaWindowInterface getMedicinaWindow() throws Exception
|
|
{
|
|
if( medicinaWindow == null )
|
|
{
|
|
medicinaWindow = new MedicinaWindow();
|
|
medicinaWindow.setTracker( SIPRPTracker.this );
|
|
}
|
|
return medicinaWindow;
|
|
}
|
|
|
|
public MultiMarcacoesWindow getMultiMarcacoesWindow() throws Exception
|
|
{
|
|
if( multiMarcacoesWindow == null )
|
|
{
|
|
multiMarcacoesWindow = new MultiMarcacoesWindow();
|
|
multiMarcacoesWindow.setTracker( SIPRPTracker.this );
|
|
}
|
|
return multiMarcacoesWindow;
|
|
}
|
|
|
|
// public MedicinaProcessoWindow getMedicinaProcessoWindow()
|
|
// {
|
|
// if( medicinaProcessoWindow == null )
|
|
// {
|
|
// try
|
|
// {
|
|
// medicinaProcessoWindow = new MedicinaProcessoWindow();
|
|
// } catch( Exception e )
|
|
// {
|
|
// e.printStackTrace();
|
|
// }
|
|
// }
|
|
// return medicinaProcessoWindow;
|
|
// }
|
|
|
|
public MarcacoesHigieneInterface getHigieneWindow() throws Exception
|
|
{
|
|
if( higieneWindow == null )
|
|
{
|
|
higieneWindow = new MarcacoesHigieneWindow();
|
|
higieneWindow.setTracker( SIPRPTracker.this );
|
|
}
|
|
return higieneWindow;
|
|
}
|
|
|
|
public AvisosPanel getAvisosPanel()
|
|
{
|
|
return avisos;
|
|
}
|
|
|
|
public void setLoginWindow( LoginWindow loginWindow )
|
|
{
|
|
this.loginWindow = loginWindow;
|
|
}
|
|
|
|
public LoginWindow getLoginWindow()
|
|
{
|
|
return loginWindow;
|
|
}
|
|
}
|