|
|
|
@ -49,6 +49,9 @@ import javax.faces.event.ValueChangeEvent;
|
|
|
|
import mail.Mail;
|
|
|
|
import mail.Mail;
|
|
|
|
import pagination.Pagina;
|
|
|
|
import pagination.Pagina;
|
|
|
|
import pagination.Pagination;
|
|
|
|
import pagination.Pagination;
|
|
|
|
|
|
|
|
import pagination.PaginationNormais;
|
|
|
|
|
|
|
|
import pagination.PaginationPatrimoniais;
|
|
|
|
|
|
|
|
import planosactuacao.SessionBean1.PAGINATION_ENUM;
|
|
|
|
import utils.JSFUtils;
|
|
|
|
import utils.JSFUtils;
|
|
|
|
import utils.Utils;
|
|
|
|
import utils.Utils;
|
|
|
|
|
|
|
|
|
|
|
|
@ -404,14 +407,21 @@ public class EditarPlano extends AbstractPageBean
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//setPagination(p);
|
|
|
|
|
|
|
|
setPagination();
|
|
|
|
if ( gridPagination.getChildCount() > 0 )
|
|
|
|
if(p.getCorrecao().matches("y"))
|
|
|
|
{
|
|
|
|
|
|
|
|
gridPagination.getChildren().clear();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setPagination( PAGINATION_ENUM.NORMAL );
|
|
|
|
|
|
|
|
setPagination( PAGINATION_ENUM.PATRIMONIAIS );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( p.getCorrecao().matches( "y" ) )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
lblObs.setText(p.getObs_correcao());
|
|
|
|
lblObs.setText( p.getObs_correcao() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
lblMsg.setText(getSessionBean1().getMsg());
|
|
|
|
lblMsg.setText( getSessionBean1().getMsg() );
|
|
|
|
getSessionBean1().setMsg("");
|
|
|
|
getSessionBean1().setMsg( "" );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
@ -461,8 +471,14 @@ public class EditarPlano extends AbstractPageBean
|
|
|
|
|
|
|
|
|
|
|
|
private void initialize( PlanoActuacao p )
|
|
|
|
private void initialize( PlanoActuacao p )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Pagination pagination = new Pagination( p );
|
|
|
|
Pagination paginationNormal = new PaginationNormais( p );
|
|
|
|
getSessionBean1().setPagination( pagination );
|
|
|
|
Pagination paginationPatrimoniais = new PaginationPatrimoniais( p );
|
|
|
|
|
|
|
|
getSessionBean1().addPagination( PAGINATION_ENUM.NORMAL, paginationNormal );
|
|
|
|
|
|
|
|
getSessionBean1().addPagination( PAGINATION_ENUM.PATRIMONIAIS, paginationPatrimoniais );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Pagination pagination = new Pagination( p );
|
|
|
|
|
|
|
|
// getSessionBean1().setPagination( pagination );
|
|
|
|
|
|
|
|
|
|
|
|
Utilizador u = getSessionBean1().getCurrentUser();
|
|
|
|
Utilizador u = getSessionBean1().getCurrentUser();
|
|
|
|
if(u.getTipo().intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA)
|
|
|
|
if(u.getTipo().intValue() == Global.DIRECTOR_NACIONAL_SEGURANCA)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -802,9 +818,8 @@ public class EditarPlano extends AbstractPageBean
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
showPreviousValidacoes(p);
|
|
|
|
showPreviousValidacoes( p );
|
|
|
|
|
|
|
|
|
|
|
|
//TODO: do this IFF userType is Rogerio or 'tecnico ?'
|
|
|
|
|
|
|
|
Utilizador currentUser = getSessionBean1().getCurrentUser();
|
|
|
|
Utilizador currentUser = getSessionBean1().getCurrentUser();
|
|
|
|
if ( currentUser.getTipo().intValue() == Global.TECNICO_HS
|
|
|
|
if ( currentUser.getTipo().intValue() == Global.TECNICO_HS
|
|
|
|
|| currentUser.getTipo().intValue() == Global.DIRECTOR_SIPRP )
|
|
|
|
|| currentUser.getTipo().intValue() == Global.DIRECTOR_SIPRP )
|
|
|
|
@ -817,52 +832,51 @@ public class EditarPlano extends AbstractPageBean
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void showArea(Area a)
|
|
|
|
private void showArea( Area a )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pg = new PanelGroup();
|
|
|
|
pg = new PanelGroup();
|
|
|
|
st = new StaticText();
|
|
|
|
st = new StaticText();
|
|
|
|
st.setEscape(false);
|
|
|
|
st.setEscape( false );
|
|
|
|
st.setStyleClass("label");
|
|
|
|
st.setStyleClass( "label" );
|
|
|
|
st.setText("Área: ");
|
|
|
|
st.setText( "Área: " );
|
|
|
|
pg.getChildren().add(st);
|
|
|
|
pg.getChildren().add( st );
|
|
|
|
st = new StaticText();
|
|
|
|
st = new StaticText();
|
|
|
|
st.setEscape(false);
|
|
|
|
st.setEscape( false );
|
|
|
|
st.setText(Utils.unicodeToHTML(a.getDescricao()));
|
|
|
|
st.setText( Utils.unicodeToHTML( a.getDescricao() ) );
|
|
|
|
pg.getChildren().add(st);
|
|
|
|
pg.getChildren().add( st );
|
|
|
|
gridArea.getChildren().add(pg);
|
|
|
|
gridArea.getChildren().add( pg );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void showRisco(Risco r)
|
|
|
|
private void showRisco( Risco r )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
getSessionBean1().setCurrentRisco(r);
|
|
|
|
System.out.println( "\nEditarPlano . showRisco() : " + r.getId() + " - " + r.getDescricao() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getSessionBean1().setCurrentRisco( r );
|
|
|
|
HtmlPanelGrid grd = new HtmlPanelGrid();
|
|
|
|
HtmlPanelGrid grd = new HtmlPanelGrid();
|
|
|
|
grd.setColumns(1);
|
|
|
|
grd.setColumns( 1 );
|
|
|
|
grd.setWidth("100%");
|
|
|
|
grd.setWidth( "100%" );
|
|
|
|
//grd.setStyleClass("centerBlock");
|
|
|
|
//grd.setStyleClass("centerBlock");
|
|
|
|
// gridArea.getChildren().add(grd);
|
|
|
|
// gridArea.getChildren().add(grd);
|
|
|
|
|
|
|
|
|
|
|
|
gridRisco = new HtmlPanelGrid();
|
|
|
|
gridRisco = new HtmlPanelGrid();
|
|
|
|
//gridRisco.setStyleClass("centerBlock");
|
|
|
|
//gridRisco.setStyleClass("centerBlock");
|
|
|
|
gridRisco.setWidth("98%");
|
|
|
|
gridRisco.setWidth( "98%" );
|
|
|
|
gridRisco.setColumns(1);
|
|
|
|
gridRisco.setColumns( 1 );
|
|
|
|
gridRisco.setColumnClasses("gridColLeft");
|
|
|
|
gridRisco.setColumnClasses( "gridColLeft" );
|
|
|
|
//grd.getChildren().add(gridRisco);
|
|
|
|
//grd.getChildren().add(gridRisco);
|
|
|
|
gridArea.getChildren().add(gridRisco);
|
|
|
|
gridArea.getChildren().add( gridRisco );
|
|
|
|
|
|
|
|
|
|
|
|
pg = new PanelGroup();
|
|
|
|
pg = new PanelGroup();
|
|
|
|
st = new StaticText();
|
|
|
|
st = new StaticText();
|
|
|
|
st.setEscape(false);
|
|
|
|
st.setEscape( false );
|
|
|
|
st.setStyleClass("label");
|
|
|
|
st.setStyleClass( "label" );
|
|
|
|
st.setText("Risco: ");
|
|
|
|
st.setText( "Risco: " );
|
|
|
|
pg.getChildren().add(st);
|
|
|
|
pg.getChildren().add( st );
|
|
|
|
st = new StaticText();
|
|
|
|
st = new StaticText();
|
|
|
|
st.setEscape(false);
|
|
|
|
st.setEscape( false );
|
|
|
|
st.setText(r.getDescricao());
|
|
|
|
st.setText( r.getDescricao() );
|
|
|
|
pg.getChildren().add(st);
|
|
|
|
pg.getChildren().add( st );
|
|
|
|
gridRisco.getChildren().add(pg);
|
|
|
|
gridRisco.getChildren().add( pg );
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void showValores(Risco r)
|
|
|
|
private void showValores(Risco r)
|
|
|
|
@ -1426,22 +1440,22 @@ public class EditarPlano extends AbstractPageBean
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static final int MAX_PAGES_PER_LINE = 20;
|
|
|
|
private static final int MAX_PAGES_PER_LINE = 20;
|
|
|
|
|
|
|
|
|
|
|
|
private void setPagination()
|
|
|
|
private void setPagination( PAGINATION_ENUM type )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Class[] argtypes = new Class[ 1 ];
|
|
|
|
Class[] argtypes = new Class[ 1 ];
|
|
|
|
argtypes[ 0 ] = ActionEvent.class;
|
|
|
|
argtypes[ 0 ] = ActionEvent.class;
|
|
|
|
MethodExpression me = ( MethodExpression ) this.getApplication().getExpressionFactory().createMethodExpression(
|
|
|
|
MethodExpression me = ( MethodExpression ) this.getApplication().getExpressionFactory().createMethodExpression(
|
|
|
|
getFacesContext().getELContext(), "#{EditarPlano.paginacao_actionListener}", null, argtypes );
|
|
|
|
getFacesContext().getELContext(), "#{EditarPlano.paginacao_actionListener}", null, argtypes );
|
|
|
|
|
|
|
|
|
|
|
|
if ( gridPagination.getChildCount() > 0 )
|
|
|
|
StaticText typeLabel = new StaticText();
|
|
|
|
{
|
|
|
|
typeLabel.setText( type.getType() + ":" );
|
|
|
|
gridPagination.getChildren().clear();
|
|
|
|
gridPagination.getChildren().add( typeLabel );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PanelGroup group = new PanelGroup();
|
|
|
|
PanelGroup group = new PanelGroup();
|
|
|
|
|
|
|
|
|
|
|
|
Pagination pagination = getSessionBean1().getPagination();
|
|
|
|
// Pagination pagination = getSessionBean1().getPagination();
|
|
|
|
|
|
|
|
Pagination pagination = getSessionBean1().getPagination( type );
|
|
|
|
Vector< Pagina > paginas = pagination.getPaginas();
|
|
|
|
Vector< Pagina > paginas = pagination.getPaginas();
|
|
|
|
|
|
|
|
|
|
|
|
for ( int p = 0; p < paginas.size(); p++ )
|
|
|
|
for ( int p = 0; p < paginas.size(); p++ )
|
|
|
|
@ -1457,6 +1471,7 @@ public class EditarPlano extends AbstractPageBean
|
|
|
|
if ( pagina.isPrevious() )
|
|
|
|
if ( pagina.isPrevious() )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pagina.addActionListener( new MethodExpressionActionListener( me ) );
|
|
|
|
pagina.addActionListener( new MethodExpressionActionListener( me ) );
|
|
|
|
|
|
|
|
pagina.setPaginationType( type );
|
|
|
|
group.getChildren().add( pagina );
|
|
|
|
group.getChildren().add( pagina );
|
|
|
|
st = new StaticText();
|
|
|
|
st = new StaticText();
|
|
|
|
st.setEscape( false );
|
|
|
|
st.setEscape( false );
|
|
|
|
@ -1470,11 +1485,13 @@ public class EditarPlano extends AbstractPageBean
|
|
|
|
st.setText( " " );
|
|
|
|
st.setText( " " );
|
|
|
|
group.getChildren().add( st );
|
|
|
|
group.getChildren().add( st );
|
|
|
|
pagina.addActionListener( new MethodExpressionActionListener( me ) );
|
|
|
|
pagina.addActionListener( new MethodExpressionActionListener( me ) );
|
|
|
|
|
|
|
|
pagina.setPaginationType( type );
|
|
|
|
group.getChildren().add( pagina );
|
|
|
|
group.getChildren().add( pagina );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
pagina.addActionListener( new MethodExpressionActionListener( me ) );
|
|
|
|
pagina.addActionListener( new MethodExpressionActionListener( me ) );
|
|
|
|
|
|
|
|
pagina.setPaginationType( type );
|
|
|
|
group.getChildren().add( pagina );
|
|
|
|
group.getChildren().add( pagina );
|
|
|
|
if ( pagina.getPage_nr().intValue() < pagination.totalPaginas() )
|
|
|
|
if ( pagina.getPage_nr().intValue() < pagination.totalPaginas() )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -1774,8 +1791,9 @@ public class EditarPlano extends AbstractPageBean
|
|
|
|
getSessionBean1().getRiscosHash().remove( r.getId() );
|
|
|
|
getSessionBean1().getRiscosHash().remove( r.getId() );
|
|
|
|
getSessionBean1().getRiscosHash().put( r.getId(), r );
|
|
|
|
getSessionBean1().getRiscosHash().put( r.getId(), r );
|
|
|
|
|
|
|
|
|
|
|
|
Pagination pagination = getSessionBean1().getPagination();
|
|
|
|
// Pagination pagination = getSessionBean1().getPagination();
|
|
|
|
|
|
|
|
Pagination pagination = getSessionBean1().getPagination( r.getIsPatrimonial() ? PAGINATION_ENUM.PATRIMONIAIS : PAGINATION_ENUM.NORMAL );
|
|
|
|
|
|
|
|
|
|
|
|
r = pagination.nextValor();
|
|
|
|
r = pagination.nextValor();
|
|
|
|
Area a = getSessionBean1().getAreasHash().get( r.getArea_id() );
|
|
|
|
Area a = getSessionBean1().getAreasHash().get( r.getArea_id() );
|
|
|
|
if ( r != null )
|
|
|
|
if ( r != null )
|
|
|
|
@ -2529,31 +2547,33 @@ public class EditarPlano extends AbstractPageBean
|
|
|
|
gridArea = ( HtmlPanelGrid ) gridPlano.findComponent( "form1:gridArea" );
|
|
|
|
gridArea = ( HtmlPanelGrid ) gridPlano.findComponent( "form1:gridArea" );
|
|
|
|
if ( gridArea.getChildren() != null )
|
|
|
|
if ( gridArea.getChildren() != null )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
gridArea.getChildren().clear();
|
|
|
|
gridArea.getChildren().clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Pagina pagina = ( Pagina ) e.getSource();
|
|
|
|
Pagina pagina = ( Pagina ) e.getSource();
|
|
|
|
Pagination pagination = getSessionBean1().getPagination();
|
|
|
|
PAGINATION_ENUM type = pagina.getPaginationType();
|
|
|
|
|
|
|
|
|
|
|
|
Risco r = pagination.getValor( pagina );
|
|
|
|
// Pagination pagination = getSessionBean1().getPagination();
|
|
|
|
r = getSessionBean1().getRiscosHash().get( r.getId() );
|
|
|
|
Pagination pagination = getSessionBean1().getPagination( type );
|
|
|
|
|
|
|
|
if ( pagination != null )
|
|
|
|
Area a = getSessionBean1().getAreasHash().get( r.getArea_id() );
|
|
|
|
{
|
|
|
|
showArea( a );
|
|
|
|
Risco r = pagination.getValor( pagina );
|
|
|
|
showRisco( r );
|
|
|
|
r = getSessionBean1().getRiscosHash().get( r.getId() );
|
|
|
|
showValor( r );
|
|
|
|
|
|
|
|
showResponsavel( r );
|
|
|
|
Area a = getSessionBean1().getAreasHash().get( r.getArea_id() );
|
|
|
|
|
|
|
|
showArea( a );
|
|
|
|
|
|
|
|
showRisco( r );
|
|
|
|
|
|
|
|
showValor( r );
|
|
|
|
|
|
|
|
showResponsavel( r );
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String butCancelar_action() {
|
|
|
|
public String butCancelar_action()
|
|
|
|
// TODO: Process the action. Return value is a navigation
|
|
|
|
{
|
|
|
|
// case name where null will return to the same page.
|
|
|
|
|
|
|
|
return "lista_planos";
|
|
|
|
return "lista_planos";
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String butLimparDados_action() {
|
|
|
|
public String butLimparDados_action()
|
|
|
|
// TODO: Process the action. Return value is a navigation
|
|
|
|
{
|
|
|
|
// case name where null will return to the same page.
|
|
|
|
|
|
|
|
gridArea = (HtmlPanelGrid) gridPlano.findComponent("form1:gridArea");
|
|
|
|
gridArea = (HtmlPanelGrid) gridPlano.findComponent("form1:gridArea");
|
|
|
|
gridResponsavel = (HtmlPanelGrid) gridArea.findComponent("form1:gridResponsavel");
|
|
|
|
gridResponsavel = (HtmlPanelGrid) gridArea.findComponent("form1:gridResponsavel");
|
|
|
|
PlanoActuacao p = getSessionBean1().getPlanoActuacao();
|
|
|
|
PlanoActuacao p = getSessionBean1().getPlanoActuacao();
|
|
|
|
@ -2602,14 +2622,11 @@ public class EditarPlano extends AbstractPageBean
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String butEnviarCorrecao_action() {
|
|
|
|
public String butEnviarCorrecao_action()
|
|
|
|
// TODO: Process the action. Return value is a navigation
|
|
|
|
{
|
|
|
|
// case name where null will return to the same page.
|
|
|
|
System.out.println( "BUT ENVIAR CORRECAO" );
|
|
|
|
System.out.println("BUT ENVIAR CORRECAO");
|
|
|
|
|
|
|
|
return "enviar_correcao";
|
|
|
|
return "enviar_correcao";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|