com.waveset.ui.util
Interface ViewSource

All Known Implementing Classes:
GenericViewSource

public interface ViewSource

The interface of an object that can serve as a "source" for the view and form objects manipulated by an GenericEditForm.

The primary implementation is GenericViewSource.


Method Summary
 WavesetResult checkinView()
          Save the changes made to a view, and release any locks that might be held.
 void clearErrors()
          Clear the error list.
 void clearView()
          Remove the information saved by saveView().
 java.util.List getErrors()
          Get a list of error messages accumulated by the view source.
 Form getForm()
          Return the form for this view.
 java.util.Map getOptions()
          Get all view options.
 GenericObject getView()
          Returns the view.
 boolean hasCachedView()
          Returns true if the view source is currently maintaining a cached view.
 boolean hasValidView()
          Returns true if the view source is still maintaining a valid view.
 boolean isAlwaysRefresh()
           
 void refreshView()
          Refresh the view to reflect changes that may have been made.
 void saveView()
          Save the current contents of the view in such a way that the view can be restored efficiently by a different instance of the view source.
 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 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 setViewId(java.lang.String s)
          Sets the view identifier.
 void unlockView()
          Release any locks that might be held for the current view, but do not check it in.
 

Method Detail

setRequestState

public void setRequestState(RequestState rs)
Sets the request state for this view source.


setViewId

public void setViewId(java.lang.String s)
Sets the view identifier. If this contains a colon, it is assumed to be a full view id and an existing object will be edited. If it does not contain a colon, it is assumed to be a view type name and a new view will be created.


setOption

public void setOption(java.lang.String name,
                      java.lang.Object value)
Set a view option.


getOptions

public java.util.Map getOptions()
Get all view options.


setOptions

public void setOptions(java.util.Map options)
Set all view options.


setAlwaysRefresh

public void setAlwaysRefresh(boolean b)
When true, the view will always be refreshed and will not be cached in the HttpSession.


isAlwaysRefresh

public boolean isAlwaysRefresh()

setSessionAttribute

public 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.


hasCachedView

public boolean hasCachedView()
Returns true if the view source is currently maintaining a cached view. Called after initial view processing to determine if there is still a view that needs to be displayed, but avoids regenerating one if one is not cached.


hasValidView

public boolean hasValidView()
Returns true if the view source is still maintaining a valid view. The view may or may not be cached. This is affected by the "always refresh" option and "newView" command line argument.


getView

public GenericObject getView()
                      throws WavesetException
Returns the view. The view may either represent a new object being created, or an existing object being edited, depending on the settings for create type and view id.

If this is a view of an existing object, the object will normally be locked in the underlying storage manager so you should remember to call unlockView() or checkinView() later.

Throws:
WavesetException

getForm

public Form getForm()
             throws WavesetException
Return the form for this view. This is usually the same as the form stored in the view object, but some custom sources may wish to override the form.

Throws:
WavesetException

refreshView

public void refreshView()
                 throws WavesetException
Refresh the view to reflect changes that may have been made. What this does depends on the view itself. Simple views may do nothing, complex views (like the User view) may perform complex processing like resouce account fetching and form regeneration.

Throws:
WavesetException

checkinView

public WavesetResult checkinView()
                          throws WavesetException
Save the changes made to a view, and release any locks that might be held. This could result in complex processing, the results of that processing are returned in a WavesetResult.

Throws:
WavesetException

unlockView

public void unlockView()
                throws WavesetException
Release any locks that might be held for the current view, but do not check it in. This is typically used when the editing operation is canceled.

Throws:
WavesetException

saveView

public void saveView()
              throws WavesetException
Save the current contents of the view in such a way that the view can be restored efficiently by a different instance of the view source. But do not check it into the underlying storage manager.

Normally, this will serialize the view and store it on the HttpSession. The intent is that getView() can discover this and restore the view without having to use a file or database.

Throws:
WavesetException

clearView

public void clearView()
Remove the information saved by saveView().


getErrors

public java.util.List getErrors()
Get a list of error messages accumulated by the view source. This may be non-null if something serious happened that needs to be displayed, but we recovered and were able to create the view.


clearErrors

public void clearErrors()
Clear the error list.