|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.washington.biostr.sig.brainj3d.doevents.AbstractDataController<V>
public abstract class AbstractDataController<V extends DataView>
The default data controller handles most simple work that a data controller needs to do. It listens for SHObjects and fires a ParameterEvent with the name and value. It also handles state change events that target the data view.
| Nested Class Summary | |
|---|---|
protected class |
AbstractDataController.SetValues
|
| Constructor Summary | |
|---|---|
AbstractDataController(Class<?> viewClass)
|
|
| Method Summary | |
|---|---|
void |
addListener(CommandListener l)
add a listener that fires on events that cause a change to this. |
boolean |
doCommand(DoCommand cmd)
By default do nothing |
protected void |
fireCommand(DoCommand cmd)
|
protected void |
fireStateChange(State state)
|
protected V |
getCastView()
|
DataKey |
getDataKey()
|
V |
getDataView()
|
boolean |
getEdit()
Return true if we are in edit mode. |
String |
getEditButtonText()
Get the text for the edit button. |
protected abstract Executor |
getGUIThread()
Get the GUI thread. |
DoTarget |
getTarget()
Get the target. |
void |
initUI()
|
boolean |
isEditable()
Set to true if this has components that can be enabled/disabled with edit mode. |
boolean |
isFocus()
Within a set, a single Controller should have the focus. |
boolean |
isVisible()
Return the value that visible was set to. |
protected void |
monitorUpdates(DataKey target,
CommandListener listener)
Monitor updates to the specified targets parameters. |
void |
removeListener(CommandListener l)
|
void |
requestFocus()
Request focus. |
DataController |
setDataView(DataView view,
DataKey dataKey)
This is called when the view is set. |
void |
setDoTarget(DoTarget target)
Set the target. |
boolean |
setEdit(boolean edit)
By default do nothing |
void |
setFocus(boolean focus)
Set the focus. |
protected abstract void |
setGUIValues(Map<String,Object> g)
Set the GUI values. |
boolean |
setState(State s)
If the state has our key as the ident, send it to the data view, and call setGUIValues(Map |
void |
setVisible(boolean visible)
Set the visibility state. |
void |
somethingHappened(Event evt)
If evt instanceof SHPropertyEvent then we automatically
dispatch a ParemeterEvent with evt.getName() as the name, the DataKey
as the target and evt.getData() as the data.If this doesn't work for all of the GUI elements, than override this and handle those elements individually with a fallthrough like: else { |
void |
updateGUIValues()
|
protected abstract void |
viewWasSet(V view,
DataKey key)
This is called when the data view is set. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface edu.washington.biostr.sig.brainj3d.doevents.Controller |
|---|
getControl, getControlName |
| Constructor Detail |
|---|
public AbstractDataController(Class<?> viewClass)
| Method Detail |
|---|
public void addListener(CommandListener l)
addListener in interface DataControllerl - public void removeListener(CommandListener l)
removeListener in interface DataControllerprotected void fireStateChange(State state)
protected void fireCommand(DoCommand cmd)
public final DataController setDataView(DataView view,
DataKey dataKey)
setDataView in interface DataControllerprotected V getCastView()
public V getDataView()
getDataView in interface DataControllerpublic boolean setEdit(boolean edit)
setEdit in interface DataController
protected abstract void viewWasSet(V view,
DataKey key)
view - key - public boolean getEdit()
DataController
getEdit in interface DataControllerpublic DoTarget getTarget()
Controller
getTarget in interface Controllerpublic void setDoTarget(DoTarget target)
Controller
setDoTarget in interface Controllerpublic boolean isVisible()
Controller
isVisible in interface Controllerpublic void setVisible(boolean visible)
Controller
setVisible in interface Controllerpublic boolean isFocus()
Controller
isFocus in interface Controllerpublic void setFocus(boolean focus)
Controller
setFocus in interface Controllerpublic boolean doCommand(DoCommand cmd)
doCommand in interface CommandListenerpublic boolean setState(State s)
setState in interface CommandListenerpublic void updateGUIValues()
protected abstract void setGUIValues(Map<String,Object> g)
g - protected abstract Executor getGUIThread()
public void requestFocus()
if (getTarget() instanceof ViewPort)
{
((ViewPort) getTarget()).requestFocus(getDataKey());
}
Note:
requestFocus in interface Controllerpublic void somethingHappened(Event evt)
evt instanceof SHPropertyEvent then we automatically
dispatch a ParemeterEvent with evt.getName() as the name, the DataKey
as the target and evt.getData() as the data.else {
super.somethingHappened(evt)
}
somethingHappened in interface Listenerpublic DataKey getDataKey()
public String getEditButtonText()
DataController
getEditButtonText in interface DataControllerpublic boolean isEditable()
protected void monitorUpdates(DataKey target,
CommandListener listener)
target - The target to monitor or null to monitor all Parameter changeslistener - public void initUI()
initUI in interface DataController
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||