Example usage for org.apache.wicket MarkupContainer getMarkupId

List of usage examples for org.apache.wicket MarkupContainer getMarkupId

Introduction

In this page you can find the example usage for org.apache.wicket MarkupContainer getMarkupId.

Prototype

public String getMarkupId(boolean createIfDoesNotExist) 

Source Link

Document

Retrieves id by which this component is represented within the markup.

Usage

From source file:wicketdnd.util.MarkupIdVisitor.java

License:Apache License

/**
 * Get the given container's descendent by markup id.
 * /*  www .  j  ava 2 s  .  c o  m*/
 * @param container
 *            container to find descendent of
 * @param id
 *            markup id
 * @return component
 * @throws PageExpiredException
 *             if no descendent has the given markup id
 */
public static Component getComponent(MarkupContainer container, String id) {
    if (id.equals(container.getMarkupId(false))) {
        return container;
    }

    Component component = container.visitChildren(new MarkupIdVisitor(id));

    if (component == null) {
        throw new PageExpiredException("No component with markup id " + id);
    }

    return component;
}