com.wewebu.ow.server.ui
Class OwEventTarget

java.lang.Object
  extended by com.wewebu.ow.server.ui.OwEventTarget
Direct Known Subclasses:
OwAppContext, OwDocument, OwFieldManager, OwFieldManagerControl, OwMimeManager, OwSettingsPropertyControl, OwToolView.OwToolClickTarget, OwView

public abstract class OwEventTarget
extends Object

EventTarget Base Class. Events are generated through requests and dispatched through the targets.

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


Constructor Summary
OwEventTarget()
           
 
Method Summary
 void attach(OwAppContext context_p, String strName_p)
          attach the event target to the context
 void detach()
          remove target
 void disableRequestListener()
          remove from request listener registry current event target, the target must be already registered as event and request listener.
 void enableRequestListener()
          register the event target to receive onRequest events the target must already be registered
 String getAjaxEventURL(String strEventName_p, String strAdditionalParameters_p)
          get a URL for the requested AJAX event without rendering
 OwAppContext getContext()
          get the context reference
 String getEventURL(String strEventName_p, String strAdditionalParameters_p)
          get a URL for the requested event
 String getFormEventFunction(String strEventName_p, String strAdditionalParameters_p)
          get a script function for the requested event sending the form data defined in the event target with getFormName()
 String getFormEventURL(String strEventName_p, String strAdditionalParameters_p)
          get a URL for the requested event sending the form data defined in the event target with getFormName()
 String getFormName()
          Get the form used for the edit fields.
By default return null, should be overridden by derived classes
 OwEventTarget getFormTarget()
          get the target, that is used for form data and renders form
 String getID()
          get the ID of the target, every target has its unique id, used to dispatch requests among the targets in a context.
protected abstract  void init()
          init the target after the context is set.
 void onExternalRequest(javax.servlet.http.HttpServletRequest request_p, javax.servlet.http.HttpServletResponse response_p)
          overridable to receive request notifications from external sources / links
 void onFormEvent(javax.servlet.http.HttpServletRequest request_p)
          called before a form event is caught.
 boolean onRequest(javax.servlet.http.HttpServletRequest request_p, javax.servlet.http.HttpServletResponse response_p)
          overridable to receive request notifications to receive onRequest, the target must be registered with OwAppContext.registerRequestTarget
 void setExternalFormTarget(OwEventTarget eventtarget_p)
          override the internal form with an external one, must be called BEFORE event target is attached.
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OwEventTarget

public OwEventTarget()
Method Detail

init

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

Throws:
Exception

attach

public void attach(OwAppContext context_p,
                   String strName_p)
            throws Exception
attach the event target to the context

Parameters:
context_p - Application context to attach to
strName_p - Name / ID under which the Target gets registered
Throws:
Exception

enableRequestListener

public void enableRequestListener()
                           throws OwException
register the event target to receive onRequest events the target must already be registered

Throws:
OwException - if registration fails

disableRequestListener

public void disableRequestListener()
                            throws OwException
remove from request listener registry current event target, the target must be already registered as event and request listener.

Throws:
OwException - if de-register fails

getContext

public OwAppContext getContext()
get the context reference

Returns:
OwAppContext Application context

detach

public void detach()
remove target


getID

public String getID()
get the ID of the target, every target has its unique id, used to dispatch requests among the targets in a context.

Returns:
String representing current event target Id

getEventURL

public String getEventURL(String strEventName_p,
                          String strAdditionalParameters_p)
get a URL for the requested event

Parameters:
strEventName_p - Function name to be called upon event fired
strAdditionalParameters_p - additional query string with parameters.
Returns:
String representing the event URL

getAjaxEventURL

public String getAjaxEventURL(String strEventName_p,
                              String strAdditionalParameters_p)
get a URL for the requested AJAX event without rendering

Parameters:
strEventName_p - Function name to be called upon event fired
strAdditionalParameters_p - additional query string with parameters.
Returns:
String representing an AJAX URL

getFormEventURL

public String getFormEventURL(String strEventName_p,
                              String strAdditionalParameters_p)
get a URL for the requested event sending the form data defined in the event target with getFormName()

Parameters:
strEventName_p - Function name to be called upon event fired
strAdditionalParameters_p - additional query string with parameters.
Returns:
String URL for current form

getFormEventFunction

public String getFormEventFunction(String strEventName_p,
                                   String strAdditionalParameters_p)
get a script function for the requested event sending the form data defined in the event target with getFormName()

Parameters:
strEventName_p - Function name to be called upon event fired
strAdditionalParameters_p - additional query string with parameters.
Returns:
String function for form submit

getFormName

public String getFormName()
Get the form used for the edit fields.
By default return null, should be overridden by derived classes

Returns:
String form name, or null if not attached to form

setExternalFormTarget

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

Parameters:
eventtarget_p - OwEventTarget to be used for form data
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

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

onFormEvent

public void onFormEvent(javax.servlet.http.HttpServletRequest request_p)
                 throws Exception
called before a form event is caught. Method gets called before the event handler to inform neighbor controls / views

Parameters:
request_p - HttpServletRequest
Throws:
Exception - if getFormTarget() update call fails

getFormTarget

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

Returns:
OwEventTarget

onRequest

public boolean onRequest(javax.servlet.http.HttpServletRequest request_p,
                         javax.servlet.http.HttpServletResponse response_p)
                  throws Exception
overridable to receive request notifications to receive onRequest, the target must be registered with OwAppContext.registerRequestTarget

Parameters:
request_p - HttpServletRequest
response_p - HttpServletResponse
Returns:
boolean true = continue with request and render, false = request is already finished, return to client
Throws:
Exception

onExternalRequest

public void onExternalRequest(javax.servlet.http.HttpServletRequest request_p,
                              javax.servlet.http.HttpServletResponse response_p)
                       throws Exception
overridable to receive request notifications from external sources / links

Parameters:
request_p - HttpServletRequest
response_p - HttpServletResponse
Throws:
Exception


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.