org.xngr.context
Class DocumentContext

java.lang.Object
  extended by org.xngr.context.ServiceContext
      extended by org.xngr.context.URIServiceContext
          extended by org.xngr.context.FileContext
              extended by org.xngr.context.DocumentContext

public class DocumentContext
extends FileContext

The context for a XML document object, containing the file-services, document-services and node-services and actions for the file and document-services.

Version:
$Revision: 91 $, $Date: 2009-05-07 21:45:40 +0100 (Thu, 07 May 2009) $
Author:
Edwin Dankert

Method Summary
 void addDocumentContextListener(DocumentContextListener listener)
          Adds a document context listener, duplicate listeners will only be added once.
 void dispose()
          Removes all listeners and the reference to the manager, removes the context from the list of contexts maintained by the context-manager and also removes all links to the node-contexts.
protected  void fireNodeContextsChanged(NodeContext context, ServiceContextEvent.Type type)
          Fire an event when a node-context has either been added or removed.
 java.lang.String getDescription()
          Returns the most appropriate description for the context's URI.
 java.util.List<DocumentMarker> getDocumentMarkers()
           
 java.util.List<DocumentService> getDocumentServices()
           
 javax.swing.Icon getIcon()
          Returns the most appropriate icon for the context's URI.
 java.lang.String getName()
          Returns the most appropriate name for the context's URI.
 java.util.List<NodeContext> getNodeContexts()
           
 java.util.List<NodeMarker> getNodeMarkers()
           
 java.util.List<Service> getServices()
           
 void open(Action action)
          Opens the supplied service using the action's service, the context's URI and the arguments defined in the action.
 void open(DocumentService service)
          Opens the supplied service using the Context's URI and an empty HashMap as arguments.
 void open(DocumentService service, java.util.Map<java.lang.String,java.lang.String> arguments)
          Opens the supplied service using the Context's URI.
 void removeDocumentContextListener(DocumentContextListener listener)
          Remove the document context listener.
 
Methods inherited from class org.xngr.context.FileContext
getFileMarkers, getFileServices, getMarkers, open, open
 
Methods inherited from class org.xngr.context.URIServiceContext
getURI
 
Methods inherited from class org.xngr.context.ServiceContext
addServiceContextListener, fireActionsChanged, fireMarkersChanged, fireServicesChanged, getActions, removeServiceContextListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDocumentServices

public java.util.List<DocumentService> getDocumentServices()
Returns:
a live-list of document-services, modifications to the list will modify the list of document-services.

getDocumentMarkers

public java.util.List<DocumentMarker> getDocumentMarkers()
Returns:
a live-list of document-markers, modifications to the list will modify the list of document-markers.

getServices

public java.util.List<Service> getServices()
Overrides:
getServices in class FileContext
Returns:
a list of all the services associated with the document context, this is not a 'live' list.

getNodeMarkers

public java.util.List<NodeMarker> getNodeMarkers()
Returns:
a live-list of node-markers, modifications to the list will modify the list of node-services.

open

public void open(DocumentService service)
Opens the supplied service using the Context's URI and an empty HashMap as arguments.

Parameters:
service - the document-service to open.

open

public void open(Action action)
Opens the supplied service using the action's service, the context's URI and the arguments defined in the action.

Overrides:
open in class FileContext
Parameters:
action - the action to open the service for.

open

public void open(DocumentService service,
                 java.util.Map<java.lang.String,java.lang.String> arguments)
Opens the supplied service using the Context's URI.

Parameters:
service - the document-service to open.
arguments - the arguments

getIcon

public javax.swing.Icon getIcon()
Description copied from class: FileContext
Returns the most appropriate icon for the context's URI. This method iterates through the services starting with the 'most specific' service and ending with the least specific service, returning the first icon it finds. The method returns null when no icon can be found.

Overrides:
getIcon in class FileContext
Returns:
the icon for the context's uri or null when no icon can be found.
See Also:
FileContext#getIcon(URI)

getName

public java.lang.String getName()
Description copied from class: FileContext
Returns the most appropriate name for the context's URI. This method iterates through the services starting with the 'most specific' service and ending with the 'least specific' service, returning the first name it finds. The method returns null when no name can be found.

Overrides:
getName in class FileContext
Returns:
the name for the context's uri or null if no name can be found.
See Also:
FileContext#getName(String)

getDescription

public java.lang.String getDescription()
Description copied from class: FileContext
Returns the most appropriate description for the context's URI. This method iterates through the services starting with the 'most specific' service and ending with the 'least specific' service, returning the first description it finds. The method returns null when no description can be found.

Overrides:
getDescription in class FileContext
Returns:
the description for the context's uri or null if no description can be found.
See Also:
FileContext#getDescription(String)

getNodeContexts

public java.util.List<NodeContext> getNodeContexts()
Returns:
an unmodifiable List of node contexts which have been selected using the XPathExpressions for the different services. Note: Nodes for these node contexts are not editable.

addDocumentContextListener

public void addDocumentContextListener(DocumentContextListener listener)
Adds a document context listener, duplicate listeners will only be added once.

Parameters:
listener - the listener to add to the listener list.

removeDocumentContextListener

public void removeDocumentContextListener(DocumentContextListener listener)
Remove the document context listener.

Parameters:
listener - the listener to be removed from the listener list.

fireNodeContextsChanged

protected void fireNodeContextsChanged(NodeContext context,
                                       ServiceContextEvent.Type type)
Fire an event when a node-context has either been added or removed.

Parameters:
context - the node-context
type - the event-type.

dispose

public void dispose()
Removes all listeners and the reference to the manager, removes the context from the list of contexts maintained by the context-manager and also removes all links to the node-contexts.

Overrides:
dispose in class URIServiceContext


Copyright © 2002-2009 Edwin Dankert. All Rights Reserved.