List of usage examples for org.apache.wicket.feedback FeedbackMessage getReporter
public final Component getReporter()
From source file:com.googlecode.wicketwebbeans.containers.BeanForm.java
License:Apache License
/** * Construct a new BeanForm.//from w ww .jav a2 s .co m * * @param id the Wicket id for the panel. * @param bean the bean to be displayed. This may be an IModel or regular bean object. * The bean may be a List or, if an IModel, a model that returns a List. If so, the bean is display is * displayed using BeanTablePanel. Otherwise BeanGridPanel is used. * @param beanMetaData the meta data for the bean. If bean is a List or model of a List, then this must be * the BeanMetaData for a single element (row) of the List. * @param container an optional container to use in place of the default BeanGridPanel or BeanTablePanel. This container must must be a Panel and * implement a constructor of the form: <p> * <code>public Constructor(String id, final Object bean, BeanMetaData beanMetaData, TabMetaData tabMetaData)</code> * <p> * where id = Wicket component ID<br> * bean = the bean, or IModel containing the bean<br> * beanMetaData = the BeanMetaData for bean<br> * tabMetaData = the tab metadata<p> * May be null. */ @SuppressWarnings("serial") public BeanForm(String id, final Object bean, final BeanMetaData beanMetaData, final Class<? extends Panel> container) { super(id); this.bean = bean; this.beanMetaData = beanMetaData; this.container = container; form = new Form("f") { // Track whether the form is in submit processing. @Override public boolean process() { ++submitCnt; try { return super.process(); } finally { --submitCnt; } } }; form.setOutputMarkupId(true); add(form); String title = beanMetaData.getLabel(); form.add(new Label("title", title)); form.add(new Label("beanFormIndicatorErrorLabel", new ResourceModel("beanFormError.msg", "An error occurred on the server. Your session may have timed out."))); beanMetaData.consumeParameter(PARAM_ROWS); final HiddenField hiddenFocusField = new HiddenField<String>("focusField", new PropertyModel<String>(this, "focusField")); hiddenFocusField.add(new AbstractBehavior() { @Override public void onComponentTag(Component component, ComponentTag tag) { tag.put("id", "bfFocusField"); super.onComponentTag(component, tag); } }); form.add(hiddenFocusField); formVisitor = new FormVisitor(); createTabs(bean, beanMetaData, container); // Use a FeedbackMessageFilter to handle messages for multiple BeanForms on a page. This is because messages are stored on the session. IFeedbackMessageFilter feedbackFilter = new IFeedbackMessageFilter() { public boolean accept(FeedbackMessage message) { // If the reporter is a field and this is refreshing because of a non-Ajax form submit, it's very likely that the field has been detached // from its parent because it is in a list view. As a result, findParent doesn't return the BeanForm. Component reporter = message.getReporter(); AbstractField reporterField = (AbstractField) (reporter instanceof AbstractField ? reporter : reporter.findParent(AbstractField.class)); if (reporterField != null) { return reporterField.getBeanForm().getId().equals(BeanForm.this.getId()); } Component parent = (reporter instanceof BeanForm ? reporter : reporter.findParent(BeanForm.class)); return reporter == BeanForm.this || parent == null || parent == BeanForm.this; } }; feedback = new FeedbackPanel("feedback", feedbackFilter); feedback.setOutputMarkupId(true); form.add(feedback); createGlobalActions(); }
From source file:com.locke.library.web.panels.feedback.GlobalFeedbackPanel.java
License:Apache License
public GlobalFeedbackPanel(String id) { super(id, new IFeedbackMessageFilter() { private static final long serialVersionUID = -6916795669026332590L; public boolean accept(FeedbackMessage message) { return message.getReporter().findParent(LocalFeedbackContainer.class) == null; }//from w ww. j av a 2s. c om }); }
From source file:com.locke.library.web.panels.feedback.LocalFeedbackPanel.java
License:Apache License
public LocalFeedbackPanel(String id, final LocalFeedbackContainer container) { super(id, new IFeedbackMessageFilter() { private static final long serialVersionUID = -1883211501894198761L; public boolean accept(FeedbackMessage message) { return container.contains(message.getReporter(), true); }/*from w ww. j a v a2 s . c o m*/ }); }
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 . j a 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.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/*w w w . ja va2 s. c om*/ 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.BootstrapFeedbackPopover.java
License:Open Source License
@Override protected void onBeforeRender() { super.onBeforeRender(); List<FeedbackMessage> msgs = model.getObject(); messages = new HashMap<Component, List<FeedbackMessage>>(); for (FeedbackMessage msg : msgs) { if (!messages.containsKey(msg.getReporter())) messages.put(msg.getReporter(), new ArrayList<FeedbackMessage>()); messages.get(msg.getReporter()).add(msg); msg.markRendered();/* www. jav a 2 s . c o m*/ } }
From source file:com.senacor.wbs.web.core.layout.BaseWBSPage.java
License:Apache License
public boolean accept(final FeedbackMessage message) { if (message.getReporter() == null) { return false; }/* w w w . java 2 s . c o m*/ for (MarkupContainer container : containerList) { if (container.contains(message.getReporter(), true) || (container == message.getReporter())) { return false; } } return true; }
From source file:com.userweave.module.methoden.questionnaire.page.survey.AnswerPanel.java
License:Open Source License
public AnswerPanel(String id, T question, QuestionnaireSurveyContext context, Locale locale) { super(id);// www. ja v a 2 s .co m this.selectedLocale = locale; this.context = context; final Integer questionId = question.getId(); LoadableDetachableModel questionModel = new LoadableDetachableModel() { @Override protected Object load() { return getQuestionDao().findById(questionId); } }; setDefaultModel(new CompoundPropertyModel(questionModel)); AnswerFeedbackPanel feedback = new AnswerFeedbackPanel("feedback"); feedback.setFilter(new IFeedbackMessageFilter() { @Override public boolean accept(FeedbackMessage message) { return AnswerPanel.this.contains(message.getReporter(), true); } }); add(feedback); add(new Label("text", new LocalizedPropertyModel(questionModel, "text", getLocale()))); }
From source file:com.visural.wicket.message.filter.NoMessagesFromWithin.java
License:Apache License
public boolean accept(FeedbackMessage message) { return (message.getReporter() == null || !container.contains(message.getReporter(), true)); }
From source file:ee.pri.rl.blog.web.page.common.message.GlobalFeedbackPanel.java
License:Open Source License
public GlobalFeedbackPanel(String id) { super(id, new IFeedbackMessageFilter() { private static final long serialVersionUID = -6916795669026332590L; public boolean accept(FeedbackMessage message) { return message.getReporter() == null; }/*from ww w . j a v a 2 s .co m*/ }); }