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

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

Binary file not shown.

@ -12,7 +12,7 @@ import java.util.Enumeration;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import javax.swing.JDialog; import javax.swing.JButton;
import javax.swing.JLabel; import javax.swing.JLabel;
import javax.swing.JScrollPane; import javax.swing.JScrollPane;
import javax.swing.JTree; import javax.swing.JTree;
@ -23,6 +23,7 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath; import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel; import javax.swing.tree.TreeSelectionModel;
import com.evolute.swing.dialog.EvoDialog;
import com.evolute.utils.error.ErrorLogger; import com.evolute.utils.error.ErrorLogger;
import com.evolute.utils.images.ImageException; import com.evolute.utils.images.ImageException;
import com.evolute.utils.images.ImageIconLoader; import com.evolute.utils.images.ImageIconLoader;
@ -30,7 +31,7 @@ import com.evolute.utils.ui.trees.TreeTools;
public class TreeInserterDialog extends JDialog public class TreeInserterDialog extends EvoDialog
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -57,13 +58,13 @@ public class TreeInserterDialog extends JDialog
private final JScrollPane allScroll; private final JScrollPane allScroll;
private LeafButton buttonAdd = null; private JButton buttonAdd = null;
private LeafButton buttonRemove = null; private JButton buttonRemove = null;
private final LeafButton buttonOK = new LeafButton( "OK" ); private final JButton buttonOK = new JButton( "OK" );
private final LeafButton buttonCancel = new LeafButton( "Cancelar" ); private final JButton buttonCancel = new JButton( "Cancelar" );
private static List<Object> expandedNodes = new LinkedList<Object>(); private static List<Object> expandedNodes = new LinkedList<Object>();
@ -71,13 +72,13 @@ public class TreeInserterDialog extends JDialog
{ {
this.allRoot = root; this.allRoot = root;
this.allModel = new DefaultTreeModel( allRoot ); this.allModel = new DefaultTreeModel( allRoot );
this.allTree = new JTree(allModel); this.allTree = new JTree( allModel );
this.allScroll = new JScrollPane( allTree ); this.allScroll = new JScrollPane( allTree );
this.setTitle( title ); this.setTitle( title );
try try
{ {
buttonAdd = new LeafButton( ImageIconLoader.loadImageIcon( ICON_NAME_ADD ) ); buttonAdd = new JButton( ImageIconLoader.loadImageIcon( ICON_NAME_ADD ) );
buttonRemove = new LeafButton( ImageIconLoader.loadImageIcon( ICON_NAME_REM ) ); buttonRemove = new JButton( ImageIconLoader.loadImageIcon( ICON_NAME_REM ) );
} catch( ImageException e ) } catch( ImageException e )
{ {
ErrorLogger.logException( e ); ErrorLogger.logException( e );
@ -91,13 +92,13 @@ public class TreeInserterDialog extends JDialog
Toolkit tk = Toolkit.getDefaultToolkit(); Toolkit tk = Toolkit.getDefaultToolkit();
if( tk != null ) if( tk != null )
{ {
this.setSize( tk.getScreenSize().width, DIALOG_DEFAULT_DIMENSIONS.height ); this.setSize( tk.getScreenSize().width, tk.getScreenSize().height );
} }
else else
{ {
this.setSize( DIALOG_DEFAULT_DIMENSIONS ); this.setSize( DIALOG_DEFAULT_DIMENSIONS );
} }
this.setLocationRelativeTo( null );
this.setModal( true ); this.setModal( true );
this.setVisible( true ); this.setVisible( true );
} }

@ -14,6 +14,8 @@ import siprp.data.outer.HsLegislacaoCategoriaData;
import siprp.data.outer.HsLegislacaoData; import siprp.data.outer.HsLegislacaoData;
import siprp.data.outer.HsLegislacaoEmpresaData; import siprp.data.outer.HsLegislacaoEmpresaData;
import siprp.data.outer.HsNormalizacaoData; import siprp.data.outer.HsNormalizacaoData;
import siprp.data.outer.HsNormalizacaoEmpresaData;
import siprp.data.outer.HsNormalizacaoEstabelecimentoData;
import siprp.data.outer.HsPostoData; import siprp.data.outer.HsPostoData;
import siprp.data.outer.HsPostoRiscoData; import siprp.data.outer.HsPostoRiscoData;
import siprp.data.outer.HsRelatorioData; import siprp.data.outer.HsRelatorioData;
@ -289,20 +291,61 @@ public class PlanoActuacaoDataProvider
return result == null ? new LinkedList<HsLegislacaoData>() : result; return result == null ? new LinkedList<HsLegislacaoData>() : result;
} }
public List< HsNormalizacaoData > getNormalizacao( boolean portuguesa ) public List<HsNormalizacaoData> getNormalizacaoForEstabelecimento( boolean portuguesa, EstabelecimentosData estabelecimento )
{ {
List< HsNormalizacaoData > result = null; List<HsNormalizacaoData> result = null;
try try
{ {
result = ENTITY_PROVIDER.listLoad( HsNormalizacaoData.class, if( estabelecimento != null )
new Object[] { null, portuguesa }, new String[] { HsNormalizacaoData.DELETED_DATE, HsNormalizacaoData.PORTUGUESA }, {
new String[] {} ); Expression where = new Field( HsNormalizacaoData.DELETED_DATE_FULL ).isEqual( null );
where = where.and( new Field( HsNormalizacaoEstabelecimentoData.ESTABELECIMENTO_ID_FULL ).isEqual( estabelecimento.getId() ) );
where = where.and( new Field( HsNormalizacaoData.PORTUGUESA_FULL ).isEqual( portuguesa ) );
List<ForeignKey> fks = new LinkedList<ForeignKey>();
fks.add( new ForeignKey( HsNormalizacaoData.class, HsNormalizacaoData.ID_FULL, HsNormalizacaoEstabelecimentoData.class, HsNormalizacaoEstabelecimentoData.NORMALIZACAO_ID_FULL ) );
result = ENTITY_PROVIDER.listLoad( HsNormalizacaoData.class, fks, where, new String[] { HsNormalizacaoData.DESCRICAO_FULL } );
}
else
{
result = ENTITY_PROVIDER.listLoad( HsNormalizacaoData.class, new Object[]{ null, portuguesa }, new String[]{ HsNormalizacaoData.DELETED_DATE_FULL, HsNormalizacaoData.PORTUGUESA_FULL }, new String[] { HsNormalizacaoData.DESCRICAO_FULL } );
}
} }
catch ( Exception e ) catch ( Exception e )
{ {
ErrorLogger.logException( e ); ErrorLogger.logException( e );
} }
return result; return result == null ? new LinkedList<HsNormalizacaoData>() : result;
}
public List<HsNormalizacaoData> getNormalizacaoForEmpresa( boolean portuguesa, EmpresasData empresa )
{
List<HsNormalizacaoData> result = null;
try
{
if( empresa != null )
{
Expression where = new Field( HsNormalizacaoData.DELETED_DATE_FULL ).isEqual( null );
where = where.and( new Field( HsNormalizacaoEmpresaData.EMPRESA_ID_FULL ).isEqual( empresa.getId() ) );
where = where.and( new Field( HsNormalizacaoData.PORTUGUESA_FULL ).isEqual( portuguesa ) );
List<ForeignKey> fks = new LinkedList<ForeignKey>();
fks.add( new ForeignKey( HsNormalizacaoData.class, HsNormalizacaoData.ID_FULL, HsNormalizacaoEmpresaData.class, HsNormalizacaoEmpresaData.NORMALIZACAO_ID_FULL ) );
result = ENTITY_PROVIDER.listLoad( HsNormalizacaoData.class, fks, where, new String[] { HsNormalizacaoData.DESCRICAO_FULL } );
}
else
{
result = ENTITY_PROVIDER.listLoad( HsNormalizacaoData.class, new Object[]{ null, portuguesa }, new String[]{ HsNormalizacaoData.DELETED_DATE_FULL, HsNormalizacaoData.PORTUGUESA_FULL }, new String[] { HsNormalizacaoData.DESCRICAO_FULL } );
}
}
catch ( Exception e )
{
ErrorLogger.logException( e );
}
return result == null ? new LinkedList<HsNormalizacaoData>() : result;
}
public List<HsNormalizacaoData> getNormalizacao( boolean portuguesa )
{
return getNormalizacaoForEmpresa( portuguesa, (EmpresasData) null );
} }
public List< HsEquipamentoData > getAllEquipamentos() public List< HsEquipamentoData > getAllEquipamentos()

@ -1,6 +1,7 @@
package siprp.higiene.gestao; package siprp.higiene.gestao;
import java.awt.Cursor; import java.awt.Cursor;
import java.util.Date;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
@ -38,7 +39,9 @@ public abstract class SIPRPLazyLoadedPanel extends JPanel
@Override @Override
public void run() public void run()
{ {
long start = System.currentTimeMillis();
refresh(); refresh();
System.out.println("\n\t" + SIPRPLazyLoadedPanel.this.getClass() + ": took " + ( System.currentTimeMillis() - start ) );
} }
} ); } );
} }

@ -468,64 +468,64 @@ public class HigieneSegurancaLogic
DefaultMutableTreeNode result = new DefaultMutableTreeNode(); DefaultMutableTreeNode result = new DefaultMutableTreeNode();
DefaultMutableTreeNode portuguesa = new DefaultMutableTreeNode("Normaliza" + ccedil + atilde + "o Portuguesa" ); DefaultMutableTreeNode portuguesa = new DefaultMutableTreeNode("Normaliza" + ccedil + atilde + "o Portuguesa" );
DefaultMutableTreeNode internacional = new DefaultMutableTreeNode("Normaliza" + ccedil + atilde + "o Internacional" ); DefaultMutableTreeNode internacional = new DefaultMutableTreeNode("Normaliza" + ccedil + atilde + "o Internacional" );
for( HsNormalizacaoData normalizacao : planoProvider.getNormalizacao( true ) ) for( HsNormalizacaoData normalizacao : planoProvider.getNormalizacaoForEmpresa( true, empresa ) )
{ {
if( empresa == null || hasEmpresa( normalizacao, empresa ) ) // if( empresa == null || hasEmpresa( normalizacao, empresa ) )
{ // {
DefaultMutableTreeNode normalizacaoNode = new DefaultMutableTreeNode( normalizacao ); DefaultMutableTreeNode normalizacaoNode = new DefaultMutableTreeNode( normalizacao );
portuguesa.add( normalizacaoNode ); portuguesa.add( normalizacaoNode );
} // }
} }
for( HsNormalizacaoData normalizacao : planoProvider.getNormalizacao( false ) ) for( HsNormalizacaoData normalizacao : planoProvider.getNormalizacaoForEmpresa( false, empresa ) )
{ {
if( empresa == null || hasEmpresa( normalizacao, empresa ) ) // if( empresa == null || hasEmpresa( normalizacao, empresa ) )
{ // {
DefaultMutableTreeNode normalizacaoNode = new DefaultMutableTreeNode( normalizacao ); DefaultMutableTreeNode normalizacaoNode = new DefaultMutableTreeNode( normalizacao );
internacional.add( normalizacaoNode ); internacional.add( normalizacaoNode );
} // }
} }
result.add( portuguesa ); result.add( portuguesa );
result.add( internacional ); result.add( internacional );
return result; return result;
} }
private static boolean hasEmpresa( HsNormalizacaoData normalizacao, EmpresasData empresa ) // private static boolean hasEmpresa( HsNormalizacaoData normalizacao, EmpresasData empresa )
{ // {
boolean result = false; // boolean result = false;
if( normalizacao != null && empresa != null ) // if( normalizacao != null && empresa != null )
{ // {
for( HsNormalizacaoEmpresaData rel : normalizacao.fromHsNormalizacaoEmpresa_normalizacao_id() ) // for( HsNormalizacaoEmpresaData rel : normalizacao.fromHsNormalizacaoEmpresa_normalizacao_id() )
{ // {
result = empresa.equals( rel.toEmpresa_id() ); // result = empresa.equals( rel.toEmpresa_id() );
if( result ) // if( result )
{ // {
break; // break;
} // }
} // }
} // }
return result; // return result;
} // }
public static DefaultMutableTreeNode getNormalizacaoTreeForEstabelecimento( EstabelecimentosData estabelecimento ) public static DefaultMutableTreeNode getNormalizacaoTreeForEstabelecimento( EstabelecimentosData estabelecimento )
{ {
DefaultMutableTreeNode result = new DefaultMutableTreeNode(); DefaultMutableTreeNode result = new DefaultMutableTreeNode();
DefaultMutableTreeNode portuguesa = new DefaultMutableTreeNode("Normaliza" + ccedil + atilde + "o Portuguesa" ); DefaultMutableTreeNode portuguesa = new DefaultMutableTreeNode("Normaliza" + ccedil + atilde + "o Portuguesa" );
DefaultMutableTreeNode internacional = new DefaultMutableTreeNode("Normaliza" + ccedil + atilde + "o Internacional" ); DefaultMutableTreeNode internacional = new DefaultMutableTreeNode("Normaliza" + ccedil + atilde + "o Internacional" );
for( HsNormalizacaoData normalizacao : planoProvider.getNormalizacao( true ) ) for( HsNormalizacaoData normalizacao : planoProvider.getNormalizacaoForEstabelecimento( true, estabelecimento ) )
{ {
if( estabelecimento == null || hasEstabelecimento( normalizacao, estabelecimento ) ) // if( estabelecimento == null || hasEstabelecimento( normalizacao, estabelecimento ) )
{ // {
DefaultMutableTreeNode normalizacaoNode = new DefaultMutableTreeNode( normalizacao ); DefaultMutableTreeNode normalizacaoNode = new DefaultMutableTreeNode( normalizacao );
portuguesa.add( normalizacaoNode ); portuguesa.add( normalizacaoNode );
} // }
} }
for( HsNormalizacaoData normalizacao : planoProvider.getNormalizacao( false ) ) for( HsNormalizacaoData normalizacao : planoProvider.getNormalizacaoForEstabelecimento( false, estabelecimento ) )
{ {
if( estabelecimento == null || hasEstabelecimento( normalizacao, estabelecimento ) ) // if( estabelecimento == null || hasEstabelecimento( normalizacao, estabelecimento ) )
{ // {
DefaultMutableTreeNode normalizacaoNode = new DefaultMutableTreeNode( normalizacao ); DefaultMutableTreeNode normalizacaoNode = new DefaultMutableTreeNode( normalizacao );
internacional.add( normalizacaoNode ); internacional.add( normalizacaoNode );
} // }
} }
result.add( portuguesa ); result.add( portuguesa );
result.add( internacional ); result.add( internacional );

Loading…
Cancel
Save