|
|||||||||
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.Project
There are several ways in which a project node is unusual and needs special care:
project
is always null, but
getProject
returns a reference to the project itself.
nodeID
of a project is always 0.
parent
of a project is always null.
Field Summary | |
static java.lang.String |
CATEGORY_DEFAULT
The default project category "sys". |
static java.lang.String |
ENCODING
The encoding category "Encoding" which retains the setting used when read/write text files. |
static java.lang.String |
PREFIX_UNTITLED
The default prefix "Untitled" used by the createProject() and createFileNode() methods. |
protected java.util.ArrayList |
projectListeners
Array of registered ProjectListeners. |
Fields inherited from class com.borland.primetime.node.Node |
EMPTY_ARRAY, nodeListeners |
Constructor Summary | |
protected |
Project(Url url)
Creates a new project instance to represent a particular Url. |
Method Summary | |
void |
addProjectListener(ProjectListener listener)
Adds given listener to list of registered listeners for Project events. |
void |
check()
Ensure that the project's properties are resynchronized with the current state of its paths. |
FileNode |
createFileNode(java.lang.String extension)
Generates a unique Url with the specified extension for new files that the user has not yet been prompted to name. |
static Project |
createProject(java.lang.String extension)
Generates a unique Url with the specified extension for new projects that the user has not yet been prompted to name. |
void |
dumpAllNodes()
Strictly a diagnostic method |
static void |
dumpProjects()
Strictly a diagnostic method |
FileNode |
findNode(Url url)
Returns a FileNode for the given Url if it had been created earlier in this project for it. |
LightweightNode[] |
findNodes(java.lang.String name)
Returns an array of the registered lightweight nodes that are part of this Project (e.g. |
static Project |
findProject(Url url)
Maps given Url into a known, cached Project. |
void |
fireChildrenChanged(Node parent)
Notifies all registered ProjectListeners that a node has been been added to or removed from a parent node the project. |
void |
fireNodeChanged(Node node)
Notifies all registered ProjectListeners that a node's display name or icon has changed. |
void |
fireProjectPropertyChanged(java.lang.String category,
java.lang.String property,
java.lang.String oldValue,
java.lang.String newValue)
Notifies all registered ProjectListeners that a property on the project node has been changed. |
java.lang.String |
getAutoProperty(java.lang.String category,
java.lang.String property)
Gets the value of an automatic project property. |
javax.swing.Icon |
getDisplayIcon()
Returns the 16x16 icon used to represent a Project. |
java.lang.String |
getDisplayName()
Uses the the FileNode's underlying Url to derive a display name. |
int |
getDisplaySequence()
Returns sort sequence for ProjectPane. |
java.lang.String |
getEncoding()
Describes the standard encoding used to read and write text files for this project. |
java.lang.String |
getLongDisplayName()
Uses the the FileNode's underlying Url to derive a full display name. |
FileNode |
getNode(Url url)
Returns an appropriate FileNode from the given Url by either finding one created earlier in this Project for it, or by constructing one using a registered file type based on the file extension. |
Project |
getProject()
Returns Project which contains this node. |
static Project |
getProject(Url url)
Maps given Url into a Project by first searching cache, then if not found will create an cache an instance of the Project. |
Url |
getProjectPath()
Returns the Url representing the directory the project is stored in. |
Url |
getUrl()
Returns the Url the project is currently associated with. |
boolean |
isModified()
Describes whether or not unsaved changes exist in the project's state. |
boolean |
isNew()
Describes whether or not the project needs to be renamed before it can be saved. |
boolean |
isPersistant()
Determines whether or not the node definition and its properties will be saved with in a project file. |
static boolean |
isProjectExtension(java.lang.String extension)
Returns true if the given extension is registered as a project file type. |
static boolean |
isProjectUrl(Url url)
Returns true if given Url has a registered project file extension. |
protected void |
postProjectLoad(Url rootUrl)
Hook for doing postprocessing after the project is saved. |
protected void |
preProjectSave(Url rootUrl)
Hook for doing preprocessing prior to project being saved. |
void |
refresh()
Invoked whenever the "refresh" button is pressed from the project view's toolbar. |
static void |
registerProjectClass(java.lang.String extension,
java.lang.String description,
java.lang.Class projectClass,
javax.swing.Icon icon)
Add a new project type to the registry of known types and their associated extensions. |
void |
removeProjectListener(ProjectListener listener)
Removes given listener from list of registered listeners for Project events. |
void |
rename(Url url)
Rename cannot change the type of a Project. |
void |
revert()
Revert a project to its on-disk state. |
void |
save()
Updates the project's permanent storage to reflect the current state of the project. |
void |
saveAs(Url url)
saveAs _can_ change the extension of a Project since all state is maintained by the Project instance itself and not the buffer representation, and all project buffers _must_ be associated with Project nodes. |
void |
setAutoProperty(java.lang.String category,
java.lang.String property,
java.lang.String value)
Sets an automatic project property, which is always saved whether or not the project itself is saved. |
void |
setEncoding(java.lang.String encoding)
Changes the standard encoding used to read and write text files for this project. |
protected void |
setUrl(Url url)
Used internally by rename() and saveAs() to change the underlying Url associated with the project. |
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, 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 |
Field Detail |
public static final java.lang.String CATEGORY_DEFAULT
public static final java.lang.String ENCODING
public static final java.lang.String PREFIX_UNTITLED
protected java.util.ArrayList projectListeners
Constructor Detail |
protected Project(Url url) throws DuplicateNodeException, InvalidUrlException
url
- The resource to read the project definition from.DuplicateNodeException
- If a project
is already registered for the specified Url.Method Detail |
public java.lang.String getEncoding()
public void setEncoding(java.lang.String encoding)
encoding
- The Java encoding to use or null if the default encoding
should be used.protected void setUrl(Url url) throws DuplicateNodeException
url
- The new Url to be associated with the project. This value must
not be null.public Url getUrl()
getUrl
in class UrlNode
public Url getProjectPath()
public static boolean isProjectUrl(Url url)
url
- The Url to test.public static boolean isProjectExtension(java.lang.String extension)
extension
- The file extension without the leading period.public static void registerProjectClass(java.lang.String extension, java.lang.String description, java.lang.Class projectClass, 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.projectClass
- A subclass of Project that should be instantiated to
represent projects with the matching extension.public static Project findProject(Url url)
url
- Url to map into a Project.public static Project getProject(Url url) throws InvalidUrlException
url
- Url to map into a ProjectDuplicateNodeException
- If same Project created twice despite
earlier cache check.protected void preProjectSave(Url rootUrl)
rootUrl
- Url for the project being saved.protected void postProjectLoad(Url rootUrl)
rootUrl
- Url for the project being saved.public void revert()
Revert a project to its on-disk state. Note that this isn't the ideal implementation but is sufficient presuming that all references to project nodes are being discarded.
Ideally, we'd rather not lose FileNode instance identity and we would need to rework parentage on surviving nodes, etc.
revert
in class UrlNode
com.borland.primetime.node.UrlNode
java.io.IOException
- If the Url specifies a resource that could
not be successfully reverted.public void saveAs(Url url) throws java.io.IOException, InvalidUrlException, DuplicateNodeException
saveAs
in class UrlNode
url
- The destination location.java.io.IOException
- When error doing the physical save.InvalidUrlException
- When saving a project using a different file extension.public void rename(Url url) throws java.io.IOException, InvalidUrlException, DuplicateNodeException, ReadOnlyException
rename
in class UrlNode
url
- The new name (cannot be different file extension).java.io.IOException
- When error doing the physical change.InvalidUrlException
- When saving using a different file extension.ReadOnlyException
- If the file being renamed is read-only.public static Project createProject(java.lang.String extension)
extension
- A registered file extension for projects without the period.public FileNode createFileNode(java.lang.String extension)
extension
- A registered file extension for projects without the period.public FileNode getNode(Url url)
url
- Storage associated with this file.DuplicateNodeException
- public FileNode findNode(Url url)
public LightweightNode[] findNodes(java.lang.String name)
name
- The registered name of a particular type of lightweight node.public void setAutoProperty(java.lang.String category, java.lang.String property, java.lang.String value)
category
- The category to which the property belongs.property
- The name of the property.value
- The value of the property.public java.lang.String getAutoProperty(java.lang.String category, java.lang.String property)
category
- The category to which the property belongs.property
- The name of the property.public void addProjectListener(ProjectListener listener)
listener
- The listener to be registered.public void removeProjectListener(ProjectListener listener)
listener
- The listener to be unregistered.public void fireProjectPropertyChanged(java.lang.String category, java.lang.String property, java.lang.String oldValue, java.lang.String newValue)
category
- The category of the property, may be null.property
- The name of the property.oldValue
- The old value of the property, may be null.newValue
- The new value of the proeprty, may be null.public void fireChildrenChanged(Node parent)
parent
- Parent where children have been removed or added.public void fireNodeChanged(Node node)
node
- Node where name or icon has been changed.public boolean isPersistant()
isPersistant
in class Node
public void check()
check
in class Node
public boolean isModified()
isModified
in class UrlNode
public boolean isNew()
isNew
in class UrlNode
public void save() throws java.io.IOException, InvalidUrlException
save
in class UrlNode
com.borland.primetime.node.UrlNode
java.io.IOException
- InvalidUrlException
- public Project getProject()
getProject
in class Node
public int getDisplaySequence()
getDisplaySequence
in class Node
public java.lang.String getDisplayName()
getDisplayName
in class Node
public java.lang.String getLongDisplayName()
getLongDisplayName
in class Node
public javax.swing.Icon getDisplayIcon()
getDisplayIcon
in class Node
public void refresh()
public static void dumpProjects()
public void dumpAllNodes()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |