Package org.apache.wicket.feedback

Examples of org.apache.wicket.feedback.FeedbackCollector


  @Override
  public void onConfigure()
  {
    super.onConfigure();
    // Get the messages for the current page
    setVisible(new FeedbackCollector(getPage()).collect(getFeedbackMessageFilter())
      .size() > 0);
  }
View Full Code Here


    tester.startPage(page);

    FormTester ft = tester.newFormTester("form");
    ft.setValue("name", "999999999");
    ft.submit();
    assertEquals(0, new FeedbackCollector(page).collect().size());

    MaxLenValidator max = new MaxLenValidator();
    page.name.add(max);

    ft = tester.newFormTester("form");
    ft.setValue("name", "999999999");
    ft.submit();
    assertEquals(1, new FeedbackCollector(page).collect().size());
    // WICKET-5115 variables in default message are not substituted (was the case in 1.5.x)
    assertEquals("MAX ${len}", new FeedbackCollector(page).collect()
      .get(0)
      .getMessage()
      .toString());

    ft = tester.newFormTester("form");
    ft.setValue("name", "22");
    ft.submit();
    assertEquals(0, new FeedbackCollector(page).collect().size());

    MinLenValidator min = new MinLenValidator();
    page.name.add(min);

    ft = tester.newFormTester("form");
    ft.setValue("name", "22");
    ft.submit();
    assertEquals(1, new FeedbackCollector(page).collect().size());
    assertEquals("MINIMUM", new FeedbackCollector(page).collect()
      .get(0)
      .getMessage()
      .toString());

    ft = tester.newFormTester("form");
    ft.setValue("name", "7777777");
    ft.submit();
    assertEquals(0, new FeedbackCollector(page).collect().size());

    page.name.remove(min);

    ft = tester.newFormTester("form");
    ft.setValue("name", "22");
    ft.submit();
    assertEquals(0, new FeedbackCollector(page).collect().size());

    page.name.remove(max);

    ft = tester.newFormTester("form");
    ft.setValue("name", "999999999");
    ft.submit();
    assertEquals(0, new FeedbackCollector(page).collect().size());
  }
View Full Code Here

   * @return <code>List</code> of messages (as <code>String</code>s)
   * @see FeedbackMessage
   */
  public List<Serializable> getMessages(final int level)
  {
    List<FeedbackMessage> allMessages = new FeedbackCollector(getLastRenderedPage()).collect(new IFeedbackMessageFilter()
    {

      @Override
      public boolean accept(FeedbackMessage message)
      {
View Full Code Here

      @Override
      public String getObject()
      {
        final IFeedbackMessageFilter filter = feedback.getFilter();

        boolean error = new FeedbackCollector(getPage()).collect(
          new IFeedbackMessageFilter()
          {
            @Override
            public boolean accept(FeedbackMessage message)
            {
View Full Code Here

    tester.startPage(page);

    FormTester ft = tester.newFormTester("form");
    ft.setValue("name", "999999999");
    ft.submit();
    assertEquals(0, new FeedbackCollector(page).collect().size());

    MaxLenValidator max = new MaxLenValidator(page.name);
    page.form.add(max);

    ft = tester.newFormTester("form");
    ft.setValue("name", "999999999");
    ft.submit();
    assertEquals(1, new FeedbackCollector(page).collect().size());
    assertEquals("MAX", new FeedbackCollector(page).collect()
      .get(0)
      .getMessage()
      .toString());

    ft = tester.newFormTester("form");
    ft.setValue("name", "22");
    ft.submit();
    assertEquals(0, new FeedbackCollector(page).collect().size());

    MinLenValidator min = new MinLenValidator(page.name);
    page.form.add(min);

    ft = tester.newFormTester("form");
    ft.setValue("name", "22");
    ft.submit();
    assertEquals(1, new FeedbackCollector(page).collect().size());
    assertEquals("MINIMUM", new FeedbackCollector(page).collect()
      .get(0)
      .getMessage()
      .toString());

    ft = tester.newFormTester("form");
    ft.setValue("name", "7777777");
    ft.submit();
    assertEquals(0, new FeedbackCollector(page).collect().size());

    page.form.remove(min);

    ft = tester.newFormTester("form");
    ft.setValue("name", "22");
    ft.submit();
    assertEquals(0, new FeedbackCollector(page).collect().size());

    page.form.remove(max);

    ft = tester.newFormTester("form");
    ft.setValue("name", "999999999");
    ft.submit();
    assertEquals(0, new FeedbackCollector(page).collect().size());

  }
View Full Code Here

   * @return <code>List</code> of messages (as <code>String</code>s)
   * @see FeedbackMessage
   */
  public List<Serializable> getMessages(final int level)
  {
    List<FeedbackMessage> allMessages = new FeedbackCollector(getLastRenderedPage()).collect(new IFeedbackMessageFilter()
    {

      @Override
      public boolean accept(FeedbackMessage message)
      {
View Full Code Here

    tester.startPage(page);

    FormTester ft = tester.newFormTester("form");
    ft.setValue("name", "999999999");
    ft.submit();
    assertEquals(0, new FeedbackCollector(page).collect().size());

    MaxLenValidator max = new MaxLenValidator();
    page.name.add(max);

    ft = tester.newFormTester("form");
    ft.setValue("name", "999999999");
    ft.submit();
    assertEquals(1, new FeedbackCollector(page).collect().size());
    assertEquals("MAX", new FeedbackCollector(page).collect()
      .get(0)
      .getMessage()
      .toString());

    ft = tester.newFormTester("form");
    ft.setValue("name", "22");
    ft.submit();
    assertEquals(0, new FeedbackCollector(page).collect().size());

    MinLenValidator min = new MinLenValidator();
    page.name.add(min);

    ft = tester.newFormTester("form");
    ft.setValue("name", "22");
    ft.submit();
    assertEquals(1, new FeedbackCollector(page).collect().size());
    assertEquals("MINIMUM", new FeedbackCollector(page).collect()
      .get(0)
      .getMessage()
      .toString());

    ft = tester.newFormTester("form");
    ft.setValue("name", "7777777");
    ft.submit();
    assertEquals(0, new FeedbackCollector(page).collect().size());

    page.name.remove(min);

    ft = tester.newFormTester("form");
    ft.setValue("name", "22");
    ft.submit();
    assertEquals(0, new FeedbackCollector(page).collect().size());

    page.name.remove(max);

    ft = tester.newFormTester("form");
    ft.setValue("name", "999999999");
    ft.submit();
    assertEquals(0, new FeedbackCollector(page).collect().size());
  }
View Full Code Here

   * @return <code>List</code> of messages (as <code>String</code>s)
   * @see FeedbackMessage
   */
  public List<Serializable> getMessages(final int level)
  {
    List<FeedbackMessage> allMessages = new FeedbackCollector(getLastRenderedPage()).collect(new IFeedbackMessageFilter()
    {

      @Override
      public boolean accept(FeedbackMessage message)
      {
View Full Code Here

   * @return <code>List</code> of messages (as <code>String</code>s)
   * @see FeedbackMessage
   */
  public List<Serializable> getMessages(final int level)
  {
    List<FeedbackMessage> allMessages = new FeedbackCollector(getLastRenderedPage()).collect(new IFeedbackMessageFilter()
    {

      @Override
      public boolean accept(FeedbackMessage message)
      {
View Full Code Here

   * https://issues.apache.org/jira/browse/WICKET-5165
   */
  private void bindSessionIfNeeded()
  {
    // check for session feedback messages only
    FeedbackCollector collector = new FeedbackCollector();
    List<FeedbackMessage> feedbackMessages = collector.collect();
    if (feedbackMessages.size() > 0)
    {
      Session.get().bind();
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.feedback.FeedbackCollector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.