001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: package org.netbeans.modules.web.jsf.navigation.graph;
042:
043: import org.netbeans.api.visual.border.Border;
044: import org.netbeans.api.visual.border.BorderFactory;
045: import org.netbeans.api.visual.vmd.*;
046: import org.netbeans.api.visual.widget.Widget;
047: import org.netbeans.api.visual.model.ObjectState;
048: import org.netbeans.api.visual.anchor.AnchorShape;
049: import org.netbeans.api.visual.anchor.PointShape;
050: import org.openide.util.Utilities;
051:
052: import java.awt.*;
053: import org.netbeans.api.visual.anchor.PointShapeFactory;
054:
055: /**
056: * @author David Kaspar
057: */
058: public class PFENotModifiableScheme extends VMDColorScheme {
059:
060: private static final Color COLOR60_SELECT = new Color(210, 210, 210);
061: private static final Color COLOR60_HOVER = new Color(200, 200, 200);
062: private static final Color COLOR60_HOVER_BACKGROUND = new Color(
063: 0xB0C3E1);
064: private static final Color COLOR_NORMAL = new Color(230, 230, 230);
065: private static final Color COLOR_HIGHLIGHTED = new Color(0x316AC5);
066: private static final PointShape POINT_SHAPE_IMAGE = PointShapeFactory
067: .createImagePointShape(Utilities
068: .loadImage("org/netbeans/modules/visual/resources/vmd-pin.png")); // NOI18N
069:
070: private static final Border BORDER_PIN = BorderFactory
071: .createOpaqueBorder(2, 8, 2, 8);
072: private static final Border BORDER60_PIN_SELECT = BorderFactory
073: .createCompositeBorder(BorderFactory.createLineBorder(0, 1,
074: 0, 1, COLOR60_SELECT), BorderFactory
075: .createLineBorder(2, 7, 2, 7, COLOR60_SELECT));
076:
077: public void installUI(VMDNodeWidget widget) {
078: }
079:
080: public void updateUI(VMDNodeWidget widget,
081: ObjectState previousState, ObjectState state) {
082:
083: }
084:
085: public void installUI(VMDConnectionWidget widget) {
086: widget.setSourceAnchorShape(AnchorShape.NONE);
087: widget.setTargetAnchorShape(AnchorShape.TRIANGLE_FILLED);
088: widget.setPaintControlPoints(true);
089: }
090:
091: public void updateUI(VMDConnectionWidget widget,
092: ObjectState previousState, ObjectState state) {
093: if (state.isSelected()) {
094: widget.setForeground(COLOR60_SELECT);
095: } else if (state.isHighlighted()) {
096: widget.setForeground(COLOR_HIGHLIGHTED);
097: } else if (state.isHovered() || state.isFocused()) {
098: widget.setForeground(COLOR60_HOVER);
099: } else {
100: widget.setForeground(COLOR_NORMAL);
101: }
102:
103: if (state.isSelected() || state.isHovered()) {
104: widget.setControlPointShape(PointShape.SQUARE_FILLED_SMALL);
105: widget.setEndPointShape(PointShape.SQUARE_FILLED_BIG);
106: widget.setControlPointCutDistance(0);
107: } else {
108: widget.setControlPointShape(PointShape.NONE);
109: widget.setEndPointShape(POINT_SHAPE_IMAGE);
110: widget.setControlPointCutDistance(5);
111: }
112: }
113:
114: public void installUI(VMDPinWidget widget) {
115: widget.setBorder(BORDER_PIN);
116: widget.setBackground(COLOR60_HOVER_BACKGROUND);
117: }
118:
119: public void updateUI(VMDPinWidget widget,
120: ObjectState previousState, ObjectState state) {
121: widget.setOpaque(state.isHovered() || state.isFocused());
122: if (state.isSelected()) {
123: widget.setBorder(BORDER60_PIN_SELECT);
124: } else {
125: widget.setBorder(BORDER_PIN);
126: }
127: }
128:
129: public int getNodeAnchorGap(VMDNodeAnchor anchor) {
130: return 4;
131: }
132:
133: public boolean isNodeMinimizeButtonOnRight(VMDNodeWidget widget) {
134: return true;
135: }
136:
137: public Image getMinimizeWidgetImage(VMDNodeWidget widget) {
138: return widget.isMinimized() ? Utilities
139: .loadImage("org/netbeans/modules/visual/resources/vmd-expand-60.png") // NOI18N
140: : Utilities
141: .loadImage("org/netbeans/modules/visual/resources/vmd-collapse-60.png"); // NOI18N
142: }
143:
144: public Widget createPinCategoryWidget(VMDNodeWidget widget,
145: String categoryDisplayName) {
146: return VMDFactory.getOriginalScheme().createPinCategoryWidget(
147: widget, categoryDisplayName);
148: }
149:
150: }
|