diff --git a/trunk/SIPRPSoft/lib/shst.jar b/trunk/SIPRPSoft/lib/shst.jar index 4d66b288..13996437 100644 Binary files a/trunk/SIPRPSoft/lib/shst.jar and b/trunk/SIPRPSoft/lib/shst.jar differ diff --git a/trunk/SIPRPSoft/src/siprp/SIPRPTracker.java b/trunk/SIPRPSoft/src/siprp/SIPRPTracker.java index de245dc5..be92c9cd 100644 --- a/trunk/SIPRPSoft/src/siprp/SIPRPTracker.java +++ b/trunk/SIPRPSoft/src/siprp/SIPRPTracker.java @@ -15,6 +15,7 @@ import javax.swing.tree.DefaultMutableTreeNode; import shst.SHSTPropertiesConstants; import shst.SHSTTrackerInterface; import shst.cursos.CursosWindowAdapter; +import shst.higiene.mapa.MapaHigieneWindow; import shst.higiene.marcacoes.MarcacoesHigieneInterface; import shst.higiene.marcacoes.MarcacoesHigieneWindow; @@ -26,7 +27,6 @@ import siprp.cursos.SIPRPCursosInit; import siprp.estatistica.EstatisticaWindow; import siprp.ficha.FichaWindow; import siprp.higiene.gestao.GestaoRelatorioWindow; -import siprp.higiene.mapa.MapaHigieneWindow; import siprp.higiene.relatorio.RelatorioHigieneSegurancaWindow; import siprp.impressaofichas.ImpressaoFichasWindow; import siprp.lembretes.LembretesWindow; diff --git a/trunk/SIPRPSoft/src/siprp/higiene/mapa/DiaLine.java b/trunk/SIPRPSoft/src/siprp/higiene/mapa/DiaLine.java deleted file mode 100644 index c38e0102..00000000 --- a/trunk/SIPRPSoft/src/siprp/higiene/mapa/DiaLine.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * DiaLine.java - * - * Created on 8 de Fevereiro de 2006, 22:43 - * - * To change this template, choose Tools | Template Manager - * and open the template in the editor. - */ - -package siprp.higiene.mapa; - -import java.util.Vector; - -import com.evolute.utils.tables.ColumnizedObjectForUpdate; - -/** - * - * @author Frederico - */ -public class DiaLine implements ColumnizedObjectForUpdate -{ - protected Integer day; - protected Vector data[]; - - public DiaLine( int day, Vector data[] ) - { - this.day = new Integer( day ); - this.data = data; - } - - public Object getValue( int col ) - { - switch( col ) - { - case 0: - return day; - - default: - return data[ col - 1 ].toArray( new Object[ 0 ][] ); - } - } - - public int[] getUpdateableColumns() - { - return new int[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; - } - - public void setValueAt( Object value, int col ) - { -// data[ col - 1 ].clear(); - if( value != null && value instanceof Vector ) - { - data[ col - 1 ].addAll( ( Vector ) value ); - } - } - - public void clear( int col ) - { - data[ col - 1 ].clear(); - } -} diff --git a/trunk/SIPRPSoft/src/siprp/higiene/mapa/DiaPanel.java b/trunk/SIPRPSoft/src/siprp/higiene/mapa/DiaPanel.java deleted file mode 100644 index 3278c7ae..00000000 --- a/trunk/SIPRPSoft/src/siprp/higiene/mapa/DiaPanel.java +++ /dev/null @@ -1,97 +0,0 @@ -package siprp.higiene.mapa; - -import java.awt.Color; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; - -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; - -import com.evolute.utils.dataui.ControllableComponent; -/** - * - * @author fpalma - */ -public class DiaPanel extends JPanel implements ControllableComponent< Object >, ActionListener -{ - - private static final long serialVersionUID = 1L; - - protected Object data[][]; - protected JButton buttons[]; - - public DiaPanel() - { - } - - public void setEnabled( boolean enable ) - { - } - - public void fill( Object value ) - { - removeAll(); - Object arr[][] = ( Object[][] ) value; - data = arr; - buttons = new JButton[ arr.length ]; - if( arr.length > 0 ) - { - GridBagLayout gridbag = new GridBagLayout(); - setLayout( gridbag ); - GridBagConstraints constraints = new GridBagConstraints(); - constraints.insets = new Insets( 0, 0, 0, 0 ); - constraints.fill = GridBagConstraints.BOTH; - constraints.weightx = 1; - constraints.gridwidth = GridBagConstraints.REMAINDER; - constraints.weighty = 0; - constraints.gridheight = 1; - Integer dia = ( Integer ) arr[ 0 ][ 0 ]; - JLabel diaLabel = new JLabel( dia.toString(), JLabel.LEFT ); - gridbag.setConstraints( diaLabel, constraints ); - add( diaLabel ); - for( int n = 1; n < arr.length; n++ ) - { - String empresa = ( String ) arr[ n ][ 0 ]; - String estabelecimento = ( String ) arr[ n ][ 1 ]; - String tecnico = ( String ) arr[ n ][ 2 ]; - Color cor = ( Color ) arr[ n ][ 3 ]; - String empresaR = empresa.length() > 10 ? empresa.substring( 0, 10 ) : empresa; - String estabelecimentoR = estabelecimento.length() > 10 ? estabelecimento.substring( 0, 10 ) : estabelecimento; - buttons[ n ] = new JButton( "" + empresaR + "
" + estabelecimentoR + "
" ); - buttons[ n ].setMargin( new Insets( 2, 1, 2, 1 ) ); - buttons[ n ].setBackground( cor ); - buttons[ n ].setToolTipText( "T\u00e9cnico: " + ( tecnico != null ? tecnico : "n.d." ) - + " \nEmpresa: " + empresa + " \nEstabelecimento: " + estabelecimento ); - gridbag.setConstraints( buttons[ n ], constraints ); - add( buttons[ n ] ); - buttons[ n ].addActionListener( this ); - } - JPanel pad = new JPanel(); - constraints.weighty = 1; - constraints.gridheight = GridBagConstraints.REMAINDER; - gridbag.setConstraints( pad, constraints ); - add( pad ); - } - - } - - public Object save() - { - return data; - } - - public void clear() - { - } - - public void actionPerformed( ActionEvent e ) - { - JButton source = ( JButton ) e.getSource(); - JOptionPane.showMessageDialog( source, source.getToolTipText(), "", JOptionPane.PLAIN_MESSAGE ); - } -} diff --git a/trunk/SIPRPSoft/src/siprp/higiene/mapa/DiaRenderer.java b/trunk/SIPRPSoft/src/siprp/higiene/mapa/DiaRenderer.java deleted file mode 100644 index 8ba625ed..00000000 --- a/trunk/SIPRPSoft/src/siprp/higiene/mapa/DiaRenderer.java +++ /dev/null @@ -1,61 +0,0 @@ -package siprp.higiene.mapa; - -import java.awt.Component; - -import javax.swing.DefaultCellEditor; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JTable; -import javax.swing.table.TableCellRenderer; -/** - * - * @author Frederico - */ -public class DiaRenderer extends DefaultCellEditor implements TableCellRenderer -{ - - private static final long serialVersionUID = 1L; - - protected JLabel diaLabel; - protected DiaPanel diaPanel; - - /** Creates a new instance of DiaRenderer */ - public DiaRenderer() - { - super( new JCheckBox() ); - diaLabel = new JLabel(); - diaPanel = new DiaPanel(); - } - - public Component getTableCellRendererComponent( JTable table, Object value, - boolean isSelected, - boolean hasFocus, - int row, int column ) - { - if( column == 0 ) - { - diaLabel.setText( "" + value ); - return diaLabel; - } - diaPanel.fill( value ); - return diaPanel; - } - - public Component getTableCellEditorComponent( JTable table, Object value, - boolean isSelected, - int row, int column ) - { - if( column == 0 ) - { - diaLabel.setText( "" + value ); - return diaLabel; - } - diaPanel.fill( value ); - return diaPanel; - } - - public Object getCellEditorValue() - { - return diaPanel.save(); - } -} diff --git a/trunk/SIPRPSoft/src/siprp/higiene/mapa/MapaHigienePanel.java b/trunk/SIPRPSoft/src/siprp/higiene/mapa/MapaHigienePanel.java deleted file mode 100644 index 847aa984..00000000 --- a/trunk/SIPRPSoft/src/siprp/higiene/mapa/MapaHigienePanel.java +++ /dev/null @@ -1,108 +0,0 @@ -package siprp.higiene.mapa; - -import java.awt.GridLayout; -import java.util.Vector; - -import javax.swing.JPanel; -import javax.swing.JScrollPane; - -import com.evolute.utils.dataui.ControllableComponent; -import com.evolute.utils.date.DateUtils; -import com.evolute.utils.tables.BaseTable; -import com.evolute.utils.tables.VectorTableModel; -/** - * - * @author Frederico - */ -public class MapaHigienePanel extends JPanel implements ControllableComponent< Object > -{ - - private static final long serialVersionUID = 1L; - - protected BaseTable yearTable; - protected VectorTableModel yearModel; - protected JScrollPane yearScroll; - - /** Creates a new instance of MapaHigienePanel */ - public MapaHigienePanel() - throws Exception - { - setupComponents(); - } - - private void setupComponents() - throws Exception - { - String headers[] = new String[ 13 ]; - headers[ 0 ] = " "; - for( int n = 0; n < DateUtils.MONTHS_FULL_PT.length; n++ ) - { - headers[ n + 1 ] = DateUtils.MONTHS_FULL_PT[ n ]; - } - yearModel = new VectorTableModel( headers ); - yearTable = new BaseTable( yearModel ); - yearTable.fixColumnWidth( 0, 20 ); - yearTable.setNonResizableNorReordable(); -// yearTable.setEnabled( true ); - yearModel.setEditable( true ); - yearTable.setTableCellRenderer( new DiaRenderer() ); - yearTable.setTableCellEditor( new DiaRenderer() ); - yearScroll = new JScrollPane( yearTable, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, - JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); - Vector values = yearModel.getValues(); - for( int n = 0; n < 31; n++ ) - { - Vector data[] = new Vector[ 12 ]; - for( int m = 0; m < 12; m++ ) - { - data[ m ] = new Vector(); - } - values.add( new DiaLine( n + 1, data ) ); - } - yearModel.setValues( values ); - - setLayout( new GridLayout( 1, 1 ) ); - add( yearScroll ); - } - - public void clear() - { - } - - public void setEnabled( boolean enable ) - { - yearTable.setEnabled( enable ); - } - - public void fill( Object value ) - { -// if( true ) return; - Vector arr[][] = ( Vector[][] )value; - int maxs[] = new int[ arr.length ]; - for( int r = 0; r < arr.length; r++ ) - { - maxs[ r ] = 1; - for( int c = 0; c < arr[ r ].length; c++ ) - { - if( arr[ r ][ c ] != null && arr[ r ][ c ].size() > maxs[ r ] ) - { - maxs[ r ] = arr[ r ][ c ].size(); - } - DiaLine line = ( DiaLine ) yearModel.getRowAt( r ); - line.clear( c + 1 ); - line.setValueAt( arr[ r ][ c ], c + 1 ); - yearModel.removeRowAt( r ); - yearModel.insertRowAt( line, r ); - } - } - for( int r = 0; r < arr.length; r++ ) - { - yearTable.setRowHeight( r, 20 + ( maxs[ r ] - 1 ) * 40 ); - } - } - - public Object save() - { - return null; - } -} diff --git a/trunk/SIPRPSoft/src/siprp/higiene/mapa/MapaHigieneWindow.java b/trunk/SIPRPSoft/src/siprp/higiene/mapa/MapaHigieneWindow.java deleted file mode 100644 index 63ddb79d..00000000 --- a/trunk/SIPRPSoft/src/siprp/higiene/mapa/MapaHigieneWindow.java +++ /dev/null @@ -1,137 +0,0 @@ -package siprp.higiene.mapa; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Calendar; - -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; - -import siprp.higiene.HigieneDataProvider; -import siprp.ui.SIPRPEditorWindow; - -import com.evolute.utils.documents.YearDocument; -import com.evolute.utils.ui.DialogException; - -/** - * - * @author fpalma - */ -public class MapaHigieneWindow extends SIPRPEditorWindow implements ActionListener -{ - - private static final long serialVersionUID = 1L; - - public final static String TITLE = "Mapa de Higiene e Seguran\u00e7a"; - - private final static int iPermissionArray[][] = - new int[][]{ { } }; - - protected MapaHigienePanel mainPanel; - protected JTextField anoText; - protected JButton actualizarButton; - - protected HigieneDataProvider provider; - - public static void main( String args[] ) - throws Exception - { - - SIPRPEditorWindow frm = new MapaHigieneWindow(); - frm.setVisible( true ); - } - - /** Creates a new instance of MarcacoesHigieneWindow */ - public MapaHigieneWindow() - throws Exception - { - super( iPermissionArray ); - provider = ( HigieneDataProvider ) HigieneDataProvider.getProvider(); - setupComponents(); - setExtendedState(getExtendedState() | MAXIMIZED_BOTH); - } - - private void setupComponents() - throws Exception - { - setTitle( TITLE ); - JPanel upperPanel = new JPanel(); - mainPanel = new MapaHigienePanel(); - getContentPane().setLayout( new BorderLayout() ); - getContentPane().add( upperPanel, BorderLayout.NORTH ); - getContentPane().add( mainPanel, BorderLayout.CENTER ); - - upperPanel.setLayout( new FlowLayout( FlowLayout.LEFT ) ); - upperPanel.add( new TecnicosPanel() ); - JLabel anoLabel = new JLabel( "Ano" ); - anoText = new JTextField(); - anoText.setPreferredSize( new Dimension( 50, 20 ) ); - anoText.setDocument( new YearDocument() ); - anoText.addActionListener( this ); - actualizarButton = new JButton( "Actualizar" ); - actualizarButton.addActionListener( this ); - - Calendar cal = Calendar.getInstance(); - anoText.setText( "" + cal.get( Calendar.YEAR ) ); - - JPanel pesquisaPanel = new JPanel(); - upperPanel.add( pesquisaPanel ); - pesquisaPanel.setLayout( new FlowLayout( FlowLayout.CENTER ) ); - pesquisaPanel.add( anoLabel ); - pesquisaPanel.add( anoText ); - pesquisaPanel.add( actualizarButton ); - -// Vector data[][] = new Vector[ 31 ][ 12 ]; -// for( int r = 0; r < 31; r++ ) -// { -// for( int c = 0; c < 12; c++ ) -// { -// data[ r ][ c ] = new Vector(); -// } -// } -//// Vector example = new Vector(); -//// example.add( new Object[]{ "Empresa1", "Estabelecimento1", "Pai Natal", "9:30", Color.red } ); -// data[ 20 ][ 10 ].add( new Object[]{ new Integer( 21 ) } ); -// data[ 20 ][ 10 ].add( new Object[]{ "Empresa1", "Estabelecimento1", "Pai Natal", Color.red } ); -// data[ 20 ][ 10 ].add( new Object[]{ "Empresa1", "Estabelecimento1", "Pai Natal", Color.green } ); -// data[ 20 ][ 10 ].add( new Object[]{ "Empresa1", "Estabelecimento1", "Pai Natal", Color.yellow } ); -// data[ 20 ][ 10 ].add( new Object[]{ "Empresa1", "Estabelecimento1", "Pai Natal", Color.white } ); -// mainPanel.fill( data ); - } - - public void actualizar() - { - String anoStr = anoText.getText(); - if( anoStr.length() == 0 ) - { - mainPanel.clear(); - } - else - { - Integer ano = new Integer( anoStr ); - try - { - mainPanel.fill( provider.getMapaAnual( ano ) ); - } - catch( Exception ex ) - { - DialogException.showExceptionMessage( ex, "Erro a carregar dados", true ); - mainPanel.clear(); - } - } - } - - public void actionPerformed( ActionEvent e ) - { - Object source = e.getSource(); - if( source.equals( actualizarButton ) || source.equals( anoText ) ) - { - actualizar(); - } - } -} diff --git a/trunk/SIPRPSoft/src/siprp/higiene/mapa/TecnicosPanel.java b/trunk/SIPRPSoft/src/siprp/higiene/mapa/TecnicosPanel.java deleted file mode 100644 index 602bc045..00000000 --- a/trunk/SIPRPSoft/src/siprp/higiene/mapa/TecnicosPanel.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * TecnicosPanel.java - * - * Created on 12 de Fevereiro de 2006, 17:48 - * - * To change this template, choose Tools | Template Manager - * and open the template in the editor. - */ - -package siprp.higiene.mapa; - -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; - -import javax.swing.JLabel; -import javax.swing.JPanel; - -import siprp.higiene.HigieneDataProvider; - -/** - * - * @author Frederico - */ -public class TecnicosPanel extends JPanel -{ - - private static final long serialVersionUID = 1L; - - protected HigieneDataProvider provider; - - /** Creates a new instance of TecnicosPanel */ - public TecnicosPanel() - throws Exception - { - provider = ( HigieneDataProvider ) HigieneDataProvider.getProvider(); - setupComponents(); - } - - private void setupComponents() - throws Exception - { - Object tecnicos[][] = provider.getTecnicosHST( false ); - GridBagLayout gridbag = new GridBagLayout(); - setLayout( gridbag ); - GridBagConstraints constraints = new GridBagConstraints(); - constraints.insets = new Insets( 1, 1, 1, 1 ); - constraints.fill = GridBagConstraints.HORIZONTAL; - constraints.gridheight = 1; - constraints.weighty = 0; - - for( int n = 0; n < tecnicos.length; n++ ) - { - constraints.weightx = 0; - constraints.gridwidth = 1; - JLabel corLabel = new JLabel( " " ); - corLabel.setBackground( HigieneDataProvider.CORES_TECNICOS[ ( ( Integer ) tecnicos[ n ][ 3 ] ).intValue() ] ); - corLabel.setOpaque( true ); - gridbag.setConstraints( corLabel, constraints ); - add( corLabel ); - constraints.weightx = 1; - constraints.gridwidth = GridBagConstraints.REMAINDER; - JLabel nomeLabel = new JLabel( (String)tecnicos[ n ][ 1 ] ); - gridbag.setConstraints( nomeLabel, constraints ); - add( nomeLabel ); - - } - - } -}