com.keyoti.creditCard.display
Class ElementController
java.lang.Object
|
+--com.keyoti.creditCard.display.ElementController
- public abstract class ElementController
- extends Object
- implements PropertyChangeListener, Serializable
Abstract base controller class, part of the MVC style 'separable model' design similar to that used by Swing.
Each CardElementPanel, such as
CardNumberPanel has its own sub-class of ElementController that handles property change events from
the model (CreditCard) and the view (any subclass of CardElementPanel).
Note: Custom card element panels don't have to use this as a base class for their controllers, this is just
a convenience class that does some property change event handling and model getting and setting. Custom card elements may
have controller code embedded in alongside the view code if it suits the programmer to do so.
- See Also:
CardElementPanel,
CardNumberPanel, Serialized Form
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
creditCard
protected CreditCard creditCard
- The model object.
view
protected CardElementPanel view
- The view object, this should be set to an object with the CardElementPanel as a base class.
ElementController
public ElementController(CardElementPanel view)
throws NullPointerException
- Construct a new ElementController with a corresponding
view.
- Parameters:
view - CardElementPanel extension class object that this controller is servicing.- Throws:
- NullPointerException - if view is null.
- Preconditions:
view != null
propertyChange
public abstract void propertyChange(PropertyChangeEvent evt)
- Listener method, listens to property changes in the model (CreditCard) and the view (XXXPanel).
Property values are updated in either model or the view as appropriate. This method must be overridden by
sub-classes to provide custom property change handling, to update the view and model appropriately.
- Specified by:
- propertyChange in interface PropertyChangeListener
setCreditCard
public void setCreditCard(CreditCard c)
throws NullPointerException
- Sets the logic layer CreditCard that this interface is viewing. This should be overridden
to update the view if necessary.
- Throws:
- NullPointerException - if c is null.
- Preconditions:
c != null- Postconditions:
getCreditCard() == c AND c is registered as a property change listener- See Also:
CreditCard
getCreditCard
public CreditCard getCreditCard()
- Returns the CreditCard that this interface is viewing.
Copyright © 2002 Keyoti All Rights Reserved.