00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00027 package org.mpcl.nui.treetable;
00028
00029 import java.awt.Component;
00030 import javax.swing.JTable;
00031 import javax.swing.JTree;
00032 import javax.swing.tree.DefaultTreeCellRenderer;
00033 import org.mpcl.nui.TTreeTable;
00034
00035
00037 public class TTreeTableCellRenderer implements ITreeTableCellRenderer
00038 {
00039
00041 protected JTree tTree;
00042
00044 protected DefaultTreeCellRenderer tTreeCellRenderer;
00045
00047 protected TTreeTable tTreeTable;
00048
00049
00050
00051
00052
00053
00058 public TTreeTableCellRenderer (TTreeTable tTREE_TABLE)
00059 {
00060 tTreeTable = tTREE_TABLE;
00061 tTree = tTreeTable.getTree();
00062 tTreeCellRenderer = new DefaultTreeCellRenderer();
00063 }
00064
00065
00066
00067
00068
00069
00094 public Component getTableCellRendererComponent ( JTable tTABLE ,
00095 Object tVALUE ,
00096 boolean gIS_SELECTED ,
00097 boolean gHAS_FOCUS ,
00098 int iROW ,
00099 int iCOLUMN )
00100 {
00101 if ( gIS_SELECTED )
00102 {
00103 tTree.setBackground (tTABLE.getSelectionBackground());
00104 }
00105 else
00106 {
00107 tTree.setBackground (tTABLE.getBackground());
00108 }
00109 tTreeTable.setLastVisibleRow (iROW);
00110 return tTree;
00111 }
00112
00130 public Component getTreeCellRendererComponent ( JTree tTREE ,
00131 Object tVALUE ,
00132 boolean gIS_SELECTED ,
00133 boolean gIS_EXPANDED ,
00134 boolean gIS_LEAF ,
00135 int iROW ,
00136 boolean gHAS_FOCUS )
00137 {
00138 tTreeCellRenderer.getTreeCellRendererComponent ( tTREE ,
00139 tVALUE ,
00140 gIS_SELECTED ,
00141 gIS_EXPANDED ,
00142 gIS_LEAF ,
00143 iROW ,
00144 gHAS_FOCUS );
00145 tTreeCellRenderer.setTextNonSelectionColor (tTreeTable.getForeground());
00146 tTreeCellRenderer.setBackgroundNonSelectionColor (tTreeTable.getBackground());
00147 return tTreeCellRenderer;
00148 }
00149
00150 }