From d2332cb506da70d9c1d35c0291b9a58289a2170b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tiago=20Sim=C3=A3o?= Date: Wed, 14 Jul 2010 16:04:15 +0000 Subject: [PATCH] git-svn-id: https://svn.coded.pt/svn/SIPRP@1294 bb69d46d-e84e-40c8-a05a-06db0d633741 --- .../extensions/production/PDFRenderer.jnlp | 25 +++ .../extensions/production/iText-2.0.7.jnlp | 25 +++ .../jnlp/extensions/production/mail.jnlp | 25 +++ .../jnlp/extensions/production/smtp.jnlp | 25 +++ .../jnlp/extensions/test/PDFRenderer.jnlp | 25 +++ .../jnlp/extensions/test/iText-2.0.7.jnlp | 25 +++ .../SIPRPSoft/jnlp/extensions/test/mail.jnlp | 25 +++ .../SIPRPSoft/jnlp/extensions/test/smtp.jnlp | 25 +++ .../SIPRPSoft/jnlp/production/siprpsoft.jnlp | 119 ++++++------ trunk/SIPRPSoft/jnlp/test/siprpsoft.jnlp | 62 ++++++ .../properties/1-development/app.properties | 8 +- .../properties/2-testing/app.properties | 14 +- .../properties/3-production/app.properties | 18 +- trunk/SIPRPSoft/properties/version.properties | 8 +- trunk/SIPRPSoft/src/siprp/data/Marcacao.java | 125 ++++++------ .../SIPRPSoft/src/siprp/ficha/ExamePanel.java | 23 +-- .../src/siprp/ficha/TrabalhadorPanel.java | 23 +-- .../relatorio/GerirMedidasRelatorioPanel.java | 1 + .../higiene/relatorio/PlanoActuacaoPanel.java | 179 +++++++++--------- 19 files changed, 508 insertions(+), 272 deletions(-) create mode 100644 trunk/SIPRPSoft/jnlp/extensions/production/PDFRenderer.jnlp create mode 100644 trunk/SIPRPSoft/jnlp/extensions/production/iText-2.0.7.jnlp create mode 100644 trunk/SIPRPSoft/jnlp/extensions/production/mail.jnlp create mode 100644 trunk/SIPRPSoft/jnlp/extensions/production/smtp.jnlp create mode 100644 trunk/SIPRPSoft/jnlp/extensions/test/PDFRenderer.jnlp create mode 100644 trunk/SIPRPSoft/jnlp/extensions/test/iText-2.0.7.jnlp create mode 100644 trunk/SIPRPSoft/jnlp/extensions/test/mail.jnlp create mode 100644 trunk/SIPRPSoft/jnlp/extensions/test/smtp.jnlp create mode 100644 trunk/SIPRPSoft/jnlp/test/siprpsoft.jnlp diff --git a/trunk/SIPRPSoft/jnlp/extensions/production/PDFRenderer.jnlp b/trunk/SIPRPSoft/jnlp/extensions/production/PDFRenderer.jnlp new file mode 100644 index 00000000..0cb81326 --- /dev/null +++ b/trunk/SIPRPSoft/jnlp/extensions/production/PDFRenderer.jnlp @@ -0,0 +1,25 @@ + + + + SIPRPSoft + Evolute Lda + + Software de Gestão de Higiene e Segurança no Trabalho + SIPRPSoft + + + + + + + + + + + + + + + + + diff --git a/trunk/SIPRPSoft/jnlp/extensions/production/iText-2.0.7.jnlp b/trunk/SIPRPSoft/jnlp/extensions/production/iText-2.0.7.jnlp new file mode 100644 index 00000000..705f35dc --- /dev/null +++ b/trunk/SIPRPSoft/jnlp/extensions/production/iText-2.0.7.jnlp @@ -0,0 +1,25 @@ + + + + SIPRPSoft + Evolute Lda + + Software de Gestão de Higiene e Segurança no Trabalho + SIPRPSoft + + + + + + + + + + + + + + + + + diff --git a/trunk/SIPRPSoft/jnlp/extensions/production/mail.jnlp b/trunk/SIPRPSoft/jnlp/extensions/production/mail.jnlp new file mode 100644 index 00000000..4c5323cb --- /dev/null +++ b/trunk/SIPRPSoft/jnlp/extensions/production/mail.jnlp @@ -0,0 +1,25 @@ + + + + SIPRPSoft + Evolute Lda + + Software de Gestão de Higiene e Segurança no Trabalho + SIPRPSoft + + + + + + + + + + + + + + + + + diff --git a/trunk/SIPRPSoft/jnlp/extensions/production/smtp.jnlp b/trunk/SIPRPSoft/jnlp/extensions/production/smtp.jnlp new file mode 100644 index 00000000..4ad1ac28 --- /dev/null +++ b/trunk/SIPRPSoft/jnlp/extensions/production/smtp.jnlp @@ -0,0 +1,25 @@ + + + + SIPRPSoft + Evolute Lda + + Software de Gestão de Higiene e Segurança no Trabalho + SIPRPSoft + + + + + + + + + + + + + + + + + diff --git a/trunk/SIPRPSoft/jnlp/extensions/test/PDFRenderer.jnlp b/trunk/SIPRPSoft/jnlp/extensions/test/PDFRenderer.jnlp new file mode 100644 index 00000000..d816439d --- /dev/null +++ b/trunk/SIPRPSoft/jnlp/extensions/test/PDFRenderer.jnlp @@ -0,0 +1,25 @@ + + + + SIPRPSoft + Evolute Lda + + Software de Gestão de Higiene e Segurança no Trabalho + SIPRPSoft + + + + + + + + + + + + + + + + + diff --git a/trunk/SIPRPSoft/jnlp/extensions/test/iText-2.0.7.jnlp b/trunk/SIPRPSoft/jnlp/extensions/test/iText-2.0.7.jnlp new file mode 100644 index 00000000..b3cdd3f8 --- /dev/null +++ b/trunk/SIPRPSoft/jnlp/extensions/test/iText-2.0.7.jnlp @@ -0,0 +1,25 @@ + + + + SIPRPSoft + Evolute Lda + + Software de Gestão de Higiene e Segurança no Trabalho + SIPRPSoft + + + + + + + + + + + + + + + + + diff --git a/trunk/SIPRPSoft/jnlp/extensions/test/mail.jnlp b/trunk/SIPRPSoft/jnlp/extensions/test/mail.jnlp new file mode 100644 index 00000000..6264856b --- /dev/null +++ b/trunk/SIPRPSoft/jnlp/extensions/test/mail.jnlp @@ -0,0 +1,25 @@ + + + + SIPRPSoft + Evolute Lda + + Software de Gestão de Higiene e Segurança no Trabalho + SIPRPSoft + + + + + + + + + + + + + + + + + diff --git a/trunk/SIPRPSoft/jnlp/extensions/test/smtp.jnlp b/trunk/SIPRPSoft/jnlp/extensions/test/smtp.jnlp new file mode 100644 index 00000000..79b8a5e6 --- /dev/null +++ b/trunk/SIPRPSoft/jnlp/extensions/test/smtp.jnlp @@ -0,0 +1,25 @@ + + + + SIPRPSoft + Evolute Lda + + Software de Gestão de Higiene e Segurança no Trabalho + SIPRPSoft + + + + + + + + + + + + + + + + + diff --git a/trunk/SIPRPSoft/jnlp/production/siprpsoft.jnlp b/trunk/SIPRPSoft/jnlp/production/siprpsoft.jnlp index 7be4d7e7..88dbb48c 100644 --- a/trunk/SIPRPSoft/jnlp/production/siprpsoft.jnlp +++ b/trunk/SIPRPSoft/jnlp/production/siprpsoft.jnlp @@ -1,57 +1,62 @@ - - - - SIPRP - EVOLUTE 2010 - - SIPRP, v11 - SIPRP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + SIPRPSoft + Evolute Lda + + Software de Gestão de Higiene e Segurança no Trabalho + SIPRPSoft + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/trunk/SIPRPSoft/jnlp/test/siprpsoft.jnlp b/trunk/SIPRPSoft/jnlp/test/siprpsoft.jnlp new file mode 100644 index 00000000..571112a4 --- /dev/null +++ b/trunk/SIPRPSoft/jnlp/test/siprpsoft.jnlp @@ -0,0 +1,62 @@ + + + + SIPRPSoft + Evolute Lda + + Software de Gestão de Higiene e Segurança no Trabalho + SIPRPSoft + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/trunk/SIPRPSoft/properties/1-development/app.properties b/trunk/SIPRPSoft/properties/1-development/app.properties index 2980b7ff..ceb3a618 100644 --- a/trunk/SIPRPSoft/properties/1-development/app.properties +++ b/trunk/SIPRPSoft/properties/1-development/app.properties @@ -1,5 +1,5 @@ #APP level -app.appName = SIPRPSoft +app.appName = siprpsoft app.main-class = siprp.Main app.main = siprp.Main @@ -17,9 +17,9 @@ jnlp.resources.property.server.port = 5432 #app.max.mem=512M #app.run.args=test 1 2 3 -#app.resources.j2se.version = 1.0+ -#app.resources.j2se.initial-heap-size = 4m -#app.resources.j2se.max-heap-size = 8m +app.resources.j2se.max-heap-size=512m +app.resources.j2se.initial-heap-size=256m +app.resources.j2se.version=1.6.0+ #app.ws.dest.package=com.evolute.test-project.stubs #app.ws.wsdl.url=https://www.evolute.pt/test-project/test-endpoint?wsdl diff --git a/trunk/SIPRPSoft/properties/2-testing/app.properties b/trunk/SIPRPSoft/properties/2-testing/app.properties index 2bbd09e8..febf66a2 100644 --- a/trunk/SIPRPSoft/properties/2-testing/app.properties +++ b/trunk/SIPRPSoft/properties/2-testing/app.properties @@ -1,5 +1,5 @@ #APP level -app.appName = SIPRPSoft +app.appName = siprpsoft app.main-class = siprp.Main app.main = siprp.Main @@ -16,9 +16,15 @@ jnlp.resources.property.server.port = 5436 #app.max.mem=512M #app.run.args=test 1 2 3 -#app.resources.j2se.version = 1.0+ -#app.resources.j2se.initial-heap-size = 4m -#app.resources.j2se.max-heap-size = 8m +app.resources.j2se.max-heap-size=512m +app.resources.j2se.initial-heap-size=256m +app.resources.j2se.version=1.6.0+ + +jnlp.information.description.short=SIPRPSoft +jnlp.information.description=Software de Gestão de Higiene e Segurança no Trabalho +jnlp.information.icon=logo/icon.png +jnlp.information.vendor=Evolute Lda +jnlp.information.title=SIPRPSoft #app.ws.dest.package=com.evolute.test-project.stubs #app.ws.wsdl.url=https://www.evolute.pt/test-project/test-endpoint?wsdl diff --git a/trunk/SIPRPSoft/properties/3-production/app.properties b/trunk/SIPRPSoft/properties/3-production/app.properties index d6ef1447..1f91adb7 100644 --- a/trunk/SIPRPSoft/properties/3-production/app.properties +++ b/trunk/SIPRPSoft/properties/3-production/app.properties @@ -1,5 +1,5 @@ #APP level -app.appName = SIPRPSoft +app.appName = siprpsoft app.main-class = siprp.Main app.main = siprp.Main @@ -9,15 +9,21 @@ db.password = Typein db.name = siprp_local db.connection.driver = org.postgresql.Driver -jnlp.resources.property.server.address = 10.158.2.2:5432 -jnlp.resources.property.server.port = 5432 +jnlp.resources.property.server.address=10.158.2.2 +jnlp.resources.property.server.port=5432 #app.max.mem=512M #app.run.args=test 1 2 3 -#app.resources.j2se.version = 1.0+ -#app.resources.j2se.initial-heap-size = 4m -#app.resources.j2se.max-heap-size = 8m +app.resources.j2se.max-heap-size=512m +app.resources.j2se.initial-heap-size=256m +app.resources.j2se.version=1.6.0+ + +jnlp.information.description.short=SIPRPSoft +jnlp.information.description=Software de Gestão de Higiene e Segurança no Trabalho +jnlp.information.icon=logo/icon.png +jnlp.information.vendor=Evolute Lda +jnlp.information.title=SIPRPSoft #app.ws.dest.package=com.evolute.test-project.stubs #app.ws.wsdl.url=https://www.evolute.pt/test-project/test-endpoint?wsdl diff --git a/trunk/SIPRPSoft/properties/version.properties b/trunk/SIPRPSoft/properties/version.properties index eaa19aa8..74d091cc 100644 --- a/trunk/SIPRPSoft/properties/version.properties +++ b/trunk/SIPRPSoft/properties/version.properties @@ -1,6 +1,6 @@ -#SIPRPSoft versioning file -#Fri Jun 25 17:32:18 WEST 2010 +#siprpsoft versioning file +#Wed Jul 14 15:49:54 WEST 2010 major=12 -name=SIPRPSoft +name=siprpsoft minor=0 -build=1 +build=9 diff --git a/trunk/SIPRPSoft/src/siprp/data/Marcacao.java b/trunk/SIPRPSoft/src/siprp/data/Marcacao.java index 950d33eb..1a35345a 100644 --- a/trunk/SIPRPSoft/src/siprp/data/Marcacao.java +++ b/trunk/SIPRPSoft/src/siprp/data/Marcacao.java @@ -10,7 +10,6 @@ import java.text.DateFormat; import java.util.Calendar; import java.util.Date; -import siprp.FichaDataProvider; import siprp.data.outer.AvisosData; import siprp.data.outer.EmpresasData; import siprp.data.outer.EstabelecimentosData; @@ -20,16 +19,13 @@ import siprp.data.outer.MarcacoesTrabalhadorData; import siprp.data.outer.TrabalhadoresData; import siprp.medicina.MedicinaDataProvider; -import com.evolute.entity.ProviderInterface; import com.evolute.entity.evo.EvoDataException; -import com.evolute.utils.Singleton; import com.evolute.utils.tables.ColumnizedObject; /** * * @author fpalma */ -public abstract class Marcacao extends BaseObject - implements ColumnizedObject +public abstract class Marcacao extends BaseObject implements ColumnizedObject //, JDOOperationHandlerInterface { public static final int TIPO_MARCACAO_TRABALHADOR_EXAMES = 0; @@ -51,8 +47,7 @@ public abstract class Marcacao extends BaseObject public static final String ANTECEDENCIA_AVISO = "antecedencia_aviso"; protected static final DateFormat DATE_FORMAT = DateFormat.getDateInstance( DateFormat.SHORT ); - protected static ProviderInterface JDO; - +// protected static ProviderInterface JDO; public static Marcacao getMarcacao( int tipo ) { @@ -122,58 +117,58 @@ public abstract class Marcacao extends BaseObject } } - public static void saveMarcacaoConsultaForTrabalhadorID( Integer trabalhadorID, Date date ) - throws Exception - { - if( date != null ) - { - date = (Date)date.clone(); - } - FichaDataProvider provider = (FichaDataProvider) FichaDataProvider.getProvider(); - if( trabalhadorID == null ) - { - return; - } - Integer marcacaoID = provider.getMarcacaoIDByTrabalhador( trabalhadorID ); - MarcacoesTrabalhadorData marcacao; - if( marcacaoID == null ) - { - marcacao = null; - } - else - { - if( JDO == null ) - { - JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); - } - marcacao = ( MarcacoesTrabalhadorData ) JDO.load( MarcacoesTrabalhadorData.class, marcacaoID ); - } - if( date == null && marcacao != null ) - { - marcacao.delete(); - } - else if( date != null && marcacao != null ) - { - marcacao.set( Marcacao.DATA, date ); - marcacao.save(); - } - else if( date != null && marcacao == null ) - { - marcacao = new MarcacoesTrabalhadorData(); - if( JDO == null ) - { - JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); - } - TrabalhadoresData trab = (TrabalhadoresData)JDO.load( TrabalhadoresData.class, trabalhadorID ); - marcacao.set( MarcacoesTrabalhadorData.TO_TRABALHADOR_ID, trab ); - marcacao.set( MarcacoesTrabalhadorData.TIPO, new Integer( MarcacoesTrabalhadorData.TIPO_CONSULTA ) ); - marcacao.set( Marcacao.DATA, date ); - marcacao.set( Marcacao.REALIZADA, "n" ); - marcacao.set( MarcacoesTrabalhadorData.ESTADO, new Integer( siprp.medicina.MedicinaDataProvider.ESTADO_POR_REALIZAR ) ); - marcacao.set( MarcacoesTrabalhadorData.MOTIVO, new Integer( 2 ) ); - marcacao.save(); - } - } +// public static void saveMarcacaoConsultaForTrabalhadorID( Integer trabalhadorID, Date date ) +// throws Exception +// { +// if( date != null ) +// { +// date = (Date)date.clone(); +// } +// FichaDataProvider provider = (FichaDataProvider) FichaDataProvider.getProvider(); +// if( trabalhadorID == null ) +// { +// return; +// } +// Integer marcacaoID = provider.getMarcacaoIDByTrabalhador( trabalhadorID ); +// MarcacoesTrabalhadorData marcacao; +// if( marcacaoID == null ) +// { +// marcacao = null; +// } +// else +// { +// if( JDO == null ) +// { +// JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); +// } +// marcacao = ( MarcacoesTrabalhadorData ) JDO.load( MarcacoesTrabalhadorData.class, marcacaoID ); +// } +// if( date == null && marcacao != null ) +// { +// marcacao.delete(); +// } +// else if( date != null && marcacao != null ) +// { +// marcacao.set( Marcacao.DATA, date ); +// marcacao.save(); +// } +// else if( date != null && marcacao == null ) +// { +// marcacao = new MarcacoesTrabalhadorData(); +// if( JDO == null ) +// { +// JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); +// } +// TrabalhadoresData trab = (TrabalhadoresData)JDO.load( TrabalhadoresData.class, trabalhadorID ); +// marcacao.set( MarcacoesTrabalhadorData.TO_TRABALHADOR_ID, trab ); +// marcacao.set( MarcacoesTrabalhadorData.TIPO, new Integer( MarcacoesTrabalhadorData.TIPO_CONSULTA ) ); +// marcacao.set( Marcacao.DATA, date ); +// marcacao.set( Marcacao.REALIZADA, "n" ); +// marcacao.set( MarcacoesTrabalhadorData.ESTADO, new Integer( siprp.medicina.MedicinaDataProvider.ESTADO_POR_REALIZAR ) ); +// marcacao.set( MarcacoesTrabalhadorData.MOTIVO, new Integer( 2 ) ); +// marcacao.save(); +// } +// } @Override public void save() throws EvoDataException @@ -200,7 +195,7 @@ public abstract class Marcacao extends BaseObject { if( object instanceof MarcacoesEmpresaData ) { - AvisosData aviso = (AvisosData) JDO.load( AvisosData.class, + AvisosData aviso = getProvider().load( AvisosData.class, new Object[]{ object.get( MarcacoesEmpresaData.ID ), new Integer( AvisosData.TIPO_EMPRESA ) }, new String[]{ AvisosData.EVENTO_ID, AvisosData.TIPO } ); if( aviso == null ) @@ -222,7 +217,7 @@ public abstract class Marcacao extends BaseObject } else if( object instanceof MarcacoesEstabelecimentoData ) { - AvisosData aviso = (AvisosData) JDO.load( AvisosData.class, + AvisosData aviso = getProvider().load( AvisosData.class, new Object[]{ object.get( MarcacoesEstabelecimentoData.ID ), new Integer( AvisosData.TIPO_ESTABELECIMENTO ) }, new String[]{ AvisosData.EVENTO_ID, AvisosData.TIPO } ); if( aviso == null ) @@ -264,7 +259,7 @@ public abstract class Marcacao extends BaseObject } if( object instanceof MarcacoesTrabalhadorData ) { - AvisosData aviso = (AvisosData) JDO.load( AvisosData.class, + AvisosData aviso = getProvider().load( AvisosData.class, new Object[]{ object.get( MarcacoesTrabalhadorData.ID ), new Integer( AvisosData.TIPO_TRABALHADOR ) }, new String[]{ AvisosData.EVENTO_ID, AvisosData.TIPO } ); if( aviso == null ) @@ -280,7 +275,7 @@ public abstract class Marcacao extends BaseObject aviso.setToEmpresa_id( empresa ); aviso.set( AvisosData.EVENTO_ID, object.get( MarcacoesTrabalhadorData.ID ) ); Date dataEvento = (Date) object.get( Marcacao.DATA ); - Date dataAviso = new Date( dataEvento.getTime() ); + Date dataAviso = new Date( dataEvento == null ? System.currentTimeMillis() : dataEvento.getTime() ); Calendar cal = Calendar.getInstance(); cal.setTime( dataAviso ); cal.add( Calendar.DAY_OF_MONTH, -14 ); @@ -327,7 +322,7 @@ public abstract class Marcacao extends BaseObject } result = true; } - catch (Exception e) + catch ( Exception e ) { throw new EvoDataException( e ); } @@ -375,7 +370,7 @@ public abstract class Marcacao extends BaseObject { return false; } - AvisosData aviso = (AvisosData) JDO.load( AvisosData.class, + AvisosData aviso = getProvider().load( AvisosData.class, new Object[]{ object.get( "id" ), tipo }, new String[]{ AvisosData.EVENTO_ID, AvisosData.TIPO } ); if( aviso != null ) diff --git a/trunk/SIPRPSoft/src/siprp/ficha/ExamePanel.java b/trunk/SIPRPSoft/src/siprp/ficha/ExamePanel.java index 0a22afd9..0b2bfe59 100644 --- a/trunk/SIPRPSoft/src/siprp/ficha/ExamePanel.java +++ b/trunk/SIPRPSoft/src/siprp/ficha/ExamePanel.java @@ -427,27 +427,10 @@ public class ExamePanel extends JPanel } recomendacoesText.setText( recomendacoes.trim() ); -// exame = provider.createObject( FichaDataProvider.EXAMES ); exame = new ExamesData(); -// DBField fields[] = FichaDataProvider.EXAMES.getInsertFields(); -// String exameFields[] = new String[ fields.length ]; -// for( int i = 0; i < exameFields.length; ++i ) -// { -// exameFields[ i ] = fields[ i ].FULL_NAME; -// } -// Hashtable hash = new Hashtable(); -// ComponentController.save( exameFields, hash, components ); -// hash.put( FichaDataProvider.T_EXAMES + "." + FichaDataProvider.INACTIVO, "n" ); -// Enumeration enum = hash.keys(); -// while( enum.hasMoreElements() ) -// { -// String name = ( String )enum.nextElement(); -// exame.setProperty( name, hash.get( name ) ); -// } - String names[] = exame.getFieldNames(); - Hashtable hash = new Hashtable(); - ComponentController.save( names, hash, components ); - exame.setHashData( hash ); + + + exame.setHashData( ComponentController.save( components ) ); int tipo = 0; if( admissaoRadio.isSelected() ) diff --git a/trunk/SIPRPSoft/src/siprp/ficha/TrabalhadorPanel.java b/trunk/SIPRPSoft/src/siprp/ficha/TrabalhadorPanel.java index d0f111f3..2abc40d9 100644 --- a/trunk/SIPRPSoft/src/siprp/ficha/TrabalhadorPanel.java +++ b/trunk/SIPRPSoft/src/siprp/ficha/TrabalhadorPanel.java @@ -329,8 +329,8 @@ public class TrabalhadorPanel extends JPanel try { trabalhador = ( TrabalhadoresData ) JDO.load( TrabalhadoresData.class, trabalhadorID ); - String names[] = trabalhador.getFieldNames(); - ComponentController.fill( names, trabalhador.getHashData(), components ); +// String names[] = trabalhador.getFieldNames(); + ComponentController.fill( trabalhador.getHashData(), components ); // trabalhador = provider.load( FichaDataProvider.TRABALHADORES, new DBKey( trabalhadorID ) ); // DBField fields[] = FichaDataProvider.TRABALHADORES.getInsertFields(); // String trabalhadorFields[] = new String[ fields.length ]; @@ -367,24 +367,7 @@ public class TrabalhadorPanel extends JPanel trabalhador = new TrabalhadoresData(); trabalhador.set( TrabalhadoresData.PERFIL, new Integer( 1 ) ); } -// DBField fields[] = FichaDataProvider.TRABALHADORES.getInsertFields(); -// String trabalhadorFields[] = new String[ fields.length ]; -// for( int i = 0; i < trabalhadorFields.length; ++i ) -// { -// trabalhadorFields[ i ] = fields[ i ].FULL_NAME; -// } -// Hashtable hash = new Hashtable(); -// ComponentController.save( trabalhadorFields, hash, components ); -// Enumeration enum = hash.keys(); -// while( enum.hasMoreElements() ) -// { -// String name = ( String )enum.nextElement(); -// trabalhador.setProperty( name, hash.get( name ) ); -// } - String names[] = trabalhador.getFieldNames(); - Map hash = trabalhador.getHashData(); - ComponentController.save( names, hash, components ); - trabalhador.setHashData( hash ); + trabalhador.setHashData( ComponentController.save( components ) ); // if( ((String)trabalhador.getProperty( FichaDataProvider.NOME )).trim().length() == 0 ) if( ((String)trabalhador.get( TrabalhadoresData.NOME )).trim().length() == 0 ) { diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/GerirMedidasRelatorioPanel.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/GerirMedidasRelatorioPanel.java index 3c1439aa..0d70e6b0 100644 --- a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/GerirMedidasRelatorioPanel.java +++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/GerirMedidasRelatorioPanel.java @@ -86,6 +86,7 @@ public class GerirMedidasRelatorioPanel extends JPanel { buttonAdicionar.setEnabled( false ); buttonRemover.setEnabled( false ); + TreeTools.registerTreeKeepExpandState( tree ); tree.setRootVisible( false ); tree.getSelectionModel().setSelectionMode( TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION ); tree.setCellRenderer( new DefaultTreeCellRenderer() diff --git a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/PlanoActuacaoPanel.java b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/PlanoActuacaoPanel.java index c40a16e0..6285b118 100644 --- a/trunk/SIPRPSoft/src/siprp/higiene/relatorio/PlanoActuacaoPanel.java +++ b/trunk/SIPRPSoft/src/siprp/higiene/relatorio/PlanoActuacaoPanel.java @@ -11,16 +11,11 @@ import java.beans.PropertyChangeListener; import javax.swing.BorderFactory; import javax.swing.JPanel; -import siprp.database.cayenne.objects.Estabelecimentos; -import siprp.database.cayenne.objects.HsArea; -import siprp.database.cayenne.objects.HsPosto; -import siprp.database.cayenne.objects.HsPostoEstabelecimento; import siprp.database.cayenne.objects.HsRelatorio; import siprp.database.cayenne.objects.HsRelatorioArea; import siprp.database.cayenne.objects.HsRelatorioPosto; import siprp.database.cayenne.objects.HsRelatorioPostoMedida; import siprp.database.cayenne.objects.HsRelatorioPostoRisco; -import siprp.database.cayenne.objects.MarcacoesEstabelecimento; import siprp.logic.HigieneSegurancaLogic; public class PlanoActuacaoPanel extends JPanel @@ -135,93 +130,93 @@ public class PlanoActuacaoPanel extends JPanel // } ); } - private void refreshAreas() throws Exception - { - if( relatorio != null ) - { - MarcacoesEstabelecimento marcacao = relatorio.getToHsMarcacoesEstabelecimento(); - if( marcacao != null ) - { - Estabelecimentos estabelecimento = marcacao.getToEstabelecimentos(); - if( estabelecimento != null ) - { - for( HsPostoEstabelecimento postoEstabelecimento : estabelecimento.getHsPostoEstabelecimentoArray() ) - { - refreshPostoEstabelecimento( postoEstabelecimento ); - } - areas.refresh(); - } - } - } - } - - private void refreshPostoEstabelecimento( HsPostoEstabelecimento postoEstabelecimento ) throws Exception - { - if( postoEstabelecimento != null ) - { - HsPosto posto = postoEstabelecimento.getToHsPosto(); - if( posto != null ) - { - HsArea area = posto.getToHsArea(); - HsRelatorioArea relatorioArea = null; - if( area != null ) - { - relatorioArea = getAreaInRelatorio( relatorio, area.getId() ); - if( relatorioArea == null ) - { - relatorioArea = new HsRelatorioArea(); - } - HigieneSegurancaLogic.updateRelatorioAreaFromHsArea( relatorio, relatorioArea, area ); - } - HsRelatorioPosto relatorioPosto = getPostoInRelatorio( relatorio, posto.getId() ); - if( relatorioPosto == null ) - { - relatorioPosto = HigieneSegurancaLogic.createRelatorioPostoFromHsPosto( relatorio , relatorioArea, posto ); - } - else - { - HigieneSegurancaLogic.updateRelatorioPostoFromHsPosto( relatorioPosto, relatorioArea, posto ); - } - } - } - } - - private HsRelatorioArea getAreaInRelatorio( HsRelatorio relatorio, Integer softRefId ) - { - HsRelatorioArea result = null; - if( relatorio != null && softRefId != null ) - { - for( HsRelatorioArea relatArea : relatorio.getHsRelatorioArea() ) - { - if( softRefId.equals( relatArea.getHsAreaId() ) ) - { - result = relatArea; - break; - } - } - } - return result; - } - - private HsRelatorioPosto getPostoInRelatorio( HsRelatorio relatorio, Integer softRefId ) - { - HsRelatorioPosto result = null; - if( relatorio != null && softRefId != null ) - { - for( HsRelatorioArea relatArea : relatorio.getHsRelatorioArea() ) - { - for( HsRelatorioPosto relatPosto : relatArea.getHsRelatorioPostoArray() ) - { - if( softRefId.equals( relatPosto.getHsPostoId() ) ) - { - result = relatPosto; - break; - } - } - } - } - return result; - } +// private void refreshAreas() throws Exception +// { +// if( relatorio != null ) +// { +// MarcacoesEstabelecimento marcacao = relatorio.getToHsMarcacoesEstabelecimento(); +// if( marcacao != null ) +// { +// Estabelecimentos estabelecimento = marcacao.getToEstabelecimentos(); +// if( estabelecimento != null ) +// { +// for( HsPostoEstabelecimento postoEstabelecimento : estabelecimento.getHsPostoEstabelecimentoArray() ) +// { +// refreshPostoEstabelecimento( postoEstabelecimento ); +// } +// areas.refresh(); +// } +// } +// } +// } +// +// private void refreshPostoEstabelecimento( HsPostoEstabelecimento postoEstabelecimento ) throws Exception +// { +// if( postoEstabelecimento != null ) +// { +// HsPosto posto = postoEstabelecimento.getToHsPosto(); +// if( posto != null ) +// { +// HsArea area = posto.getToHsArea(); +// HsRelatorioArea relatorioArea = null; +// if( area != null ) +// { +// relatorioArea = getAreaInRelatorio( relatorio, area.getId() ); +// if( relatorioArea == null ) +// { +// relatorioArea = new HsRelatorioArea(); +// } +// HigieneSegurancaLogic.updateRelatorioAreaFromHsArea( relatorio, relatorioArea, area ); +// } +// HsRelatorioPosto relatorioPosto = getPostoInRelatorio( relatorio, posto.getId() ); +// if( relatorioPosto == null ) +// { +// relatorioPosto = HigieneSegurancaLogic.createRelatorioPostoFromHsPosto( relatorio , relatorioArea, posto ); +// } +// else +// { +// HigieneSegurancaLogic.updateRelatorioPostoFromHsPosto( relatorioPosto, relatorioArea, posto ); +// } +// } +// } +// } +// +// private HsRelatorioArea getAreaInRelatorio( HsRelatorio relatorio, Integer softRefId ) +// { +// HsRelatorioArea result = null; +// if( relatorio != null && softRefId != null ) +// { +// for( HsRelatorioArea relatArea : relatorio.getHsRelatorioArea() ) +// { +// if( softRefId.equals( relatArea.getHsAreaId() ) ) +// { +// result = relatArea; +// break; +// } +// } +// } +// return result; +// } +// +// private HsRelatorioPosto getPostoInRelatorio( HsRelatorio relatorio, Integer softRefId ) +// { +// HsRelatorioPosto result = null; +// if( relatorio != null && softRefId != null ) +// { +// for( HsRelatorioArea relatArea : relatorio.getHsRelatorioArea() ) +// { +// for( HsRelatorioPosto relatPosto : relatArea.getHsRelatorioPostoArray() ) +// { +// if( softRefId.equals( relatPosto.getHsPostoId() ) ) +// { +// result = relatPosto; +// break; +// } +// } +// } +// } +// return result; +// } private void startupComponents() {