/*
 * NovoUtilizador.java
 *
 * Created on December 3, 2007, 2:30 PM
 * Copyright lluis
 */
package analiseacidentestrabalho;

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.Checkbox;
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.HiddenField;
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.RadioButton;
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 db.AnalisesDataProvider;
import db.TrabalhadoresListDataProvider;
import global.Global;
import java.util.ArrayList;
import javax.faces.FacesException;
import javax.faces.component.html.HtmlPanelGrid;
import javax.faces.event.ValueChangeEvent;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import utils.Utils;

/**
 * <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>
 */
public class NovoUtilizador extends AbstractPageBean {
    // <editor-fold defaultstate="collapsed" desc="Managed Component Definition">
    private int __placeholder;
    
    /**
     * <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 {
    }
    
    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 PanelGroup groupPanel2 = new PanelGroup();

    public PanelGroup getGroupPanel2() {
        return groupPanel2;
    }

    public void setGroupPanel2(PanelGroup pg) {
        this.groupPanel2 = pg;
    }

    private StaticText lblUser = new StaticText();

    public StaticText getLblUser() {
        return lblUser;
    }

    public void setLblUser(StaticText st) {
        this.lblUser = st;
    }

    private StaticText staticText1 = new StaticText();

    public StaticText getStaticText1() {
        return staticText1;
    }

    public void setStaticText1(StaticText st) {
        this.staticText1 = st;
    }

    private Hyperlink lnkEditUser1 = new Hyperlink();

    public Hyperlink getLnkEditUser1() {
        return lnkEditUser1;
    }

    public void setLnkEditUser1(Hyperlink h) {
        this.lnkEditUser1 = h;
    }

    private StaticText staticText2 = new StaticText();

    public StaticText getStaticText2() {
        return staticText2;
    }

    public void setStaticText2(StaticText st) {
        this.staticText2 = st;
    }

    private Hyperlink lnkLogout1 = new Hyperlink();

    public Hyperlink getLnkLogout1() {
        return lnkLogout1;
    }

    public void setLnkLogout1(Hyperlink h) {
        this.lnkLogout1 = h;
    }

    private HtmlPanelGrid gridMsg1 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridMsg1() {
        return gridMsg1;
    }

    public void setGridMsg1(HtmlPanelGrid hpg) {
        this.gridMsg1 = hpg;
    }

    private StaticText txtMsg = new StaticText();

    public StaticText getTxtMsg() {
        return txtMsg;
    }

    public void setTxtMsg(StaticText st) {
        this.txtMsg = st;
    }

    private HtmlPanelGrid gridPanel2 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel2() {
        return gridPanel2;
    }

    public void setGridPanel2(HtmlPanelGrid hpg) {
        this.gridPanel2 = hpg;
    }

    private HtmlPanelGrid gridPanel3 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel3() {
        return gridPanel3;
    }

    public void setGridPanel3(HtmlPanelGrid hpg) {
        this.gridPanel3 = hpg;
    }

    private PanelGroup groupPanel3 = new PanelGroup();

    public PanelGroup getGroupPanel3() {
        return groupPanel3;
    }

    public void setGroupPanel3(PanelGroup pg) {
        this.groupPanel3 = pg;
    }

    private StaticText staticText3 = new StaticText();

    public StaticText getStaticText3() {
        return staticText3;
    }

    public void setStaticText3(StaticText st) {
        this.staticText3 = st;
    }

    private HtmlPanelGrid gridPanel6 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel6() {
        return gridPanel6;
    }

    public void setGridPanel6(HtmlPanelGrid hpg) {
        this.gridPanel6 = hpg;
    }

    private PanelGroup groupPanel4 = new PanelGroup();

    public PanelGroup getGroupPanel4() {
        return groupPanel4;
    }

    public void setGroupPanel4(PanelGroup pg) {
        this.groupPanel4 = pg;
    }

    private StaticText staticText10 = new StaticText();

    public StaticText getStaticText10() {
        return staticText10;
    }

    public void setStaticText10(StaticText st) {
        this.staticText10 = st;
    }

    private HtmlPanelGrid gridPanel7 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel7() {
        return gridPanel7;
    }

    public void setGridPanel7(HtmlPanelGrid hpg) {
        this.gridPanel7 = hpg;
    }

    private Button butCancelar = new Button();

    public Button getButCancelar() {
        return butCancelar;
    }

    public void setButCancelar(Button b) {
        this.butCancelar = b;
    }

    private PanelGroup groupPanel5 = new PanelGroup();

    public PanelGroup getGroupPanel5() {
        return groupPanel5;
    }

    public void setGroupPanel5(PanelGroup pg) {
        this.groupPanel5 = pg;
    }

    private Button butContinuar = new Button();

    public Button getButContinuar() {
        return butContinuar;
    }

    public void setButContinuar(Button b) {
        this.butContinuar = b;
    }

    private HtmlPanelGrid gridPanel4 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel4() {
        return gridPanel4;
    }

    public void setGridPanel4(HtmlPanelGrid hpg) {
        this.gridPanel4 = hpg;
    }

    private HtmlPanelGrid gridCategoria = new HtmlPanelGrid();

    public HtmlPanelGrid getGridCategoria() {
        return gridCategoria;
    }

    public void setGridCategoria(HtmlPanelGrid hpg) {
        this.gridCategoria = hpg;
    }

    private HtmlPanelGrid gridUtilizador = new HtmlPanelGrid();

    public HtmlPanelGrid getGridUtilizador() {
        return gridUtilizador;
    }

    public void setGridUtilizador(HtmlPanelGrid hpg) {
        this.gridUtilizador = hpg;
    }

    private PanelGroup pgCatDirRh = new PanelGroup();

    public PanelGroup getPgCatDirRh() {
        return pgCatDirRh;
    }

    public void setPgCatDirRh(PanelGroup pg) {
        this.pgCatDirRh = pg;
    }

    private RadioButton rbCatDirRh = new RadioButton();

    public RadioButton getRbCatDirRh() {
        return rbCatDirRh;
    }

    public void setRbCatDirRh(RadioButton rbCatGestao) {
        this.rbCatDirRh = rbCatGestao;
    }

    private StaticText staticText11 = new StaticText();

    public StaticText getStaticText11() {
        return staticText11;
    }

    public void setStaticText11(StaticText st) {
        this.staticText11 = st;
    }

    private PanelGroup pgCatGestao = new PanelGroup();

    public PanelGroup getPgCatGestao() {
        return pgCatGestao;
    }

    public void setPgCatGestao(PanelGroup pg) {
        this.pgCatGestao = pg;
    }

    private RadioButton rbCatGestao = new RadioButton();

    public RadioButton getRbCatGestao() {
        return rbCatGestao;
    }

    public void setRbCatGestao(RadioButton rbCatGestao) {
        this.rbCatGestao = rbCatGestao;
    }

    private StaticText staticText12 = new StaticText();

    public StaticText getStaticText12() {
        return staticText12;
    }

    public void setStaticText12(StaticText st) {
        this.staticText12 = st;
    }

    private PanelGroup pgCatGestaoAd = new PanelGroup();

    public PanelGroup getPgCatGestaoAd() {
        return pgCatGestaoAd;
    }

    public void setPgCatGestaoAd(PanelGroup pg) {
        this.pgCatGestaoAd = pg;
    }

    private StaticText staticText13 = new StaticText();

    public StaticText getStaticText13() {
        return staticText13;
    }

    public void setStaticText13(StaticText st) {
        this.staticText13 = st;
    }

    private Checkbox chkGestaoGeral = new Checkbox();

    public Checkbox getChkGestaoGeral() {
        return chkGestaoGeral;
    }

    public void setChkGestaoGeral(Checkbox c) {
        this.chkGestaoGeral = c;
    }

    private PanelGroup pgCatHs = new PanelGroup();

    public PanelGroup getPgCatHs() {
        return pgCatHs;
    }

    public void setPgCatHs(PanelGroup pg) {
        this.pgCatHs = pg;
    }

    private RadioButton rbCatHs = new RadioButton();

    public RadioButton getRbCatHs() {
        return rbCatHs;
    }

    public void setRbCatHs(RadioButton rbCatGestao) {
        this.rbCatHs = rbCatGestao;
    }

    private StaticText staticText14 = new StaticText();

    public StaticText getStaticText14() {
        return staticText14;
    }

    public void setStaticText14(StaticText st) {
        this.staticText14 = st;
    }

    private PanelGroup pgCatMed = new PanelGroup();

    public PanelGroup getPgCatMed() {
        return pgCatMed;
    }

    public void setPgCatMed(PanelGroup pg) {
        this.pgCatMed = pg;
    }

    private RadioButton rbCatMed = new RadioButton();

    public RadioButton getRbCatMed() {
        return rbCatMed;
    }

    public void setRbCatMed(RadioButton rbCatGestao) {
        this.rbCatMed = rbCatGestao;
    }

    private StaticText staticText15 = new StaticText();

    public StaticText getStaticText15() {
        return staticText15;
    }

    public void setStaticText15(StaticText st) {
        this.staticText15 = st;
    }

    private PanelGroup pgCatRh = new PanelGroup();

    public PanelGroup getPgCatRh() {
        return pgCatRh;
    }

    public void setPgCatRh(PanelGroup pg) {
        this.pgCatRh = pg;
    }

    private RadioButton rbCatRh = new RadioButton();

    public RadioButton getRbCatRh() {
        return rbCatRh;
    }

    public void setRbCatRh(RadioButton rbCatGestao) {
        this.rbCatRh = rbCatGestao;
    }

    private StaticText staticText16 = new StaticText();

    public StaticText getStaticText16() {
        return staticText16;
    }

    public void setStaticText16(StaticText st) {
        this.staticText16 = st;
    }

    private PanelGroup pgCatRhAd = new PanelGroup();

    public PanelGroup getPgCatRhAd() {
        return pgCatRhAd;
    }

    public void setPgCatRhAd(PanelGroup pg) {
        this.pgCatRhAd = pg;
    }

    private StaticText staticText17 = new StaticText();

    public StaticText getStaticText17() {
        return staticText17;
    }

    public void setStaticText17(StaticText st) {
        this.staticText17 = st;
    }

    private Checkbox chkRhResp = new Checkbox();

    public Checkbox getChkRhResp() {
        return chkRhResp;
    }

    public void setChkRhResp(Checkbox c) {
        this.chkRhResp = c;
    }

    private PanelGroup pgCatSeg = new PanelGroup();

    public PanelGroup getPgCatSeg() {
        return pgCatSeg;
    }

    public void setPgCatSeg(PanelGroup pg) {
        this.pgCatSeg = pg;
    }

    private RadioButton rbCatSeg = new RadioButton();

    public RadioButton getRbCatSeg() {
        return rbCatSeg;
    }

    public void setRbCatSeg(RadioButton rbCatGestao) {
        this.rbCatSeg = rbCatGestao;
    }

    private StaticText staticText18 = new StaticText();

    public StaticText getStaticText18() {
        return staticText18;
    }

    public void setStaticText18(StaticText st) {
        this.staticText18 = st;
    }

    private PanelGroup pgCatSegAd = new PanelGroup();

    public PanelGroup getPgCatSegAd() {
        return pgCatSegAd;
    }

    public void setPgCatSegAd(PanelGroup pg) {
        this.pgCatSegAd = pg;
    }

    private StaticText staticText19 = new StaticText();

    public StaticText getStaticText19() {
        return staticText19;
    }

    public void setStaticText19(StaticText st) {
        this.staticText19 = st;
    }

    private Checkbox chkSegResp = new Checkbox();

    public Checkbox getChkSegResp() {
        return chkSegResp;
    }

    public void setChkSegResp(Checkbox c) {
        this.chkSegResp = c;
    }

    private HtmlPanelGrid gridTrabalhadores = new HtmlPanelGrid();

    public HtmlPanelGrid getGridTrabalhadores() {
        return gridTrabalhadores;
    }

    public void setGridTrabalhadores(HtmlPanelGrid hpg) {
        this.gridTrabalhadores = hpg;
    }

    private StaticText txtSearchMsg1 = new StaticText();

    public StaticText getTxtSearchMsg1() {
        return txtSearchMsg1;
    }

    public void setTxtSearchMsg1(StaticText st) {
        this.txtSearchMsg1 = st;
    }

    private PanelGroup groupPanel6 = new PanelGroup();

    public PanelGroup getGroupPanel6() {
        return groupPanel6;
    }

    public void setGroupPanel6(PanelGroup pg) {
        this.groupPanel6 = pg;
    }

    private StaticText staticText4 = new StaticText();

    public StaticText getStaticText4() {
        return staticText4;
    }

    public void setStaticText4(StaticText st) {
        this.staticText4 = st;
    }

    private TextField txtNrMecanografico = new TextField();

    public TextField getTxtNrMecanografico() {
        return txtNrMecanografico;
    }

    public void setTxtNrMecanografico(TextField tf) {
        this.txtNrMecanografico = tf;
    }

    private StaticText staticText5 = new StaticText();

    public StaticText getStaticText5() {
        return staticText5;
    }

    public void setStaticText5(StaticText st) {
        this.staticText5 = st;
    }

    private TextField txtNomeTrabalhador = new TextField();

    public TextField getTxtNomeTrabalhador() {
        return txtNomeTrabalhador;
    }

    public void setTxtNomeTrabalhador(TextField tf) {
        this.txtNomeTrabalhador = tf;
    }

    private StaticText staticText6 = new StaticText();

    public StaticText getStaticText6() {
        return staticText6;
    }

    public void setStaticText6(StaticText st) {
        this.staticText6 = st;
    }

    private Button butProcurarTrab = new Button();

    public Button getButProcurarTrab() {
        return butProcurarTrab;
    }

    public void setButProcurarTrab(Button b) {
        this.butProcurarTrab = b;
    }

    private Table tblTrabalhadores = new Table();

    public Table getTblTrabalhadores() {
        return tblTrabalhadores;
    }

    public void setTblTrabalhadores(Table t) {
        this.tblTrabalhadores = 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 lnkPOR = new Hyperlink();

    public Hyperlink getLnkPOR() {
        return lnkPOR;
    }

    public void setLnkPOR(Hyperlink h) {
        this.lnkPOR = h;
    }

    private TableColumn tableColumn2 = new TableColumn();

    public TableColumn getTableColumn2() {
        return tableColumn2;
    }

    public void setTableColumn2(TableColumn tc) {
        this.tableColumn2 = tc;
    }

    private Hyperlink lnkNomeTrabalhador = new Hyperlink();

    public Hyperlink getLnkNomeTrabalhador() {
        return lnkNomeTrabalhador;
    }

    public void setLnkNomeTrabalhador(Hyperlink h) {
        this.lnkNomeTrabalhador = h;
    }

    private TableColumn tableColumn3 = new TableColumn();

    public TableColumn getTableColumn3() {
        return tableColumn3;
    }

    public void setTableColumn3(TableColumn tc) {
        this.tableColumn3 = tc;
    }

    private Hyperlink lnkEstabelecimentoTrabalhador = new Hyperlink();

    public Hyperlink getLnkEstabelecimentoTrabalhador() {
        return lnkEstabelecimentoTrabalhador;
    }

    public void setLnkEstabelecimentoTrabalhador(Hyperlink h) {
        this.lnkEstabelecimentoTrabalhador = h;
    }

    private StaticText staticText7 = new StaticText();

    public StaticText getStaticText7() {
        return staticText7;
    }

    public void setStaticText7(StaticText st) {
        this.staticText7 = st;
    }

    private StaticText stOutro = new StaticText();

    public StaticText getStOutro() {
        return stOutro;
    }

    public void setStOutro(StaticText st) {
        this.stOutro = st;
    }

    private HtmlPanelGrid gridOutro = new HtmlPanelGrid();

    public HtmlPanelGrid getGridOutro() {
        return gridOutro;
    }

    public void setGridOutro(HtmlPanelGrid hpg) {
        this.gridOutro = hpg;
    }

    private StaticText staticText9 = new StaticText();

    public StaticText getStaticText9() {
        return staticText9;
    }

    public void setStaticText9(StaticText st) {
        this.staticText9 = st;
    }

    private TextField txtNomeOutro = new TextField();

    public TextField getTxtNomeOutro() {
        return txtNomeOutro;
    }

    public void setTxtNomeOutro(TextField tf) {
        this.txtNomeOutro = tf;
    }

    private StaticText staticText20 = new StaticText();

    public StaticText getStaticText20() {
        return staticText20;
    }

    public void setStaticText20(StaticText st) {
        this.staticText20 = st;
    }

    private DropDown drpEstabelecimentoOutro = new DropDown();

    public DropDown getDrpEstabelecimentoOutro() {
        return drpEstabelecimentoOutro;
    }

    public void setDrpEstabelecimentoOutro(DropDown dd) {
        this.drpEstabelecimentoOutro = dd;
    }

    private HtmlPanelGrid gridTecnicosHs = new HtmlPanelGrid();

    public HtmlPanelGrid getGridTecnicosHs() {
        return gridTecnicosHs;
    }

    public void setGridTecnicosHs(HtmlPanelGrid hpg) {
        this.gridTecnicosHs = hpg;
    }

    private StaticText staticText21 = new StaticText();

    public StaticText getStaticText21() {
        return staticText21;
    }

    public void setStaticText21(StaticText st) {
        this.staticText21 = st;
    }

    private DropDown drpNomeHs = new DropDown();

    public DropDown getDrpNomeHs() {
        return drpNomeHs;
    }

    public void setDrpNomeHs(DropDown dd) {
        this.drpNomeHs = dd;
    }

    private StaticText staticText22 = new StaticText();

    public StaticText getStaticText22() {
        return staticText22;
    }

    public void setStaticText22(StaticText st) {
        this.staticText22 = st;
    }

    private TextField txtCap = new TextField();

    public TextField getTxtCap() {
        return txtCap;
    }

    public void setTxtCap(TextField tf) {
        this.txtCap = tf;
    }

    private HtmlPanelGrid gridMedicos = new HtmlPanelGrid();

    public HtmlPanelGrid getGridMedicos() {
        return gridMedicos;
    }

    public void setGridMedicos(HtmlPanelGrid hpg) {
        this.gridMedicos = hpg;
    }

    private StaticText staticText23 = new StaticText();

    public StaticText getStaticText23() {
        return staticText23;
    }

    public void setStaticText23(StaticText st) {
        this.staticText23 = st;
    }

    private DropDown drpNomeMed = new DropDown();

    public DropDown getDrpNomeMed() {
        return drpNomeMed;
    }

    public void setDrpNomeMed(DropDown dd) {
        this.drpNomeMed = dd;
    }

    private StaticText staticText24 = new StaticText();

    public StaticText getStaticText24() {
        return staticText24;
    }

    public void setStaticText24(StaticText st) {
        this.staticText24 = st;
    }

    private DropDown drpEstabelecimentoMed = new DropDown();

    public DropDown getDrpEstabelecimentoMed() {
        return drpEstabelecimentoMed;
    }

    public void setDrpEstabelecimentoMed(DropDown dd) {
        this.drpEstabelecimentoMed = dd;
    }
    
    // </editor-fold>
    boolean isPostback = false;    

    private HiddenField hidHighlight = new HiddenField();

    public HiddenField getHidHighlight() {
        return hidHighlight;
    }

    public void setHidHighlight(HiddenField hf) {
        this.hidHighlight = hf;
    }

    private HiddenField hidClear = new HiddenField();

    public HiddenField getHidClear() {
        return hidClear;
    }

    public void setHidClear(HiddenField hf) {
        this.hidClear = hf;
    }

    private HtmlPanelGrid gridPanel8 = new HtmlPanelGrid();

    public HtmlPanelGrid getGridPanel8() {
        return gridPanel8;
    }

    public void setGridPanel8(HtmlPanelGrid hpg) {
        this.gridPanel8 = hpg;
    }

    private PanelGroup groupPanel7 = new PanelGroup();

    public PanelGroup getGroupPanel7() {
        return groupPanel7;
    }

    public void setGroupPanel7(PanelGroup pg) {
        this.groupPanel7 = pg;
    }

    private StaticText staticText25 = new StaticText();

    public StaticText getStaticText25() {
        return staticText25;
    }

    public void setStaticText25(StaticText st) {
        this.staticText25 = st;
    }

    private ImageComponent image3 = new ImageComponent();

    public ImageComponent getImage3() {
        return image3;
    }

    public void setImage3(ImageComponent ic) {
        this.image3 = ic;
    }

    private StaticText staticText26 = new StaticText();

    public StaticText getStaticText26() {
        return staticText26;
    }

    public void setStaticText26(StaticText st) {
        this.staticText26 = st;
    }

    private Hyperlink lnkNewUser1 = new Hyperlink();

    public Hyperlink getLnkNewUser1() {
        return lnkNewUser1;
    }

    public void setLnkNewUser1(Hyperlink h) {
        this.lnkNewUser1 = h;
    }

    private StaticText staticText27 = new StaticText();

    public StaticText getStaticText27() {
        return staticText27;
    }

    public void setStaticText27(StaticText st) {
        this.staticText27 = st;
    }

    private StaticText staticText28 = new StaticText();

    public StaticText getStaticText28() {
        return staticText28;
    }

    public void setStaticText28(StaticText st) {
        this.staticText28 = st;
    }

    private Hyperlink lnkAnalisesAcidente = new Hyperlink();

    public Hyperlink getLnkAnalisesAcidente() {
        return lnkAnalisesAcidente;
    }

    public void setLnkAnalisesAcidente(Hyperlink h) {
        this.lnkAnalisesAcidente = h;
    }

    private Hyperlink lnkAjuda1 = new Hyperlink();

    public Hyperlink getLnkAjuda1() {
        return lnkAjuda1;
    }

    public void setLnkAjuda1(Hyperlink h) {
        this.lnkAjuda1 = h;
    }

    private StaticText staticText29 = new StaticText();

    public StaticText getStaticText29() {
        return staticText29;
    }

    public void setStaticText29(StaticText st) {
        this.staticText29 = st;
    }
    /**
     * <p>Construct a new Page bean instance.</p>
     */
    public NovoUtilizador() {
    }
    
    /**
     * <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>
     */
    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) {
            log("NovoUtilizador 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
	if (!getSessionBean1().isLoggedIn()) {
	    try {
		getExternalContext().redirect("Login.jsp");
	    } catch(Exception e) {  
	    // . . .  handle exception . . .              
	    }
	}
        else
        {
            lblUser.setText( getSessionBean1().getCurrentUser().getLogin() );         

           HttpServletRequest request = (HttpServletRequest) getExternalContext().getRequest();
           String referer = request.getRequestURI();
           String pageFrom = Utils.getPageFrom(referer);
           if(!pageFrom.matches("NovoUtilizador.jsp"))        
           {
               isPostback = false;
           }
           else
           {
               isPostback = true;
           }                    
            
        }

    }
    
    /**
     * <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>
     */
    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>
     */
    public void prerender() {
        if(!isPostback)
        {
            getSessionBean1().setNewUser(null);            
            initializePage();            
        }
        else
        {
            showPagePostback();
        }

        txtMsg.setText(getSessionBean1().getMsg());
        getSessionBean1().setMsg("");
        
    }
    
    /**
     * <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>
     */
    public void destroy() {
    }

    /**
     * <p>Return a reference to the scoped data bean.</p>
     */
    protected ApplicationBean1 getApplicationBean1() {
        return (ApplicationBean1)getBean("ApplicationBean1");
    }

    /**
     * <p>Return a reference to the scoped data bean.</p>
     */
    protected RequestBean1 getRequestBean1() {
        return (RequestBean1)getBean("RequestBean1");
    }

    /**
     * <p>Return a reference to the scoped data bean.</p>
     */
    protected SessionBean1 getSessionBean1() {
        return (SessionBean1)getBean("SessionBean1");
    }

    public String lnkEditUser_action() {
        // TODO: Replace with your code
        
        getSessionBean1().setNavFrom("NovoUtilizador");
        getSessionBean1().setModoEdicaoUtilizador("edit");
        return "user";        

    }

    public String lnkLogout_action() {
        // TODO: Replace with your code
        
        try
        {
            javax.servlet.http.HttpSession session =
                    (javax.servlet.http.HttpSession) getExternalContext().getSession(true);
            session.invalidate();            
        }
        catch(Exception ex){}

	    try {
		getExternalContext().redirect("Login.jsp");
	    } catch(Exception e) {}        
        //return "login";	
        return null;

    }

    public void drpTipo_processValueChange(ValueChangeEvent event) {
        // TODO: Replace with your code
        
    }

    public void drpNome_processValueChange(ValueChangeEvent event) {
        // TODO: Replace with your code
        
    }

    public String butCancelar_action() {
        // TODO: Process the button click action. Return value is a navigation
        // case name where null will return to the same page.
        
        return "gestao_utilizadores";
    }

    public String butApagar_action() {
        // TODO: Process the button click action. Return value is a navigation
        // case name where null will return to the same page.
        
        return null;
    }

    public String butContinuar_action() {
        // TODO: Process the button click action. Return value is a navigation
        // case name where null will return to the same page.
        AnalisesDataProvider adp = new AnalisesDataProvider();        
        
        if(rbCatHs.getSelected() != null)
        {
            if(rbCatHs.getSelected().equals(new Boolean(true)))            
            {
                if(drpNomeHs.getSelected().equals(new Integer(0) ))
                {
                    getSessionBean1().setMsg("Falta nome do t&eacute;cnico de higiena e seguran&ccedil;a!");                    
                    return null;
                }
                else if(txtCap.getText() == null)
                {
                    getSessionBean1().setMsg("Falta cap!");                    
                    return null;
                }
                else
                {
                    String cap = (String) txtCap.getText();
                    if(cap.trim().length() == 0)
                    {
                        getSessionBean1().setMsg("Falta cap!");                    
                        return null;                        
                    }
                    else
                    {
                        NewUser u = new NewUser();
                        u.setTipo(new Integer(3));
                        u.setNumero_mecanografico("");
                        try
                        {
                            u.setTipo_descricao(adp.getTipoDescricao(u.getTipo()));
                        }
                        catch(Exception ex)
                        {
                            ex.printStackTrace();
                        }                        
                        u.setFuncionario_hst_id((Integer) drpNomeHs.getSelected());
                        try
                        {
                            Integer tecnico_id = (Integer) drpNomeHs.getSelected();
                            u.setNome(Utils.unicodeToHTML(adp.getTecnicoSaudeNome(tecnico_id)));                            
                        }
                        catch(Exception ex)
                        {
                            ex.printStackTrace();
                        }

                        u.setCap(cap);
                        u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id());                        
                        u.setResponsavel_loja("n");
                        u.setEstabelecimento(null);
                        getSessionBean1().setNewUser(u);
                        getSessionBean1().setModoEdicaoUtilizador("new");
                        getSessionBean1().setNavFrom("NovoUtilizador");                        
                        return "new_user_fields";
                    }
                }
            }
        }
        else if(rbCatMed.getSelected() != null)
        {
            if(rbCatMed.getSelected().equals(new Boolean(true)))
            {
                if(drpNomeMed.getSelected().equals(new Integer(0)))
                {
                    getSessionBean1().setMsg("Falta nome do m&eacute;dico!");                    
                    return null;                        
                }
                else if(drpEstabelecimentoMed.getSelected().equals(new Integer(-1)))
                {
                    getSessionBean1().setMsg("Falta estabelecimento!");                    
                    return null;                        
                }
                else
                {
                    NewUser u = new NewUser();
                    u.setTipo(new Integer(5));    
                    u.setNumero_mecanografico("");
                    try
                    {
                        u.setTipo_descricao(adp.getTipoDescricao(u.getTipo()));
                    }
                    catch(Exception ex)
                    {
                        ex.printStackTrace();
                    }                                            
                    u.setMedico_id((Integer) drpNomeMed.getSelected());
                    //u.setNome(drpNomeMed.getLabel());
                    Medico m = null;
                    try
                    {
                        Integer medico_id = (Integer) drpNomeMed.getSelected();
                        m = adp.getMedico(medico_id);
                        u.setNome(m.getNome());    
                        u.setNumero_cedula(m.getNumero_cedula());
                    }
                    catch(Exception ex)
                    {
                        ex.printStackTrace();
                    }                    
                    u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id());                    
                    u.setEstabelecimento((Integer) drpEstabelecimentoMed.getSelected());
                    try
                    {
                        u.setEstabelecimento_descricao(adp.getEstabelecimentoNome(u.getEstabelecimento()));
                    }
                    catch(Exception ex)
                    {
                        ex.printStackTrace();
                    }
                    u.setResponsavel_loja("n");                    
                    getSessionBean1().setNewUser(u);
                    getSessionBean1().setModoEdicaoUtilizador("new");  
                    getSessionBean1().setNavFrom("NovoUtilizador");                                            
                    return "new_user_fields";                    
                }
            }
        }
        else // 
        {
           if(getSessionBean1().getNewUser() == null) 
           {
               boolean booOutro = false;
               NewUser u = new NewUser();               
               if(txtNomeOutro.getText() != null)
               {
                   String nome_outro = (String) txtNomeOutro.getText();
                   if(nome_outro.trim().length() > 0)
                   {
                        u.setNome(nome_outro);
                        booOutro = true;
                   }
                   else
                   {
                       getSessionBean1().setMsg("Falta designa&ccedil;&atilde;o!");
                       return null;
                   }
               }
               else
               {
                   getSessionBean1().setMsg("Falta designa&ccedil;&atilde;o!");
                   return null;                   
               }
               Integer estabelecimento_outro = (Integer) drpEstabelecimentoOutro.getSelected();
               if(estabelecimento_outro.intValue() == -1)
               {
                   getSessionBean1().setMsg("Falta estabelecimento!");
                   return null;                   
               }
               else
               {
                   u.setEstabelecimento(estabelecimento_outro);
                   try
                   {
                     u.setEstabelecimento_descricao(adp.getEstabelecimentoNome(estabelecimento_outro));
                     booOutro = true;                     
                   }
                   catch(Exception ex)
                   {
                       ex.printStackTrace();
                   }
               }
               u = setUserTipo(u);
               u.setNumero_mecanografico("");
               u.setResponsavel_loja("n");
               u.setGestor_geral("n");               
               switch(u.getTipo().intValue())
               {
                   case 1:  //seg
                       if(chkSegResp.getSelected() != null)
                       {
                           if(chkSegResp.getSelected().equals(new Boolean(true)))
                           {
                                u.setResponsavel_loja("y");                               
                           }
                       }
                       break;
                   case 2:  //rh
                       if(chkRhResp.getSelected() != null)
                       {
                           if(chkRhResp.getSelected().equals(new Boolean(true)))
                           {
                                u.setResponsavel_loja("y");                               
                           }
                       }
                       break;  
                   case 6:   //gestor   
                       if(chkGestaoGeral.getSelected() != null)
                       {
                           if(chkGestaoGeral.getSelected().equals(new Boolean(true)))
                           {
                                u.setGestor_geral("y");                               
                           }
                       }
                       
                       break;
               }
               u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id());                                   
               if(booOutro)
               {
                    getSessionBean1().setNewUser(u);
                    getSessionBean1().setModoEdicaoUtilizador("new"); 
                    getSessionBean1().setNavFrom("NovoUtilizador");                                            
                    return "new_user_fields";                                       
               }
               getSessionBean1().setNewUser(u);                  
           }
        }

        if(getSessionBean1().getNewUser() == null)
        {
            getSessionBean1().setMsg("Tem de definir um novo utilizador !");
            return null;
        }
        else
        {
        
            getSessionBean1().setModoEdicaoUtilizador("new");  
            getSessionBean1().setNavFrom("NovoUtilizador");                                    
            return "new_user_fields";                                
        }
    }
    
    
    
    private void initializePage()
    {
        getSessionBean1().getTrabalhadoresListDataProvider().setList(new ArrayList());        
        int tipo = getSessionBean1().getCurrentUser().getTipo().intValue();
        switch(tipo)
        {
            case 7: //Director RH
                pgCatDirRh.setRendered(false);
                pgCatHs.setRendered(false);
                pgCatMed.setRendered(false);
                break;
        }
        
        //gridUtilizador.setRendered(false);
        gridTrabalhadores.setStyleClass("hidden");
        tblTrabalhadores.setStyleClass("hidden");
        gridTecnicosHs.setStyleClass("hidden");
        gridMedicos.setStyleClass("hidden");
        
        rbCatDirRh.setSelected(null);
        rbCatGestao.setSelected(null);        
        rbCatHs.setSelected(null);        
        rbCatMed.setSelected(null);        
        rbCatRh.setSelected(null);        
        rbCatSeg.setSelected(null); 
        
        AnalisesDataProvider adp = new AnalisesDataProvider();
        
       try
       {
                com.sun.rave.web.ui.model.Option[] listMedOptions = adp.getEstabelecimentosList( new Integer(Global.AUCHAN), new Boolean(false));           
                listMedOptions[0].setLabel("-Seleccionar-");                
                com.sun.rave.web.ui.model.Option[] listOutroOptions = adp.getEstabelecimentosList( getSessionBean1().getCurrentUser().getEmpresa_id(), new Boolean(false));
                listOutroOptions[0].setLabel("-Seleccionar-");  
                
          
            getSessionBean1().setEstabelecimentosMedOptions(listMedOptions);                                           
            getSessionBean1().setEstabelecimentosOutroOptions( listOutroOptions );
            drpEstabelecimentoOutro.setSelected(new Integer(-1));
            drpEstabelecimentoMed.setSelected(new Integer(-1));            
       }
       catch(Exception ex)
       {
           ex.printStackTrace();
       }                     
        
        try
        {
            getSessionBean1().setTecnicosOptions(adp.getTecnicosSaudeList());                           
            drpNomeHs.setSelected(new Integer(0));
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }                    

        try
        {
            getSessionBean1().setMedicosOptions(adp.getMedicosList());                           
            drpNomeMed.setSelected(new Integer(0));
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }                                
    }

    public String butProcurarTrab_action() {
        // TODO: Process the button click action. Return value is a navigation
        // case name where null will return to the same page.
        boolean booNrOk = false;
        boolean booNomeOk = false;        
        String nr_mecano = null;
        String nome = null;        
        if(txtNrMecanografico.getText() != null)
        {
            nr_mecano = (String) txtNrMecanografico.getText();
            if(nr_mecano.trim().length() > 0)
            {
                booNrOk = true;
            }
            else
            {
                nr_mecano = null;
            }
        }
        
        if(txtNomeTrabalhador.getText() != null)
        {
            nome = (String) txtNomeTrabalhador.getText();

            if(nome.trim().length() > 0)
            {
                booNomeOk = true;
            }
            else
            {
                nome = null;
            }            
        }        
        
        if(! booNrOk && !booNomeOk)
        {
            getSessionBean1().setMsg("Tem de preencher Numero Mecanogr&aacute;fico ou Nome");
            return null;
        }
        
        AnalisesDataProvider adp = new AnalisesDataProvider();
        Trabalhador t = null;
        if(nome != null)
        {
            nome = utils.Utils.textToUnicode( nome.toUpperCase());            
        }
        try
        {
            ArrayList list = adp.searchTrabalhador(getSessionBean1().getCurrentUser().getEmpresa_id(), nr_mecano, nome );
//            if(list.size() == 1)
//            {
//                t = (Trabalhador) list.get(0);
//                NewUser u = new NewUser();
//                
//                u.setNome(t.getNome());  
//                u.setNumero_mecanografico(t.getNumero_mecanografico());
//                u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id());
//                u.setEstabelecimento(t.getEstabelecimento_id());
//                u.setEstabelecimento_descricao(t.getEstabelecimento());
//                u = setUserTipo(u);                
//                u.setResponsavel_loja("n");
//                if(u.getTipo().intValue() == 1) //seg
//                {
//                    if(chkSegResp.getSelected() != null)
//                    {
//                        if(chkSegResp.getSelected().equals(new Boolean(true)))
//                        {
//                            u.setResponsavel_loja("y");                            
//                        }
//                    }
//                }
//                else if(u.getTipo().intValue() == 2) //rh                
//                {
//                    if(chkRhResp.getSelected() != null)
//                    {
//                        if(chkRhResp.getSelected().equals(new Boolean(true)))
//                        {
//                            u.setResponsavel_loja("y");                            
//                        }
//                    }                    
//                }
//                getSessionBean1().setNewUser(u);    
//            }
//            else
//            {
                //tblTrabalhadores.setRendered(true);
                gridTrabalhadores.setStyleClass("");   
                tblTrabalhadores.setStyleClass("");                
                getSessionBean1().getTrabalhadoresListDataProvider().setList(list);
//            }
        }
        catch(Exception ex)
        {
            getSessionBean1().setMsg("Trabalhador inexistente !"); 
            getSessionBean1().getTrabalhadoresListDataProvider().setList(new ArrayList());            
            tblTrabalhadores.setStyleClass("hidden");
            ex.printStackTrace();
        }        
        return null;
    }

    public String lnkPOR_action() {
        // TODO: Replace with your code
        Trabalhador t = getTrabalhadorRowData();    
        NewUser u = new NewUser();
        u = setUserTipo(u);
        u.setNome(t.getNome());  
        u.setNumero_mecanografico(t.getNumero_mecanografico());
        u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id());
        u.setEstabelecimento(t.getEstabelecimento_id());
        u.setEstabelecimento_descricao(t.getEstabelecimento());
        u.setResponsavel_loja("n");
        u.setGestor_geral("n");
        if(u.getTipo().intValue() == 1) //seg
        {
            if(chkSegResp.getSelected() != null)
            {
                if(chkSegResp.getSelected().equals(new Boolean(true)))
                {
                    u.setResponsavel_loja("y");                            
                }
            }
        }
        else if(u.getTipo().intValue() == 2) //rh                
        {
            if(chkRhResp.getSelected() != null)
            {
                if(chkRhResp.getSelected().equals(new Boolean(true)))
                {
                    u.setResponsavel_loja("y");                            
                }
            }                    
        } 
        else if(u.getTipo().intValue() == 6) //gestor
        {
           if(chkGestaoGeral.getSelected() != null)
           {
               if(chkGestaoGeral.getSelected().equals(new Boolean(true)))
               {
                    u.setGestor_geral("y");                               
               }
           }
            
        }
        
        
        getSessionBean1().setNewUser(u);  
        getSessionBean1().setModoEdicaoUtilizador("new"); 
        getSessionBean1().setNavFrom("NovoUtilizador");                                            
        
        return "new_user_fields";
    }

    public String lnkNomeTrabalhador_action() {
        // TODO: Replace with your code
        Trabalhador t = getTrabalhadorRowData();     
        NewUser u = new NewUser();
        u = setUserTipo(u);
        u.setNome(t.getNome());  
        u.setNumero_mecanografico(t.getNumero_mecanografico());
        u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id());
        u.setEstabelecimento(t.getEstabelecimento_id());
        u.setEstabelecimento_descricao(t.getEstabelecimento());
        u.setResponsavel_loja("n");
        u.setGestor_geral("n");        
        if(u.getTipo().intValue() == 1) //seg
        {
            if(chkSegResp.getSelected() != null)
            {
                if(chkSegResp.getSelected().equals(new Boolean(true)))
                {
                    u.setResponsavel_loja("y");                            
                }
            }
        }
        else if(u.getTipo().intValue() == 2) //rh                
        {
            if(chkRhResp.getSelected() != null)
            {
                if(chkRhResp.getSelected().equals(new Boolean(true)))
                {
                    u.setResponsavel_loja("y");                            
                }
            }                    
        }   
        else if(u.getTipo().intValue() == 6) //gestor
        {
           if(chkGestaoGeral.getSelected() != null)
           {
               if(chkGestaoGeral.getSelected().equals(new Boolean(true)))
               {
                    u.setGestor_geral("y");                               
               }
           }
            
        }
        
        getSessionBean1().setNewUser(u);  
        getSessionBean1().setModoEdicaoUtilizador("new"); 
        getSessionBean1().setNavFrom("NovoUtilizador");                                            
        
        return "new_user_fields";
    }

    public String lnkEstabelecimentoTrabalhador_action() {
        // TODO: Replace with your code
        Trabalhador t = getTrabalhadorRowData(); 
        NewUser u = new NewUser();
        u = setUserTipo(u);
        u.setNome(t.getNome());  
        u.setNumero_mecanografico(t.getNumero_mecanografico());
        u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id());
        u.setEstabelecimento(t.getEstabelecimento_id());
        u.setEstabelecimento_descricao(t.getEstabelecimento());
        u.setResponsavel_loja("n");
        u.setGestor_geral("n");        
        if(u.getTipo().intValue() == 1) //seg
        {
            if(chkSegResp.getSelected() != null)
            {
                if(chkSegResp.getSelected().equals(new Boolean(true)))
                {
                    u.setResponsavel_loja("y");                            
                }
            }
        }
        else if(u.getTipo().intValue() == 2) //rh                
        {
            if(chkRhResp.getSelected() != null)
            {
                if(chkRhResp.getSelected().equals(new Boolean(true)))
                {
                    u.setResponsavel_loja("y");                            
                }
            }                    
        }     
        else if(u.getTipo().intValue() == 6) //gestor
        {
           if(chkGestaoGeral.getSelected() != null)
           {
               if(chkGestaoGeral.getSelected().equals(new Boolean(true)))
               {
                    u.setGestor_geral("y");                               
               }
           }
            
        }
        
        getSessionBean1().setNewUser(u);   
        getSessionBean1().setModoEdicaoUtilizador("new"); 
        getSessionBean1().setNavFrom("NovoUtilizador");                                            
       
        return "new_user_fields";
    }
    
    private Trabalhador getTrabalhadorRowData()
    {
        RowKey rk = tableRowGroup1.getRowKey();
        int k = Integer.parseInt(rk.getRowId());        
        TrabalhadoresListDataProvider provider = (TrabalhadoresListDataProvider) tableRowGroup1.getSourceData();
        ArrayList list = (ArrayList) provider.getList();
        Trabalhador t = (Trabalhador)list.get(k);
        hidHighlight.setValue(rk.getRowId());
        return t;
    }    
    
    private NewUser setUserTipo(NewUser u)
    {
        if(rbCatDirRh.getSelected() != null)
        {
            if(rbCatDirRh.getSelected().equals(new Boolean(true)))
            {
                u.setTipo(new Integer(7));                
            }
        }  
        if(rbCatGestao.getSelected() != null)
        {
            if(rbCatGestao.getSelected().equals(new Boolean(true)))
            {
                u.setTipo(new Integer(6));                
            }
        }          
        if(rbCatRh.getSelected() != null)
        {
            if(rbCatRh.getSelected().equals(new Boolean(true)))
            {
                u.setTipo(new Integer(2));                
            }
        }  
        if(rbCatSeg.getSelected() != null)
        {
            if(rbCatSeg.getSelected().equals(new Boolean(true)))
            {
                u.setTipo(new Integer(1));                
            }
        }        
        
        AnalisesDataProvider adp = new AnalisesDataProvider();
        try
        {
            u.setTipo_descricao(adp.getTipoDescricao(u.getTipo()));
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }
        return u;
    }
    
    private void showPagePostback()
    {
        if(rbCatDirRh.getSelected() != null)
        {
            if(rbCatDirRh.getSelected().equals( new Boolean(true) ))
            {
                gridTrabalhadores.setStyleClass("");
                return;
            }
        }
        
        if(rbCatGestao.getSelected() != null)
        {
            if(rbCatGestao.getSelected().equals( new Boolean(true) ))
            {
                gridTrabalhadores.setStyleClass("");
                return;
            }
        }   
        
        if(rbCatRh.getSelected() != null)
        {
            if(rbCatRh.getSelected().equals( new Boolean(true) ))
            {
                gridTrabalhadores.setStyleClass("");
                return;
            }
        }   
        if(rbCatSeg.getSelected() != null)
        {
            if(rbCatSeg.getSelected().equals( new Boolean(true) ))
            {
                gridTrabalhadores.setStyleClass("");
                return;
            }
        }  
        
        if(rbCatHs.getSelected() != null)
        {
            if(rbCatHs.getSelected().equals( new Boolean(true) ))
            {
                gridTecnicosHs.setStyleClass("");
                return;
            }
        }        
        
        if(rbCatMed.getSelected() != null)
        {
            if(rbCatMed.getSelected().equals( new Boolean(true) ))
            {
                gridMedicos.setStyleClass("");
                return;
            }
        }                
        
    }
    
//    public String getColumnStyle(){
//        TableRowDataProvider trdp = (TableRowDataProvider) getBean("currentRow");
//        RowKey rowKey = trdp.getTableRow();
//        System.out.println(rowKey);
//        if ((Integer.parseInt(rowKey.getRowId()) % 2) == 0){
//            return " ";
//        }
//        else {
//            return "background-color: #eeeeee";
//        }
//    }    
    
    private void setNewUser()
    {
        
       NewUser u = new NewUser();               
       u = setUserTipo(u);
       u.setNumero_mecanografico("");
       u.setResponsavel_loja("n");
       u.setGestor_geral("n");               
       switch(u.getTipo().intValue())
       {
           case 1:  //seg
               if(chkSegResp.getSelected() != null)
               {
                   if(chkSegResp.getSelected().equals(new Boolean(true)))
                   {
                        u.setResponsavel_loja("y");                               
                   }
               }
               break;
           case 2:  //rh
               if(chkRhResp.getSelected() != null)
               {
                   if(chkRhResp.getSelected().equals(new Boolean(true)))
                   {
                        u.setResponsavel_loja("y");                               
                   }
               }
               break;  
           case 6:   //gestor   
               if(chkGestaoGeral.getSelected() != null)
               {
                   if(chkGestaoGeral.getSelected().equals(new Boolean(true)))
                   {
                        u.setGestor_geral("y");                               
                   }
               }

               break;
       }
       u.setEmpresa_id(getSessionBean1().getCurrentUser().getEmpresa_id());                                           
        
    }

    public String lnkNewUser_action() {
        // TODO: Replace with your code
        
        return null;
    }

    public String lnkAnalisesAcidente_action() {
        // TODO: Replace with your code
        Integer tipo_utilizador = getSessionBean1().getCurrentUser().getTipo();
        if(tipo_utilizador.intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_SIPRP)
        {
            return "form_dir_siprp";            
        }
        else if(tipo_utilizador.intValue() == Global.TIPO_UTILIZADOR_DIRECTOR_GERAL_RH)
        {
            return "form_dir_ger_rh";                        
        }
        
        return null;
    }

    public void rbCatRh_processValueChange(ValueChangeEvent event) {
        // TODO: Replace with your code
    }

    public void rbCatHs_processValueChange(ValueChangeEvent event) {
        // TODO: Replace with your code
        
    }

    public String lnkAjuda_action() {
        // TODO: Replace with your code
//        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)
//         {
//             ex.printStackTrace();
//         }                
        return null;
    }
}

