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 15 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.List;
import javax.swing.JDialog;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTree;
@ -23,6 +23,7 @@ import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
import javax.swing.tree.TreeSelectionModel;
import com.evolute.swing.dialog.EvoDialog;
import com.evolute.utils.error.ErrorLogger;
import com.evolute.utils.images.ImageException;
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;
@ -57,13 +58,13 @@ public class TreeInserterDialog extends JDialog
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>();
@ -71,13 +72,13 @@ public class TreeInserterDialog extends JDialog
{
this.allRoot = root;
this.allModel = new DefaultTreeModel( allRoot );
this.allTree = new JTree(allModel);
this.allTree = new JTree( allModel );
this.allScroll = new JScrollPane( allTree );
this.setTitle( title );
try
{
buttonAdd = new LeafButton( ImageIconLoader.loadImageIcon( ICON_NAME_ADD ) );
buttonRemove = new LeafButton( ImageIconLoader.loadImageIcon( ICON_NAME_REM ) );
buttonAdd = new JButton( ImageIconLoader.loadImageIcon( ICON_NAME_ADD ) );
buttonRemove = new JButton( ImageIconLoader.loadImageIcon( ICON_NAME_REM ) );
} catch( ImageException e )
{
ErrorLogger.logException( e );
@ -91,13 +92,13 @@ public class TreeInserterDialog extends JDialog
Toolkit tk = Toolkit.getDefaultToolkit();
if( tk != null )
{
this.setSize( tk.getScreenSize().width, DIALOG_DEFAULT_DIMENSIONS.height );
this.setSize( tk.getScreenSize().width, tk.getScreenSize().height );
}
else
{
this.setSize( DIALOG_DEFAULT_DIMENSIONS );
}
this.setLocationRelativeTo( null );
this.setModal( true );
this.setVisible( true );
}

@ -14,6 +14,8 @@ import siprp.data.outer.HsLegislacaoCategoriaData;
import siprp.data.outer.HsLegislacaoData;
import siprp.data.outer.HsLegislacaoEmpresaData;
import siprp.data.outer.HsNormalizacaoData;
import siprp.data.outer.HsNormalizacaoEmpresaData;
import siprp.data.outer.HsNormalizacaoEstabelecimentoData;
import siprp.data.outer.HsPostoData;
import siprp.data.outer.HsPostoRiscoData;
import siprp.data.outer.HsRelatorioData;
@ -288,21 +290,62 @@ public class PlanoActuacaoDataProvider
}
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
{
result = ENTITY_PROVIDER.listLoad( HsNormalizacaoData.class,
new Object[] { null, portuguesa }, new String[] { HsNormalizacaoData.DELETED_DATE, HsNormalizacaoData.PORTUGUESA },
new String[] {} );
if( estabelecimento != null )
{
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 )
{
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()

@ -1,6 +1,7 @@
package siprp.higiene.gestao;
import java.awt.Cursor;
import java.util.Date;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
@ -38,7 +39,9 @@ public abstract class SIPRPLazyLoadedPanel extends JPanel
@Override
public void run()
{
long start = System.currentTimeMillis();
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 portuguesa = new DefaultMutableTreeNode("Normaliza" + ccedil + atilde + "o Portuguesa" );
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 );
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 );
internacional.add( normalizacaoNode );
}
// }
}
result.add( portuguesa );
result.add( internacional );
return result;
}
private static boolean hasEmpresa( HsNormalizacaoData normalizacao, EmpresasData empresa )
{
boolean result = false;
if( normalizacao != null && empresa != null )
{
for( HsNormalizacaoEmpresaData rel : normalizacao.fromHsNormalizacaoEmpresa_normalizacao_id() )
{
result = empresa.equals( rel.toEmpresa_id() );
if( result )
{
break;
}
}
}
return result;
}
// private static boolean hasEmpresa( HsNormalizacaoData normalizacao, EmpresasData empresa )
// {
// boolean result = false;
// if( normalizacao != null && empresa != null )
// {
// for( HsNormalizacaoEmpresaData rel : normalizacao.fromHsNormalizacaoEmpresa_normalizacao_id() )
// {
// result = empresa.equals( rel.toEmpresa_id() );
// if( result )
// {
// break;
// }
// }
// }
// return result;
// }
public static DefaultMutableTreeNode getNormalizacaoTreeForEstabelecimento( EstabelecimentosData estabelecimento )
{
DefaultMutableTreeNode result = new DefaultMutableTreeNode();
DefaultMutableTreeNode portuguesa = new DefaultMutableTreeNode("Normaliza" + ccedil + atilde + "o Portuguesa" );
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 );
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 );
internacional.add( normalizacaoNode );
}
// }
}
result.add( portuguesa );
result.add( internacional );

Loading…
Cancel
Save