/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* The metal look and feel implementation of <code>TreeUI</code>.
* <p>
* <code>MetalTreeUI</code> allows for configuring how to
* visually render the spacing and delineation between nodes. The following
* hints are supported:
*
* <table summary="Descriptions of supported hints: Angled, Horizontal, and None">
* <tr>
* <th><p align="left">Angled</p></th>
* <td>A line is drawn connecting the child to the parent. For handling
* of the root node refer to
* {@link javax.swing.JTree#setRootVisible} and
* {@link javax.swing.JTree#setShowsRootHandles}.
* </td>
* </tr>
* <tr>
* <th><p align="left">Horizontal</p></th>
* <td>A horizontal line is drawn dividing the children of the root node.</td>
* </tr>
* <tr>
* <th><p align="left">None</p></th>
* <td>Do not draw any visual indication between nodes.</td>
* </tr>
* </table>
*
* <p>
* As it is typically impratical to obtain the <code>TreeUI</code> from
* the <code>JTree</code> and cast to an instance of <code>MetalTreeUI</code>
* you enable this property via the client property
* <code>JTree.lineStyle</code>. For example, to switch to
* <code>Horizontal</code> style you would do:
* <code>tree.putClientProperty("JTree.lineStyle", "Horizontal");</code>
* <p>
* The default is <code>Angled</code>.
*
* @author Tom Santos
* @author Steve Wilson (value add stuff)
*/
// Boilerplate
return new MetalTreeUI();
}
public MetalTreeUI()
{
super();
}
protected int getHorizontalLegBuffer()
{
return 3;
}
super.installUI( c );
}
super.uninstallUI(c);
}
/** this function converts between the string passed into the client property
* and the internal representation (currently and int)
*
*/
if ( lineStyleFlag == null ||
} else {
}
}
}
int boxWidth;
if(getExpandedIcon() != null)
else
boxWidth = 8;
}
return false;
}
super.paint( g, c );
// Paint the lines
}
}
return;
}
(tree, i));
// Draw a line at the top
}
}
}
if (lineStyle == LEG_LINE_STYLE) {
}
}
boolean isExpanded,
boolean hasBeenExpanded, boolean
isLeaf) {
if (lineStyle == LEG_LINE_STYLE) {
}
}
/** This class listens for changes in line style */
decodeLineStyle(e.getNewValue());
}
}
} // end class PaletteListener
}