Skip to main content
summaryrefslogtreecommitdiffstats
blob: d482fe1c8399fd12c4db8ac86cfeb4293f6efa14 (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
/*******************************************************************************
 * 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.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.QueryElement;
import org.eclipse.wst.ws.internal.explorer.platform.uddi.datamodel.RegistryElement;

public class QueryParentNode extends UDDINavigatorFolderNode
{
  public QueryParentNode(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_QUERIES))
        {
          QueryElement queryElement = (QueryElement)event.getParentElement();
          createChildNode(queryElement);
        }
      }

      public void relRemoved(RelRemoveEvent event)
      {
        QueryElement queryElement = null;
        if (event.getInBoundRelName().equals(UDDIModelConstants.REL_QUERIES))
          queryElement = (QueryElement)event.getInboundElement();
        else if (event.getOutBoundRelName().equals(UDDIModelConstants.REL_QUERIES))
          queryElement = (QueryElement)event.getOutBoundElement();

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

  private final void createChildNode(QueryElement element)
  {
    QueryNode queryNode = new QueryNode(element,nodeManager_,nodeDepth_+1);
    // Add registry authentication properties.
    RegistryElement regElement = (RegistryElement)(getParent().getTreeElement());
    queryNode.addAuthenticationProperties(regElement);
    addChild(queryNode);
  }
  
  protected final void initTools()
  {
    UDDIPerspective uddiPerspective = nodeManager_.getController().getUDDIPerspective();
    new ItemsSummaryTool(toolManager_,"uddi/images/queries_closed_enabled.gif","uddi/images/queries_closed_highlighted.gif",uddiPerspective.getMessage("ALT_SUMMARY_QUERIES"),UDDIActionInputs.QUERY_ITEM_QUERIES);
    new ItemsSummaryTool(toolManager_,"uddi/images/businesses_closed_enabled.gif","uddi/images/businesses_closed_highlighted.gif",uddiPerspective.getMessage("ALT_SUMMARY_BUSINESSES"),UDDIActionInputs.QUERY_ITEM_BUSINESSES);
    new ItemsSummaryTool(toolManager_,"uddi/images/services_closed_enabled.gif","uddi/images/services_closed_highlighted.gif",uddiPerspective.getMessage("ALT_SUMMARY_SERVICES"),UDDIActionInputs.QUERY_ITEM_SERVICES);
    new ItemsSummaryTool(toolManager_,"uddi/images/service_interfaces_closed_enabled.gif","uddi/images/service_interfaces_closed_highlighted.gif",uddiPerspective.getMessage("ALT_SUMMARY_SERVICE_INTERFACES"),UDDIActionInputs.QUERY_ITEM_SERVICE_INTERFACES);
  }
  
  public String getOpenImagePath()
  {
    return "uddi/images/queries_open_highlighted.gif";
  }
  
  public String getClosedImagePath()
  {
    return "uddi/images/queries_closed_highlighted.gif";
  }
}

Back to the top