Module wicket.bootstrap.core
Class DropDownButton
java.lang.Object
org.apache.wicket.Component
org.apache.wicket.MarkupContainer
org.apache.wicket.markup.html.WebMarkupContainer
org.apache.wicket.markup.html.link.AbstractLink
de.agilecoders.wicket.core.markup.html.bootstrap.button.dropdown.DropDownButton
- All Implemented Interfaces:
Activatable,Serializable,Iterable<Component>,IEventSink,IEventSource,IFeedbackContributor,IConverterLocator,IMetadataContext<Serializable,,Component> IHeaderContributor,IRequestableComponent,IHierarchical<Component>,IClusterable
- Direct Known Subclasses:
NavbarDropDownButton,SplitButton
Use any button to trigger a dropdown menu by placing it within a .btn-group and providing the proper menu markup.
- Author:
- miha
- See Also:
-
Field Summary
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_INITIALIZED, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER, RFLAG_CONTAINER_DEQUEING, RFLAG_CONTAINER_HAS_REMOVALS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddButtonBehavior(ButtonBehavior buttonBehavior) adds the button behavior to the base button of this dropdown componentprotected voidaddIconToBaseButton(Icon icon) adds an icon to the base buttonfinal DropDownButtonaddToButton(Behavior behavior) adds aBehaviorto the base buttonfinal voidappends a toggle menu script to a givenIPartialPageRequestHandler.protected StringgetIcon()getModel()booleanDecides whether the current instance (this) is the active item.protected WebMarkupContainercreates a new button instanceprotected IconnewButtonIcon(String markupId, IModel<IconType> iconTypeModel) creates a new icon component with givenIconType.protected ComponentnewButtonLabel(String markupId, IModel<?> labelModel) creates a new icon component with givenIconType.protected ButtonListnewButtonList(String markupId) creates a newButtonListthat contains all buttons fromnewSubMenuButtons(String)protected Stringprotected final IMarkupSourcingStrategyprotected abstract List<AbstractLink>newSubMenuButtons(String buttonMarkupId) creates a list of sub menu buttons which will be shown if sub menu will be opened.protected voidprotected voidvoidrenderHead(IHeaderResponse response) setAlignment(DropDownAlignmentBehavior.Alignment... alignment) sets the dropdown menu alignmentfinal DropDownButtonsetIconType(IconType iconType) sets the icon of the base button elementsetSize(Buttons.Size size) sets the size of the buttonsetType(Buttons.Type type) sets the type of the buttonsetVariation(DropDownVariationBehavior.Variation variation) Sets the dropdown menu "drop" variationMethods inherited from class org.apache.wicket.markup.html.link.AbstractLink
disableLink, getBody, onComponentTagBody, onDetach, setBodyMethods inherited from class org.apache.wicket.markup.html.WebMarkupContainer
getWebApplication, getWebPage, getWebRequest, getWebResponse, getWebSessionMethods inherited from class org.apache.wicket.MarkupContainer
add, addDequeuedComponent, addOrReplace, autoAdd, canDequeueTag, contains, dequeue, dequeue, dequeuePreamble, findChildComponent, findComponentToDequeue, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, getMarkupType, getRegionMarkup, internalAdd, internalInitialize, iterator, iterator, newDequeueContext, onRender, queue, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, stream, streamChildren, toString, toString, visitChildren, visitChildrenMethods inherited from class org.apache.wicket.Component
add, addStateChange, beforeRender, canCallListener, canCallListenerAfterExpiry, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, createConverter, debug, detach, detachModel, detachModels, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessages, getFlag, getId, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMarkupTag, 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, internalRenderComponent, internalRenderHead, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isInitialized, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, onAfterRender, onBeforeRender, onConfigure, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderPart, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlForListener, urlForListener, visitParents, visitParents, warn, wrapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
DropDownButton
Construct.- Parameters:
id- The markup idmodel- The label of the main button
-
DropDownButton
Construct.- Parameters:
markupId- The markup idmodel- The label of the main buttoniconType- The type of the icon
-
-
Method Details
-
onInitialize
protected void onInitialize()- Overrides:
onInitializein classMarkupContainer
-
getModel
-
getIcon
-
createCssClassName
- Returns:
- base css class name of button container element
-
addIconToBaseButton
adds an icon to the base button- Parameters:
icon- The icon to add
-
addToButton
adds aBehaviorto the base button- Parameters:
behavior- to add- Returns:
- this instance for chaining
-
newInitializerScript
- Returns:
- new initializer script
-
appendToggleMenuScript
appends a toggle menu script to a givenIPartialPageRequestHandler.- Parameters:
target- the current target
-
setIconType
sets the icon of the base button element- Parameters:
iconType- TheIconTypeof the icon- Returns:
- this element instance
-
newButton
protected WebMarkupContainer newButton(String markupId, IModel<String> labelModel, IModel<IconType> iconTypeModel) creates a new button instance- Parameters:
markupId- The component's idlabelModel- The label text as modeliconTypeModel- The icon type as model- Returns:
- a new button component
-
newButtonLabel
creates a new icon component with givenIconType.- Parameters:
markupId- The component' idlabelModel- The label text as model- Returns:
- new label component
-
newButtonIcon
creates a new icon component with givenIconType.- Parameters:
markupId- The component' idiconTypeModel- The icon type as model- Returns:
- new icon component
-
renderHead
- Specified by:
renderHeadin interfaceIHeaderContributor- Overrides:
renderHeadin classComponent
-
addButtonBehavior
adds the button behavior to the base button of this dropdown component- Parameters:
buttonBehavior- - behavior to add
-
newSubMenuButtons
creates a list of sub menu buttons which will be shown if sub menu will be opened.- Parameters:
buttonMarkupId- the markup id that all sub menu buttons must be use.- Returns:
- list of sub menu buttons
-
newButtonList
creates a newButtonListthat contains all buttons fromnewSubMenuButtons(String)- Parameters:
markupId- the markup id ofButtonList- Returns:
- new
ButtonListinstance
-
setSize
sets the size of the button- Parameters:
size- mandatory parameter- Returns:
- this instance for chaining
-
setType
sets the type of the button- Parameters:
type- mandatory parameter- Returns:
- this instance for chaining
-
setAlignment
sets the dropdown menu alignment- Parameters:
alignment- The alignment of the button- Returns:
- this instance for chaining
-
setVariation
Sets the dropdown menu "drop" variation- Parameters:
variation- The "drop" variant of the button- Returns:
- this instance for chaining
-
newMarkupSourcingStrategy
- Overrides:
newMarkupSourcingStrategyin classComponent
-
onComponentTag
- Overrides:
onComponentTagin classComponent
-
isActive
Description copied from interface:ActivatableDecides whether the current instance (this) is the active item.- Specified by:
isActivein interfaceActivatable- Parameters:
item- the current instance as a Component- Returns:
trueif the item is the current active one
-