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