org.malai.action.library
Class ModifyValue
java.lang.Object
org.malai.action.Action
org.malai.action.library.ModifyValue
- Direct Known Subclasses:
- ModifyMagneticGrid, ShapePropertyAction
public abstract class ModifyValue
- extends Action
The goal of this abstract action is to modify an object. This object can be for instance
a property of an object.
The use of this action can be made when an object has a lot of properties which modification
follow the same process. Thus, a same action can be used to modify all the properties. To do
so, a enumeration of the properties can be defined and used into the action to specify which
property will be modified by the current action instance.
This file is part of Malai
Copyright (c) 2009-2012 Arnaud BLOUIN
Malai is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
any later version.
Malai is distributed without any warranty; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more details.
- Since:
- 0.2
- Author:
- Arnaud Blouin
Field Summary |
protected java.lang.Object |
value
The new value of the property. |
Constructor Summary |
ModifyValue()
Initialises the action. |
Method Summary |
protected abstract void |
applyValue(java.lang.Object obj)
This method executes the job of methods undo, redo, and do |
boolean |
canDo()
|
void |
flush()
When an action is no more useful it can be flushes to release the used data. |
protected abstract boolean |
isValueMatchesProperty()
|
void |
setValue(java.lang.Object value)
Sets the new value of the parameter to change. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
value
protected java.lang.Object value
- The new value of the property.
ModifyValue
public ModifyValue()
- Initialises the action.
- Since:
- 0.2
flush
public void flush()
- Description copied from class:
Action
- When an action is no more useful it can be flushes to release the used data.
Should be overridden.
- Overrides:
flush
in class Action
canDo
public boolean canDo()
- Specified by:
canDo
in class Action
- Returns:
- True if the action can be executed.
setValue
public void setValue(java.lang.Object value)
- Sets the new value of the parameter to change.
- Parameters:
value
- The new value.- Since:
- 0.2
applyValue
protected abstract void applyValue(java.lang.Object obj)
- This method executes the job of methods undo, redo, and do
- Parameters:
obj
- The value to set. Must not be null.
- Throws:
java.lang.NullPointerException
- If the given value is null.- Since:
- 0.2
isValueMatchesProperty
protected abstract boolean isValueMatchesProperty()
- Returns:
- True: the object to modified supports the selected property.
- Since:
- 0.2