|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.borland.primetime.node.Node | +--com.borland.primetime.node.UrlNode | +--com.borland.primetime.node.FileNode
FileNode instances represent nodes within a project that are associated with storage outside the project file. Each FileNode has a single associated Url that represents storage available to the node, and no two FileNode instances in the same project may be associated with the same Url.
LightweightNode
Fields inherited from class com.borland.primetime.node.Node |
EMPTY_ARRAY, nodeListeners |
Constructor Summary | |
FileNode(Project project,
Node parent,
Url url)
All FileNode subtypes must expose this constructor signature. |
Method Summary | |
void |
check()
Updates the node to ensure that any manipulation done outside of the IDE is reflected on returning to the IDE by check if the underlying file has been modified using Buffer.check(). |
Buffer |
findBuffer()
Find an existing Buffer associated with this Node. |
static java.lang.Class |
findFileNodeClass(java.lang.String extension,
boolean includeBackups)
Searches the node class registry to attempt to match a file extension with a node type. |
static java.lang.Class |
findFileNodeClass(Url url)
Searches the node class registry to attempt to match a file extension with a node type assuming that backup files should be matched to the original file's node type. |
static java.lang.Class |
findFileNodeClass(Url url,
boolean includeBackups)
Searches the node class registry to attempt to match a file extension with a node type. |
Buffer |
getBuffer()
Provide lazy buffer loading by requesting a Buffer instance using the VFS the first time it is required and then caching the result. |
javax.swing.Icon |
getDisplayIcon()
Returns the default icon for a FileNode. |
java.lang.String |
getDisplayName()
Uses the the FileNode's underlying Url to derive a short display name. |
int |
getDisplaySequence()
Determines the overall grouping order for nodes in the project pane. |
java.io.InputStream |
getInputStream()
Create an input stream to read from the underlying Url. |
java.lang.String |
getLongDisplayName()
Use the Url's file component for display purposes except for the NewFilesystem where the full path is meaningless. |
java.io.OutputStream |
getOutputStream()
Create an output stream to write to the underlying Url. |
long |
getTimestamp()
Return any last modified timestamp associated with this buffer. |
Url |
getUrl()
Returns the node's associated Url. |
boolean |
isModified()
Return if any existing Buffer for this Node is modified or not. |
boolean |
isNew()
Returns whether nor the Url filesystem is the NewFilesystem. |
boolean |
isPersistant()
Determines whether or not the node definition and its properties will be saved with in a project file. |
boolean |
isReadOnly()
Returns if Buffer or file is read-only or not. |
static void |
registerFileNodeClass(java.lang.String extension,
java.lang.String description,
java.lang.Class nodeClass,
javax.swing.Icon icon)
Add a new node type to the registry of known types and their assocaited extensions. |
void |
rename(Url url)
Attempt to rename FileNode (it is not allowed to change the type of a FileNode) to match the given Url. |
void |
revert()
Attempt to revert the file associated with this Node by reloading it from storage. |
void |
save()
Attempt to save FileNode (unless it is using the NewFilesystem). |
void |
saveAs(Url url)
Attempt to save FileNode (it is not allowed to change the type of a FileNode) to the given Url (overwriting existing files) causing a name change if needed. |
protected void |
setUrl(Url url)
Changes the node's associated Url. |
Methods inherited from class com.borland.primetime.node.UrlNode |
getSuggestedUrl |
Methods inherited from class com.borland.primetime.node.Node |
addNodeListener, compareTo, dumpNodes, dumpNodes, dumpNodes, equals, fireNodeRenamed, getChildren, getDisplayChildren, getNodeID, getParent, getProject, getProperties, getProperty, getProperty, getProperty, hasChildren, hasDisplayChildren, hashCode, makePersistant, removeNodeListener, setParent, setProperty, setProperty, setProperty, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public FileNode(Project project, Node parent, Url url) throws DuplicateNodeException
project
- Project (cannot be null) to which this node will be associated.parent
- Immediate parent (may be null) of this node and must be of same Project.url
- The storage available to this node.DuplicateNodeException
- if node already registered.Project.getNode(com.borland.primetime.vfs.Url)
Method Detail |
public Url getUrl()
getUrl
in class UrlNode
protected void setUrl(Url url) throws DuplicateNodeException
rename
or saveAs
instead.url
- The new Url to associate with this FileNode.DuplicateNodeException
- If another node belonging to the same
project is already associated with the new Url.public static void registerFileNodeClass(java.lang.String extension, java.lang.String description, java.lang.Class nodeClass, javax.swing.Icon icon)
type
- The extension that this registration is associated with.
Extensions are case-insensitive and do not include the leading period
character.description
- A user-viewable description of the file type.bufferClass
- A subclass of FileNode that NodeSystem should
instantiate to represent files with the matching extension.public static java.lang.Class findFileNodeClass(Url url)
url
- The Url for which a suitable Node subclass should be found.public static java.lang.Class findFileNodeClass(Url url, boolean includeBackups)
url
- The Url for which a suitable Node subclass should be found.includeBackups
- True if VFS backup files should be matched to the
original file's node type.public static java.lang.Class findFileNodeClass(java.lang.String extension, boolean includeBackups)
extension
- The extension for which a suitable Node subclass should
be found.includeBackups
- True if VFS backup files should be matched to the
original file's node type.public Buffer getBuffer() throws java.io.IOException
java.io.IOException
- If the buffer cannot be loaded.Buffer
public Buffer findBuffer()
Buffer
public long getTimestamp()
Buffer
public java.io.InputStream getInputStream() throws java.io.IOException
java.io.IOException
- If the Url specifies a resource that could
not be read, or if no matching filesystem could be found for the Url.public java.io.OutputStream getOutputStream() throws java.io.IOException, VFSException
To modify the state of the in-memory buffer without immediately saving the results to disk use getBuffer().getOutputStream() instead.
java.io.IOException
- If the Url specifies a resource that could
not be written to.public boolean isReadOnly()
public boolean isNew()
isNew
in class UrlNode
NewFilesystem
public boolean isModified()
isModified
in class UrlNode
public void revert() throws java.io.IOException
revert
in class UrlNode
java.io.IOException
- If the Url specifies a resource that could
not be successfully reverted.public void rename(Url url) throws java.io.IOException, InvalidUrlException, DuplicateNodeException, ReadOnlyException
rename
in class UrlNode
url
- Url with new name.java.io.IOException
- InvalidUrlException
- DuplicateNodeException
- ReadOnlyException
- public void saveAs(Url url) throws java.io.IOException, InvalidUrlException, DuplicateNodeException
saveAs
in class UrlNode
url
- Url with new name where to save.java.io.IOException
- InvalidUrlException
- DuplicateNodeException
- public void save() throws java.io.IOException, InvalidUrlException
save
in class UrlNode
java.io.IOException
- InvalidUrlException
- public boolean isPersistant()
isPersistant
in class Node
public javax.swing.Icon getDisplayIcon()
getDisplayIcon
in class Node
public java.lang.String getDisplayName()
getDisplayName
in class Node
public java.lang.String getLongDisplayName()
getLongDisplayName
in class Node
public int getDisplaySequence()
getDisplaySequence
in class Node
public void check()
check
in class Node
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |