You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Conny Kühne <co...@gmail.com> on 2010/07/08 16:48:19 UTC

org.apache.wicket.WicketRuntimeException: Submit Button ... is not visible

I have an AjaxButton with

@Override
public boolean isVisible() {
  return  someFlag;
}

In a race condition, if user B sets someFlag to false, and then user A
clicks the button A gets the following exception

org.apache.wicket.WicketRuntimeException: Submit Button buttonName ... is
not visible

Any ideas how to circumvent this?

Conny

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/org-apache-wicket-WicketRuntimeException-Submit-Button-is-not-visible-tp2282413p2282413.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: org.apache.wicket.WicketRuntimeException: Submit Button ... is not visible

Posted by vov <vo...@mail.ru>.
Hi!
It is not a best solutions but you can try it

ajaxButton.add(new AjaxSelfUpdatingTimerBehavior(Duration.milliseconds(1)));
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/org-apache-wicket-WicketRuntimeException-Submit-Button-is-not-visible-tp2282413p2282506.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: org.apache.wicket.WicketRuntimeException: Submit Button ... is not visible

Posted by vov <vo...@mail.ru>.
Thanks. It working. But the button visibility will never be changed and
button will be visible in this case even if 'visibleFlag' changed to false.
This mean that is your change 'visibleFlag' to false than method onSubmit()
will be call
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/org-apache-wicket-WicketRuntimeException-Submit-Button-is-not-visible-tp2282413p2285760.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: org.apache.wicket.WicketRuntimeException: Submit Button ... is not visible

Posted by Sven Meier <sv...@meiers.net>.
callOnBeforeRenderIfNotVisible() ?

On 07/09/2010 12:26 PM, vov wrote:
> It can't work.
> Please, see org.apache.wicket.Component.internalBeforeRender() method.
> Method onBeforeRendering() colling only in case when visibility of component
> is true.
> In our example boolean variable 'available' false by default. This mean that
> component never be rendered.
>
> Can someone explain what I do not understand?
>
>    


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: org.apache.wicket.WicketRuntimeException: Submit Button ... is not visible

Posted by vov <vo...@mail.ru>.
It can't work. 
Please, see org.apache.wicket.Component.internalBeforeRender() method.
Method onBeforeRendering() colling only in case when visibility of component
is true.
In our example boolean variable 'available' false by default. This mean that
component never be rendered.

Can someone explain what I do not understand?

-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/org-apache-wicket-WicketRuntimeException-Submit-Button-is-not-visible-tp2282413p2283191.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: org.apache.wicket.WicketRuntimeException: Submit Button ... is not visible

Posted by Conny Kühne <co...@gmail.com>.

vov wrote:
> 
> But question is still open:)
> 
> Look to example
> 
> public static boolean visibleFlag = true;
> 
>   public VisibilityButtonTest()
>   {
>     Form<Void> form = new Form<Void>("form");
>     add(form);
>     AjaxButton ajaxButton = new AjaxButton("button1")
>     {
>       @Override
>       public boolean isVisible()
>       {
>         return visibleFlag;
>       }
> 
>       @Override
>       protected void onSubmit(AjaxRequestTarget target, Form<?> form)
>       {
>         // do nothing
>       }
>     };
>     form.add(ajaxButton);
>     form.add(new AjaxButton("button2")
>     {
>       @Override
>       protected void onSubmit(AjaxRequestTarget target, Form<?> form)
>       {
>         visibleFlag = false;
>       }
>     });
>   }
> 
> after open this page press to button2 and after to button1
> 

In that case Sven's solution should work.
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/org-apache-wicket-WicketRuntimeException-Submit-Button-is-not-visible-tp2282413p2283188.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: org.apache.wicket.WicketRuntimeException: Submit Button ... is not visible

Posted by vov <vo...@mail.ru>.
But question is still open:)

Look to example

public static boolean visibleFlag = true;

  public VisibilityButtonTest()
  {
    Form<Void> form = new Form<Void>("form");
    add(form);
    AjaxButton ajaxButton = new AjaxButton("button1")
    {
      @Override
      public boolean isVisible()
      {
        return visibleFlag;
      }

      @Override
      protected void onSubmit(AjaxRequestTarget target, Form<?> form)
      {
        // do nothing
      }
    };
    form.add(ajaxButton);
    form.add(new AjaxButton("button2")
    {
      @Override
      protected void onSubmit(AjaxRequestTarget target, Form<?> form)
      {
        visibleFlag = false;
      }
    });
  }

after open this page press to button2 and after to button1
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/org-apache-wicket-WicketRuntimeException-Submit-Button-is-not-visible-tp2282413p2282540.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: org.apache.wicket.WicketRuntimeException: Submit Button ... is not visible

Posted by Conny Kühne <co...@gmail.com>.
Thanks. That would have solved it. I am using setVisible(someFlag) now. Doh!
;)
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/org-apache-wicket-WicketRuntimeException-Submit-Button-is-not-visible-tp2282413p2282534.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: org.apache.wicket.WicketRuntimeException: Submit Button ... is not visible

Posted by Sven Meier <sv...@meiers.net>.
new AjaxButton() {
   private boolean available;

   onBeforeRender() {
     available = someFlag();
  }

   isVisible() {
     return available;
   }

   onSubmit() {
     if (!available) {
       error("no longer available");
     }
   }
}

Sven

On 07/08/2010 04:48 PM, Conny Kühne wrote:
> I have an AjaxButton with
>
> @Override
> public boolean isVisible() {
>    return  someFlag;
> }
>
> In a race condition, if user B sets someFlag to false, and then user A
> clicks the button A gets the following exception
>
> org.apache.wicket.WicketRuntimeException: Submit Button buttonName ... is
> not visible
>
> Any ideas how to circumvent this?
>
> Conny
>
>    


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: org.apache.wicket.WicketRuntimeException: Submit Button ... is not visible

Posted by Conny Kühne <co...@gmail.com>.

Pedro Santos wrote:
> 
> someFlag is an static variable?
> 

someFlag is actually a business method that queries the database. But for
the sake of this argument you could model it as static variable. Doesn't
change the problem.
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/org-apache-wicket-WicketRuntimeException-Submit-Button-is-not-visible-tp2282413p2282520.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: org.apache.wicket.WicketRuntimeException: Submit Button ... is not visible

Posted by Pedro Santos <pe...@gmail.com>.
someFlag is an static variable?

2010/7/8 Conny Kühne <co...@gmail.com>

>
> I have an AjaxButton with
>
> @Override
> public boolean isVisible() {
>  return  someFlag;
> }
>
> In a race condition, if user B sets someFlag to false, and then user A
> clicks the button A gets the following exception
>
> org.apache.wicket.WicketRuntimeException: Submit Button buttonName ... is
> not visible
>
> Any ideas how to circumvent this?
>
> Conny
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/org-apache-wicket-WicketRuntimeException-Submit-Button-is-not-visible-tp2282413p2282413.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Pedro Henrique Oliveira dos Santos