Example usage for org.apache.wicket.util.visit IVisit stop

List of usage examples for org.apache.wicket.util.visit IVisit stop

Introduction

In this page you can find the example usage for org.apache.wicket.util.visit IVisit stop.

Prototype

void stop(R result);

Source Link

Document

Stops the visit/traversal and returns result

Usage

From source file:at.molindo.wicketutils.migration.IVisitor.java

License:Apache License

@Override
public void component(T component, IVisit<Object> visit) {
    Object o = component(component);

    if (o == CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER) {
        visit.dontGoDeeper();//  w  w w  . ja  v  a 2  s . c o m
    } else if (o != CONTINUE_TRAVERSAL) {
        visit.stop(STOP_TRAVERSAL);
    }
}

From source file:com.github.javawithmarcus.wicket.cdi.ConversationPropagator.java

License:Apache License

protected boolean hasConversationalComponent(Page page) {
    Boolean hasConversational = Visits.visit(page, new IVisitor<Component, Boolean>() {
        @Override/*from   w  ww.  j a  va  2  s.c  o  m*/
        public void component(Component object, IVisit<Boolean> visit) {
            Conversational annotation = object.getClass().getAnnotation(Conversational.class);
            if (annotation != null) {
                visit.stop(true);
            }
        }
    });

    return hasConversational == null ? false : hasConversational;
}

From source file:com.premiumminds.webapp.wicket.behaviours.EnableSubmitOnEnterBehaviour.java

License:Open Source License

private static IFormSubmitter findSubmitButton(final Form<?> form) {
    IFormSubmittingComponent submittingComponent = form.visitChildren(IFormSubmittingComponent.class,
            new IVisitor<Component, IFormSubmittingComponent>() {
                public void component(final Component component, final IVisit<IFormSubmittingComponent> visit) {
                    // Get submitting component
                    final IFormSubmittingComponent submittingComponent = (IFormSubmittingComponent) component;
                    final Form<?> formFromComponent = submittingComponent.getForm();

                    if ((formFromComponent != null) && (formFromComponent == form)) {
                        visit.stop(submittingComponent);
                    }// w  w  w  .ja v  a2 s .  co m
                }
            });

    return submittingComponent;
}

From source file:com.premiumminds.webapp.wicket.bootstrap.BootstrapControlGroupFeedback.java

License:Open Source License

@Override
protected void onConfigure() {
    super.onConfigure();

    filter = new IFeedbackMessageFilter() {
        private static final long serialVersionUID = -7726392072697648969L;

        public boolean accept(final FeedbackMessage msg) {
            Boolean b = visitChildren(FormComponent.class, new IVisitor<FormComponent<?>, Boolean>() {
                @Override//from   w  ww  .ja  va  2  s.  com
                public void component(FormComponent<?> arg0, IVisit<Boolean> arg1) {
                    if (arg0.equals(msg.getReporter()))
                        arg1.stop(true);
                }
            });

            if (b == null)
                return false;

            return b;
        }
    };
}

From source file:com.premiumminds.webapp.wicket.bootstrap.BootstrapDatepicker.java

License:Open Source License

/**
 * Gets the DateTextField inside this datepicker wrapper.
 *
 * @return the date field/*from   w  ww  . j  av a 2s  .co m*/
 */
public DateTextField getDateTextField() {
    DateTextField component = visitChildren(DateTextField.class, new IVisitor<DateTextField, DateTextField>() {
        @Override
        public void component(DateTextField arg0, IVisit<DateTextField> arg1) {
            arg1.stop(arg0);
        }
    });

    if (component == null)
        throw new WicketRuntimeException("BootstrapDatepicker didn't have any DateTextField child!");

    return component;
}

From source file:com.premiumminds.webapp.wicket.bootstrap.BootstrapFeedbackPopover.java

License:Open Source License

@Override
protected void onInitialize() {
    super.onInitialize();

    filter = new IFeedbackMessageFilter() {
        private static final long serialVersionUID = -7726392072697648969L;

        public boolean accept(final FeedbackMessage msg) {
            Boolean b = visitChildren(FormComponent.class, new IVisitor<FormComponent<?>, Boolean>() {
                @Override//from  www  .  jav  a 2  s  .c  o m
                public void component(FormComponent<?> arg0, IVisit<Boolean> arg1) {
                    if (arg0.equals(msg.getReporter()))
                        arg1.stop(true);
                }
            });

            if (b == null)
                return false;

            return b;
        }
    };

}

From source file:com.premiumminds.webapp.wicket.bootstrap.BootstrapJodaDatepicker.java

License:Open Source License

@Override
protected void onConfigure() {
    super.onConfigure();

    dateField = visitChildren(JodaInstantTextField.class,
            new IVisitor<JodaInstantTextField<T>, JodaInstantTextField<T>>() {
                @Override//from  ww  w. ja v a  2 s. co  m
                public void component(JodaInstantTextField<T> arg0, IVisit<JodaInstantTextField<T>> arg1) {
                    arg1.stop(arg0);
                }
            });
}

From source file:de.inren.frontend.application.FeedbackPanelVisitor.java

License:Apache License

@Override
public void component(Component component, IVisit<Component> visit) {
    if (!visited.contains(component)) {
        visited.add(component);//from  ww w .  j  a v a  2s.  co m
        if (component instanceof FeedbackPanel) {
            visit.stop(component);
        }
    }
}

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

License:Apache License

private boolean hasBlobsOrClobs(final Page page) {

    // this is a bit of a hack... currently the blob/clob panel doesn't correctly redraw itself.
    // we therefore force a re-forward (unless is declared as unchanging).
    final Object hasBlobsOrClobs = page.visitChildren(IsisBlobOrClobPanelAbstract.class,
            new IVisitor<IsisBlobOrClobPanelAbstract, Object>() {
                @Override/*from w  w  w .j a  v a  2s .c o  m*/
                public void component(final IsisBlobOrClobPanelAbstract object, final IVisit<Object> visit) {
                    if (!isUnchanging(object)) {
                        visit.stop(true);
                    }
                }

                private boolean isUnchanging(final IsisBlobOrClobPanelAbstract object) {
                    final ScalarModel scalarModel = (ScalarModel) object.getModel();
                    final UnchangingFacet unchangingFacet = scalarModel.getFacet(UnchangingFacet.class);
                    return unchangingFacet != null && unchangingFacet.value();
                }

            });
    return hasBlobsOrClobs != null;
}

From source file:org.apache.syncope.fit.console.AbstractConsoleITCase.java

License:Apache License

protected <V extends Serializable> Component findComponentByProp(final String property, final String searchPath,
        final V key) {

    Component component = TESTER.getComponentFromLastRenderedPage(searchPath);
    return (component instanceof MarkupContainer ? MarkupContainer.class.cast(component) : component.getPage())
            .visitChildren(ListItem.class, new IVisitor<ListItem<?>, Component>() {

                @Override//from   w w  w  . j  a v a2s .c  om
                public void component(final ListItem<?> object, final IVisit<Component> visit) {
                    try {
                        Method getter = PropertyResolver.getPropertyGetter(property, object.getModelObject());
                        if (getter != null && getter.invoke(object.getModelObject()).equals(key)) {
                            visit.stop(object);
                        }
                    } catch (Exception e) {
                        LOG.error("Error invoke method", e);
                    }
                }
            });
}