Interface IRequestableComponent

All Known Subinterfaces:
IRequestablePage
All Known Implementing Classes:
AbstractCheckSelector, AbstractChoice, AbstractErrorPage, AbstractItem, AbstractLink, AbstractOutputTransformerContainer, AbstractPageableView, AbstractRepeater, AbstractSingleSelectChoice, AbstractSubmitLink, AbstractTextComponent, AccessDeniedPage, AjaxButton, AjaxCheckBox, AjaxFallbackButton, AjaxFallbackLink, AjaxLink, AjaxPagingNavigation, AjaxPagingNavigationIncrementLink, AjaxPagingNavigationLink, AjaxPagingNavigator, AjaxSubmitLink, Audio, AutoLabelResolver.AutoLabel, AutoLinkResolver.AutolinkBookmarkablePageLink, Body, BookmarkablePageLink, Border, Border.BorderBodyContainer, BorderPanel, BrowserInfoForm, BrowserInfoPage, Button, Check, CheckBox, CheckBoxMultipleChoice, CheckboxMultipleChoiceSelector, CheckBoxSelector, CheckGroup, CheckGroupSelector, ClientSideImageMap, Component, ComponentFeedbackPanel, ContextImage, DataView, DataViewBase, DownloadLink, DropDownChoice, EmailTextField, EmptyPanel, Enclosure, EnclosureContainer, EnumLabel, ExceptionErrorPage, ExternalImage, ExternalLink, ExternalSource, FeedbackPanel, FencedFeedbackPanel, FileUploadField, Form, FormComponent, FormComponentFeedbackBorder, FormComponentFeedbackIndicator, FormComponentLabel, FormComponentPanel, Fragment, GenericPanel, GenericWebMarkupContainer, GenericWebPage, GridView, HeaderPartContainer, HeaderResponseContainer, HiddenField, HtmlHeaderContainer, HtmlHeaderItemsContainer, Image, ImageButton, Include, InlineEnclosure, InlineFrame, InlineImage, InternalErrorPage, Item, Label, LabeledWebMarkupContainer, Link, ListChoice, ListItem, ListMultipleChoice, ListView, Loop, LoopItem, MarkupContainer, MediaComponent, MockHomePage, MultiFileUploadField, MultiLineLabel, NonCachingImage, NoopOutputTransformerContainer, NumberTextField, OddEvenItem, OddEvenListItem, Page, PageableListView, PageExpiredErrorPage, PageView, PagingNavigation, PagingNavigationIncrementLink, PagingNavigationLink, PagingNavigator, Panel, PasswordTextField, Picture, PopupCloseLink, PopupCloseLink.ClosePopupPage, PropertyListView, Radio, RadioChoice, RadioGroup, RangeTextField, RedirectPage, RefreshingView, RepeatingView, RequiredTextField, ResourceLink, SimpleFormComponentLabel, Source, Source, StatelessForm, StatelessLink, SubmitLink, TextArea, TextField, Track, TransparentWebMarkupContainer, UrlTextField, Video, WebComponent, WebMarkupContainer, WebPage, XsltOutputTransformerContainer

public interface IRequestableComponent
Base interface for components. The purpose of this interface is to make certain parts of Wicket easier to mock and unit test.
Author:
Matej Knopp
  • Method Details

    • getPageRelativePath

      Gets this component's path.
      Returns:
      Colon separated path to this component in the component hierarchy
    • getId

      Gets the id of this component.
      Returns:
      The id of this component
    • getPage

      Returns page this component belongs to.
      Returns:
      The page holding this component
      Throws:
      WicketRuntimeException - Thrown if component is not yet attached to a Page.
    • get

      Gets the component at the given path.
      Parameters:
      path - Path to component
      Returns:
      The component at the path
    • getBehaviorId

      int getBehaviorId(Behavior behavior)
      Gets a stable id for the specified non-temporary behavior. The id remains stable from the point this method is first called for the behavior until the behavior has been removed from the component. This includes from one request to the next, when the component itself is retained for the next request (i.e. is stateful). Note that the bookkeeping required for these stable ids increases the memory footprint of the component.
      Parameters:
      behavior -
      Returns:
      a stable id for the specified behavior
      Throws:
      IllegalArgumentException - when the behavior is temporary
    • getBehaviorById

      Gets the behavior for the specified id
      Parameters:
      id -
      Returns:
      behavior or null if none
      Throws:
      InvalidBehaviorIdException - when behavior with this id cannot be found
    • detach

      void detach()
      Detaches the component.

      NOTE: this method is not inherited from IDetachable on purpose. in Wicket the assumption for a long time has been that Components do not implement IDetachable; doing so may lead to some very nasty side-effects. Consider AbstractPropertyModel#detach() which looks like this:

       public void detach()
       {
              // Detach nested object if it's a detachable
              if (target instanceof IDetachable)
              {
                      ((IDetachable) target).detach();
              }
       }
       
      If the model was constructed thusly, which is quite common: new PropertyModel(this, "person") and Component implemented IDetachable then calling @{code model.detach()} will cause an infinite loop with the model trying to detach the component and the component trying to detach the model.

    • canCallListenerAfterExpiry

      Returns:
      true if it is save to call an IRequestListener on this component when the owner page is freshly created after expiration