|
Extension SDK 10.1.2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.ide.model.DefaultDisplayable oracle.ide.model.DefaultElement oracle.ide.model.DefaultDocument
The DefaultDocument
class is a default implementation
of the Document
interface.
Document
,
Element
,
DefaultElement
Field Summary |
Fields inherited from interface oracle.ide.addin.Subject |
OBJECT_MODIFIED |
Constructor Summary | |
DefaultDocument()
Default constructor is required for JavaBean status. |
|
DefaultDocument(java.net.URL url)
Constructor that takes an URL pointing to the persistent
location of the document's contents. |
Method Summary | |
void |
attach(Observer observer)
Registers an observer interested in being notified when the internal state of the class implementing the Subject interface
changes. |
void |
close()
Part of Document interface. |
protected void |
copyToImpl(DefaultDocument copy)
Design pattern for supporting strongly typed copying. |
protected Subject |
createSubject()
Creates an instance of a Subject implementation. |
void |
detach(Observer observer)
Unregisters an observer that is not interested anymore in being notified when the internal state of the class implementing the Subject
interface changes. |
protected boolean |
ensureOpen()
Call this method to make sure that the document is properly opened before accessing its data. |
protected boolean |
equalsImpl(DefaultDocument document)
This is a helper method for Object.equals(Object) that can
also be used by subclasses that implement Object.equals(Object) . |
java.io.InputStream |
getInputStream()
Part of Document interface. |
java.lang.String |
getLongLabel()
Part of the Displayable interface. |
java.lang.String |
getShortLabel()
Part of the Displayable interface. |
protected Subject |
getSubject()
Gets the implementation of the Subject interface. |
long |
getTimestamp()
Part of Document interface. |
protected long |
getTimestampDirectly()
Accessor for allowing subclasses to get the timestamp directly. |
java.lang.String |
getToolTipText()
Part of the Displayable interface. |
java.net.URL |
getURL()
Part of Locatable interface. |
boolean |
isDirty()
True if the data in the object has been modified. |
boolean |
isNew()
Returns true if the document's data has never been
saved. |
boolean |
isOpen()
Part of Document interface. |
boolean |
isReadOnly()
Part of Document interface. |
void |
markDirty(boolean dirty)
Marks the data with the specified dirty state. |
void |
notifyObservers(java.lang.Object observed,
UpdateMessage change)
Notifies all observers that the state of the subject has changed. |
void |
open()
Part of Document interface. |
protected long |
refreshTimestamp()
Protected method that can be used to refresh the timestamp of the DefaultDocument based on the timestamp
that can be obtained through the URL . |
void |
save(boolean shallow)
Part of Document interface. |
protected void |
setOpen(boolean isOpen)
Protected accessor for the #_isOpen flag. |
protected void |
setTimestampDirectly(long timestamp)
Accessor for allowing subclasses to set the timestamp directly. |
void |
setURL(java.net.URL url)
Part of Locatable interface. |
protected void |
setURLDirectly(java.net.URL url)
Set the URL directly. |
Methods inherited from class oracle.ide.model.DefaultElement |
getAttributes, getChildren, getData, mayHaveChildren |
Methods inherited from class oracle.ide.model.DefaultDisplayable |
getIcon, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface oracle.ide.model.Element |
getAttributes, getChildren, mayHaveChildren |
Methods inherited from interface oracle.ide.model.Data |
getData |
Methods inherited from interface oracle.ide.model.Displayable |
getIcon, toString |
Constructor Detail |
public DefaultDocument()
public DefaultDocument(java.net.URL url)
URL
pointing to the persistent
location of the document's contents.
url
- URL
identifying the persistent document for
the content represented by this DefaultDocument
.Method Detail |
public java.net.URL getURL()
Locatable
interface. The default implementation
returns the currently set URL
.
getURL
in interface Locatable
URL
identifying this Locatable
.Locatable.getURL()
public void setURL(java.net.URL url)
Locatable
interface. The default implementation
sets the URL
to the specified value.
setURL
in interface Locatable
url
- The URL
to set.Locatable.setURL(URL)
public boolean isDirty()
Dirtyable
isDirty
in interface Dirtyable
true
if the data in the object has been modified.public void markDirty(boolean dirty)
Dirtyable
markDirty(...)
instead of
setDirty(...)
so that the JavaBeans
Introspector
will not
mistakenly identify "dirty" as a JavaBean property.
markDirty
in interface Dirtyable
dirty
- If true
, sets the object as being
dirty; if false
, sets the object as being up-to-date.public java.lang.String getShortLabel()
Displayable
interface. The default
implementation returns the file name part of the currently set
URL
. If the currently set URL
is
null
, then this method returns "<null>".
getShortLabel
in interface Displayable
getShortLabel
in class DefaultDisplayable
Displayable.getShortLabel()
public java.lang.String getLongLabel()
Displayable
interface. The default
implementation returns the path name part of the currently set
URL
. If the currently set URL
is
null
, then this method returns "<null>".
getLongLabel
in interface Displayable
getLongLabel
in class DefaultDisplayable
Displayable.getLongLabel()
public java.lang.String getToolTipText()
Displayable
interface. The default
implementation returns the same result as the
getLongLabel()
method.
getToolTipText
in interface Displayable
getToolTipText
in class DefaultDisplayable
Displayable.getToolTipText()
public void attach(Observer observer)
Subject
Subject
interface
changes.
Implementors should do nothing when the same observer is added more
than once.
attach
in interface Subject
observer
- the Observer
interested in change notification
messages.public void detach(Observer observer)
Subject
Subject
interface changes.
Implementors should do nothing when the same observer is removed more
than once.
detach
in interface Subject
observer
- the Observer
disinterested in change
notification messages.public void notifyObservers(java.lang.Object observed, UpdateMessage change)
Subject
notifyObservers
in interface Subject
observed
- the subject whose state has changed.change
- what changed.public void open() throws java.io.IOException
Document
interface. This implementation simply
calls setOpen
(true)
and
refreshes the timestamp.
open
in interface Document
java.io.IOException
- Signals that an I/O exception of some sort
occurred.Document.open()
public void close() throws java.io.IOException
Document
interface. This implementation simply
calls setOpen
(false)
.
close
in interface Document
java.io.IOException
- Signals that an I/O exception of some sort
occurred.Document.close()
public void save(boolean shallow) throws java.io.IOException
Document
interface. This implementation simply
clears the dirty
flag by calling
markDirty
(false)
.
save
in interface Document
shallow
- The value of this parameter only matters if the
Document
is also a Container
. If
shallow
is true
, children should not
be saved; if shallow
is false
, children
should also be saved.
java.io.IOException
- Signals that an I/O exception of some sort
occurred.Document.save(boolean)
public boolean isOpen()
Document
interface. This implementataion returns
the current state of the #_isOpen
flag.
isOpen
in interface LazyLoadable
LazyLoadable.isOpen()
public boolean isReadOnly()
Document
interface. This implementation delegates
to the URLFileSystem
to determine whether or not this
document is read-only.
isReadOnly
in interface Document
true
if the document is a read-only document.Document.isReadOnly()
public long getTimestamp()
Document
interface. This implementation gets the
timestamp based on the last time that this document was either
opened or saved.
getTimestamp
in interface Document
Document
's time stamp.Document.getTimestamp()
public java.io.InputStream getInputStream() throws java.io.IOException
Document
interface. The default implementation
returns a raw InputStream
based on the URL
associated with the Document
. The InputStream
is
obtained through the URLFileSystem
class. The caller is
responsible for closing the InputStream
when done.
getInputStream
in interface Document
InputStream
, or null
if the
document has no contents.
java.net.UnknownServiceException
- if the
URL
's protocol does not support input; this exception is
a subclass of IOException
.
java.io.IOException
- if an I/O error occurs when trying to open
the InputStream
.Document.getInputStream()
public boolean isNew()
Document
true
if the document's data has never been
saved.
isNew
in interface Document
true
if the document's data has never been
saved.protected void setOpen(boolean isOpen)
#_isOpen
flag. This method
must remain protected
in order to avoid being picked
up by the Introspector
as a
read/writeable JavaBean property.
protected long refreshTimestamp()
DefaultDocument
based on the timestamp
that can be obtained through the URL
.
protected long getTimestampDirectly()
protected void setTimestampDirectly(long timestamp)
protected final void copyToImpl(DefaultDocument copy)
This method is intended to be helper method that subclasses can use,
if they implement the Copyable
interface.
protected final boolean equalsImpl(DefaultDocument document)
Object.equals(Object)
that can
also be used by subclasses that implement Object.equals(Object)
.
It assumes that the argument is not null
.
protected Subject getSubject()
Subject
interface. This
implementation returns an IdeSubject
but subclasses should
override the createSubject
method in order to provide
a different implementation of a Subject
.
protected Subject createSubject()
Subject
implementation. This method
is called from getSubject()
the first time the subject
is created. Subclasses should override this method to provide their
own Subject
implementation.
protected boolean ensureOpen()
protected void setURLDirectly(java.net.URL url)
URL
directly. This method just sets the url
on the node. The method is intended to provide a way to create a
document without having the node put in the node factory cache.
url
- the node's url
.
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.