com.objectwave.appSupport
Class DetailModel
java.lang.Object
|
+--com.objectwave.appArch.EventSupport
|
+--com.objectwave.appArch.WindowModel
|
+--com.objectwave.appSupport.OkCancelModel
|
+--com.objectwave.appSupport.DetailModel
- All Implemented Interfaces:
- java.util.EventListener, PacketListener, PacketProducerIF, PresentationModelIF, java.beans.PropertyChangeListener, WindowModelIF
- public class DetailModel
- extends OkCancelModel
The behavior for a detail frame. - It makes some design decisions that you
may not wish to follow. In that case, just subclass the OkCancelModel for
most of the useful behavior.
Example:
addPresentationModel(new DetailModel("Company", CompanyDetailGUI.class));
InputEvents -
DataRequest("Dispaly)
OutputEvents -
DataRequest("", null) - Should let others fill company
DataAvailable("")
Constructor Summary |
DetailModel()
If you create a detail model using this constructor, it will
behove you to call setWindowClass(Class) and setSubjectClass(String)
prior to really doing anything with this model. |
DetailModel(java.lang.String subjectClass,
java.lang.Class windowClass)
|
DetailModel(java.lang.String subjectClass,
java.lang.Class windowClass,
java.lang.Object[] additionalParams)
The subjectClass is used when analyzing events. |
Method Summary |
void |
displayBusinessObject()
Upon opening, this method is called. |
java.lang.String |
getSubjectClass()
For more information, check out the mutator method. |
boolean |
isAllowingMultipleInstances()
In the event I am using this class directly as a wrapper, I need to allow
multiple instances. |
protected void |
maybeRollback()
If an exception occurred while trying to save, we may have obtained
a packetToForward. |
java.awt.Window |
open()
|
void |
packetAvailable(DataAvailable evt)
|
void |
packetAvailable(DataRequest evt)
Check with security before opening the screen. |
void |
populateBusinessObject()
When a detail screen is closed, we most likely want to populate the
business object. |
void |
setSubject(java.lang.Object obj)
The 'subject' variable will contain the evt.getValue() from the
DataRequest event. |
void |
setSubjectClass(java.lang.String value)
The subject class is the name of the events for which we will claim
our own. |
void |
setWindow(java.awt.Window w)
Allow the window model to clean up before a new instance is created. |
Methods inherited from class com.objectwave.appArch.WindowModel |
addConsumer, addPresentationModel, addProducer, createCache, getDefaultWindowListener, getWindow, isCached, reset, setAllowingMulitpleInstances, setDefaultWindowListener, setWindowClass |
Methods inherited from class com.objectwave.appArch.EventSupport |
addPacketListener, addPropertyChangeListener, fireDataAvailable, fireDataChanged, fireDataRequest, firePacket, firePropertyChange, packetAvailable, propertyChange, removePacketListener, removePropertyChangeListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DetailModel
public DetailModel()
- If you create a detail model using this constructor, it will
behove you to call setWindowClass(Class) and setSubjectClass(String)
prior to really doing anything with this model.
DetailModel
public DetailModel(java.lang.String subjectClass,
java.lang.Class windowClass)
DetailModel
public DetailModel(java.lang.String subjectClass,
java.lang.Class windowClass,
java.lang.Object[] additionalParams)
- The subjectClass is used when analyzing events.
The windowClass is used for creating new instances of the window.
displayBusinessObject
public void displayBusinessObject()
- Upon opening, this method is called.
We most likely have some listening presentation models who also
care about this, so we fire a DataAvailable event. The
is the property name, and the is the our 'subject' variable.
- Specified by:
displayBusinessObject
in class OkCancelModel
getSubjectClass
public java.lang.String getSubjectClass()
- For more information, check out the mutator method.
- Specified by:
getSubjectClass
in class OkCancelModel
- See Also:
setSubjectClass(java.lang.String)
isAllowingMultipleInstances
public boolean isAllowingMultipleInstances()
- In the event I am using this class directly as a wrapper, I need to allow
multiple instances. This is so that multiple screens can use this class
as a wrapper.
- Specified by:
isAllowingMultipleInstances
in interface WindowModelIF
- Overrides:
isAllowingMultipleInstances
in class WindowModel
maybeRollback
protected void maybeRollback()
throws java.lang.Exception
- If an exception occurred while trying to save, we may have obtained
a packetToForward. If this does indeed occur, we must clear out this packet
when we are rolling back values.
- Overrides:
maybeRollback
in class OkCancelModel
java.lang.Exception
open
public java.awt.Window open()
throws java.lang.ClassNotFoundException,
java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.beans.PropertyVetoException
- Overrides:
open
in class WindowModel
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.beans.PropertyVetoException
packetAvailable
public void packetAvailable(DataAvailable evt)
- Specified by:
packetAvailable
in interface PacketListener
- Overrides:
packetAvailable
in class EventSupport
packetAvailable
public void packetAvailable(DataRequest evt)
- Check with security before opening the screen.
If we have a subject, then we are opening a detail screen of that subject.
To enforce readOnly on that screen it is the screen's responsibility.
If subject is null, and you only have read access, we won't allow the
screen to open.
- Specified by:
packetAvailable
in interface PacketListener
- Overrides:
packetAvailable
in class EventSupport
populateBusinessObject
public void populateBusinessObject()
- When a detail screen is closed, we most likely want to populate the
business object. This method is called at that time. Since we most
likely have listening PresentationModel's we fire a DataRequest with
the as the propertyName.
- Specified by:
populateBusinessObject
in class OkCancelModel
setSubject
public void setSubject(java.lang.Object obj)
- The 'subject' variable will contain the evt.getValue() from the
DataRequest event. This is set when a DataRequest event with a
property name of "Display" is sent to this model.
- See Also:
packetAvailable(com.objectwave.event.DataAvailable)
setSubjectClass
public void setSubjectClass(java.lang.String value)
- The subject class is the name of the events for which we will claim
our own. We will watch for a Display to know to open the
screen. A DataAvailable with the property name of will be
forwarded to my listeners when I close. Finally, when we open, we fire
a DataAvailable with the property name of .
- See Also:
displayBusinessObject()
setWindow
public void setWindow(java.awt.Window w)
- Description copied from interface:
WindowModelIF
- Allow the window model to clean up before a new instance is created.
- Specified by:
setWindow
in interface WindowModelIF
- Overrides:
setWindow
in class OkCancelModel