From 1af7d3700724834e40ad8636bc9a56cdc3b19b15 Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Sat, 27 Jul 2019 11:52:38 -0400 Subject: [PATCH] New layout icons --- cTreeModel.java | 127 +++++++++++++++++++++--------------------- 1 files changed, 64 insertions(+), 63 deletions(-) diff --git a/cTreeModel.java b/cTreeModel.java index e5f99c4..85f893d 100644 --- a/cTreeModel.java +++ b/cTreeModel.java @@ -8,101 +8,100 @@ public cTreeModel(Object3D owner) { - root = owner; + root = owner; } public void addTreeModelListener(TreeModelListener l) { } - public Object getChild(Object parent, int index) + public Object getChild(Object parent, int index) { - Object3D /*Composite*/ group = (Object3D /*Composite*/) parent; + Object3D /*Composite*/ group = (Object3D /*Composite*/) parent; - return group./*children.*/get(index); + return group./*children.*/get(index); } - public int getChildCount(Object parent) + public int getChildCount(Object parent) { - //if (parent instanceof Composite) - { - return ((Object3D /*Composite*/) parent)/*.children*/.Size(); - } + //if (parent instanceof Composite) + { + return ((Object3D /*Composite*/) parent)/*.children*/.Size(); + } - //return 0; + //return 0; } - public int getIndexOfChild(Object parent, Object child) + public int getIndexOfChild(Object parent, Object child) { - Object3D /*Composite*/ group = (Object3D /*Composite*/) parent; + Object3D /*Composite*/ group = (Object3D /*Composite*/) parent; - return group./*GetObject().*/indexOf(child); + return group./*GetObject().*/indexOf(child); } - public Object getRoot() + public Object getRoot() { - return root; + return root; } - public boolean isLeaf(Object node) + public boolean isLeaf(Object node) { - return ((Object3D)node).Size() == 0; // !(node instanceof Composite); + return ((Object3D) node).Size() == 0; // !(node instanceof Composite); } - public void removeTreeModelListener(TreeModelListener l) + public void removeTreeModelListener(TreeModelListener l) { } - public void valueForPathChanged(TreePath path, Object newValue) + public void valueForPathChanged(TreePath path, Object newValue) { } static class Renderer extends DefaultTreeCellRenderer { - public Renderer() { + public Renderer() + { } public java.awt.Component getTreeCellRendererComponent( - javax.swing.JTree tree, - Object value, - boolean sel, - boolean expanded, - boolean leaf, - int row, - boolean hasFocus) + javax.swing.JTree tree, + Object value, + boolean sel, + boolean expanded, + boolean leaf, + int row, + boolean hasFocus) { //System.out.println(value.getClass()); - super.getTreeCellRendererComponent( - tree, value, sel, - expanded, leaf, row, - hasFocus); - String stringValue = tree.convertValueToText(value, sel, - expanded, leaf, row, hasFocus); + super.getTreeCellRendererComponent(tree, value, sel, + expanded, leaf, row, hasFocus); + String stringValue = tree.convertValueToText(value, sel, + expanded, leaf, row, hasFocus); - //this.tree = tree; - this.hasFocus = hasFocus; - setText(stringValue); + //this.tree = tree; + this.hasFocus = hasFocus; + setText(stringValue); - Object3D obj = (Object3D) value; - - int r = 0, g = 0, b = 0; + Object3D obj = (Object3D) value; - if (obj.live) - { - g = 192; - } - - if (obj.hide) - { - r = 192; - } - - if (obj.link2master) - { - b = 192; - } - - java.awt.Color fg = new java.awt.Color(r,g,b); + int r = 0, g = 0, b = 0; + + if (obj.live) + { + g = 192; + } + + if (obj.hide) + { + r = 192; + } + + if (obj.link2master) + { + b = 192; + } + + java.awt.Color fg = new java.awt.Color(r, g, b); // isDropCell = false; // JTree.DropLocation dropLocation = tree.getDropLocation(); @@ -126,9 +125,9 @@ // } // setBackground(fg); - setForeground(fg); + setForeground(fg); - // There needs to be a way to specify disabled icons. + // There needs to be a way to specify disabled icons. // if (!tree.isEnabled()) { // setEnabled(false); // @@ -152,20 +151,22 @@ // } // } - setComponentOrientation(tree.getComponentOrientation()); + setComponentOrientation(tree.getComponentOrientation()); - selected = sel; + selected = sel; //Object3D obj = (Object3D) value; - - if(obj.material == null) + + if (obj.material == null) + { setIcon(null); - + } + setToolTipText("This book is in the Tutorial series."); return this; } - + public void setText(String text) { //System.out.println(text); -- Gitblit v1.6.2