本文整理汇总了Java中org.apache.wicket.util.visit.IVisit类的典型用法代码示例。如果您正苦于以下问题:Java IVisit类的具体用法?Java IVisit怎么用?Java IVisit使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IVisit类属于org.apache.wicket.util.visit包,在下文中一共展示了IVisit类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isHiddenByModalContainer
import org.apache.wicket.util.visit.IVisit; //导入依赖的package包/类
protected boolean isHiddenByModalContainer() {
final MarkupContainer markupContainer = getContext().getMarkupContainer();
final ModalContainer parentModalContainer = markupContainer.findParent(ModalContainer.class);
if (parentModalContainer != null && !parentModalContainer.isShowing()) {
//this modal container is not showing this component currently
return true;
}
final Boolean showingChildModalContainerFound = markupContainer.visitChildren(ModalContainer.class,
new IVisitor<ModalContainer, Boolean>() {
@Override
public void component(final ModalContainer object, final IVisit<Boolean> visit) {
if (object.isShowing()) {
//a child modal container is blocking this component currently
visit.stop(true);
}
}
});
return showingChildModalContainerFound != null && showingChildModalContainerFound;
}
示例2: convertInputToValue
import org.apache.wicket.util.visit.IVisit; //导入依赖的package包/类
@Override
protected Serializable convertInputToValue() throws ConversionException {
final Serializable bean = (Serializable) getBeanDescriptor().newBeanInstance();
visitChildren(PropertyEditor.class, new IVisitor<PropertyEditor<Serializable>, PropertyEditor<Serializable>>() {
@Override
public void component(PropertyEditor<Serializable> object, IVisit<PropertyEditor<Serializable>> visit) {
object.getPropertyDescriptor().setPropertyValue(bean, object.getConvertedInput());
visit.dontGoDeeper();
}
});
return bean;
}
示例3: getSourceAware
import org.apache.wicket.util.visit.IVisit; //导入依赖的package包/类
@Nullable
private SourceAware getSourceAware(String path) {
return diffsView.visitChildren(new IVisitor<Component, SourceAware>() {
@SuppressWarnings("unchecked")
@Override
public void component(Component object, IVisit<SourceAware> visit) {
if (object instanceof ListItem) {
ListItem<BlobChange> item = (ListItem<BlobChange>) object;
if (item.getModelObject().getPaths().contains(path)) {
visit.stop((SourceAware) item.get(DIFF_ID));
} else {
visit.dontGoDeeper();
}
}
}
});
}
示例4: onConfigure
import org.apache.wicket.util.visit.IVisit; //导入依赖的package包/类
@Override
public void onConfigure() {
super.onConfigure();
toolbars.configure();
Boolean visible = toolbars.visitChildren(new IVisitor<Component, Boolean>() {
@Override
public void component(Component object, IVisit<Boolean> visit) {
object.configure();
if (object.isVisible()) {
visit.stop(Boolean.TRUE);
} else {
visit.dontGoDeeper();
}
}
});
if (visible == null) {
visible = false;
}
setVisible(visible);
}
示例5: invokeForcedButtonOnValidationError
import org.apache.wicket.util.visit.IVisit; //导入依赖的package包/类
protected void invokeForcedButtonOnValidationError(final Component component) {
/*
* On forced button method we need to synchronize all valid properties into the model and reset all invalid ones
* with the values of the model.
*/
final Component root = Components.findRoot(component);
final Form<?> form = Components.findForm(root);
FormComponent.visitFormComponentsPostOrder(form, new IVisitor<FormComponent<?>, Void>() {
@Override
public void component(final FormComponent<?> object, final IVisit<Void> visit) {
if (object.isEnabledInHierarchy() && object.isVisibleInHierarchy() && !object.isValid()) {
/*
* need to clear individual components besides the form to make GridColumnBorder not display error
* even though there should be none because form was cleared
*/
object.clearInput();
object.getFeedbackMessages().clear();
}
}
});
//clear the form itself
form.clearInput();
form.getSession().getFeedbackMessages().clear();
invokeButtonMethod(component);
}
示例6: updateValidModelsOnValidationError
import org.apache.wicket.util.visit.IVisit; //导入依赖的package包/类
/**
* Synchronize valid model values so that validator utilities have something to work with. This is useful in onError
* calls in submit behaviors
*/
public static boolean updateValidModelsOnValidationError(final Component component) {
final Component root = Components.findRoot(component);
final Form<?> form = Components.findForm(root);
final AtomicBoolean invalidFound = new AtomicBoolean(false);
FormComponent.visitFormComponentsPostOrder(form, new IVisitor<FormComponent<?>, Void>() {
@Override
public void component(final FormComponent<?> object, final IVisit<Void> visit) {
if (object.isEnabledInHierarchy() && object.isVisibleInHierarchy()
//fileUploadField chokes on FileNotFound if synchronized twice in a call!
&& !(object instanceof FileUploadField)) {
try {
object.updateModel(); //fill in values regardless of valid state, since complex validation rules might require all inputs
} catch (final Throwable t) {
//ignore
}
object.validate();
if (!object.isValid()) {
invalidFound.set(true);
}
}
}
});
return invalidFound.get();
}
示例7: rememberAllFeedbackMessages
import org.apache.wicket.util.visit.IVisit; //导入依赖的package包/类
/**
* This method is called on each page refresh to remember the previous state of feedback messages for rollback
*/
public static void rememberAllFeedbackMessages(final Component component) {
Assertions.assertThat(RequestCycle.get().getMetaData(KEY_PREVIOUS_MESSAGES)).isNull();
//CHECKSTYLE:OFF
final Map<String, List<FeedbackMessage>> markupId_previousMessages = new HashMap<String, List<FeedbackMessage>>();
//CHECKSTYLE:ON
component.getPage().visitChildren(new IVisitor<Component, Void>() {
@Override
public void component(final Component object, final IVisit<Void> visit) {
if (object.hasFeedbackMessage()) {
final List<FeedbackMessage> previousMessages = new ArrayList<FeedbackMessage>(
object.getFeedbackMessages().toList());
markupId_previousMessages.put(object.getMarkupId(), previousMessages);
}
}
});
RequestCycle.get().setMetaData(KEY_PREVIOUS_MESSAGES, markupId_previousMessages);
}
示例8: rollbackAllFeedbackMessages
import org.apache.wicket.util.visit.IVisit; //导入依赖的package包/类
public static void rollbackAllFeedbackMessages(final Component component) {
final Map<String, List<FeedbackMessage>> markupId_previousMessages = RequestCycle.get()
.getMetaData(KEY_PREVIOUS_MESSAGES);
Assertions.assertThat(markupId_previousMessages).isNotNull();
component.getPage().visitChildren(new IVisitor<Component, Void>() {
@Override
public void component(final Component object, final IVisit<Void> visit) {
if (object != component) {
object.getFeedbackMessages().clear();
final List<FeedbackMessage> previousMessages = markupId_previousMessages.get(object.getMarkupId());
if (previousMessages != null) {
for (final FeedbackMessage previousMessage : previousMessages) {
object.getFeedbackMessages().add(previousMessage);
}
}
}
}
});
RequestCycle.get().setMetaData(KEY_PREVIOUS_MESSAGES, null);
}
示例9: getDateTextField
import org.apache.wicket.util.visit.IVisit; //导入依赖的package包/类
/**
* Gets the DateTextField inside this datepicker wrapper.
*
* @return the date field
*/
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("BootstrapDateTimepicker didn't have any DateTextField child!");
}
return component;
}
示例10: onConfigure
import org.apache.wicket.util.visit.IVisit; //导入依赖的package包/类
@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
public void component(FormComponent<?> arg0, IVisit<Boolean> arg1) {
if (arg0.equals(msg.getReporter()))
arg1.stop(true);
}
});
if (b == null)
return false;
return b;
}
};
}
示例11: accept
import org.apache.wicket.util.visit.IVisit; //导入依赖的package包/类
@Override
public boolean accept(final FeedbackMessage message) {
if(BootstrapFeedbackPanel.this.getParent()!=null){
BootstrapFeedbackPopover innerAccepted = BootstrapFeedbackPanel.this.getParent()
.visitChildren(BootstrapFeedbackPopover.class, new IVisitor<BootstrapFeedbackPopover, BootstrapFeedbackPopover>() {
@Override
public void component(BootstrapFeedbackPopover object, IVisit<BootstrapFeedbackPopover> visit) {
if(object.getFilter().accept(message)){
visit.stop(object);
}
}
});
return innerAccepted==null;
}
return true;
}
示例12: onInitialize
import org.apache.wicket.util.visit.IVisit; //导入依赖的package包/类
@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
public void component(FormComponent<?> arg0, IVisit<Boolean> arg1) {
if (arg0.equals(msg.getReporter()))
arg1.stop(true);
}
});
if (b == null)
return false;
return b;
}
};
}
示例13: findComponentByProp
import org.apache.wicket.util.visit.IVisit; //导入依赖的package包/类
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, (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);
}
});
}
示例14: searchLog
import org.apache.wicket.util.visit.IVisit; //导入依赖的package包/类
private Component searchLog(final String property, final String searchPath, final String key) {
Component component = TESTER.getComponentFromLastRenderedPage(searchPath);
Component result = component.getPage().
visitChildren(ListItem.class, (final ListItem<LoggerTO> object, final IVisit<Component> visit) -> {
try {
if (object.getModelObject() instanceof LoggerTO && PropertyResolver.getPropertyGetter(
property, object.getModelObject()).invoke(object.getModelObject()).equals(key)) {
visit.stop(object);
}
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
LOG.error("Error invoke method", ex);
}
});
return result;
}
示例15: updatePage
import org.apache.wicket.util.visit.IVisit; //导入依赖的package包/类
public void updatePage(AjaxRequestTarget target) {
MarkupContainer root = SynchronizerHelper.findRoot(target.getPage());
IVisitor<Component, Object> visitor = new IVisitor<Component, Object>() {
@Override
public void component(Component object, IVisit<Object> visit) {
if (object instanceof MarkupContainer && object.getClass().equals(page.getClass())
&& StringUtils.equals(page.getId(), object.getId())) {
DMDWebGenPageContext.this.page = (MarkupContainer) object;
pageUpdated = true;
}
}
};
visitor.component(root, null);
root.visitChildren(visitor);
if (pageUpdated == null) {
pageUpdated = false;
}
}