IDocumentView Interface
- public interface IDocumentView
extends ICookieSupport
, IDriverSupport
, IPropertySupport
This interface defines the primary way that the DocumentSvc displays documents and document editors
to the user. A document may define one or more views that allow the user to interact with the
document in various ways.
It is important to understand the relationship between document views
and the document. There is only one document object for a given object, but there may be not
only multiple IDocumentView objects, but multiple copies of the same IDocumentView object. The
document is responsible for ownership of the actual contents of the object. The view is responsible
for the user interface that reflects the documents contents. Changes made to the document, whether
made internally through the IDocument or IDocumentElement objects or made by the user through
the IDocumentView objects, should be visible in all IDocumentViews. The IDocumentView object
is responsible only for storing the state of the user interface. The IDocumentView should
create listeners either on the IDocumentElement tree, or on the ISourceModel to keep the
user interface in sync with changes to the document. Similarly, changes that the user makes
to the document should be performed through one of those mechanisms.
The createView method of the IDocumentViewInfo
is
intended to create a new instance of the IDocumentView. Users of the IDE may choose to display
two copies of the same IDocumentView (i.e. two source views in side-by-side windows). The state
of these two views needs to be different, but the underlying IDocument object will be the same.
As noted above, changes made in one view should be reflected in the other. However, each will
have a different cursor location, scroll position, etc.... This requirement captures the essence
of the IDocumentView. It is all state associated with the user interface for a document.
-
All Known Implementing Classes
-
DefaultDocumentView
-
All Superinterfaces
-
ICookieSupport
, IDriverSupport
, IPropertySupport
-
All Known Subinterfaces
-
IDesignView
, ISourceView
public IDocument |
-
getDocument ()
- Get the underlying document object associated with this view.
|
public IElement |
-
getDocumentElement (IElement el)
- Given an IElement from this view, map it to an appropriate IElement from the element tree of a document.
|
public INavigationPoint |
-
getNavigationPoint ()
- Gets a navigation point indicating the current position in the view.
|
public void |
-
onActivate (Container c)
- Called to indicate to this view that it should activate itself and display itself to the user.
|
public void |
-
onClose ()
- Called to indicate to the view that the user is no longer interested in this view so it should go away.
|
public void |
-
onDeactivate ()
- Called to indicate to the view that it should hide itself from the users view.
|
public boolean |
-
requestViewFocus ()
- Set this view to have the focus
|
public boolean |
-
setCurrentPoint (INavigationPoint np)
- This method updates the document view so that its state matches the
state specified by the navigation point.
|
PROP_SelectedElement
public static final String
PROP_SelectedElement
- This property indicates the currently selected element for the view.
SOURCE_VIEW
public static final String
SOURCE_VIEW
- Static string to represent the source view. Sinc switching to source view is a common operation, this
string should be used by all IDocumentView implementors to name their source view. It can then be used
in
DocumentSvc.I.displayDocument(IDocument, String)
to display the source view for
a particular document.
getDocument() Method
public IDocument
getDocument()
Get the underlying document object associated with this view.
Returns
- Document object over which this view is running
getDocumentElement(IElement) Method
public IElement
getDocumentElement(IElement
el)
Given an IElement from this view, map it to an appropriate IElement from the element tree of a document. If
it is already an element from a document, the element may simply be returned. If this element has no
corresponding element in the document tree, the implementation may return null
. The returned element is not
required to be from the document this view was created from. It may be from any document that is represented
in the view. This method is used to provide a mapping for views that use some other type of element as their
PROP_SelectedElement property.
Returns
- An IElement in the document's tree that the given element represents;
null
if there is no such element
getNavigationPoint() Method
public INavigationPoint
getNavigationPoint()
Gets a navigation point indicating the current position in the view.
onActivate(Container) Method
public void onActivate(Container
c)
Called to indicate to this view that it should activate itself and display itself to the user.
Parameters
-
c
- Container in which the view should place itself to be shown
onClose() Method
public void onClose()
Called to indicate to the view that the user is no longer interested in this view so it should go away. The view
will never be called again. In addition, it is guaranteed that IDocumentView.onDeactivate()
will always be called before
this method.
onDeactivate() Method
public void onDeactivate()
Called to indicate to the view that it should hide itself from the users view. This is distinct from onClose
in that it may be a temporary change.
requestViewFocus() Method
public boolean requestViewFocus()
Set this view to have the focus
setCurrentPoint(INavigationPoint) Method
public boolean setCurrentPoint(INavigationPoint
np)
This method updates the document view so that its state matches the
state specified by the navigation point. The document view should be in
the active state (that is, its onActivate() method must have been called more
recently than its onDeactivate() method).
Returns
true
if the document view was successfully updated to be consistent with
this navigation point; false
otherwise