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.
1022 lines
38 KiB
1022 lines
38 KiB
/*
|
|
* ViewPlano.java
|
|
*
|
|
* Created on Oct 20, 2008, 10:39:31 AM
|
|
*/
|
|
package planosactuacao;
|
|
|
|
import com.evolute.utils.error.ErrorLogger;
|
|
import com.sun.rave.web.ui.appbase.AbstractPageBean;
|
|
import com.sun.webui.jsf.component.Button;
|
|
import com.sun.webui.jsf.component.PageSeparator;
|
|
import com.sun.webui.jsf.component.PanelGroup;
|
|
import com.sun.webui.jsf.component.StaticText;
|
|
import com.sun.webui.jsf.component.Table;
|
|
import com.sun.webui.jsf.component.TableRowGroup;
|
|
import db.entidades.Area;
|
|
import db.entidades.LinhaEstatistica;
|
|
import db.entidades.Medida;
|
|
import db.entidades.PlanoActuacao;
|
|
import db.entidades.PostoTrabalho;
|
|
import db.entidades.Risco;
|
|
import db.providers.PlanosDataProvider;
|
|
import db.providers.RiscoLogic;
|
|
import db.providers.UtilizadoresLogic;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.Comparator;
|
|
import java.util.List;
|
|
import javax.faces.FacesException;
|
|
import javax.faces.component.html.HtmlPanelGrid;
|
|
import utils.Global;
|
|
|
|
/**
|
|
* <p>Page bean that corresponds to a similarly named JSP page. This
|
|
* class contains component definitions (and initialization code) for
|
|
* all components that you have defined on this page, as well as
|
|
* lifecycle methods and event handlers where you may add behavior
|
|
* to respond to incoming events.</p>
|
|
*
|
|
* @author lluis
|
|
*/
|
|
public class ViewPlano extends AbstractPageBean {
|
|
// <editor-fold defaultstate="collapsed" desc="Managed Component Definition">
|
|
|
|
private Table tableEstatistica = new Table();
|
|
private TableRowGroup tableRowGroupEstatisticas = new TableRowGroup();
|
|
protected boolean concluido = true;
|
|
|
|
/**
|
|
* <p>Automatically managed component initialization. <strong>WARNING:</strong>
|
|
* This method is automatically generated, so any user-specified code inserted
|
|
* here is subject to being replaced.</p>
|
|
*/
|
|
private void _init() throws Exception {
|
|
}
|
|
|
|
public Table getTableEstatistica()
|
|
{
|
|
return tableEstatistica;
|
|
}
|
|
|
|
public void setTableEstatistica( Table tableEstatistica )
|
|
{
|
|
this.tableEstatistica = tableEstatistica;
|
|
}
|
|
|
|
public TableRowGroup getTableRowGroupEstatisticas()
|
|
{
|
|
return tableRowGroupEstatisticas;
|
|
}
|
|
|
|
public void setTableRowGroupEstatisticas( TableRowGroup tableRowGroupEstatisticas )
|
|
{
|
|
this.tableRowGroupEstatisticas = tableRowGroupEstatisticas;
|
|
}
|
|
|
|
private Button butVoltar = new Button();
|
|
|
|
public Button getButVoltar() {
|
|
return butVoltar;
|
|
}
|
|
|
|
public void setButVoltar(Button b) {
|
|
this.butVoltar = b;
|
|
}
|
|
private HtmlPanelGrid gridLayout = new HtmlPanelGrid();
|
|
|
|
public HtmlPanelGrid getGridLayout() {
|
|
return gridLayout;
|
|
}
|
|
|
|
public void setGridLayout(HtmlPanelGrid hpg) {
|
|
this.gridLayout = hpg;
|
|
}
|
|
// </editor-fold>
|
|
HtmlPanelGrid gridPlano;
|
|
HtmlPanelGrid gridArea;
|
|
HtmlPanelGrid gridAreaContainer;
|
|
HtmlPanelGrid gridRisco;
|
|
HtmlPanelGrid gridValor;
|
|
HtmlPanelGrid gridMedida;
|
|
HtmlPanelGrid gridPosto;
|
|
HtmlPanelGrid gridResponsavel;
|
|
PanelGroup pg;
|
|
StaticText st;
|
|
|
|
|
|
|
|
/**
|
|
* <p>Construct a new Page bean instance.</p>
|
|
*/
|
|
public ViewPlano() {
|
|
}
|
|
|
|
/**
|
|
* <p>Callback method that is called whenever a page is navigated to,
|
|
* either directly via a URL, or indirectly via page navigation.
|
|
* Customize this method to acquire resources that will be needed
|
|
* for event handlers and lifecycle methods, whether or not this
|
|
* page is performing post back processing.</p>
|
|
*
|
|
* <p>Note that, if the current request is a postback, the property
|
|
* values of the components do <strong>not</strong> represent any
|
|
* values submitted with this request. Instead, they represent the
|
|
* property values that were saved for this view when it was rendered.</p>
|
|
*/
|
|
@Override
|
|
public void init() {
|
|
// Perform initializations inherited from our superclass
|
|
super.init();
|
|
// Perform application initialization that must complete
|
|
// *before* managed components are initialized
|
|
// TODO - add your own initialiation code here
|
|
|
|
// <editor-fold defaultstate="collapsed" desc="Managed Component Initialization">
|
|
// Initialize automatically managed components
|
|
// *Note* - this logic should NOT be modified
|
|
try {
|
|
_init();
|
|
} catch (Exception e) {
|
|
ErrorLogger.logException(e);
|
|
log("ViewPlano Initialization Failure", e);
|
|
throw e instanceof FacesException ? (FacesException) e : new FacesException(e);
|
|
}
|
|
|
|
// </editor-fold>
|
|
// Perform application initialization that must complete
|
|
// *after* managed components are initialized
|
|
// TODO - add your own initialization code here
|
|
}
|
|
|
|
/**
|
|
* <p>Callback method that is called after the component tree has been
|
|
* restored, but before any event processing takes place. This method
|
|
* will <strong>only</strong> be called on a postback request that
|
|
* is processing a form submit. Customize this method to allocate
|
|
* resources that will be required in your event handlers.</p>
|
|
*/
|
|
@Override
|
|
public void preprocess() {
|
|
}
|
|
|
|
/**
|
|
* <p>Callback method that is called just before rendering takes place.
|
|
* This method will <strong>only</strong> be called for the page that
|
|
* will actually be rendered (and not, for example, on a page that
|
|
* handled a postback and then navigated to a different page). Customize
|
|
* this method to allocate resources that will be required for rendering
|
|
* this page.</p>
|
|
*/
|
|
@Override
|
|
public void prerender() {
|
|
PlanoActuacao p = getSessionBean1().getPlanoActuacao();
|
|
showPlano(p);
|
|
}
|
|
|
|
/**
|
|
* <p>Callback method that is called after rendering is completed for
|
|
* this request, if <code>init()</code> was called (regardless of whether
|
|
* or not this was the page that was actually rendered). Customize this
|
|
* method to release resources acquired in the <code>init()</code>,
|
|
* <code>preprocess()</code>, or <code>prerender()</code> methods (or
|
|
* acquired during execution of an event handler).</p>
|
|
*/
|
|
@Override
|
|
public void destroy() {
|
|
}
|
|
|
|
/**
|
|
* <p>Return a reference to the scoped data bean.</p>
|
|
*
|
|
* @return reference to the scoped data bean
|
|
*/
|
|
protected SessionBean1 getSessionBean1() {
|
|
return (SessionBean1) getBean("SessionBean1");
|
|
}
|
|
|
|
/**
|
|
* <p>Return a reference to the scoped data bean.</p>
|
|
*
|
|
* @return reference to the scoped data bean
|
|
*/
|
|
protected ApplicationBean1 getApplicationBean1() {
|
|
return (ApplicationBean1) getBean("ApplicationBean1");
|
|
}
|
|
|
|
/**
|
|
* <p>Return a reference to the scoped data bean.</p>
|
|
*
|
|
* @return reference to the scoped data bean
|
|
*/
|
|
protected RequestBean1 getRequestBean1() {
|
|
return (RequestBean1) getBean("RequestBean1");
|
|
}
|
|
|
|
private void showPlano(PlanoActuacao p) {
|
|
System.out.println("\nViewPlano . showPlano( " + p.getId() + " ) : \n");
|
|
|
|
gridPlano = new HtmlPanelGrid();
|
|
gridPlano.setId("gridPlano");
|
|
gridPlano.setWidth("100%");
|
|
gridPlano.setColumns(1);
|
|
gridPlano.setStyle("background-color: #f6f4e8; border: solid 1px #000000");
|
|
gridPlano.setColumnClasses("gridColCenter");
|
|
//lblTop.setText("Plano de actuação da auditoria " + p.getData_visita_str());
|
|
|
|
if (p.getConcluidoPorDesactivacao()) {
|
|
StaticText st = new StaticText();
|
|
st.setText("N\u00E3o realizado por falta de cumprimento do prazo.");
|
|
st.setStyle("color: #FF0000; font-weight: bold; font-size: 13px;");
|
|
gridPlano.getChildren().add(st);
|
|
}
|
|
concluido = p.getFase() != null && p.getFase().intValue() == Global.FASE_CONCLUIDO && !p.getConcluidoPorDesactivacao();
|
|
gridLayout.getChildren().add(gridPlano);
|
|
showAreas(p.getAreas());
|
|
showValidacoes(gridPlano, p);
|
|
List<LinhaEstatistica> linhasEstatistica = null;
|
|
try
|
|
{
|
|
linhasEstatistica = PlanosDataProvider.getInstance().getEstatisticaForPlanoId( p.getId() );
|
|
}
|
|
catch( Exception ex )
|
|
{
|
|
ex.printStackTrace();
|
|
linhasEstatistica = new ArrayList<LinhaEstatistica>();
|
|
}
|
|
getSessionBean1().getEstatisticaPlanoDataProvider().setList( linhasEstatistica );
|
|
}
|
|
|
|
private void showAreas(List<Area> areas) {
|
|
int i = 0;
|
|
for (Area area : areas) {
|
|
i++;
|
|
gridArea = new HtmlPanelGrid();
|
|
gridArea.setColumns(1);
|
|
gridArea.setColumnClasses("gridColCenter");
|
|
gridArea.setWidth("100%");
|
|
|
|
gridPlano.getChildren().add(gridArea);
|
|
|
|
pg = new PanelGroup();
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setStyleClass("label");
|
|
st.setText("Área: ");
|
|
pg.getChildren().add(st);
|
|
st = new StaticText();
|
|
st.setId("fakeLink" + i);
|
|
st.setStyleClass("fakeLink");
|
|
st.setOnMouseOver("this.style.textDecoration = 'underline'");
|
|
st.setOnMouseOut("this.style.textDecoration = 'none'");
|
|
st.setOnClick("expand(this)");
|
|
st.setEscape(false);
|
|
st.setText( area.getDescricao() );
|
|
pg.getChildren().add(st);
|
|
|
|
gridArea.getChildren().add(pg);
|
|
|
|
gridAreaContainer = new HtmlPanelGrid();
|
|
gridAreaContainer.setId("area_container" + i);
|
|
////gridAreaContainer.setStyle("border: solid 1px #000000; width: 100%;");
|
|
gridAreaContainer.setStyleClass("hidden");
|
|
//gridAreaContainer.setStyleClass("visible");
|
|
gridAreaContainer.setColumns(1);
|
|
gridAreaContainer.setColumnClasses("gridColLeft");
|
|
gridAreaContainer.setWidth("100%");
|
|
|
|
gridArea.getChildren().add(gridAreaContainer);
|
|
showRiscos(area.getRiscos());
|
|
}
|
|
}
|
|
|
|
private void showRiscos(List<Risco> riscos) {
|
|
int rCount = 0;
|
|
Collections.sort(riscos, new Comparator<Risco>() {
|
|
|
|
@Override
|
|
public int compare(Risco o1, Risco o2) {
|
|
// false first, true after
|
|
return o1.getIsPatrimonial().compareTo(o2.getIsPatrimonial());
|
|
}
|
|
});
|
|
|
|
for (Risco risco : riscos) {
|
|
boolean isPatrimonial = risco.getIsPatrimonial();
|
|
String riscoTitle = "Risco" + (isPatrimonial ? " Patrimonial" : "") + ": ";
|
|
|
|
HtmlPanelGrid grd = new HtmlPanelGrid();
|
|
grd.setColumns(1);
|
|
grd.setColumnClasses("gridColLeft");
|
|
//grd.setStyle("border: solid 1px #0000FF; display: inline; width: 100%");
|
|
grd.setStyle("display: block; width: 100%");
|
|
grd.setWidth("100%");
|
|
//grd.setStyleClass("centerBlock");
|
|
//gridArea.getChildren().add(grd);
|
|
gridAreaContainer.getChildren().add(grd);
|
|
|
|
gridRisco = new HtmlPanelGrid();
|
|
//gridRisco.setStyleClass("centerBlock");
|
|
gridRisco.setStyle("display: block; width: 98%");
|
|
gridRisco.setWidth("98%");
|
|
gridRisco.setColumns(1);
|
|
gridRisco.setColumnClasses("gridColLeft");
|
|
grd.getChildren().add(gridRisco);
|
|
|
|
|
|
pg = new PanelGroup();
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setStyleClass("label");
|
|
st.setText(riscoTitle);
|
|
pg.getChildren().add(st);
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setText( risco.getDescricao() );
|
|
pg.getChildren().add(st);
|
|
gridRisco.getChildren().add(pg);
|
|
//showValores(risco.getValores());
|
|
showValor(risco);
|
|
//showMedidas(risco.getMedidas());
|
|
|
|
if (rCount < riscos.size() - 1) {
|
|
showSeparator();
|
|
}
|
|
|
|
rCount++;
|
|
}
|
|
}
|
|
|
|
private void showValor(Risco r) {
|
|
HtmlPanelGrid grd = new HtmlPanelGrid();
|
|
grd.setColumns(1);
|
|
grd.setWidth("100%");
|
|
grd.setStyleClass("centerBlock");
|
|
grd.setStyle("display: block");
|
|
//gridRisco.getChildren().add(grd);
|
|
|
|
gridValor = new HtmlPanelGrid();
|
|
gridRisco.getChildren().add(gridValor);
|
|
//gridValor.setStyleClass("centerBlock");
|
|
gridValor.setStyle("display: block");
|
|
gridValor.setWidth("100%");
|
|
gridValor.setColumns(1);
|
|
gridValor.setColumnClasses("gridColLeft");
|
|
//grd.getChildren().add(gridValor);
|
|
pg = new PanelGroup();
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setStyleClass("label");
|
|
st.setText("Valor: ");
|
|
pg.getChildren().add(st);
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setText(RiscoLogic.getInstance().getValor(r));
|
|
|
|
pg.getChildren().add(st);
|
|
gridValor.getChildren().add(pg);
|
|
|
|
showMedidas(r.getMedidas());
|
|
|
|
grd = new HtmlPanelGrid();
|
|
grd.setColumns(1);
|
|
grd.setWidth("100%");
|
|
//grd.setStyleClass("centerBlock");
|
|
gridValor.getChildren().add(grd);
|
|
HtmlPanelGrid gridParecer = new HtmlPanelGrid();
|
|
gridParecer.setStyleClass("centerBlock");
|
|
gridParecer.setStyle("display: block");
|
|
gridParecer.setWidth("98%");
|
|
gridParecer.setColumns(1);
|
|
gridParecer.setColumnClasses("gridColLeft");
|
|
grd.getChildren().add(gridParecer);
|
|
|
|
if (r.getResponsavel_execucao() != null) {
|
|
if (r.getResponsavel_execucao().trim().length() > 0) {
|
|
pg = new PanelGroup();
|
|
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setStyleClass("label");
|
|
st.setText("Responsável de execução: ");
|
|
pg.getChildren().add(st);
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setText(r.getResponsavel_execucao().toString());
|
|
pg.getChildren().add(st);
|
|
|
|
if (r.getPor() != null) {
|
|
if (r.getPor().trim().length() > 0) {
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setText(" ");
|
|
pg.getChildren().add(st);
|
|
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setStyleClass("label");
|
|
st.setText("POR: ");
|
|
pg.getChildren().add(st);
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setText(r.getPor().toString());
|
|
pg.getChildren().add(st);
|
|
}
|
|
}
|
|
|
|
gridParecer.getChildren().add(pg);
|
|
}
|
|
}
|
|
|
|
if (r.getRecursos_necessarios() != null) {
|
|
if (r.getRecursos_necessarios().trim().length() > 0) {
|
|
pg = new PanelGroup();
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setStyleClass("label");
|
|
st.setText("Recursos necessários: ");
|
|
pg.getChildren().add(st);
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setText(r.getRecursos_necessarios().toString());
|
|
pg.getChildren().add(st);
|
|
gridParecer.getChildren().add(pg);
|
|
}
|
|
}
|
|
|
|
if (r.getData_inicio() != null) {
|
|
pg = new PanelGroup();
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setStyleClass("label");
|
|
st.setText("Data início: ");
|
|
pg.getChildren().add(st);
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
String data_str = "";
|
|
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
|
|
data_str = formatter.format(r.getData_inicio());
|
|
st.setText(data_str);
|
|
pg.getChildren().add(st);
|
|
gridParecer.getChildren().add(pg);
|
|
}
|
|
|
|
if (r.getData_fim() != null) {
|
|
pg = new PanelGroup();
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setStyleClass("label");
|
|
st.setText("Data fim: ");
|
|
pg.getChildren().add(st);
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
String data_str = "";
|
|
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
|
|
data_str = formatter.format(r.getData_fim());
|
|
st.setText(data_str);
|
|
pg.getChildren().add(st);
|
|
gridParecer.getChildren().add(pg);
|
|
}
|
|
|
|
if (r.getParecer_dl() != null) {
|
|
if (r.getParecer_dl().trim().length() > 0) {
|
|
pg = new PanelGroup();
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setStyleClass("label");
|
|
st.setText("Parecer DL: ");
|
|
pg.getChildren().add(st);
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setText(r.getParecer_dl().toString());
|
|
pg.getChildren().add(st);
|
|
gridParecer.getChildren().add(pg);
|
|
}
|
|
}
|
|
|
|
if (r.getParecer_dns() != null) {
|
|
if (r.getParecer_dns().trim().length() > 0) {
|
|
pg = new PanelGroup();
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setStyleClass("label");
|
|
st.setText("Parecer DNS: ");
|
|
pg.getChildren().add(st);
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setText(r.getParecer_dns().toString());
|
|
pg.getChildren().add(st);
|
|
gridParecer.getChildren().add(pg);
|
|
|
|
}
|
|
}
|
|
|
|
if (r.getVerificacao_siprp() != null) {
|
|
if (r.getVerificacao_siprp().trim().length() > 0) {
|
|
pg = new PanelGroup();
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setStyleClass("label");
|
|
st.setText("Verificação SIPRP: ");
|
|
pg.getChildren().add(st);
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setText(r.getVerificacao_siprp().toString());
|
|
pg.getChildren().add(st);
|
|
gridParecer.getChildren().add(pg);
|
|
}
|
|
}
|
|
}
|
|
|
|
// private void showValores( List< Valor > valores )
|
|
// {
|
|
// for ( Valor valor : valores )
|
|
// {
|
|
// HtmlPanelGrid grd = new HtmlPanelGrid();
|
|
// grd.setColumns( 1 );
|
|
// grd.setWidth( "100%" );
|
|
// //grd.setStyleClass("centerBlock");
|
|
// //gridRisco.getChildren().add(grd);
|
|
//
|
|
// gridValor = new HtmlPanelGrid();
|
|
// gridRisco.getChildren().add( gridValor );
|
|
// ////gridValor.setStyleClass("centerBlock");
|
|
// gridValor.setWidth( "100%" );
|
|
// gridValor.setColumns( 1 );
|
|
// gridValor.setColumnClasses( "gridColLeft" );
|
|
// //grd.getChildren().add(gridValor);
|
|
// pg = new PanelGroup();
|
|
// st = new StaticText();
|
|
// st.setEscape(false);
|
|
// st.setStyleClass("label");
|
|
// st.setText("Valor: ");
|
|
// pg.getChildren().add(st);
|
|
// st = new StaticText();
|
|
// st.setEscape(false);
|
|
// if(valor.getValorQuantitativo() == null)
|
|
// {
|
|
// st.setText(" - ");
|
|
// }
|
|
// else
|
|
// {
|
|
// st.setText(valor.getValorQuantitativo().toString());
|
|
// }
|
|
// pg.getChildren().add(st);
|
|
// gridValor.getChildren().add(pg);
|
|
//
|
|
// showMedidas(valor.getMedidas());
|
|
//
|
|
// grd = new HtmlPanelGrid();
|
|
// grd.setColumns(1);
|
|
// grd.setWidth("100%");
|
|
// ////grd.setStyleClass("centerBlock");
|
|
// gridValor.getChildren().add(grd);
|
|
// HtmlPanelGrid gridParecer = new HtmlPanelGrid();
|
|
// gridParecer.setStyleClass("centerBlock");
|
|
// gridParecer.setWidth("98%");
|
|
// gridParecer.setColumns(1);
|
|
// gridParecer.setColumnClasses("gridColLeft");
|
|
// grd.getChildren().add(gridParecer);
|
|
//
|
|
// if(valor.getResponsavel_execucao() != null)
|
|
// {
|
|
// if(valor.getResponsavel_execucao().trim().length() > 0)
|
|
// {
|
|
// pg = new PanelGroup();
|
|
// st = new StaticText();
|
|
// st.setEscape(false);
|
|
// st.setStyleClass("label");
|
|
// st.setText("Responsável de execução: ");
|
|
// pg.getChildren().add(st);
|
|
// st = new StaticText();
|
|
// st.setEscape(false);
|
|
// st.setText(valor.getResponsavel_execucao().toString());
|
|
// pg.getChildren().add(st);
|
|
// gridParecer.getChildren().add(pg);
|
|
// }
|
|
// }
|
|
//
|
|
// if(valor.getRecursos_necessarios() != null)
|
|
// {
|
|
// if(valor.getRecursos_necessarios().trim().length() > 0)
|
|
// {
|
|
// pg = new PanelGroup();
|
|
// st = new StaticText();
|
|
// st.setEscape(false);
|
|
// st.setStyleClass("label");
|
|
// st.setText("Recursos necessários: ");
|
|
// pg.getChildren().add(st);
|
|
// st = new StaticText();
|
|
// st.setEscape(false);
|
|
// st.setText(valor.getRecursos_necessarios().toString());
|
|
// pg.getChildren().add(st);
|
|
// gridParecer.getChildren().add(pg);
|
|
// }
|
|
// }
|
|
//
|
|
// if(valor.getData_inicio() != null)
|
|
// {
|
|
// pg = new PanelGroup();
|
|
// st = new StaticText();
|
|
// st.setEscape(false);
|
|
// st.setStyleClass("label");
|
|
// st.setText("Data início: ");
|
|
// pg.getChildren().add(st);
|
|
// st = new StaticText();
|
|
// st.setEscape(false);
|
|
// String data_str = "";
|
|
// SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
|
|
// data_str = formatter.format(valor.getData_inicio());
|
|
// st.setText(data_str);
|
|
// pg.getChildren().add(st);
|
|
// gridParecer.getChildren().add(pg);
|
|
// }
|
|
//
|
|
// if(valor.getData_fim() != null)
|
|
// {
|
|
// pg = new PanelGroup();
|
|
// st = new StaticText();
|
|
// st.setEscape(false);
|
|
// st.setStyleClass("label");
|
|
// st.setText("Data fim: ");
|
|
// pg.getChildren().add(st);
|
|
// st = new StaticText();
|
|
// st.setEscape(false);
|
|
// String data_str = "";
|
|
// SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
|
|
// data_str = formatter.format(valor.getData_fim());
|
|
// st.setText(data_str);
|
|
// pg.getChildren().add(st);
|
|
// gridParecer.getChildren().add(pg);
|
|
// }
|
|
//
|
|
// if(valor.getParecer_dl() != null)
|
|
// {
|
|
// if(valor.getParecer_dl().trim().length() > 0)
|
|
// {
|
|
// pg = new PanelGroup();
|
|
// st = new StaticText();
|
|
// st.setEscape(false);
|
|
// st.setStyleClass("label");
|
|
// st.setText("Parecer DL: ");
|
|
// pg.getChildren().add(st);
|
|
// st = new StaticText();
|
|
// st.setEscape(false);
|
|
// st.setText(valor.getParecer_dl().toString());
|
|
// pg.getChildren().add(st);
|
|
// gridParecer.getChildren().add(pg);
|
|
//
|
|
// }
|
|
// }
|
|
//
|
|
// if(valor.getParecer_dns() != null)
|
|
// {
|
|
// if(valor.getParecer_dns().trim().length() > 0)
|
|
// {
|
|
// pg = new PanelGroup();
|
|
// st = new StaticText();
|
|
// st.setEscape(false);
|
|
// st.setStyleClass("label");
|
|
// st.setText("Parecer DNS: ");
|
|
// pg.getChildren().add(st);
|
|
// st = new StaticText();
|
|
// st.setEscape(false);
|
|
// st.setText(valor.getParecer_dns().toString());
|
|
// pg.getChildren().add(st);
|
|
// gridParecer.getChildren().add(pg);
|
|
//
|
|
// }
|
|
// }
|
|
//
|
|
// if(valor.getVerificacao_siprp() != null)
|
|
// {
|
|
// if(valor.getVerificacao_siprp().trim().length() > 0)
|
|
// {
|
|
// pg = new PanelGroup();
|
|
// st = new StaticText();
|
|
// st.setEscape(false);
|
|
// st.setStyleClass("label");
|
|
// st.setText("Verificação SIPRP: ");
|
|
// pg.getChildren().add(st);
|
|
// st = new StaticText();
|
|
// st.setEscape(false);
|
|
// st.setText(valor.getVerificacao_siprp().toString());
|
|
// pg.getChildren().add(st);
|
|
// gridParecer.getChildren().add(pg);
|
|
//
|
|
// }
|
|
// }
|
|
// //
|
|
// }
|
|
// }
|
|
private void showMedidas(List<Medida> medidas) {
|
|
for (Medida medida : medidas) {
|
|
HtmlPanelGrid grd = new HtmlPanelGrid();
|
|
grd.setColumns(1);
|
|
grd.setWidth("100%");
|
|
////grd.setStyleClass("centerBlock");
|
|
grd.setStyle("display: block");
|
|
gridValor.getChildren().add(grd);
|
|
|
|
gridMedida = new HtmlPanelGrid();
|
|
////gridMedida.setStyleClass("centerBlock");
|
|
gridMedida.setStyle("display: block");
|
|
gridMedida.setWidth("98%");
|
|
gridMedida.setColumns(1);
|
|
gridMedida.setColumnClasses("gridColLeft");
|
|
grd.getChildren().add(gridMedida);
|
|
|
|
pg = new PanelGroup();
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setStyleClass("label");
|
|
st.setText("Medida: ");
|
|
pg.getChildren().add(st);
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setText( medida.getDescricao() );
|
|
pg.getChildren().add(st);
|
|
gridMedida.getChildren().add(pg);
|
|
|
|
showPostos(medida.getPostos());
|
|
}
|
|
}
|
|
|
|
private void showPostos(List<PostoTrabalho> postos) {
|
|
for (PostoTrabalho posto : postos) {
|
|
HtmlPanelGrid grd = new HtmlPanelGrid();
|
|
grd.setColumns(1);
|
|
grd.setStyle("display: block");
|
|
grd.setWidth("100%");
|
|
gridMedida.getChildren().add(grd);
|
|
|
|
gridPosto = new HtmlPanelGrid();
|
|
gridPosto.setStyle("display: block");
|
|
gridPosto.setWidth("98%");
|
|
gridPosto.setColumns(1);
|
|
gridPosto.setColumnClasses("gridColLeft");
|
|
grd.getChildren().add(gridPosto);
|
|
pg = new PanelGroup();
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setStyleClass("label");
|
|
st.setText("Posto de trabalho: ");
|
|
pg.getChildren().add(st);
|
|
st = new StaticText();
|
|
st.setEscape(false);
|
|
st.setText( posto.getDescricao() );
|
|
pg.getChildren().add(st);
|
|
gridPosto.getChildren().add(pg);
|
|
}
|
|
}
|
|
|
|
private void showValidacoes(HtmlPanelGrid grid, PlanoActuacao p) {
|
|
SimpleDateFormat DF = new SimpleDateFormat("dd-MM-yyyy");
|
|
|
|
HtmlPanelGrid gridValidacoes = new HtmlPanelGrid();
|
|
gridValidacoes.setColumns(1);
|
|
gridValidacoes.setColumnClasses("gridColLeft");
|
|
gridValidacoes.setWidth("100%");
|
|
|
|
// 1
|
|
System.out.println("showValidacoes() : 1. (Auditoria) " + p.getData_visita());
|
|
if (p.getData_visita() != null) {
|
|
StaticText visitaText = new StaticText();
|
|
visitaText.setEscape(false);
|
|
visitaText.setText("Data da auditoria: " + (p.getData_visita() == null ? "" : DF.format(p.getData_visita())));
|
|
gridValidacoes.getChildren().add(visitaText);
|
|
}
|
|
|
|
// 2
|
|
System.out.println("showValidacoes() : 2. (Disponibilizacao) " + p.getData_disponibilizacao());
|
|
if (p.getData_disponibilizacao() != null) {
|
|
StaticText dispText = new StaticText();
|
|
dispText.setEscape(false);
|
|
dispText.setText("Data de disponibilizacao online: " + (p.getData_disponibilizacao() == null ? "" : DF.format(p.getData_disponibilizacao())));
|
|
gridValidacoes.getChildren().add(dispText);
|
|
}
|
|
|
|
// 3
|
|
System.out.println("showValidacoes() : 3. (Validacao Seg) " + p.getData_validacao_seg());
|
|
if (p.getData_validacao_seg() != null) {
|
|
StaticText segText = new StaticText();
|
|
segText.setEscape(false);
|
|
String nome = UtilizadoresLogic.getInstance().getNomeUtilizadorByID(p.getUser_seg());
|
|
segText.setText("Validado por " + nome + " (Segurança)" + (p.getData_validacao_seg() == null ? "" : " a " + DF.format(p.getData_validacao_seg())));
|
|
gridValidacoes.getChildren().add(segText);
|
|
}
|
|
|
|
// 4
|
|
System.out.println("showValidacoes() : 4. (Validacao DL) " + p.getValidacao_director_loja());
|
|
if (p.getValidacao_director_loja()) {
|
|
StaticText valDirLojaText = new StaticText();
|
|
valDirLojaText.setEscape(false);
|
|
String nome = UtilizadoresLogic.getInstance().getNomeUtilizadorByID(p.getUser_dir_loja());
|
|
|
|
|
|
String validacaoText = "Validado por " + nome + " (Director de Loja)" +
|
|
(p.getData_validacao_dir_loja() == null ? "" : " a " + DF.format(p.getData_validacao_dir_loja()));
|
|
valDirLojaText.setText(validacaoText);
|
|
gridValidacoes.getChildren().add(valDirLojaText);
|
|
|
|
if (p.getObservacoes_dl() != null && !"".equals(p.getObservacoes_dl().trim())) {
|
|
StaticText obsTitleText = new StaticText();
|
|
obsTitleText.setEscape(false);
|
|
obsTitleText.setText("Observações gerais DL: ");
|
|
|
|
StaticText obsText = new StaticText();
|
|
obsText.setEscape(false);
|
|
obsText.setText(p.getObservacoes_dl());
|
|
|
|
gridValidacoes.getChildren().add(obsTitleText);
|
|
gridValidacoes.getChildren().add(obsText);
|
|
}
|
|
}
|
|
|
|
// 5
|
|
System.out.println("showValidacoes() : 5. (Validacao DNS) " + p.getValidacao_dns());
|
|
if (p.getValidacao_dns()) {
|
|
StaticText valDnsText = new StaticText();
|
|
valDnsText.setEscape(false);
|
|
String nome = UtilizadoresLogic.getInstance().getNomeUtilizadorByID(p.getUser_dns());
|
|
valDnsText.setText("Validado por " + nome + " (Director Nacional de Segurança)" + (p.getData_validacao_dns() == null ? "" : " a " + DF.format(p.getData_validacao_dns())));
|
|
gridValidacoes.getChildren().add(valDnsText);
|
|
|
|
if (p.getObservacoes_dns() != null && !"".equals(p.getObservacoes_dns().trim())) {
|
|
StaticText obsTitleText = new StaticText();
|
|
obsTitleText.setEscape(false);
|
|
obsTitleText.setText("Observações gerais DNS: ");
|
|
|
|
StaticText obsText = new StaticText();
|
|
obsText.setEscape(false);
|
|
obsText.setText(p.getObservacoes_dns());
|
|
|
|
gridValidacoes.getChildren().add(obsTitleText);
|
|
gridValidacoes.getChildren().add(obsText);
|
|
}
|
|
}
|
|
|
|
// 6
|
|
System.out.println("showValidacoes() : 6. (Validacao HS) " + p.getValidacao_hs());
|
|
if (p.getValidacao_hs()) {
|
|
StaticText valHsText = new StaticText();
|
|
valHsText.setEscape(false);
|
|
String nome = UtilizadoresLogic.getInstance().getNomeUtilizadorByID(p.getUser_hs());
|
|
valHsText.setText("Validado por " + nome + " (Técnico Superior de SHST)" + (p.getData_validacao_hs() == null ? "" : " a " + DF.format(p.getData_validacao_hs())));
|
|
gridValidacoes.getChildren().add(valHsText);
|
|
}
|
|
|
|
grid.getChildren().add(gridValidacoes);
|
|
}
|
|
|
|
// private void showValidacoes(HtmlPanelGrid grid, PlanoActuacao p)
|
|
// {
|
|
// boolean hasValidations = false;
|
|
// HtmlPanelGrid grd = new HtmlPanelGrid();
|
|
// grd.setColumns(1);
|
|
// grd.setColumnClasses("gridColLeft");
|
|
// grd.setWidth("100%");
|
|
// if(p.getValidacao_director_loja().booleanValue())
|
|
// {
|
|
// hasValidations = true;
|
|
// StaticText st = new StaticText();
|
|
// st.setEscape(false);
|
|
// //st.setStyleClass("label");
|
|
// String nome = "";
|
|
// try
|
|
// {
|
|
// UtilizadoresDataProvider udp = UtilizadoresDataProvider.getInstance();
|
|
// Utilizador user = udp.getUtilizador(p.getUser_dir_loja());
|
|
// nome = user.getNome();
|
|
// }
|
|
// catch(Exception ex)
|
|
// {
|
|
// ErrorLogger.logException( ex );
|
|
// }
|
|
// st.setText("Validado por " + nome + " (Director de Loja) a " + p.getData_validacao_dir_loja_str());
|
|
// grd.getChildren().add(st);
|
|
//
|
|
// if(p.getObservacoes_dl() != null)
|
|
// {
|
|
// if(p.getObservacoes_dl().trim().length() > 0)
|
|
// {
|
|
// pg = new PanelGroup();
|
|
// st = new StaticText();
|
|
// st.setEscape(false);
|
|
// st.setText("Observações gerais DL: ");
|
|
// pg.getChildren().add(st);
|
|
// st = new StaticText();
|
|
// st.setEscape(false);
|
|
// st.setText(p.getObservacoes_dl());
|
|
// pg.getChildren().add(st);
|
|
// grd.getChildren().add(pg);
|
|
// }
|
|
// }
|
|
// }
|
|
//
|
|
// if(p.getValidacao_dns().booleanValue())
|
|
// {
|
|
// hasValidations = true;
|
|
// StaticText st = new StaticText();
|
|
// st.setEscape(false);
|
|
// //st.setStyleClass("label");
|
|
// String nome = "";
|
|
// try
|
|
// {
|
|
// UtilizadoresDataProvider udp = UtilizadoresDataProvider.getInstance();
|
|
// Utilizador user = udp.getUtilizador(p.getUser_dns());
|
|
// nome = user.getNome();
|
|
// }
|
|
// catch(Exception ex)
|
|
// {
|
|
// ErrorLogger.logException( ex );
|
|
// }
|
|
// st.setText("Validado por " + nome + " (Director Nacional de Segurança) a " + p.getData_validacao_dns_str());
|
|
// grd.getChildren().add(st);
|
|
//
|
|
// if(p.getObservacoes_dns() != null)
|
|
// {
|
|
// if(p.getObservacoes_dns().trim().length() > 0)
|
|
// {
|
|
// pg = new PanelGroup();
|
|
// st = new StaticText();
|
|
// st.setEscape(false);
|
|
// st.setText("Observações gerais DNS: ");
|
|
// pg.getChildren().add(st);
|
|
// st = new StaticText();
|
|
// st.setEscape(false);
|
|
// st.setText(p.getObservacoes_dns());
|
|
// pg.getChildren().add(st);
|
|
// grd.getChildren().add(pg);
|
|
// }
|
|
// }
|
|
// }
|
|
//
|
|
// if(p.getValidacao_hs().booleanValue())
|
|
// {
|
|
// hasValidations = true;
|
|
// StaticText st = new StaticText();
|
|
// st.setEscape(false);
|
|
// //st.setStyleClass("label");
|
|
// String nome = "";
|
|
// try
|
|
// {
|
|
// UtilizadoresDataProvider udp = UtilizadoresDataProvider.getInstance();
|
|
// Utilizador user = udp.getUtilizador(p.getUser_hs());
|
|
// nome = user.getNome();
|
|
// }
|
|
// catch(Exception ex)
|
|
// {
|
|
// ErrorLogger.logException( ex );
|
|
// }
|
|
// st.setText("Validado por " + nome + " (Técnico de SHS) a " + p.getData_validacao_hs_str());
|
|
// grd.getChildren().add(st);
|
|
//
|
|
//// if(p.getVerificacao_siprp() != null)
|
|
//// {
|
|
//// if(p.getVerificacao_siprp().trim().length() > 0)
|
|
//// {
|
|
//// pg = new PanelGroup();
|
|
//// st = new StaticText();
|
|
//// st.setEscape(false);
|
|
//// st.setText("Verificação SIPRP: ");
|
|
//// pg.getChildren().add(st);
|
|
//// st = new StaticText();
|
|
//// st.setEscape(false);
|
|
//// st.setText(p.getVerificacao_siprp());
|
|
//// pg.getChildren().add(st);
|
|
//// grd.getChildren().add(pg);
|
|
//// }
|
|
//// }
|
|
// }
|
|
//
|
|
// if(hasValidations)
|
|
// {
|
|
// grid.getChildren().add(grd);
|
|
// }
|
|
// }
|
|
private void showSeparator() {
|
|
PageSeparator separator = new PageSeparator();
|
|
// separator.setStyle( "margin-bottom: 50px;" );
|
|
gridAreaContainer.getChildren().add(separator);
|
|
}
|
|
|
|
public String butVoltar_action() {
|
|
return "lista_planos";
|
|
}
|
|
|
|
public boolean isConcluido()
|
|
{
|
|
return concluido;
|
|
}
|
|
|
|
public void setConcluido( boolean concluido )
|
|
{
|
|
this.concluido = concluido;
|
|
}
|
|
|
|
|
|
}
|
|
|