Class NewTaskType
- java.lang.Object
-
- ca.cgjennings.apps.arkham.project.NewTaskType
-
- Direct Known Subclasses:
DeckTask,DocumentTask,PluginImportTask,PluginTask
public abstract class NewTaskType extends java.lang.ObjectA kind of task that can be added to a project.- Author:
- Chris Jennings
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCASEBOOK_TYPEThe standard task type for case books.static java.lang.StringDECK_TYPEThe standard task type for decks.static java.lang.StringDOCUMENTATION_TYPEThe standard task type for documentation folders.static java.lang.StringEXPANSION_BOARD_TYPEThe standard task type for expansion boards.static java.lang.StringFACTORY_SCRIPTED_SUBTYPEThe task subtype for scripted factories.static java.lang.StringFACTORY_TYPEThe standard task type for component factories.static java.lang.StringGENERIC_TYPEThe standard default task type.static java.lang.StringPLUGIN_TYPEThe standard task type for plug-ins.static java.lang.StringTASK_GROUP_TYPEThe task type for task groups.
-
Constructor Summary
Constructors Constructor Description NewTaskType()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDescription()Returns the localized, human-readable description of this task type as a simple HTML document.java.lang.StringgetIconResource()Returns a string that identifies an image resource to be used to locate the icon image for this task type.abstract java.lang.StringgetLabel()Returns the localized, human-readable name of this task type.static NewTaskType[]getNewTaskTypes()Returns an array of the types that are currently registered, sorted by type and then by label.java.lang.StringgetSubtype()Returns a string that describes the subtype of task created by thisNewTaskType.java.lang.StringgetType()Returns a string that describes the type of task created by thisNewTaskType.booleaninitializeNewTask(Project project, Task task)This method is called when this task type is added to a project.static booleanisRegistered(NewTaskType ntt)Returnstrueif a new task type instance is currently registered.static voidregister(NewTaskType ntt)Registers a new task type.java.lang.StringtoString()static voidunregister(NewTaskType ntt)Unregisters a new task type.
-
-
-
Field Detail
-
DECK_TYPE
public static final java.lang.String DECK_TYPE
The standard task type for decks.- See Also:
- Constant Field Values
-
CASEBOOK_TYPE
public static final java.lang.String CASEBOOK_TYPE
The standard task type for case books.- See Also:
- Constant Field Values
-
FACTORY_TYPE
public static final java.lang.String FACTORY_TYPE
The standard task type for component factories.- See Also:
- Constant Field Values
-
DOCUMENTATION_TYPE
public static final java.lang.String DOCUMENTATION_TYPE
The standard task type for documentation folders.- See Also:
- Constant Field Values
-
EXPANSION_BOARD_TYPE
public static final java.lang.String EXPANSION_BOARD_TYPE
The standard task type for expansion boards.- See Also:
- Constant Field Values
-
PLUGIN_TYPE
public static final java.lang.String PLUGIN_TYPE
The standard task type for plug-ins.- See Also:
- Constant Field Values
-
GENERIC_TYPE
public static final java.lang.String GENERIC_TYPE
The standard default task type.- See Also:
- Constant Field Values
-
TASK_GROUP_TYPE
public static final java.lang.String TASK_GROUP_TYPE
The task type for task groups.- See Also:
- Constant Field Values
-
FACTORY_SCRIPTED_SUBTYPE
public static final java.lang.String FACTORY_SCRIPTED_SUBTYPE
The task subtype for scripted factories.- See Also:
- Constant Field Values
-
-
Method Detail
-
getLabel
public abstract java.lang.String getLabel()
Returns the localized, human-readable name of this task type.- Returns:
- the name displayed for this type in the new task dialog
-
getDescription
public java.lang.String getDescription()
Returns the localized, human-readable description of this task type as a simple HTML document.- Returns:
- a description of the task supported by this task type
-
getType
public java.lang.String getType()
Returns a string that describes the type of task created by thisNewTaskType. The default implementation returns "TASK", the generic task type. Returning "PROJECT" is illegal, because that type is reserved to identify project folders. The type setting of new tasks of this type will be set to the value returned by this method.TaskActions often decide whether or not they can be applied to a given file based on the type and/or subtype of the task folder they belong to.Note that the type identifier returned by this method does not have to be unique.
- Returns:
- a non-
nullstring describing the task type
-
getSubtype
public java.lang.String getSubtype()
Returns a string that describes the subtype of task created by thisNewTaskType. This can benullto indicate no subtype. (The default implementation returnsnull.) The subtype setting of new tasks of this type will be set to the value returned by this method if it is non-null.- Returns:
- a string describing the task subtype, or
null
-
getIconResource
public java.lang.String getIconResource()
Returns a string that identifies an image resource to be used to locate the icon image for this task type. Ifnull, a default icon will be used based on the project type. If this value is non-null, then the icon setting of new tasks of this type will be set to the returned value. The icon used in the project view can be changed duringinitializeNewTask(ca.cgjennings.apps.arkham.project.Project, ca.cgjennings.apps.arkham.project.Task)by changing the value of this setting.- Returns:
- the path to an image file in the application resources
-
initializeNewTask
public boolean initializeNewTask(Project project, Task task) throws java.lang.Throwable
This method is called when this task type is added to a project. By the time this is called, the task folder will already exist and the type, subtype, and icon settings will be filled in using the values returned from this object, if any.The project view will be synchronized with the task after this method returns, so any new files added to the task folder will be detected immediately.
The default implementation does nothing, which means the user will simply have a new, empty task folder after adding the new task.
This method should return
trueif the initialization is successful. If it returnsfalse, or the method throws an exception, then the task folder will be deleted. If an exception was thrown, then a generic error message will be displayed; if the method returnsfalsethen it is assumed that the method displayed its own, more specific message.- Parameters:
project- the project that the task was added totask- theMemberthat represents the new task's folder- Returns:
trueif initialization succeeded- Throws:
java.lang.Throwable- if an uncaught exception occurs during initialization
-
toString
public java.lang.String toString()
This method is overridden to return the task type's label.
- Overrides:
toStringin classjava.lang.Object
-
register
public static void register(NewTaskType ntt)
Registers a new task type.- Parameters:
ntt- the type to register- Throws:
java.lang.NullPointerException- ifnttisnulljava.lang.IllegalArgumentException- ifnttis already registeredjava.lang.IllegalArgumentException- ifnttuses a reserved type code
-
unregister
public static void unregister(NewTaskType ntt)
Unregisters a new task type.- Parameters:
ntt- the type to unregister- Throws:
java.lang.NullPointerException- ifnttisnulljava.lang.IllegalArgumentException- ifnttis not already registered
-
isRegistered
public static boolean isRegistered(NewTaskType ntt)
Returnstrueif a new task type instance is currently registered.- Parameters:
ntt- the type to look for- Returns:
trueifntthas been registered- Throws:
java.lang.NullPointerException- ifnttisnull
-
getNewTaskTypes
public static NewTaskType[] getNewTaskTypes()
Returns an array of the types that are currently registered, sorted by type and then by label.- Returns:
- an array of the registered new task types
-
-