You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Petr Fejfar <pe...@gmail.com> on 2009/07/13 15:21:57 UTC

How to show/hide, enable/disable items in menu based on YUI menu2

Hi all,

I'm still trying to build menubar based on YUI menu2 from wicketstuff
and still have a problems: currently I'd like to hide/show ev. to enable/disable
some menu items (YuiMenuBarItem) in dependence of actions taken
by commands related to this menu bar.

If I tried to add those menu items into AjaxRequestTarget to be refreshed,
I get run-time java.lang.IllegalStateException: Ajax render cannot be called
on component that has setRenderBodyOnly enabled.

If I tried switch rendering of full markup on, there is some kind of refresh,
but the menu does not work correctly e.g. from refreshed menu submenus
have disappeared
etc...

Please, could somebody help me to refresh status/visibility of menu
items?


Thanks, Petr

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


Re: How to show/hide, enable/disable items in menu based on YUI menu2

Posted by Joshua Lim <li...@gmail.com>.
Hi Petr, The table would be interesting, could you email it to me ? thanks
I'll take a look at the rest of the yuimenu when I reach that point. :)

Joshua

2009/7/17 Petr Fejfar <pe...@gmail.com>

> On Thu, Jul 16, 2009 at 4:25 PM, Joshua Lim<li...@gmail.com> wrote:
>
> > Did you check out yui as well? This marks disappears should be redrawn
> > in the new code.
>
> Yes. I tested it on revision 4808 from July 15.
>
>
> > What browser are you using though I 've only tested on FF.
>
> I see. While learning Wicket I use Google Chrome (because it shows
> source code using small fonts and offers live hrefs there). I've spent
> some time and retest all wicketstuff Yui examples with 4 browsers we
> tries to be compatible with. Please find out attached table - maybe it
> could be usefull for someone else as well.
>
>
> > btw, I am not the original author for the menu bar, so I have still to
> figure out that bits.
>
> Anyway, if you would be able to fix it, it would be great (at least
> for me), because even if I'm SW engineer with 30+ years experience,
> I'm a beginner in the Java, EE and Ajax field.
>
>
> Petr
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

Re: How to show/hide, enable/disable items in menu based on YUI menu2

Posted by Joshua Lim <li...@gmail.com>.
updated menubar with menuitems check/disable/selected options it should work
on FF at least.

josh

2009/7/17 Petr Fejfar <pe...@gmail.com>

> On Thu, Jul 16, 2009 at 11:43 PM, Petr Fejfar<pe...@gmail.com>
> wrote:
>
> > tries to be compatible with. Please find out attached table - maybe it
> > could be usefull for someone else as well.
>
> Errata: in the Menu test on Google Chrome, there should be "(it seems
> the value does *not* toggle)"
>
> Petr
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: How to show/hide, enable/disable items in menu based on YUI menu2

Posted by Petr Fejfar <pe...@gmail.com>.
On Thu, Jul 16, 2009 at 11:43 PM, Petr Fejfar<pe...@gmail.com> wrote:

> tries to be compatible with. Please find out attached table - maybe it
> could be usefull for someone else as well.

Errata: in the Menu test on Google Chrome, there should be "(it seems
the value does *not* toggle)"

Petr

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


Re: How to show/hide, enable/disable items in menu based on YUI menu2

Posted by Petr Fejfar <pe...@gmail.com>.
On Thu, Jul 16, 2009 at 4:25 PM, Joshua Lim<li...@gmail.com> wrote:

> Did you check out yui as well? This marks disappears should be redrawn
> in the new code.

Yes. I tested it on revision 4808 from July 15.


> What browser are you using though I 've only tested on FF.

I see. While learning Wicket I use Google Chrome (because it shows
source code using small fonts and offers live hrefs there). I've spent
some time and retest all wicketstuff Yui examples with 4 browsers we
tries to be compatible with. Please find out attached table - maybe it
could be usefull for someone else as well.


> btw, I am not the original author for the menu bar, so I have still to figure out that bits.

Anyway, if you would be able to fix it, it would be great (at least
for me), because even if I'm SW engineer with 30+ years experience,
I'm a beginner in the Java, EE and Ajax field.


Petr


Re: How to show/hide, enable/disable items in menu based on YUI menu2

Posted by Joshua Lim <li...@gmail.com>.
2009/7/16 Petr Fejfar <pe...@gmail.com>

>
>
> thank for your effort. I tried your improvements, but it stil does not
> work for me. It is possible that I'm missing something, but some
> problems can be seen in your yui-example as well: After you click
> M2:L3 item to remove 1st item from menu:
> - all marks indicating an item has a submenu disappears
> - the menubar losts its dynamic behaveour i.e. mouse over does nothing



Did you check out yui as well? This marks disappears should be redrawn
in the new code. What browser are you using though I 've only tested on FF.



>
> - a click into any menubar's item "returns" it into regular behaveour
>

> This is probably the major problem. More, I've tried extend your example:
>
> - by adding Enable/Disable toggle with behaveour same as in the removing
> case
>
>                subMenu2.addMenuItem(new AjaxLinkAction("M2 : L6 (Ajax) -
> disables 2nd item")
>                {
>                        @Override
>                        public void onClick(AjaxRequestTarget target)
>                        {
>                                MenuBar2Page.this.info
> (getName().getObject());
>                                m2L2.setEnabled(!m2L2.isEnabled());
>                                target.addComponent(feedback);
>                                target.addComponent(mb);
>                        }
>                });
>
>
> - by adding Checked toggle - it toggles value, but it seems there is
> no checked mark
>
>                m2L7 = subMenu2.addMenuItem(new AjaxLinkAction("M2 : L7
> (Ajax) -
> toggles itself")
>                {
>                        @Override
>                        public void onClick(AjaxRequestTarget target)
>                        {
>                                MenuBar2Page.this.info
> (getName().getObject());
>                                System.out.println("Check togle:
> "+m2L7.isChecked());
>                                m2L7.setChecked(!m2L7.isChecked());
>                                target.addComponent(feedback);
>                                target.addComponent(mb);
>                        }
>                });
>
>
> Please, if you would have some time, could you try to fix it?
>

not sure about the "setChecked" yet, as its not something I am working on.
btw, I am not the original author for the menu bar, so I have still to
figure out that bits.



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

Re: How to show/hide, enable/disable items in menu based on YUI menu2

Posted by Petr Fejfar <pe...@gmail.com>.
> I've made some changes on the trunk to allow AjaxLinkAction, and remove the
> setRenderBodyOnly so that you can basically modify the menu 'ajaxically'.
[...]
> check out the yui-examples

Hi Joshua,

thank for your effort. I tried your improvements, but it stil does not
work for me. It is possible that I'm missing something, but some
problems can be seen in your yui-example as well: After you click
M2:L3 item to remove 1st item from menu:
- all marks indicating an item has a submenu disappears
- the menubar losts its dynamic behaveour i.e. mouse over does nothing
- a click into any menubar's item "returns" it into regular behaveour

This is probably the major problem. More, I've tried extend your example:

- by adding Enable/Disable toggle with behaveour same as in the removing case

		subMenu2.addMenuItem(new AjaxLinkAction("M2 : L6 (Ajax) - disables 2nd item")
		{
			@Override
			public void onClick(AjaxRequestTarget target)
			{
				MenuBar2Page.this.info(getName().getObject());
				m2L2.setEnabled(!m2L2.isEnabled());
				target.addComponent(feedback);
				target.addComponent(mb);
			}
		});


- by adding Checked toggle - it toggles value, but it seems there is
no checked mark

		m2L7 = subMenu2.addMenuItem(new AjaxLinkAction("M2 : L7 (Ajax) -
toggles itself")
		{
			@Override
			public void onClick(AjaxRequestTarget target)
			{
				MenuBar2Page.this.info(getName().getObject());
				System.out.println("Check togle: "+m2L7.isChecked());
				m2L7.setChecked(!m2L7.isChecked());
				target.addComponent(feedback);
				target.addComponent(mb);
			}
		});


Please, if you would have some time, could you try to fix it?

Thanks, Petr

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


Re: How to show/hide, enable/disable items in menu based on YUI menu2

Posted by Joshua Lim <li...@gmail.com>.
Hi

I've made some changes on the trunk to allow AjaxLinkAction, and remove the
setRenderBodyOnly so that you can basically modify the menu 'ajaxically'.

Also I've applied the yui-sam-skin by default for YuiMenuBar and YuiMenu.
and it is now using YuiLoader and 2.7.0

check out the yui-examples

HTH
Josh





2009/7/13 Petr Fejfar <pe...@gmail.com>

> Hi all,
>
> I'm still trying to build menubar based on YUI menu2 from wicketstuff
> and still have a problems: currently I'd like to hide/show ev. to
> enable/disable
> some menu items (YuiMenuBarItem) in dependence of actions taken
> by commands related to this menu bar.
>
> If I tried to add those menu items into AjaxRequestTarget to be refreshed,
> I get run-time java.lang.IllegalStateException: Ajax render cannot be
> called
> on component that has setRenderBodyOnly enabled.
>
> If I tried switch rendering of full markup on, there is some kind of
> refresh,
> but the menu does not work correctly e.g. from refreshed menu submenus
> have disappeared
> etc...
>
> Please, could somebody help me to refresh status/visibility of menu
> items?
>
>
> Thanks, Petr
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>