|
|
|
|
@ -24,6 +24,7 @@ import info.clearthought.layout.TableLayout;
|
|
|
|
|
import info.clearthought.layout.TableLayoutConstraints;
|
|
|
|
|
import java.awt.Dimension;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Hashtable;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Vector;
|
|
|
|
|
import javax.swing.BorderFactory;
|
|
|
|
|
@ -55,12 +56,17 @@ public class PrestadoresWindow extends EditorWindow
|
|
|
|
|
protected JTextField localidadeCodigoPostalText;
|
|
|
|
|
protected JTextField localidadeText;
|
|
|
|
|
protected ContactoPanel contactoPanel;
|
|
|
|
|
protected JTextField contribuinteText;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected PrestadoresDataProvider provider;
|
|
|
|
|
protected ClientesDataProvider clientesProvider;
|
|
|
|
|
|
|
|
|
|
protected ComponentsHashtable components;
|
|
|
|
|
|
|
|
|
|
protected PrestadoresData prestador;
|
|
|
|
|
protected Integer gruposProtocolo[];
|
|
|
|
|
|
|
|
|
|
/** Creates a new instance of PrestadoresWindow */
|
|
|
|
|
public PrestadoresWindow()
|
|
|
|
|
throws Exception
|
|
|
|
|
@ -113,13 +119,16 @@ public class PrestadoresWindow extends EditorWindow
|
|
|
|
|
localidadeCodigoPostalText.setPreferredSize( new Dimension( 150, 50 ) );
|
|
|
|
|
JLabel localidadeLabel = new JLabel( "Localidade" );
|
|
|
|
|
localidadeText = new JTextField();
|
|
|
|
|
JLabel contribuinteLabel = new JLabel( "Contribuinte" );
|
|
|
|
|
contribuinteText = new JTextField();
|
|
|
|
|
contribuinteText.setPreferredSize( new Dimension( 100, 50 ) );
|
|
|
|
|
|
|
|
|
|
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.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM };
|
|
|
|
|
TableLayout tableLayout = new TableLayout( cols,rows );
|
|
|
|
|
getContentPane().setLayout( tableLayout );
|
|
|
|
|
|
|
|
|
|
@ -138,7 +147,8 @@ public class PrestadoresWindow extends EditorWindow
|
|
|
|
|
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 ) );
|
|
|
|
|
|
|
|
|
|
getContentPane().add( contribuinteLabel, new TableLayoutConstraints( 0, 8 ) );
|
|
|
|
|
getContentPane().add( contribuinteText, new TableLayoutConstraints( 1, 8 ) );
|
|
|
|
|
pack();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -146,11 +156,12 @@ public class PrestadoresWindow extends EditorWindow
|
|
|
|
|
{
|
|
|
|
|
components = new ComponentsHashtable();
|
|
|
|
|
components.putComponent( PrestadoresData.NOME, nomeText );
|
|
|
|
|
components.putComponent( PrestadoresData.NOME, new JTextComponentPlainFillerSaver( nomeText ) );
|
|
|
|
|
components.putComponent( PrestadoresData.NOME_PLAIN, new JTextComponentPlainFillerSaver( nomeText ) );
|
|
|
|
|
components.putComponent( PrestadoresData.MORADA, moradaText );
|
|
|
|
|
components.putComponent( PrestadoresData.CODIGO_POSTAL, codigoPostalText );
|
|
|
|
|
components.putComponent( PrestadoresData.LOCALIDADE_CP, localidadeCodigoPostalText );
|
|
|
|
|
components.putComponent( PrestadoresData.LOCALIDADE, localidadeText );
|
|
|
|
|
components.putComponent( PrestadoresData.CONTRIBUINTE, contribuinteText );
|
|
|
|
|
components.putComponent( PrestadoresData.ACTIVO, activoCheck );
|
|
|
|
|
components.putComponent( PrestadoresData.FAZ_CONSULTAS, consultasCheck );
|
|
|
|
|
components.putComponent( PrestadoresData.FAZ_ECDS, ecdsCheck );
|
|
|
|
|
@ -172,6 +183,9 @@ public class PrestadoresWindow extends EditorWindow
|
|
|
|
|
clear( 0 );
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
prestador = provider.getPrestadorByID( id );
|
|
|
|
|
gruposProtocolo = provider.getGruposProtocoloIDByPrestadorID( id );
|
|
|
|
|
reload( 0 );
|
|
|
|
|
}
|
|
|
|
|
catch( Exception ex )
|
|
|
|
|
{
|
|
|
|
|
@ -191,9 +205,11 @@ public class PrestadoresWindow extends EditorWindow
|
|
|
|
|
|
|
|
|
|
public void reload( int index )
|
|
|
|
|
{
|
|
|
|
|
clear( 0 );
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
String names[] = (String[])components.keySet().toArray( new String[0] );
|
|
|
|
|
ComponentController.fill( names, prestador.getHashData(), components );
|
|
|
|
|
ecdsPanel.setSelected( gruposProtocolo );
|
|
|
|
|
}
|
|
|
|
|
catch( Exception ex )
|
|
|
|
|
{
|
|
|
|
|
@ -207,6 +223,8 @@ public class PrestadoresWindow extends EditorWindow
|
|
|
|
|
String names[] = (String[])components.keySet().toArray( new String[0] );
|
|
|
|
|
ComponentController.clear( names, components );
|
|
|
|
|
ecdsPanel.clear();
|
|
|
|
|
prestador = null;
|
|
|
|
|
gruposProtocolo = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public boolean newItem( int index )
|
|
|
|
|
@ -216,6 +234,26 @@ public class PrestadoresWindow extends EditorWindow
|
|
|
|
|
|
|
|
|
|
public boolean save( int index )
|
|
|
|
|
{
|
|
|
|
|
if( prestador == null )
|
|
|
|
|
{
|
|
|
|
|
prestador = new PrestadoresData();
|
|
|
|
|
}
|
|
|
|
|
String names[] = (String[])components.keySet().toArray( new String[0] );
|
|
|
|
|
Hashtable data = prestador.getHashData();
|
|
|
|
|
ComponentController.save( names, data, components );
|
|
|
|
|
prestador.setHashData( data );
|
|
|
|
|
gruposProtocolo = ecdsPanel.getSelected();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
provider.savePrestador( prestador );
|
|
|
|
|
provider.setGruposProtocoloForPrestador( ( Integer ) prestador.get( PrestadoresData.ID ),
|
|
|
|
|
gruposProtocolo );
|
|
|
|
|
}
|
|
|
|
|
catch( Exception ex )
|
|
|
|
|
{
|
|
|
|
|
DialogException.showExceptionMessage( ex, "Erro a guardar dados", true );
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|