org.araneaframework.core
Class BaseApplicationWidget

java.lang.Object
  extended by org.araneaframework.core.BaseComponent
      extended by org.araneaframework.core.BaseService
          extended by org.araneaframework.core.BaseWidget
              extended by org.araneaframework.core.BaseApplicationWidget
All Implemented Interfaces:
Serializable, Component, Composite, Composite.CompositeComponent, Composite.CompositeService, Composite.CompositeWidget, ApplicationComponent, ApplicationService, ApplicationWidget, Service, Viewable, Viewable.ViewableComponent, Viewable.ViewableService, Viewable.ViewableWidget, Widget
Direct Known Subclasses:
BaseControl, BaseUIWidget, ContextMenuWidget, DownloaderWidget, GenericFormElement, PopupFlowWidget, PopupFlowWrapperWidget, StandardClassReloadingFilterWidget, StandardFlowContainerWidget, StandardOverlayContainerWidget, TabContainerWidget, TabWidget, TreeNodeWidget

public class BaseApplicationWidget
extends BaseWidget
implements ApplicationWidget

A full featured Widget with support for composite, eventlisteners, viewmodel.

See Also:
Serialized Form

Nested Class Summary
protected  class BaseApplicationWidget.CompositeImpl
           
protected  class BaseApplicationWidget.ViewableImpl
           
 class BaseApplicationWidget.ViewModel
           
 
Nested classes/interfaces inherited from class org.araneaframework.core.BaseWidget
BaseWidget.WidgetImpl
 
Nested classes/interfaces inherited from class org.araneaframework.core.BaseService
BaseService.ServiceImpl
 
Nested classes/interfaces inherited from class org.araneaframework.core.BaseComponent
BaseComponent.ComponentImpl
 
Nested classes/interfaces inherited from interface org.araneaframework.core.ApplicationWidget
ApplicationWidget.WidgetViewModel
 
Nested classes/interfaces inherited from interface org.araneaframework.core.ApplicationService
ApplicationService.ServiceViewModel
 
Nested classes/interfaces inherited from interface org.araneaframework.core.ApplicationComponent
ApplicationComponent.ComponentViewModel
 
Nested classes/interfaces inherited from interface org.araneaframework.Composite
Composite.CompositeComponent, Composite.CompositeService, Composite.CompositeWidget
 
Nested classes/interfaces inherited from interface org.araneaframework.Viewable
Viewable.ViewableComponent, Viewable.ViewableService, Viewable.ViewableWidget
 
Nested classes/interfaces inherited from interface org.araneaframework.Composite
Composite.CompositeComponent, Composite.CompositeService, Composite.CompositeWidget
 
Nested classes/interfaces inherited from interface org.araneaframework.Viewable
Viewable.ViewableComponent, Viewable.ViewableService, Viewable.ViewableWidget
 
Nested classes/interfaces inherited from interface org.araneaframework.Widget
Widget.Interface
 
Nested classes/interfaces inherited from interface org.araneaframework.Composite
Composite.CompositeComponent, Composite.CompositeService, Composite.CompositeWidget
 
Nested classes/interfaces inherited from interface org.araneaframework.Widget
Widget.Interface
 
Nested classes/interfaces inherited from interface org.araneaframework.Viewable
Viewable.ViewableComponent, Viewable.ViewableService, Viewable.ViewableWidget
 
Nested classes/interfaces inherited from interface org.araneaframework.Widget
Widget.Interface
 
Field Summary
 
Fields inherited from class org.araneaframework.core.BaseService
currentInputData, currentOutputData
 
Fields inherited from interface org.araneaframework.core.ApplicationWidget
EVENT_HANDLER_ID_KEY, EVENT_PARAMETER_KEY, EVENT_PATH_KEY
 
Fields inherited from interface org.araneaframework.core.ApplicationService
ACTION_HANDLER_ID_KEY, ACTION_PARAMETER_KEY, ACTION_PATH_KEY
 
Constructor Summary
BaseApplicationWidget()
           
 
Method Summary
 Composite.Interface _getComposite()
          Returns the Composite.Interface internal implementation.
 Viewable.Interface _getViewable()
          Returns the Viewable.Interface internal implementation.
protected  void action(Path path, InputData input, OutputData output)
          If Path.hasNext() routes to the action to child, otherwise calls the appropriate ActionListener.
 void addActionListener(Object actionId, ActionListener listener)
          Adds the ActionListener listener with the specified action id.
 void addEventListener(Object eventId, EventListener listener)
          Adds an EventListener to this Widget with an eventId.
 void addWidget(Object key, Widget child)
          Adds a widget as a child widget with the key.
 void addWidget(Object key, Widget child, Environment env)
          Adds a widget as a child widget with the key.
 void clearActionListeners(Object actionId)
          Clears all the ActionListeners with the specified actionId.
 void clearEventlisteners(Object eventId)
          Clears all the EventListeners from this Widget with the specified eventId.
 void clearGlobalEventListener()
          Clears the global eventlistener of this Widget.
 void disableWidget(Object key)
          Disables the widget with the specified key.
 void enableWidget(Object key)
          Enables the widget with the specified key.
protected  void event(Path path, InputData input)
          If path hasNextStep() routes to the correct child, otherwise calls the appropriate listener.
protected  String getActionId(InputData input)
          Returns the id of the action based on the input.
 Environment getChildEnvironment()
          Get the child Environment of this component.
 Map getChildren()
          Returns all the childcomponents of this component.
protected  Environment getChildWidgetEnvironment()
          Returns the widget's Environment by default.
 Environment getEnvironment()
          Provides access to the Environment of this Component.
protected  String getEventId(InputData input)
          Returns the id of the event in InputData.
 Object getViewModel()
          Returns the view model.
 Widget getWidget(Object key)
          Returns the widget with the specified key.
protected  void handleAction(InputData input, OutputData output)
          Calls the approriate listener
protected  void handleEvent(InputData input)
          Calls the respective listeners.
protected  void handleUpdate(InputData input)
          Callback called when update(InputData) is invoked.
protected  void propagate(Message message)
          Forwards the message to the component and to all of its children components.
 void putViewData(String key, Object customDataItem)
          Adds custom data to the widget view model (${widget.custom['key']}).
 void putViewDataOnce(String key, Object customDataItem)
          Adds custom data to the widget view model (${widget.custom['key']}).
 void removeActionListener(ActionListener listener)
          Removes the ActionListener listener from this component.
 void removeEventListener(EventListener listener)
          Removes the listener from the Widget's eventlisteners.
 void removeViewData(String key)
          Removes the custom data under key.
 void removeWidget(Object key)
          Removes component from the children and calls destroy on it.
protected  void render(OutputData output)
          Renders the component to output, meant for overriding.
 void setGlobalEventListener(EventListener eventListener)
          Adds a global eventlistener to this Widget.
protected  void update(InputData input)
           
 
Methods inherited from class org.araneaframework.core.BaseWidget
_getWidget, getInputData, getOutputData, handleWidgetException
 
Methods inherited from class org.araneaframework.core.BaseService
_getService, handleServiceException
 
Methods inherited from class org.araneaframework.core.BaseComponent
_addComponent, _addComponent, _checkCall, _disableComponent, _enableComponent, _endCall, _endWaitingCall, _getChildren, _getComponent, _getDisabledChildren, _propagate, _relocateComponent, _removeComponent, _setEnvironment, _setScope, _startCall, _startWaitingCall, _strictCheckCall, _strictStartCall, _waitNoCall, destroy, disable, enable, getScope, handleException, init, isAlive, isDead, isInitialized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.araneaframework.Component
_getComponent, getScope, isAlive
 
Methods inherited from interface org.araneaframework.Service
_getService
 
Methods inherited from interface org.araneaframework.Component
_getComponent, getScope, isAlive
 
Methods inherited from interface org.araneaframework.Component
_getComponent, getScope, isAlive
 
Methods inherited from interface org.araneaframework.Service
_getService
 
Methods inherited from interface org.araneaframework.Component
_getComponent, getScope, isAlive
 
Methods inherited from interface org.araneaframework.Component
_getComponent, getScope, isAlive
 
Methods inherited from interface org.araneaframework.Service
_getService
 
Methods inherited from interface org.araneaframework.Component
_getComponent, getScope, isAlive
 
Methods inherited from interface org.araneaframework.Widget
_getWidget
 
Methods inherited from interface org.araneaframework.Component
_getComponent, getScope, isAlive
 
Methods inherited from interface org.araneaframework.Service
_getService
 
Methods inherited from interface org.araneaframework.Component
_getComponent, getScope, isAlive
 
Methods inherited from interface org.araneaframework.Widget
_getWidget
 
Methods inherited from interface org.araneaframework.Service
_getService
 
Methods inherited from interface org.araneaframework.Component
_getComponent, getScope, isAlive
 
Methods inherited from interface org.araneaframework.Component
_getComponent, getScope, isAlive
 
Methods inherited from interface org.araneaframework.Service
_getService
 
Methods inherited from interface org.araneaframework.Component
_getComponent, getScope, isAlive
 
Methods inherited from interface org.araneaframework.Widget
_getWidget
 
Methods inherited from interface org.araneaframework.Service
_getService
 
Methods inherited from interface org.araneaframework.Component
_getComponent, getScope, isAlive
 

Constructor Detail

BaseApplicationWidget

public BaseApplicationWidget()
Method Detail

getChildWidgetEnvironment

protected Environment getChildWidgetEnvironment()
                                         throws Exception
Returns the widget's Environment by default. Usually overridden.

Throws:
Exception

propagate

protected void propagate(Message message)
                  throws Exception
Description copied from class: BaseComponent
Forwards the message to the component and to all of its children components.

Overrides:
propagate in class BaseComponent
Parameters:
message - A message to forward.
Throws:
Exception - Any runtime exception that may occur.

update

protected void update(InputData input)
               throws Exception
Overrides:
update in class BaseWidget
Throws:
Exception

event

protected void event(Path path,
                     InputData input)
              throws Exception
If path hasNextStep() routes to the correct child, otherwise calls the appropriate listener.

Overrides:
event in class BaseWidget
Throws:
Exception

handleUpdate

protected void handleUpdate(InputData input)
                     throws Exception
Callback called when update(InputData) is invoked.

Throws:
Exception

handleEvent

protected void handleEvent(InputData input)
                    throws Exception
Calls the respective listeners.

Throws:
Exception

action

protected void action(Path path,
                      InputData input,
                      OutputData output)
               throws Exception
If Path.hasNext() routes to the action to child, otherwise calls the appropriate ActionListener.

Overrides:
action in class BaseService
Parameters:
path - The path of the component to whom the action is targeted.
input - The request data.
output - The response data.
Throws:
Exception - Any runtime exception that may occur.

handleAction

protected void handleAction(InputData input,
                            OutputData output)
                     throws Exception
Calls the approriate listener

Throws:
Exception

render

protected void render(OutputData output)
               throws Exception
Renders the component to output, meant for overriding.

Overrides:
render in class BaseWidget
Throws:
Exception

getEventId

protected String getEventId(InputData input)
Returns the id of the event in InputData. By default returns EVENT_HANDLER_ID_KEY from the input's global data.


getActionId

protected String getActionId(InputData input)
Returns the id of the action based on the input. Uses the ACTION_HANDLER_ID_KEY key to extract it from InputData's global data.


_getViewable

public Viewable.Interface _getViewable()
Returns the Viewable.Interface internal implementation.

Specified by:
_getViewable in interface Viewable
Returns:
the Viewable.Interface implementation

_getComposite

public Composite.Interface _getComposite()
Returns the Composite.Interface internal implementation.

Specified by:
_getComposite in interface Composite
Returns:
the Composite.Interface implementation

getChildren

public Map getChildren()
Returns all the childcomponents of this component.

Returns:
a map of the childcomponents under this component

getWidget

public Widget getWidget(Object key)
Returns the widget with the specified key.

Parameters:
key - of the child being returned
Returns:
the Widget under the provided key

addWidget

public void addWidget(Object key,
                      Widget child,
                      Environment env)
Adds a widget as a child widget with the key. The child is initialized with the environment provided.

Parameters:
key - of the the child Widget
child - Widget being added
env - the Environment the child will be initialized with

addWidget

public void addWidget(Object key,
                      Widget child)
Adds a widget as a child widget with the key. The child is initialized with the Environment of this Widget

Parameters:
key - of the the child Widget
child - Widget being added

removeWidget

public void removeWidget(Object key)
Removes component from the children and calls destroy on it.

Parameters:
key - of the child being removed

enableWidget

public void enableWidget(Object key)
Enables the widget with the specified key. Only a disabled widgets can be enabled.


disableWidget

public void disableWidget(Object key)
Disables the widget with the specified key. Only a enabled widgets can be disabled.


getEnvironment

public Environment getEnvironment()
Description copied from interface: Component
Provides access to the Environment of this Component.

Specified by:
getEnvironment in interface Component
Overrides:
getEnvironment in class BaseComponent
Returns:
the Environment of the Component.

getChildEnvironment

public final Environment getChildEnvironment()
Description copied from interface: ApplicationComponent
Get the child Environment of this component.

Specified by:
getChildEnvironment in interface ApplicationComponent

setGlobalEventListener

public void setGlobalEventListener(EventListener eventListener)
Adds a global eventlistener to this Widget. A global eventlistener gets all the events.

Parameters:
eventListener - a EventListener added as the global eventlistener.

clearGlobalEventListener

public void clearGlobalEventListener()
Clears the global eventlistener of this Widget.


addEventListener

public void addEventListener(Object eventId,
                             EventListener listener)
Adds an EventListener to this Widget with an eventId. Multiple listeners can be added under one eventId.

Parameters:
eventId - the eventId of the listener
listener - the EventListener being added
See Also:
removeEventListener(org.araneaframework.core.EventListener)

removeEventListener

public void removeEventListener(EventListener listener)
Removes the listener from the Widget's eventlisteners.

Parameters:
listener - the EventListener to remove
See Also:
addEventListener(java.lang.Object, org.araneaframework.core.EventListener)

clearEventlisteners

public void clearEventlisteners(Object eventId)
Clears all the EventListeners from this Widget with the specified eventId.

Parameters:
eventId - the id of the EventListeners.

putViewData

public void putViewData(String key,
                        Object customDataItem)
Adds custom data to the widget view model (${widget.custom['key']}). This data will be available until explicitly removed with removeViewData(String).


removeViewData

public void removeViewData(String key)
Removes the custom data under key.


putViewDataOnce

public void putViewDataOnce(String key,
                            Object customDataItem)
Adds custom data to the widget view model (${widget.custom['key']}). This data will be available during this request only.


getViewModel

public Object getViewModel()
                    throws Exception
Returns the view model. Usually overridden.

Throws:
Exception

addActionListener

public void addActionListener(Object actionId,
                              ActionListener listener)
Adds the ActionListener listener with the specified action id.


removeActionListener

public void removeActionListener(ActionListener listener)
Removes the ActionListener listener from this component.


clearActionListeners

public void clearActionListeners(Object actionId)
Clears all the ActionListeners with the specified actionId.

Parameters:
actionId - the actionId