|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jeta.open.gui.framework.JETAController
public abstract class JETAController
This is the base class for all controllers in an application. We follow the
model-view-controller pattern extensively in the UI. All controllers should
derive from this class. A controller is resposible for all event handlers for
a JETAPanel (JETAPanels handle only layout and view logic). This controller
class also supports disabling listeners. This is useful when updating a view
with components that fire events when changed programmatically such as
JComboBoxes. See enableEvents(boolean)
. Usage:
class MyController extends JETAController { public MyController(JETAContainer view) { super(view); // assign a button handler. If the view has a menu and toolbar button // for the same command, this assignAction method will install handlers // on both. assignAction(MyViewNames.ID_LOGIN_BUTTON, new LoginAction()); // assign other listeners } public class LoginAction implements ActionListener { public void actionPerformed(ActionEvent evt) { MyFrame frame = (MyFrame) getView(); //... } } }
Nested Class Summary | |
---|---|
static class |
JETAController.ListenerManager
|
class |
JETAController.TextFocusListener
Focus listener for text fields |
Constructor Summary | |
---|---|
JETAController(JETAContainer view)
ctor |
Method Summary | |
---|---|
boolean |
actionPerformed(String actionName,
ActionEvent evt)
Forwarded from the view when an action occurs. |
void |
assignAction(String compName,
ActionListener action)
Registers and ActionListener with this controller. |
protected void |
assignComponentAction(Component comp,
String commandId,
ActionListener action)
Registers this controller as an action listener with all components that have the given name found in the associated view. |
void |
assignListener(String compName,
ChangeListener listener)
Assigns a change listener to the Component for the given name - assuming the component has method addChangeListener( ChangeListener ) |
void |
assignListener(String compName,
ListSelectionListener listener)
Assigns a list listener to the JList for the given name |
void |
enableEvents(boolean enable)
Sets the flag that indicates if listener/action events should be propagated to registered listeners |
ActionListener |
getAction(String actionName)
Returns the first action listener associated with the given name. |
ActionListener |
getPrimaryActionListener()
Returns the main action listener that is registered with components in the associated view. |
JETAContainer |
getView()
Returns the view that is associated with this controller. |
boolean |
invokeAction(String actionName)
Invokes the action assigned to the given name |
boolean |
isEventsEnabled()
|
void |
stateChanged(ChangeEvent e)
Forwarded from the view when a change event occurs. |
void |
updateComponents(Object src)
Forwards the call to the UIDirector if it is not null |
void |
valueChanged(ListSelectionEvent e)
Forwarded from the view when a list selection event occurs. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JETAController(JETAContainer view)
view
- the view whose events we are handling.Method Detail |
---|
public boolean actionPerformed(String actionName, ActionEvent evt)
actionName
- the name of the action associated with the eventevt
- the action event
method if a component is
found.
public void assignAction(String compName, ActionListener action)
protected void assignComponentAction(Component comp, String commandId, ActionListener action)
public void assignListener(String compName, ListSelectionListener listener)
public void assignListener(String compName, ChangeListener listener)
public void enableEvents(boolean enable)
public ActionListener getPrimaryActionListener()
public ActionListener getAction(String actionName)
public JETAContainer getView()
public boolean invokeAction(String actionName)
public boolean isEventsEnabled()
public void stateChanged(ChangeEvent e)
public void updateComponents(Object src)
public void valueChanged(ListSelectionEvent e)
e
- the list selection event
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |