Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.scopemvc.view.swing
Class SActionListener  view SActionListener download SActionListener.java

java.lang.Object
  extended byorg.scopemvc.view.swing.SActionListener
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class SActionListener
extends java.lang.Object
implements java.awt.event.ActionListener

Connects component action event to a method in a model.

Let's have button Save and method void saveData() in model object, which should be called, when button is pressed. The connection can be done in following way:

     JButton button = new JButton("Save");
     SActionListener action = new SActionListener();
     action.setModelActionString("saveData");
     button.addActionListener(action);
     ...
     action.setBoundModel(myModel);
 

Version:
$Revision: 1.3 $ $Date: 2002/01/26 09:46:20 $

Field Summary
private static org.apache.commons.logging.Log LOG
           
private  java.lang.Object model
           
private  org.scopemvc.core.ModelAction modelAction
           
 
Constructor Summary
SActionListener()
          Creates new SActionListener
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ev)
          Called by component to notify, that user performed action on the component.
 java.lang.Object getBoundModel()
           
 void setBoundModel(java.lang.Object inModel)
          Sets model object on which the method will be called.
private  void setModelAction(org.scopemvc.core.ModelAction inAction)
           
 void setModelActionString(java.lang.String s)
          Sets name of method to call on model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.commons.logging.Log LOG

model

private java.lang.Object model

modelAction

private org.scopemvc.core.ModelAction modelAction
Constructor Detail

SActionListener

public SActionListener()
Creates new SActionListener

Method Detail

setModelActionString

public final void setModelActionString(java.lang.String s)
Sets name of method to call on model. The name is case sensitive.


setModelAction

private void setModelAction(org.scopemvc.core.ModelAction inAction)

setBoundModel

public final void setBoundModel(java.lang.Object inModel)
Sets model object on which the method will be called.


getBoundModel

public final java.lang.Object getBoundModel()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ev)
Called by component to notify, that user performed action on the component. Specified method is called on the model.

Specified by:
actionPerformed in interface java.awt.event.ActionListener