git-svn-id: https://svn.coded.pt/svn/SIPRP@1302 bb69d46d-e84e-40c8-a05a-06db0d633741

lxbfYeaa
Tiago Simão 16 years ago
parent 94c0b2ecbb
commit cf87f66496

Binary file not shown.

@ -1,6 +1,6 @@
#siprpsoft versioning file #siprpsoft versioning file
#Wed Jul 14 15:49:54 WEST 2010 #Wed Jul 14 17:09:45 WEST 2010
major=12 major=12
name=siprpsoft name=siprpsoft
minor=0 minor=0
build=9 build=10

@ -11,9 +11,6 @@ import java.sql.Timestamp;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import siprp.database.cayenne.objects.MarcacoesEstabelecimento;
import siprp.database.cayenne.objects.Trabalhadores;
import com.evolute.entity.evo.EvoDataException; import com.evolute.entity.evo.EvoDataException;

@ -8,11 +8,7 @@
package siprp.data.outer; package siprp.data.outer;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import siprp.database.cayenne.objects.TrabalhadoresProcesso;
import com.evolute.entity.evo.EvoDataException; import com.evolute.entity.evo.EvoDataException;

@ -13,7 +13,6 @@ import java.awt.GridLayout;
import java.awt.Insets; import java.awt.Insets;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.Hashtable;
import java.util.Vector; import java.util.Vector;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;

@ -10,7 +10,6 @@ import java.awt.GridBagConstraints;
import java.awt.GridBagLayout; import java.awt.GridBagLayout;
import java.awt.Insets; import java.awt.Insets;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Map;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JLabel; import javax.swing.JLabel;

@ -1,7 +1,6 @@
package siprp.higiene.gestao; package siprp.higiene.gestao;
import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; import static com.evolute.utils.strings.UnicodeLatin1Map.atilde;
import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil;
import static com.evolute.utils.strings.UnicodeLatin1Map.oacute; import static com.evolute.utils.strings.UnicodeLatin1Map.oacute;
import java.awt.Dimension; import java.awt.Dimension;

@ -4,8 +4,6 @@ import info.clearthought.layout.TableLayout;
import info.clearthought.layout.TableLayoutConstraints; import info.clearthought.layout.TableLayoutConstraints;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.util.Hashtable;
import java.util.Map;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JButton; import javax.swing.JButton;
@ -19,10 +17,8 @@ import siprp.data.outer.MarcacoesEstabelecimentoData;
import com.evolute.utils.Singleton; import com.evolute.utils.Singleton;
import com.evolute.utils.data.IDObject; import com.evolute.utils.data.IDObject;
import com.evolute.utils.data.MappableObject; import com.evolute.utils.data.MappableObject;
import com.evolute.utils.data.PropertyObject;
import com.evolute.utils.dataui.ComponentController; import com.evolute.utils.dataui.ComponentController;
import com.evolute.utils.dataui.ComponentsHashtable; import com.evolute.utils.dataui.ComponentsHashtable;
import com.evolute.utils.dataui.ControllableComponent;
import com.evolute.utils.dataui.DataClassAware; import com.evolute.utils.dataui.DataClassAware;
import com.evolute.utils.db.DBManager; import com.evolute.utils.db.DBManager;
import com.evolute.utils.db.SQLExecuter; import com.evolute.utils.db.SQLExecuter;
@ -30,9 +26,7 @@ import com.evolute.utils.ui.calendar.JCalendarPanel;
import com.evolute.utils.ui.panel.RadioButtonFixedPanel; import com.evolute.utils.ui.panel.RadioButtonFixedPanel;
import com.evolute.utils.ui.text.StateTextArea; import com.evolute.utils.ui.text.StateTextArea;
public class MarcacaoVisitaHSTPanel public class MarcacaoVisitaHSTPanel extends JPanel implements DataClassAware<MarcacoesEstabelecimentoData>
extends JPanel
implements ControllableComponent, DataClassAware
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -234,56 +228,58 @@ public class MarcacaoVisitaHSTPanel
components.putComponent( MarcacoesEstabelecimentoData.ESTADO, estadoList ); components.putComponent( MarcacoesEstabelecimentoData.ESTADO, estadoList );
components.putComponent( MarcacoesEstabelecimentoData.OBSERVACOES, observacoesText ); components.putComponent( MarcacoesEstabelecimentoData.OBSERVACOES, observacoesText );
} }
public void fill( Object toFill ) @Override
public void fill( MarcacoesEstabelecimentoData toFill )
{ {
clear(); marcacaoEstabelecimentosData = toFill;
if( toFill == null || !( toFill instanceof PropertyObject ) ) // if( toFill == null || !( toFill instanceof PropertyObject ) )
{ // {
return; // return;
} // }
Map<String,Object> data = null; // Map<String,Object> data = null;
if( toFill instanceof PropertyObject ) // if( toFill instanceof PropertyObject )
{ // {
data = ( (PropertyObject) toFill ).getHashData(); // data = ( (PropertyObject) toFill ).getHashData();
if( toFill instanceof MarcacoesEstabelecimentoData ) // if( toFill instanceof MarcacoesEstabelecimentoData )
{ // {
marcacaoEstabelecimentosData = (MarcacoesEstabelecimentoData) toFill; // marcacaoEstabelecimentosData = (MarcacoesEstabelecimentoData) toFill;
} // }
} // }
else if( toFill instanceof Hashtable ) // else if( toFill instanceof Hashtable )
{ // {
data = (Hashtable) toFill; // data = (Hashtable) toFill;
} // }
else // else
{ // {
return; // return;
} // }
if( marcacaoEstabelecimentosData == null ) // if( marcacaoEstabelecimentosData == null )
{ // {
marcacaoEstabelecimentosData = new MarcacoesEstabelecimentoData(); // clear();
marcacaoEstabelecimentosData.setHashData( data ); // marcacaoEstabelecimentosData = new MarcacoesEstabelecimentoData();
} // marcacaoEstabelecimentosData.setHashData( data );
PropertyObject po = (PropertyObject) toFill; // }
String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); // PropertyObject po = (PropertyObject) toFill;
ComponentController.fill( properties, po.getHashData(), components ); // String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] );
ComponentController.fillFrom( marcacaoEstabelecimentosData, components );
} }
public Object save() @Override
public MarcacoesEstabelecimentoData save()
{ {
if( marcacaoEstabelecimentosData == null ) if( marcacaoEstabelecimentosData == null )
{ {
marcacaoEstabelecimentosData = new MarcacoesEstabelecimentoData(); marcacaoEstabelecimentosData = new MarcacoesEstabelecimentoData();
} }
Map<String,Object> data = marcacaoEstabelecimentosData.getHashData(); // marcacaoEstabelecimentosData.setHashData( ComponentController.save( components ) );
String properties[] = (String[]) components.keySet().toArray( new String[ 0 ] ); // if( !( marcacaoEstabelecimentosData instanceof PropertyObject ) )
ComponentController.save( properties, data, components ); // {
if( !( marcacaoEstabelecimentosData instanceof PropertyObject ) ) // return marcacaoEstabelecimentosData;
{ // }
return data; return ComponentController.saveTo( marcacaoEstabelecimentosData, components );
} // marcacaoEstabelecimentosData.setHashData( data );
marcacaoEstabelecimentosData.setHashData( data ); // return marcacaoEstabelecimentosData;
return marcacaoEstabelecimentosData;
} }
public void clear() public void clear()

@ -36,6 +36,7 @@ import siprp.clientes.AvisosPanel;
import siprp.data.AvisoConstants; import siprp.data.AvisoConstants;
import siprp.data.Marcacao; import siprp.data.Marcacao;
import siprp.data.outer.ContactosData; import siprp.data.outer.ContactosData;
import siprp.data.outer.EmpresasData;
import siprp.data.outer.EstabelecimentosData; import siprp.data.outer.EstabelecimentosData;
import siprp.data.outer.MarcacoesEstabelecimentoData; import siprp.data.outer.MarcacoesEstabelecimentoData;
import siprp.higiene.HigieneDataProvider; import siprp.higiene.HigieneDataProvider;
@ -74,16 +75,16 @@ public class MarcacoesHigieneWindow extends SIPRPEditorWindow
protected MarcacaoVisitaHSTPanel marcacaoPanel; protected MarcacaoVisitaHSTPanel marcacaoPanel;
protected TableEditorPanel marcacaoEditorPanel; protected TableEditorPanel marcacaoEditorPanel;
protected HigieneDataProvider provider; protected HigieneDataProvider higienteProvider;
protected ProviderInterface JDO; protected ProviderInterface objectProvider;
protected SHSTTrackerInterface tracker; protected SHSTTrackerInterface tracker;
private Hashtable<Object, Object[]> tecnicosHash; private Hashtable<Object, Object[]> tecnicosHash;
protected Integer empresaID; private Integer empresaID;
protected String empresa; // protected String empresa;
protected Integer estabelecimentoID; private Integer estabelecimentoID;
protected EstabelecimentosData estabelecimento; private EstabelecimentosData estabelecimento;
protected boolean editing = false; protected boolean editing = false;
@ -92,8 +93,8 @@ public class MarcacoesHigieneWindow extends SIPRPEditorWindow
throws Exception throws Exception
{ {
super( iPermissionArray ); super( iPermissionArray );
this.provider = ( HigieneDataProvider ) HigieneDataProvider.getProvider(); this.higienteProvider = ( HigieneDataProvider ) HigieneDataProvider.getProvider();
this.JDO = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER ); this.objectProvider = ( ProviderInterface ) Singleton.getInstance( Singleton.DEFAULT_JDO_PROVIDER );
this.tecnicosHash = new Hashtable<Object, Object[]>(); this.tecnicosHash = new Hashtable<Object, Object[]>();
this.setupComponents(); this.setupComponents();
this.setSize( 800, 700 ); this.setSize( 800, 700 );
@ -157,7 +158,9 @@ public class MarcacoesHigieneWindow extends SIPRPEditorWindow
marcacaoEditorPanel.addComponent( marcacaoPanel, marcacaoEditorPanel.addComponent( marcacaoPanel,
new int[]{0,2}, new int[]{1,2}, new int[]{0,2}, new int[]{1,2},
1.0, 1.0 ); 1.0, 1.0 );
marcacaoEditorPanel.addListSelectionListener( new ListSelectionListener(){ marcacaoEditorPanel.addListSelectionListener( new ListSelectionListener()
{
@Override
public void valueChanged(javax.swing.event.ListSelectionEvent listSelectionEvent) public void valueChanged(javax.swing.event.ListSelectionEvent listSelectionEvent)
{ {
if( marcacaoEditorPanel.getID() != null ) if( marcacaoEditorPanel.getID() != null )
@ -170,8 +173,9 @@ public class MarcacoesHigieneWindow extends SIPRPEditorWindow
clear( INDEX_VISITA ); clear( INDEX_VISITA );
} }
} }
}); } );
}catch( Exception ex ) }
catch( Exception ex )
{ {
DialogException.showException( ex ); DialogException.showException( ex );
return; return;
@ -201,7 +205,7 @@ public class MarcacoesHigieneWindow extends SIPRPEditorWindow
private void fillTecnicos( JComboBox tecnicosList, boolean superiores ) throws Exception private void fillTecnicos( JComboBox tecnicosList, boolean superiores ) throws Exception
{ {
tecnicosList.removeAllItems(); tecnicosList.removeAllItems();
Object tecnicos[][] = provider.getTecnicosHST( superiores ); Object tecnicos[][] = higienteProvider.getTecnicosHST( superiores );
tecnicosList.addItem( new MappableObject( new Integer( -2 ), " " ) ); tecnicosList.addItem( new MappableObject( new Integer( -2 ), " " ) );
for( int n = 0; n < tecnicos.length; n++ ) for( int n = 0; n < tecnicos.length; n++ )
{ {
@ -218,6 +222,7 @@ public class MarcacoesHigieneWindow extends SIPRPEditorWindow
tecnicosList.addItem( new MappableObject( new Integer( -1 ), "Novo/Editar" ) ); tecnicosList.addItem( new MappableObject( new Integer( -1 ), "Novo/Editar" ) );
} }
@Override
public void itemStateChanged( ItemEvent itemEvent ) public void itemStateChanged( ItemEvent itemEvent )
{ {
JComboBox tecnicos = null; JComboBox tecnicos = null;
@ -265,6 +270,7 @@ public class MarcacoesHigieneWindow extends SIPRPEditorWindow
} }
} }
@Override
public boolean save(int index) public boolean save(int index)
{ {
switch( index ) switch( index )
@ -310,6 +316,7 @@ public class MarcacoesHigieneWindow extends SIPRPEditorWindow
return true; return true;
} }
@Override
public boolean delete(int index) public boolean delete(int index)
{ {
int option = JOptionPane.showConfirmDialog( this, "Tem a certeza que quer apagar a marca\u00e7\u00e3o?", int option = JOptionPane.showConfirmDialog( this, "Tem a certeza que quer apagar a marca\u00e7\u00e3o?",
@ -337,13 +344,13 @@ public class MarcacoesHigieneWindow extends SIPRPEditorWindow
return false; return false;
} }
@Override
public void clear(int index) public void clear(int index)
{ {
switch( index ) switch( index )
{ {
case INDEX_MAIN: case INDEX_MAIN:
empresaID = null; empresaID = null;
empresa = null;
estabelecimentoID = null; estabelecimentoID = null;
estabelecimento = null; estabelecimento = null;
upperPanel.clear(); upperPanel.clear();
@ -378,6 +385,7 @@ public class MarcacoesHigieneWindow extends SIPRPEditorWindow
} }
} }
@Override
protected void enableSelect( int index, boolean select ) protected void enableSelect( int index, boolean select )
{ {
switch( index ) switch( index )
@ -388,6 +396,7 @@ public class MarcacoesHigieneWindow extends SIPRPEditorWindow
} }
} }
@Override
public void reload( int index ) public void reload( int index )
{ {
switch( index ) switch( index )
@ -395,12 +404,12 @@ public class MarcacoesHigieneWindow extends SIPRPEditorWindow
case INDEX_MAIN: case INDEX_MAIN:
try try
{ {
empresa = provider.getEmpresa( empresaID ); // EmpresasData empresa = (EmpresasData) objectProvider.load( EmpresasData.class, empresaID );
estabelecimento = ( EstabelecimentosData ) JDO.load( EstabelecimentosData.class, estabelecimentoID ); estabelecimento = estabelecimentoID == null ? null : ((EstabelecimentosData) objectProvider.load( EstabelecimentosData.class, estabelecimentoID ));
// upperPanel.getEmpresaText().setText( empresa ); // upperPanel.getEmpresaText().setText( empresa );
// upperPanel.getEstabelecimentoText().setText( estabelecimento ); // upperPanel.getEstabelecimentoText().setText( estabelecimento );
// upperPanel.getTrabalhadorText().setText( ( String ) trabalhador.get( TrabalhadoresData.NOME ) ); // upperPanel.getTrabalhadorText().setText( ( String ) trabalhador.get( TrabalhadoresData.NOME ) );
Object visitas[][] = provider.getVisitasEstabelecimento( estabelecimentoID ); Object visitas[][] = higienteProvider.getVisitasEstabelecimento( estabelecimentoID );
if( visitas.length > 0 ) if( visitas.length > 0 )
{ {
marcacaoEditorPanel.setData( new Object2DArray( visitas ) ); marcacaoEditorPanel.setData( new Object2DArray( visitas ) );
@ -424,8 +433,7 @@ public class MarcacoesHigieneWindow extends SIPRPEditorWindow
} }
try try
{ {
MarcacoesEstabelecimentoData visita = MarcacoesEstabelecimentoData visita = (MarcacoesEstabelecimentoData) objectProvider.load( MarcacoesEstabelecimentoData.class, visitaID );
( MarcacoesEstabelecimentoData ) JDO.load( MarcacoesEstabelecimentoData.class, visitaID );
marcacaoPanel.fill( visita ); marcacaoPanel.fill( visita );
Date dataEmailVisita = ( Date ) visita.get( MarcacoesEstabelecimentoData.DATA_EMAIL ); Date dataEmailVisita = ( Date ) visita.get( MarcacoesEstabelecimentoData.DATA_EMAIL );
if( dataEmailVisita != null ) if( dataEmailVisita != null )
@ -445,6 +453,7 @@ public class MarcacoesHigieneWindow extends SIPRPEditorWindow
} }
} }
@Override
public void actionPerformed( ActionEvent e ) public void actionPerformed( ActionEvent e )
{ {
Object source = e.getSource(); Object source = e.getSource();
@ -517,6 +526,7 @@ public class MarcacoesHigieneWindow extends SIPRPEditorWindow
} }
} }
@Override
public void valueChanged( ListSelectionEvent e ) public void valueChanged( ListSelectionEvent e )
{ {
Object source = e.getSource(); Object source = e.getSource();
@ -538,6 +548,7 @@ public class MarcacoesHigieneWindow extends SIPRPEditorWindow
} }
} }
@Override
public void setEmpresaAndEstabelecimento( Integer empresaID, Integer estabelecimentoID ) public void setEmpresaAndEstabelecimento( Integer empresaID, Integer estabelecimentoID )
{ {
if( editing ) if( editing )
@ -551,8 +562,10 @@ public class MarcacoesHigieneWindow extends SIPRPEditorWindow
} }
} }
@Override
public void setTracker( SHSTTrackerInterface tracker ) public void setTracker( SHSTTrackerInterface tracker )
{ {
this.tracker = tracker; this.tracker = tracker;
} }
} }

Loading…
Cancel
Save