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

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Tiago Simão 16 years ago
parent d4b1549cd3
commit ec136c28b7

@ -5,16 +5,23 @@ import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil;
import info.clearthought.layout.TableLayout; import info.clearthought.layout.TableLayout;
import info.clearthought.layout.TableLayoutConstraints; import info.clearthought.layout.TableLayoutConstraints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JPanel; import javax.swing.JPanel;
import leaf.ui.SimpleTable; import leaf.ui.SimpleTable;
import siprp.database.cayenne.objects.Estabelecimentos;
import siprp.database.cayenne.objects.HsRelatorio; import siprp.database.cayenne.objects.HsRelatorio;
import siprp.database.cayenne.objects.HsRelatorioLegislacao; import siprp.database.cayenne.objects.HsRelatorioLegislacao;
import siprp.database.cayenne.objects.MarcacoesEstabelecimento;
import siprp.logic.HigieneSegurancaLogic;
import com.evolute.utils.error.ErrorLogger;
import com.evolute.utils.tables.ColumnizedObjectArray; import com.evolute.utils.tables.ColumnizedObjectArray;
public class RelatorioLegislacaoPanel extends JPanel public class RelatorioLegislacaoPanel extends JPanel
@ -22,6 +29,8 @@ public class RelatorioLegislacaoPanel extends JPanel
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final JButton revert = new JButton("Reverter");
private HsRelatorio relatorio = null; private HsRelatorio relatorio = null;
private final SimpleTable<ColumnizedObjectArray> table = new SimpleTable<ColumnizedObjectArray>( "Categoria", "Legisla" + ccedil + atilde + "o" ); private final SimpleTable<ColumnizedObjectArray> table = new SimpleTable<ColumnizedObjectArray>( "Categoria", "Legisla" + ccedil + atilde + "o" );
@ -36,17 +45,45 @@ public class RelatorioLegislacaoPanel extends JPanel
private void startupComponents() private void startupComponents()
{ {
table.getTable().fixColumnWidth(0,200); table.getTable().fixColumnWidth(0,200);
revert.addActionListener( new ActionListener()
{
@Override
public void actionPerformed( ActionEvent e )
{
if( relatorio != null )
{
MarcacoesEstabelecimento marcacao = relatorio.getToHsMarcacoesEstabelecimento();
if( marcacao != null )
{
Estabelecimentos estabelecimento = marcacao.getToEstabelecimentos();
if( estabelecimento != null )
{
try
{
HigieneSegurancaLogic.reverterLegislacao( relatorio, estabelecimento );
} catch( Exception e1 )
{
ErrorLogger.logException( e1 );
}
}
}
refresh();
}
}
} );
} }
private void setupLayout() private void setupLayout()
{ {
TableLayout layout = new TableLayout( new double[]{ TableLayout.FILL }, new double[]{ TableLayout.FILL } ); TableLayout layout = new TableLayout( new double[]{ TableLayout.MINIMUM, TableLayout.FILL }, new double[]{ TableLayout.MINIMUM, TableLayout.FILL } );
this.setLayout( layout ); this.setLayout( layout );
} }
private void placeComponents() private void placeComponents()
{ {
this.add( table, new TableLayoutConstraints( 0, 0 ) ); this.add( table, new TableLayoutConstraints( 0, 1,1,1 ) );
this.add( revert, new TableLayoutConstraints( 0, 0 ) );
} }
public void setRelatorio( HsRelatorio relatorio ) public void setRelatorio( HsRelatorio relatorio )

@ -7,16 +7,24 @@ import static com.evolute.utils.strings.UnicodeLatin1Map.oacute;
import info.clearthought.layout.TableLayout; import info.clearthought.layout.TableLayout;
import info.clearthought.layout.TableLayoutConstraints; import info.clearthought.layout.TableLayoutConstraints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Vector; import java.util.Vector;
import javax.swing.JButton;
import javax.swing.JPanel; import javax.swing.JPanel;
import leaf.ui.SimpleTable; import leaf.ui.SimpleTable;
import siprp.data.Estabelecimento;
import siprp.database.cayenne.objects.Estabelecimentos;
import siprp.database.cayenne.objects.HsRelatorio; import siprp.database.cayenne.objects.HsRelatorio;
import siprp.database.cayenne.objects.HsRelatorioNormalizacao; import siprp.database.cayenne.objects.HsRelatorioNormalizacao;
import siprp.database.cayenne.objects.MarcacoesEstabelecimento;
import siprp.logic.HigieneSegurancaLogic;
import com.evolute.utils.error.ErrorLogger;
import com.evolute.utils.tables.ColumnizedObjectArray; import com.evolute.utils.tables.ColumnizedObjectArray;
public class RelatorioNormalizacaoPanel extends JPanel public class RelatorioNormalizacaoPanel extends JPanel
@ -26,6 +34,8 @@ public class RelatorioNormalizacaoPanel extends JPanel
private HsRelatorio relatorio = null; private HsRelatorio relatorio = null;
private final JButton revert = new JButton("Reverter");
private final SimpleTable<ColumnizedObjectArray> table = new SimpleTable<ColumnizedObjectArray>( "C" + oacute + "digo", "Normaliza" + ccedil + atilde + "o", "" ); private final SimpleTable<ColumnizedObjectArray> table = new SimpleTable<ColumnizedObjectArray>( "C" + oacute + "digo", "Normaliza" + ccedil + atilde + "o", "" );
public RelatorioNormalizacaoPanel() public RelatorioNormalizacaoPanel()
@ -39,17 +49,45 @@ public class RelatorioNormalizacaoPanel extends JPanel
{ {
table.getTable().fixColumnWidth(0,50); table.getTable().fixColumnWidth(0,50);
table.getTable().fixColumnWidth(2,100); table.getTable().fixColumnWidth(2,100);
revert.addActionListener( new ActionListener()
{
@Override
public void actionPerformed( ActionEvent e )
{
if( relatorio != null )
{
MarcacoesEstabelecimento marcacao = relatorio.getToHsMarcacoesEstabelecimento();
if( marcacao != null )
{
Estabelecimentos estabelecimento = marcacao.getToEstabelecimentos();
if( estabelecimento != null )
{
try
{
HigieneSegurancaLogic.reverterNormalizacao( relatorio, estabelecimento );
} catch( Exception e1 )
{
ErrorLogger.logException( e1 );
}
}
}
refresh();
}
}
} );
} }
private void setupLayout() private void setupLayout()
{ {
TableLayout layout = new TableLayout( new double[]{ TableLayout.FILL }, new double[]{ TableLayout.FILL } ); TableLayout layout = new TableLayout( new double[]{ TableLayout.MINIMUM, TableLayout.FILL }, new double[]{ TableLayout.MINIMUM, TableLayout.FILL } );
this.setLayout( layout ); this.setLayout( layout );
} }
private void placeComponents() private void placeComponents()
{ {
this.add( table, new TableLayoutConstraints( 0, 0 ) ); this.add( table, new TableLayoutConstraints( 0, 1,1,1 ) );
this.add( revert, new TableLayoutConstraints( 0, 0 ) );
} }
public void setRelatorio( HsRelatorio relatorio ) public void setRelatorio( HsRelatorio relatorio )

@ -301,7 +301,7 @@ public class HigieneSegurancaLogic
revertMedidasAndRiscos(posto.getHsPostoRiscoArray(),rPosto); revertMedidasAndRiscos(posto.getHsPostoRiscoArray(),rPosto);
} }
private static void reverterLegislacao( HsRelatorio relatorio, Estabelecimentos estabelecimento ) throws Exception public static void reverterLegislacao( HsRelatorio relatorio, Estabelecimentos estabelecimento ) throws Exception
{ {
int legislacaoSize = relatorio.getHsRelatorioLegislacaoArray().size(); int legislacaoSize = relatorio.getHsRelatorioLegislacaoArray().size();
for(int i = 0; i < legislacaoSize; ++i ) for(int i = 0; i < legislacaoSize; ++i )
@ -331,7 +331,7 @@ public class HigieneSegurancaLogic
return result; return result;
} }
private static void reverterNormalizacao( HsRelatorio relatorio, Estabelecimentos estabelecimento ) throws Exception public static void reverterNormalizacao( HsRelatorio relatorio, Estabelecimentos estabelecimento ) throws Exception
{ {
int normalizacaoSize = relatorio.getHsRelatorioNormalizacaoArray().size(); int normalizacaoSize = relatorio.getHsRelatorioNormalizacaoArray().size();
for(int i = 0; i < normalizacaoSize; ++i ) for(int i = 0; i < normalizacaoSize; ++i )

Loading…
Cancel
Save