forked from Coded/SIPRP
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
113 lines
2.6 KiB
113 lines
2.6 KiB
/*
|
|
* MapaHigienePanel.java
|
|
*
|
|
* Created on 9 de Fevereiro de 2006, 0:11
|
|
*
|
|
* To change this template, choose Tools | Template Manager
|
|
* and open the template in the editor.
|
|
*/
|
|
|
|
package siprp.higiene.mapa;
|
|
|
|
import java.awt.*;
|
|
import javax.swing.*;
|
|
import java.util.*;
|
|
|
|
import com.evolute.utils.dataui.*;
|
|
import com.evolute.utils.date.*;
|
|
import com.evolute.utils.tables.*;
|
|
/**
|
|
*
|
|
* @author Frederico
|
|
*/
|
|
public class MapaHigienePanel extends JPanel
|
|
implements ControllableComponent
|
|
{
|
|
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;
|
|
}
|
|
}
|