public class TLcyLspSetControllerActiveSettable extends ALcyActiveSettable
An active settable implementation which allows to activate a controller on a Lightspeed view.
When calling setActive(true)
, the active settable will install the controller on the Lightspeed view.
The active settable will de-activate itself when another controller is placed on the view.
Note: this active settable does nothing when calling setActive(false)
.
To de-activate it, you need to install another controller on the view.
This means that typically you use multiple instances of this class, allowing the user of your application to
switch between different controllers.
To ensure that this is reflected in the UI, you need to indicate that de-activation of this active settable is not
possible when inserting it into the UI.
For example by passing false
as last argument in TLcyActionBarUtil#insertInConfiguredActionBars
,
or ILcyActionBar#insertActiveSettable
.
TLspSetControllerAction
,
Serialized FormDEFAULT, LONG_DESCRIPTION, NAME, SHORT_DESCRIPTION, SHOW_ACTION_NAME, SMALL_ICON, SMALL_SELECTED_ICON, VISIBLE
Constructor and Description |
---|
TLcyLspSetControllerActiveSettable(ILspController aController,
ILspView aView,
ILcyLucyEnv aLucyEnv)
Creates a new active settable that, when active, sets the given controller on the given view.
|
Modifier and Type | Method and Description |
---|---|
ILspController |
getController()
Returns the controller of this active settable.
|
ILcyLucyEnv |
getLucyEnv()
Returns the current Lucy environment.
|
Object |
getValue(String aKey)
Gets a value given its key.
|
ILspView |
getView()
Returns the view to set the controller on.
|
boolean |
isActive()
Returns true if the state of this object is active, false if the state is inactive.
|
boolean |
isEnabled()
Returns true if this object is enabled, false otherwise.
|
void |
putValue(String aKey,
Object aValue)
Associates a given value with a given key.
|
void |
setActive(boolean aActive)
Sets the active state of this object.
|
void |
setController(ILspController aController)
Sets the controller of this active settable.
|
void |
setEnabled(boolean aEnabled)
Sets the enabled state of this active settable.
|
void |
setView(ILspView aView)
Sets the view to set the controller on.
|
addPropertyChangeListener, firePropertyChange, getDisplayName, getIcon, getLongDescription, getName, getShortDescription, removePropertyChangeListener, setDisplayName, setIcon, setLongDescription, setName, setShortDescription
public TLcyLspSetControllerActiveSettable(ILspController aController, ILspView aView, ILcyLucyEnv aLucyEnv)
aController
- the controller that will be activated on the view. If null
is provided, a
controller must be set before using this active settableaView
- the view to activate the controller for. If null
is
provided, a view must be set before using this active settableaLucyEnv
- the Lucy back-end. Must not be null.public Object getValue(String aKey)
ILcyActiveSettable
getValue
in interface ILcyActiveSettable
getValue
in class ALcyActiveSettable
aKey
- The key to retrieve the value for.ILcyActiveSettable.putValue(java.lang.String, java.lang.Object)
public void putValue(String aKey, Object aValue)
ILcyActiveSettable
putValue
in interface ILcyActiveSettable
putValue
in class ALcyActiveSettable
aKey
- The key.aValue
- The value to associate to the key.ILcyActiveSettable.getValue(java.lang.String)
public boolean isActive()
ILcyActiveSettable
ILcyActiveSettable.setActive(boolean)
).ILcyActiveSettable.setActive(boolean)
public void setActive(boolean aActive)
ILcyActiveSettable
aActive
- True if the new state is active, false if the new state is inactive.ILcyActiveSettable.isActive()
public ILspController getController()
public void setController(ILspController aController)
aController
- The controller to work on.public ILcyLucyEnv getLucyEnv()
public ILspView getView()
public void setView(ILspView aView)
aView
- the view to set the controller on.public void setEnabled(boolean aEnabled)
ILcyActiveSettable
setEnabled
in interface ILcyActiveSettable
setEnabled
in class ALcyActiveSettable
aEnabled
- True if the new state of this object is enabled, false otherwise.ILcyActiveSettable.isEnabled()
public boolean isEnabled()
ILcyActiveSettable
isEnabled
in interface ILcyActiveSettable
isEnabled
in class ALcyActiveSettable
ILcyActiveSettable.setEnabled(boolean)