diff --git a/trunk/SIPRPSoft/src/SIPRPMap.map.xml b/trunk/SIPRPSoft/src/SIPRPMap.map.xml deleted file mode 100644 index a10c1e42..00000000 --- a/trunk/SIPRPSoft/src/SIPRPMap.map.xml +++ /dev/null @@ -1,1454 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - ORACLE - - - - - - - - - - ORACLE - ecd_oficial_id_seq - 1 - - - - - - - - ORACLE - email_plano_de_actuacao_id_seq - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ORACLE - etiquetas_id_seq - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ORACLE - exames_portaria_id_seq - 1 - - - - - - - - - - - - - - ORACLE - image_id_seq - 1 - - - - - - - - ORACLE - legislacao_id_seq - 1 - - - - - - - - - - - - - - - - - - - - - - - ORACLE - lembretes_id_seq - 1 - - - - - - - - - - ORACLE - lembretes_tipos_id_seq - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - ORACLE - marcacoes_grupos_realizados_id_seq - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ORACLE - marcacoes_trabalhador_estados_id_seq - 1 - - - - - - - - - - - - - ORACLE - medida_id_seq - 1 - - - - - - - ORACLE - posto_de_trabalho_id_seq - 1 - - - - - - - - - - - - - - - - - - - - - - ORACLE - prestadores_id_seq - 1 - - - - - - - - ORACLE - prestadores_grupos_protocolo_id_seq - 1 - - - - - - - - - ORACLE - prt_elementos_protocolo_id_seq - 1 - - - - - - - - - - - - - - - - - - - - - - - ORACLE - risco_id_seq - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ORACLE - trabalhadores_consultas_id_seq - 1 - - - - - - - - - - ORACLE - trabalhadores_consultas_datas_id_seq - 1 - - - - - - - - - - - ORACLE - trabalhadores_consultas_datas_emails_id_seq - 1 - - - - - - - - ORACLE - trabalhadores_consultas_datas_observacoes_id_seq - 1 - - - - - - - - - - - - - - ORACLE - trabalhadores_ecd_id_seq - 1 - - - - - - - - - - ORACLE - trabalhadores_ecds_id_seq - 1 - - - - - - - - - - - - - - - - - - - ORACLE - trabalhadores_ecds_datas_id_seq - 1 - - - - - - - - - - - ORACLE - trabalhadores_ecds_datas_emails_id_seq - 1 - - - - - - - - ORACLE - trabalhadores_ecds_datas_observacoes_id_seq - 1 - - - - - - - - ORACLE - trabalhadores_fichas_aptidao_id_seq - 1 - - - - - - - - - - - - - ORACLE - trabalhadores_processo_id_seq - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/trunk/SIPRPSoft/src/SIPRPNode.driver.xml b/trunk/SIPRPSoft/src/SIPRPNode.driver.xml index 897b3592..3c75ecb8 100644 --- a/trunk/SIPRPSoft/src/SIPRPNode.driver.xml +++ b/trunk/SIPRPSoft/src/SIPRPNode.driver.xml @@ -1,8 +1,6 @@ - - - + - + diff --git a/trunk/SIPRPSoft/src/cayenne.xml b/trunk/SIPRPSoft/src/cayenne.xml deleted file mode 100644 index f91ca29c..00000000 --- a/trunk/SIPRPSoft/src/cayenne.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - diff --git a/trunk/SIPRPSoft/src/siprp/Main.java b/trunk/SIPRPSoft/src/siprp/Main.java index 00b34c2a..e71cc39c 100644 --- a/trunk/SIPRPSoft/src/siprp/Main.java +++ b/trunk/SIPRPSoft/src/siprp/Main.java @@ -1,12 +1,12 @@ package siprp; -import static siprp.medicina.processo.ProcessoConstants.ESTADO_PROCESSO_BY_CODE; -import static siprp.medicina.processo.ProcessoConstants.PROCESSO_ABERTO_CODE; -import static siprp.medicina.processo.ProcessoConstants.PROCESSO_ABERTO_DESCRIPTION; -import static siprp.medicina.processo.ProcessoConstants.PROCESSO_CANCELADO_CODE; -import static siprp.medicina.processo.ProcessoConstants.PROCESSO_CANCELADO_DESCRIPTION; -import static siprp.medicina.processo.ProcessoConstants.PROCESSO_FECHADO_CODE; -import static siprp.medicina.processo.ProcessoConstants.PROCESSO_FECHADO_DESCRIPTION; +import static siprp.ProcessoConstants.ESTADO_PROCESSO_BY_CODE; +import static siprp.ProcessoConstants.PROCESSO_ABERTO_CODE; +import static siprp.ProcessoConstants.PROCESSO_ABERTO_DESCRIPTION; +import static siprp.ProcessoConstants.PROCESSO_CANCELADO_CODE; +import static siprp.ProcessoConstants.PROCESSO_CANCELADO_DESCRIPTION; +import static siprp.ProcessoConstants.PROCESSO_FECHADO_CODE; +import static siprp.ProcessoConstants.PROCESSO_FECHADO_DESCRIPTION; import java.awt.Color; import java.awt.GraphicsEnvironment; diff --git a/trunk/SIPRPSoft/src/siprp/SingletonConstants.java b/trunk/SIPRPSoft/src/siprp/SingletonConstants.java deleted file mode 100644 index 6d2170fc..00000000 --- a/trunk/SIPRPSoft/src/siprp/SingletonConstants.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * SingletonConstants.java - * - * Created on 25 de Maio de 2004, 13:34 - */ - -package siprp; - -/** - * - * @author fpalma - */ -public class SingletonConstants -{ - public static final String PERSISTENCE_MANAGER = "PERSISTENCE_MANAGER"; - public static final String SOFTWARE_NAME = "software_name"; - public static final String COMPANY_NAME = "company_name"; - public static final String COMPANY_LOGO = "company_logo"; - public static final String COMPANY_ACRONYM = "company_acronym"; - public static final String SUBJECT_CONSULTA = "subject_consulta"; - public static final String LETTER_CONSULTA = "letter_consulta"; - public static final String SUBJECT_CONSULTA_VACINAS = "subject_consulta_vacinas"; - public static final String LETTER_CONSULTA_VACINAS = "letter_consulta_vacinas"; - public static final String SUBJECT_EXAMES = "subject_exames"; - public static final String LETTER_EXAMES = "letter_exames"; - public static final String SUBJECT_VISITA = "subject_visita"; - public static final String LETTER_VISITA = "letter_visita"; - public static final String USES_HOUR = "uses_hour"; - public static final String CODIGO_EMPRESA_FORMAT = "codigo_empresa_format"; - public static final String FICHA_MARCA_EXAMES = "ficha_marca_exames"; - public static final String EXCEL_FORMAT = "excel_format"; - public static final String EXCEL_FORMAT_DEMISSAO = "excel_format_demissao"; - - public static final String MODULE_FICHA = "module_ficha"; - public static final String MODULE_CLIENTES = "module_clientes"; - public static final String WEB_AWARE = "web_aware"; - public static final String MODULE_RELATORIO = "module_relatorio"; - public static final String MODULE_LISTAGENS = "module_listagens"; - - public static final String WEB_USER = "web_user"; - public static final String WEB_PASSWORD = "web_password"; - public static final String WEB_URL_PREFIX = "web_url_prefix"; - public static final String WEB_URL = "web_url"; - public static final String WEB_DB_NAME = "web_db_name"; - public static final String WEB_DRIVER_NAME = "web_driver_name"; - - public static final String LOCAL_USER = "local_user"; - public static final String LOCAL_PASSWORD = "local_password"; - public static final String LOCAL_URL_PREFIX = "local_url_prefix"; - public static final String LOCAL_URL = "local_url"; - public static final String LOCAL_DB_NAME = "local_db_name"; - public static final String LOCAL_DRIVER_NAME = "local_driver_name"; - - public static final String SIPRP_TRACKER = "SIPRP_TRACKER"; - - /** Creates a new instance of SingletonConstants */ - private SingletonConstants() - { - } - -} diff --git a/trunk/SIPRPSoft/src/siprp/clientes/EstabelecimentoPlanoActuacaoPanel.java b/trunk/SIPRPSoft/src/siprp/clientes/EstabelecimentoPlanoActuacaoPanel.java index 109e260a..3863a565 100644 --- a/trunk/SIPRPSoft/src/siprp/clientes/EstabelecimentoPlanoActuacaoPanel.java +++ b/trunk/SIPRPSoft/src/siprp/clientes/EstabelecimentoPlanoActuacaoPanel.java @@ -1,481 +1,450 @@ package siprp.clientes; -import static com.evolute.utils.strings.UnicodeLatin1Map.aacute; -import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; -import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; -import static com.evolute.utils.strings.UnicodeLatin1Map.otilde; -import info.clearthought.layout.TableLayout; -import info.clearthought.layout.TableLayoutConstraints; - -import java.awt.Dimension; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Vector; - -import javax.swing.BorderFactory; -import javax.swing.JButton; -import javax.swing.JOptionPane; import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.ScrollPaneConstants; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; - -import org.apache.cayenne.CayenneDataObject; - -import siprp.database.cayenne.objects.EmailPlanoDeActuacao; -import siprp.database.cayenne.objects.Estabelecimentos; -import siprp.database.cayenne.objects.Legislacao; -import siprp.database.cayenne.objects.LegislacaoEstabelecimento; -import siprp.database.cayenne.objects.PostoDeTrabalho; -import siprp.database.cayenne.objects.PostoDeTrabalhoEstabelecimento; -import siprp.database.cayenne.providers.PlanoActuacaoDAO; import com.evolute.utils.dataui.ControllableComponent; -import com.evolute.utils.tables.VectorTableModel; public class EstabelecimentoPlanoActuacaoPanel extends JPanel implements ControllableComponent { - private static final long serialVersionUID = 1L; - - private static final Dimension PREFERRED_DIMENSION_EMAIL = new Dimension(200,0); - - private static final Dimension PREFERRED_DIMENSION_LEGISLACAO = new Dimension(400,0); - - private static final Dimension PREFERRED_DIMENSION_POSTO_TRABALHO = new Dimension(300,0); - - private final VectorTableModel modelEmail = new VectorTableModel( new String[]{ "Endere" + ccedil + "o" } ); - - private final VectorTableModel modelLegislacao = new VectorTableModel( new String[]{ "Descri" + ccedil + atilde + "o" } ); - - private final VectorTableModel modelPostoTrabalho= new VectorTableModel( new String[]{ "Descri" + ccedil + atilde + "o" } ); - - private final JTable tableEmail = new JTable( modelEmail ); - - private final JTable tableLegislacao = new JTable( modelLegislacao ); - - private final JTable tablePostoTrabalho = new JTable( modelPostoTrabalho ); - - private final JScrollPane scrollEmail = new JScrollPane( tableEmail, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER ); - - private final JScrollPane scrollLegislacao = new JScrollPane( tableLegislacao, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER ); - - private final JScrollPane scrollPostoTrabalho = new JScrollPane( tablePostoTrabalho, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER ); - - private final JPanel panelEmail = new JPanel(); - - private final JPanel panelLegislacao = new JPanel(); - - private final JPanel panelPostoTrabalho = new JPanel(); - - private final JButton buttonEmailAdicionar = new JButton("Adicionar"); - - private final JButton buttonLegislacaoAdicionar = new JButton("Adicionar"); - - private final JButton buttonPostoTrabalhoCriar = new JButton("Criar"); - - private final JButton buttonPostoTrabalhoEditar = new JButton("Editar"); - - private final JButton buttonPostoTrabalhoAdicionar = new JButton("Adicionar"); - - private final JButton buttonEmailRemover = new JButton("Remover"); - - private final JButton buttonLegislacaoRemover = new JButton("Remover"); - - private final JButton buttonPostoTrabalhoRemover = new JButton("Remover"); - - private final PlanoActuacaoDAO provider = new PlanoActuacaoDAO(); - - private Estabelecimentos estabelecimento = null; - +// private static final long serialVersionUID = 1L; +// +// private static final Dimension PREFERRED_DIMENSION_EMAIL = new Dimension(200,0); +// +// private static final Dimension PREFERRED_DIMENSION_LEGISLACAO = new Dimension(400,0); +// +// private static final Dimension PREFERRED_DIMENSION_POSTO_TRABALHO = new Dimension(300,0); +// +// private final VectorTableModel modelEmail = new VectorTableModel( new String[]{ "Endere" + ccedil + "o" } ); +// +// private final VectorTableModel modelLegislacao = new VectorTableModel( new String[]{ "Descri" + ccedil + atilde + "o" } ); +// +// private final VectorTableModel modelPostoTrabalho= new VectorTableModel( new String[]{ "Descri" + ccedil + atilde + "o" } ); +// +// private final JTable tableEmail = new JTable( modelEmail ); +// +// private final JTable tableLegislacao = new JTable( modelLegislacao ); +// +// private final JTable tablePostoTrabalho = new JTable( modelPostoTrabalho ); +// +// private final JScrollPane scrollEmail = new JScrollPane( tableEmail, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER ); +// +// private final JScrollPane scrollLegislacao = new JScrollPane( tableLegislacao, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER ); +// +// private final JScrollPane scrollPostoTrabalho = new JScrollPane( tablePostoTrabalho, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER ); +// +// private final JPanel panelEmail = new JPanel(); +// +// private final JPanel panelLegislacao = new JPanel(); +// +// private final JPanel panelPostoTrabalho = new JPanel(); +// +// private final JButton buttonEmailAdicionar = new JButton("Adicionar"); +// +// private final JButton buttonLegislacaoAdicionar = new JButton("Adicionar"); +// +// private final JButton buttonPostoTrabalhoCriar = new JButton("Criar"); +// +// private final JButton buttonPostoTrabalhoEditar = new JButton("Editar"); +// +// private final JButton buttonPostoTrabalhoAdicionar = new JButton("Adicionar"); +// +// private final JButton buttonEmailRemover = new JButton("Remover"); +// +// private final JButton buttonLegislacaoRemover = new JButton("Remover"); +// +// private final JButton buttonPostoTrabalhoRemover = new JButton("Remover"); +// +// private final PlanoActuacaoDAO provider = new PlanoActuacaoDAO(); +// +// private Estabelecimentos estabelecimento = null; +// public EstabelecimentoPlanoActuacaoPanel() { - startupComponents(); - startupLayout(); - placeComponents(); - startupListeners(); - } - - private void startupLayout() - { - startupEmailLayout(); - startupPostoTrabalhoLayout(); - startupLegislacaoLayout(); - double [] cols = new double[]{ TableLayout.FILL, TableLayout.FILL, TableLayout.PREFERRED }; - double [] rows = new double[]{ TableLayout.FILL }; - TableLayout layout = new TableLayout(cols,rows); - layout.setHGap( 5 ); - layout.setVGap( 5 ); - this.setLayout( layout ); - } - - private void startupEmailLayout() - { - double [] cols = new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL }; - double [] rows = new double[]{ TableLayout.FILL, TableLayout.MINIMUM }; - TableLayout layout = new TableLayout(cols,rows); - layout.setHGap( 5 ); - layout.setVGap( 5 ); - panelEmail.setLayout( layout ); - } - - private void startupPostoTrabalhoLayout() - { - double [] cols = new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL }; - double [] rows = new double[]{ TableLayout.FILL, TableLayout.MINIMUM }; - TableLayout layout = new TableLayout(cols,rows); - layout.setHGap( 5 ); - layout.setVGap( 5 ); - panelPostoTrabalho.setLayout( layout ); - } - - private void startupLegislacaoLayout() - { - double [] cols = new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL }; - double [] rows = new double[]{ TableLayout.FILL, TableLayout.MINIMUM }; - TableLayout layout = new TableLayout(cols,rows); - layout.setHGap( 5 ); - layout.setVGap( 5 ); - panelLegislacao.setLayout( layout ); - } - - private void startupComponents() - { - panelLegislacao.setPreferredSize( PREFERRED_DIMENSION_LEGISLACAO ); - panelLegislacao.setBorder( BorderFactory.createTitledBorder( "Legisla" + ccedil + otilde + "es" ) ); - - panelPostoTrabalho.setPreferredSize( PREFERRED_DIMENSION_POSTO_TRABALHO ); - panelPostoTrabalho.setBorder( BorderFactory.createTitledBorder( "Postos de trabalho" ) ); - - panelEmail.setPreferredSize( PREFERRED_DIMENSION_EMAIL ); - panelEmail.setBorder( BorderFactory.createTitledBorder( "E-mails" ) ); - - buttonEmailAdicionar.setEnabled( false ); - buttonEmailRemover.setEnabled( false ); - - buttonLegislacaoAdicionar.setEnabled( false ); - buttonLegislacaoRemover.setEnabled( false ); - - buttonPostoTrabalhoCriar.setEnabled( false ); - buttonPostoTrabalhoEditar.setEnabled( false ); - buttonPostoTrabalhoAdicionar.setEnabled( false ); - buttonPostoTrabalhoRemover.setEnabled( false ); - } - - private void placeComponents() - { - - panelEmail.add( scrollEmail, new TableLayoutConstraints( 0, 0, 2, 0 ) ); - panelEmail.add( buttonEmailAdicionar, new TableLayoutConstraints( 0, 1 ) ); - panelEmail.add( buttonEmailRemover, new TableLayoutConstraints( 1, 1 ) ); - - panelLegislacao.add( scrollLegislacao, new TableLayoutConstraints( 0, 0, 2, 0 ) ); - panelLegislacao.add( buttonLegislacaoAdicionar, new TableLayoutConstraints( 0, 1 ) ); - panelLegislacao.add( buttonLegislacaoRemover, new TableLayoutConstraints( 1, 1 ) ); - - panelPostoTrabalho.add( scrollPostoTrabalho, new TableLayoutConstraints( 0, 0, 4, 0 ) ); - panelPostoTrabalho.add( buttonPostoTrabalhoCriar, new TableLayoutConstraints( 0, 1 ) ); - panelPostoTrabalho.add( buttonPostoTrabalhoEditar, new TableLayoutConstraints( 1, 1 ) ); - panelPostoTrabalho.add( buttonPostoTrabalhoAdicionar, new TableLayoutConstraints( 2, 1 ) ); - panelPostoTrabalho.add( buttonPostoTrabalhoRemover, new TableLayoutConstraints( 3, 1 ) ); - - this.add( panelLegislacao, new TableLayoutConstraints( 0,0 ) ); - this.add( panelPostoTrabalho, new TableLayoutConstraints( 1,0 ) ); - this.add( panelEmail, new TableLayoutConstraints( 2,0 ) ); - - } - - private void refresh() - { - clear(); - load(); - } - - private void load() - { - if( estabelecimento != null ) - { - modelEmail.setValues( new Vector( estabelecimento.getEmailPlanoDeActuacaoArray() ) ); - modelLegislacao.setValues( new Vector( estabelecimento.getLegislacaoEstabelecimentoArray() ) ); - modelPostoTrabalho.setValues( new Vector( estabelecimento.getPostoDeTrabalhoEstabelecimentoArray() ) ); - } - } - - private void startupListeners() - { - buttonEmailAdicionar.addActionListener( new ActionListener() - { - @Override - public void actionPerformed( ActionEvent e ) - { - adicionarEmail(); - } - } ); - buttonEmailRemover.addActionListener( new ActionListener() - { - @Override - public void actionPerformed( ActionEvent e ) - { - removeSelected(tableEmail); - } - } ); - buttonLegislacaoAdicionar.addActionListener( new ActionListener() - { - @Override - public void actionPerformed( ActionEvent e ) - { - adicionarLegislacao(); - } - } ); - buttonLegislacaoRemover.addActionListener( new ActionListener() - { - @Override - public void actionPerformed( ActionEvent e ) - { - removeSelected(tableLegislacao); - } - } ); - buttonPostoTrabalhoCriar.addActionListener( new ActionListener() - { - @Override - public void actionPerformed( ActionEvent e ) - { - criarPostoTrabalho(); - } - } ); - buttonPostoTrabalhoEditar.addActionListener( new ActionListener() - { - @Override - public void actionPerformed( ActionEvent e ) - { - alterarPostoTrabalho(); - } - } ); - buttonPostoTrabalhoAdicionar.addActionListener( new ActionListener() - { - @Override - public void actionPerformed( ActionEvent e ) - { - adicionarPostoTrabalho(); - } - } ); - buttonPostoTrabalhoRemover.addActionListener( new ActionListener() - { - @Override - public void actionPerformed( ActionEvent e ) - { - removeSelected(tablePostoTrabalho); - } - } ); - tableEmail.getSelectionModel().addListSelectionListener( new ListSelectionListener() - { - @Override - public void valueChanged( ListSelectionEvent e ) - { - if( !e.getValueIsAdjusting() ) - { - buttonEmailRemover.setEnabled( tableEmail.getSelectedRowCount() > 0 ); - } - } - } ); - tableLegislacao.getSelectionModel().addListSelectionListener( new ListSelectionListener() - { - @Override - public void valueChanged( ListSelectionEvent e ) - { - if( !e.getValueIsAdjusting() ) - { - buttonLegislacaoRemover.setEnabled( tableLegislacao.getSelectedRowCount() > 0 ); - } - } - } ); - tablePostoTrabalho.getSelectionModel().addListSelectionListener( new ListSelectionListener() - { - @Override - public void valueChanged( ListSelectionEvent e ) - { - if( !e.getValueIsAdjusting() ) - { - buttonPostoTrabalhoEditar.setEnabled( tablePostoTrabalho.getSelectedRowCount() > 0 ); - buttonPostoTrabalhoRemover.setEnabled( tablePostoTrabalho.getSelectedRowCount() > 0 ); - } - } - } ); - } - - private void adicionarLegislacao() - { - Legislacao [] legislacoes = provider.getAllLegislacoesNotInEstabelecimento( estabelecimento ); - Legislacao legislacao = (Legislacao) JOptionPane.showInputDialog( - this, - "Legisla" + ccedil + otilde + "es", - "Adicionar legisla" + ccedil + atilde + "o", JOptionPane.QUESTION_MESSAGE, null, legislacoes, null ); - adicionarLegislacao( legislacao ); - } - - private void adicionarLegislacao( Legislacao legislacao ) - { - if( legislacao != null ) - { - provider.addLegislacaoToEstabelecimento( legislacao, estabelecimento ); - refresh(); - } - } - - private void criarPostoTrabalho() - { - String postoTrabalho = JOptionPane.showInputDialog( "Criar posto de trabalho" ); - PostoDeTrabalho postoTrabalhoObject = criarPostoTrabalho( postoTrabalho ); - if( postoTrabalhoObject != null ) - { - adicionarPostoTrabalho( postoTrabalhoObject ); - } - } - - private PostoDeTrabalho criarPostoTrabalho( String postoTrabalho ) - { - PostoDeTrabalho result = null; - if( postoTrabalho != null ) - { - if( postoTrabalho.trim().length() > 0 ) - { - postoTrabalho = postoTrabalho.trim(); - result = provider.createPostoTrabalho( postoTrabalho ); - } - else - { - JOptionPane.showMessageDialog( this, "Posto de trabalho inv" + aacute + "lido", "Erro", JOptionPane.ERROR_MESSAGE, null ); - } - } - return result; - } - - private PostoDeTrabalhoEstabelecimento getSelectedPostoTrabalhoRel() - { - PostoDeTrabalhoEstabelecimento result = null; - int index = tablePostoTrabalho.getSelectedRow(); - if( index != -1 ) - { - result = modelPostoTrabalho.getRowAt( index ); - } - return result; - } - - private void alterarPostoTrabalho() - { - PostoDeTrabalhoEstabelecimento rel = getSelectedPostoTrabalhoRel(); - if( rel != null ) - { - String newDescription = JOptionPane.showInputDialog( "Editar medida", rel.getToPostoDeTrabalho().getDescription() ); - if( newDescription != null ) - { - if( newDescription.trim().length() > 0 ) - { - rel.getToPostoDeTrabalho().setDescription( newDescription ); - provider.commit(); - refresh(); - } - else - { - JOptionPane.showMessageDialog( this, "Medida inv" + aacute + "lida", "Erro", JOptionPane.ERROR_MESSAGE, null ); - } - } - } - } - - private void adicionarPostoTrabalho() - { - PostoDeTrabalho [] postos = provider.getAllPostosNotInEstabelecimento( estabelecimento ); - PostoDeTrabalho postoDeTrabalho = (PostoDeTrabalho) JOptionPane.showInputDialog( - this, - "Postos de trabalho", - "Adicionar posto de trabalho", - JOptionPane.QUESTION_MESSAGE, - null, - postos, - null - ); - adicionarPostoTrabalho( postoDeTrabalho ); - } - - private void adicionarPostoTrabalho( PostoDeTrabalho postoTrabalho ) - { - if( postoTrabalho != null ) - { - provider.addPostoTrabalhoToEstabelecimento( postoTrabalho, estabelecimento ); - refresh(); - } - } - - private void adicionarEmail() - { - adicionarEmail( JOptionPane.showInputDialog( "Inserir e-mail" ) ); - } - - private void adicionarEmail( String email ) - { - if( email != null && email.trim().length() > 0 ) - { - email = email.trim(); - boolean valid = email.toUpperCase().matches( "[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}" ); - if( valid ) - { - provider.addEmailToEstabelecimento( email, estabelecimento); - refresh(); - } - else - { - JOptionPane.showMessageDialog( this, "Endere" + ccedil + "o de e-mail inv" + aacute + "lido", "Erro", JOptionPane.ERROR_MESSAGE, null ); - } - } - } - - private void removeSelected( JTable table ) - { - VectorTableModel model = (VectorTableModel) table.getModel(); - int indexes [] = table.getSelectedRows(); - if( indexes != null && indexes.length > 0 ) - { - for( int i = 0; i < indexes.length; ++i ) - { - removeSelected( model, indexes[i] ); - } - refresh(); - } - } - - private void removeSelected( VectorTableModel model, int index ) - { - provider.delete( model.getRowAt( index ) ); +// startupComponents(); +// startupLayout(); +// placeComponents(); +// startupListeners(); } +// +// private void startupLayout() +// { +// startupEmailLayout(); +// startupPostoTrabalhoLayout(); +// startupLegislacaoLayout(); +// double [] cols = new double[]{ TableLayout.FILL, TableLayout.FILL, TableLayout.PREFERRED }; +// double [] rows = new double[]{ TableLayout.FILL }; +// TableLayout layout = new TableLayout(cols,rows); +// layout.setHGap( 5 ); +// layout.setVGap( 5 ); +// this.setLayout( layout ); +// } +// +// private void startupEmailLayout() +// { +// double [] cols = new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL }; +// double [] rows = new double[]{ TableLayout.FILL, TableLayout.MINIMUM }; +// TableLayout layout = new TableLayout(cols,rows); +// layout.setHGap( 5 ); +// layout.setVGap( 5 ); +// panelEmail.setLayout( layout ); +// } +// +// private void startupPostoTrabalhoLayout() +// { +// double [] cols = new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL }; +// double [] rows = new double[]{ TableLayout.FILL, TableLayout.MINIMUM }; +// TableLayout layout = new TableLayout(cols,rows); +// layout.setHGap( 5 ); +// layout.setVGap( 5 ); +// panelPostoTrabalho.setLayout( layout ); +// } +// +// private void startupLegislacaoLayout() +// { +// double [] cols = new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL }; +// double [] rows = new double[]{ TableLayout.FILL, TableLayout.MINIMUM }; +// TableLayout layout = new TableLayout(cols,rows); +// layout.setHGap( 5 ); +// layout.setVGap( 5 ); +// panelLegislacao.setLayout( layout ); +// } +// +// private void startupComponents() +// { +// panelLegislacao.setPreferredSize( PREFERRED_DIMENSION_LEGISLACAO ); +// panelLegislacao.setBorder( BorderFactory.createTitledBorder( "Legisla" + ccedil + otilde + "es" ) ); +// +// panelPostoTrabalho.setPreferredSize( PREFERRED_DIMENSION_POSTO_TRABALHO ); +// panelPostoTrabalho.setBorder( BorderFactory.createTitledBorder( "Postos de trabalho" ) ); +// +// panelEmail.setPreferredSize( PREFERRED_DIMENSION_EMAIL ); +// panelEmail.setBorder( BorderFactory.createTitledBorder( "E-mails" ) ); +// +// buttonEmailAdicionar.setEnabled( false ); +// buttonEmailRemover.setEnabled( false ); +// +// buttonLegislacaoAdicionar.setEnabled( false ); +// buttonLegislacaoRemover.setEnabled( false ); +// +// buttonPostoTrabalhoCriar.setEnabled( false ); +// buttonPostoTrabalhoEditar.setEnabled( false ); +// buttonPostoTrabalhoAdicionar.setEnabled( false ); +// buttonPostoTrabalhoRemover.setEnabled( false ); +// } +// +// private void placeComponents() +// { +// +// panelEmail.add( scrollEmail, new TableLayoutConstraints( 0, 0, 2, 0 ) ); +// panelEmail.add( buttonEmailAdicionar, new TableLayoutConstraints( 0, 1 ) ); +// panelEmail.add( buttonEmailRemover, new TableLayoutConstraints( 1, 1 ) ); +// +// panelLegislacao.add( scrollLegislacao, new TableLayoutConstraints( 0, 0, 2, 0 ) ); +// panelLegislacao.add( buttonLegislacaoAdicionar, new TableLayoutConstraints( 0, 1 ) ); +// panelLegislacao.add( buttonLegislacaoRemover, new TableLayoutConstraints( 1, 1 ) ); +// +// panelPostoTrabalho.add( scrollPostoTrabalho, new TableLayoutConstraints( 0, 0, 4, 0 ) ); +// panelPostoTrabalho.add( buttonPostoTrabalhoCriar, new TableLayoutConstraints( 0, 1 ) ); +// panelPostoTrabalho.add( buttonPostoTrabalhoEditar, new TableLayoutConstraints( 1, 1 ) ); +// panelPostoTrabalho.add( buttonPostoTrabalhoAdicionar, new TableLayoutConstraints( 2, 1 ) ); +// panelPostoTrabalho.add( buttonPostoTrabalhoRemover, new TableLayoutConstraints( 3, 1 ) ); +// +// this.add( panelLegislacao, new TableLayoutConstraints( 0,0 ) ); +// this.add( panelPostoTrabalho, new TableLayoutConstraints( 1,0 ) ); +// this.add( panelEmail, new TableLayoutConstraints( 2,0 ) ); +// +// } +// +// private void refresh() +// { +// clear(); +// load(); +// } +// +// private void load() +// { +// if( estabelecimento != null ) +// { +// modelEmail.setValues( new Vector( estabelecimento.getEmailPlanoDeActuacaoArray() ) ); +// modelLegislacao.setValues( new Vector( estabelecimento.getLegislacaoEstabelecimentoArray() ) ); +// modelPostoTrabalho.setValues( new Vector( estabelecimento.getPostoDeTrabalhoEstabelecimentoArray() ) ); +// } +// } +// +// private void startupListeners() +// { +// buttonEmailAdicionar.addActionListener( new ActionListener() +// { +// @Override +// public void actionPerformed( ActionEvent e ) +// { +// adicionarEmail(); +// } +// } ); +// buttonEmailRemover.addActionListener( new ActionListener() +// { +// @Override +// public void actionPerformed( ActionEvent e ) +// { +// removeSelected(tableEmail); +// } +// } ); +// buttonLegislacaoAdicionar.addActionListener( new ActionListener() +// { +// @Override +// public void actionPerformed( ActionEvent e ) +// { +// adicionarLegislacao(); +// } +// } ); +// buttonLegislacaoRemover.addActionListener( new ActionListener() +// { +// @Override +// public void actionPerformed( ActionEvent e ) +// { +// removeSelected(tableLegislacao); +// } +// } ); +// buttonPostoTrabalhoCriar.addActionListener( new ActionListener() +// { +// @Override +// public void actionPerformed( ActionEvent e ) +// { +// criarPostoTrabalho(); +// } +// } ); +// buttonPostoTrabalhoEditar.addActionListener( new ActionListener() +// { +// @Override +// public void actionPerformed( ActionEvent e ) +// { +// alterarPostoTrabalho(); +// } +// } ); +// buttonPostoTrabalhoAdicionar.addActionListener( new ActionListener() +// { +// @Override +// public void actionPerformed( ActionEvent e ) +// { +// adicionarPostoTrabalho(); +// } +// } ); +// buttonPostoTrabalhoRemover.addActionListener( new ActionListener() +// { +// @Override +// public void actionPerformed( ActionEvent e ) +// { +// removeSelected(tablePostoTrabalho); +// } +// } ); +// tableEmail.getSelectionModel().addListSelectionListener( new ListSelectionListener() +// { +// @Override +// public void valueChanged( ListSelectionEvent e ) +// { +// if( !e.getValueIsAdjusting() ) +// { +// buttonEmailRemover.setEnabled( tableEmail.getSelectedRowCount() > 0 ); +// } +// } +// } ); +// tableLegislacao.getSelectionModel().addListSelectionListener( new ListSelectionListener() +// { +// @Override +// public void valueChanged( ListSelectionEvent e ) +// { +// if( !e.getValueIsAdjusting() ) +// { +// buttonLegislacaoRemover.setEnabled( tableLegislacao.getSelectedRowCount() > 0 ); +// } +// } +// } ); +// tablePostoTrabalho.getSelectionModel().addListSelectionListener( new ListSelectionListener() +// { +// @Override +// public void valueChanged( ListSelectionEvent e ) +// { +// if( !e.getValueIsAdjusting() ) +// { +// buttonPostoTrabalhoEditar.setEnabled( tablePostoTrabalho.getSelectedRowCount() > 0 ); +// buttonPostoTrabalhoRemover.setEnabled( tablePostoTrabalho.getSelectedRowCount() > 0 ); +// } +// } +// } ); +// } +// +// private void adicionarLegislacao() +// { +// Legislacao [] legislacoes = provider.getAllLegislacoesNotInEstabelecimento( estabelecimento ); +// Legislacao legislacao = (Legislacao) JOptionPane.showInputDialog( +// this, +// "Legisla" + ccedil + otilde + "es", +// "Adicionar legisla" + ccedil + atilde + "o", JOptionPane.QUESTION_MESSAGE, null, legislacoes, null ); +// adicionarLegislacao( legislacao ); +// } +// +// private void adicionarLegislacao( Legislacao legislacao ) +// { +// if( legislacao != null ) +// { +// provider.addLegislacaoToEstabelecimento( legislacao, estabelecimento ); +// refresh(); +// } +// } +// +// private void criarPostoTrabalho() +// { +// String postoTrabalho = JOptionPane.showInputDialog( "Criar posto de trabalho" ); +// PostoDeTrabalho postoTrabalhoObject = criarPostoTrabalho( postoTrabalho ); +// if( postoTrabalhoObject != null ) +// { +// adicionarPostoTrabalho( postoTrabalhoObject ); +// } +// } +// +// private PostoDeTrabalho criarPostoTrabalho( String postoTrabalho ) +// { +// PostoDeTrabalho result = null; +// if( postoTrabalho != null ) +// { +// if( postoTrabalho.trim().length() > 0 ) +// { +// postoTrabalho = postoTrabalho.trim(); +// result = provider.createPostoTrabalho( postoTrabalho ); +// } +// else +// { +// JOptionPane.showMessageDialog( this, "Posto de trabalho inv" + aacute + "lido", "Erro", JOptionPane.ERROR_MESSAGE, null ); +// } +// } +// return result; +// } +// +// private PostoDeTrabalhoEstabelecimento getSelectedPostoTrabalhoRel() +// { +// PostoDeTrabalhoEstabelecimento result = null; +// int index = tablePostoTrabalho.getSelectedRow(); +// if( index != -1 ) +// { +// result = modelPostoTrabalho.getRowAt( index ); +// } +// return result; +// } +// +// private void alterarPostoTrabalho() +// { +// PostoDeTrabalhoEstabelecimento rel = getSelectedPostoTrabalhoRel(); +// if( rel != null ) +// { +// String newDescription = JOptionPane.showInputDialog( "Editar medida", rel.getToPostoDeTrabalho().getDescription() ); +// if( newDescription != null ) +// { +// if( newDescription.trim().length() > 0 ) +// { +// rel.getToPostoDeTrabalho().setDescription( newDescription ); +// provider.commit(); +// refresh(); +// } +// else +// { +// JOptionPane.showMessageDialog( this, "Medida inv" + aacute + "lida", "Erro", JOptionPane.ERROR_MESSAGE, null ); +// } +// } +// } +// } +// +// private void adicionarPostoTrabalho() +// { +// PostoDeTrabalho [] postos = provider.getAllPostosNotInEstabelecimento( estabelecimento ); +// PostoDeTrabalho postoDeTrabalho = (PostoDeTrabalho) JOptionPane.showInputDialog( +// this, +// "Postos de trabalho", +// "Adicionar posto de trabalho", +// JOptionPane.QUESTION_MESSAGE, +// null, +// postos, +// null +// ); +// adicionarPostoTrabalho( postoDeTrabalho ); +// } +// +// private void adicionarPostoTrabalho( PostoDeTrabalho postoTrabalho ) +// { +// if( postoTrabalho != null ) +// { +// provider.addPostoTrabalhoToEstabelecimento( postoTrabalho, estabelecimento ); +// refresh(); +// } +// } +// +// private void adicionarEmail() +// { +// adicionarEmail( JOptionPane.showInputDialog( "Inserir e-mail" ) ); +// } +// +// private void adicionarEmail( String email ) +// { +// if( email != null && email.trim().length() > 0 ) +// { +// email = email.trim(); +// boolean valid = email.toUpperCase().matches( "[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}" ); +// if( valid ) +// { +// provider.addEmailToEstabelecimento( email, estabelecimento); +// refresh(); +// } +// else +// { +// JOptionPane.showMessageDialog( this, "Endere" + ccedil + "o de e-mail inv" + aacute + "lido", "Erro", JOptionPane.ERROR_MESSAGE, null ); +// } +// } +// } +// +// private void removeSelected( JTable table ) +// { +// VectorTableModel model = (VectorTableModel) table.getModel(); +// int indexes [] = table.getSelectedRows(); +// if( indexes != null && indexes.length > 0 ) +// { +// for( int i = 0; i < indexes.length; ++i ) +// { +// removeSelected( model, indexes[i] ); +// } +// refresh(); +// } +// } +// +// private void removeSelected( VectorTableModel model, int index ) +// { +// provider.delete( model.getRowAt( index ) ); +// } @Override public void clear() { - modelEmail.clearAll(); - modelLegislacao.clearAll(); - modelPostoTrabalho.clearAll(); +// modelEmail.clearAll(); +// modelLegislacao.clearAll(); +// modelPostoTrabalho.clearAll(); } @Override public void fill( Object value ) { - if( value != null ) - { - if( value instanceof Integer ) - { - estabelecimento = provider.getEstabelecimentoByID( (Integer) value ); - } - setEnabled( true ); - } - else - { - estabelecimento = null; - setEnabled( false ); - } - refresh(); +// if( value != null ) +// { +// if( value instanceof Integer ) +// { +// estabelecimento = provider.getEstabelecimentoByID( (Integer) value ); +// } +// setEnabled( true ); +// } +// else +// { +// estabelecimento = null; +// setEnabled( false ); +// } +// refresh(); } @Override @@ -487,16 +456,16 @@ public class EstabelecimentoPlanoActuacaoPanel extends JPanel implements Control @Override public void setEnabled( boolean enabled ) { - tableEmail.setEnabled( enabled ); - tableLegislacao.setEnabled( enabled ); - tablePostoTrabalho.setEnabled( enabled ); - buttonEmailAdicionar.setEnabled( enabled ); - buttonLegislacaoAdicionar.setEnabled( enabled ); - buttonPostoTrabalhoAdicionar.setEnabled( enabled ); - buttonPostoTrabalhoCriar.setEnabled( enabled ); - tableEmail.clearSelection(); - tableLegislacao.clearSelection(); - tablePostoTrabalho.clearSelection(); +// tableEmail.setEnabled( enabled ); +// tableLegislacao.setEnabled( enabled ); +// tablePostoTrabalho.setEnabled( enabled ); +// buttonEmailAdicionar.setEnabled( enabled ); +// buttonLegislacaoAdicionar.setEnabled( enabled ); +// buttonPostoTrabalhoAdicionar.setEnabled( enabled ); +// buttonPostoTrabalhoCriar.setEnabled( enabled ); +// tableEmail.clearSelection(); +// tableLegislacao.clearSelection(); +// tablePostoTrabalho.clearSelection(); } }