diff --git a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/ViewAnaliseAcidenteTrabalho.java b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/ViewAnaliseAcidenteTrabalho.java index 69a9fcf3..343a54ba 100644 --- a/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/ViewAnaliseAcidenteTrabalho.java +++ b/trunk/AnaliseAcidentesTrabalho/src/java/analiseacidentestrabalho/ViewAnaliseAcidenteTrabalho.java @@ -3342,87 +3342,90 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { } } - private void fillMedidasRh(AnaliseAcidente a) + private void fillMedidasRh( AnaliseAcidente a ) { try { AnalisesDataProvider adp = AnalisesDataProvider.getInstance(); - ArrayList list = adp.getMedidasByAnalise(a.getId()); + ArrayList list = adp.getMedidasByAnalise( a.getId() ); ListIterator iter = list.listIterator(); int seq = 1; - while(iter.hasNext()) + while ( iter.hasNext() ) { - Medida m = (Medida) iter.next(); + Medida m = ( Medida ) iter.next(); HtmlPanelGrid grd = new HtmlPanelGrid(); - grd.setId("grdMedidaView" + seq); - grd.setColumns(2); - grd.setColumnClasses("gridColLeft5, gridColLeft95"); - grd.setStyle("width: 100%"); + grd.setId( "grdMedidaView" + seq ); + grd.setColumns( 2 ); + grd.setColumnClasses( "gridColLeft5, gridColLeft95" ); + grd.setStyle( "width: 100%" ); StaticText st = new StaticText(); - st.setId("stNrMedidaView" + seq); - st.setText(seq + " ."); - st.setStyle("width: 24px"); - grd.getChildren().add(st); + st.setId( "stNrMedidaView" + seq ); + st.setText( seq + " ." ); + st.setStyle( "width: 24px" ); + grd.getChildren().add( st ); st = new StaticText(); - st.setId("stMedidaView" + seq); - st.setText(m.getMedida()); + st.setId( "stMedidaView" + seq ); + st.setText( m.getMedida() ); //st.setStyle("width: 24px"); - grd.getChildren().add(st); + grd.getChildren().add( st ); - gridMedidasView.getChildren().add(grd); + gridMedidasView.getChildren().add( grd ); seq++; } } - catch(Exception ex) + catch ( Exception ex ) { ErrorLogger.logException( ex ); } } - private void fillMedico(AnaliseAcidente a) + private void fillMedico( AnaliseAcidente a ) { - PanelGroup pg = null; StaticText st = null; HtmlPanelGrid grd = null; - ImageComponent img = null; + ImageComponent img = null; //LESAO : - if(a.getLesao_cabeca().matches("y")) +// if ( a.getLesao_cabeca().matches( "y" ) ) + if ( "y".equals( a.getLesao_cabeca() ) ) { st = new StaticText(); - st.setId("stLesaoCabeca"); - st.setEscape(false); - st.setText("Cabeça"); - gridLesao.getChildren().add(st); + st.setId( "stLesaoCabeca" ); + st.setEscape( false ); + st.setText( "Cabeça" ); + gridLesao.getChildren().add( st ); } - if(a.getLesao_pescoco().matches("y")) +// if(a.getLesao_pescoco().matches("y")) + if ( "y".equals( a.getLesao_pescoco() ) ) { st = new StaticText(); - st.setId("stLesaoPescoco"); - st.setEscape(false); - st.setText("Pescoço"); - gridLesao.getChildren().add(st); + st.setId( "stLesaoPescoco" ); + st.setEscape( false ); + st.setText( "Pescoço" ); + gridLesao.getChildren().add( st ); } - if(a.getLesao_tronco().matches("y")) +// if ( a.getLesao_tronco().matches( "y" ) ) + if ( "y".equals( a.getLesao_tronco() ) ) { st = new StaticText(); - st.setId("stLesaoTronco"); - st.setEscape(false); - st.setText("Tronco"); - gridLesao.getChildren().add(st); + st.setId( "stLesaoTronco" ); + st.setEscape( false ); + st.setText( "Tronco" ); + gridLesao.getChildren().add( st ); } grd = new HtmlPanelGrid(); grd.setId("gridLesaoMembros"); grd.setColumns(2); grd.setColumnClasses("gridColLeft"); - if(a.getLesao_membro_sup_dir().matches("y")) +// if(a.getLesao_membro_sup_dir().matches("y")) + if ( "y".equals( a.getLesao_membro_sup_dir() ) ) { st = new StaticText(); st.setId("stLesaoMembroSupDir"); @@ -3442,7 +3445,8 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { } } - if(a.getLesao_membro_sup_esq().matches("y")) +// if(a.getLesao_membro_sup_esq().matches("y")) + if ( "y".equals( a.getLesao_membro_sup_esq() ) ) { st = new StaticText(); st.setId("stLesaoMembroSupEsq"); @@ -3462,72 +3466,70 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { } } - if(a.getLesao_membro_inf_dir().matches("y")) +// if ( a.getLesao_membro_inf_dir().matches( "y" ) ) + if ( "y".equals( a.getLesao_membro_inf_dir() ) ) { st = new StaticText(); - st.setId("stLesaoMembroInfDir"); - st.setEscape(false); - st.setText("Membro Inferior Direito"); - grd.getChildren().add(st); - if(a.getEspecif3() != null) - { - if(a.getEspecif3().trim().length() > 0) - { - st = new StaticText(); - st.setId("stEspecif3"); - st.setEscape(false); - st.setText(a.getEspecif3()); - grd.getChildren().add(st); - } - } - - } + st.setId( "stLesaoMembroInfDir" ); + st.setEscape( false ); + st.setText( "Membro Inferior Direito" ); + grd.getChildren().add( st ); + if ( a.getEspecif3() != null && a.getEspecif3().trim().length() > 0 ) + { + st = new StaticText(); + st.setId("stEspecif3"); + st.setEscape(false); + st.setText(a.getEspecif3()); + grd.getChildren().add(st); + } + } - if(a.getLesao_membro_inf_esq().matches("y")) +// if ( a.getLesao_membro_inf_esq().matches( "y" ) ) + if ( "y".equals( a.getLesao_membro_inf_esq() ) ) { st = new StaticText(); - st.setId("stLesaoMembroInfEsq"); - st.setEscape(false); - st.setText("Membro Inferior Esquerdo"); - grd.getChildren().add(st); - if(a.getEspecif4() != null) + st.setId( "stLesaoMembroInfEsq" ); + st.setEscape( false ); + st.setText( "Membro Inferior Esquerdo" ); + grd.getChildren().add( st ); + if ( a.getEspecif4() != null ) { - if(a.getEspecif4().trim().length() > 0) + if ( a.getEspecif4().trim().length() > 0 ) { st = new StaticText(); - st.setId("stEspecif4"); - st.setEscape(false); - st.setText(a.getEspecif4()); - grd.getChildren().add(st); + st.setId( "stEspecif4" ); + st.setEscape( false ); + st.setText( a.getEspecif4() ); + grd.getChildren().add( st ); } } - } - if(grd.getChildren().size() > 0) + } + if ( grd.getChildren().size() > 0 ) { - gridLesao.getChildren().add(grd); + gridLesao.getChildren().add( grd ); } - if(a.getTipo_lesao().trim().length() > 0 ) + if ( a.getTipo_lesao() != null && a.getTipo_lesao().trim().length() > 0 ) { pg = new PanelGroup(); - pg.setId("pgTipoLesao"); + pg.setId( "pgTipoLesao" ); st = new StaticText(); - st.setId("stTipoLesaoLbl"); - st.setEscape(false); - st.setText("Tipo de lesão:   "); - pg.getChildren().add(st); + st.setId( "stTipoLesaoLbl" ); + st.setEscape( false ); + st.setText( "Tipo de lesão:   " ); + pg.getChildren().add( st ); st = new StaticText(); - st.setId("stTipoLesao"); - st.setEscape(false); - st.setText(a.getTipo_lesao()); - pg.getChildren().add(st); - gridLesao.getChildren().add(pg); + st.setId( "stTipoLesao" ); + st.setEscape( false ); + st.setText( a.getTipo_lesao() ); + pg.getChildren().add( st ); + gridLesao.getChildren().add( pg ); } - System.out.println("GRID LESAO : " + gridLesao.getChildren().size()); - if(gridLesao.getChildren().size() == 0) + System.out.println( "GRID LESAO : " + gridLesao.getChildren().size() ); + if ( gridLesao.getChildren().size() == 0 ) { - lblAreasCorporais.setRendered(false); + lblAreasCorporais.setRendered( false ); } //INCAPACIDADE : @@ -3538,7 +3540,9 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { st.setEscape(false); st.setStyle("font-weight: bold"); st.setText("Tipo de incapacidade:  "); - if(a.getTipo_incapacidade().matches("t")) + +// if ( a.getTipo_incapacidade().matches( "t" ) ) + if ( "t".equals( a.getTipo_incapacidade() ) ) { pg.getChildren().add(st); st = new StaticText(); @@ -3555,64 +3559,63 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { st = new StaticText(); st.setId("stCoefIncapacidade"); st.setEscape(false); - st.setText(a.getCoef_incapacidade().toString() + "%"); + st.setText( a.getCoef_incapacidade() == null ? "" : a.getCoef_incapacidade().toString() + "%" ); pg.getChildren().add(st); } - else if(a.getTipo_incapacidade().matches("p")) +// else if(a.getTipo_incapacidade().matches("p")) + else if ( "p".equals( a.getTipo_incapacidade() ) ) { - pg.getChildren().add(st); + pg.getChildren().add( st ); st = new StaticText(); st.setId("stTipoIncapacidade"); - st.setEscape(false); - st.setText("Permanente  "); - pg.getChildren().add(st); + st.setEscape( false ); + st.setText("Permanente  "); + pg.getChildren().add( st ); st = new StaticText(); st.setId("stTipoIncapacidadeLbl2"); - st.setStyle("font-weight: bold"); - st.setEscape(false); - st.setText("   Coeficiente de incapacidade:  "); - pg.getChildren().add(st); + st.setStyle("font-weight: bold"); + st.setEscape( false ); + st.setText("   Coeficiente de incapacidade:  "); + pg.getChildren().add( st ); st = new StaticText(); st.setId("stCoefIncapacidade"); - st.setEscape(false); - st.setText(a.getCoef_incapacidade().toString() + "%"); - pg.getChildren().add(st); + st.setEscape( false ); + st.setText( a.getCoef_incapacidade() == null ? "" : a.getCoef_incapacidade().toString() + "%" ); + pg.getChildren().add( st ); } - if(pg.getChildren().size() > 0) + if ( pg.getChildren().size() > 0 ) { - gridIncapacidade.getChildren().add(pg); - + gridIncapacidade.getChildren().add( pg ); } pg = new PanelGroup(); - pg.setId("pgAvaliacaoIncapacidade"); - if(a.getData_aval_incapacidade() != null) + pg.setId("pgAvaliacaoIncapacidade"); + if ( a.getData_aval_incapacidade() != null ) { st = new StaticText(); st.setId("stDataAvalIncapacidadeLbl1"); - st.setStyle("font-weight: bold"); + st.setStyle("font-weight: bold"); st.setEscape(false); - st.setText("Avaliação de incapacidade realizada em  "); - pg.getChildren().add(st); + st.setText("Avaliação de incapacidade realizada em  "); + pg.getChildren().add(st); st = new StaticText(); st.setId("stDataAvalIncapacidade"); st.setEscape(false); - //st.setText(a.getData_aval_incapacidade()); try { java.util.Date ddate = new java.util.Date(a.getData_aval_incapacidade().getTime()); st.setText(utils.Utils.dateToYYYYMMDD(ddate)); } - catch(Exception ex) + catch ( Exception ex ) { // ErrorLogger.logException( ex ); } - pg.getChildren().add(st); + pg.getChildren().add( st ); } - if(a.getData_rev_incapacidade() != null) + if ( a.getData_rev_incapacidade() != null ) { st = new StaticText(); st.setId("stDataRevIncapacidadeLbl1"); @@ -3623,17 +3626,16 @@ public class ViewAnaliseAcidenteTrabalho extends AbstractPageBean { st = new StaticText(); st.setId("stDataRevIncapacidade"); st.setEscape(false); - //st.setText(a.getData_rev_incapacidade()); try { java.util.Date ddate = new java.util.Date(a.getData_rev_incapacidade().getTime()); st.setText(utils.Utils.dateToYYYYMMDD(ddate)); } - catch(Exception ex) + catch ( Exception ex ) { // ErrorLogger.logException( ex ); } - pg.getChildren().add(st); + pg.getChildren().add( st ); } if(pg.getChildren().size() > 0)