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

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Diogo Neves 15 years ago
parent e5db6f8e53
commit 6f583a6ce5

Binary file not shown.

Binary file not shown.

@ -1,5 +1,8 @@
package leaf.ui;
import java.io.IOException;
import com.evolute.utils.error.ErrorLogger;
import com.evolute.utils.images.ImageException;
import com.evolute.utils.images.ImageIconLoader;
@ -7,9 +10,9 @@ public class LeafIconButton extends LeafButton implements LeafUIConstants
{
private static final long serialVersionUID = 1L;
private LeafIconButton( String imagePath ) throws ImageException
private LeafIconButton( String imagePath ) throws ImageException, IOException
{
super(ImageIconLoader.loadImageIcon( imagePath ));
super( ImageIconLoader.loadImageIcon( imagePath ) );
}
public static LeafIconButton createDefaultNewButton()
@ -40,11 +43,16 @@ public class LeafIconButton extends LeafButton implements LeafUIConstants
{
try
{
result = new LeafIconButton(imagePath);
result = new LeafIconButton( imagePath );
// result.setMargin( new Insets(0,0,0,0) );
} catch( ImageException e )
}
catch( ImageException e )
{
ErrorLogger.logException( e );
}
catch ( IOException e )
{
e.printStackTrace();
ErrorLogger.logException( e );
}
}
return result;

@ -9,6 +9,7 @@ import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.util.Enumeration;
import java.util.LinkedList;
import java.util.List;
@ -80,7 +81,12 @@ public class TreeInserterDialog extends EvoDialog
{
buttonAdd = new JButton( ImageIconLoader.loadImageIcon( ICON_NAME_ADD ) );
buttonRemove = new JButton( ImageIconLoader.loadImageIcon( ICON_NAME_REM ) );
} catch( ImageException e )
}
catch( ImageException e )
{
ErrorLogger.logException( e );
}
catch ( IOException e )
{
ErrorLogger.logException( e );
}

@ -75,6 +75,8 @@ public class Main implements com.evolute.utils.ui.window.Connector
UIManager.put( "FormattedTextField.inactiveForeground", ColorUIResource.BLACK );
UIManager.put( "FormattedTextField.foreground", ColorUIResource.RED.darker() );
new SIPRPShutdownHook().init();
new SIPRPUIInitializer().doInit();
SIPRPPropertiesLoader.getInstance().load();
@ -232,7 +234,22 @@ public class Main implements com.evolute.utils.ui.window.Connector
{
if( siprpTracker == null || siprpTracker.quit() )
{
System.exit( 0 );
// Thread exit = new Thread( new Runnable()
// {
// @Override
// public void run()
// {
if ( siprpTracker != null && siprpTracker.getLoginWindow() != null )
{
siprpTracker.getLoginWindow().setVisible( false );
siprpTracker.getLoginWindow().dispose();
}
System.exit( 0 );
// }
// });
// exit.setName( "Exit Thread" );
// exit.setDaemon( false );
// exit.start();
}
}

@ -0,0 +1,39 @@
package siprp;
import siprp.higiene.relatorio.MedidasRiscosDeleterController;
import com.evolute.threads.EvoShutdownHook;
import com.evolute.utils.error.ErrorLogger;
public class SIPRPShutdownHook extends EvoShutdownHook
{
public SIPRPShutdownHook()
{
}
public void execute()
{
MedidasRiscosDeleterController controller = MedidasRiscosDeleterController.getInstance();
System.out.println( "\nChecking " + controller.getThreads().size() + " threads ..." );
for ( Thread deleter : controller.getThreads() )
{
System.out.println( "\nChecking " + deleter.getName() + " ... Running ? " + deleter.isAlive() );
if ( deleter.isAlive() )
{
try
{
System.out.println( "\nWaiting for <" + deleter + "> ... " );
deleter.join();
}
catch ( InterruptedException e )
{
ErrorLogger.logException( e );
}
}
}
}
}

@ -3,12 +3,11 @@ package siprp.higiene.gestao.riscos;
import info.clearthought.layout.TableLayout;
import info.clearthought.layout.TableLayoutConstraints;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.event.CaretEvent;
@ -20,6 +19,7 @@ import siprp.SIPRPSpellChecker;
import siprp.data.outer.HsMedidaData;
import siprp.higiene.gestao.SIPRPLazyLoadedPanel;
import com.evolute.utils.error.ErrorLogger;
import com.evolute.utils.images.ImageException;
import com.evolute.utils.images.ImageIconLoader;
@ -54,9 +54,14 @@ public class GerirMedidaPanel extends SIPRPLazyLoadedPanel
{
buttonSaveRequesito = new LeafButton( ImageIconLoader.loadImageIcon( ICON_NAME_SAVE ) );
buttonRevertRequesito = new LeafButton( ImageIconLoader.loadImageIcon( ICON_NAME_REVERT ) );
} catch( ImageException e )
}
catch( ImageException e )
{
e.printStackTrace();
ErrorLogger.logException( e );
}
catch ( IOException e )
{
ErrorLogger.logException( e );
}
startupComponents();
startupLayout();

@ -5,9 +5,9 @@ import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil;
import info.clearthought.layout.TableLayout;
import info.clearthought.layout.TableLayoutConstraints;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
@ -22,6 +22,7 @@ import leaf.ui.LeafDialog;
import siprp.SIPRPSpellChecker;
import siprp.data.outer.HsRelatorioPostoMedidaData;
import com.evolute.utils.error.ErrorLogger;
import com.evolute.utils.images.ImageException;
import com.evolute.utils.images.ImageIconLoader;
@ -64,9 +65,14 @@ public class GerirMedidaRelatorioPanel extends JPanel
buttonRevertMedida = new LeafButton( ImageIconLoader.loadImageIcon( ICON_NAME_REVERT ) );
buttonSaveRequesito = new LeafButton( ImageIconLoader.loadImageIcon( ICON_NAME_SAVE ) );
buttonRevertRequesito = new LeafButton( ImageIconLoader.loadImageIcon( ICON_NAME_REVERT ) );
} catch( ImageException e )
}
catch( ImageException e )
{
e.printStackTrace();
ErrorLogger.logException( e );
}
catch ( IOException e )
{
ErrorLogger.logException( e );
}
startupComponents();
startupLayout();

@ -9,7 +9,6 @@ import java.awt.Color;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@ -349,11 +348,17 @@ public class GerirMedidasRelatorioPanel extends SIPRPLazyLoadedPanel
return JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog( this, message, "Confirma"+ccedil+atilde+"o", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null );
}
private String shortenString( String string )
{
return string == null ? null : (string.length() <= 40 ? string : (string.substring(0,40) + "..."));
}
private void rem()
{
for( TreePath path : tree.getSelectionPaths() )
{
if( !rem(path) )
if ( ! rem( path ) )
{
break;
}
@ -361,15 +366,8 @@ public class GerirMedidasRelatorioPanel extends SIPRPLazyLoadedPanel
doRefresh();
setEnabled();
}
private String shortenString( String string )
{
return string == null ? null : (string.length() <= 40 ? string : (string.substring(0,40) + "..."));
}
private boolean rem(TreePath path)
private boolean rem( TreePath path )
{
boolean outcome = false;
try
@ -395,14 +393,9 @@ public class GerirMedidasRelatorioPanel extends SIPRPLazyLoadedPanel
if( confirm("Tem a certeza que deseja remover o risco '" + shortenString( rel.toRisco_id().toString() ) + "'?") )
{
HsRelatorioRiscoData riscoData = rel.toRisco_id();
for( HsRelatorioMedidaData medida : riscoData.fromHsRelatorioMedida_risco_id() )
{
for ( HsRelatorioPostoMedidaData relMedida : medida.fromHsRelatorioPostoMedida_medida_id() )
{
relMedida.delete();
}
medida.delete();
}
MedidasRiscosDeleterController.getInstance().delete( new MedidasRiscosDeleter( riscoData ) );
riscoData.delete();
rel.delete();

@ -0,0 +1,51 @@
package siprp.higiene.relatorio;
import com.evolute.utils.error.ErrorLogger;
import siprp.data.outer.HsRelatorioMedidaData;
import siprp.data.outer.HsRelatorioPostoMedidaData;
import siprp.data.outer.HsRelatorioRiscoData;
public class MedidasRiscosDeleter implements Runnable
{
private HsRelatorioRiscoData riscoData;
private String name;
public MedidasRiscosDeleter( HsRelatorioRiscoData riscoData )
{
this.riscoData = riscoData;
setName( "Delete Medidas from Risco - " + riscoData );
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public void run()
{
try
{
for( HsRelatorioMedidaData medida : riscoData.fromHsRelatorioMedida_risco_id() )
{
for ( HsRelatorioPostoMedidaData relMedida : medida.fromHsRelatorioPostoMedida_medida_id() )
{
relMedida.delete();
}
medida.delete();
}
}
catch ( Exception e )
{
ErrorLogger.logException( e );
}
}
}

@ -0,0 +1,51 @@
package siprp.higiene.relatorio;
import java.util.LinkedList;
import java.util.List;
public class MedidasRiscosDeleterController
{
private static MedidasRiscosDeleterController INSTANCE = null;
private List< Thread > threads = null;
private MedidasRiscosDeleterController()
{
threads = new LinkedList< Thread >();
}
public static synchronized MedidasRiscosDeleterController getInstance()
{
if ( INSTANCE == null )
{
INSTANCE = new MedidasRiscosDeleterController();
}
return INSTANCE;
}
public List< Thread > getThreads()
{
return threads;
}
private void setThreads( List< Thread > threads )
{
this.threads = threads;
}
public void delete( MedidasRiscosDeleter thread )
{
if ( getThreads() == null )
{
setThreads( new LinkedList< Thread >() );
}
Thread t = new Thread( thread );
t.setName( thread.getName() );
t.setDaemon( false );
t.start();
getThreads().add( t );
}
}

@ -14,6 +14,7 @@ import java.awt.Color;
import javax.swing.Icon;
import javax.swing.tree.DefaultMutableTreeNode;
import com.evolute.utils.error.ErrorLogger;
import com.evolute.utils.images.ImageIconLoader;
/**
@ -51,11 +52,11 @@ abstract public class EstruturaProcessoMutableTreeNode extends DefaultMutableTre
{
try
{
icon = ImageIconLoader.loadImageIcon( getClass(), getIconPath() );
icon = ImageIconLoader.loadImageIcon( getIconPath() );
}
catch( Exception ex )
{
ex.printStackTrace();
ErrorLogger.logException( ex );
}
}
}

@ -483,8 +483,7 @@ public class MailDialog extends CustomJDialog
private JButton createButton( Action action, String iconPath )
throws Exception
{
action.putValue( Action.SMALL_ICON,
ImageIconLoader.loadImageIcon( getClass(), iconPath ) );
action.putValue( Action.SMALL_ICON, ImageIconLoader.loadImageIcon( iconPath ) );
JButton button = new JButton( action );
button.setText( null );

Loading…
Cancel
Save