forked from Coded/SIPRP
no message
git-svn-id: https://svn.coded.pt/svn/SIPRP@369 bb69d46d-e84e-40c8-a05a-06db0d6337410'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
parent
abcb77d958
commit
ab1261e651
@ -0,0 +1,173 @@
|
||||
/*
|
||||
* EscolherMotivoDialog.java
|
||||
*
|
||||
* Created on 13 de Maio de 2007, 22:16
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package siprp.medicina.processo;
|
||||
|
||||
import com.evolute.utils.data.IDObject;
|
||||
import com.evolute.utils.data.MappableObject;
|
||||
import com.evolute.utils.ui.CustomJDialog;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.HashMap;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Frederico
|
||||
*/
|
||||
public class EscolherMotivoDialog extends CustomJDialog
|
||||
implements ActionListener
|
||||
{
|
||||
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" )
|
||||
};
|
||||
|
||||
protected IDObject SUB_MOTIVOS[][] =
|
||||
new IDObject[][]{
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
{ 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" )
|
||||
}
|
||||
};
|
||||
|
||||
protected JButton motivoButtons[];
|
||||
protected HashMap<JButton,JButton[]> subMotivoButtons;
|
||||
protected HashMap<JButton,Integer> motivoButtonIDs;
|
||||
protected HashMap<JButton,Integer> subMotivoButtonIDs;
|
||||
protected JPanel motivoPanel;
|
||||
protected JPanel subMotivoPanel;
|
||||
|
||||
protected Integer motivo;
|
||||
protected Integer subMotivo;
|
||||
|
||||
/** Creates a new instance of EscolherMotivoDialog */
|
||||
public EscolherMotivoDialog( JFrame owner )
|
||||
{
|
||||
super( owner, true );
|
||||
setupComponents();
|
||||
|
||||
if( owner != null )
|
||||
{
|
||||
centerSuper();
|
||||
}
|
||||
else
|
||||
{
|
||||
center();
|
||||
}
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
setTitle( "Escolher Motivo" );
|
||||
setLayout( new FlowLayout( FlowLayout.LEFT ) );
|
||||
motivoButtons = new JButton[ MOTIVOS.length ];
|
||||
subMotivoButtons = new HashMap<JButton,JButton[]>();
|
||||
motivoButtonIDs = new HashMap<JButton,Integer>();
|
||||
subMotivoButtonIDs = new HashMap<JButton,Integer>();
|
||||
for( int m = 0; m < MOTIVOS.length; m++ )
|
||||
{
|
||||
JButton motivoButton = new JButton( MOTIVOS[ m ].toString() );
|
||||
motivoButton.addActionListener( this );
|
||||
motivoButtonIDs.put( motivoButton, MOTIVOS[ m ].getID() );
|
||||
motivoButton.setPreferredSize( new Dimension( 250, 20 ) );
|
||||
motivoButtons[ m ] = motivoButton;
|
||||
if( SUB_MOTIVOS[ m ].length > 0 )
|
||||
{
|
||||
JButton subButtons[] = new JButton[ SUB_MOTIVOS[ m ].length ];
|
||||
for( int sm = 0; sm < SUB_MOTIVOS[ m ].length; sm++ )
|
||||
{
|
||||
JButton subButton = new JButton( SUB_MOTIVOS[ m ][ sm ].toString() );
|
||||
subMotivoButtonIDs.put( subButton, SUB_MOTIVOS[ m ][ sm ].getID() );
|
||||
subButtons[ sm ] = subButton;
|
||||
subButton.setPreferredSize( new Dimension( 300, 20 ) );
|
||||
subButton.addActionListener( this );
|
||||
}
|
||||
subMotivoButtons.put( motivoButton, subButtons );
|
||||
}
|
||||
else
|
||||
{
|
||||
subMotivoButtons.put( motivoButton, null );
|
||||
}
|
||||
}
|
||||
motivoPanel = new JPanel();
|
||||
subMotivoPanel = new JPanel();
|
||||
|
||||
motivoPanel.setLayout( new GridLayout( motivoButtons.length + 1, 1 ) );
|
||||
for( int n = 0; n < motivoButtons.length; n++ )
|
||||
{
|
||||
motivoPanel.add( motivoButtons[ n ] );
|
||||
}
|
||||
|
||||
add( motivoPanel );
|
||||
add( subMotivoPanel );
|
||||
|
||||
pack();
|
||||
}
|
||||
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
JButton source = ( JButton ) e.getSource();
|
||||
if( motivoButtonIDs.containsKey( source ) )
|
||||
{
|
||||
motivo = motivoButtonIDs.get( source );
|
||||
}
|
||||
else if( subMotivoButtonIDs.containsKey( source ) )
|
||||
{
|
||||
subMotivo = subMotivoButtonIDs.get( source );
|
||||
close();
|
||||
}
|
||||
if( subMotivoButtons.containsKey( source ) )
|
||||
{
|
||||
JButton subButtons[] = subMotivoButtons.get( source );
|
||||
if( subButtons == null || subButtons.length == 0 )
|
||||
{
|
||||
close();
|
||||
}
|
||||
else
|
||||
{
|
||||
subMotivoPanel.removeAll();
|
||||
subMotivoPanel.setLayout( new GridLayout( 0, 1 ) );
|
||||
for( int n = 0; n < subButtons.length; n++ )
|
||||
{
|
||||
subMotivoPanel.add( subButtons[ n ] );
|
||||
}
|
||||
pack();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void close()
|
||||
{
|
||||
SwingUtilities.invokeLater( new Runnable(){
|
||||
public void run()
|
||||
{
|
||||
setVisible( false );
|
||||
dispose();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* ECDsPanel.java
|
||||
*
|
||||
* Created on 13 de Maio de 2007, 17:07
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package siprp.medicina.processo.detalhes;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Frederico
|
||||
*/
|
||||
public class ECDsPanel extends JPanel
|
||||
{
|
||||
protected JFrame owner;
|
||||
|
||||
/**
|
||||
* Creates a new instance of ECDsPanel
|
||||
*/
|
||||
public ECDsPanel( JFrame owner )
|
||||
{
|
||||
this.owner = owner;
|
||||
setupComponents();
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue