com.wewebu.ow.server.app
Class OwSearchCriteriaView

java.lang.Object
  extended by com.wewebu.ow.server.ui.OwEventTarget
      extended by com.wewebu.ow.server.ui.OwView
          extended by com.wewebu.ow.server.app.OwSearchCriteriaView
All Implemented Interfaces:
OwFieldProvider, OwBaseView, OwUpdateTarget

public class OwSearchCriteriaView
extends OwView
implements OwFieldProvider

View Module to display and edit search criteria. The View must be enclosed by a form, or you can use the function setFormName to internally create a form in the view.

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 int ERRORS_REGION
          errors region
protected  List m_CriteriaList
          list of the search criteria
protected  Map m_CriteriaMap
          map of criteria for fast access when using a layout
protected  int m_iViewMask
          filters the views to be displayed
protected  String m_strHtmlFormular
          optional HTML form
protected  String m_strJspFormular
          optional JSP form
protected  OwFieldManager m_theFieldManager
          instance of the property field class
static String PLACEHOLDER_ERROR_PREFIX
          start delimiter for the placeholders
static String PLACEHOLDER_INSTRUCTION_PREFIX
          start delimiter for the placeholders
static String PLACEHOLDER_VALIDATION_PREFIX
          start delimiter for the placeholders
static String RUNTIME_PLACEHOLDER_BASE_URL
          placeholder for the server base url
static String RUNTIME_PLACEHOLDER_DESIGN_URL
          placeholder for the server design url
static int VIEW_MASK_RENDER_VERTICAL
          mask value to enable vertical rendering of criteria
 
Fields inherited from class com.wewebu.ow.server.ui.OwView
CURRENT_MODULE_KEY, FORMULAR_PLACEHOLDER_END_DELIMITER, FORMULAR_PLACEHOLDER_START_DELIMITER, m_externalFormEventTarget
 
Fields inherited from interface com.wewebu.ow.server.field.OwFieldProvider
TYPE_AJAX, TYPE_CHECKIN_OBJECT, TYPE_CREATE_OBJECT, TYPE_META_OBJECT, TYPE_RESULT_LIST, TYPE_SEARCH, TYPE_SMALL
 
Fields inherited from interface com.wewebu.ow.server.ui.OwBaseView
EMPTY_STRING
 
Constructor Summary
OwSearchCriteriaView()
           
 
Method Summary
 void detach()
          remove view and all subviews from context
 OwField getField(String strFieldClassName_p)
          implementation for the OwFieldProvider interface
 String getFieldProviderName()
          get a name that identifies the field provider, can be used to create IDs
 Object getFieldProviderSource()
          get the source object that originally provided the fields.
 int getFieldProviderType()
          implementation for the OwFieldProvider interface get the type of field provider as defined with TYPE_...
 Collection getFields()
          get all the properties in the form
 Object getSafeFieldValue(String sName_p, Object defaultvalue_p)
          retrieve the value of a Field
 String getSafeInstruction(OwSearchCriteria searchCriteria_p)
          get a instruction for the criteria
protected  boolean hasViewMask(int iViewMask_p)
          check if view should be displayed or is masked out
protected  void init()
          init the view after the context is set.
 OwSearchCriteria lookupCriteria(String strName_p)
          lookup a criteria by the unique name
 void onRender(Writer w_p)
          render the views of the region
protected  void onRenderHorizontal(Writer w_p)
          render the search template normal without a form
protected  void onRenderVertical(Writer w_p)
          render the search template normal without a form
 boolean onSubmitSearch(javax.servlet.http.HttpServletRequest request_p)
          event called when user submits the form updates the criteria, does the same as updateEditable NOTE: Exceptions are handled and displayed automatically
protected  void renderEditCriteria(Writer w_p, OwSearchCriteria crit_p)
          render a single editable criteria
 void renderNamedRegion(Writer w_p, String strPlaceholder_p)
          Called when the form parser finds a placeholder in the HTML input
protected  void renderPropertyLabel(Writer w_p, OwSearchCriteria criteria_p, String suffix_p)
          Renders a property control label on the given Writer.
The property's read-only status and the value type (array or complex value) are considered at rendering time.
protected  void renderReadOnlyCriteria(Writer w_p, OwSearchCriteria crit_p)
          render a single read only criteria
 void renderRegion(Writer w_p, int region_p)
          render only a region in the view, used by derived classes
 void resetErrors()
          Reset the errors from OwFieldManager object
 void setCriteriaList(List criteriaList_p)
          set list of the search criteria
 void setField(String sName_p, Object value_p)
          modify a Field value, but does not save the value right away
 void setFieldProvider(OwFieldProvider fieldProvider_p)
          set an interface to a field provider interface the field provider interface can be used by the fields to reference other fields.
 void setHTMLFormular(String strFormular_p)
          set the optional HTML form to use in the render method
 void setJspFormular(String strJspUrl_p)
          set the optional JSP form to use in the render method

In the JSP Form you can use the following statements to display and manipulate Properties

// get a reference to the calling view
OwView m_View = (OwView)request.getAttribute(OwView.CURRENT_MODULE_KEY);

<% m_View.renderNamedRegion(out,); %> : renders the Property FieldName
<% m_View.renderNamedRegion(out,ow_err_); %> : renders any validation error messages for the Property FieldName
<% m_View.renderNamedRegion(out,ow_inst_); %> : renders the Property FieldName always read-only
<% m_View.renderNamedRegion(out,ow_menu); %> : renders a function menu to save changes


You can also cast the m_View to OwFieldProvider to retrieve a OwField instance and manipulate or program a field directly.
 void setViewMask(int iViewMask_p)
          determine the views to be displayed by masking them with their flag
 boolean updateExternalFormTarget(javax.servlet.http.HttpServletRequest request_p, boolean fSave_p)
          update the target after a form event, so it can set its form fields
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.OwView
activate, addView, getBreadcrumbPart, getDocument, getExternalFormEventTarget, getFormName, getFormTarget, getIcon, getIterator, getMaximizeView, getParent, getRenderedNamedRegion, getRenderedRegion, getTitle, getViewList, isFormTargetExternal, isNamedRegion, isRegion, isShowMaximized, isShowMinimized, isShowNormal, onActivate, onUpdate, render, renderHTMLFormular, serverSideDesignInclude, serverSideInclude, setDocument, setExternalFormTarget, setMaximizeView, setParent, showMaximized, showMinimized, showNormal
 
Methods inherited from class com.wewebu.ow.server.ui.OwEventTarget
attach, disableRequestListener, enableRequestListener, getAjaxEventURL, getContext, getEventURL, getFormEventFunction, getFormEventURL, getID, onExternalRequest, onFormEvent, onRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VIEW_MASK_RENDER_VERTICAL

public static final int VIEW_MASK_RENDER_VERTICAL
mask value to enable vertical rendering of criteria

See Also:
Constant Field Values

RUNTIME_PLACEHOLDER_BASE_URL

public static final String RUNTIME_PLACEHOLDER_BASE_URL
placeholder for the server base url

See Also:
Constant Field Values

RUNTIME_PLACEHOLDER_DESIGN_URL

public static final String RUNTIME_PLACEHOLDER_DESIGN_URL
placeholder for the server design url

See Also:
Constant Field Values

PLACEHOLDER_ERROR_PREFIX

public static final String PLACEHOLDER_ERROR_PREFIX
start delimiter for the placeholders

See Also:
Constant Field Values

PLACEHOLDER_INSTRUCTION_PREFIX

public static final String PLACEHOLDER_INSTRUCTION_PREFIX
start delimiter for the placeholders

See Also:
Constant Field Values

PLACEHOLDER_VALIDATION_PREFIX

public static final String PLACEHOLDER_VALIDATION_PREFIX
start delimiter for the placeholders

See Also:
Constant Field Values

ERRORS_REGION

public static final int ERRORS_REGION
errors region

See Also:
Constant Field Values

m_theFieldManager

protected OwFieldManager m_theFieldManager
instance of the property field class


m_CriteriaList

protected List m_CriteriaList
list of the search criteria


m_strHtmlFormular

protected String m_strHtmlFormular
optional HTML form


m_strJspFormular

protected String m_strJspFormular
optional JSP form


m_CriteriaMap

protected Map m_CriteriaMap
map of criteria for fast access when using a layout


m_iViewMask

protected int m_iViewMask
filters the views to be displayed

Constructor Detail

OwSearchCriteriaView

public OwSearchCriteriaView()
Method Detail

setViewMask

public void setViewMask(int iViewMask_p)
determine the views to be displayed by masking them with their flag

Parameters:
iViewMask_p - bitmask according to VIEW_MASK_... flags

hasViewMask

protected boolean hasViewMask(int iViewMask_p)
check if view should be displayed or is masked out

Parameters:
iViewMask_p - bitmask according to VIEW_MASK_... flags

init

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

Overrides:
init in class OwView
Throws:
Exception

getField

public OwField getField(String strFieldClassName_p)
                 throws Exception
implementation for the OwFieldProvider interface

Specified by:
getField in interface OwFieldProvider
Parameters:
strFieldClassName_p - String class name of requested fields
Returns:
OwField or throws OwObjectNotFoundException
Throws:
Exception

getFieldProviderSource

public Object getFieldProviderSource()
get the source object that originally provided the fields. e.g. the fieldprovider might be a template pattern implementation like a view, where the original provider would still be an OwObject

Specified by:
getFieldProviderSource in interface OwFieldProvider
Returns:
Object the original source object where the fields have been taken, can be a this pointer

getFieldProviderType

public int getFieldProviderType()
implementation for the OwFieldProvider interface get the type of field provider as defined with TYPE_...

Specified by:
getFieldProviderType in interface OwFieldProvider

detach

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

Overrides:
detach in class OwView

setFieldProvider

public void setFieldProvider(OwFieldProvider fieldProvider_p)
set an interface to a field provider interface the field provider interface can be used by the fields to reference other fields. setting the field provider is optional

Parameters:
fieldProvider_p - OwFieldProvider interface

setCriteriaList

public void setCriteriaList(List criteriaList_p)
set list of the search criteria

Parameters:
criteriaList_p - List with OwSearchCriteria to be edited in the view

setHTMLFormular

public void setHTMLFormular(String strFormular_p)
set the optional HTML form to use in the render method

Parameters:
strFormular_p - String optional HTML layout

setJspFormular

public void setJspFormular(String strJspUrl_p)
set the optional JSP form to use in the render method

In the JSP Form you can use the following statements to display and manipulate Properties

// get a reference to the calling view
OwView m_View = (OwView)request.getAttribute(OwView.CURRENT_MODULE_KEY);

<% m_View.renderNamedRegion(out,); %> : renders the Property FieldName
<% m_View.renderNamedRegion(out,ow_err_); %> : renders any validation error messages for the Property FieldName
<% m_View.renderNamedRegion(out,ow_inst_); %> : renders the Property FieldName always read-only
<% m_View.renderNamedRegion(out,ow_menu); %> : renders a function menu to save changes


You can also cast the m_View to OwFieldProvider to retrieve a OwField instance and manipulate or program a field directly.

Parameters:
strJspUrl_p - String optional HTML layout

lookupCriteria

public OwSearchCriteria lookupCriteria(String strName_p)
                                throws Exception
lookup a criteria by the unique name

Parameters:
strName_p -
Throws:
Exception

renderNamedRegion

public void renderNamedRegion(Writer w_p,
                              String strPlaceholder_p)
                       throws Exception
Called when the form parser finds a placeholder in the HTML input

Specified by:
renderNamedRegion in interface OwBaseView
Overrides:
renderNamedRegion in class OwView
Parameters:
strPlaceholder_p - the placeholder string found
w_p - Writer object, write to replace placeholder
Throws:
Exception

onRender

public void onRender(Writer w_p)
              throws Exception
render the views of the region

Overrides:
onRender in class OwView
Parameters:
w_p - Writer object to write HTML to
Throws:
Exception

renderRegion

public void renderRegion(Writer w_p,
                         int region_p)
                  throws Exception
Description copied from class: OwView
render only a region in the view, used by derived classes

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

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

Overrides:
usesFormWithAttributes in class OwView
Returns:
String with form attributes, or null if view does not render a form

getSafeInstruction

public String getSafeInstruction(OwSearchCriteria searchCriteria_p)
                          throws Exception
get a instruction for the criteria

Parameters:
searchCriteria_p - OwSearchCriteria
Returns:
String instruction or empty String
Throws:
Exception

renderPropertyLabel

protected void renderPropertyLabel(Writer w_p,
                                   OwSearchCriteria criteria_p,
                                   String suffix_p)
                            throws Exception
Renders a property control label on the given Writer.
The property's read-only status and the value type (array or complex value) are considered at rendering time.

Parameters:
w_p -
criteria_p -
suffix_p -
Throws:
Exception
Since:
3.0.0.0`

onRenderHorizontal

protected void onRenderHorizontal(Writer w_p)
                           throws Exception
render the search template normal without a form

Parameters:
w_p - Writer object, write to replace placeholder
Throws:
Exception

onRenderVertical

protected void onRenderVertical(Writer w_p)
                         throws Exception
render the search template normal without a form

Parameters:
w_p - Writer object, write to replace placeholder
Throws:
Exception

renderEditCriteria

protected void renderEditCriteria(Writer w_p,
                                  OwSearchCriteria crit_p)
                           throws Exception
render a single editable criteria

Parameters:
w_p -
crit_p -
Throws:
Exception

renderReadOnlyCriteria

protected void renderReadOnlyCriteria(Writer w_p,
                                      OwSearchCriteria crit_p)
                               throws Exception
render a single read only criteria

Parameters:
w_p -
crit_p -
Throws:
Exception

onSubmitSearch

public boolean onSubmitSearch(javax.servlet.http.HttpServletRequest request_p)
                       throws Exception
event called when user submits the form updates the criteria, does the same as updateEditable NOTE: Exceptions are handled and displayed automatically

Parameters:
request_p - HttpServletRequest
Returns:
true on success, false if errors occurred
Throws:
Exception

updateExternalFormTarget

public boolean updateExternalFormTarget(javax.servlet.http.HttpServletRequest request_p,
                                        boolean fSave_p)
                                 throws Exception
update the target after a form event, so it can set its form fields

Overrides:
updateExternalFormTarget in class OwEventTarget
Parameters:
request_p - HttpServletRequest
fSave_p - boolean true = save the changes of the form data, false = just update the form data, but do not save
Returns:
true = field data was valid, false = field data was invalid
Throws:
Exception

getFieldProviderName

public String getFieldProviderName()
get a name that identifies the field provider, can be used to create IDs

Specified by:
getFieldProviderName in interface OwFieldProvider
Returns:
String unique ID / Name of fieldprovider

setField

public void setField(String sName_p,
                     Object value_p)
              throws Exception,
                     OwObjectNotFoundException
modify a Field value, but does not save the value right away

Specified by:
setField in interface OwFieldProvider
Parameters:
sName_p -
value_p -
Throws:
Exception
OwObjectNotFoundException

getSafeFieldValue

public Object getSafeFieldValue(String sName_p,
                                Object defaultvalue_p)
retrieve the value of a Field

Specified by:
getSafeFieldValue in interface OwFieldProvider
Parameters:
sName_p -
defaultvalue_p -
Returns:
Object the value of the Field of defaultvalue_p

getFields

public Collection getFields()
                     throws Exception
get all the properties in the form

Specified by:
getFields in interface OwFieldProvider
Returns:
Collection of OwField
Throws:
Exception

resetErrors

public void resetErrors()
Reset the errors from OwFieldManager object

Since:
3.0.0.0


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.