@Test public void isParent() { new WicketTester(new WebApplication() { @Override public Class<? extends Page> getHomePage() { return null; } }); final WebMarkupContainer c1 = new WebMarkupContainer("c1"); final WebMarkupContainer c2 = new WebMarkupContainer("c2"); c1.add(c2); final WebMarkupContainer c3 = new WebMarkupContainer("c3"); c2.add(c3); final Label l1 = new Label("l1", "l1"); c3.add(l1); final Label l2 = new Label("l2", "l2"); c1.add(l2); final Label l3 = new Label("l3", "l3"); assertFalse(WicketUtils.isParent(c1, c1)); assertTrue(WicketUtils.isParent(c1, c2)); assertFalse(WicketUtils.isParent(c2, c1)); assertTrue(WicketUtils.isParent(c1, c3)); assertTrue(WicketUtils.isParent(c1, l1)); assertTrue(WicketUtils.isParent(c2, l1)); assertTrue(WicketUtils.isParent(c3, l1)); assertTrue(WicketUtils.isParent(c1, l2)); assertFalse(WicketUtils.isParent(c2, l2)); assertFalse(WicketUtils.isParent(c1, l3)); }
public static boolean isParent(final Component parent, final Component descendant) { final MarkupContainer p = descendant.getParent(); if (p == null) { return false; } else if (p == parent) { return true; } else { return isParent(parent, p); } }
WicketUtils { public static boolean isParent(final Component parent, final Component descendant) { final MarkupContainer p = descendant.getParent(); if (p == null) { return false; } else if (p == parent) { return true; } else { return isParent(parent, p); } } }
WicketUtils { public static boolean isParent(final Component parent, final Component descendant) { final MarkupContainer p = descendant.getParent(); if (p == null) { return false; } else if (p == parent) { return true; } else { return isParent(parent, p); } }  }
WicketUtils { public static boolean isParent(final Component parent, final Component descendant) { final MarkupContainer p = descendant.getParent(); if (p == null) { return false; } else if (p == parent) { return true; } else { return isParent(parent, p); } }  static String getContextPath(); static void redirectToLogin(Component component); static void redirectToLogin(Page page); static HttpServletRequest getHttpServletRequest(final Request request); static HttpServletResponse getHttpServletResponse(final Response response); static boolean contains(final PageParameters parameters, final String name); static String getAsString(final PageParameters parameters, final String name); static Integer getAsInteger(final PageParameters parameters, final String name); static int getAsInt(final PageParameters parameters, final String name, final int defaultValue); static Long getAsLong(final PageParameters parameters, final String name); static Boolean getAsBooleanObject(final PageParameters parameters, final String name); static boolean getAsBoolean(final PageParameters parameters, final String name); static Object getAsObject(final PageParameters parameters, final String name, final Class<?> type); static String getCssForFavicon(final String favicon); static final String getAbsoluteUrl(final String url); static String getImageUrl(final RequestCycle requestCycle, final String path); static String getUrl(final RequestCycle requestCycle, final String path, final boolean encodeUrl); static String getBookmarkablePageUrl(final Class<? extends Page> pageClass, final String... params); static PageParameters getPageParameters(final String[] params); final static String toAbsolutePath(final String requestUrl, final String relativePagePath); final static PageParameters getEditPageParameters(final Integer id); static String getDefaultPageUrl(); static Class<? extends WebPage> getDefaultPage(); static void putPageParameter(final PageParameters pageParameters, final String key, final Object value); static void addOrReplaceParameter(final PageParameters pageParameters, final String key, final Object value); static void putPageParameters(final ISelectCallerPage callerPage, final Object dataObject,
                                       final Object filterObject,
                                       final PageParameters pageParameters, final String[] bookmarkableProperties); static Object getPageParameter(final PageParameters pageParameters, final String key,
                                        final Class<?> objectType); static boolean hasParameter(final PageParameters parameters, final String name); static void evaluatePageParameters(final ISelectCallerPage callerPage, final Object dataObject,
                                            final Object filter,
                                            final PageParameters parameters, final String[] bookmarkableProperties); static void addRowClick(final Component row); static ContextImage getInvisibleDummyImage(final String id, final RequestCycle requestCylce); static Component getInvisibleComponent(final String id); static String getLabelWithUnit(final String label, final String unit); static IconPanel getJIRASupportTooltipIcon(final Component parent, final String id); static IconPanel getJIRASupportTooltipIcon(final FieldsetPanel fieldset); static IconPanel getAlertTooltipIcon(final FieldsetPanel fieldset, final String tooltip); static IconPanel getAlertTooltipIcon(final FieldsetPanel fieldset, final IModel<String> title,
                                              final IModel<String> tooltip); static final boolean isJIRAConfigured(); static void addShowDeleteRowQuestionDialog(final MarkupContainer parent, final BaseDao<?> dao); static void setPlaceHolderAttribute(Component component, final String value); static String getCalendarWeeks(final MarkupContainer parent, final Date startTime, final Date stopTime); static String getCalendarWeeks(final MarkupContainer parent, final LocalDate startTime, final LocalDate stopTime); static String getUTCDate(final Date date); static String getUTCDate(final String label, final Date date); static String getUTCDate(final String label, final LocalDate date); static String getUTCDates(final Date startTime, final Date stopTime); static String getUTCDates(final LocalDate startTime, final LocalDate stopTime); static LabelValueChoiceRenderer<Long> getDatumChoiceRenderer(final int lastNDays); static void append(final Component component, final RowCssClass... rowCssClasses); static Component addTooltip(final Component component, final String title, final String text); static Component addTooltip(final Component component, final String title, final String text,
                                     final boolean rightAlignment); static Component addTooltip(final Component component, final String text); static Component addTooltip(final Component component, final String text, final boolean rightAlignment); static Component addTooltip(final Component component, final IModel<String> text); static Component addTooltip(final Component component, final IModel<String> text, final boolean rightAlignment); static Component addTooltip(final Component component, final IModel<String> title, final IModel<String> text); static Component addTooltip(final Component component, final IModel<String> title, final IModel<String> text,
                                     final boolean rightAlignment); static Component addEditableLabelDefaultTooltip(final Component label); static Component setWarningTooltip(final Component component); static FormComponent<?> setReadonly(final FormComponent<?> component); static FormComponent<?> setSize(final FormComponent<?> component, final int size); static FormComponent<?> setSize(final FormComponent<?> component, final int size, final boolean important); static FormComponent<?> setPercentSize(final FormComponent<?> component, final int size); static Component setFontSizeLarge(final Component component); static Component setStrong(final Component component); static FormComponent<?> setHeight(final FormComponent<?> component, final int height); static FormComponent<?> setFocus(final FormComponent<?> component); static Behavior setFocus(); static String createMultipleFieldsetLabel(final String... labels); static Component createBooleanLabel(final RequestCycle requestCycle, final String componentId,
                                             final boolean value); static AttributeModifier getAttributeModifier(final Component comp, final String name); static void setResponsePage(final Component component, final Component responseItem); static void setResponsePage(final Component component, final ISelectCallerPage callerPage); static AttributeModifier javaScriptConfirmDialogOnClick(final String message); @SuppressWarnings("unchecked") static void setLabel(final FormComponent<?> component, final Label label); static boolean isParent(final Component parent, final Component descendant); }
WicketUtils { public static boolean isParent(final Component parent, final Component descendant) { final MarkupContainer p = descendant.getParent(); if (p == null) { return false; } else if (p == parent) { return true; } else { return isParent(parent, p); } }  static String getContextPath(); static void redirectToLogin(Component component); static void redirectToLogin(Page page); static HttpServletRequest getHttpServletRequest(final Request request); static HttpServletResponse getHttpServletResponse(final Response response); static boolean contains(final PageParameters parameters, final String name); static String getAsString(final PageParameters parameters, final String name); static Integer getAsInteger(final PageParameters parameters, final String name); static int getAsInt(final PageParameters parameters, final String name, final int defaultValue); static Long getAsLong(final PageParameters parameters, final String name); static Boolean getAsBooleanObject(final PageParameters parameters, final String name); static boolean getAsBoolean(final PageParameters parameters, final String name); static Object getAsObject(final PageParameters parameters, final String name, final Class<?> type); static String getCssForFavicon(final String favicon); static final String getAbsoluteUrl(final String url); static String getImageUrl(final RequestCycle requestCycle, final String path); static String getUrl(final RequestCycle requestCycle, final String path, final boolean encodeUrl); static String getBookmarkablePageUrl(final Class<? extends Page> pageClass, final String... params); static PageParameters getPageParameters(final String[] params); final static String toAbsolutePath(final String requestUrl, final String relativePagePath); final static PageParameters getEditPageParameters(final Integer id); static String getDefaultPageUrl(); static Class<? extends WebPage> getDefaultPage(); static void putPageParameter(final PageParameters pageParameters, final String key, final Object value); static void addOrReplaceParameter(final PageParameters pageParameters, final String key, final Object value); static void putPageParameters(final ISelectCallerPage callerPage, final Object dataObject,
                                       final Object filterObject,
                                       final PageParameters pageParameters, final String[] bookmarkableProperties); static Object getPageParameter(final PageParameters pageParameters, final String key,
                                        final Class<?> objectType); static boolean hasParameter(final PageParameters parameters, final String name); static void evaluatePageParameters(final ISelectCallerPage callerPage, final Object dataObject,
                                            final Object filter,
                                            final PageParameters parameters, final String[] bookmarkableProperties); static void addRowClick(final Component row); static ContextImage getInvisibleDummyImage(final String id, final RequestCycle requestCylce); static Component getInvisibleComponent(final String id); static String getLabelWithUnit(final String label, final String unit); static IconPanel getJIRASupportTooltipIcon(final Component parent, final String id); static IconPanel getJIRASupportTooltipIcon(final FieldsetPanel fieldset); static IconPanel getAlertTooltipIcon(final FieldsetPanel fieldset, final String tooltip); static IconPanel getAlertTooltipIcon(final FieldsetPanel fieldset, final IModel<String> title,
                                              final IModel<String> tooltip); static final boolean isJIRAConfigured(); static void addShowDeleteRowQuestionDialog(final MarkupContainer parent, final BaseDao<?> dao); static void setPlaceHolderAttribute(Component component, final String value); static String getCalendarWeeks(final MarkupContainer parent, final Date startTime, final Date stopTime); static String getCalendarWeeks(final MarkupContainer parent, final LocalDate startTime, final LocalDate stopTime); static String getUTCDate(final Date date); static String getUTCDate(final String label, final Date date); static String getUTCDate(final String label, final LocalDate date); static String getUTCDates(final Date startTime, final Date stopTime); static String getUTCDates(final LocalDate startTime, final LocalDate stopTime); static LabelValueChoiceRenderer<Long> getDatumChoiceRenderer(final int lastNDays); static void append(final Component component, final RowCssClass... rowCssClasses); static Component addTooltip(final Component component, final String title, final String text); static Component addTooltip(final Component component, final String title, final String text,
                                     final boolean rightAlignment); static Component addTooltip(final Component component, final String text); static Component addTooltip(final Component component, final String text, final boolean rightAlignment); static Component addTooltip(final Component component, final IModel<String> text); static Component addTooltip(final Component component, final IModel<String> text, final boolean rightAlignment); static Component addTooltip(final Component component, final IModel<String> title, final IModel<String> text); static Component addTooltip(final Component component, final IModel<String> title, final IModel<String> text,
                                     final boolean rightAlignment); static Component addEditableLabelDefaultTooltip(final Component label); static Component setWarningTooltip(final Component component); static FormComponent<?> setReadonly(final FormComponent<?> component); static FormComponent<?> setSize(final FormComponent<?> component, final int size); static FormComponent<?> setSize(final FormComponent<?> component, final int size, final boolean important); static FormComponent<?> setPercentSize(final FormComponent<?> component, final int size); static Component setFontSizeLarge(final Component component); static Component setStrong(final Component component); static FormComponent<?> setHeight(final FormComponent<?> component, final int height); static FormComponent<?> setFocus(final FormComponent<?> component); static Behavior setFocus(); static String createMultipleFieldsetLabel(final String... labels); static Component createBooleanLabel(final RequestCycle requestCycle, final String componentId,
                                             final boolean value); static AttributeModifier getAttributeModifier(final Component comp, final String name); static void setResponsePage(final Component component, final Component responseItem); static void setResponsePage(final Component component, final ISelectCallerPage callerPage); static AttributeModifier javaScriptConfirmDialogOnClick(final String message); @SuppressWarnings("unchecked") static void setLabel(final FormComponent<?> component, final Label label); static boolean isParent(final Component parent, final Component descendant);  }