ordenacao na listagem de ECDs por receber

git-svn-id: https://svn.coded.pt/svn/SIPRP@712 bb69d46d-e84e-40c8-a05a-06db0d633741
lxbfYeaa
Tiago Simão 18 years ago
parent c4f959643f
commit 9eaaca6270

@ -25,6 +25,9 @@ public class RecepcaoExamesLogic extends LeafLogic
@Action(isSave=true)
public final static String ACTION_RECEBER_EXAMES = "ACTION_RECEBER_EXAMES";
@Action(isSave=false)
public final static String ACTION_SORT = "ACTION_SORT";
public Prestadores currentAnalisador = null;
private MedicinaDAO dao = new MedicinaDAO();

@ -9,6 +9,7 @@ import java.awt.Dimension;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import javax.swing.JLabel;
@ -38,6 +39,9 @@ public class RecepcaoExamesWindow extends LeafWindow
private static final long serialVersionUID = 1L;
public static final String TITLE = "Recep" + ccedil + atilde + "o de ECDs";
private static final String TRABALHADOR = "Trabalhador";
private static final String EMPRESA = "Empresa";
public final JLabel labelAnalisador = new JLabel( "Analisador" );
@ -51,6 +55,10 @@ public class RecepcaoExamesWindow extends LeafWindow
public final JLabel labelData = new JLabel( "Data de recep" + ccedil + atilde + "o" );
public final LeafInputField<Date> fieldData = new LeafInputField<Date>();
public final JLabel labelOrder = new JLabel("Ordenar por: ");
@ActionActivation(onSelect="", onChange=RecepcaoExamesLogic.ACTION_SORT)
public final LeafInputField<OrderedMap<String>> fieldOrder = new LeafInputField<OrderedMap<String>>();
@ActionActivation(onSelect=RecepcaoExamesLogic.ACTION_RECEBER_EXAMES, onChange="")
public final LeafButton buttonReceber = new LeafButton( "Receber" );
@ -73,7 +81,7 @@ public class RecepcaoExamesWindow extends LeafWindow
TableLayout.PREFERRED, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM, TableLayout.PREFERRED
};
double[] rows = new double[] {
TableLayout.PREFERRED, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL, TableLayout.PREFERRED
TableLayout.PREFERRED, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL, TableLayout.MINIMUM, TableLayout.PREFERRED
};
TableLayout layout = new TableLayout( cols, rows );
layout.setHGap( 5 );
@ -91,6 +99,13 @@ public class RecepcaoExamesWindow extends LeafWindow
examesTable.setSelectionMode( ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
examesTable.setNonResizableNorReordable();
examesScroll = new JScrollPane( examesTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER );
examesTable.setAutoCreateRowSorter(true);
OrderedMap<String> orderOptions = new OrderedMap<String>();
orderOptions.putLast( EMPRESA, EMPRESA );
orderOptions.putLast( TRABALHADOR, TRABALHADOR );
fieldOrder.setObject( orderOptions, EMPRESA );
fieldOrder.setEditable( true );
}
private JPanel createMargin(boolean horizontal, int marginSize)
@ -105,15 +120,17 @@ public class RecepcaoExamesWindow extends LeafWindow
private void placeComponents()
{
pane.add( createMargin(true, 20), new TableLayoutConstraints(0,0,0,5));
pane.add( createMargin(true, 20), new TableLayoutConstraints(6,0,6,5));
pane.add( createMargin(false, 20), new TableLayoutConstraints(0,0,6,0));
pane.add( createMargin(false, 20), new TableLayoutConstraints(0,5,6,5));
pane.add( createMargin(true, 20), new TableLayoutConstraints(7,0,7,5));
pane.add( createMargin(false, 20), new TableLayoutConstraints(0,0,7,0));
pane.add( createMargin(false, 20), new TableLayoutConstraints(0,5,7,5));
pane.add( labelAnalisador, new TableLayoutConstraints( 1, 1, 2, 1 ) );
pane.add( fieldAnalisador, new TableLayoutConstraints( 1, 2, 4, 2 ) );
pane.add( labelData, new TableLayoutConstraints( 1, 3 ) );
pane.add( fieldData, new TableLayoutConstraints( 1, 4, 2, 4 ) );
pane.add( buttonReceber, new TableLayoutConstraints( 4, 4 ) );
pane.add( examesScroll, new TableLayoutConstraints( 1, 5, 4, 5 ) );
pane.add( labelOrder, new TableLayoutConstraints( 1, 6 ) );
pane.add( fieldOrder, new TableLayoutConstraints( 2, 6, 3, 6 ) );
}
@LeafUIActionBinding(action = RecepcaoExamesLogic.ACTION_FILL_EXAMES)
@ -154,6 +171,22 @@ public class RecepcaoExamesWindow extends LeafWindow
}
}
@LeafUIActionBinding(action=RecepcaoExamesLogic.ACTION_SORT)
public void sort()
{
Object selected = fieldOrder.getSelectedObject();
if( selected != null )
{
if(selected.toString().equals( TRABALHADOR ))
{
examesModel.order( 2, 3 );
}else
{
examesModel.order( 0, 1, 2, 3 );
}
}
}
@LeafUIActionBinding(action = RecepcaoExamesLogic.ACTION_SELECT_ANALISADOR)
public Prestadores selectAnalisador()
{

Loading…
Cancel
Save