org.malai.action.library
Class ActivateInactivateInstruments

java.lang.Object
  extended by org.malai.action.Action
      extended by org.malai.action.library.ActivateInactivateInstruments

public class ActivateInactivateInstruments
extends Action

This instrument activates and inactivates instruments.

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 (at your option) 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.1
Author:
Arnaud Blouin

Nested Class Summary
 
Nested classes/interfaces inherited from class org.malai.action.Action
Action.ActionStatus
 
Field Summary
protected  boolean activateFirst
          Defines the activations must be performed before the inactivations.
protected  boolean hideWidgets
          Defines if the widgets of WidgetInstrument instances must be hidden during their deactivation.
protected  java.util.List<Instrument> insActivate
          The instruments to activate.
protected  java.util.List<Instrument> insInactivate
          The instrument to desactivate.
 
Fields inherited from class org.malai.action.Action
status
 
Constructor Summary
ActivateInactivateInstruments()
          Creates and initialises the instrument.
 
Method Summary
protected  void activate()
           
 void addInstrumentToActivate(Instrument ins)
          Adds an instrument to activate.
 void addInstrumentToInactivate(Instrument ins)
          Adds an instrument to inactivate.
 boolean canDo()
           
protected  void deactivate()
           
protected  void doActionBody()
          This method contains the core code to execute when the action is executed.
 void flush()
          When an action is no more useful it can be flushes to release the used data.
 boolean isRegisterable()
          Specifies if the action must be saved in the action register.
 void setActivateFirst(boolean activateFirst)
           
 void setHideWidgets(boolean hideWidgets)
           
 
Methods inherited from class org.malai.action.Action
abort, cancelledBy, doIt, done, getStatus, hadEffect, isDone, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

insActivate

protected java.util.List<Instrument> insActivate
The instruments to activate.


insInactivate

protected java.util.List<Instrument> insInactivate
The instrument to desactivate.


activateFirst

protected boolean activateFirst
Defines the activations must be performed before the inactivations.


hideWidgets

protected boolean hideWidgets
Defines if the widgets of WidgetInstrument instances must be hidden during their deactivation.

Constructor Detail

ActivateInactivateInstruments

public ActivateInactivateInstruments()
Creates and initialises the instrument. By default instruments are not hidden and activation is performed first.

Since:
0.1
Method Detail

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

doActionBody

protected void doActionBody()
Description copied from class: Action
This method contains the core code to execute when the action is executed.

Specified by:
doActionBody in class Action

deactivate

protected void deactivate()

activate

protected void activate()

addInstrumentToActivate

public void addInstrumentToActivate(Instrument ins)
Adds an instrument to activate.

Parameters:
ins - The instrument to activate.
Since:
0.1

setHideWidgets

public void setHideWidgets(boolean hideWidgets)
Parameters:
hideWidgets - Defines if the widgets of WidgetInstrument instances must be hidden during their deactivation.
Since:
0.2

addInstrumentToInactivate

public void addInstrumentToInactivate(Instrument ins)
Adds an instrument to inactivate.

Parameters:
ins - The instrument to inactivate.
Since:
0.1

canDo

public boolean canDo()
Specified by:
canDo in class Action
Returns:
True if the action can be executed.

isRegisterable

public boolean isRegisterable()
Description copied from class: Action
Specifies if the action must be saved in the action register. For instance, some actions, such as a scroll of the scroll bars, should not be saved nor put in the undo/redo manager. Thus, they must not be registrable.

Specified by:
isRegisterable in class Action
Returns:
False. Action ActivateInactivateInstruments cannot be registered.

setActivateFirst

public void setActivateFirst(boolean activateFirst)
Parameters:
activateFirst - True: the activations will be performed before the inactivations.
Since:
0.2