forked from Coded/SIPRP
git-svn-id: https://svn.coded.pt/svn/SIPRP@1321 bb69d46d-e84e-40c8-a05a-06db0d633741
parent
9a900398b5
commit
b861ba2725
Binary file not shown.
@ -0,0 +1,77 @@
|
||||
package siprp.higiene.gestao;
|
||||
|
||||
import java.awt.Cursor;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import siprp.SIPRPTracker;
|
||||
|
||||
import com.evolute.utils.Singleton;
|
||||
import com.evolute.utils.error.ErrorLogger;
|
||||
|
||||
|
||||
public abstract class SIPRPLazyLoadedPanel extends JPanel
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private boolean inited = false;
|
||||
|
||||
public synchronized final void doRefresh( )
|
||||
{
|
||||
Runnable run = new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
inited = true;
|
||||
SIPRPTracker tracker = (SIPRPTracker) Singleton.getInstance( Singleton.TRACKER );
|
||||
if( tracker != null )
|
||||
{
|
||||
GestaoRelatorioWindow window = (GestaoRelatorioWindow)tracker.getWindow( GestaoRelatorioWindow.TITLE );
|
||||
window.runAsynchronously( new Runnable()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
refresh();
|
||||
}
|
||||
} );
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
setCursor( new Cursor( Cursor.WAIT_CURSOR ) );
|
||||
refresh();
|
||||
}
|
||||
finally
|
||||
{
|
||||
setCursor( new Cursor( Cursor.DEFAULT_CURSOR ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( Exception e )
|
||||
{
|
||||
ErrorLogger.logException( e );
|
||||
}
|
||||
}
|
||||
};
|
||||
SwingUtilities.invokeLater( run );
|
||||
}
|
||||
|
||||
public final void init()
|
||||
{
|
||||
if( !inited )
|
||||
{
|
||||
doRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void refresh();
|
||||
|
||||
}
|
||||
Loading…
Reference in new issue