|
|
|
|
@ -18,24 +18,27 @@ import java.awt.GridLayout;
|
|
|
|
|
import java.awt.event.ActionEvent;
|
|
|
|
|
import java.awt.event.ActionListener;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import javax.swing.AbstractButton;
|
|
|
|
|
import javax.swing.JButton;
|
|
|
|
|
import javax.swing.JFrame;
|
|
|
|
|
import javax.swing.JPanel;
|
|
|
|
|
import javax.swing.JToggleButton;
|
|
|
|
|
import javax.swing.SwingUtilities;
|
|
|
|
|
import siprp.medicina.MedicinaConstants;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @author Frederico
|
|
|
|
|
*/
|
|
|
|
|
public class EscolherMotivoDialog extends CustomJDialog
|
|
|
|
|
implements ActionListener
|
|
|
|
|
implements ActionListener, MedicinaConstants
|
|
|
|
|
{
|
|
|
|
|
protected IDObject MOTIVOS[] =
|
|
|
|
|
new IDObject[]{
|
|
|
|
|
new MappableObject( new Integer( 1 ), "Admiss\u00e3o" ),
|
|
|
|
|
new MappableObject( new Integer( 2 ), "Peri\u00f3dico" ),
|
|
|
|
|
new MappableObject( new Integer( 5 ), "Peri\u00f3dico inicial" ),
|
|
|
|
|
new MappableObject( new Integer( 3 ), "Ocasional" )
|
|
|
|
|
new MappableObject( MOTIVO_ADMISSAO_INTEGER, MOTIVO_ADMISSAO_STR ),
|
|
|
|
|
new MappableObject( MOTIVO_PERIODICO_INTEGER, MOTIVO_PERIODICO_STR ),
|
|
|
|
|
new MappableObject( MOTIVO_PERIODICO_INICIAL_INTEGER, MOTIVO_PERIODICO_INICIAL_STR ),
|
|
|
|
|
new MappableObject( MOTIVO_OCASIONAL_INTEGER, MOTIVO_OCASIONAL_STR )
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
protected IDObject SUB_MOTIVOS[][] =
|
|
|
|
|
@ -43,23 +46,24 @@ public class EscolherMotivoDialog extends CustomJDialog
|
|
|
|
|
{},
|
|
|
|
|
{},
|
|
|
|
|
{},
|
|
|
|
|
{ new MappableObject( new Integer( 1 ), "Ap\u00f3s doen\u00e7a" ),
|
|
|
|
|
new MappableObject( new Integer( 2 ), "Ap\u00f3s acidente" ),
|
|
|
|
|
new MappableObject( new Integer( 3 ), "A pedido do trabalhador" ),
|
|
|
|
|
new MappableObject( new Integer( 4 ), "A pedido do servi\u00e7o" ),
|
|
|
|
|
new MappableObject( new Integer( 5 ), "Por mudan\u00e7a de fun\u00e7\u00e3o" ),
|
|
|
|
|
new MappableObject( new Integer( 6 ), "Por altera\u00e7\u00e3o das condi\u00e7\u00f5es de trabalho" ),
|
|
|
|
|
new MappableObject( new Integer( 10 ), "Outro" )
|
|
|
|
|
{ new MappableObject( SUB_MOTIVO_APOS_DOENCA_INTEGER, SUB_MOTIVO_APOS_DOENCA_STR ),
|
|
|
|
|
new MappableObject( SUB_MOTIVO_APOS_ACIDENTE_INTEGER, SUB_MOTIVO_APOS_ACIDENTE_STR ),
|
|
|
|
|
new MappableObject( SUB_MOTIVO_PEDIDO_TRABALHADOR_INTEGER, SUB_MOTIVO_PEDIDO_TRABALHADOR_STR ),
|
|
|
|
|
new MappableObject( SUB_MOTIVO_PEDIDO_SERVICO_INTEGER, SUB_MOTIVO_PEDIDO_SERVICO_STR ),
|
|
|
|
|
new MappableObject( SUB_MOTIVO_MUDANCA_FUNCAO_INTEGER, SUB_MOTIVO_MUDANCA_FUNCAO_STR ),
|
|
|
|
|
new MappableObject( SUB_MOTIVO_ALTERACAO_CONDICOES_INTEGER, SUB_MOTIVO_ALTERACAO_CONDICOES_STR ),
|
|
|
|
|
new MappableObject( SUB_MOTIVO_OUTRO_INTEGER, SUB_MOTIVO_OUTRO_STR )
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
protected JButton motivoButtons[];
|
|
|
|
|
protected HashMap<JButton,JButton[]> subMotivoButtons;
|
|
|
|
|
protected HashMap<JButton,Integer> motivoButtonIDs;
|
|
|
|
|
protected AbstractButton motivoButtons[];
|
|
|
|
|
protected HashMap<AbstractButton,JButton[]> subMotivoButtons;
|
|
|
|
|
protected HashMap<AbstractButton,Integer> motivoButtonIDs;
|
|
|
|
|
protected HashMap<JButton,Integer> subMotivoButtonIDs;
|
|
|
|
|
protected JPanel motivoPanel;
|
|
|
|
|
protected JPanel subMotivoPanel;
|
|
|
|
|
|
|
|
|
|
protected Integer motivoTemp;
|
|
|
|
|
protected Integer motivo;
|
|
|
|
|
protected Integer subMotivo;
|
|
|
|
|
|
|
|
|
|
@ -83,13 +87,13 @@ public class EscolherMotivoDialog extends CustomJDialog
|
|
|
|
|
{
|
|
|
|
|
setTitle( "Escolher Motivo" );
|
|
|
|
|
setLayout( new FlowLayout( FlowLayout.LEFT ) );
|
|
|
|
|
motivoButtons = new JButton[ MOTIVOS.length ];
|
|
|
|
|
subMotivoButtons = new HashMap<JButton,JButton[]>();
|
|
|
|
|
motivoButtonIDs = new HashMap<JButton,Integer>();
|
|
|
|
|
motivoButtons = new JToggleButton[ MOTIVOS.length ];
|
|
|
|
|
subMotivoButtons = new HashMap<AbstractButton,JButton[]>();
|
|
|
|
|
motivoButtonIDs = new HashMap<AbstractButton,Integer>();
|
|
|
|
|
subMotivoButtonIDs = new HashMap<JButton,Integer>();
|
|
|
|
|
for( int m = 0; m < MOTIVOS.length; m++ )
|
|
|
|
|
{
|
|
|
|
|
JButton motivoButton = new JButton( MOTIVOS[ m ].toString() );
|
|
|
|
|
JToggleButton motivoButton = new JToggleButton( MOTIVOS[ m ].toString() );
|
|
|
|
|
motivoButton.addActionListener( this );
|
|
|
|
|
motivoButtonIDs.put( motivoButton, MOTIVOS[ m ].getID() );
|
|
|
|
|
motivoButton.setPreferredSize( new Dimension( 250, 20 ) );
|
|
|
|
|
@ -129,13 +133,14 @@ public class EscolherMotivoDialog extends CustomJDialog
|
|
|
|
|
|
|
|
|
|
public void actionPerformed(ActionEvent e)
|
|
|
|
|
{
|
|
|
|
|
JButton source = ( JButton ) e.getSource();
|
|
|
|
|
AbstractButton source = ( AbstractButton ) e.getSource();
|
|
|
|
|
if( motivoButtonIDs.containsKey( source ) )
|
|
|
|
|
{
|
|
|
|
|
motivo = motivoButtonIDs.get( source );
|
|
|
|
|
motivoTemp = motivoButtonIDs.get( source );
|
|
|
|
|
}
|
|
|
|
|
else if( subMotivoButtonIDs.containsKey( source ) )
|
|
|
|
|
{
|
|
|
|
|
motivo = motivoTemp;
|
|
|
|
|
subMotivo = subMotivoButtonIDs.get( source );
|
|
|
|
|
close();
|
|
|
|
|
}
|
|
|
|
|
@ -144,6 +149,7 @@ public class EscolherMotivoDialog extends CustomJDialog
|
|
|
|
|
JButton subButtons[] = subMotivoButtons.get( source );
|
|
|
|
|
if( subButtons == null || subButtons.length == 0 )
|
|
|
|
|
{
|
|
|
|
|
motivo = motivoTemp;
|
|
|
|
|
close();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
@ -170,4 +176,8 @@ public class EscolherMotivoDialog extends CustomJDialog
|
|
|
|
|
} );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Integer[] getMotivo()
|
|
|
|
|
{
|
|
|
|
|
return new Integer[]{ motivo, subMotivo };
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|