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.Object
A kind of task that can be added to a project.- Author:
- Chris Jennings
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CASEBOOK_TYPE
The standard task type for case books.static java.lang.String
DECK_TYPE
The standard task type for decks.static java.lang.String
DOCUMENTATION_TYPE
The standard task type for documentation folders.static java.lang.String
EXPANSION_BOARD_TYPE
The standard task type for expansion boards.static java.lang.String
FACTORY_SCRIPTED_SUBTYPE
The task subtype for scripted factories.static java.lang.String
FACTORY_TYPE
The standard task type for component factories.static java.lang.String
GENERIC_TYPE
The standard default task type.static java.lang.String
PLUGIN_TYPE
The standard task type for plug-ins.static java.lang.String
TASK_GROUP_TYPE
The 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.String
getDescription()
Returns the localized, human-readable description of this task type as a simple HTML document.java.lang.String
getIconResource()
Returns a string that identifies an image resource to be used to locate the icon image for this task type.abstract java.lang.String
getLabel()
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.String
getSubtype()
Returns a string that describes the subtype of task created by thisNewTaskType
.java.lang.String
getType()
Returns a string that describes the type of task created by thisNewTaskType
.boolean
initializeNewTask(Project project, Task task)
This method is called when this task type is added to a project.static boolean
isRegistered(NewTaskType ntt)
Returnstrue
if a new task type instance is currently registered.static void
register(NewTaskType ntt)
Registers a new task type.java.lang.String
toString()
static void
unregister(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.TaskAction
s 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-
null
string describing the task type
-
getSubtype
public java.lang.String getSubtype()
Returns a string that describes the subtype of task created by thisNewTaskType
. This can benull
to 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
true
if 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 returnsfalse
then it is assumed that the method displayed its own, more specific message.- Parameters:
project
- the project that the task was added totask
- theMember
that represents the new task's folder- Returns:
true
if 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:
toString
in 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
- ifntt
isnull
java.lang.IllegalArgumentException
- ifntt
is already registeredjava.lang.IllegalArgumentException
- ifntt
uses 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
- ifntt
isnull
java.lang.IllegalArgumentException
- ifntt
is not already registered
-
isRegistered
public static boolean isRegistered(NewTaskType ntt)
Returnstrue
if a new task type instance is currently registered.- Parameters:
ntt
- the type to look for- Returns:
true
ifntt
has been registered- Throws:
java.lang.NullPointerException
- ifntt
isnull
-
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
-
-