You're reading the documentation for Wicket Stuff 11.x, the current feature line. The 10.x long-term support documentation is the default.

Components

ModalX

modalx
Source Edit this page

A lightweight extension to Wicket’s modal dialog capabilities that comes with standardized MessageBox class and allows easy definition of Modal dialog box classes, similar in nature to desktop application development in frameworks like MFC, .net, OWL, Swing etc.

  • Wicket’s ModalDialog is genericized as ModalContentWindow and is automatically managed. Definition of a new Modal Form needs only to extend a single class ModalFormPanel.
  • Generic modal window management - open from anywhere in your application without explicitly defining the modal window tag markup in a component that might need it.
  • MessageBox feature
  • IWindowCloseListener - optional listener on any ModalContentPanel close event.
  • ModalResult - a desktop framework concept. Allows a IWindowCloseListener to query the button the user pressed to close a modal window.

ModalX home page at Visual Classworks: ModalX Home

ModalX class diagram

This Visual Classworks/Javelin class diagram shows the core classes and how they relate to each other. The base class ModalContentPanel implements the behavior necessary to display itself inside a generic modal window (ModalContentWindow) instance which means the modal window has been genericized and can be effectively ignored when defining a new ModalFormPanel class.

ModalX Class Diagram

Maven

<dependency>
    <groupId>org.wicketstuff</groupId>
    <artifactId>modalx</artifactId>
</dependency>

Import org.wicketstuff:wicketstuff-bom in your dependencyManagement section to manage the version.

Java

Definition of a form class:

public class TestForm extends ModalFormPanel {
    public TestForm(ModalContentWindow iModalContentWindow,
        IWindowCloseListener iWindowCloseListener, Person iPerson) {
        super(iModalContentWindow, iWindowCloseListener);

        person = iPerson;
        setTitle("Personal Details");
    }

    public void addFormComponents() {
        form.add(new RequiredTextField("firstName",
             new PropertyModel(person, "firstName")).setLabel(new Model("First Name")));
        form.add(new RequiredTextField("lastName",
             new PropertyModel(person, "lastName")).setLabel(new Model("Last Name")));
        etc.,
    }
}

Opening a form:

TestForm testForm = new TestForm(allocateModalWindow(), null, person);

testForm.show(target);

Project maintainers

Chris Colman

The modalx-examples module contains a runnable example application.

Source: modalx-parent