/*
* 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.
*/
/**
* Provides the Synth L&F UI delegate for
* {@link javax.swing.JTree}.
*
* @author Scott Violet
* @since 1.7
*/
implements PropertyChangeListener, SynthUI {
private boolean drawHorizontalLines;
private boolean drawVerticalLines;
private int padding;
private boolean useTreeColors;
/**
* Creates a new UI object for the given component.
*
* @param x component to create UI object for
* @return the UI object
*/
return new SynthTreeUI();
}
/**
* @inheritDoc
*/
return expandedIconWrapper;
}
/**
* @inheritDoc
*/
protected void installDefaults() {
}
0));
0));
context, "Tree.drawHorizontalLines",true);
context, "Tree.drawVerticalLines", true);
}
"Tree.rendererUseTreeColors", true);
}
}
}
/**
* @inheritDoc
*/
protected void installListeners() {
super.installListeners();
tree.addPropertyChangeListener(this);
}
/**
* @inheritDoc
*/
}
}
}
}
// Always treat the cell as selected, will be adjusted appropriately
// when painted.
}
/**
* @inheritDoc
*/
renderer);
}
else {
}
return editor;
}
/**
* @inheritDoc
*/
return new SynthTreeCellRenderer();
}
/**
* @inheritDoc
*/
protected void uninstallDefaults() {
}
}
/**
* @inheritDoc
*/
protected void uninstallListeners() {
super.uninstallListeners();
tree.removePropertyChangeListener(this);
}
/**
* Notifies this UI delegate to repaint the specified component.
* This method paints the component background, then calls
* the {@link #paint(SynthContext,Graphics)} method.
*
* <p>In general, this method does not need to be overridden by subclasses.
* All Look and Feel rendering code should reside in the {@code paint} method.
*
* @param g the {@code Graphics} object used for painting
* @param c the component being painted
* @see #paint(SynthContext,Graphics)
*/
}
/**
* @inheritDoc
*/
int y, int w, int h) {
}
/**
* Paints the specified component according to the Look and Feel.
* <p>This method is not used by Synth Look and Feel.
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
*
* @param g the {@code Graphics} object used for painting
* @param c the component being painted
* @see #paint(SynthContext,Graphics)
*/
}
/**
* Paints the specified component.
*
* @param context context for the component being painted
* @param g the {@code Graphics} object used for painting
* @see #update(Graphics,JComponent)
*/
paintBounds.y);
(initialPath);
if (paintingEnumerator != null) {
// First pass, draw the rows
boolean done = false;
boolean isExpanded;
boolean hasBeenExpanded;
boolean isLeaf;
if (isLeaf) {
isExpanded = hasBeenExpanded = false;
}
else {
}
done = true;
}
}
else {
done = true;
}
row++;
}
// Draw the connecting lines and controls.
// Find each parent and have them draw a line to their last child
while (parentPath != null) {
}
done = false;
if (isLeaf) {
isExpanded = hasBeenExpanded = false;
}
else {
}
// See if the vertical line to the parent has been drawn.
if (parentPath != null) {
}
}
}
hasBeenExpanded, isLeaf)) {
}
done = true;
}
}
else {
done = true;
}
row++;
}
}
paintDropLine(g);
// Empty out the renderer pane, allowing renderers to be gc'ed.
paintContext = null;
}
if (renderer instanceof DefaultTreeCellRenderer) {
}
color = r.getBackgroundSelectionColor();
}
color = r.getTextNonSelectionColor();
}
}
}
}
/**
* @inheritDoc
*/
boolean isExpanded,
boolean hasBeenExpanded, boolean
isLeaf) {
if (drawHorizontalLines) {
}
}
/**
* @inheritDoc
*/
}
/**
* @inheritDoc
*/
if (drawVerticalLines) {
}
}
/**
* @inheritDoc
*/
int bottom) {
}
boolean hasBeenExpanded, boolean isLeaf) {
// Don't paint the renderer if editing this row.
}
}
UIResource)) {
}
return;
}
int leadIndex;
}
else {
leadIndex = -1;
}
}
}
/**
* @inheritDoc
*/
//modify the paintContext's state to match the state for the row
//this is a hack in that it requires knowledge of the subsequent
//method calls. The point is, the context used in drawCentered
//should reflect the state of the row, not of the tree.
if (isSelected) {
}
}
/**
* @inheritDoc
*/
int x, int y) {
findCenteredX(x, w),
y - h/2, w, h);
}
/**
* @inheritDoc
*/
}
}
}
/**
* @inheritDoc
*/
if (!isDropLine(loc)) {
return;
}
if (c != null) {
g.setColor(c);
}
}
return;
}
Rectangle r;
if (isDropLine(loc)) {
r = getDropLineRect(loc);
} else {
if (r != null) {
r.x = 0;
}
}
if (r != null) {
}
}
/**
* @inheritDoc
*/
}
implements UIResource {
}
return "Tree.cellRenderer";
}
boolean sel,
boolean expanded,
boolean hasFocus) {
}
else {
}
}
paintComponent(g);
if (hasFocus) {
assert false: "SynthTreeCellRenderer is being used " +
"outside of UI that created it";
return;
}
int imageOffset = 0;
}
if (selected) {
}
else {
}
if(getComponentOrientation().isLeftToRight()) {
getHeight());
}
else {
}
}
}
}
}
return "Tree.cellEditor";
}
};
// One click to edit.
return editor;
}
}
//
// BasicTreeUI directly uses expandIcon outside of the Synth methods.
// To get the correct context we return an instance of this that fetches
// the SynthContext as needed.
//
int y, int w, int h) {
}
else {
}
}
int width;
}
else {
}
return width;
}
int height;
}
else {
}
return height;
}
}
}