X

Geertjan's Blog

  • July 19, 2005

Overview of Wicket Components

Geertjan Wielenga
Product Manager
Here's a brief overview of each of the Wicket components (the intention is to provide an overview of each, so if any are missing, they should be added), together with a reference to a sample for each. (References to samples still to be added for most components.) I will continue adding information to this list -- so it is not complete and it will keep changing -- as I learn more about Wicket. I intend to add code snippets to illustrate the usage of each component. I will also add related wicket tags to each component description. Once this overview is in a good enough state -- and assuming the Wicket team will want to host it -- it will be made available from the Wicket site. Thanks to Eelco for providing the basis of the information below.

Output components

Package: wicket.markup.html.basic

Components:

  • Label. Outputs a single string. See the "HelloWorld" sample.

    Java:

    add(new Label("message", "Hello World!"));


    HTML:

    <span wicket:id="message" id="message">Message goes here</span>

  • MultiLineLabel. Outputs a string with converted line breaks and tabs. See the "GuestBook" sample.

    Java:

    public GuestBook() {
    // Add comment form
    add(new CommentForm("commentForm"));
    // Add commentListView of existing comments
    add(commentListView = new ListView("comments", commentList) {
    public void populateItem(final ListItem listItem) {
    final Comment comment = (Comment)listItem.getModelObject();
    listItem.add(new Label("date", new Model(comment.getDate())));listItem.add(new MultiLineLabel("text", comment.getText()));
    }
    }).setVersioned(false);
    }


    HTML:

    <body>
    <span wicket:id="mainNavigation"/>
    <form wicket:id = "commentForm" id = "commentForm">
    Add your comment here:
    <p>
    <textarea wicket:id = "text">This is a comment</textarea>
    <p>
    <input type = "submit" value = "Submit"/>
    </form>
    <p/>
    <span wicket:id = "comments" id="comments">
    <p>
    <span wicket:id = "date">1/1/2004</span><br><span wicket:id = "text">Comment text goes here.</span>
    </p>
    </span>
    <wicket:remove>
    <p>
    1/2/2004<br/>
    More comment text here.
    </p>
    </wicket:remove>
    </body>

Layout and Grouping components

Packages: wicket.markup.html.panel, wicket.markup.html.border, wicket.markup.html.list, wicket.markup.html.tree

Components:

  • Panel. Generic component for nesting subcomponents. See "WicketExampleHeader".

  • Border. Generic component for nesting subcomponents within a border. See the "NavoMatic" sample.

  • ListView. Component for repetitive elements. ListViews can contain nested ListViews.

  • Loop. Same as ListView, but simpler and lighter, and therefore less advanced than ListView.

  • Tree. Component for interactive server-side tree. Includes events voor expanding/collapsing and for selection. See the "Nested" sample.

  • AbstractTree. Abstract tree component that can be used for implementing trees that follow an alternative rendering strategy.

Link components

Package: wicket.markup.html.link

Components:

  • BookmarkablePageLink. Specialized PageLink for BookmarkablePages.

  • ExternalLink. Link to non-Wicket sites, such as Google.

  • ImageMap. Link defined on an image.

  • Link. Generic call mechanism that can be attached to HTML anchors (such as <a href=>) or to arbitrary HTML elements, such as <TD> or <DIV>.

  • PageLink. Link to a Wicket page, able to determine whether the link is active or inactive. A page is only created when the link is clicked, which saves session space.

  • PopupCloseLink. Link that closes the current popup and removes it from the session.

  • ResourceLink. Link to a resource, such as JAR-ed images or PDF files.

Form components

Packages: wicket.markup.html.form, wicket.markup.html.form.upload

Components:

  • AbstractChoice. Basis class for all selection components.

  • AbstractSingleSelectChoice. Basis class for single selection components.

  • AbstractTextComponent. Basis component for custom text-based form components.

  • Button. Button for triggering a Form submit.

  • CheckBox. Checkbox component.

  • DropDownChoice. Dropdown for selection.

  • Form. Form component, equivalent of <form> in HTML.

  • FormComponent. Basis for custom form component.

  • ImageButton. Special button for working with images.

  • ListChoice. Scroll selection instead of drop-down.

  • ListMultipleChoice. Scroll and select multiple items.

  • PasswordTextField. Encrypted entry field for passwords.

  • RadioChoice. Radio button selection.

  • RequiredTextField. Adds RequiredValidator to TextField-type component.

  • TextField. Text field.

  • TextArea. Multi-line text field.

  • UploadForm. Special form for uploads. See "Upload" sample.

  • UploadField. Field used for nesting UploadForms, so that you can create an upload per field, which allows simultaneous multiple file uploads within a single UploadForm. See "Upload" sample.

Miscellaneous components

Package: wicket.markup.html.image

Component:

  • Image. Represents static and dynamic images. See "Images" sample.

Custom components

Package: wicket.markup.html

Components:

  • WebComponent. For components without subcomponents. Useful for components that need to influence their body directly, such as Labels.

  • WebContainer. For components that have subcomponents, such as Panels, Forms, etc.

  • WebPage. Represents an HTML page.

  • WebResource. Basis class for resources.

Join the discussion

Comments ( 3 )
  • guest Tuesday, December 13, 2005
    ii
  • johnson Friday, January 13, 2006
    Good
  • guest Friday, June 2, 2006
    nice
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.