Project MVC architecture
version 0.1 - 010723

lib.gui.mvc
Interface CommandListener

All Known Implementing Classes:
ViewTest

public interface CommandListener

An interface for MVC architectured applications.

Synopsis

CommandListener defines a subset of the Model methods that should be implemented by the application using the MVC structure.
When the Model method of the same name is called by the Contoler instance, the CommandListener member, (the application itself), is called with this method.
The application executes any appropriate function and returns a true diagnostic value to inform the Model that it has handled the command.
If the Model's CommandListener member is null or if it returned a false diagnostic, the Model instance has to handle the command at its own level. the Model may then issue a warning message or execute some default processing.
The model may return a false diagnostic to the Controler so it can propagate the unhandle command to some other processing mecanism.

Version:
2001-07-22
Author:
Ivan Wellesz - ivanw@club-internet.fr

Field Summary
static java.lang.String MESSAGE_CANCEL
          Default cancel Component command.
static java.lang.String MESSAGE_OK
          Default accept Component command.
static java.lang.String NEXT
          Default application next item or view selection Component command.
static int NO_CALLBACK_REASON
          Default cancel return value from a dialog box.
static java.lang.String PREV
          Default application previous item or view selection Component command.
static java.lang.String PRINT
          Default print Component command.
static java.lang.String QUIT
          Default quit Component command.
static java.lang.String START
          Default start Component command.
static java.lang.String STOP
          Default stop Component command.
 
Method Summary
 boolean componentValueChanged(Controler controler, java.awt.Component component)
          Handles a modification of a TextComponent contents.
 boolean parse_command(Controler controler, java.awt.Component src, java.lang.String cmd)
          Parses the user selected action command received by the Model instance.
 boolean parse_TextField(Controler controler, java.awt.TextField textField)
          Handles a validation request from a TextField.
 boolean quit(Controler controler)
          Handles a quit request from a Component holding the default QUIT command.
 

Field Detail

QUIT

public static final java.lang.String QUIT
Default quit Component command.

START

public static final java.lang.String START
Default start Component command.

STOP

public static final java.lang.String STOP
Default stop Component command.

PRINT

public static final java.lang.String PRINT
Default print Component command.

PREV

public static final java.lang.String PREV
Default application previous item or view selection Component command.

NEXT

public static final java.lang.String NEXT
Default application next item or view selection Component command.

MESSAGE_CANCEL

public static final java.lang.String MESSAGE_CANCEL
Default cancel Component command.

MESSAGE_OK

public static final java.lang.String MESSAGE_OK
Default accept Component command.

NO_CALLBACK_REASON

public static final int NO_CALLBACK_REASON
Default cancel return value from a dialog box.
Method Detail

parse_command

public boolean parse_command(Controler controler,
                             java.awt.Component src,
                             java.lang.String cmd)
Parses the user selected action command received by the Model instance.
Parameters:
controler - the controler instance that may be used to access MVC elements
src - the event source Component instance that triggered the event
cmd - the command associated to the source Component instance
Returns:
whether the command has been handled or if it should be further processed by the caller

componentValueChanged

public boolean componentValueChanged(Controler controler,
                                     java.awt.Component component)
Handles a modification of a TextComponent contents.
When some change occured in a TextField or a TextArea, this function is called so that some action can take place to check the validity of the current input.
Parameters:
controler - the controler instance that may be used to access MVC elements
component - the event source Component instance that triggered the event
Returns:
whether the command has been handled or if it should be further processed by the caller

parse_TextField

public boolean parse_TextField(Controler controler,
                               java.awt.TextField textField)
Handles a validation request from a TextField.
The user depressed the Return key in the specified TextField. Some action must take place to handle input.
Parameters:
controler - the controler instance that may be used to access MVC elements
textField - the event source Component instance that triggered the event
Returns:
whether the command has been handled or if it should be further processed by the caller

quit

public boolean quit(Controler controler)
Handles a quit request from a Component holding the default QUIT command.
Parameters:
controler - the controler instance that may be used to access MVC elements
textField - the event source Component instance that triggered the event
Returns:
whether the command has been handled or if it should be further processed by the caller. The default handling will be a call to System.exit( 0 );

MVC architecture

Document Tech Infos - Ivan Wellesz