|
|
|
|
@ -26,14 +26,21 @@ import db.entidades.Utilizador;
|
|
|
|
|
import db.entidades.Valor;
|
|
|
|
|
import db.providers.PlanosDataProvider;
|
|
|
|
|
import global.Global;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.Iterator;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Vector;
|
|
|
|
|
import javax.el.MethodExpression;
|
|
|
|
|
import javax.faces.FacesException;
|
|
|
|
|
import javax.faces.component.html.HtmlInputHidden;
|
|
|
|
|
import javax.faces.component.html.HtmlPanelGrid;
|
|
|
|
|
import javax.faces.context.FacesContext;
|
|
|
|
|
import javax.faces.event.ActionEvent;
|
|
|
|
|
import javax.faces.event.MethodExpressionActionListener;
|
|
|
|
|
import javax.faces.event.ValueChangeEvent;
|
|
|
|
|
import mail.Mail;
|
|
|
|
|
import pagination.Pagina;
|
|
|
|
|
import pagination.Pagination;
|
|
|
|
|
import utils.JSFUtils;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -57,6 +64,7 @@ public class EditarPlano extends AbstractPageBean {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// </editor-fold>
|
|
|
|
|
PlanosDataProvider pdp = new PlanosDataProvider();
|
|
|
|
|
HtmlPanelGrid grid;
|
|
|
|
|
PanelGroup pg;
|
|
|
|
|
StaticText st;
|
|
|
|
|
@ -64,9 +72,6 @@ public class EditarPlano extends AbstractPageBean {
|
|
|
|
|
|
|
|
|
|
//Plano actuacao
|
|
|
|
|
PlanoActuacao plano;
|
|
|
|
|
Vector<Medida> medidas = new Vector<Medida>();
|
|
|
|
|
Vector<Risco> riscos = new Vector<Risco>();
|
|
|
|
|
Vector<PostoTrabalho> postos = new Vector<PostoTrabalho>();
|
|
|
|
|
|
|
|
|
|
HtmlPanelGrid gridPlano = new HtmlPanelGrid();
|
|
|
|
|
HtmlPanelGrid gridArea;
|
|
|
|
|
@ -74,6 +79,7 @@ public class EditarPlano extends AbstractPageBean {
|
|
|
|
|
HtmlPanelGrid gridValor;
|
|
|
|
|
HtmlPanelGrid gridMedida;
|
|
|
|
|
HtmlPanelGrid gridPosto;
|
|
|
|
|
HtmlPanelGrid gridResponsavel;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -86,6 +92,7 @@ public class EditarPlano extends AbstractPageBean {
|
|
|
|
|
TextArea txtRecursos;
|
|
|
|
|
Calendar dtInicio;
|
|
|
|
|
Calendar dtFim;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public HtmlPanelGrid getGridLayout() {
|
|
|
|
|
return gridLayout;
|
|
|
|
|
@ -220,6 +227,24 @@ public class EditarPlano extends AbstractPageBean {
|
|
|
|
|
public void setLblTop(StaticText st) {
|
|
|
|
|
this.lblTop = st;
|
|
|
|
|
}
|
|
|
|
|
private PanelGroup grpPagination = new PanelGroup();
|
|
|
|
|
|
|
|
|
|
public PanelGroup getGrpPagination() {
|
|
|
|
|
return grpPagination;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setGrpPagination(PanelGroup pg) {
|
|
|
|
|
this.grpPagination = pg;
|
|
|
|
|
}
|
|
|
|
|
private HtmlPanelGrid gridPagination = new HtmlPanelGrid();
|
|
|
|
|
|
|
|
|
|
public HtmlPanelGrid getGridPagination() {
|
|
|
|
|
return gridPagination;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setGridPagination(HtmlPanelGrid hpg) {
|
|
|
|
|
this.gridPagination = hpg;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <p>Construct a new Page bean instance.</p>
|
|
|
|
|
@ -295,22 +320,18 @@ public class EditarPlano extends AbstractPageBean {
|
|
|
|
|
//boolean isPostback = JSFUtils.isPostBack12(fc);
|
|
|
|
|
//boolean isPostback = JSFUtils.isPostBack(fc);
|
|
|
|
|
boolean isPostback = JSFUtils.isPostback();
|
|
|
|
|
System.out.println("POSTBACK : " + isPostback);
|
|
|
|
|
System.out.println("POSTBACK : " + isPostback);
|
|
|
|
|
PlanoActuacao p = getSessionBean1().getPlanoActuacao();
|
|
|
|
|
getRiscosByPlano(p);
|
|
|
|
|
if(!isPostback)
|
|
|
|
|
{
|
|
|
|
|
PlanoActuacao p = getSessionBean1().getPlanoActuacao();
|
|
|
|
|
//initializePlano();
|
|
|
|
|
initialize(p);
|
|
|
|
|
showPlano(p);
|
|
|
|
|
//fillPlano();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
riscos = getSessionBean1().getRiscos();
|
|
|
|
|
medidas = getSessionBean1().getMedidas();
|
|
|
|
|
postos = getSessionBean1().getPostos();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//setPagination(p);
|
|
|
|
|
setPagination();
|
|
|
|
|
lblMsg.setText(getSessionBean1().getMsg());
|
|
|
|
|
getSessionBean1().setMsg("");
|
|
|
|
|
}
|
|
|
|
|
@ -360,219 +381,14 @@ public class EditarPlano extends AbstractPageBean {
|
|
|
|
|
return "lista_planos";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// private void fillPlano()
|
|
|
|
|
// {
|
|
|
|
|
// String indent = " ";
|
|
|
|
|
// Risco r = getNextRisco(plano.getId());
|
|
|
|
|
// fillRisco(r);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// private void fillRisco(Risco r)
|
|
|
|
|
// {
|
|
|
|
|
// String indent = " ";
|
|
|
|
|
// if(gridLayout.getChildren().size() > 0)
|
|
|
|
|
// {
|
|
|
|
|
// gridLayout.getChildren().clear();
|
|
|
|
|
// }
|
|
|
|
|
// gridRisco = new HtmlPanelGrid();
|
|
|
|
|
// gridRisco.setWidth("100%");
|
|
|
|
|
// gridRisco.setStyle("border: solid 1px #000000");
|
|
|
|
|
// gridRisco.setColumns(1);
|
|
|
|
|
// gridRisco.setColumnClasses("gridColLeft");
|
|
|
|
|
//
|
|
|
|
|
// pg = new PanelGroup();
|
|
|
|
|
// st = new StaticText();
|
|
|
|
|
// st.setEscape(false);
|
|
|
|
|
// st.setStyleClass("label");
|
|
|
|
|
// st.setStyle("color: #2c4d7a");
|
|
|
|
|
// st.setText("RISCO 1" + ": ");
|
|
|
|
|
// pg.getChildren().add(st);
|
|
|
|
|
// st = new StaticText();
|
|
|
|
|
// st.setEscape(false);
|
|
|
|
|
// st.setText(r.getDescricao());
|
|
|
|
|
// pg.getChildren().add(st);
|
|
|
|
|
// gridRisco.getChildren().add(pg);
|
|
|
|
|
//
|
|
|
|
|
// st = new StaticText();
|
|
|
|
|
// st.setEscape(false);
|
|
|
|
|
// st.setText(" ");
|
|
|
|
|
// gridRisco.getChildren().add(st);
|
|
|
|
|
//
|
|
|
|
|
// 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(r.getValor().toString());
|
|
|
|
|
// pg.getChildren().add(st);
|
|
|
|
|
// gridRisco.getChildren().add(pg);
|
|
|
|
|
//
|
|
|
|
|
// st = new StaticText();
|
|
|
|
|
// st.setEscape(false);
|
|
|
|
|
// st.setText(" ");
|
|
|
|
|
// gridRisco.getChildren().add(st);
|
|
|
|
|
//
|
|
|
|
|
// //medidas
|
|
|
|
|
// Vector<Medida> meds = getMedidas(r.getId());
|
|
|
|
|
// for(int i = 0; i < meds.size(); i++)
|
|
|
|
|
// {
|
|
|
|
|
// Medida m = medidas.get(i);
|
|
|
|
|
// if(m.getRisco_id().intValue() == r.getId().intValue())
|
|
|
|
|
// {
|
|
|
|
|
// pg = new PanelGroup();
|
|
|
|
|
// st = new StaticText();
|
|
|
|
|
// st.setEscape(false);
|
|
|
|
|
// st.setStyleClass("label");
|
|
|
|
|
// st.setText(indent + "Medida" + ": ");
|
|
|
|
|
// pg.getChildren().add(st);
|
|
|
|
|
// st = new StaticText();
|
|
|
|
|
// st.setEscape(false);
|
|
|
|
|
// st.setText(m.getDescricao());
|
|
|
|
|
// pg.getChildren().add(st);
|
|
|
|
|
// gridRisco.getChildren().add(pg);
|
|
|
|
|
//
|
|
|
|
|
// //postos trabalho
|
|
|
|
|
// Vector<PostoTrabalho> posts = getPostosTrabalho(m.getId());
|
|
|
|
|
// pg = new PanelGroup();
|
|
|
|
|
// st = new StaticText();
|
|
|
|
|
// st.setEscape(false);
|
|
|
|
|
// st.setStyleClass("label");
|
|
|
|
|
// st.setText(indent + indent + "Postos de trabalho afectados" + ": ");
|
|
|
|
|
// pg.getChildren().add(st);
|
|
|
|
|
// st = new StaticText();
|
|
|
|
|
// st.setEscape(false);
|
|
|
|
|
// String spostos = "";
|
|
|
|
|
// for(int j = 0; j < posts.size(); j++)
|
|
|
|
|
// {
|
|
|
|
|
// PostoTrabalho p = posts.get(j);
|
|
|
|
|
// spostos += p.getDescricao(); // + " ";
|
|
|
|
|
// if(j < (posts.size() -1) )
|
|
|
|
|
// {
|
|
|
|
|
// spostos += "; ";
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// st.setText(spostos);
|
|
|
|
|
// pg.getChildren().add(st);
|
|
|
|
|
// gridRisco.getChildren().add(pg);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// st = new StaticText();
|
|
|
|
|
// st.setEscape(false);
|
|
|
|
|
// st.setText(" ");
|
|
|
|
|
// gridRisco.getChildren().add(st);
|
|
|
|
|
//
|
|
|
|
|
// pg = new PanelGroup();
|
|
|
|
|
// st = new StaticText();
|
|
|
|
|
// st.setEscape(false);
|
|
|
|
|
// st.setStyleClass("label");
|
|
|
|
|
// st.setText("Responsável de execução:");
|
|
|
|
|
// pg.getChildren().add(st);
|
|
|
|
|
// txtResponsavelExecucao = new TextField();
|
|
|
|
|
// txtResponsavelExecucao.setColumns(100);
|
|
|
|
|
// pg.getChildren().add(txtResponsavelExecucao);
|
|
|
|
|
// gridRisco.getChildren().add(pg);
|
|
|
|
|
// pg = new PanelGroup();
|
|
|
|
|
// st = new StaticText();
|
|
|
|
|
// st.setEscape(false);
|
|
|
|
|
// st.setStyleClass("label");
|
|
|
|
|
// st.setText("Recursos necessários à implementação da medida:");
|
|
|
|
|
// pg.getChildren().add(st);
|
|
|
|
|
// gridRisco.getChildren().add(pg);
|
|
|
|
|
// txtRecursos = new TextArea();
|
|
|
|
|
// txtRecursos.setColumns(200);
|
|
|
|
|
// gridRisco.getChildren().add(txtRecursos);
|
|
|
|
|
//
|
|
|
|
|
// HtmlPanelGrid grd = new HtmlPanelGrid();
|
|
|
|
|
// grd.setColumns(2);
|
|
|
|
|
// grd.setColumnClasses("gridCol15, gridCol85");
|
|
|
|
|
// grd.setId("pgDtInicio");
|
|
|
|
|
// grd.setStyle("width: 100%");
|
|
|
|
|
// st = new StaticText();
|
|
|
|
|
// st.setEscape(false);
|
|
|
|
|
// st.setStyleClass("label");
|
|
|
|
|
// st.setText("Data prevista de início:");
|
|
|
|
|
// grd.getChildren().add(st);
|
|
|
|
|
// dtInicio = new Calendar();
|
|
|
|
|
// grd.getChildren().add(dtInicio);
|
|
|
|
|
// gridRisco.getChildren().add(grd);
|
|
|
|
|
//
|
|
|
|
|
// grd = new HtmlPanelGrid();
|
|
|
|
|
// grd.setColumns(2);
|
|
|
|
|
// grd.setColumnClasses("gridCol15, gridCol85");
|
|
|
|
|
// grd.setId("pgDtFim");
|
|
|
|
|
// grd.setStyle("width: 100%");
|
|
|
|
|
// st = new StaticText();
|
|
|
|
|
// st.setEscape(false);
|
|
|
|
|
// st.setStyleClass("label");
|
|
|
|
|
// st.setText("Data prevista de conclusão:");
|
|
|
|
|
// grd.getChildren().add(st);
|
|
|
|
|
// dtFim = new Calendar();
|
|
|
|
|
//
|
|
|
|
|
// grd.getChildren().add(dtFim);
|
|
|
|
|
// gridRisco.getChildren().add(grd);
|
|
|
|
|
//
|
|
|
|
|
// gridLayout.getChildren().add(gridRisco);
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// private Risco getNextRisco(Integer planoId)
|
|
|
|
|
// {
|
|
|
|
|
// System.out.println("GET NEXT RISCO");
|
|
|
|
|
// System.out.println("RISCOS SIZE : " + riscos.size());
|
|
|
|
|
// riscos = getSessionBean1().getRiscos();
|
|
|
|
|
// risco_id = getSessionBean1().getRiscosIdx();
|
|
|
|
|
// Risco r = riscos.get(risco_id);
|
|
|
|
|
// if(r != null)
|
|
|
|
|
// {
|
|
|
|
|
// if(r.getPlano_id().intValue() != planoId.intValue())
|
|
|
|
|
// {
|
|
|
|
|
// r = null;
|
|
|
|
|
// risco_id = 0;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// risco_id++;
|
|
|
|
|
// getSessionBean1().setRiscosIdx(risco_id);
|
|
|
|
|
// return r;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// private Vector<Medida> getMedidas(Integer riscoId)
|
|
|
|
|
// {
|
|
|
|
|
// Vector<Medida> meds = new Vector<Medida>();
|
|
|
|
|
// medidas = getSessionBean1().getMedidas();
|
|
|
|
|
// for(int i = 0; i < medidas.size(); i++)
|
|
|
|
|
// {
|
|
|
|
|
// Medida m = medidas.get(i);
|
|
|
|
|
// if(m.getRisco_id().intValue() == riscoId.intValue())
|
|
|
|
|
// {
|
|
|
|
|
// meds.add(m);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// return meds;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
private Vector<PostoTrabalho> getPostosTrabalho(Integer medidaId)
|
|
|
|
|
{
|
|
|
|
|
Vector<PostoTrabalho> posts = new Vector<PostoTrabalho>();
|
|
|
|
|
postos = getSessionBean1().getPostos();
|
|
|
|
|
for(int i = 0; i < postos.size(); i++)
|
|
|
|
|
{
|
|
|
|
|
PostoTrabalho p = postos.get(i);
|
|
|
|
|
if(p.getMedida_id().intValue() == medidaId.intValue())
|
|
|
|
|
{
|
|
|
|
|
posts.add(p);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return posts;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void initialize(PlanoActuacao p)
|
|
|
|
|
{
|
|
|
|
|
//getSessionBean1().setPaginationPageNr(1);
|
|
|
|
|
Pagination pagination = new Pagination(p);
|
|
|
|
|
getSessionBean1().setPagination(pagination);
|
|
|
|
|
Utilizador u = getSessionBean1().getCurrentUser();
|
|
|
|
|
if(u.getTipo().intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA)
|
|
|
|
|
{
|
|
|
|
|
@ -585,12 +401,9 @@ public class EditarPlano extends AbstractPageBean {
|
|
|
|
|
|
|
|
|
|
//gridValidar.setStyleClass("hidden");
|
|
|
|
|
|
|
|
|
|
//System.out.println("VISIBILITY : " + gridValidar.getStyleClass());
|
|
|
|
|
//System.out.println("USER TYPE : " + u.getTipo().intValue());
|
|
|
|
|
if(u.getTipo().intValue() != Global.DIRECTOR_LOJA && u.getTipo().intValue() != Global.DIRECTOR_NACIONAL_SEGURANCA)
|
|
|
|
|
{
|
|
|
|
|
//gridValidar.setStyleClass("visible");
|
|
|
|
|
//System.out.println("VISIBILITY B : " + gridValidar.getStyleClass());
|
|
|
|
|
gridValidar.setRendered(false);
|
|
|
|
|
//txtParecer.setStyleClass("hidden");
|
|
|
|
|
}
|
|
|
|
|
@ -636,6 +449,7 @@ public class EditarPlano extends AbstractPageBean {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gridPlano.setId("gridPlano");
|
|
|
|
|
gridPlano.setWidth("100%");
|
|
|
|
|
gridPlano.setColumns(1);
|
|
|
|
|
gridPlano.setColumnClasses("gridColCenter");
|
|
|
|
|
@ -647,6 +461,7 @@ public class EditarPlano extends AbstractPageBean {
|
|
|
|
|
private void showPlano(PlanoActuacao p)
|
|
|
|
|
{
|
|
|
|
|
gridArea = new HtmlPanelGrid();
|
|
|
|
|
gridArea.setId("gridArea");
|
|
|
|
|
gridArea.setColumns(1);
|
|
|
|
|
gridArea.setColumnClasses("gridColLeft");
|
|
|
|
|
gridArea.setWidth("100%");
|
|
|
|
|
@ -654,7 +469,15 @@ public class EditarPlano extends AbstractPageBean {
|
|
|
|
|
gridPlano.getChildren().add(gridArea);
|
|
|
|
|
|
|
|
|
|
Area a = p.getAreas().get(0);
|
|
|
|
|
|
|
|
|
|
showArea(a);
|
|
|
|
|
Risco r = a.getRiscos().get(0);
|
|
|
|
|
showRisco(r);
|
|
|
|
|
showValores(r);
|
|
|
|
|
showResponsavel(r);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void showArea(Area a)
|
|
|
|
|
{
|
|
|
|
|
pg = new PanelGroup();
|
|
|
|
|
st = new StaticText();
|
|
|
|
|
st.setEscape(false);
|
|
|
|
|
@ -662,13 +485,18 @@ public class EditarPlano extends AbstractPageBean {
|
|
|
|
|
pg.getChildren().add(st);
|
|
|
|
|
gridArea.getChildren().add(pg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void showRisco(Risco r)
|
|
|
|
|
{
|
|
|
|
|
getSessionBean1().setCurrentRisco(r);
|
|
|
|
|
HtmlPanelGrid grd = new HtmlPanelGrid();
|
|
|
|
|
grd.setColumns(1);
|
|
|
|
|
grd.setWidth("100%");
|
|
|
|
|
grd.setStyleClass("centerBlock");
|
|
|
|
|
gridArea.getChildren().add(grd);
|
|
|
|
|
gridArea.getChildren().add(grd);
|
|
|
|
|
|
|
|
|
|
//Risco
|
|
|
|
|
gridRisco = new HtmlPanelGrid();
|
|
|
|
|
gridRisco.setStyleClass("centerBlock");
|
|
|
|
|
gridRisco.setWidth("98%");
|
|
|
|
|
@ -676,7 +504,6 @@ public class EditarPlano extends AbstractPageBean {
|
|
|
|
|
gridRisco.setColumnClasses("gridColLeft");
|
|
|
|
|
grd.getChildren().add(gridRisco);
|
|
|
|
|
|
|
|
|
|
Risco r = a.getRiscos().get(0);
|
|
|
|
|
pg = new PanelGroup();
|
|
|
|
|
st = new StaticText();
|
|
|
|
|
st.setEscape(false);
|
|
|
|
|
@ -684,15 +511,6 @@ public class EditarPlano extends AbstractPageBean {
|
|
|
|
|
pg.getChildren().add(st);
|
|
|
|
|
gridRisco.getChildren().add(pg);
|
|
|
|
|
|
|
|
|
|
showValores(r);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gridMedida = new HtmlPanelGrid();
|
|
|
|
|
gridMedida.setStyleClass("centerBlock");
|
|
|
|
|
gridMedida.setWidth("98%");
|
|
|
|
|
gridMedida.setColumns(1);
|
|
|
|
|
gridMedida.setColumnClasses("gridColLeft");
|
|
|
|
|
grd.getChildren().add(gridMedida);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void showValores(Risco r)
|
|
|
|
|
@ -781,7 +599,123 @@ public class EditarPlano extends AbstractPageBean {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void showResponsavel(Risco r)
|
|
|
|
|
{
|
|
|
|
|
gridResponsavel = new HtmlPanelGrid();
|
|
|
|
|
gridResponsavel.setId("gridResponsavel");
|
|
|
|
|
gridResponsavel.setWidth("100%");
|
|
|
|
|
gridResponsavel.setColumns(1);
|
|
|
|
|
gridResponsavel.setColumnClasses("gridColLeft");
|
|
|
|
|
gridArea.getChildren().add(gridResponsavel);
|
|
|
|
|
|
|
|
|
|
pg = new PanelGroup();
|
|
|
|
|
pg.setId("pgResponsavel");
|
|
|
|
|
st = new StaticText();
|
|
|
|
|
st.setEscape(false);
|
|
|
|
|
st.setStyleClass("label");
|
|
|
|
|
st.setText("Responsável de execução:");
|
|
|
|
|
pg.getChildren().add(st);
|
|
|
|
|
txtResponsavelExecucao = new TextField();
|
|
|
|
|
txtResponsavelExecucao.setId("txtResponsavel");
|
|
|
|
|
txtResponsavelExecucao.setColumns(100);
|
|
|
|
|
pg.getChildren().add(txtResponsavelExecucao);
|
|
|
|
|
gridResponsavel.getChildren().add(pg);
|
|
|
|
|
pg = new PanelGroup();
|
|
|
|
|
st = new StaticText();
|
|
|
|
|
st.setEscape(false);
|
|
|
|
|
st.setStyleClass("label");
|
|
|
|
|
st.setText("Recursos necessários à implementação da medida:");
|
|
|
|
|
pg.getChildren().add(st);
|
|
|
|
|
gridResponsavel.getChildren().add(pg);
|
|
|
|
|
txtRecursos = new TextArea();
|
|
|
|
|
txtRecursos.setId("txtRecursos");
|
|
|
|
|
txtRecursos.setColumns(200);
|
|
|
|
|
gridResponsavel.getChildren().add(txtRecursos);
|
|
|
|
|
|
|
|
|
|
HtmlPanelGrid grd = new HtmlPanelGrid();
|
|
|
|
|
grd.setColumns(2);
|
|
|
|
|
grd.setColumnClasses("gridCol15, gridCol85");
|
|
|
|
|
grd.setId("pgDtInicio");
|
|
|
|
|
grd.setStyle("width: 100%");
|
|
|
|
|
st = new StaticText();
|
|
|
|
|
st.setEscape(false);
|
|
|
|
|
st.setStyleClass("label");
|
|
|
|
|
st.setText("Data prevista de início:");
|
|
|
|
|
grd.getChildren().add(st);
|
|
|
|
|
dtInicio = new Calendar();
|
|
|
|
|
dtInicio.setId("dtInicio");
|
|
|
|
|
grd.getChildren().add(dtInicio);
|
|
|
|
|
gridResponsavel.getChildren().add(grd);
|
|
|
|
|
|
|
|
|
|
grd = new HtmlPanelGrid();
|
|
|
|
|
grd.setColumns(2);
|
|
|
|
|
grd.setColumnClasses("gridCol15, gridCol85");
|
|
|
|
|
grd.setId("pgDtFim");
|
|
|
|
|
grd.setStyle("width: 100%");
|
|
|
|
|
st = new StaticText();
|
|
|
|
|
st.setEscape(false);
|
|
|
|
|
st.setStyleClass("label");
|
|
|
|
|
st.setText("Data prevista de conclusão:");
|
|
|
|
|
grd.getChildren().add(st);
|
|
|
|
|
dtFim = new Calendar();
|
|
|
|
|
dtFim.setId("dtFim");
|
|
|
|
|
grd.getChildren().add(dtFim);
|
|
|
|
|
gridResponsavel.getChildren().add(grd);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setPagination()
|
|
|
|
|
{
|
|
|
|
|
StaticText st = null;
|
|
|
|
|
|
|
|
|
|
Class[] argtypes = new Class[1];
|
|
|
|
|
argtypes[0] = ActionEvent.class;
|
|
|
|
|
MethodExpression me = (MethodExpression)this.getApplication().getExpressionFactory().createMethodExpression(
|
|
|
|
|
getFacesContext().getELContext(), "#{EditarPlano.paginacao_actionListener}", null,argtypes);
|
|
|
|
|
|
|
|
|
|
if(grpPagination.getChildCount() > 0)
|
|
|
|
|
{
|
|
|
|
|
grpPagination.getChildren().clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Pagination pagination = getSessionBean1().getPagination();
|
|
|
|
|
Vector<Pagina> paginas = pagination.getPaginas();
|
|
|
|
|
for(Pagina pagina : paginas)
|
|
|
|
|
{
|
|
|
|
|
if(pagina.isPrevious())
|
|
|
|
|
{
|
|
|
|
|
pagina.addActionListener(new MethodExpressionActionListener(me));
|
|
|
|
|
grpPagination.getChildren().add(pagina);
|
|
|
|
|
st = new StaticText();
|
|
|
|
|
st.setEscape(false);
|
|
|
|
|
st.setText(" ");
|
|
|
|
|
grpPagination.getChildren().add(st);
|
|
|
|
|
}
|
|
|
|
|
else if(pagina.isNext())
|
|
|
|
|
{
|
|
|
|
|
st = new StaticText();
|
|
|
|
|
st.setEscape(false);
|
|
|
|
|
st.setText(" ");
|
|
|
|
|
grpPagination.getChildren().add(st);
|
|
|
|
|
pagina.addActionListener(new MethodExpressionActionListener(me));
|
|
|
|
|
grpPagination.getChildren().add(pagina);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
pagina.addActionListener(new MethodExpressionActionListener(me));
|
|
|
|
|
grpPagination.getChildren().add(pagina);
|
|
|
|
|
if(pagina.getPage_nr().intValue() < pagination.totalPaginas() )
|
|
|
|
|
{
|
|
|
|
|
st = new StaticText();
|
|
|
|
|
st.setEscape(false);
|
|
|
|
|
st.setText(" | ");
|
|
|
|
|
grpPagination.getChildren().add(st);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String butGravarPlano_action() {
|
|
|
|
|
// TODO: Process the action. Return value is a navigation
|
|
|
|
|
// case name where null will return to the same page.
|
|
|
|
|
@ -791,11 +725,79 @@ public class EditarPlano extends AbstractPageBean {
|
|
|
|
|
public String butGravarRisco_action() {
|
|
|
|
|
// TODO: Process the action. Return value is a navigation
|
|
|
|
|
// case name where null will return to the same page.
|
|
|
|
|
System.out.println("BUT NEXT RISCO");
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Risco r = getSessionBean1().getCurrentRisco();
|
|
|
|
|
r = fillRiscoFields(r);
|
|
|
|
|
pdp.updateRisco(r);
|
|
|
|
|
|
|
|
|
|
Pagination pagination = getSessionBean1().getPagination();
|
|
|
|
|
r = pagination.nextRisco();
|
|
|
|
|
if(r != null)
|
|
|
|
|
{
|
|
|
|
|
gridPlano = (HtmlPanelGrid) gridLayout.findComponent("form1:gridPlano");
|
|
|
|
|
gridArea = (HtmlPanelGrid) gridPlano.findComponent("form1:gridArea");
|
|
|
|
|
if(gridArea.getChildren() != null)
|
|
|
|
|
{
|
|
|
|
|
gridArea.getChildren().clear();
|
|
|
|
|
}
|
|
|
|
|
Area a = getSessionBean1().getAreasHash().get( r.getArea_id() );
|
|
|
|
|
showArea(a);
|
|
|
|
|
showRisco(r);
|
|
|
|
|
showValores(r);
|
|
|
|
|
showResponsavel(r);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch(Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ex.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Risco r = getNextRisco(getSessionBean1().getPlanoId());
|
|
|
|
|
//fillRisco(r);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Risco fillRiscoFields(Risco r)
|
|
|
|
|
{
|
|
|
|
|
gridArea = (HtmlPanelGrid) gridPlano.findComponent("form1:gridArea");
|
|
|
|
|
gridResponsavel = (HtmlPanelGrid) gridArea.findComponent("form1:gridResponsavel");
|
|
|
|
|
|
|
|
|
|
TextField txtResponsavel = (TextField) gridResponsavel.findComponent("_form1:txtResponsavel");
|
|
|
|
|
if(txtResponsavel != null)
|
|
|
|
|
{
|
|
|
|
|
if(txtResponsavel.getText() != null)
|
|
|
|
|
{
|
|
|
|
|
r.setResponsavel_execucao((String) txtResponsavel.getText());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextArea txtRecursos = (TextArea) gridResponsavel.findComponent("_form1:txtRecursos");
|
|
|
|
|
if(txtRecursos != null)
|
|
|
|
|
{
|
|
|
|
|
if(txtRecursos.getText() != null)
|
|
|
|
|
{
|
|
|
|
|
r.setRecursos_necessarios((String) txtRecursos.getText());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Calendar dtInicio = (Calendar) gridResponsavel.findComponent("_form1:dtInicio");
|
|
|
|
|
if(dtInicio != null)
|
|
|
|
|
{
|
|
|
|
|
r.setData_inicio(dtInicio.getSelectedDate());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Calendar dtFim = (Calendar) gridResponsavel.findComponent("_form1:dtFim");
|
|
|
|
|
if(dtFim != null)
|
|
|
|
|
{
|
|
|
|
|
r.setData_fim(dtFim.getSelectedDate());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return r;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public String butEnviar_action() {
|
|
|
|
|
// TODO: Process the action. Return value is a navigation
|
|
|
|
|
@ -969,5 +971,43 @@ public class EditarPlano extends AbstractPageBean {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void getRiscosByPlano(PlanoActuacao p)
|
|
|
|
|
{
|
|
|
|
|
HashMap areasHash = new HashMap();
|
|
|
|
|
HashMap riscosHash = new HashMap();
|
|
|
|
|
|
|
|
|
|
for(Area a : p.getAreas())
|
|
|
|
|
{
|
|
|
|
|
areasHash.put(a.getId(), a);
|
|
|
|
|
for(Risco r : a.getRiscos())
|
|
|
|
|
{
|
|
|
|
|
riscosHash.put(r.getId(), r);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getSessionBean1().setAreasHash(areasHash);
|
|
|
|
|
getSessionBean1().setRiscosHash(riscosHash);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void paginacao_actionListener(ActionEvent e)
|
|
|
|
|
{
|
|
|
|
|
gridPlano = (HtmlPanelGrid) gridLayout.findComponent("form1:gridPlano");
|
|
|
|
|
gridArea = (HtmlPanelGrid) gridPlano.findComponent("form1:gridArea");
|
|
|
|
|
if(gridArea.getChildren() != null)
|
|
|
|
|
{
|
|
|
|
|
gridArea.getChildren().clear();
|
|
|
|
|
}
|
|
|
|
|
Pagina pagina = (Pagina) e.getSource();
|
|
|
|
|
Pagination pagination = getSessionBean1().getPagination();
|
|
|
|
|
Risco r = pagination.getRisco(pagina);
|
|
|
|
|
System.out.println("RISCO == " + r.getId().toString());
|
|
|
|
|
Area a = getSessionBean1().getAreasHash().get( r.getArea_id() );
|
|
|
|
|
showArea(a);
|
|
|
|
|
showRisco(r);
|
|
|
|
|
showValores(r);
|
|
|
|
|
showResponsavel(r);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|