forked from Coded/SIPRP
git-svn-id: https://svn.coded.pt/svn/SIPRP@626 bb69d46d-e84e-40c8-a05a-06db0d633741
parent
185e6b8460
commit
e6d63271bc
@ -0,0 +1,205 @@
|
||||
package siprp.medicina.locais_analise;
|
||||
|
||||
import info.clearthought.layout.TableLayout;
|
||||
import info.clearthought.layout.TableLayoutConstraints;
|
||||
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.text.DateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.WindowConstants;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import com.evolute.utils.data.IDObject;
|
||||
import com.evolute.utils.dataui.ControllableComponent;
|
||||
import com.evolute.utils.tracker.TrackableWindow;
|
||||
import com.evolute.utils.ui.DialogException;
|
||||
import com.evolute.utils.ui.calendar.JCalendarPanel;
|
||||
import com.evolute.utils.ui.panel.CheckBoxPanel;
|
||||
|
||||
public class EnviarAnalisesWindow extends JFrame
|
||||
implements TrackableWindow, ActionListener, ChangeListener, ControllableComponent
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected JCalendarPanel dataPanel;
|
||||
protected JComboBox prestadorCombo;
|
||||
protected JPanel ecdsOuterPanel;
|
||||
protected CheckBoxPanel ecdsPanel;
|
||||
protected JButton enviarButton;
|
||||
|
||||
protected final EnviarAnalisesWindowLogic logic;
|
||||
|
||||
public EnviarAnalisesWindow()
|
||||
throws Exception
|
||||
{
|
||||
logic = new EnviarAnalisesWindowLogic( this );
|
||||
setupComponents();
|
||||
}
|
||||
|
||||
private void setupComponents()
|
||||
{
|
||||
setTitle( "Enviar Colheitas para An\u00e1lise" );
|
||||
setSize( 500, 400 );
|
||||
|
||||
JLabel dataLabel = new JLabel( "Data" );
|
||||
dataPanel = new JCalendarPanel( this );
|
||||
dataPanel.addChangeListener( this );
|
||||
JLabel prestadorLabel = new JLabel( "Prestador" );
|
||||
prestadorCombo = new JComboBox();
|
||||
ecdsOuterPanel = new JPanel();
|
||||
ecdsOuterPanel.setLayout( new GridLayout( 1, 1 ) );
|
||||
enviarButton = new JButton( "Enviar" );
|
||||
enviarButton.addActionListener( this );
|
||||
|
||||
TableLayout layout =
|
||||
new TableLayout(
|
||||
new double[]{ TableLayoutConstraints.MINIMUM, TableLayoutConstraints.PREFERRED,
|
||||
TableLayoutConstraints.MINIMUM, TableLayoutConstraints.PREFERRED },
|
||||
new double[]{ TableLayoutConstraints.MINIMUM, TableLayoutConstraints.FILL,
|
||||
TableLayoutConstraints.MINIMUM } );
|
||||
layout.setHGap( 2 );
|
||||
layout.setVGap( 2 );
|
||||
getContentPane().setLayout( layout );
|
||||
|
||||
getContentPane().add( dataLabel, new TableLayoutConstraints( 0, 0 ) );
|
||||
getContentPane().add( dataPanel, new TableLayoutConstraints( 1, 0 ) );
|
||||
getContentPane().add( prestadorLabel, new TableLayoutConstraints( 2, 0 ) );
|
||||
getContentPane().add( prestadorCombo, new TableLayoutConstraints( 3, 0 ) );
|
||||
getContentPane().add( ecdsOuterPanel, new TableLayoutConstraints( 0, 1, 3, 1 ) );
|
||||
getContentPane().add( enviarButton, new TableLayoutConstraints( 1, 2, 2, 2 ) );
|
||||
|
||||
|
||||
setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
|
||||
addWindowListener( new WindowAdapter(){
|
||||
public void windowClosing( WindowEvent e )
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
public void windowOpened( WindowEvent e )
|
||||
{
|
||||
// setExtendedState( getExtendedState() | MAXIMIZED_BOTH );
|
||||
}
|
||||
|
||||
} );
|
||||
dataPanel.setDate( new Date() );
|
||||
}
|
||||
|
||||
public void refresh()
|
||||
{
|
||||
}
|
||||
|
||||
public void open()
|
||||
{
|
||||
setVisible( true );
|
||||
}
|
||||
|
||||
public void close()
|
||||
{
|
||||
SwingUtilities.invokeLater( new Runnable() {
|
||||
public void run()
|
||||
{
|
||||
setVisible( false );
|
||||
dispose();
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
public boolean closeIfPossible()
|
||||
{
|
||||
close();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void setPrestadores( IDObject prestadores[] )
|
||||
{
|
||||
prestadorCombo.removeAllItems();
|
||||
for( IDObject prestador : prestadores )
|
||||
{
|
||||
prestadorCombo.addItem( prestador );
|
||||
}
|
||||
// revalidate();
|
||||
}
|
||||
|
||||
public void setEcds( IDObject ecds[] )
|
||||
{
|
||||
ecdsPanel = new CheckBoxPanel( ecds );
|
||||
ecdsOuterPanel.removeAll();
|
||||
ecdsOuterPanel.add( ecdsPanel );
|
||||
revalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed( ActionEvent e )
|
||||
{
|
||||
Object source = e.getSource();
|
||||
if( source.equals( enviarButton ) )
|
||||
{
|
||||
Date data = dataPanel.getDate();
|
||||
try
|
||||
{
|
||||
logic.dateChanged( data );
|
||||
}
|
||||
catch( Exception ex )
|
||||
{
|
||||
if( data != null )
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a carregar dados de " + DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) ).format( data ), true );
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogException.showExceptionMessage( ex, "Erro a carregar dados de null", true );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stateChanged( ChangeEvent e )
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fill( Object value )
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object save()
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
private void revalidate()
|
||||
{
|
||||
( ( JPanel ) getContentPane() ).revalidate();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* V8_1_To_V8_2.java
|
||||
*
|
||||
* Created on December 19, 2007, 3:12 PM
|
||||
*
|
||||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package siprp.update.updates;
|
||||
|
||||
import com.evolute.utils.Singleton;
|
||||
import com.evolute.utils.db.DBManager;
|
||||
import com.evolute.utils.db.Executer;
|
||||
import com.evolute.utils.sql.Assignment;
|
||||
import com.evolute.utils.sql.Field;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fpalma
|
||||
*/
|
||||
public class V8_1_To_V8_2
|
||||
implements siprp.update.Update
|
||||
{
|
||||
|
||||
/**
|
||||
* Creates a new instance of V8_1_To_V8_2
|
||||
*/
|
||||
public V8_1_To_V8_2()
|
||||
{
|
||||
}
|
||||
|
||||
public String []listChanges()
|
||||
{
|
||||
return new String[]{ "Alterar tabela dos ecds", "Alterar tabela de marca\u00e7\u00e3o dos ecds" };
|
||||
}
|
||||
|
||||
public double getStartVersion()
|
||||
{
|
||||
return 8.1;
|
||||
}
|
||||
|
||||
public double getEndVersion()
|
||||
{
|
||||
return 8.2;
|
||||
}
|
||||
|
||||
public void doUpdate()
|
||||
throws Exception
|
||||
{
|
||||
DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER );
|
||||
Executer executer = dbm.getSharedExecuter();
|
||||
com.evolute.utils.sql.Update update =
|
||||
new com.evolute.utils.sql.Update(
|
||||
"ALTER TABLE trabalhadores_ecd ADD enviado CHAR(1);" );
|
||||
executer.executeQuery( update );
|
||||
update =
|
||||
new com.evolute.utils.sql.Update(
|
||||
"ALTER TABLE trabalhadores_ecds_datas ADD analisador_id INT REFERENCES prestadores( id );" );
|
||||
executer.executeQuery( update );
|
||||
update =
|
||||
new com.evolute.utils.sql.Update(
|
||||
"ALTER TABLE trabalhadores_ecds_datas ADD data_envio DATE;" );
|
||||
executer.executeQuery( update );
|
||||
update =
|
||||
new com.evolute.utils.sql.Update(
|
||||
"ALTER TABLE trabalhadores_ecds_datas ADD data_recepcao DATE;" );
|
||||
executer.executeQuery( update );
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return "v" + getStartVersion() + " para v" + getEndVersion();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue