/* * LembretesRemarcacaoPanel.java * * Created on 13 de Fevereiro de 2007, 23:24 * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package siprp.lembretes.remarcacoes; import com.evolute.utils.data.IDObject; import com.evolute.utils.data.MappableObject; import com.evolute.utils.ui.panel.multipleactionlist.MultipleActionListPanel; import java.awt.BorderLayout; import java.awt.GridLayout; import java.util.List; import java.util.Vector; import javax.swing.*; import siprp.lembretes.Lembrete; import siprp.lembretes.LembretesConstants; import siprp.lembretes.LembretesDataProvider; /** * * @author Frederico */ public class LembretesRemarcacaoPanel extends JPanel implements LembretesConstants { protected JScrollPane listTrabalhadoresScroll; protected JScrollPane listEstabelecimentosScroll; protected MultipleActionListPanel listTrabalhadoresPanel; protected MultipleActionListPanel listEstabelecimentosPanel; protected LembretesDataProvider provider; /** Creates a new instance of LembretesRemarcacaoPanel */ public LembretesRemarcacaoPanel() throws Exception { provider = LembretesDataProvider.getProvider(); setupComponents(); } private void setupComponents() throws Exception { listTrabalhadoresPanel = new MultipleActionListPanel( new RemarcacoesActionFactory[]{ }, new RemarcacoesActionFactory[]{ new RemarcacoesActionFactory( RemarcacoesActionFactory.TRABALHADOR ) } ); listTrabalhadoresScroll = new JScrollPane( listTrabalhadoresPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); listEstabelecimentosPanel = new MultipleActionListPanel( new RemarcacoesActionFactory[]{ }, new RemarcacoesActionFactory[]{ new RemarcacoesActionFactory( RemarcacoesActionFactory.ESTABELECIMENTO ) } ); listEstabelecimentosScroll = new JScrollPane( listTrabalhadoresPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); setLayout( new GridLayout( 1, 2 ) ); JPanel trabalhadoresPanel = new JPanel(); JPanel estabelecimentosPanel = new JPanel(); add( trabalhadoresPanel ); add( estabelecimentosPanel ); trabalhadoresPanel.setLayout( new BorderLayout() ); trabalhadoresPanel.add( new JLabel( "Consultas / ECDs", JLabel.CENTER ), BorderLayout.NORTH ); trabalhadoresPanel.add( listTrabalhadoresScroll, BorderLayout.CENTER ); estabelecimentosPanel.setLayout( new BorderLayout() ); estabelecimentosPanel.add( new JLabel( "Higiene e Seguran\u00e7a", JLabel.CENTER ), BorderLayout.NORTH ); estabelecimentosPanel.add( listEstabelecimentosScroll, BorderLayout.CENTER ); Lembrete lembretes[] = provider.getLembretesByTipo( provider.getTipoLembreteByCodigo( CODE_REMARCACOES ).getID() ); System.out.println( "\nLEMBRETES: " + lembretes.length ) ; List trabalhadores = new Vector(); List estabelecimentos = new Vector(); for( int n = 0; n < lembretes.length; n++ ) { if( lembretes[ n ].getMarcacaoTrabalhadorID() != null ) { trabalhadores.add( new MappableObject( lembretes[ n ].getMarcacaoTrabalhadorID(), lembretes[ n ].getDescricao() ) ); } else if( lembretes[ n ].getMarcacaoEstabelecimentoID() != null ) { } } System.out.println( "\nTRABALHADORES: " + trabalhadores.size() ) ; listTrabalhadoresPanel.showList( trabalhadores.toArray( new IDObject[ trabalhadores.size() ] ) ); listEstabelecimentosPanel.showList( estabelecimentos.toArray( new IDObject[ estabelecimentos.size() ] ) ); listTrabalhadoresScroll.setViewportView( listTrabalhadoresPanel ); } }