com.wewebu.ow.server.ui
Class OwView

java.lang.Object
  extended by com.wewebu.ow.server.ui.OwEventTarget
      extended by com.wewebu.ow.server.ui.OwView
All Implemented Interfaces:
OwBaseView, OwUpdateTarget
Direct Known Subclasses:
OwClipboardView, OwConfiguration.OwErrorView, OwDelegateView, OwDialogManager, OwImageButtonView, OwLaunchableWorkflowSelectionView, OwLayout, OwMasterView, OwMultipanelAccessRightsView, OwNavigationView, OwObjectAccessRightsView, OwObjectClassPreviewView, OwObjectFiledRecordsView, OwObjectListView, OwObjectPropertyFormularView, OwPolicyLevelView, OwPrivilegeSetEditor, OwPrivilegesView, OwSearchCriteriaView, OwToolView, OwTreeView, OwUISubModul

public abstract class OwView
extends OwEventTarget
implements OwBaseView, OwUpdateTarget

View Class, which supports Document View Pattern and acts as an Event Target.

Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.

For licensing information read the license.txt file or
go to: http://wiki.alfresco.com


Field Summary
static String CURRENT_MODULE_KEY
          request key for to reference the current module in a JSP redirect
static String FORMULAR_PLACEHOLDER_END_DELIMITER
          end delimiter for the formular placeholders, used in onRenderHTMLFormular.
static String FORMULAR_PLACEHOLDER_START_DELIMITER
          start delimiter for the formular placeholders, used in onRenderHTMLFormular.
protected  OwEventTarget m_externalFormEventTarget
          external form view overrides internal form
 
Fields inherited from interface com.wewebu.ow.server.ui.OwBaseView
EMPTY_STRING
 
Constructor Summary
OwView()
           
 
Method Summary
 void activate()
          activate this view, i.e.
 void addView(OwView view_p, String strName_p)
          add a view and initialize it
 void detach()
          remove view and all subviews from context
 String getBreadcrumbPart()
          This method is used to create a "Breadcrumb" navigation view.
 OwDocument getDocument()
          gets the reference to the document
 OwEventTarget getExternalFormEventTarget()
          the external form target if set
 String getFormName()
          get the form used for the template edit fields Returns the internal render form or the external one if you called setFormName.
 OwEventTarget getFormTarget()
          get the target, that is used for form date and renders form
 String getIcon()
          get the icon URL for this view to be displayed
 Iterator getIterator()
          get a iterator object for the child views
protected  OwView getMaximizeView()
          overridable function to retrieve the view that is shown maximized if any
 OwView getParent()
          the parent view of this view or null if the top view
 String getRenderedNamedRegion(String strRegion_p)
          render the region and return a result String useful function when rendering regions and need the HTML in other functions
 String getRenderedRegion(int iRegion_p)
          render the region and return a result String useful function when rendering regions and need the HTML in other functions
 String getTitle()
          overridable title of the view
 List getViewList()
          get the list of views
protected  void init()
          init the target after the context is set.
 boolean isFormTargetExternal()
          check if the form target is external
 boolean isNamedRegion(String strRegion_p)
          determine if region exists
 boolean isRegion(int iRegion_p)
          determine if region exists
 boolean isShowMaximized()
          checks if the view is shown maximized
 boolean isShowMinimized()
          checks if the view is shown minimized
 boolean isShowNormal()
          checks if the view is shown normal
protected  void onActivate(int iIndex_p, Object oReason_p)
          activate the target from a navigation module.
protected  void onRender(Writer w_p)
          called when the view should create its HTML content to be displayed
 void onUpdate(OwEventTarget caller_p, int iCode_p, Object param_p)
          called by the framework to update the view when OwDocument.Update was called NOTE: We can not use the onRender method to update, because we do not know the call order of onRender.
 void render(Writer w_p)
          render the view and all contained views.
protected  void renderHTMLFormular(Writer w_p, String strHTMLFormular_p)
          generic function, which can render HTML forms.
 void renderNamedRegion(Writer w_p, String strRegion_p)
          render only a region in the view, used by derived classes
 void renderRegion(Writer w_p, int iRegion_p)
          render only a region in the view, used by derived classes
 void serverSideDesignInclude(String path_p, Writer w_p)
          Include the specified URL writing its output to the current Writer object.
 void serverSideInclude(String path_p, Writer w_p)
          Include the specified URL writing its output to the current Writer object.
 void setDocument(OwDocument doc_p)
          Sets the reference to the document.
 void setExternalFormTarget(OwEventTarget eventtarget_p)
          override the internal OwEditable with an external one, must be called BEFORE view is attached.
protected  void setMaximizeView(OwView view_p)
          overridable function to set a view as a maximized view, i.e.
protected  void setParent(OwView parent_p)
          set the parent to this view
 void showMaximized()
          maximize the view
 void showMinimized()
          minimize the view
 void showNormal()
          show the view normal
protected  String usesFormWithAttributes()
          to get additional form attributes used for the form override if your view needs a form.
 
Methods inherited from class com.wewebu.ow.server.ui.OwEventTarget
attach, disableRequestListener, enableRequestListener, getAjaxEventURL, getContext, getEventURL, getFormEventFunction, getFormEventURL, getID, onExternalRequest, onFormEvent, onRequest, updateExternalFormTarget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CURRENT_MODULE_KEY

public static final String CURRENT_MODULE_KEY
request key for to reference the current module in a JSP redirect

See Also:
Constant Field Values

FORMULAR_PLACEHOLDER_START_DELIMITER

public static final String FORMULAR_PLACEHOLDER_START_DELIMITER
start delimiter for the formular placeholders, used in onRenderHTMLFormular.

See Also:
Constant Field Values

FORMULAR_PLACEHOLDER_END_DELIMITER

public static final String FORMULAR_PLACEHOLDER_END_DELIMITER
end delimiter for the formular placeholders, used in onRenderHTMLFormular.

See Also:
Constant Field Values

m_externalFormEventTarget

protected OwEventTarget m_externalFormEventTarget
external form view overrides internal form

Constructor Detail

OwView

public OwView()
Method Detail

getIcon

public String getIcon()
               throws Exception
get the icon URL for this view to be displayed

Returns:
String icon URL, or null if not defined
Throws:
Exception

getIterator

public Iterator getIterator()
get a iterator object for the child views

Returns:
iterator for the child views

getViewList

public List getViewList()
get the list of views


getTitle

public String getTitle()
overridable title of the view

Specified by:
getTitle in interface OwBaseView
Returns:
String localized display name for the view

setParent

protected void setParent(OwView parent_p)
set the parent to this view

Parameters:
parent_p - Parent view

getParent

public OwView getParent()
the parent view of this view or null if the top view

Returns:
the parent view of this view

setMaximizeView

protected void setMaximizeView(OwView view_p)
overridable function to set a view as a maximized view, i.e. the submitted view should be drawn maximized.

Parameters:
view_p - OwView that requests to be shown maximized

getMaximizeView

protected OwView getMaximizeView()
overridable function to retrieve the view that is shown maximized if any

Returns:
view_p OwView that is shown maximized, null otherwise

showMaximized

public void showMaximized()
maximize the view


showMinimized

public void showMinimized()
minimize the view


showNormal

public void showNormal()
show the view normal


isShowMaximized

public boolean isShowMaximized()
checks if the view is shown maximized

Returns:
true, if view is maximized, false otherwise

isShowMinimized

public boolean isShowMinimized()
checks if the view is shown minimized

Returns:
true, if view is maximized, false otherwise

isShowNormal

public boolean isShowNormal()
checks if the view is shown normal

Returns:
true, if view is maximized, false otherwise

onUpdate

public void onUpdate(OwEventTarget caller_p,
                     int iCode_p,
                     Object param_p)
              throws Exception
Description copied from interface: OwUpdateTarget
called by the framework to update the view when OwDocument.Update was called NOTE: We can not use the onRender method to update, because we do not know the call order of onRender. onUpdate is always called before all onRender methods.

Specified by:
onUpdate in interface OwUpdateTarget
Parameters:
caller_p - OwEventTarget target that called update
iCode_p - int optional reason code
param_p - Object optional parameter representing the refresh, depends on the value of iCode_p, can be null
Throws:
Exception

activate

public void activate()
              throws Exception
activate this view, i.e. make it visible by navigating to it and all its parents

Throws:
Exception

addView

public void addView(OwView view_p,
                    String strName_p)
             throws Exception
add a view and initialize it

Parameters:
view_p - View to add
strName_p - Name / ID of the view, can be null
Throws:
Exception

setDocument

public void setDocument(OwDocument doc_p)
Sets the reference to the document.

For safety reasons, the OwDocument object can be set only once for a view.

Parameters:
doc_p - OwDocument instance to attach to.

detach

public void detach()
remove view and all subviews from context

Overrides:
detach in class OwEventTarget

getDocument

public OwDocument getDocument()
gets the reference to the document

Returns:
document instance

render

public final void render(Writer w_p)
                  throws Exception
render the view and all contained views. This function is always called in advance to onRender. It is used to do special work around rendering, e.g. set flags. NOTE: Do not inherit this function, nor create HTML code here, this should be done with onRender.

Specified by:
render in interface OwBaseView
Parameters:
w_p - Writer object to write HTML to
Throws:
Exception

onRender

protected void onRender(Writer w_p)
                 throws Exception
called when the view should create its HTML content to be displayed

Parameters:
w_p - Writer object to write HTML to
Throws:
Exception

renderRegion

public void renderRegion(Writer w_p,
                         int iRegion_p)
                  throws Exception
render only a region in the view, used by derived classes

Specified by:
renderRegion in interface OwBaseView
Parameters:
w_p - Writer object to write HTML to
iRegion_p - ID of the region to render
Throws:
Exception

getRenderedRegion

public String getRenderedRegion(int iRegion_p)
                         throws Exception
render the region and return a result String useful function when rendering regions and need the HTML in other functions

Parameters:
iRegion_p - ID of the region to render
Returns:
String with regions HTML
Throws:
Exception

isRegion

public boolean isRegion(int iRegion_p)
                 throws Exception
determine if region exists

Specified by:
isRegion in interface OwBaseView
Parameters:
iRegion_p - ID of the region to render
Returns:
true if region contains anything and should be rendered
Throws:
Exception

isNamedRegion

public boolean isNamedRegion(String strRegion_p)
                      throws Exception
determine if region exists

Specified by:
isNamedRegion in interface OwBaseView
Parameters:
strRegion_p - name of the region to render
Returns:
true if region contains anything and should be rendered
Throws:
Exception

init

protected void init()
             throws Exception
init the target after the context is set.

Specified by:
init in class OwEventTarget
Throws:
Exception

onActivate

protected void onActivate(int iIndex_p,
                          Object oReason_p)
                   throws Exception
activate the target from a navigation module. Called when menu item was pressed for this target.

Parameters:
iIndex_p - int tab iIndex of Navigation
oReason_p - User Object which was submitted when target was attached to the navigation module
Throws:
Exception

serverSideInclude

public void serverSideInclude(String path_p,
                              Writer w_p)
                       throws Exception
Include the specified URL writing its output to the current Writer object. The view reference is set in the Request Attribute CURRENT_MODULE_KEY, to access the View in the JSP page. This function can be called from the render method

Parameters:
path_p - - The path to the URL to include.
w_p - - The Writer which will be flushed prior to the include.
Throws:
Exception

serverSideDesignInclude

public void serverSideDesignInclude(String path_p,
                                    Writer w_p)
                             throws Exception
Include the specified URL writing its output to the current Writer object. Appends the current design directory to the JSP path The view reference is set in the Request Attribute CURRENT_MODULE_KEY, to access the View in the JSP page. This function can be called from the render method

Parameters:
path_p - - The path to the URL to include. (should not start with slash "/")
w_p - - The Writer which will be flushed prior to the include.
Throws:
Exception

renderHTMLFormular

protected void renderHTMLFormular(Writer w_p,
                                  String strHTMLFormular_p)
                           throws Exception
generic function, which can render HTML forms. Upon each occurrence of a placeholder (defined as {#...#}) it calls the onRenderFormularPlaceholder function.

Parameters:
w_p - Writer object to write HTML to
strHTMLFormular_p - String HTML Formular with {#...#} placeholders
Throws:
Exception

renderNamedRegion

public void renderNamedRegion(Writer w_p,
                              String strRegion_p)
                       throws Exception
render only a region in the view, used by derived classes

Specified by:
renderNamedRegion in interface OwBaseView
Parameters:
w_p - Writer object to write HTML to
strRegion_p - named region to render
Throws:
Exception

getRenderedNamedRegion

public String getRenderedNamedRegion(String strRegion_p)
                              throws Exception
render the region and return a result String useful function when rendering regions and need the HTML in other functions

Parameters:
strRegion_p - name of the region to render
Returns:
String with regions HTML
Throws:
Exception

isFormTargetExternal

public boolean isFormTargetExternal()
check if the form target is external

Returns:
boolean true if the form target is external

getFormTarget

public OwEventTarget getFormTarget()
get the target, that is used for form date and renders form

Overrides:
getFormTarget in class OwEventTarget
Returns:
OwEventTarget

setExternalFormTarget

public void setExternalFormTarget(OwEventTarget eventtarget_p)
                           throws Exception
override the internal OwEditable with an external one, must be called BEFORE view is attached.
NOTE: By default, view will render its own form, unless you call setEditable When setting an external OwEditable, the view will not render a own form, but use the form name of the given OwEditable. ==> Several form views can update each other.

Overrides:
setExternalFormTarget in class OwEventTarget
Parameters:
eventtarget_p - OwEventTarget to be used, replaces the internal OwEditable
Throws:
Exception

getExternalFormEventTarget

public OwEventTarget getExternalFormEventTarget()
the external form target if set

Returns:
an OwEventTarget
See Also:
setExternalFormTarget(OwEventTarget)

usesFormWithAttributes

protected String usesFormWithAttributes()
to get additional form attributes used for the form override if your view needs a form. Base class will then render a form automatically

Returns:
String with form attributes, or null if view does not render a form

getFormName

public String getFormName()
get the form used for the template edit fields Returns the internal render form or the external one if you called setFormName.

Overrides:
getFormName in class OwEventTarget
Returns:
String form name

getBreadcrumbPart

public String getBreadcrumbPart()
Description copied from interface: OwBaseView
This method is used to create a "Breadcrumb" navigation view. The view is just attaching it's known title/name to the part which is returned from it child.

Example: We have a View A which contains a View B which has a many views contained.

      A.getBreadcrumbPart()
      {
          return this.getTitle() + " - " + B.getBreadcrumbPart();
      }
      B.getBreadcrumbPart()
      {
          return this.getName() + " - " + getMainView().getBreadcrumbPart();
      }
 

So every view is just returning the part of the navigation which is known in it's context. This method should not return null at least the OwBaseView.EMPTY_STRING should be returned.

Specified by:
getBreadcrumbPart in interface OwBaseView
Returns:
String representing the current bread crumb part


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.