org.odlabs.wiquery.ui.accordion
Class Accordion

java.lang.Object
  extended by org.apache.wicket.Component
      extended by org.apache.wicket.MarkupContainer
          extended by org.apache.wicket.markup.html.WebMarkupContainer
              extended by org.odlabs.wiquery.ui.accordion.Accordion
All Implemented Interfaces:
Serializable, Iterable<org.apache.wicket.Component>, org.apache.wicket.event.IEventSink, org.apache.wicket.event.IEventSource, org.apache.wicket.IClusterable, org.apache.wicket.IConverterLocator, org.apache.wicket.markup.html.IHeaderContributor, org.apache.wicket.request.component.IRequestableComponent, org.apache.wicket.util.IHierarchical<org.apache.wicket.Component>, IWiQueryPlugin

public class Accordion
extends org.apache.wicket.markup.html.WebMarkupContainer
implements IWiQueryPlugin

$Id$

Creates an accordion UI component from this WebMarkupContainer's HTML markup.

Since:
0.6
Author:
Lionel Armanet
See Also:
Serialized Form

Nested Class Summary
static class Accordion.AccordionTriggerEvent
          $Id$
 
Field Summary
 
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER
 
Constructor Summary
Accordion(String id)
           
 
Method Summary
 void activate(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget, int index)
          Method to destroy the accordion within the ajax request
 JsStatement activate(int index)
          Method to activate a content part of the Accordion programmatically.
 JsStatement destroy()
          Method to destroy the accordion This will return the element back to its pre-init state.
 void destroy(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to destroy the accordion within the ajax request
protected  void detachModel()
           
 JsStatement disable()
          Method to disable the accordion
 void disable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to disable the accordion within the ajax request
 JsStatement enable()
          Method to enable the accordion
 void enable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to enable the accordion within the ajax request
 AccordionActive getActive()
           
 AccordionAnimated getAnimated()
           
 AccordionAnimated getAnimationEffect()
          Deprecated. will be removed in 1.2
 Accordion.AccordionTriggerEvent getEvent()
          Returns the Accordion.AccordionTriggerEvent.
 AccordionHeader getHeader()
           
 AccordionIcon getIcons()
           
 Options getOptions()
          Method retrieving the options of the component
 Accordion.AccordionTriggerEvent getTriggerEvent()
          Deprecated. will be removed in 1.2
 Accordion hideIcons()
          Allows to hide the icons.
 boolean isAutoHeight()
          Returns true if this accordion is auto height.
 boolean isClearStyle()
           
 boolean isCollapsible()
           
 boolean isDisabled()
           
 boolean isFillSpace()
          Returns if this accordion fill space.
 boolean isNavigation()
           
 void renderHead(org.apache.wicket.markup.html.IHeaderResponse response)
           
 Accordion setActive(AccordionActive active)
          Selector for the active element.
 Accordion setAnimated(AccordionAnimated animationEffect)
          Sets the effect to apply when the accordion's content is switched.
 Accordion setAnimationEffect(AccordionAnimated animationEffect)
          Deprecated. will be removed in 1.2
 Accordion setAutoHeight(boolean autoHeight)
          Sets if the accordion's height is fixed to the highest content part.
 Accordion setChangeEvent(JsScopeUiEvent change)
          Set's the callback when the accordion changes.
 Accordion setChangeStartEvent(JsScopeUiEvent changestart)
          Set's the callback when the accordion starts to change.
 Accordion setClearStyle(boolean clearStyle)
          If set, clears height and overflow styles after finishing animations.
 Accordion setCollapsible(boolean collapsible)
          Whether all the sections can be closed at once.
 Accordion setDisabled(boolean disabled)
          Disables (true) or enables (false) the accordion.
 Accordion setEvent(Accordion.AccordionTriggerEvent accordionTriggerEvent)
          Sets the Accordion.AccordionTriggerEvent to use to open content.
 Accordion setFillSpace(boolean fillSpace)
          Makes this accordion's height to the maximum size possible in this' parent container.
 Accordion setHeader(AccordionHeader header)
          Sets the CSS selector used to defined a header in this accordion.
 Accordion setIcons(AccordionIcon icons)
          Icons to use for headers.
 Accordion setIcons(UiIcon header, UiIcon headerSelected)
          Icons to use for headers.
 Accordion setNavigation(boolean navigation)
          If set, looks for the anchor that matches location.href and activates it.
 Accordion setNavigationFilter(JsScope navigationFilter)
          Overwrite the default location.href-matching with your own matcher.
 Accordion setTriggerEvent(Accordion.AccordionTriggerEvent accordionTriggerEvent)
          Deprecated. will be removed in 1.2
 JsStatement statement()
          Returns the main JsStatement used to create the plugin.
 JsStatement widget()
          Method to returns the .ui-accordion element
 void widget(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
          Method to returns the .ui-accordion element within the ajax request
 
Methods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebPage, getWebRequest
 
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, hasAssociatedMarkup, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onComponentTagBody, onMarkupAttached, onRender, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, toString, visitChildren, visitChildren, visitChildren, visitChildren
 
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, canCallListenerInterface, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, configure, continueToOriginalDestination, debug, detach, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessage, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getSizeInBytes, getStatelessHint, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalOnModelChanged, internalPrepareForRender, internalRenderComponent, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, locateMarkupStream, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onAfterRender, onBeforeRender, onComponentTag, onConfigure, onDetach, onEvent, onInitialize, onModelChanged, onModelChanging, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Accordion

public Accordion(String id)
Method Detail

detachModel

protected void detachModel()
Overrides:
detachModel in class org.apache.wicket.Component

renderHead

public void renderHead(org.apache.wicket.markup.html.IHeaderResponse response)
Specified by:
renderHead in interface org.apache.wicket.markup.html.IHeaderContributor
Overrides:
renderHead in class org.apache.wicket.Component

statement

public JsStatement statement()
Description copied from interface: IWiQueryPlugin
Returns the main JsStatement used to create the plugin.

Specified by:
statement in interface IWiQueryPlugin
Returns:
The JsStatement corresponding to this component.

getOptions

public Options getOptions()
Method retrieving the options of the component

Returns:
the options

setAnimated

public Accordion setAnimated(AccordionAnimated animationEffect)
Sets the effect to apply when the accordion's content is switched.

Parameters:
animationEffect - the effect name to apply. Set it empty if you don't want to apply any effect.
Returns:
instance of the current component

getAnimated

public AccordionAnimated getAnimated()
Returns:
the animated option value

setAnimationEffect

@Deprecated
public Accordion setAnimationEffect(AccordionAnimated animationEffect)
Deprecated. will be removed in 1.2

Sets the effect to apply when the accordion's content is switched.

Parameters:
animationEffect - the effect name to apply. Set it empty if you don't want to apply any effect.
Returns:
instance of the current component
See Also:
setAnimated(AccordionAnimated)

getAnimationEffect

@Deprecated
public AccordionAnimated getAnimationEffect()
Deprecated. will be removed in 1.2

Returns:
the animated option value
See Also:
getAnimated()

setAutoHeight

public Accordion setAutoHeight(boolean autoHeight)
Sets if the accordion's height is fixed to the highest content part.

Parameters:
autoHeight - true if this accordion's height is the highest content's one.
Returns:
instance of the current component

isAutoHeight

public boolean isAutoHeight()
Returns true if this accordion is auto height.

See Also:
setAutoHeight(boolean)

setTriggerEvent

@Deprecated
public Accordion setTriggerEvent(Accordion.AccordionTriggerEvent accordionTriggerEvent)
Deprecated. will be removed in 1.2

Sets the Accordion.AccordionTriggerEvent to use to open content.

Returns:
instance of the current component

getTriggerEvent

@Deprecated
public Accordion.AccordionTriggerEvent getTriggerEvent()
Deprecated. will be removed in 1.2

Returns the Accordion.AccordionTriggerEvent.

See Also:
#setTriggerEvent(org.objetdirect.wickext.ui.accordion.Accordion.AccordionTriggerEvent)

setEvent

public Accordion setEvent(Accordion.AccordionTriggerEvent accordionTriggerEvent)
Sets the Accordion.AccordionTriggerEvent to use to open content.

Returns:
instance of the current component

getEvent

public Accordion.AccordionTriggerEvent getEvent()
Returns the Accordion.AccordionTriggerEvent.

See Also:
#setTriggerEvent(org.objetdirect.wickext.ui.accordion.Accordion.AccordionTriggerEvent)

setFillSpace

public Accordion setFillSpace(boolean fillSpace)
Makes this accordion's height to the maximum size possible in this' parent container.

Overrides setAutoHeight(boolean) behavior

Returns:
instance of the current component

isFillSpace

public boolean isFillSpace()
Returns if this accordion fill space.

See Also:
setFillSpace(boolean)

setDisabled

public Accordion setDisabled(boolean disabled)
Disables (true) or enables (false) the accordion. Can be set when initialising (first creating) the accordion.

Parameters:
disabled -
Returns:
instance of the current behavior

isDisabled

public boolean isDisabled()
Returns:
the disabled option

setHeader

public Accordion setHeader(AccordionHeader header)
Sets the CSS selector used to defined a header in this accordion.

Returns:
instance of the current component

getHeader

public AccordionHeader getHeader()
Returns:
the header option value

setClearStyle

public Accordion setClearStyle(boolean clearStyle)
If set, clears height and overflow styles after finishing animations. This enables accordions to work with dynamic content. Won't work together with autoHeight.

Parameters:
clearStyle -
Returns:
instance of the current component

isClearStyle

public boolean isClearStyle()
See Also:
setClearStyle(boolean)

setCollapsible

public Accordion setCollapsible(boolean collapsible)
Whether all the sections can be closed at once. Allows collapsing the active section by the triggering event (click is the default).

Parameters:
collapsible -

isCollapsible

public boolean isCollapsible()
See Also:
setCollapsible(boolean)

setNavigation

public Accordion setNavigation(boolean navigation)
If set, looks for the anchor that matches location.href and activates it. Great for href-based state-saving. Use navigationFilter to implement your own matcher.

Parameters:
navigation -
Returns:
instance of the current component

isNavigation

public boolean isNavigation()
See Also:
setNavigation(boolean)

setNavigationFilter

public Accordion setNavigationFilter(JsScope navigationFilter)
Overwrite the default location.href-matching with your own matcher.

Parameters:
navigationFilter -
Returns:
instance of the current component

getIcons

public AccordionIcon getIcons()
See Also:
#setIcon(AccordionIcon)

setIcons

public Accordion setIcons(AccordionIcon icons)
Icons to use for headers. Icons may be specified for 'header' and 'headerSelected', and we recommend using the icons native to the jQuery UI CSS Framework manipulated by jQuery UI ThemeRoller Default: { 'header': 'ui-icon-triangle-1-e', 'headerSelected': 'ui-icon-triangle-1-s' }

Parameters:
icon -
Returns:
instance of the current component

setIcons

public Accordion setIcons(UiIcon header,
                          UiIcon headerSelected)
Icons to use for headers.

Parameters:
header -
headerSelected -
Returns:
instance of the current component

hideIcons

public Accordion hideIcons()
Allows to hide the icons.

Returns:
instance of the current component

getActive

public AccordionActive getActive()
See Also:
setActive(AccordionActive)

setActive

public Accordion setActive(AccordionActive active)
Selector for the active element. Set to false to display none at start. Needs collapsible: true. Type of element : Selector, Element, jQuery, Boolean, Number Default: first child

Parameters:
active -
Returns:
instance of the current component

setChangeEvent

public Accordion setChangeEvent(JsScopeUiEvent change)
Set's the callback when the accordion changes. If the accordion is animated, the event will be triggered upon completion of the animation; otherwise, it is triggered immediately.

Parameters:
change -
Returns:
instance of the current component

setChangeStartEvent

public Accordion setChangeStartEvent(JsScopeUiEvent changestart)
Set's the callback when the accordion starts to change.

Parameters:
changestart -
Returns:
instance of the current component

activate

public JsStatement activate(int index)
Method to activate a content part of the Accordion programmatically. The index can be a zero-indexed number to match the position of the header to close or a Selector matching an element. Pass false to close all (only possible with collapsible:true). This will return the element back to its pre-init state.

Parameters:
index -
Returns:
the associated JsStatement

activate

public void activate(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget,
                     int index)
Method to destroy the accordion within the ajax request

Parameters:
ajaxRequestTarget -
index -

destroy

public JsStatement destroy()
Method to destroy the accordion This will return the element back to its pre-init state.

Returns:
the associated JsStatement

destroy

public void destroy(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to destroy the accordion within the ajax request

Parameters:
ajaxRequestTarget -

disable

public JsStatement disable()
Method to disable the accordion

Returns:
the associated JsStatement

disable

public void disable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to disable the accordion within the ajax request

Parameters:
ajaxRequestTarget -

enable

public JsStatement enable()
Method to enable the accordion

Returns:
the associated JsStatement

enable

public void enable(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to enable the accordion within the ajax request

Parameters:
ajaxRequestTarget -

widget

public JsStatement widget()
Method to returns the .ui-accordion element

Returns:
the associated JsStatement

widget

public void widget(org.apache.wicket.ajax.AjaxRequestTarget ajaxRequestTarget)
Method to returns the .ui-accordion element within the ajax request

Parameters:
ajaxRequestTarget -


Copyright © 2012. All Rights Reserved.