Class New.NewGameComponent
- java.lang.Object
-
- ca.cgjennings.apps.arkham.project.TaskAction
-
- ca.cgjennings.apps.arkham.project.New.NewGameComponent
-
- All Implemented Interfaces:
IconProvider
- Enclosing class:
- New
public static class New.NewGameComponent extends TaskAction
ANew
child action that creates a specific game component from a compiledGameComponent
class.
-
-
Constructor Summary
Constructors Constructor Description NewGameComponent(java.lang.String key, java.lang.String className, java.lang.String taskType, java.lang.String taskSubtype)
Creates a child action that creates a game component from a compiledGameComponent
subclass.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
appliesTo(Project project, Task task, Member member)
Returnstrue
if this action can be performed on the specified member of a project, project or a task.javax.swing.Icon
getIcon()
Returns an icon for this action, ornull
if the action should not be associated with an icon.java.lang.String
getLabel()
Returns the human-readable name of this action.boolean
perform(Project project, Task task, Member member)
Perform this action on a member of a project, a project or a task.-
Methods inherited from class ca.cgjennings.apps.arkham.project.TaskAction
appliesToSelection, applyToChildren, getActionName, getDescription, performOnSelection, resolveTarget, toString
-
-
-
-
Field Detail
-
klass
protected java.lang.String klass
-
iconKey
protected java.lang.String iconKey
-
docname
protected java.lang.String docname
-
label
protected java.lang.String label
-
taskType
protected java.lang.String taskType
-
taskSubtype
protected java.lang.String taskSubtype
-
icon
protected javax.swing.Icon icon
-
-
Constructor Detail
-
NewGameComponent
public NewGameComponent(java.lang.String key, java.lang.String className, java.lang.String taskType, java.lang.String taskSubtype)
Creates a child action that creates a game component from a compiledGameComponent
subclass.- Parameters:
key
- a UI text key for the component; if the key has the "app-new-" prefix this may be left offclassName
- the fully qualified name of the component class; or, if no package is specified, thearkham.component
package is used by defaulttaskType
- the type of task that must be active for the action to apply, ornull
taskSubtype
- the type of task subtype that must be active for the action to apply, ornull
- Throws:
java.lang.NullPointerException
- if the key or class name isnull
java.lang.IllegalArgumentException
- if the specified class does not exist
-
-
Method Detail
-
getLabel
public java.lang.String getLabel()
Description copied from class:TaskAction
Returns the human-readable name of this action.- Specified by:
getLabel
in classTaskAction
- Returns:
- the name used to create menu items for this action, localized if possible
-
perform
public boolean perform(Project project, Task task, Member member)
Description copied from class:TaskAction
Perform this action on a member of a project, a project or a task. If the project itself is the target,task
andmember
will benull
. If a task is the target, thenmember
will be null. If an error occurs while executing the task, then it is the action's responsibility to inform the user. This method can returnfalse
to indicate that if the action is being applied to multiple members, it should stop immediately rather than continue to the next member.- Specified by:
perform
in classTaskAction
- Parameters:
project
- the project that is being acted upontask
- the task within the project that is being acted upon;null
if acting on a projectmember
- the specific member within the task to act upon;null
if this is a project or task
-
appliesTo
public boolean appliesTo(Project project, Task task, Member member)
Description copied from class:TaskAction
Returnstrue
if this action can be performed on the specified member of a project, project or a task. If the project itself is the target,task
andmember
will benull
. If a task is the target, thenmember
will be null. If an error occurs while executing the task, then it is the action's responsibility to inform the user. This method can returnfalse
to indicate that if the action is being applied to multiple members, it should stop immediately rather than continue to the next member.- Specified by:
appliesTo
in classTaskAction
- Parameters:
project
- the project that is being acted upontask
- the task within the project that is being acted upon;null
if acting on a projectmember
- the specific member within the task to act upon;null
if this is a project or task
-
getIcon
public javax.swing.Icon getIcon()
Description copied from class:TaskAction
Returns an icon for this action, ornull
if the action should not be associated with an icon.- Specified by:
getIcon
in interfaceIconProvider
- Overrides:
getIcon
in classTaskAction
- Returns:
- an icon that represents the action
-
-