diff --git a/trunk/SIPRPSoft/.classpath b/trunk/SIPRPSoft/.classpath index 8d100415..2ac224c0 100644 --- a/trunk/SIPRPSoft/.classpath +++ b/trunk/SIPRPSoft/.classpath @@ -45,7 +45,7 @@ - + diff --git a/trunk/SIPRPSoft/lib/cursos.jar b/trunk/SIPRPSoft/lib/cursos.jar index 4b8cb8a7..94785d0c 100644 Binary files a/trunk/SIPRPSoft/lib/cursos.jar and b/trunk/SIPRPSoft/lib/cursos.jar differ diff --git a/trunk/SIPRPSoft/lib/evolute.jar b/trunk/SIPRPSoft/lib/evolute.jar index 0ec5bd89..4365580e 100644 Binary files a/trunk/SIPRPSoft/lib/evolute.jar and b/trunk/SIPRPSoft/lib/evolute.jar differ diff --git a/trunk/SIPRPSoft/lib/shst.jar b/trunk/SIPRPSoft/lib/shst.jar index f347824f..a63c41b0 100644 Binary files a/trunk/SIPRPSoft/lib/shst.jar and b/trunk/SIPRPSoft/lib/shst.jar differ diff --git a/trunk/SIPRPSoft/src/siprp/Main.java b/trunk/SIPRPSoft/src/siprp/Main.java index ef6441bc..5c2395c2 100644 --- a/trunk/SIPRPSoft/src/siprp/Main.java +++ b/trunk/SIPRPSoft/src/siprp/Main.java @@ -177,13 +177,10 @@ public class Main implements com.evolute.utils.ui.window.Connector StatementExecuterFactory.initialize( new DBStatementExecuter( dbm.getSharedExecuter(this) ) ); Updater.getInstance().executeUpdates( UpdateList.getUpdates() ); -// Updater.getInstance().executeUpdate(true, true, UpdateList.UPDATE_LIST); - + new ORMInitializer().initializeORM( url, user, passwd ); Singleton.setInstance( Singleton.TODAY, new Date() ); -// initializeCayenne( url, user, passwd); - } catch( Exception ex ) { @@ -209,8 +206,7 @@ public class Main implements com.evolute.utils.ui.window.Connector siprpTracker = null; try { - ( ( DBManager )Singleton.getInstance( - Singleton.DEFAULT_DBMANAGER ) ).close(); + ( ( DBManager )Singleton.getInstance( Singleton.DEFAULT_DBMANAGER ) ).close(); Singleton.clear(); } catch( DBException ex ) diff --git a/trunk/SIPRPSoft/src/siprp/SIPRPTracker.java b/trunk/SIPRPSoft/src/siprp/SIPRPTracker.java index f6cd3ffd..b4876428 100644 --- a/trunk/SIPRPSoft/src/siprp/SIPRPTracker.java +++ b/trunk/SIPRPSoft/src/siprp/SIPRPTracker.java @@ -307,6 +307,16 @@ public class SIPRPTracker extends WindowTracker implements SHSTTrackerInterface } } ); } + + + try + { + SIPRPCursosInit.initFactory(); + } + catch ( Exception e ) + { + ErrorLogger.logException( e ); + } if( hasCursos ) { rootNode.add( new DefaultMutableTreeNode( CursosWindow.TITLE ) ); @@ -314,7 +324,6 @@ public class SIPRPTracker extends WindowTracker implements SHSTTrackerInterface public TrackableWindow create() throws Exception { - SIPRPCursosInit.initFactory(); return new CursosWindowAdapter(); } } ); diff --git a/trunk/SIPRPSoft/src/siprp/higiene/HigieneDataProvider.java b/trunk/SIPRPSoft/src/siprp/higiene/HigieneDataProvider.java deleted file mode 100644 index 2f1465db..00000000 --- a/trunk/SIPRPSoft/src/siprp/higiene/HigieneDataProvider.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * HigieneDataProvider.java - * - * Created on February 1, 2006, 10:49 PM - * - * To change this template, choose Tools | Template Manager - * and open the template in the editor. - */ - -package siprp.higiene; - -import java.awt.Color; -import java.util.Calendar; -import java.util.Date; -import java.util.Hashtable; -import java.util.Vector; - -import shst.SHSTPropertiesConstants; - -import com.evolute.utils.Singleton; -import com.evolute.utils.arrays.Virtual2DArray; -import com.evolute.utils.db.DBManager; -import com.evolute.utils.db.Executer; -import com.evolute.utils.metadb.MetaProvider; -import com.evolute.utils.sql.Field; -import com.evolute.utils.sql.Select; -import com.evolute.utils.tables.ColumnizedMappable; - -/** - * - * @author fpalma - */ -public class HigieneDataProvider extends MetaProvider -{ - public static final int ESTADO_POR_REALIZAR = 0; - public static final int ESTADO_REALIZADO = 2; - public static final int ESTADO_DESMARCADO_TRABALHADOR = 3; - public static final int ESTADO_DESMARCADO_EMPRESA = 4; - public static final int ESTADO_FALTOU = 5; - - public static final String ESTADOS_STR[] = - new String[]{ "Por realizar", "", "Realizada", - "Desmarcada empresa", - "Desmarcada " + Singleton.getInstance( SHSTPropertiesConstants.COMPANY_ACRONYM ), - "Faltou" }; - - public static final Color CORES_TECNICOS[] = - new Color[]{ Color.white, Color.red.darker(), Color.blue, - Color.green.darker(), Color.yellow.darker(), - Color.gray, Color.pink.darker() }; - - private static final Object LOCK = new Object(); - private static HigieneDataProvider instance = null; - private final Executer executer; - - /** Creates a new instance of HigieneDataProvider */ - public HigieneDataProvider() - throws Exception - { - DBManager dbm = ( DBManager ) Singleton.getInstance( Singleton.DEFAULT_DBMANAGER /*SingletonConstants.DBMANAGER*/ ); - executer = dbm.getSharedExecuter( this ); - } - - public static MetaProvider getProvider() - throws Exception - { - synchronized( LOCK ) - { - if( instance == null ) - { - instance = new HigieneDataProvider(); - } - } - return instance; - } - - public Object[][] getTecnicosHST( boolean superiores ) - throws Exception - { - Select select = - new Select( new String[]{ "marcacoes_tecnicos_hst" }, - new String[]{ "id", "nome", "iniciais", "identificador", "nome_plain" }, - new Field( "inactivo" ).isDifferent( "y" ).and(new Field( "is_superior" ).isEqual( superiores ? "y" : "n" )), - new String[]{ "nome_plain" }, - null ); - Virtual2DArray array = executer.executeQuery( select ); - return array.getObjects(); - } - - public Object[][] getAllTecnicosHST( ) - throws Exception - { - Select select = - new Select( new String[]{ "marcacoes_tecnicos_hst" }, - new String[]{ "id", "nome", "iniciais", "identificador", "is_superior", "nome_plain" }, - new Field( "inactivo" ).isDifferent( "y" ), - new String[]{ "nome_plain" }, - null ); - Virtual2DArray array = executer.executeQuery( select ); - return array.getObjects(); - } - - public ColumnizedMappable[] getAllEmpresas() - throws Exception - { - Select select = - new Select( new String[]{ "empresas" }, - new String[]{ "id", "designacao_social", "designacao_social_plain" }, - new Field( "inactivo" ).isDifferent( "y" ), - new String[]{ "designacao_social_plain" }, - null ); - Virtual2DArray array = executer.executeQuery( select ); - ColumnizedMappable empresas[] = new ColumnizedMappable[ array.columnLength() ]; - for( int n = 0; n < empresas.length; n++ ) - { - Integer id = ( Integer ) array.get( n, 0 ); - String designacao = ( String ) array.get( n, 1 ); - empresas[ n ] = new ColumnizedMappable( id, designacao ); - } - return empresas; - } - - public ColumnizedMappable[] getAllEstabelecimentosForEmpresa( Integer empresaID ) - throws Exception - { - Select select = - new Select( new String[]{ "estabelecimentos" }, - new String[]{ "id", "nome", "nome_plain" }, - new Field( "empresa_id" ).isEqual( empresaID ).and( - new Field( "inactivo" ).isDifferent( "y" ) ), - new String[]{ "nome_plain" }, - null ); - Virtual2DArray array = executer.executeQuery( select ); - ColumnizedMappable estabelecimentos[] = new ColumnizedMappable[ array.columnLength() ]; - for( int n = 0; n < estabelecimentos.length; n++ ) - { - Integer id = ( Integer ) array.get( n, 0 ); - String nome = ( String ) array.get( n, 1 ); - estabelecimentos[ n ] = new ColumnizedMappable( id, nome ); - } - return estabelecimentos; - } - - public String getEmpresa( Integer empresaID ) - throws Exception - { - String nomes[] = new String[ 2 ]; - Select select = new Select( new String[]{ "empresas" }, - new String[]{ "designacao_social" }, - new Field( "id" ).isEqual( empresaID ) ); - Virtual2DArray array = executer.executeQuery( select ); - return ( String ) array.get( 0, 0 ); - } - - public Object[][] getVisitasEstabelecimento( Integer estabelecimentoID ) - throws Exception - { - Select select = - new Select( new String[]{ "marcacoes_estabelecimento" }, - new String[]{ "id", "data", "estado" }, - new Field( "estabelecimento_id" ).isEqual( estabelecimentoID ), - new String[]{ "data desc" }, - null ); - Virtual2DArray array = executer.executeQuery( select ); - Object data[][] = array.getObjects(); - for( int n = 0; n < data.length; n++ ) - { - int estado = ( ( Integer ) data[ n ][ 2 ] ).intValue(); - data[ n ][ 2 ] = ESTADOS_STR[ estado ]; - } - return data; - } - - public Vector[][] getMapaAnual( Integer ano ) - throws Exception - { - String deleted = "__DELETED__"; - Select select = - new Select( new String[]{ "marcacoes_tecnicos_hst" }, - new String[]{ "id", "nome", "iniciais", "identificador", "nome_plain" }, - new Field( "inactivo" ).isDifferent( "y" ).and(new Field( "is_superior" ).isDifferent( "y" )), - new String[]{ "nome_plain" }, - null ); - Virtual2DArray array = executer.executeQuery( select ); - Object tecnicosArr[][] = array.getObjects(); - Hashtable tecnicos = new Hashtable(); - for( int n = 0; n < tecnicosArr.length; n++ ) - { - tecnicos.put( tecnicosArr[ n ][ 0 ], tecnicosArr[ n ] ); - } - Hashtable empresas = new Hashtable(); - Hashtable estabelecimentos = new Hashtable(); - Hashtable empresasEstabelecimentos = new Hashtable(); - Vector data[][] = new Vector[ 31 ][ 12 ]; - select = new Select( new String[]{ "marcacoes_estabelecimento" }, - new String[]{ "data", "estabelecimento_id", "tecnico_hst" }, - new Field( "data" ).between( new Object[]{ ano + "-01-01", ano + "-12-31" } ).and( - new Field( "estado" ).in( new Integer[]{ new Integer( 0 ), new Integer( 2 ) } ) ) ); - array = executer.executeQuery( select ); - for( int n = 0; n < array.columnLength(); n++ ) - { - Date dataVisita = ( Date ) array.get( n, 0 ); - Integer estabelecimentoID = ( Integer ) array.get( n, 1 ); - Integer tecnicoID = ( Integer ) array.get( n, 2 ); - Integer empresaID = null; - if( !estabelecimentos.containsKey( estabelecimentoID ) ) - { - Select estabelecimentoSelect = - new Select( new String[]{ "estabelecimentos" }, - new String[]{ "nome", "empresa_id", "inactivo" }, - new Field( "id" ).isEqual( estabelecimentoID ) ); - Virtual2DArray estabelecimentoArray = executer.executeQuery( estabelecimentoSelect ); - if( "y".equals( estabelecimentoArray.get( 0, 2 ) ) ) - { - estabelecimentos.put( estabelecimentoID, deleted ); - } - else - { - estabelecimentos.put( estabelecimentoID, estabelecimentoArray.get( 0, 0 ) ); - } - empresaID = ( Integer ) estabelecimentoArray.get( 0, 1 ); - empresasEstabelecimentos.put( estabelecimentoID, empresaID ); - if( !empresas.containsKey( empresaID ) ) - { - Select empresaSelect = - new Select( new String[]{ "empresas" }, - new String[]{ "designacao_social", "inactivo" }, - new Field( "id" ).isEqual( empresaID ) ); - Virtual2DArray empresaArray = executer.executeQuery( empresaSelect ); - if( "y".equals( empresaArray.get( 0, 1 ) ) ) - { - empresas.put( empresaID, deleted ); - } - else - { - empresas.put( empresaID, empresaArray.get( 0, 0 ) ); - } - } - } - String nomeEstabelecimento = ( String ) estabelecimentos.get( estabelecimentoID ); - empresaID = ( Integer ) empresasEstabelecimentos.get( estabelecimentoID ); - String nomeEmpresa = ( String ) empresas.get( empresaID ); - String nomeTecnico = " "; - Integer indiceCor = null; - Color cor = null; - if( tecnicoID != null ) - { - Object tecnico[] = ( Object[] ) tecnicos.get( tecnicoID ); - if ( tecnico != null ) - { - nomeTecnico = ( String ) tecnico[ 1 ]; - indiceCor = ( Integer ) tecnico[ 3 ]; - cor = CORES_TECNICOS[ indiceCor.intValue() ]; - } - } - Calendar cal = Calendar.getInstance(); - cal.setTime( dataVisita ); - int dia = cal.get( Calendar.DAY_OF_MONTH ) - 1; - int mes = cal.get( Calendar.MONTH ); - if( data[ dia ][ mes ] == null ) - { - data[ dia ][ mes ] = new Vector(); - data[ dia ][ mes ].add( new Object[]{ new Integer( dia + 1 ) } ); - } - if( nomeEmpresa != deleted && nomeEstabelecimento != deleted ) - { - data[ dia ][ mes ].add( new Object[]{ nomeEmpresa, nomeEstabelecimento, nomeTecnico, cor } ); - } - } - - return data; - } -} diff --git a/trunk/SIPRPSoft/src/siprp/higiene/alter2.sql b/trunk/SIPRPSoft/src/siprp/higiene/alter2.sql deleted file mode 100644 index 6166400d..00000000 --- a/trunk/SIPRPSoft/src/siprp/higiene/alter2.sql +++ /dev/null @@ -1,18 +0,0 @@ - -CREATE TABLE marcacoes_tecnicos_hst -( - id int4 NOT NULL, - nome varchar(255) NOT NULL, - nome_plain varchar(255) NOT NULL, - iniciais varchar(10) NOT NULL, - identificador int4, - inactivo char(1) DEFAULT 'n' NOT NULL, - CONSTRAINT marcacoes_tecnicos_hst_pkey PRIMARY KEY (id) -) -WITHOUT OIDS; -ALTER TABLE marcacoes_tecnicos_hst OWNER TO postgres; - -ALTER TABLE marcacoes_estabelecimento ADD estado INT; -ALTER TABLE marcacoes_estabelecimento ADD tecnico_hst INT REFERENCES marcacoes_tecnicos_hst(id); -ALTER TABLE marcacoes_estabelecimento ADD observacoes VARCHAR( 2048 ); -UPDATE marcacoes_estabelecimento SET estado = 2 WHERE realizada = 'y'; \ No newline at end of file diff --git a/trunk/SIPRPSoft/src/siprp/higiene/legislacoes/GestaoLegislacoesWindow.java b/trunk/SIPRPSoft/src/siprp/higiene/legislacoes/GestaoLegislacoesWindow.java deleted file mode 100644 index a12d8658..00000000 --- a/trunk/SIPRPSoft/src/siprp/higiene/legislacoes/GestaoLegislacoesWindow.java +++ /dev/null @@ -1,375 +0,0 @@ -package siprp.higiene.legislacoes; - -import static com.evolute.utils.strings.UnicodeLatin1Map.atilde; -import static com.evolute.utils.strings.UnicodeLatin1Map.ccedil; -import static com.evolute.utils.strings.UnicodeLatin1Map.otilde; - -import javax.swing.SwingUtilities; - -import siprp.ui.SIPRPFrame; - -import com.evolute.utils.tracker.TrackableWindow; - -public class GestaoLegislacoesWindow extends SIPRPFrame implements TrackableWindow -{ - - private static final long serialVersionUID = 1L; - - public static final String TITLE = "Gest" + atilde + "o de Legisla" + ccedil + otilde + "es"; -// -// private static final Dimension SIZE = new Dimension( 800, 400 ); -// -// private DefaultMutableTreeNode root = new DefaultMutableTreeNode( "Legisla" + ccedil + atilde + "o em Higiene e Seguran" + ccedil + "a no Trabalho" ); -// -// private final DefaultTreeModel model = new DefaultTreeModel( root ); -// -// private final JTree tree = new JTree( model ); -// -// private final JScrollPane scroll = new JScrollPane( tree ); -// -// private final JButton buttonCriar = new JButton("Criar"); -// -// private final JButton buttonRemover = new JButton("Remover"); -// -// private final JButton buttonGuardar = new JButton("Guardar"); -// -// private final JButton buttonCancelar = new JButton("Cancelar"); -// -// private final JTextArea text = new JTextArea(); -// -// private final JPanel panelTree = new JPanel(); -// -// private final JPanel panelText = new JPanel(); -// -// private final PlanoActuacaoDAO provider = new PlanoActuacaoDAO(); -// -// private Legislacao newLegislacao = null; -// -// public static void main( String[] args ) -// { -// GestaoLegislacoesWindow window = new GestaoLegislacoesWindow(); -// window.setDefaultCloseOperation( SIPRPFrame.EXIT_ON_CLOSE ); -// window.setVisible( true ); -// } - - public GestaoLegislacoesWindow() - { -// this.setTitle( TITLE ); -// this.setSize( SIZE ); -// startupComponents(); -// startupLayout(); -// startupListeners(); -// placeComponents(); -// refresh(); - } - -// private void startupComponents() -// { -// panelText.setBorder( BorderFactory.createEtchedBorder() ); -// buttonRemover.setEnabled( false ); -// buttonGuardar.setEnabled( false ); -// buttonCancelar.setEnabled( false ); -// text.setEnabled( false ); -// tree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION ); -// tree.setRootVisible( true ); -// } -// -// private void startupLayout() -// { -// startupPanelTextLayout(); -// startupPanelTreeLayout(); -// this.getContentPane().setLayout( new GridLayout(1,0,5,5) ); -// } -// -// private void startupPanelTextLayout() -// { -// TableLayout layout = new TableLayout( -// new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL }, -// new double[]{ TableLayout.FILL, TableLayout.MINIMUM } -// ); -// layout.setHGap( 5 ); -// layout.setVGap( 5 ); -// panelText.setLayout( layout ); -// } -// -// private void startupPanelTreeLayout() -// { -// TableLayout layout = new TableLayout( -// new double[]{ TableLayout.MINIMUM, TableLayout.MINIMUM, TableLayout.FILL }, -// new double[]{ TableLayout.FILL, TableLayout.MINIMUM } -// ); -// layout.setHGap( 5 ); -// layout.setVGap( 5 ); -// panelTree.setLayout( layout ); -// } -// -// private void startupListeners() -// { -// buttonCriar.addActionListener( new ActionListener() -// { -// @Override -// public void actionPerformed( ActionEvent e ) -// { -// criarLegislacao( ); -// } -// } ); -// buttonRemover.addActionListener( new ActionListener() -// { -// @Override -// public void actionPerformed( ActionEvent e ) -// { -// removerLegislacao(); -// } -// } ); -// buttonGuardar.addActionListener( new ActionListener() -// { -// @Override -// public void actionPerformed( ActionEvent e ) -// { -// guardarLegislacao(); -// } -// } ); -// buttonCancelar.addActionListener( new ActionListener() -// { -// @Override -// public void actionPerformed( ActionEvent e ) -// { -// cancelarEdicao(); -// } -// } ); -// tree.getSelectionModel().addTreeSelectionListener( new TreeSelectionListener() -// { -// @Override -// public void valueChanged( TreeSelectionEvent e ) -// { -// TreePath path = tree.getSelectionPath(); -// Legislacao legislacao = getSelectedLegislacao(); -// if( path != null ) -// { -// buttonRemover.setEnabled( !root.equals( path.getLastPathComponent() ) ); -// text.setEnabled( !root.equals( path.getLastPathComponent() ) ); -// text.setText( legislacao == null ? "" : legislacao.getDescription() ); -// } -// else -// { -// text.setEnabled( false ); -// buttonRemover.setEnabled( false ); -// text.setText( "" ); -// } -// } -// } ); -// text.addCaretListener( new CaretListener() -// { -// @Override -// public void caretUpdate( CaretEvent e ) -// { -// if( text.getText().length() > 0) -// { -// Legislacao legislacao = null; -// if( newLegislacao != null ) -// { -// legislacao = newLegislacao; -// } -// else -// { -// legislacao = getSelectedLegislacao(); -// } -// boolean changed = legislacao == null ? false : !legislacao.getDescription().equals( text.getText() ); -// buttonGuardar.setEnabled( changed ); -// text.setBorder( changed ? BorderFactory.createLineBorder( Color.RED, 2 ) : BorderFactory.createEtchedBorder() ); -// } -// else -// { -// buttonGuardar.setEnabled( false ); -// text.setBorder( BorderFactory.createEtchedBorder() ); -// } -// } -// } ); -// } -// -// private void placeComponents() -// { -// panelTree.add( scroll, new TableLayoutConstraints( 0, 0, 2, 0 ) ); -// panelTree.add( buttonCriar, new TableLayoutConstraints( 0, 1 ) ); -// panelTree.add( buttonRemover, new TableLayoutConstraints( 1, 1 ) ); -// -// panelText.add( text, new TableLayoutConstraints( 0, 0, 2, 0 ) ); -// panelText.add( buttonGuardar, new TableLayoutConstraints( 0, 1 ) ); -// panelText.add( buttonCancelar, new TableLayoutConstraints( 1, 1 ) ); -// -// this.getContentPane().add( panelTree ); -// this.getContentPane().add( panelText ); -// } -// -// private void criarLegislacao() -// { -// text.setText( "" ); -// Legislacao selected = getSelectedLegislacao(); -// if( selected != null ) -// { -// newLegislacao = provider.createNovaLegislacao( selected ); -// } -// else -// { -// newLegislacao = provider.createNovaLegislacao( getSelectedLegislacao() ); -// } -// prepareEditar( false ); -// textInputOnly( true ); -// } -// -// private void prepareEditar( boolean editar ) -// { -// buttonGuardar.setText( editar ? "Editar" : "Criar" ); -// buttonCancelar.setText( editar ? "Reverter" : "Cancelar" ); -// } -// -// private void textInputOnly( boolean doTextInput ) -// { -// text.setEnabled( doTextInput ); -// buttonCancelar.setEnabled( doTextInput ); -// buttonCriar.setEnabled( !doTextInput ); -// tree.setEnabled( !doTextInput ); -// text.setBorder( doTextInput ? BorderFactory.createLineBorder( Color.RED, 2 ) : BorderFactory.createEtchedBorder()); -// if( doTextInput ){ -// text.setCaretPosition( 0 ); -// text.requestFocus(); -// buttonRemover.setEnabled( false ); -// } -// } -// -// private void guardarLegislacao() -// { -// TreePath path = tree.getSelectionPath(); -// if( newLegislacao != null ) -// { -// newLegislacao.setDescription( text.getText() ); -// provider.commit(); -// newLegislacao = null; -// prepareEditar( true ); -// textInputOnly( false ); -// refresh(); -// } -// else if( path != null ) -// { -// Legislacao legislacao = getSelectedLegislacao(); -// legislacao.setDescription( text.getText() ); -// provider.commit(); -// prepareEditar( true ); -// textInputOnly( false ); -// refresh(); -// } -// } -// -// private void cancelarEdicao() -// { -// TreePath path = tree.getSelectionPath(); -// if( newLegislacao != null ) -// { -// newLegislacao = null; -// prepareEditar( true ); -// textInputOnly( false ); -// refresh(); -// tree.setSelectionPath( path ); -// } -// else if( path != null ) -// { -// prepareEditar( true ); -// textInputOnly( false ); -// refresh(); -// tree.setSelectionPath( path ); -// } -// } -// -// private Legislacao getSelectedLegislacao() -// { -// Legislacao result = null; -// TreePath path = tree.getSelectionPath(); -// if( path != null ) -// { -// Object o = ( (DefaultMutableTreeNode) path.getLastPathComponent() ).getUserObject(); -// if( o instanceof Legislacao ) -// { -// result = (Legislacao) o; -// } -// } -// return result; -// } -// -// private void removerLegislacao() -// { -// Legislacao legislacao = getSelectedLegislacao(); -// if( legislacao != null ) -// { -// provider.delete( legislacao ); -// } -// refresh(); -// } -// - @Override - public void refresh() - { -// clearTree(); -// fillTree(); - } -// -// private void clearTree() -// { -// root.removeAllChildren(); -// refreshTree(); -// } -// -// private void fillTree() -// { -// List legislacoes = provider.getAllLegislacoes( null ); -// for( Legislacao legislacao : legislacoes ) -// { -// DefaultMutableTreeNode node = new DefaultMutableTreeNode( legislacao ); -// fillWithChildren( node, legislacao ); -// root.add( node ); -// } -// refreshTree(); -// } -// -// private void fillWithChildren( DefaultMutableTreeNode node, Legislacao legislacao ) -// { -// if( legislacao != null ) -// { -// for( Legislacao child : legislacao.getChildrenArray() ) -// { -// DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(child); -// fillWithChildren( childNode, child ); -// node.add( childNode ); -// } -// } -// } -// -// private void refreshTree() -// { -// model.nodeStructureChanged( root ); -// } - - @Override - public boolean closeIfPossible() - { - close(); - return true; - } - - private void close() - { - SwingUtilities.invokeLater( new Runnable() { - public void run() - { - setVisible( false ); - dispose(); - } - } ); - } - - @Override - public void open() - { - setVisible( true ); - } - -}