Skip to main content
summaryrefslogtreecommitdiffstats
blob: 6539d9a60e5228bcae2fbb347e186b25ae4f8929 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*******************************************************************************
 * Copyright (c) 2001, 2004 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

package org.eclipse.wst.ws.internal.explorer.platform.uddi.perspective;

import org.eclipse.wst.ws.internal.datamodel.ElementAdapter;
import org.eclipse.wst.ws.internal.datamodel.RelAddEvent;
import org.eclipse.wst.ws.internal.datamodel.RelRemoveEvent;
import org.eclipse.wst.ws.internal.explorer.platform.datamodel.TreeElement;
import org.eclipse.wst.ws.internal.explorer.platform.perspective.Node;
import org.eclipse.wst.ws.internal.explorer.platform.perspective.NodeManager;
import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.UDDIActionInputs;
import org.eclipse.wst.ws.internal.explorer.platform.uddi.constants.UDDIModelConstants;
import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.PublishedItemsElement;

public class PublishedItemsNode extends UDDINavigatorFolderNode
{
  public PublishedItemsNode(TreeElement element,NodeManager nodeManager,int nodeDepth)
  {
    super(element,nodeManager,nodeDepth);
    element.addListener(new ElementAdapter()
    {
      public void relAdded(RelAddEvent event)
      {
        String rel = event.getOutBoundRelName();
        if (rel.equals(UDDIModelConstants.REL_PUBLISHED_ITEMS))
        {
          TreeElement treeElement = (TreeElement)event.getParentElement();
          createChildNode(treeElement);
        }
      }

      public void relRemoved(RelRemoveEvent event)
      {
        TreeElement treeElement = null;
        if (event.getInBoundRelName().equals(UDDIModelConstants.REL_PUBLISHED_ITEMS))
          treeElement = (TreeElement)event.getInboundElement();
        else if (event.getOutBoundRelName().equals(UDDIModelConstants.REL_PUBLISHED_ITEMS))
          treeElement = (TreeElement)event.getOutBoundElement();

        if (treeElement != null)
          removeChildNode(treeElement);
      }
    });
  }

  private final void createChildNode(TreeElement element)
  {
    PublishedItemsElement publishedItemsElement = (PublishedItemsElement)element_;
    Node childNode = null;
    switch (publishedItemsElement.getType())
    {
      case UDDIActionInputs.QUERY_ITEM_BUSINESSES:
        childNode = new BusinessNode(element,nodeManager_,nodeDepth_+1);
        break;
      case UDDIActionInputs.QUERY_ITEM_SERVICES:
        childNode = new ServiceNode(element,nodeManager_,nodeDepth_+1);
        break;
      case UDDIActionInputs.QUERY_ITEM_SERVICE_INTERFACES:
        childNode = new ServiceInterfaceNode(element,nodeManager_,nodeDepth_+1);
    }
    if (childNode != null)
      addChild(childNode);
  }
  
  protected final void initTools()
  {
    PublishedItemsElement publishedItemsElement = (PublishedItemsElement)element_;
    UDDIPerspective uddiPerspective = nodeManager_.getController().getUDDIPerspective();
    int publishedItemsType = publishedItemsElement.getType();
    switch (publishedItemsType)
    {
      case UDDIActionInputs.QUERY_ITEM_BUSINESSES:
        new ItemsSummaryTool(toolManager_,"uddi/images/businesses_closed_enabled.gif","uddi/images/businesses_closed_highlighted.gif",uddiPerspective.getMessage("ALT_SUMMARY_BUSINESSES"),publishedItemsType);
        break;
      case UDDIActionInputs.QUERY_ITEM_SERVICES:
        new ItemsSummaryTool(toolManager_,"uddi/images/services_closed_enabled.gif","uddi/images/services_closed_highlighted.gif",uddiPerspective.getMessage("ALT_SUMMARY_SERVICES"),publishedItemsType);
        break;
      case UDDIActionInputs.QUERY_ITEM_SERVICE_INTERFACES:
      default:
        new ItemsSummaryTool(toolManager_,"uddi/images/service_interfaces_closed_enabled.gif","uddi/images/service_interfaces_closed_highlighted.gif",uddiPerspective.getMessage("ALT_SUMMARY_SERVICE_INTERFACES"),publishedItemsType);
    }
  }
  
  public String getOpenImagePath()
  {
    PublishedItemsElement publishedItemsElement = (PublishedItemsElement)element_;
    int publishedItemsType = publishedItemsElement.getType();
    switch (publishedItemsType)
    {
      case UDDIActionInputs.QUERY_ITEM_BUSINESSES:
        return "uddi/images/businesses_open_highlighted.gif";
      case UDDIActionInputs.QUERY_ITEM_SERVICES:
        return "uddi/images/services_open_highlighted.gif";
      case UDDIActionInputs.QUERY_ITEM_SERVICE_INTERFACES:
        return "uddi/images/service_interfaces_open_highlighted.gif";
    }
    return super.getOpenImagePath();
  }
  
  public String getClosedImagePath()
  {
    PublishedItemsElement publishedItemsElement = (PublishedItemsElement)element_;
    int publishedItemsType = publishedItemsElement.getType();
    switch (publishedItemsType)
    {
      case UDDIActionInputs.QUERY_ITEM_BUSINESSES:
        return "uddi/images/businesses_closed_highlighted.gif";
      case UDDIActionInputs.QUERY_ITEM_SERVICES:
        return "uddi/images/services_closed_highlighted.gif";
      case UDDIActionInputs.QUERY_ITEM_SERVICE_INTERFACES:
        return "uddi/images/service_interfaces_closed_highlighted.gif";
    }
    return super.getClosedImagePath();
  }
}

Back to the top