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:
20: package org.netbeans.modules.xslt.tmap.nodes;
21:
22: import org.netbeans.modules.xslt.tmap.model.api.Invoke;
23: import org.netbeans.modules.xslt.tmap.util.Util;
24: import org.openide.util.NbBundle;
25:
26: /**
27: *
28: * @author Vitaly Bychkov
29: * @version 1.0
30: */
31: public class DecoratedInvoke extends
32: DecoratedTMapComponentAbstract<Invoke> {
33:
34: public DecoratedInvoke(Invoke orig) {
35: super (orig);
36: }
37:
38: @Override
39: public String getHtmlDisplayName() {
40: Invoke ref = getOriginal();
41: String pltName = null;
42: String roleName = null;
43: String opName = null;
44: if (ref != null) {
45: pltName = Util.getReferenceLocalName(ref
46: .getPartnerLinkType());
47: roleName = Util.getReferenceLocalName(ref.getRole());
48: opName = Util.getReferenceLocalName(ref.getOperation());
49: }
50: String addon = null;
51: if (pltName != null) {
52: addon = TMapComponentNode.WHITE_SPACE + pltName; // NOI18N
53: }
54:
55: if (roleName != null) {
56: addon = (addon == null ? TMapComponentNode.EMPTY_STRING
57: : addon + TMapComponentNode.WHITE_SPACE)
58: + roleName; // NOI18N
59: }
60:
61: if (opName != null) {
62: addon = (addon == null ? TMapComponentNode.EMPTY_STRING
63: : addon + TMapComponentNode.WHITE_SPACE)
64: + opName; // NOI18N
65: }
66:
67: return Util.getGrayString(super .getHtmlDisplayName(), addon);
68: }
69:
70: @Override
71: public String getTooltip() {
72: Invoke ref = getOriginal();
73: StringBuffer attributesTooltip = new StringBuffer();
74: if (ref != null) {
75: attributesTooltip.append(Util.getLocalizedAttribute(ref
76: .getPartnerLinkType(), Invoke.PARTNER_LINK_TYPE));
77:
78: attributesTooltip.append(Util.getLocalizedAttribute(ref
79: .getRole(), Invoke.ROLE_NAME));
80:
81: attributesTooltip.append(Util.getLocalizedAttribute(ref
82: .getOperation(), Invoke.OPERATION_NAME));
83: }
84: return NbBundle.getMessage(TMapComponentNode.class,
85: "LBL_LONG_TOOLTIP_HTML_TEMPLATE", super.getName(),
86: attributesTooltip.toString());
87: }
88: }
|