01: /*
02: * The contents of this file are subject to the terms of the Common Development
03: * and Distribution License (the License). You may not use this file except in
04: * compliance with the License.
05: *
06: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
07: * or http://www.netbeans.org/cddl.txt.
08: *
09: * When distributing Covered Code, include this CDDL Header Notice in each file
10: * and include the License file at http://www.netbeans.org/cddl.txt.
11: * If applicable, add the following below the CDDL Header, with the fields
12: * enclosed by brackets [] replaced by your own identifying information:
13: * "Portions Copyrighted [year] [name of copyright owner]"
14: *
15: * The Original Software is NetBeans. The Initial Developer of the Original
16: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17: * Microsystems, Inc. All Rights Reserved.
18: */
19: package org.netbeans.modules.xslt.project.nodes;
20:
21: import java.awt.Image;
22: import org.netbeans.modules.xslt.tmap.model.xsltmap.TransformationType;
23: import org.netbeans.modules.xslt.tmap.model.xsltmap.TransformationUC;
24: import org.openide.nodes.AbstractNode;
25: import org.openide.nodes.Children;
26: import org.openide.util.Utilities;
27:
28: /**
29: *
30: * @author Vitaly Bychkov
31: * @version 1.0
32: */
33: public class TransformationUCNode extends AbstractNode {
34: private String useCase;
35: private TransformationUC tUC;
36: private static String ICON = "org/netbeans/modules/xslt/project/resources/requestReplyUC.png"; // NOI18N
37: private static String PROXY_UC_ICON = "org/netbeans/modules/xslt/project/resources/proxyUC.png"; // NOI18N
38:
39: public TransformationUCNode(TransformationUC tUC, Children children) {
40: super (children);
41: this .tUC = tUC;
42: TransformationType ucType = tUC.getTransformationType();
43: this .useCase = ucType != null ? ucType.getTagName() : "";
44:
45: }
46:
47: public String getDisplayName() {
48: return getName();
49: }
50:
51: public String getName() {
52: return useCase;
53: }
54:
55: public String getShortDescription() {
56: return "<html> <b>" + useCase + "</b> </html>";
57:
58: }
59:
60: public Image getIcon(int type) {
61: return Utilities
62: .loadImage(TransformationType.REQUEST_REPLY_SERVICE
63: .equals(tUC.getTransformationType()) ? ICON
64: : PROXY_UC_ICON);
65: }
66:
67: public Image getOpenedIcon(int type) {
68: return getIcon(type);
69: }
70:
71: public boolean canCopy() {
72: return false;
73: }
74:
75: public boolean canCut() {
76: return false;
77: }
78:
79: public boolean canDestroy() {
80: return false;
81: }
82:
83: public boolean canRename() {
84: return false;
85: }
86:
87: }
|