1 3 package org.objectweb.fractal.swing; 4 5 import org.objectweb.fractal.api.control.BindingController; 6 7 import javax.swing.tree.TreeModel ; 8 import javax.swing.tree.TreeSelectionModel ; 9 import javax.swing.tree.TreeCellRenderer ; 10 11 public class JTreeImpl 12 extends javax.swing.JTree 13 implements JTreeItf, JTreeAttributes, BindingController 14 { 15 16 public final static String TREE_MODEL_BINDING = "tree-model"; 18 public final static String TREE_SELECTION_MODEL_BINDING = "tree-selection-model"; 19 public final static String TREE_CELL_RENDERER_BINDING = "tree-cell-renderer"; 20 21 public JTreeImpl () { 22 super(); 23 } 24 public JTreeImpl (Object [] arg0) { 25 super(arg0); 26 } 27 public JTreeImpl (java.util.Vector arg0) { 28 super(arg0); 29 } 30 public JTreeImpl (java.util.Hashtable arg0) { 31 super(arg0); 32 } 33 public JTreeImpl (javax.swing.tree.TreeNode arg0) { 34 super(arg0); 35 } 36 public JTreeImpl (javax.swing.tree.TreeNode arg0, boolean arg1) { 37 super(arg0,arg1); 38 } 39 public JTreeImpl (javax.swing.tree.TreeModel arg0) { 40 super(arg0); 41 } 42 43 public String [] listFc () { 44 return new String [] { 46 TREE_MODEL_BINDING, 47 TREE_SELECTION_MODEL_BINDING, 48 TREE_CELL_RENDERER_BINDING 49 }; 50 } 51 52 public Object lookupFc (String clientItfName) { 53 if (clientItfName.equals(TREE_MODEL_BINDING)) { 55 return getModel(); 56 } else if (clientItfName.equals(TREE_SELECTION_MODEL_BINDING)) { 57 return getSelectionModel(); 58 } else if (clientItfName.equals(TREE_CELL_RENDERER_BINDING)) { 59 return getCellRenderer(); 60 } 61 return null; 62 } 63 64 public void bindFc (String clientItfName, Object serverItf) { 65 if (clientItfName.equals(TREE_MODEL_BINDING)) { 67 setModel((TreeModel )serverItf); 68 } else if (clientItfName.equals(TREE_SELECTION_MODEL_BINDING)) { 69 setSelectionModel((TreeSelectionModel )serverItf); 70 } else if (clientItfName.equals(TREE_CELL_RENDERER_BINDING)) { 71 setCellRenderer((TreeCellRenderer )serverItf); 72 } 73 } 74 75 public void unbindFc (String clientItfName) { 76 if (clientItfName.equals(TREE_MODEL_BINDING)) { 78 setModel(null); 79 } else if (clientItfName.equals(TREE_SELECTION_MODEL_BINDING)) { 80 setSelectionModel(null); 81 } else if (clientItfName.equals(TREE_CELL_RENDERER_BINDING)) { 82 setCellRenderer(null); 83 } 84 } 85 86 } 87 | Popular Tags |