Re: nested forms onSubmit

2010-01-30 Thread Dave Kallstrom
Nested forms in wicket component hierarachy. Not in html. You can nest forms
in wicket which are replaced when the page is rendered and swapped out for
divs.
http://cwiki.apache.org/WICKET/nested-forms.html

On Fri, Jan 29, 2010 at 5:38 PM, Riyad Kalla rka...@gmail.com wrote:

 Are nested forms a valid HTML construct? I'm running through the use-case
 here in my head and it doesn't click -- form submission is 1:1 with an HTTP
 POST, what do multiple embedded forms even mean in this regard?

 I don't think this is kosher...

 On Fri, Jan 29, 2010 at 2:04 PM, Dave Kallstrom dave.kallst...@gmail.com
 wrote:

  Hi,
  Is there anyway to notify nested forms that they are being submitted?
  The
  onSubmit method of nested forms do not get called when the parent form is
  submitted.
  I tried implementing IFormSubmitListener but that didn't seem to help.
 
  --
  Dave Kallstrom
 




-- 
Dave Kallstrom


nested forms onSubmit

2010-01-29 Thread Dave Kallstrom
Hi,
Is there anyway to notify nested forms that they are being submitted?  The
onSubmit method of nested forms do not get called when the parent form is
submitted.
I tried implementing IFormSubmitListener but that didn't seem to help.

-- 
Dave Kallstrom


Re: yui context menu after ajax request

2010-01-22 Thread Dave Kallstrom
So it turns out there were a couple of issues preventing the yui context
menu from working correctly after an ajax request.

Even though there was a call to clearContent on the context menu during the
on show event yui seemed to ignore this. This resulted in a doubling up of
some menu items especially sub menu items. I fixed this by calling
clearContent during the menu hide event.

The even worse problem was yui totally ignoring the menu updates if the menu
was not first destroyed. I fixed this by calling destroy on the menu before
calling all the javascript to create the menu. This really seems like
overkill to me but was the only way I could get it to work. I'm not sure why
calling clearContent after a destroy was necessary but this fixes all my
problems.

Also I did not see any reason to make the add method protected in
org.wicketstuff.yui.markup.html.menu2.contextMenu.Menu.
So I opened that up and made it public. This allows the caller to add menu
items and then refresh the panel via ajax and it all seems to work fine.

I have tested these changes in a simple app with one page and one panel. I
have also tested in a much more complicated app that contains a panel with
popup and over a dozen context menus each with two sub menus and so far I
have not found any problems.

I have attached a patch. Please let me know what you think. If you have any
suggestions please let me know.
I am happy to help out where I can...


On Mon, Jan 18, 2010 at 6:16 PM, Dave Kallstrom dave.kallst...@gmail.comwrote:

 Interesting... I'll give that a try.. Thanks...


 On Mon, Jan 18, 2010 at 6:06 PM, Alexander Elsholz 
 alexander.elsh...@widas.de wrote:

 for my problem with dojo this works:

 public void refreshMenu(AjaxRequestTarget pTarget) {

   String js =  dojo.addOnLoad(function(){\n + menu.generateJS()
 + \n}); ;
pTarget.appendJavascript(sss);
 }


 and i know the same stuff works for jquery and yui. the problem is that
 the
 header javascript brokes after rerendering the component (i think its a
 problem
 with object references because most browsers replace the object by
 creating a
 new one and the javascript stuff bind on the dom-bject). What seems to
 work is
 to put the javascript stuff into the body tag using the
 onComponentRendered()
 to reactivate the behavior.

 the ugly is you have to reload the menu in every ajax-event reredering the
 component with menu.

 hth
 alex


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




 --
 Dave Kallstrom




-- 
Dave Kallstrom
Index: src/main/java/org/wicketstuff/yui/markup/html/menu2/contextMenu/YuiContextMenuBehavior.java
===
--- src/main/java/org/wicketstuff/yui/markup/html/menu2/contextMenu/YuiContextMenuBehavior.java	(revision 5131)
+++ src/main/java/org/wicketstuff/yui/markup/html/menu2/contextMenu/YuiContextMenuBehavior.java	(working copy)
@@ -17,6 +17,8 @@
 
 public class YuiContextMenuBehavior extends AbstractDefaultAjaxBehavior {
 
+	private static final long serialVersionUID = -2453827056594475980L;
+	private static final String CONTEXT_MENU = ContextMenu;
 	private ListYuiContextMenu menus = new ArrayListYuiContextMenu();
 	private YuiContextMenu defaultMenu;
 
@@ -30,24 +32,24 @@
 		for (int i = 0; i  menus.length; i++) {
 			this.menus.add(menus[i]);
 		}
-		this.defaultMenu = this.menus.get( 0 );;
+		this.defaultMenu = this.menus.get(0);
 	}
-	
-	public void applyAttributes( Component comp, String menuId, IModel targetId ) {
-		YuiContextMenu menu = getMenuById( menuId );
-		assert( menu != null);
-		applyAttributes( comp, menu, targetId );
+
+	public void applyAttributes(Component comp, String menuId, IModelString targetId) {
+		YuiContextMenu menu = getMenuById(menuId);
+		assert (menu != null);
+		applyAttributes(comp, menu, targetId);
 	}
-	
-	public void applyAttributes( Component comp, YuiContextMenu menu, IModel targetId ) {
+
+	public void applyAttributes(Component comp, YuiContextMenu menu, IModelString targetId) {
 		comp.add(new AttributeModifier(targetId, true, targetId));
-		comp.add(new AttributeModifier(contextMenuId, true, new Model( menu.getMenuId(;
+		comp.add(new AttributeModifier(contextMenuId, true, new ModelString(menu.getMenuId(;
 	}
 
+	@Override
 	protected void respond(AjaxRequestTarget target) {
 		String action = RequestCycle.get().getRequest().getParameter(action);
-		String targetId = RequestCycle.get().getRequest().getParameter(
-targetId);
+		String targetId = RequestCycle.get().getRequest().getParameter(targetId);
 		String menuId = RequestCycle.get().getRequest().getParameter(contextMenuId);
 
 		YuiContextMenu menu = getMenuById(menuId);
@@ -79,43 +81,88 @@
 	}
 
 	public CharSequence getCallBackScriptForMenu(String action) {
-		return generateCallbackScript

Re: yui context menu after ajax request

2010-01-18 Thread Dave Kallstrom
Interesting... I'll give that a try.. Thanks...

On Mon, Jan 18, 2010 at 6:06 PM, Alexander Elsholz 
alexander.elsh...@widas.de wrote:

 for my problem with dojo this works:

 public void refreshMenu(AjaxRequestTarget pTarget) {

   String js =  dojo.addOnLoad(function(){\n + menu.generateJS()
 + \n}); ;
pTarget.appendJavascript(sss);
 }


 and i know the same stuff works for jquery and yui. the problem is that the
 header javascript brokes after rerendering the component (i think its a
 problem
 with object references because most browsers replace the object by creating
 a
 new one and the javascript stuff bind on the dom-bject). What seems to work
 is
 to put the javascript stuff into the body tag using the
 onComponentRendered()
 to reactivate the behavior.

 the ugly is you have to reload the menu in every ajax-event reredering the
 component with menu.

 hth
 alex


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




-- 
Dave Kallstrom