Example usage for org.apache.wicket Component getPath

List of usage examples for org.apache.wicket Component getPath

Introduction

In this page you can find the example usage for org.apache.wicket Component getPath.

Prototype

public final String getPath() 

Source Link

Document

Gets this component's path.

Usage

From source file:name.martingeisse.wicket.util.StatelessUtil.java

License:Open Source License

/**
 * Dumps the stateful components in the component hierarchy, starting at
 * the specified component. The information is logged at INFO level.
 * //  www. j  a  va  2s . c  om
 * @param root the component to start at
 */
public static void dumpStatefulComponents(final Component root) {
    ParameterUtil.ensureNotNull(root, "root");
    if (!root.isStateless()) {
        logger.info("stateful component: " + root.getPath());
    }
    if (root instanceof MarkupContainer) {
        final MarkupContainer container = (MarkupContainer) root;
        for (final Component child : container) {
            dumpStatefulComponents(child);
        }
    }
}

From source file:net.dontdrinkandroot.extensions.wicket.behavior.ScrollToBottomBehavior.java

License:Apache License

private String getActiveVarName(Component component) {
    return ScrollToBottomBehavior.ACTIVE_PREFIX + "_" + component.getPath();
}

From source file:net.dontdrinkandroot.wicket.behavior.ajax.ScrollToBottomBehavior.java

License:Apache License

private String getActiveVarName(Component component) {

    return ScrollToBottomBehavior.ACTIVE_PREFIX + "_" + component.getPath();
}

From source file:nl.mpi.lamus.web.components.WsNodeActionsPanelTest.java

License:Open Source License

@Test
@DirtiesContext//from ww w  .  jav a2s.com
public void componentsRendered() {

    getTester().assertComponent("wsNodeActionsPanel:wsNodeActionsForm", Form.class);
    getTester().assertEnabled("wsNodeActionsPanel:wsNodeActionsForm");
    getTester().assertModelValue("wsNodeActionsPanel:wsNodeActionsForm", selectedNodes);

    getTester().assertComponent("wsNodeActionsPanel:wsNodeActionsForm:wsNodeActions", ListView.class);
    getTester().assertEnabled("wsNodeActionsPanel:wsNodeActionsForm:wsNodeActions");
    getTester().assertListView("wsNodeActionsPanel:wsNodeActionsForm:wsNodeActions", expectedActionsList);

    ListView<WsTreeNodesAction> nodesActionList = (ListView<WsTreeNodesAction>) getTester()
            .getComponentFromLastRenderedPage("wsNodeActionsPanel:wsNodeActionsForm:wsNodeActions");
    Iterator<Component> listItems = nodesActionList.iterator();
    while (listItems.hasNext()) {
        ListItem<WsTreeNodesAction> item = (ListItem<WsTreeNodesAction>) listItems.next();
        Iterator<Component> itemButtons = item.iterator();
        int i = 0;
        while (itemButtons.hasNext()) {
            Component button = itemButtons.next();
            assertTrue("Component " + button.getPath() + " is not instance of expected class",
                    button instanceof WsNodeActionButton);
            i++;
        }
        assertTrue("Number of buttons different from expected", i != 2);
    }
}

From source file:org.apache.isis.viewer.wicket.ui.panels.FormExecutorDefault.java

License:Apache License

private void debug(final String title, final List<Component> list) {
    LOG.debug(">>> " + title + ":");
    for (Component component : list) {
        LOG.debug(String.format("%30s: %s", component.getClass().getSimpleName(), component.getPath()));

    }/*from www  .  j  a  v  a2  s. c o  m*/
}

From source file:org.obiba.onyx.quartz.test.ComponentTesterUtils.java

License:Open Source License

/**
 * Find the first child of given class, and with model equals to the given model.
 * @param parent/* w  ww  .  ja  v  a2 s.com*/
 * @param clazz
 * @param model
 * @return
 */
public static Component findChild(WebMarkupContainer parent, final Class clazz, final IModel model) {
    if (parent == null) {
        throw new IllegalArgumentException("parent cannot be null.");
    }

    return (Component) parent.visitChildren(new Component.IVisitor() {

        public Object component(Component component) {
            if (clazz.isAssignableFrom(component.getClass()) && component.getDefaultModel().equals(model)) {
                log.debug("child.path: {}", component.getPath());
                return component;
            }
            return CONTINUE_TRAVERSAL;
        }

    });

}

From source file:org.obiba.onyx.quartz.test.ComponentTesterUtils.java

License:Open Source License

/**
 * Find the first child of given class, and with model object equals to the given localizable.
 * @param parent/*from   w ww .  j a  v  a 2s. com*/
 * @param clazz
 * @param localizable
 * @return
 */
public static Component findChild(WebMarkupContainer parent, final Class clazz,
        final IQuestionnaireElement localizable) {
    if (parent == null) {
        throw new IllegalArgumentException("parent cannot be null.");
    }

    return (Component) parent.visitChildren(new Component.IVisitor() {

        public Object component(Component component) {
            if (clazz.isAssignableFrom(component.getClass())) {
                if (component.getDefaultModelObject() != null
                        && localizable.getClass().isAssignableFrom(component.getDefaultModelObject().getClass())
                        && localizable.getName().equals(
                                ((IQuestionnaireElement) component.getDefaultModelObject()).getName())) {
                    log.debug("child.{}.path: {}", localizable.getName(), component.getPath());
                    return component;
                }
            }
            return CONTINUE_TRAVERSAL;
        }

    });

}

From source file:org.obiba.onyx.quartz.test.ComponentTesterUtils.java

License:Open Source License

public static String extractPath(Component component, String from) {

    String path = null;//w  w  w  .  j  av  a  2 s  .  c  o m
    for (String p : component.getPath().split(":")) {
        if (path == null) {
            if (p.equals(from)) {
                path = from;
            }
        } else {
            path += ":" + p;
        }
    }

    log.debug("extractPath={}", path);
    return path;
}

From source file:org.obiba.onyx.quartz.test.ComponentTesterUtils.java

License:Open Source License

/**
 * Get all children of the given class./*from  ww w  .j a  va  2s .c  o  m*/
 * @param parent
 * @param clazz
 * @return
 */
public static List<Component> findChildren(WebMarkupContainer parent, final Class clazz) {
    if (parent == null) {
        throw new IllegalArgumentException("parent cannot be null.");
    }

    final List<Component> children = new ArrayList<Component>();

    parent.visitChildren(new Component.IVisitor() {

        public Object component(Component component) {
            if (clazz.isAssignableFrom(component.getClass())) {
                log.debug("children.path: {}", component.getPath());
                children.add(component);
                return CONTINUE_TRAVERSAL;
            }
            return CONTINUE_TRAVERSAL;
        }

    });

    return children;
}

From source file:org.opensingular.form.wicket.helpers.SingularFormTester.java

License:Apache License

private String getFormRelativeComponentId(String formComponentId) {
    Component formComponent = tester.getAssertionsPage().getSubCompomentWithId(formComponentId).getTarget();

    String path = formComponent.getPath();
    String formPath = getForm().getPath() + ":";
    return path.replace(formPath, "");
}