Class DeckTask
- java.lang.Object
-
- ca.cgjennings.apps.arkham.project.NewTaskType
-
- ca.cgjennings.apps.arkham.project.DeckTask
-
public class DeckTask extends NewTaskType
An empty deck task. The main feature is support for automatically creating a deck from the cards in the task.- Since:
- 2.1
- Author:
- Chris Jennings
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringKEY_COPIES_LIST_FILEThe setting key that stores the name of theCopiesListfile for the task.-
Fields inherited from class ca.cgjennings.apps.arkham.project.NewTaskType
CASEBOOK_TYPE, DECK_TYPE, DOCUMENTATION_TYPE, EXPANSION_BOARD_TYPE, FACTORY_SCRIPTED_SUBTYPE, FACTORY_TYPE, GENERIC_TYPE, PLUGIN_TYPE, TASK_GROUP_TYPE
-
-
Constructor Summary
Constructors Constructor Description DeckTask()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetCopiesListFileName(Task t)Returns the name of the file that contains the copies list for the task, ornullif this is not a deck or factory task.java.lang.StringgetDescription()Returns the localized, human-readable description of this task type as a simple HTML document.java.lang.StringgetLabel()Returns the localized, human-readable name of this task type.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 booleanisCopiesList(Member m)Returnstrueif the given member is a copies list in a task.static voidsetCopiesListFileName(Task t, java.lang.String fileName)Changes the name of the copies list file for this task.static booleantaskCanHaveCopiesList(Task t)Returnstrueif the specified task is a kind that supports copies list files.-
Methods inherited from class ca.cgjennings.apps.arkham.project.NewTaskType
getIconResource, getNewTaskTypes, getSubtype, isRegistered, register, toString, unregister
-
-
-
-
Field Detail
-
KEY_COPIES_LIST_FILE
public static final java.lang.String KEY_COPIES_LIST_FILE
The setting key that stores the name of theCopiesListfile for the task.- See Also:
- Constant Field Values
-
-
Method Detail
-
taskCanHaveCopiesList
public static boolean taskCanHaveCopiesList(Task t)
Returnstrueif the specified task is a kind that supports copies list files.- Parameters:
t- the task to check- Returns:
trueif it can contain copies files
-
getCopiesListFileName
public static java.lang.String getCopiesListFileName(Task t)
Returns the name of the file that contains the copies list for the task, ornullif this is not a deck or factory task. If the specified task isnull, the default copies file name is returned.- Parameters:
t- the task to check- Returns:
- the name of the copies list file for the task, or
null
-
setCopiesListFileName
public static void setCopiesListFileName(Task t, java.lang.String fileName)
Changes the name of the copies list file for this task. This does not change the name of the actual file, but changes the name of the file that project actions will look for to locate the copies list.- Parameters:
t- the task to set the copies list name forfileName- the new name- Throws:
java.lang.IllegalArgumentException- if the new name has an extension or the task type does not use copies lists
-
isCopiesList
public static boolean isCopiesList(Member m)
Returnstrueif the given member is a copies list in a task.- Parameters:
m- the member to test- Returns:
trueif the member is the copies list file for its task
-
getLabel
public java.lang.String getLabel()
Description copied from class:NewTaskTypeReturns the localized, human-readable name of this task type.- Specified by:
getLabelin classNewTaskType- Returns:
- the name displayed for this type in the new task dialog
-
getDescription
public java.lang.String getDescription()
Description copied from class:NewTaskTypeReturns the localized, human-readable description of this task type as a simple HTML document.- Overrides:
getDescriptionin classNewTaskType- Returns:
- a description of the task supported by this task type
-
getType
public java.lang.String getType()
Description copied from class:NewTaskTypeReturns 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.
- Overrides:
getTypein classNewTaskType- Returns:
- a non-
nullstring describing the task type
-
initializeNewTask
public boolean initializeNewTask(Project project, Task task) throws java.lang.Throwable
Description copied from class:NewTaskTypeThis 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.- Overrides:
initializeNewTaskin classNewTaskType- 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
-
-