Clover coverage report - baseCode - 0.2.5 Coverage timestamp: Tue Apr 12 2005 11:31:58 EDT FRAMES NO FRAMES |
file stats: | LOC: | 77 |  | Methods: | 7
| NCLOC: | 43 |  | Classes: | 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
Source file | Conditionals | Statements | Methods | TOTAL
JVerticalHeaderRenderer.java | 0% | 0% | 0% | 0% |

1 |  |
     package baseCode.gui.table;
2 |  |
3 |  |
     import java.awt.Component;
4 |  |
     import java.awt.Dimension;
5 |  |
     import java.awt.Font;
6 |  |
     import java.awt.Graphics;
7 |  |
8 |  |
     import javax.swing.JTable;
9 |  |
     import javax.swing.table.JTableHeader;
10 |  |
     import javax.swing.table.TableCellRenderer;
11 |  |
12 |  |
     import baseCode.graphics.text.Util;
13 |  |
14 |  |
     /**
15 |  |
      * @author Will Braynen
16 |  |
      * @version $Id: JVerticalHeaderRenderer.java,v 1.2 2004/07/27 03:18:58 pavlidis Exp $
17 |  |
      */
18 |  |
     public class JVerticalHeaderRenderer extends JTableHeader implements
19 |  |
           TableCellRenderer {
20 |  |
21 |  |
        String m_columnName;
22 |  |
        final int PREFERRED_HEIGHT = 80;
23 |  |
        final int MAX_TEXT_LENGTH = 12;
24 |  |
25 |  |
        // This method is called each time a column header
26 |  |
        // using this renderer needs to be rendered.
27 | 0 |
        public Component getTableCellRendererComponent( JTable table, Object value,
28 |  |
              boolean isSelected, boolean hasFocus, int rowIndex, int vColIndex ) {
29 |  |
           // 'value' is column header value of column 'vColIndex'
30 |  |
           // rowIndex is always -1
31 |  |
           // isSelected is always false
32 |  |
           // hasFocus is always false
33 |  |
34 |  |
           // Configure the component with the specified value
35 | 0 |
           m_columnName = value.toString();
36 |  |
37 |  |
           // Set tool tip if desired
38 | 0 |
           setToolTipText( m_columnName );
39 |  |
40 |  |
           // Since the renderer is a component, return itself
41 | 0 |
           return this;
42 |  |
        }
43 |  |
44 | 0 |
        protected void paintComponent( Graphics g ) {
45 |  |
46 | 0 |
           super.paintComponent( g );
47 | 0 |
           Font font = getFont();
48 |  |
49 | 0 |
           if ( m_columnName.length() > MAX_TEXT_LENGTH ) {
50 | 0 |
              m_columnName = m_columnName.substring( 0, MAX_TEXT_LENGTH );
51 |  |
52 |  |
           }
53 | 0 |
           int x = getSize().width - 4;
54 | 0 |
           int y = getSize().height - 4;
55 | 0 |
           Util.drawVerticalString( g, m_columnName, font, x, y );
56 |  |
        }
57 |  |
58 | 0 |
        public Dimension getPreferredSize() {
59 |  |
60 | 0 |
           return new Dimension( super.getPreferredSize().width, PREFERRED_HEIGHT );
61 |  |
        }
62 |  |
63 |  |
        // The following methods override the defaults for performance reasons
64 | 0 |
        public void validate() {
65 |  |
        }
66 |  |
67 | 0 |
        public void revalidate() {
68 |  |
        }
69 |  |
70 | 0 |
        protected void firePropertyChange( String propertyName, Object oldValue,
71 |  |
              Object newValue ) {
72 |  |
        }
73 |  |
74 | 0 |
        public void firePropertyChange( String propertyName, boolean oldValue,
75 |  |
              boolean newValue ) {
76 |  |
        }
77 |  |
     }