forked from Coded/SIPRP
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
186 lines
6.2 KiB
186 lines
6.2 KiB
/*
|
|
* PrestadoresWindow.java
|
|
*
|
|
* Created on February 2, 2007, 9:44 AM
|
|
*
|
|
* To change this template, choose Tools | Template Manager
|
|
* and open the template in the editor.
|
|
*/
|
|
|
|
package siprp.medicina.prestadores;
|
|
|
|
import com.evolute.utils.data.IDObject;
|
|
import com.evolute.utils.ui.DialogException;
|
|
import com.evolute.utils.ui.panel.CheckBoxPanel;
|
|
import com.evolute.utils.ui.search.SearchDialog;
|
|
import com.evolute.utils.ui.window.EditorWindow;
|
|
import info.clearthought.layout.TableLayout;
|
|
import info.clearthought.layout.TableLayoutConstraints;
|
|
import java.awt.Dimension;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.Vector;
|
|
import javax.swing.BorderFactory;
|
|
import javax.swing.JCheckBox;
|
|
import javax.swing.JLabel;
|
|
import javax.swing.JScrollPane;
|
|
import javax.swing.JTextArea;
|
|
import javax.swing.JTextField;
|
|
import siprp.clientes.ClientesDataProvider;
|
|
import siprp.clientes.ContactoPanel;
|
|
|
|
/**
|
|
*
|
|
* @author fpalma
|
|
*/
|
|
public class PrestadoresWindow extends EditorWindow
|
|
{
|
|
public static final String TITLE = "Prestadores";
|
|
|
|
protected JTextField nomeText;
|
|
protected JCheckBox activoCheck;
|
|
protected JCheckBox consultasCheck;
|
|
protected JCheckBox ecdsCheck;
|
|
protected CheckBoxPanel ecdsPanel;
|
|
protected JTextArea moradaText;
|
|
protected JTextField codigoPostalText;
|
|
protected JTextField localidadeCodigoPostalText;
|
|
protected JTextField localidadeText;
|
|
protected ContactoPanel contactoPanel;
|
|
|
|
protected PrestadoresDataProvider provider;
|
|
protected ClientesDataProvider clientesProvider;
|
|
|
|
/** Creates a new instance of PrestadoresWindow */
|
|
public PrestadoresWindow()
|
|
throws Exception
|
|
{
|
|
super( new int[][]{{ NEW_INDEX, EDIT_INDEX, CANCEL_INDEX, SAVE_INDEX, DELETE_INDEX,
|
|
SELECT_BYNAME_INDEX }} );
|
|
provider = PrestadoresDataProvider.getProvider();
|
|
clientesProvider = ( ClientesDataProvider ) ClientesDataProvider.getProvider();
|
|
setupComponents();
|
|
}
|
|
|
|
private void setupComponents()
|
|
throws Exception
|
|
{
|
|
setTitle( TITLE );
|
|
JLabel nomeLabel = new JLabel( "Designa\u00e7\u00e3o" );
|
|
nomeText = new JTextField();
|
|
nomeText.setPreferredSize( new Dimension( 500, 20 ) );
|
|
activoCheck = new JCheckBox( "Activo (actualmente fornece servi\u00e7os \u00e0 SIPRP)" );
|
|
consultasCheck = new JCheckBox( "Faz consultas" );
|
|
ecdsCheck = new JCheckBox( "Faz ecds" );
|
|
List<IDObject> gruposProtocolo = new Vector<IDObject>();
|
|
IDObject gruposProtocoloReais[] = clientesProvider.getAllGruposProtocoloReais();
|
|
if( gruposProtocoloReais != null && gruposProtocoloReais.length > 0 )
|
|
{
|
|
gruposProtocolo.addAll( Arrays.asList( gruposProtocoloReais ) );
|
|
}
|
|
IDObject gruposProtocoloFalsos[] = clientesProvider.getAllGruposProtocoloFalsos();
|
|
if( gruposProtocoloFalsos != null && gruposProtocoloFalsos.length > 0 )
|
|
{
|
|
gruposProtocolo.addAll( Arrays.asList( gruposProtocoloFalsos ) );
|
|
}
|
|
ecdsPanel = new CheckBoxPanel( gruposProtocolo.toArray( new IDObject[ gruposProtocolo.size() ] ) );
|
|
JLabel contactoLabel = new JLabel( "Contacto" );
|
|
contactoPanel = new ContactoPanel();
|
|
contactoPanel.setPreferredSize( new Dimension( 350, 120 ) );
|
|
contactoPanel.setBorder( BorderFactory.createEtchedBorder() );
|
|
JLabel moradaLabel = new JLabel( "Morada" );
|
|
moradaText = new JTextArea();
|
|
moradaText.setLineWrap( true );
|
|
moradaText.setWrapStyleWord( true );
|
|
JScrollPane moradaScroll = new JScrollPane( moradaText, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
|
|
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
|
|
moradaScroll.setPreferredSize( new Dimension( 500, 50 ) );
|
|
JLabel codigoPostalLabel = new JLabel( "C\u00f3digo Postal" );
|
|
codigoPostalText = new JTextField();
|
|
codigoPostalText.setPreferredSize( new Dimension( 100, 50 ) );
|
|
localidadeCodigoPostalText = new JTextField();
|
|
localidadeCodigoPostalText.setPreferredSize( new Dimension( 150, 50 ) );
|
|
JLabel localidadeLabel = new JLabel( "Localidade" );
|
|
localidadeText = new JTextField();
|
|
|
|
double cols[] =
|
|
new double[]{ TableLayout.MINIMUM, TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.FILL };
|
|
double rows[] =
|
|
new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM,
|
|
TableLayout.FILL, TableLayout.PREFERRED, TableLayout.PREFERRED,
|
|
TableLayout.MINIMUM, TableLayout.MINIMUM };
|
|
TableLayout tableLayout = new TableLayout( cols,rows );
|
|
getContentPane().setLayout( tableLayout );
|
|
|
|
getContentPane().add( nomeLabel, new TableLayoutConstraints( 0, 0 ) );
|
|
getContentPane().add( nomeText, new TableLayoutConstraints( 1, 0, 3, 0 ) );
|
|
getContentPane().add( activoCheck, new TableLayoutConstraints( 0, 1, 2, 1 ) );
|
|
getContentPane().add( consultasCheck, new TableLayoutConstraints( 0, 2 ) );
|
|
getContentPane().add( ecdsCheck, new TableLayoutConstraints( 0, 3 ) );
|
|
getContentPane().add( ecdsPanel, new TableLayoutConstraints( 1, 3, 2, 3 ) );
|
|
getContentPane().add( contactoLabel, new TableLayoutConstraints( 0, 4 ) );
|
|
getContentPane().add( contactoPanel, new TableLayoutConstraints( 1, 4, 2, 4 ) );
|
|
getContentPane().add( moradaLabel, new TableLayoutConstraints( 0, 5 ) );
|
|
getContentPane().add( moradaScroll, new TableLayoutConstraints( 1, 5, 3, 5 ) );
|
|
getContentPane().add( codigoPostalLabel, new TableLayoutConstraints( 0, 6 ) );
|
|
getContentPane().add( codigoPostalText, new TableLayoutConstraints( 1, 6 ) );
|
|
getContentPane().add( localidadeCodigoPostalText, new TableLayoutConstraints( 2, 6, 3, 6 ) );
|
|
getContentPane().add( localidadeLabel, new TableLayoutConstraints( 0, 7 ) );
|
|
getContentPane().add( localidadeText, new TableLayoutConstraints( 1, 7, 3, 7 ) );
|
|
|
|
pack();
|
|
}
|
|
|
|
public boolean searchByName()
|
|
{
|
|
SearchDialog search = new SearchDialog( provider );
|
|
Integer id = ( Integer )search.getSelected();
|
|
if( id == null )
|
|
{
|
|
return false;
|
|
}
|
|
clear( 0 );
|
|
try
|
|
{
|
|
}
|
|
catch( Exception ex )
|
|
{
|
|
DialogException.showExceptionMessage( ex, "Ocorreu um erro a carregar o prestador.", true );
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public void enableComponents( int index, boolean enable )
|
|
{
|
|
}
|
|
|
|
public void reload( int index )
|
|
{
|
|
clear( 0 );
|
|
try
|
|
{
|
|
}
|
|
catch( Exception ex )
|
|
{
|
|
DialogException.showExceptionMessage( ex, "Erro a carregar dados", true );
|
|
|
|
}
|
|
}
|
|
|
|
public void clear( int index )
|
|
{
|
|
}
|
|
|
|
public boolean newItem( int index )
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public boolean save( int index )
|
|
{
|
|
return true;
|
|
}
|
|
}
|