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

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Tiago Simão 18 years ago
parent 78c0dab259
commit 0d219205ce

@ -8,7 +8,12 @@ public class TrabalhadoresConsultasDatasObservacoes extends _TrabalhadoresConsul
@Override
public String toString()
{
return getObservacao();
String result = getObservacao() == null ? "" : getObservacao();
if( result.indexOf( '\n' ) > 0 )
{
result = result.substring( 0, result.indexOf( '\n', 1) );
}
return result;
}
}

@ -34,9 +34,9 @@ public class LeafCalendarDialog extends JDialog
private JComponent parent = null;
private boolean enableClean = false;
private boolean enableClean = true;
private boolean enableCancel = false;
private boolean enableCancel = true;
private final JCalendar calendarPanel = new JCalendar( null, null, false, false );

@ -17,8 +17,11 @@ import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JTextArea;
import siprp.ui.SIPRPWindow;
public class LeafInputField<ObjClass extends Object> extends JTextArea
{
public static final String PROPERTY_CHANGED_CONSTANT = "LEAF_INPUT_PROPERTY_CHANGED";
private static final long serialVersionUID = 1L;
private static final DateFormat sdf = DateFormat.getDateInstance( DateFormat.SHORT, new Locale( "pt", "PT" ) );
@ -122,6 +125,7 @@ public class LeafInputField<ObjClass extends Object> extends JTextArea
}
if( obj != null )
{
firePropertyChange( PROPERTY_CHANGED_CONSTANT, object, obj);
setObject( obj );
}
}

@ -274,10 +274,12 @@ public class ProcessoAccoesPanel extends JPanel
if( marcacao != null )
{
boolean porRealizar = new Integer( MedicinaConstants.ESTADO_POR_REALIZAR ).equals( marcacao.getEstado() );
List list = marcacao.getTrabalhadoresConsultasDatasObservacoesArray();
boolean noObservacoes = (list == null || list.size() == 0) ? true : false;
buttonConsultaMarcacaoDesmarcar.setEnabled( porRealizar );
buttonConsultaMarcacaoFaltou.setEnabled( porRealizar );
buttonConsultaMarcacaoRealizar.setEnabled( porRealizar );
// buttonNovoConsultaMarcacaoObservacoes.setEnabled( );
buttonNovoConsultaMarcacaoObservacoes.setEnabled( noObservacoes );
cardLayout.show( cardPanel, PANEL_CONSULTA_MARCACAO_NAME );
}
else

@ -47,6 +47,7 @@ import siprp.database.cayenne.objects.TrabalhadoresEcdsDatasObservacoes;
import siprp.database.cayenne.objects.TrabalhadoresProcesso;
import siprp.logic.SIPRPLogic.LeafUIActionBinding;
import siprp.ui.SIPRPWindow;
import siprp.ui.SIPRPWindow.ActionActivation;
public class ProcessoDadosPanel extends JPanel
{
@ -95,11 +96,11 @@ public class ProcessoDadosPanel extends JPanel
private final JLabel labelTrabalhadorNacionalidade = new JLabel( "Nacionalidade" );
private final JLabel labelTrabalhadorObservacoes = new JLabel( "Observa" + ccedil + otilde + "es" );
private final LeafInputField<String> inputTrabalhadorNome = new LeafInputField<String>();
private final LeafInputField<HashMap<String,String>> inputTrabalhadorSexo = new LeafInputField<HashMap<String,String>>();
private final LeafInputField<Date> inputTrabalhadorDataNascimento = new LeafInputField<Date>();
private final LeafInputField<String> inputTrabalhadorNacionalidade = new LeafInputField<String>();
private final LeafInputField<String> inputTrabalhadorObservacoes = new LeafInputField<String>();
public final LeafInputField<String> inputTrabalhadorNome = new LeafInputField<String>();
public final LeafInputField<HashMap<String,String>> inputTrabalhadorSexo = new LeafInputField<HashMap<String,String>>();
public final LeafInputField<Date> inputTrabalhadorDataNascimento = new LeafInputField<Date>();
public final LeafInputField<String> inputTrabalhadorNacionalidade = new LeafInputField<String>();
public final LeafInputField<String> inputTrabalhadorObservacoes = new LeafInputField<String>();
// processo
@ -108,62 +109,63 @@ public class ProcessoDadosPanel extends JPanel
private final JLabel labelProcessoDataFim = new JLabel( "Fim" );
private final JLabel labelProcessoMotivo = new JLabel( "Motivo" );
private final LeafInputField<HashMap<String,String>> inputProcessoEstado = new LeafInputField<HashMap<String,String>>();
private final LeafInputField<Date> inputProcessoDataInicio = new LeafInputField<Date>();
private final LeafInputField<Date> inputProcessoDataFim = new LeafInputField<Date>();
private final LeafInputField<HashMap<Integer,String>> inputProcessoMotivo = new LeafInputField<HashMap<Integer,String>>();
public final LeafInputField<HashMap<String,String>> inputProcessoEstado = new LeafInputField<HashMap<String,String>>();
public final LeafInputField<Date> inputProcessoDataInicio = new LeafInputField<Date>();
public final LeafInputField<Date> inputProcessoDataFim = new LeafInputField<Date>();
public final LeafInputField<HashMap<Integer,String>> inputProcessoMotivo = new LeafInputField<HashMap<Integer,String>>();
// consulta
private final JLabel labelConsultaEstado = new JLabel( "Estado" );
private final JLabel labelConsultaData = new JLabel( "Data" );
private final LeafInputField<HashMap<Integer, String>> inputConsultaEstado = new LeafInputField<HashMap<Integer, String>>();
private final LeafInputField<Date> inputConsultaData = new LeafInputField<Date>();
public final LeafInputField<HashMap<Integer, String>> inputConsultaEstado = new LeafInputField<HashMap<Integer, String>>();
public final LeafInputField<Date> inputConsultaData = new LeafInputField<Date>();
// marcacao consulta
private final JLabel labelConsultaMarcacaoEstado = new JLabel( "Estado" );
private final JLabel labelConsultaMarcacaoData = new JLabel( "Data" );
private final LeafInputField<HashMap<Integer, String>> inputConsultaMarcacaoEstado = new LeafInputField<HashMap<Integer, String>>();
private final LeafInputField<Date> inputConsultaMarcacaoData = new LeafInputField<Date>();
public final LeafInputField<HashMap<Integer, String>> inputConsultaMarcacaoEstado = new LeafInputField<HashMap<Integer, String>>();
public final LeafInputField<Date> inputConsultaMarcacaoData = new LeafInputField<Date>();
// email marcacao consulta
private final JLabel labelConsultaMarcacaoEmailData = new JLabel( "Data" );
private final JLabel labelConsultaMarcacaoEmailSubject = new JLabel( "Assunto" );
private final JLabel labelConsultaMarcacaoEmailBody = new JLabel( "Mensagem" );
private final LeafInputField<Date> inputConsultaMarcacaoEmailData = new LeafInputField<Date>();
private final LeafInputField<String> inputConsultaMarcacaoEmailSubject = new LeafInputField<String>();
private final LeafInputField<String> inputConsultaMarcacaoEmailBody = new LeafInputField<String>();
public final LeafInputField<Date> inputConsultaMarcacaoEmailData = new LeafInputField<Date>();
public final LeafInputField<String> inputConsultaMarcacaoEmailSubject = new LeafInputField<String>();
public final LeafInputField<String> inputConsultaMarcacaoEmailBody = new LeafInputField<String>();
// observacao marcacao consulta
private final LeafInputField<String> inputConsultaMarcacaoObsMensagem = new LeafInputField<String>();
@ActionActivation(onSelect="", onChange=SAVE_CONSULTA_MARCACAO_OBSERVACOES)
public final LeafInputField<String> inputConsultaMarcacaoObsMensagem = new LeafInputField<String>();
// exame
private final JLabel labelExameEstado = new JLabel( "Estado" );
private final JLabel labelExameData = new JLabel( "Data" );
private final LeafInputField<String> inputExameEstado = new LeafInputField<String>();
private final LeafInputField<Date> inputExameData = new LeafInputField<Date>();
public final LeafInputField<String> inputExameEstado = new LeafInputField<String>();
public final LeafInputField<Date> inputExameData = new LeafInputField<Date>();
// marcacao exame
private final JLabel labelExameMarcacaoEstado = new JLabel( "Estado" );
private final JLabel labelExameMarcacaoData = new JLabel( "Data" );
private final LeafInputField<String> inputExameMarcacaoEstado = new LeafInputField<String>();
private final LeafInputField<Date> inputExameMarcacaoData = new LeafInputField<Date>();
public final LeafInputField<String> inputExameMarcacaoEstado = new LeafInputField<String>();
public final LeafInputField<Date> inputExameMarcacaoData = new LeafInputField<Date>();
// email marcacao exame
private final JLabel labelExameMarcacaoEmailData = new JLabel( "Data" );
private final JLabel labelExameMarcacaoEmailSubject = new JLabel( "Assunto" );
private final JLabel labelExameMarcacaoEmailBody = new JLabel( "Mensagem" );
private final LeafInputField<Date> inputExameMarcacaoEmailData = new LeafInputField<Date>();
private final LeafInputField<String> inputExameMarcacaoEmailSubject = new LeafInputField<String>();
private final LeafInputField<String> inputExameMarcacaoEmailBody = new LeafInputField<String>();
public final LeafInputField<Date> inputExameMarcacaoEmailData = new LeafInputField<Date>();
public final LeafInputField<String> inputExameMarcacaoEmailSubject = new LeafInputField<String>();
public final LeafInputField<String> inputExameMarcacaoEmailBody = new LeafInputField<String>();
// observacao marcacao exame
private final LeafInputField<String> inputExameMarcacaoObsMensagem = new LeafInputField<String>();
public final LeafInputField<String> inputExameMarcacaoObsMensagem = new LeafInputField<String>();
public ProcessoDadosPanel(SIPRPWindow parentWindow)
{
@ -378,13 +380,12 @@ public class ProcessoDadosPanel extends JPanel
@LeafUIActionBinding(action = CREATE_CONSULTA)
public void setForNewConsulta( TrabalhadoresConsultas consulta )
{
inputConsultaData.setEditable( true );
}
@LeafUIActionBinding(action = CREATE_CONSULTA_MARCACAO)
public void setForNewConsultaMarcacao( TrabalhadoresConsultasDatas marcacao )
{
LeafCalendarDialog calendar = new LeafCalendarDialog( getParentFrame(), this, false );
LeafCalendarDialog calendar = new LeafCalendarDialog( getParentFrame(), this, false, false);
Date date = calendar.getDate();
marcacao.setData( date );
}
@ -392,14 +393,14 @@ public class ProcessoDadosPanel extends JPanel
@LeafUIActionBinding(action = CREATE_CONSULTA_MARCACAO_EMAIL)
public void setForNewConsultaMarcacaoEmail( TrabalhadoresConsultasDatasEmails email )
{
inputConsultaMarcacaoEmailBody.setEditable( true );
inputConsultaMarcacaoEmailData.setEditable( true );
inputConsultaMarcacaoEmailSubject.setEditable( true );
}
@LeafUIActionBinding(action = CREATE_CONSULTA_MARCACAO_OBSERVACOES)
public void setForNewConsultaMarcacaoObservacoes( TrabalhadoresConsultasDatasObservacoes observacoes )
{
LeafTextDialog textDialog = new LeafTextDialog( getParentFrame(), this, "");
String text = textDialog.getText();
observacoes.setObservacao( text );
inputConsultaMarcacaoObsMensagem.setEditable( true );
}
@ -468,11 +469,11 @@ public class ProcessoDadosPanel extends JPanel
private void setupTrabalhadorPanel()
{
inputTrabalhadorNacionalidade.setEditable( false );
inputTrabalhadorDataNascimento.setEditable( false );
inputTrabalhadorNome.setEditable( false );
inputTrabalhadorSexo.setEditable( false );
inputTrabalhadorObservacoes.setEditable( false );
// inputTrabalhadorNacionalidade.setEditable( false );
// inputTrabalhadorDataNascimento.setEditable( false );
// inputTrabalhadorNome.setEditable( false );
// inputTrabalhadorSexo.setEditable( false );
// inputTrabalhadorObservacoes.setEditable( false );
setupSimpleDataPanel( panelTrabalhador, "Trabalhador", labelTrabalhadorNome, inputTrabalhadorNome, labelTrabalhadorSexo, inputTrabalhadorSexo, labelTrabalhadorNacionalidade, inputTrabalhadorNacionalidade, labelTrabalhadorDataNascimento, inputTrabalhadorDataNascimento, labelTrabalhadorObservacoes, inputTrabalhadorObservacoes );
}
@ -484,8 +485,8 @@ public class ProcessoDadosPanel extends JPanel
private void setupConsultaPanel()
{
setupSimpleDataPanel( panelConsulta, "Consulta", labelConsultaEstado, inputConsultaEstado, labelConsultaData, inputConsultaData, new JPanel() );
inputConsultaEstado.setEditable( true );
inputConsultaData.setEditable( true );
// inputConsultaEstado.setEditable( true );
// inputConsultaData.setEditable( true );
}
private void setupConsultaMarcacaoPanel()
@ -500,7 +501,7 @@ public class ProcessoDadosPanel extends JPanel
private void setupConsultaMarcacaoObservacoesPanel()
{
inputConsultaMarcacaoObsMensagem.setEditable( false );
// inputConsultaMarcacaoObsMensagem.setEditable( false );
setupSimpleDataPanel( panelConsultaMarcacaoObservacao, "Observa" + ccedil + otilde + "es", inputConsultaMarcacaoObsMensagem );
}
@ -521,7 +522,7 @@ public class ProcessoDadosPanel extends JPanel
private void setupExameMarcacaoObservacoesPanel()
{
inputExameMarcacaoObsMensagem.setEditable( false );
// inputExameMarcacaoObsMensagem.setEditable( false );
setupSimpleDataPanel( panelExameMarcacaoObservacao, "Observa" + ccedil + otilde + "es", inputExameMarcacaoObsMensagem );
}

@ -4,6 +4,8 @@ import static siprp.logic.SIPRPLogic.ACTION_STARTUP;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.lang.annotation.Annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@ -33,13 +35,14 @@ import siprp.logic.SIPRPLogic;
import siprp.logic.SIPRPLogic.Action;
import siprp.logic.SIPRPLogic.LeafLogicActionBinding;
import siprp.logic.SIPRPLogic.LeafUIActionBinding;
import siprp.medicina.processo.ui.LeafInputField;
import com.evolute.utils.tables.BaseTable;
import com.evolute.utils.tables.ColumnizedMappable;
import com.evolute.utils.tables.VectorTableModel;
import com.evolute.utils.tracker.TrackableWindow;
public class SIPRPWindow extends JFrame implements TrackableWindow, ListSelectionListener, TreeSelectionListener, ActionListener
public class SIPRPWindow extends JFrame implements TrackableWindow, ListSelectionListener, TreeSelectionListener, ActionListener, PropertyChangeListener
{
private static final long serialVersionUID = 1L;
@ -548,6 +551,10 @@ public class SIPRPWindow extends JFrame implements TrackableWindow, ListSelectio
{
((JButton) value).addActionListener( this );
}
else if( value instanceof LeafInputField )
{
((LeafInputField) value).addPropertyChangeListener( this );
}
} catch( IllegalAccessException e )
{
e.printStackTrace( System.out );
@ -665,6 +672,31 @@ public class SIPRPWindow extends JFrame implements TrackableWindow, ListSelectio
}
return result;
}
private List<String> getActionsForPropertyChangeEvent( PropertyChangeEvent evt )
{
List<String> result = new ArrayList<String>();
Annotation an = mapAnnotationByObject.get( evt.getSource() );
if(an != null)
{
if(an instanceof ActionActivation)
{
if(evt.getSource() instanceof LeafInputField)
{
if( LeafInputField.PROPERTY_CHANGED_CONSTANT.equals( evt.getPropertyName()))
{
String [] actions = ((ActionActivation) an).onChange();
for( String actionName : actions )
{
result.add( actionName );
}
}
}
}
}
return result;
}
@Override
public void valueChanged( TreeSelectionEvent event )
@ -703,4 +735,16 @@ public class SIPRPWindow extends JFrame implements TrackableWindow, ListSelectio
runAction( action, null );
}
}
@Override
public void propertyChange( PropertyChangeEvent evt )
{
List<String> actionNames = getActionsForPropertyChangeEvent( evt );
for( String action : actionNames )
{
runActionLater( action);
}
}
}

Loading…
Cancel
Save