|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.waveset.ui.util.GenericViewSource
An implementation of ViewSource used to manage arbitrary view objects with the Session interface. This is the default ViewSource used by GenericEditForm.
Before it can be used to create or edit an object, you must initialize it with setViewId().
Field Summary | |
Form |
_form
The edited object's form. |
GenericObject |
_view
The object we're editing. |
static java.lang.String |
code_id
|
static java.lang.String |
DEFAULT_SESSION_ATTRIBUTE
The default name of an attribute on the HttpSession where we hang our editing state. |
static java.lang.String |
NEW_VIEW_PARAMETER
A request paramter that may be set to indicate that the view should be unconditionally cleared. |
static java.lang.String |
OP_FORM
A request option that may be set to specify an alternate form. |
static java.lang.String |
RESULT_CONTINUE
A special WavesetResult item name that may be returnd by the view handler after checkin to indicate that we should continue editing the view, treating the save like a refresh instead. |
static java.lang.String |
VIEW_ID_PARAMETER
A request parameter that may be set to specify the view id. |
static java.lang.String |
VIEW_TYPE_PARAMETER
A request parameter that may be set to specify the view type so that the standard id parameter may be used to build the view id (i.e. |
Constructor Summary | |
GenericViewSource(RequestState state)
|
Method Summary | |
void |
addError(java.lang.Object msg)
Add an error message to the list. |
void |
addErrors(java.util.List msgs)
Add a list of errors. |
WavesetResult |
checkinView()
Checkin the view. |
void |
clearErrors()
Clear the error list. |
void |
clearView()
Removes information about the edit view object stored on the HttpSession after we've successfully applied the changes. |
java.util.List |
getErrors()
Get a list of error messages accumulated by the view source. |
Form |
getForm()
Obtain the Form used with the view. |
java.util.Map |
getOptions()
Get the locally specified options. |
RequestState |
getRequestState()
|
java.lang.String |
getSessionAttribute()
|
GenericObject |
getSessionView()
Restore the view from the HttpSession. |
GenericObject |
getView()
Obtain the view to be edited. |
java.lang.String |
getViewId()
|
boolean |
hasCachedView()
Return true if there is a view being managed. |
boolean |
hasValidView()
Return true if there is a view that will remain valid on the next refresh. |
boolean |
isAlwaysRefresh()
|
boolean |
isReadOnly()
|
void |
refreshView()
Refresh the edit view & form. |
void |
saveView()
Save a new version of the view being edited in the HttpSession. |
void |
setAlwaysRefresh(boolean b)
When true, the view will always be refreshed and will not be cached in the HttpSession. |
void |
setOption(java.lang.String name,
java.lang.Object value)
Set a view option. |
void |
setOptions(java.util.Map options)
Set all view options. |
void |
setReadOnly(boolean b)
|
void |
setRequestState(RequestState rs)
Sets the request state for this view source. |
void |
setSessionAttribute(java.lang.String s)
If this view source saves state on the HttpSession, this is the attribute it should use rather than the default. |
void |
setSessionView(GenericObject view)
Save the view on the HttpSession. |
void |
setViewId(java.lang.String s)
Sets the view identifier. |
void |
unlockView()
Unlock the edit view object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String code_id
public static final java.lang.String NEW_VIEW_PARAMETER
public static final java.lang.String VIEW_ID_PARAMETER
public static final java.lang.String VIEW_TYPE_PARAMETER
public static final java.lang.String OP_FORM
public static final java.lang.String RESULT_CONTINUE
public static final java.lang.String DEFAULT_SESSION_ATTRIBUTE
If you want to have more than one view active at a time, use setSessionAttribute to change the name.
public GenericObject _view
public Form _form
Constructor Detail |
public GenericViewSource(RequestState state)
Method Detail |
public void setViewId(java.lang.String s)
ViewSource
setViewId
in interface ViewSource
public void setSessionAttribute(java.lang.String s)
ViewSource
setSessionAttribute
in interface ViewSource
public void setRequestState(RequestState rs)
ViewSource
setRequestState
in interface ViewSource
public void setReadOnly(boolean b)
public void setAlwaysRefresh(boolean b)
ViewSource
setAlwaysRefresh
in interface ViewSource
public void setOption(java.lang.String name, java.lang.Object value)
ViewSource
setOption
in interface ViewSource
public void setOptions(java.util.Map options)
ViewSource
setOptions
in interface ViewSource
public java.util.Map getOptions()
getOptions
in interface ViewSource
public RequestState getRequestState()
public java.lang.String getViewId()
public java.lang.String getSessionAttribute()
public boolean isReadOnly()
public boolean isAlwaysRefresh()
isAlwaysRefresh
in interface ViewSource
public void clearErrors()
ViewSource
clearErrors
in interface ViewSource
public java.util.List getErrors()
ViewSource
getErrors
in interface ViewSource
public void addError(java.lang.Object msg)
public void addErrors(java.util.List msgs)
public GenericObject getSessionView() throws WavesetException
WavesetException
public void setSessionView(GenericObject view) throws WavesetException
WavesetException
public boolean hasCachedView()
hasCachedView
in interface ViewSource
public boolean hasValidView()
hasValidView
in interface ViewSource
public GenericObject getView() throws WavesetException
If _viewId is not set, we allow a request parameter to specify the view id. If the _viewId contains a colon, it is a full view id and we checkout an existing view. If the _viewId has no colon, it is a simple view type name and we create a new view.
Once the view has been created, we serialize it and store it on the HttpSession. This then carries the state of the edit.
This can be overridden in subclasses in case you want more control over how the views are fetched, or want to post process them after they're fetched.
getView
in interface ViewSource
WavesetException
public Form getForm() throws WavesetException
If OP_FORM is set in checkout options, use it. This allows the .jsp to override the form, I would like this to be the universal method for customizing forms. This also ensures that the same OP_FORM option sent to checkoutView is also used in getForm.
getForm
in interface ViewSource
WavesetException
public void refreshView() throws WavesetException
refreshView
in interface ViewSource
WavesetException
public WavesetResult checkinView() throws WavesetException
checkinView
in interface ViewSource
WavesetException
public void saveView() throws WavesetException
saveView
in interface ViewSource
WavesetException
public void unlockView() throws WavesetException
unlockView
in interface ViewSource
WavesetException
public void clearView()
clearView
in interface ViewSource
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |