/* * FormDirGerRh.java * * Created on December 19, 2007, 11:48 AM * Copyright lluis */ package analiseacidentestrabalho; import beans.Utilizador; import beans.AnaliseAcidente; import com.evolute.utils.error.ErrorLogger; import com.sun.data.provider.RowKey; import com.sun.rave.web.ui.appbase.AbstractPageBean; import com.sun.rave.web.ui.component.Body; import com.sun.rave.web.ui.component.Button; import com.sun.rave.web.ui.component.DropDown; import com.sun.rave.web.ui.component.Form; import com.sun.rave.web.ui.component.Head; import com.sun.rave.web.ui.component.Html; import com.sun.rave.web.ui.component.Hyperlink; import com.sun.rave.web.ui.component.ImageComponent; import com.sun.rave.web.ui.component.Link; import com.sun.rave.web.ui.component.Page; import com.sun.rave.web.ui.component.PanelGroup; import com.sun.rave.web.ui.component.StaticText; import com.sun.rave.web.ui.component.Table; import com.sun.rave.web.ui.component.TableColumn; import com.sun.rave.web.ui.component.TableRowGroup; import com.sun.rave.web.ui.component.TextField; import com.sun.rave.web.ui.model.Option; import db.providers.AnalisesConcluidasDataProvider; import db.providers.AnalisesDataProvider; import db.providers.AnalisesSeguimentoDataProvider; import global.Global; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.ListIterator; import javax.faces.FacesException; import javax.faces.component.html.HtmlPanelGrid; import javax.faces.context.FacesContext; import javax.faces.event.ValueChangeEvent; import javax.servlet.http.HttpServletRequest; import utils.Utils; /** *
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.
*/ public class FormDirGerRh extends AbstractPageBean { //Automatically managed component initialization. WARNING: * This method is automatically generated, so any user-specified code inserted * here is subject to being replaced.
*/ private void _init() throws Exception { } private Page page1 = new Page(); public Page getPage1() { return page1; } public void setPage1( Page p ) { this.page1 = p; } private Html html1 = new Html(); public Html getHtml1() { return html1; } public void setHtml1( Html h ) { this.html1 = h; } private Head head1 = new Head(); public Head getHead1() { return head1; } public void setHead1( Head h ) { this.head1 = h; } private Link link1 = new Link(); public Link getLink1() { return link1; } public void setLink1( Link l ) { this.link1 = l; } private Body body1 = new Body(); public Body getBody1() { return body1; } public void setBody1( Body b ) { this.body1 = b; } private Form form1 = new Form(); public Form getForm1() { return form1; } public void setForm1( Form f ) { this.form1 = f; } private HtmlPanelGrid gridBase1 = new HtmlPanelGrid(); public HtmlPanelGrid getGridBase1() { return gridBase1; } public void setGridBase1( HtmlPanelGrid hpg ) { this.gridBase1 = hpg; } private HtmlPanelGrid gridLayout1 = new HtmlPanelGrid(); public HtmlPanelGrid getGridLayout1() { return gridLayout1; } public void setGridLayout1( HtmlPanelGrid hpg ) { this.gridLayout1 = hpg; } private HtmlPanelGrid gridPanel1 = new HtmlPanelGrid(); public HtmlPanelGrid getGridPanel1() { return gridPanel1; } public void setGridPanel1( HtmlPanelGrid hpg ) { this.gridPanel1 = hpg; } private PanelGroup groupPanel1 = new PanelGroup(); public PanelGroup getGroupPanel1() { return groupPanel1; } public void setGroupPanel1( PanelGroup pg ) { this.groupPanel1 = pg; } private ImageComponent image1 = new ImageComponent(); public ImageComponent getImage1() { return image1; } public void setImage1( ImageComponent ic ) { this.image1 = ic; } private ImageComponent image2 = new ImageComponent(); public ImageComponent getImage2() { return image2; } public void setImage2( ImageComponent ic ) { this.image2 = ic; } private HtmlPanelGrid gridLayoutTop1 = new HtmlPanelGrid(); public HtmlPanelGrid getGridLayoutTop1() { return gridLayoutTop1; } public void setGridLayoutTop1( HtmlPanelGrid hpg ) { this.gridLayoutTop1 = hpg; } private HtmlPanelGrid gridSeguimento1 = new HtmlPanelGrid(); public HtmlPanelGrid getGridSeguimento1() { return gridSeguimento1; } public void setGridSeguimento1( HtmlPanelGrid hpg ) { this.gridSeguimento1 = hpg; } private HtmlPanelGrid gridPanel2 = new HtmlPanelGrid(); public HtmlPanelGrid getGridPanel2() { return gridPanel2; } public void setGridPanel2( HtmlPanelGrid hpg ) { this.gridPanel2 = hpg; } private StaticText staticText2 = new StaticText(); public StaticText getStaticText2() { return staticText2; } public void setStaticText2( StaticText st ) { this.staticText2 = st; } private HtmlPanelGrid gridPanel3 = new HtmlPanelGrid(); public HtmlPanelGrid getGridPanel3() { return gridPanel3; } public void setGridPanel3( HtmlPanelGrid hpg ) { this.gridPanel3 = hpg; } private Table table1 = new Table(); public Table getTable1() { return table1; } public void setTable1( Table t ) { this.table1 = t; } private TableRowGroup tableRowGroup1 = new TableRowGroup(); public TableRowGroup getTableRowGroup1() { return tableRowGroup1; } public void setTableRowGroup1( TableRowGroup trg ) { this.tableRowGroup1 = trg; } private TableColumn tableColumn1 = new TableColumn(); public TableColumn getTableColumn1() { return tableColumn1; } public void setTableColumn1( TableColumn tc ) { this.tableColumn1 = tc; } private Hyperlink lnkDataAcidenteSeg = new Hyperlink(); public Hyperlink getLnkDataAcidenteSeg() { return lnkDataAcidenteSeg; } public void setLnkDataAcidenteSeg( Hyperlink h ) { this.lnkDataAcidenteSeg = h; } private TableColumn tableColumn2 = new TableColumn(); public TableColumn getTableColumn2() { return tableColumn2; } public void setTableColumn2( TableColumn tc ) { this.tableColumn2 = tc; } private Hyperlink lnkNrSeg = new Hyperlink(); public Hyperlink getLnkNrSeg() { return lnkNrSeg; } private TableColumn tableColumnSeguimentoParticipado = new TableColumn(); public TableColumn getTableColumnSeguimentoParticipado() { return tableColumnSeguimentoParticipado; } public void setTableColumnSeguimentoParticipado( TableColumn tc ) { this.tableColumnSeguimentoParticipado = tc; } private TableColumn tableColumnConcluidoParticipado = new TableColumn(); public TableColumn getTableColumnConcluidoParticipado() { return tableColumnConcluidoParticipado; } public void setTableColumnConcluidoParticipado( TableColumn tc ) { this.tableColumnConcluidoParticipado = tc; } public void setLnkNrSeg( Hyperlink h ) { this.lnkNrSeg = h; } private TableColumn tableColumn3 = new TableColumn(); public TableColumn getTableColumn3() { return tableColumn3; } public void setTableColumn3( TableColumn tc ) { this.tableColumn3 = tc; } private Hyperlink lnkPorSeg = new Hyperlink(); public Hyperlink getLnkPorSeg() { return lnkPorSeg; } public void setLnkPorSeg( Hyperlink h ) { this.lnkPorSeg = h; } private TableColumn tableColumn4 = new TableColumn(); public TableColumn getTableColumn4() { return tableColumn4; } public void setTableColumn4( TableColumn tc ) { this.tableColumn4 = tc; } private Hyperlink lnkNomeAcidentadoSeg = new Hyperlink(); public Hyperlink getLnkNomeAcidentadoSeg() { return lnkNomeAcidentadoSeg; } public void setLnkNomeAcidentadoSeg( Hyperlink h ) { this.lnkNomeAcidentadoSeg = h; } private TableColumn tableColumn5 = new TableColumn(); public TableColumn getTableColumn5() { return tableColumn5; } public void setTableColumn5( TableColumn tc ) { this.tableColumn5 = tc; } private Hyperlink lnkFaseSeg = new Hyperlink(); public Hyperlink getLnkFaseSeg() { return lnkFaseSeg; } public void setLnkFaseSeg( Hyperlink h ) { this.lnkFaseSeg = h; } private Hyperlink lnkEstabelecimentoSeg = new Hyperlink(); public Hyperlink getLnkEstabelecimentoSeg() { return lnkEstabelecimentoSeg; } public void setLnkEstabelecimentoSeg( Hyperlink h ) { this.lnkEstabelecimentoSeg = h; } private HtmlPanelGrid gridConcluidos1 = new HtmlPanelGrid(); public HtmlPanelGrid getGridConcluidos1() { return gridConcluidos1; } public void setGridConcluidos1( HtmlPanelGrid hpg ) { this.gridConcluidos1 = hpg; } private HtmlPanelGrid gridPanel4 = new HtmlPanelGrid(); public HtmlPanelGrid getGridPanel4() { return gridPanel4; } public void setGridPanel4( HtmlPanelGrid hpg ) { this.gridPanel4 = hpg; } private StaticText staticText3 = new StaticText(); public StaticText getStaticText3() { return staticText3; } public void setStaticText3( StaticText st ) { this.staticText3 = st; } private HtmlPanelGrid gridPanel5 = new HtmlPanelGrid(); public HtmlPanelGrid getGridPanel5() { return gridPanel5; } public void setGridPanel5( HtmlPanelGrid hpg ) { this.gridPanel5 = hpg; } private PanelGroup groupPanel3 = new PanelGroup(); public PanelGroup getGroupPanel3() { return groupPanel3; } public void setGroupPanel3( PanelGroup pg ) { this.groupPanel3 = pg; } private StaticText staticText4 = new StaticText(); public StaticText getStaticText4() { return staticText4; } public void setStaticText4( StaticText st ) { this.staticText4 = st; } private DropDown drpAno = new DropDown(); public DropDown getDrpAno() { return drpAno; } public void setDrpAno( DropDown dd ) { this.drpAno = dd; } private PanelGroup groupPanel4 = new PanelGroup(); public PanelGroup getGroupPanel4() { return groupPanel4; } public void setGroupPanel4( PanelGroup pg ) { this.groupPanel4 = pg; } private StaticText lblMes = new StaticText(); public StaticText getLblMes() { return lblMes; } public void setLblMes( StaticText st ) { this.lblMes = st; } private DropDown drpMes = new DropDown(); public DropDown getDrpMes() { return drpMes; } public void setDrpMes( DropDown dd ) { this.drpMes = dd; } private PanelGroup groupPanel5 = new PanelGroup(); public PanelGroup getGroupPanel5() { return groupPanel5; } public void setGroupPanel5( PanelGroup pg ) { this.groupPanel5 = pg; } private StaticText lblDia = new StaticText(); public StaticText getLblDia() { return lblDia; } public void setLblDia( StaticText st ) { this.lblDia = st; } private DropDown drpDia = new DropDown(); public DropDown getDrpDia() { return drpDia; } public void setDrpDia( DropDown dd ) { this.drpDia = dd; } private PanelGroup groupPanel6 = new PanelGroup(); public PanelGroup getGroupPanel6() { return groupPanel6; } public void setGroupPanel6( PanelGroup pg ) { this.groupPanel6 = pg; } private StaticText staticText5 = new StaticText(); public StaticText getStaticText5() { return staticText5; } public void setStaticText5( StaticText st ) { this.staticText5 = st; } private TextField txtPor = new TextField(); public TextField getTxtPor() { return txtPor; } public void setTxtPor( TextField tf ) { this.txtPor = tf; } private PanelGroup groupPanel7 = new PanelGroup(); public PanelGroup getGroupPanel7() { return groupPanel7; } public void setGroupPanel7( PanelGroup pg ) { this.groupPanel7 = pg; } private StaticText staticText6 = new StaticText(); public StaticText getStaticText6() { return staticText6; } public void setStaticText6( StaticText st ) { this.staticText6 = st; } private TextField txtNome = new TextField(); public TextField getTxtNome() { return txtNome; } public void setTxtNome( TextField tf ) { this.txtNome = tf; } private Button butPesquisar = new Button(); public Button getButPesquisar() { return butPesquisar; } public void setButPesquisar( Button b ) { this.butPesquisar = b; } private HtmlPanelGrid gridPanel6 = new HtmlPanelGrid(); public HtmlPanelGrid getGridPanel6() { return gridPanel6; } public void setGridPanel6( HtmlPanelGrid hpg ) { this.gridPanel6 = hpg; } private Table table2 = new Table(); public Table getTable2() { return table2; } public void setTable2( Table t ) { this.table2 = t; } private TableRowGroup tableRowGroup2 = new TableRowGroup(); public TableRowGroup getTableRowGroup2() { return tableRowGroup2; } public void setTableRowGroup2( TableRowGroup trg ) { this.tableRowGroup2 = trg; } private TableColumn tableColumn6 = new TableColumn(); public TableColumn getTableColumn6() { return tableColumn6; } public void setTableColumn6( TableColumn tc ) { this.tableColumn6 = tc; } private Hyperlink lnkDataConcluida = new Hyperlink(); public Hyperlink getLnkDataConcluida() { return lnkDataConcluida; } public void setLnkDataConcluida( Hyperlink h ) { this.lnkDataConcluida = h; } private TableColumn tableColumn7 = new TableColumn(); public TableColumn getTableColumn7() { return tableColumn7; } public void setTableColumn7( TableColumn tc ) { this.tableColumn7 = tc; } private Hyperlink lnkNrConcluida = new Hyperlink(); public Hyperlink getLnkNrConcluida() { return lnkNrConcluida; } public void setLnkNrConcluida( Hyperlink h ) { this.lnkNrConcluida = h; } private TableColumn tableColumn8 = new TableColumn(); public TableColumn getTableColumn8() { return tableColumn8; } public void setTableColumn8( TableColumn tc ) { this.tableColumn8 = tc; } private Hyperlink lnkPorConcluida = new Hyperlink(); public Hyperlink getLnkPorConcluida() { return lnkPorConcluida; } public void setLnkPorConcluida( Hyperlink h ) { this.lnkPorConcluida = h; } private TableColumn tableColumn9 = new TableColumn(); public TableColumn getTableColumn9() { return tableColumn9; } public void setTableColumn9( TableColumn tc ) { this.tableColumn9 = tc; } private Hyperlink lnkNomeConcluida = new Hyperlink(); public Hyperlink getLnkNomeConcluida() { return lnkNomeConcluida; } public void setLnkNomeConcluida( Hyperlink h ) { this.lnkNomeConcluida = h; } private TableColumn tableColumn10 = new TableColumn(); public TableColumn getTableColumn10() { return tableColumn10; } public void setTableColumn10( TableColumn tc ) { this.tableColumn10 = tc; } private Hyperlink lnkEstabConcluida = new Hyperlink(); public Hyperlink getLnkEstabConcluida() { return lnkEstabConcluida; } public void setLnkEstabConcluida( Hyperlink h ) { this.lnkEstabConcluida = h; } private StaticText txtSearchMsg = new StaticText(); public StaticText getTxtSearchMsg() { return txtSearchMsg; } public void setTxtSearchMsg( StaticText st ) { this.txtSearchMsg = st; } private HtmlPanelGrid gridPanel7 = new HtmlPanelGrid(); public HtmlPanelGrid getGridPanel7() { return gridPanel7; } public void setGridPanel7( HtmlPanelGrid hpg ) { this.gridPanel7 = hpg; } private PanelGroup groupPanel8 = new PanelGroup(); public PanelGroup getGroupPanel8() { return groupPanel8; } public void setGroupPanel8( PanelGroup pg ) { this.groupPanel8 = pg; } private StaticText staticText7 = new StaticText(); public StaticText getStaticText7() { return staticText7; } public void setStaticText7( StaticText st ) { this.staticText7 = st; } private ImageComponent image3 = new ImageComponent(); public ImageComponent getImage3() { return image3; } public void setImage3( ImageComponent ic ) { this.image3 = ic; } private StaticText staticText8 = new StaticText(); public StaticText getStaticText8() { return staticText8; } public void setStaticText8( StaticText st ) { this.staticText8 = st; } private TableColumn tableColumn11 = new TableColumn(); public TableColumn getTableColumn11() { return tableColumn11; } public void setTableColumn11( TableColumn tc ) { this.tableColumn11 = tc; } private Hyperlink lnkDataAberturaSeg = new Hyperlink(); public Hyperlink getLnkDataAberturaSeg() { return lnkDataAberturaSeg; } public void setLnkDataAberturaSeg( Hyperlink h ) { this.lnkDataAberturaSeg = h; } private TableColumn tableColumn12 = new TableColumn(); public TableColumn getTableColumn12() { return tableColumn12; } public void setTableColumn12( TableColumn tc ) { this.tableColumn12 = tc; } private TableColumn tableColumn13 = new TableColumn(); public TableColumn getTableColumn13() { return tableColumn13; } public void setTableColumn13( TableColumn tc ) { this.tableColumn13 = tc; } private Hyperlink lnkDataAberturaConcluida = new Hyperlink(); public Hyperlink getLnkDataAberturaConcluida() { return lnkDataAberturaConcluida; } public void setLnkDataAberturaConcluida( Hyperlink h ) { this.lnkDataAberturaConcluida = h; } private StaticText lblUser = new StaticText(); public StaticText getLblUser() { return lblUser; } public void setLblUser( StaticText st ) { this.lblUser = st; } private Hyperlink lnkPlanosActuacao = new Hyperlink(); public Hyperlink getLnkPlanosActuacao() { return lnkPlanosActuacao; } public void setLnkPlanosActuacao( Hyperlink h ) { this.lnkPlanosActuacao = h; } private HtmlPanelGrid gridPanelFilterSeg = new HtmlPanelGrid(); public HtmlPanelGrid getGridPanelFilterSeg() { return this.gridPanelFilterSeg; } public void setGridPanelFilterSeg( HtmlPanelGrid pg ) { this.gridPanelFilterSeg = pg; } private PanelGroup groupPanelFilterSeg = new PanelGroup(); public PanelGroup getGroupPanelFilterSeg() { return this.groupPanelFilterSeg; } public void setGroupPanelFilterSeg( PanelGroup pg ) { this.groupPanelFilterSeg = pg; } private StaticText labelFilterNameSeg = new StaticText(); public StaticText getLabelFilterNameSeg() { return this.labelFilterNameSeg; } public void setLabelFilterNameSeg( StaticText st ) { this.labelFilterNameSeg = st; } private TextField textFilterNameSeg = new TextField(); public TextField getTextFilterNameSeg() { return this.textFilterNameSeg; } public void setTextFilterNameSeg( TextField tf ) { this.textFilterNameSeg = tf; } private StaticText labelFilterEstabelecimentoSeg = new StaticText(); public StaticText getLabelFilterEstabelecimentoSeg() { return labelFilterEstabelecimentoSeg; } public void setLabelFilterEstabelecimentoSeg( StaticText labelFilterEstabelecimentoSeg ) { this.labelFilterEstabelecimentoSeg = labelFilterEstabelecimentoSeg; } private DropDown dropEstabelecimentosSeguimento = new DropDown(); public DropDown getDropEstabelecimentosSeguimento() { return dropEstabelecimentosSeguimento; } public void setDropEstabelecimentosSeguimento( DropDown dropEstabelecimentos ) { this.dropEstabelecimentosSeguimento = dropEstabelecimentos; } // private com.sun.rave.web.ui.component.Calendar calFilterDateSeg = new com.sun.rave.web.ui.component.Calendar(); // // public com.sun.rave.web.ui.component.Calendar getCalFilterDateSeg() // { // return this.calFilterDateSeg; // } // // public void setCalFilterDateSeg( com.sun.rave.web.ui.component.Calendar c ) // { // this.calFilterDateSeg = c; // } private Date calFilterDateSeguimento = null; public Date getCalFilterDateSeguimento() { return calFilterDateSeguimento; } public void setCalFilterDateSeguimento( Date calFilterDateSeguimento ) { this.calFilterDateSeguimento = calFilterDateSeguimento; } private TextField textFilterPORSeg = new TextField(); public TextField getTextFilterPORSeg() { return textFilterPORSeg; } public void setTextFilterPORSeg( TextField textFilterPORSeg ) { this.textFilterPORSeg = textFilterPORSeg; } private Button buttonFilterSeg = new Button(); public Button getButtonFilterSeg() { return this.buttonFilterSeg; } public void setButtonFilterSeg( Button b ) { this.buttonFilterSeg = b; } private DropDown dropEstabelecimentosConcluidos = new DropDown(); public DropDown getDropEstabelecimentosConcluidos() { return dropEstabelecimentosConcluidos; } public void setDropEstabelecimentosConcluidos( DropDown dropEstabelecimentos ) { this.dropEstabelecimentosConcluidos = dropEstabelecimentos; } // private TextField textFilterEstabelecimentoConc = new TextField(); // public TextField getTextFilterEstabelecimentoConc() // { // return textFilterEstabelecimentoConc; // } // public void setTextFilterEstabelecimentoConc( TextField textFilterEstabelecimentoConc ) // { // this.textFilterEstabelecimentoConc = textFilterEstabelecimentoConc; // } private DropDown dropCurrentYear = new DropDown(); public DropDown getDropCurrentYear() { return dropCurrentYear; } public void setDropCurrentYear( DropDown dropCurrentYear ) { this.dropCurrentYear = dropCurrentYear; } private static final DateFormat D_F = new SimpleDateFormat( "yyyy-MM-dd" ); //Construct a new Page bean instance.
*/ public FormDirGerRh() { } /** *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.
* *Note that, if the current request is a postback, the property * values of the components do not represent any * values submitted with this request. Instead, they represent the * property values that were saved for this view when it was rendered.
*/ @Override public void init() { // Perform initializations inherited from our superclass super.init(); // Perform application initialization that must complete // *before* managed components are initialized if ( !getSessionBean1().isLoggedIn() ) { try { getExternalContext().redirect( "Login.jsp" ); } catch ( Exception e ) { // . . . handle exception . . . } } siprp = getSessionBean1().isSiprp(); //Callback method that is called after the component tree has been * restored, but before any event processing takes place. This method * will only 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.
*/ @Override public void preprocess() { } private void fillInitialForm() { Integer fromYear = getSelectedYear(); try { table1.setRendered( true ); ArrayList seguimentoList = AnalisesDataProvider.getInstance().getAnalisesSeguimentoDirGerRhList( fromYear ); getSessionBean1().getAnalisesSeguimentoDataProvider().setList( seguimentoList ); } catch ( Exception ex ) { table1.setRendered( false ); ErrorLogger.logException( ex ); } try { table2.setRendered( true ); ArrayList concluidasList = AnalisesDataProvider.getInstance().getAnalisesConcluidasList( null, null, fromYear ); getSessionBean1().getAnalisesConcluidasDataProvider().setList( concluidasList ); } catch ( Exception ex ) { table2.setRendered( false ); ErrorLogger.logException( ex ); } } /** *Callback method that is called just before rendering takes place. * This method will only 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.
*/ @Override public void prerender() { System.out.println( "=== FORM_DIR_GER_RH ===" ); lblUser.setText( getSessionBean1().getCurrentUser().getLogin() ); HttpServletRequest request = ( HttpServletRequest ) getExternalContext().getRequest(); String referer = request.getRequestURI(); String pageFrom = Utils.getPageFrom( referer ); if ( !pageFrom.matches( "FormDirGerRh.jsp" ) || dropCurrentYear.getItems() == null ) { fillCurrentYearDrop(); Utils.fillEmpresas( dropEmpresaConc, dropEmpresaSeg ); Utils.fillEstabelecimentos( getSessionBean1().getCurrentUser().getEmpresa_id(), dropEstabelecimentosConcluidos, dropEstabelecimentosSeguimento ); dropEmpresaConc.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() ); dropEmpresaSeg.setSelected( getSessionBean1().getCurrentUser().getEmpresa_id() ); fillInitialForm(); fillAnoDropDown(); } } /** *Callback method that is called after rendering is completed for
* this request, if init() was called (regardless of whether
* or not this was the page that was actually rendered). Customize this
* method to release resources acquired in the init(),
* preprocess(), or prerender() methods (or
* acquired during execution of an event handler).
Return a reference to the scoped data bean.
*/ protected SessionBean1 getSessionBean1() { return ( SessionBean1 ) getBean( "SessionBean1" ); } /** *Return a reference to the scoped data bean.
*/ protected RequestBean1 getRequestBean1() { return ( RequestBean1 ) getBean( "RequestBean1" ); } /** *Return a reference to the scoped data bean.
*/ protected ApplicationBean1 getApplicationBean1() { return ( ApplicationBean1 ) getBean( "ApplicationBean1" ); } public String lnkAnalisesAcidente_action() { return null; } public String lnkNewUser_action() { return null; } public String lnkEditUser_action() { getSessionBean1().setNavFrom( "FormDirGerRh" ); getSessionBean1().setModoEdicaoUtilizador( "edit" ); return "user"; } public String lnkLogout_action() { Utils.doLogout( getExternalContext(), true ); return null; } public String lnkDataAcidenteSeg_action() { AnaliseAcidente a = getTableSeguimentoRowData(); getSessionBean1().setCurrentAnalise( a ); getSessionBean1().setNavFrom( "FormDirGerRh" ); return "view_analise"; } public String lnkDataAberturaSeg_action() { AnaliseAcidente a = getTableSeguimentoRowData(); getSessionBean1().setCurrentAnalise( a ); getSessionBean1().setNavFrom( "FormDirGerRh" ); return "view_analise"; } public String lnkNrSeg_action() { AnaliseAcidente a = getTableSeguimentoRowData(); getSessionBean1().setCurrentAnalise( a ); getSessionBean1().setNavFrom( "FormDirGerRh" ); return "view_analise"; } public String lnkPorSeg_action() { AnaliseAcidente a = getTableSeguimentoRowData(); getSessionBean1().setCurrentAnalise( a ); getSessionBean1().setNavFrom( "FormDirGerRh" ); return "view_analise"; } public String lnkNomeAcidentadoSeg_action() { AnaliseAcidente a = getTableSeguimentoRowData(); getSessionBean1().setCurrentAnalise( a ); getSessionBean1().setNavFrom( "FormDirGerRh" ); return "view_analise"; } public String lnkFaseSeg_action() { AnaliseAcidente a = getTableSeguimentoRowData(); getSessionBean1().setCurrentAnalise( a ); getSessionBean1().setNavFrom( "FormDirGerRh" ); return "view_analise"; } public String lnkEstabelecimentoSeg_action() { AnaliseAcidente a = getTableSeguimentoRowData(); getSessionBean1().setCurrentAnalise( a ); getSessionBean1().setNavFrom( "FormDirGerRh" ); return "view_analise"; } private AnaliseAcidente getTableSeguimentoRowData() { RowKey rk = tableRowGroup1.getRowKey(); int k = Integer.parseInt( rk.getRowId() ); AnalisesSeguimentoDataProvider provider = ( AnalisesSeguimentoDataProvider ) tableRowGroup1.getSourceData(); ArrayList list = ( ArrayList ) provider.getList(); AnaliseAcidente a = ( AnaliseAcidente ) list.get( k ); return a; } public void drpAno_processValueChange( ValueChangeEvent event ) { Object ano = event.getNewValue(); if ( ano == null ) { lblMes.setVisible( false ); drpMes.setVisible( false ); lblDia.setVisible( false ); drpDia.setVisible( false ); } else { lblMes.setVisible( true ); drpMes.setVisible( true ); fillMesDropDown(); } } public void drpMes_processValueChange( ValueChangeEvent event ) { Object mes = event.getNewValue(); if ( mes == null ) { lblDia.setVisible( false ); drpDia.setVisible( false ); } else { lblDia.setVisible( true ); drpDia.setVisible( true ); //fillDiaDropDown(); } } public void drpDia_processValueChange( ValueChangeEvent event ) { } public String butPesquisar_action() { Object obAno = null; Object obMes = null; Object obDia = null; try { obAno = drpAno.getSelected(); obMes = drpMes.getSelected(); obDia = drpDia.getSelected(); } catch ( Exception ex ) { ErrorLogger.logException( ex ); } Integer ano = null; Integer mes = null; Integer dia = null; if ( obAno != null ) { ano = ( Integer ) obAno; } if ( obMes != null ) { mes = ( Integer ) obMes; } if ( obDia != null ) { dia = ( Integer ) obDia; } String por = null; if ( txtPor.getText() != null ) { por = ( String ) txtPor.getText(); if ( por.trim().length() == 0 ) { por = null; } } String nome = null; if ( txtNome.getText() != null ) { nome = ( String ) txtNome.getText(); if ( nome.trim().length() == 0 ) { nome = null; } } // String estabelecimento = null; // if ( textFilterEstabelecimentoConc.getText() != null ) // { // estabelecimento = (( String ) textFilterEstabelecimentoConc.getText()).trim(); // if ( estabelecimento.length() == 0 ) // { // estabelecimento = null; // } // } Integer selectedEmpresa; if( dropEmpresaConc.getSelected() instanceof Integer ) { selectedEmpresa = ( Integer ) dropEmpresaConc.getSelected(); } else { selectedEmpresa = Utils.getSelectedID( dropEmpresaConc ); } if( selectedEmpresa == null ) { selectedEmpresa = getSessionBean1().getCurrentUser().getEmpresa_id(); } Integer estabelecimentoID; if( dropEstabelecimentosConcluidos.getSelected() instanceof Integer ) { estabelecimentoID = ( Integer ) dropEstabelecimentosConcluidos.getSelected(); } else { estabelecimentoID = Utils.getSelectedID( dropEstabelecimentosConcluidos ); } try { AnalisesDataProvider adp = AnalisesDataProvider.getInstance(); //getSessionBean1().getAnalisesConcluidasDataProvider().setList(new ArrayList()); ArrayList concluidasList = adp.searchAnalisesConcluidasList( selectedEmpresa, null, ano, mes, dia, por, nome, estabelecimentoID, getSelectedYear() ); table2.setRendered( true ); txtSearchMsg.setRendered( false ); getSessionBean1().getAnalisesConcluidasDataProvider().setList( concluidasList ); } catch ( Exception ex ) { table2.setRendered( false ); txtSearchMsg.setRendered( true ); txtSearchMsg.setText( "Não foram encontrados registos para a sua pesquisa !" ); ErrorLogger.logException( ex ); } return null; } public String lnkDataConcluida_action() { AnaliseAcidente a = getTableConcluidasRowData(); getSessionBean1().setCurrentAnalise( a ); getSessionBean1().setNavFrom( "FormDirGerRh" ); return "view_analise"; } public String lnkDataAberturaConcluida_action() { AnaliseAcidente a = getTableConcluidasRowData(); getSessionBean1().setCurrentAnalise( a ); getSessionBean1().setNavFrom( "FormDirGerRh" ); return "view_analise"; } public String lnkNrConcluida_action() { AnaliseAcidente a = getTableConcluidasRowData(); getSessionBean1().setCurrentAnalise( a ); getSessionBean1().setNavFrom( "FormDirGerRh" ); return "view_analise"; } public String lnkPorConcluida_action() { AnaliseAcidente a = getTableConcluidasRowData(); getSessionBean1().setCurrentAnalise( a ); getSessionBean1().setNavFrom( "FormDirGerRh" ); return "view_analise"; } public String lnkNomeConcluida_action() { AnaliseAcidente a = getTableConcluidasRowData(); getSessionBean1().setCurrentAnalise( a ); getSessionBean1().setNavFrom( "FormDirGerRh" ); return "view_analise"; } public String lnkEstabConcluida_action() { AnaliseAcidente a = getTableConcluidasRowData(); getSessionBean1().setCurrentAnalise( a ); getSessionBean1().setNavFrom( "FormDirGerRh" ); return "view_analise"; } private AnaliseAcidente getTableConcluidasRowData() { RowKey rk = tableRowGroup2.getRowKey(); int k = Integer.parseInt( rk.getRowId() ); AnalisesConcluidasDataProvider provider = ( AnalisesConcluidasDataProvider ) tableRowGroup2.getSourceData(); ArrayList list = ( ArrayList ) provider.getList(); AnaliseAcidente a = ( AnaliseAcidente ) list.get( k ); return a; } public String lnkGerirUtilizadores_action() { getSessionBean1().setNavFrom( "FormDirGerRh" ); //getSessionBean1().setModoEdicaoUtilizador("new"); return "gestao_utilizadores"; } private void fillAnoDropDown() { // ArrayList anosList = new ArrayList(); // for(int ano=2007; ano<2051; ano++) // { // anosList.add(new Integer(ano)); // } try { AnalisesDataProvider adp = AnalisesDataProvider.getInstance(); ArrayList anosList = adp.getAnosListFromAnalises(); com.sun.rave.web.ui.model.Option[] anoOptions = new com.sun.rave.web.ui.model.Option[ anosList.size() + 1 ]; anoOptions[0] = new Option( "", "" ); ListIterator iter = anosList.listIterator(); int i = 1; while ( iter.hasNext() ) { Integer ano = ( Integer ) iter.next(); anoOptions[i] = new Option( ano, ano.toString() ); i++; } getSessionBean1().setAnoOptions( anoOptions ); Calendar cal = new GregorianCalendar(); int year = cal.get( Calendar.YEAR ); //drpAno.setSelected( new Integer(year) ); } catch ( Exception ex ) { ErrorLogger.logException( ex ); } } private void fillMesDropDown() { com.sun.rave.web.ui.model.Option[] mesOptions = new com.sun.rave.web.ui.model.Option[ 13 ]; mesOptions[0] = new Option( "", "" ); mesOptions[1] = new Option( new Integer( 1 ), "Janeiro" ); mesOptions[2] = new Option( new Integer( 2 ), "Fevereiro" ); mesOptions[3] = new Option( new Integer( 3 ), "Março" ); mesOptions[4] = new Option( new Integer( 4 ), "Abril" ); mesOptions[5] = new Option( new Integer( 5 ), "Maio" ); mesOptions[6] = new Option( new Integer( 6 ), "Junho" ); mesOptions[7] = new Option( new Integer( 7 ), "Julho" ); mesOptions[8] = new Option( new Integer( 8 ), "Agosto" ); mesOptions[9] = new Option( new Integer( 9 ), "Setembro" ); mesOptions[10] = new Option( new Integer( 10 ), "Outubro" ); mesOptions[11] = new Option( new Integer( 11 ), "Novembro" ); mesOptions[12] = new Option( new Integer( 12 ), "Dezembro" ); getSessionBean1().setMesOptions( mesOptions ); Calendar cal = new GregorianCalendar(); int month = cal.get( Calendar.MONTH ); // 0=Jan, 1=Feb, ... //drpMes.setSelected( new Integer(month+1) ); } // private void fillDiaDropDown() // { // // } public String lnkAjuda_action() { // ServletContext theApplicationsServletContext = // (ServletContext) this.getExternalContext().getContext(); // String pdfFolderPath = theApplicationsServletContext.getRealPath(Global.PDF_FOLDER_URL); // String pdfFilePath = pdfFolderPath + "/Ajuda.pdf"; // // Global global = new Global(); // try // { // global.showPdf(pdfFilePath); // } // catch(Exception ex) // { // ErrorLogger.logException( ex ); // } return null; } public String lnkPlanosActuacao_action() { Utilizador u = getSessionBean1().getCurrentUser(); // String curUser = "?user=" + u.getId().toString(); FacesContext fc = getFacesContext().getCurrentInstance(); Global.redirectToPlanos( fc, u ); // Utilizador u = getSessionBean1().getCurrentUser(); // String curUser = "?user=" + u.getId().toString(); // FacesContext fc = getFacesContext().getCurrentInstance(); // try // { // JSFUtils.redirect(fc, Global.PLANOS_ACTUACAO_URL + curUser); // } // catch(Exception ex) // { // ErrorLogger.logException( ex ); // } return null; } public String buttonFilterSeg_action() { // Date visitaDate = ( Date ) calFilterDateSeg.getValue(); Date visitaDate = calFilterDateSeguimento; String visitaDateStr = null; if ( visitaDate != null ) { visitaDateStr = D_F.format( visitaDate ); } String POR = null; if ( textFilterPORSeg.getText() != null ) { POR = (( String ) textFilterPORSeg.getText()).trim(); if ( POR.length() == 0 ) { POR = null; } } String nome = null; if ( textFilterNameSeg.getText() != null ) { nome = (( String ) textFilterNameSeg.getText()).trim(); if ( nome.length() == 0 ) { nome = null; } } // String estabelecimento = null; // if ( textFilterEstabelecimentoSeg.getText() != null ) // { // estabelecimento = (( String ) textFilterEstabelecimentoSeg.getText()).trim(); // if ( estabelecimento.length() == 0 ) // { // estabelecimento = null; // } // } Integer selectedEmpresa; if( dropEmpresaSeg.getSelected() instanceof Integer ) { selectedEmpresa = ( Integer ) dropEmpresaSeg.getSelected(); } else { selectedEmpresa = Utils.getSelectedID( dropEmpresaSeg ); } if( selectedEmpresa == null ) { selectedEmpresa = getSessionBean1().getCurrentUser().getEmpresa_id(); } Integer estabelecimentoID; if( dropEstabelecimentosSeguimento.getSelected() instanceof Integer ) { estabelecimentoID = ( Integer ) dropEstabelecimentosSeguimento.getSelected(); } else { estabelecimentoID = Utils.getSelectedID( dropEstabelecimentosSeguimento ); } try { AnalisesDataProvider adp = AnalisesDataProvider.getInstance(); ArrayList seguimentoList = adp.searchAnalisesSeguimentoDirGerRh( selectedEmpresa, nome, estabelecimentoID, visitaDateStr, POR, getSelectedYear() ); table1.setRendered( true ); txtSearchMsg.setRendered( false ); getSessionBean1().getAnalisesSeguimentoDataProvider().setList( seguimentoList ); } catch ( Exception e ) { table1.setRendered( false ); txtSearchMsg.setRendered( true ); txtSearchMsg.setText( "Não foram encontrados registos para a sua pesquisa !" ); ErrorLogger.logException( e ); } return null; } public void dropCurrentYear_valueChangeListener( ValueChangeEvent event ) { Object oldValue = event.getOldValue(); Object newValue = event.getNewValue(); if ( newValue != null && newValue instanceof Integer ) { Integer newYear = ( Integer ) newValue; getSessionBean1().setAnoChoice( newYear); Integer oldYear = oldValue != null && oldValue instanceof Integer ? ( Integer ) oldValue : null; if ( oldYear == null || !newYear.equals( oldYear ) ) { fillInitialForm(); } } } private Integer getSelectedYear() { Integer result = getSessionBean1().getAnoChoice(); if ( result == null && dropCurrentYear != null ) { Object selected = dropCurrentYear.getSelected(); if ( selected != null && selected instanceof Integer ) { result = ( Integer ) selected; } } return result; } private void fillCurrentYearDrop() { Integer selectedYear = getSelectedYear(); Option[] opts = Utils.getYearDropValues(); dropCurrentYear.setItems( opts ); dropCurrentYear.setSelected( selectedYear != null ? selectedYear : Utils.getDefaultSelectedYear() ); } }