ListChoice gets updated BEFORE onSubmit is called

2007-12-16 Thread Dan Kaplan
Hello, I'm very new to wicket so this may be a duh situation, but here's
what I'm trying to do:

 

I have a form that shows you a ChoiceList of things.  You can select one and
then hit the submit button to delete that item.  I've written this
functionality but found that it doesn't work the way I want.  For some
reason, Wicket asks the ChoiceList for its list BEFORE the form's onSumbit
is called.  As a result, the page gets the list before the item is deleted.
And as a result of that, the item is still in the list even though it's been
removed from the database.  If I refresh my browser, the item disappears.
So, my question is, how do I get the ChoiceList to ask for its list AFTER
the form's onSubmit is called?  Here's my code (note that I'm extending
ChoiceList, but I don't think I'm overriding any related functionality):

 

//the choicelist

public class WorldChoiceList extends ListChoice {

 

@SpringBean

private WorldService worldService;

   

public WorldChoiceList(String id, IModel model) {

super(id);

setChoices(new LoadableDetachableModel() {

protected Object load() {

return worldService.allByName();

}

});

setChoiceRenderer(new IChoiceRenderer() {

public Object getDisplayValue(Object object) {

World w = ((World) object);

return w.getName() + , + w.getMaxX() + , + w.getMaxY();

}

 

public String getIdValue(Object object, int index) {

if (object.equals()) {

return ;

}

return String.valueOf(((World) object).getWorldId());

}

});

setModel(model);

setNullValid(false);

}

 

/**

 * This override makes it so that the List does not start with a blank
or a Choose One

 * label.

 * @param selected The selected object

 * @return 

 */

protected CharSequence getDefaultChoice(final Object selected) {

return ;

}

}

 

//the web page

public class AdminHome extends AdminPage {

 

@SpringBean

private WorldService worldService;

 

private World selected;

 

public AdminHome() {

add(new FeedbackPanel(feedback));

Form form = new Form(form) {

public void onSubmit() {

if (selected != null)

worldService.deleteWorld(selected);

}

};

form.add(new WorldChoiceList(worldList, new Model() {

public void setObject(final Object object) {

selected = (World) object;

}

}));

add(form);

 

add(new BookmarkablePageLink(createWorld, CreateWorld.class));

}

}

 

Thanks for any help :-)



Re: ListChoice gets updated BEFORE onSubmit is called

2007-12-16 Thread Johan Compagner
It has to get the list, because thats where the selected object comes
from. What you need to do is remove the object through that list or
call detach on the choice in the submit. That should also result in
the list being detached/cleared.

On 12/16/07, Dan Kaplan [EMAIL PROTECTED] wrote:
 Hello, I'm very new to wicket so this may be a duh situation, but here's
 what I'm trying to do:



 I have a form that shows you a ChoiceList of things.  You can select one and
 then hit the submit button to delete that item.  I've written this
 functionality but found that it doesn't work the way I want.  For some
 reason, Wicket asks the ChoiceList for its list BEFORE the form's onSumbit
 is called.  As a result, the page gets the list before the item is deleted.
 And as a result of that, the item is still in the list even though it's been
 removed from the database.  If I refresh my browser, the item disappears.
 So, my question is, how do I get the ChoiceList to ask for its list AFTER
 the form's onSubmit is called?  Here's my code (note that I'm extending
 ChoiceList, but I don't think I'm overriding any related functionality):



 //the choicelist

 public class WorldChoiceList extends ListChoice {



 @SpringBean

 private WorldService worldService;



 public WorldChoiceList(String id, IModel model) {

 super(id);

 setChoices(new LoadableDetachableModel() {

 protected Object load() {

 return worldService.allByName();

 }

 });

 setChoiceRenderer(new IChoiceRenderer() {

 public Object getDisplayValue(Object object) {

 World w = ((World) object);

 return w.getName() + , + w.getMaxX() + , + w.getMaxY();

 }



 public String getIdValue(Object object, int index) {

 if (object.equals()) {

 return ;

 }

 return String.valueOf(((World) object).getWorldId());

 }

 });

 setModel(model);

 setNullValid(false);

 }



 /**

  * This override makes it so that the List does not start with a blank
 or a Choose One

  * label.

  * @param selected The selected object

  * @return 

  */

 protected CharSequence getDefaultChoice(final Object selected) {

 return ;

 }

 }



 //the web page

 public class AdminHome extends AdminPage {



 @SpringBean

 private WorldService worldService;



 private World selected;



 public AdminHome() {

 add(new FeedbackPanel(feedback));

 Form form = new Form(form) {

 public void onSubmit() {

 if (selected != null)

 worldService.deleteWorld(selected);

 }

 };

 form.add(new WorldChoiceList(worldList, new Model() {

 public void setObject(final Object object) {

 selected = (World) object;

 }

 }));

 add(form);



 add(new BookmarkablePageLink(createWorld, CreateWorld.class));

 }

 }



 Thanks for any help :-)



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



WYMeditor / Ajax - Adding Javascript References to Header

2007-12-16 Thread Karl M. Davis




Hello all,

I'm trying to put together a Wicket component for WYMeditor (http://www.wymeditor.org/en/)
as an alternative to TinyMCE. If you haven't seen WYMeditor itself
before, check out the demo at http://demo.wymeditor.org/demo.html.
WYMeditor is dual-licensed under GPL and MIT.

After spending all day screwing around with _javascript_ references and
Firebug, though, it's now time to give up and ask for help. Everything
works fine up until I try to add this Ajax behavior to the page during
an Ajax event. Then, things get screwy. Here's what I have now:

public class WymEditorConverter extends AbstractDefaultAjaxBehavior
{
 private static final String FILE_JS_JQUERY_PACKED =
"jquery/jquery-1.1.3.1.pack.js";
 private static final String FILE_JS_JQUERY_PRETTY =
"jquery/jquery-1.1.3.1.js";
 private static final String FILE_JS_WYMEDITOR_PACKED =
"jquery.wymeditor.pack.js";
 private static final String FILE_JS_WYMEDITOR_PRETTY =
"jquery.wymeditor.js";
 private static final String FILE_JS_WYMEDITOR_AJAX =
"jquery.wymeditor-ajax.js";
 private static final String JS_UPDATE_EDITORS =
"wymUninitialize();";

 /* Snip ... */

 
 /**
 * @see
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#respond(org.apache.wicket.ajax.AjaxRequestTarget)
 */
 @Override
 protected void respond(AjaxRequestTarget target)
 {
 }

 /**
 * @see
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior#renderHead(org.apache.wicket.markup.html.IHeaderResponse)
 */
 @Override
 public void renderHead(IHeaderResponse response)
 {
  super.renderHead(response);

  // Add a reference for the jQuery _javascript_ file
  ResourceReference jsJquery = null;
  if
(Application.get().getConfigurationType().equals(Application.DEPLOYMENT))
   jsJquery = new CompressedResourceReference(Marker.class,
FILE_JS_JQUERY_PACKED);
  else
   jsJquery = new CompressedResourceReference(Marker.class,
FILE_JS_JQUERY_PRETTY);
  renderJsReference(response, jsJquery);
  // response.renderJavascriptReference(jsJquery);

  // Add a reference for the WYMeditor _javascript_ file
  ResourceReference jsWymeditor = null;
  if
(Application.get().getConfigurationType().equals(Application.DEPLOYMENT))
   jsWymeditor = new CompressedResourceReference(Marker.class,
FILE_JS_WYMEDITOR_PACKED);
  else
   jsWymeditor = new CompressedResourceReference(Marker.class,
FILE_JS_WYMEDITOR_PRETTY);
  renderJsReference(response, jsWymeditor);
  // response.renderJavascriptReference(jsWymeditor);

  // Add a reference for the WYMeditor-ajax _javascript_ file
  ResourceReference jsWymeditorAjax = new
CompressedResourceReference(Marker.class,
FILE_JS_WYMEDITOR_AJAX);
  // renderJsReference(response, jsWymeditorAjax);
  response.renderJavascriptReference(jsWymeditorAjax);

  // Add a reference for the CSS skin
  response.renderCSSReference(options.getSkin());

  // Add the WYMeditor init block
  response.renderOnLoadJavascript(getConversionJavascript());

  // Add in references for all of the plugin's _javascript_ files
  for (Plugin plugin : this.options.getPlugins())
   //
response.renderJavascriptReference(plugin.getPluginJavascript());
   renderJsReference(response, plugin.getPluginJavascript());
 }

 private static void renderJsReference(IHeaderResponse response,
ResourceReference reference)
 {
  if (RequestCycle.get().getRequestTarget() instanceof
AjaxRequestTarget)
  {
   StringBuilder importBuilder = new StringBuilder();
   importBuilder.append("var script =
document.createElement('script');\n");
   // importBuilder.append("script.id='tinyMCEScript';\n");
   importBuilder.append("script.src='';\n");
   importBuilder.append("script.type='text/_javascript_';\n");
  
importBuilder.append("document.getElementsByTagName('head')[0].appendChild(script);\n");
  
response.renderOnDomReadyJavascript(importBuilder.toString());
  }
  else
   response.renderJavascriptReference(reference);
 }

 /**
 * Returns the _javascript_ that is run to convert elements into
WYMeditors. This is made publically
 * accessible so that this _javascript_ can be run again, as
necessary, if elements are added to the page
 * via Ajax.
 * 
 * @return the _javascript_ that is run to convert elements into
WYMeditors
 * @see AjaxRequestTarget#appendJavascript(String)
 */
 private String getConversionJavascript()
 {
  StringBuilder editorInitJs = new StringBuilder();
  // editorInitJs.append("jQuery(function() {");
  // editorInitJs.append(JS_UPDATE_EDITORS);
  editorInitJs.append(" jQuery('" +
conversionSelector.getJquerySelector() + "').wymeditor({");
  editorInitJs.append(options.renderOptions());
  editorInitJs.append(" });");
  // editorInitJs.append("});");
  return editorInitJs.toString();
 }
}


Here's the jquery.wymeditor-ajax.js file; it's just got one function
that's used when adding WYMeditors via Ajax:

function wymUninitialize() {

 for(var i=0; i  WYM_INSTANCES.length; i++) 
 { 
  WYM_INSTANCES[i].update();
 }

 WYM_INSTANCES = null;
 WYM_INSTANCES = new Array();

}


I have a couple of questions about this whole 

Re: Suckerfish dropdowns for wicket

2007-12-16 Thread tsuresh

Hi Tames,
  It worked when I upgraded from wicket 1.2.6 to 1.3 and showed no error.
Would you please suggest me what change should I make in your code, so that
I would have no links in the topMenuItems. 
thanks.

Tames wrote:
 
 Hello.  I created the example (using Eclipse with MyEclipse plugin) and
 got no such error.  I did however, put in all the generics of MenuItem
 where needed (List, ArrayList, etc). Also, you have to add all of the
 various imports from org.apache.wicket, create your own MyFirstPage and
 MySecondPage classes.  Exported to Tomcat, and all worked fine. 
 topMenuItems is a Java ArrayList object - no magic there. I am using java
 version 1.6.0
 
 
 
 tsuresh wrote:
 
 Dear wicketeers
  Has any one tried Suckerfish dropdowns in wicket. I saw one examle of it
 in
 http://javathoughts.capesugarbird.com/2007/11/suckerfish-dropdowns-for-wicket.html
  
 I tried to run the example but some error was shown with the message no
 get method for topMenuItems. Can some one please  
 solve the problem and comment. 
 thanks
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Suckerfish-dropdowns-for-wicket-tp14208480p14360384.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: ListChoice gets updated BEFORE onSubmit is called

2007-12-16 Thread Dan Kaplan
Oh ok.  I didn't think about solving the problem with that approach.  Thanks

-Original Message-
From: Johan Compagner [mailto:[EMAIL PROTECTED] 
Sent: Sunday, December 16, 2007 2:10 AM
To: users@wicket.apache.org
Subject: Re: ListChoice gets updated BEFORE onSubmit is called

It has to get the list, because thats where the selected object comes
from. What you need to do is remove the object through that list or
call detach on the choice in the submit. That should also result in
the list being detached/cleared.

On 12/16/07, Dan Kaplan [EMAIL PROTECTED] wrote:
 Hello, I'm very new to wicket so this may be a duh situation, but here's
 what I'm trying to do:



 I have a form that shows you a ChoiceList of things.  You can select one
and
 then hit the submit button to delete that item.  I've written this
 functionality but found that it doesn't work the way I want.  For some
 reason, Wicket asks the ChoiceList for its list BEFORE the form's onSumbit
 is called.  As a result, the page gets the list before the item is
deleted.
 And as a result of that, the item is still in the list even though it's
been
 removed from the database.  If I refresh my browser, the item disappears.
 So, my question is, how do I get the ChoiceList to ask for its list AFTER
 the form's onSubmit is called?  Here's my code (note that I'm extending
 ChoiceList, but I don't think I'm overriding any related functionality):



 //the choicelist

 public class WorldChoiceList extends ListChoice {



 @SpringBean

 private WorldService worldService;



 public WorldChoiceList(String id, IModel model) {

 super(id);

 setChoices(new LoadableDetachableModel() {

 protected Object load() {

 return worldService.allByName();

 }

 });

 setChoiceRenderer(new IChoiceRenderer() {

 public Object getDisplayValue(Object object) {

 World w = ((World) object);

 return w.getName() + , + w.getMaxX() + , +
w.getMaxY();

 }



 public String getIdValue(Object object, int index) {

 if (object.equals()) {

 return ;

 }

 return String.valueOf(((World) object).getWorldId());

 }

 });

 setModel(model);

 setNullValid(false);

 }



 /**

  * This override makes it so that the List does not start with a blank
 or a Choose One

  * label.

  * @param selected The selected object

  * @return 

  */

 protected CharSequence getDefaultChoice(final Object selected) {

 return ;

 }

 }



 //the web page

 public class AdminHome extends AdminPage {



 @SpringBean

 private WorldService worldService;



 private World selected;



 public AdminHome() {

 add(new FeedbackPanel(feedback));

 Form form = new Form(form) {

 public void onSubmit() {

 if (selected != null)

 worldService.deleteWorld(selected);

 }

 };

 form.add(new WorldChoiceList(worldList, new Model() {

 public void setObject(final Object object) {

 selected = (World) object;

 }

 }));

 add(form);



 add(new BookmarkablePageLink(createWorld, CreateWorld.class));

 }

 }



 Thanks for any help :-)



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Suckerfish dropdowns for wicket

2007-12-16 Thread tsuresh

Hi Tames,
  It worked when I upgraded from wicket 1.2.6 to 1.3 and showed no error.
Would you please suggest me what change should I make in your code, so that
I would have no links in the topMenuItems. 
thanks.

Tames wrote:
 
 Hello.  I created the example (using Eclipse with MyEclipse plugin) and
 got no such error.  I did however, put in all the generics of MenuItem
 where needed (List, ArrayList, etc). Also, you have to add all of the
 various imports from org.apache.wicket, create your own MyFirstPage and
 MySecondPage classes.  Exported to Tomcat, and all worked fine. 
 topMenuItems is a Java ArrayList object - no magic there. I am using java
 version 1.6.0
 
 
 
 tsuresh wrote:
 
 Dear wicketeers
  Has any one tried Suckerfish dropdowns in wicket. I saw one examle of it
 in
 http://javathoughts.capesugarbird.com/2007/11/suckerfish-dropdowns-for-wicket.html
  
 I tried to run the example but some error was shown with the message no
 get method for topMenuItems. Can some one please  
 solve the problem and comment. 
 thanks
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Suckerfish-dropdowns-for-wicket-tp14208480p14360383.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: ModalWindow bug - unable to close when added AjaxButton in content of the window

2007-12-16 Thread Thies Edeling
Was there any resolution for this? I have the same thing with rc2 with a
valid form. From the javascript console:

*INFO: *
Initiating Ajax POST request on ../../?wicket:interface=:4:39:::0:2random=
0.745044540904514
*INFO: *Invoking pre-call handler(s)...
*INFO: *Received ajax response (457 characters)
*INFO: *
?xml version=1.0
 encoding=UTF-8?ajax-responseevaluate![CDATA[var win;
try {
win = window.parent.Wicket.Window;
} catch (ignore) {
}
if (typeof(win) == undefined || typeof(win.current) == undefined) {
  try {
 win = window.Wicket.Window;
  } catch (ignore) {
  }
}
if (typeof(win) != undefined  typeof(win.current) != undefined) {
window.parent.setTimeout(function() {
win.current.close();
}, 0);
}]]/evaluate/ajax-response
*INFO: *Response parsed. Now invoking steps...
*ERROR: *Exception evaluating javascript: TypeError:
window.parent.setTimeout is not a function


On Sep 20, 2007 9:58 AM, Vit Rozkovec [EMAIL PROTECTED] wrote:

 Yes, the form validates, I put the breakpoint at onSubmit and that
 method was invoked.
 I tried it also with empty form.
 The behavior is following:
 when I have only AjaxLinks in the form, it is ok.
 When I add AjaxButton, the behavior changes - the first time the modal
 window is displayed, it is possible to close the window with the cross
 in the upper right corner and with any AjaxLink I have in the form. But
 only when the first click goes to one of these elements.
 When I first click on the button to close the window, suddently the
 cross and the links became dead too.

 Vitek

 Matej Knopp wrote:
  Are you sure your Form validates, when you click AjaxLink? Because
  otherwise the onSubmit is not invoked. Can you put a breakpoint in
  onSubmit? Also there is onError handler that is invoked when form
  validation fails.
 
  -Matej
 
  On 9/14/07, Vit Rozkovec [EMAIL PROTECTED] wrote:
 
  I am sorry, I could not replicate it in quickstart. The button works
  fine there. For now I solved the problem by replacing AjaxButtons with
  AjaxLinks.
 
  Vitek
 
  Matej Knopp wrote:
 
  Plase create a jira issue and attach a quickstart to it. Thanks.
 
  -Matej
 
  On 9/13/07, Vit Rozkovec [EMAIL PROTECTED] wrote:
 
 
  Good day,
  I am using last snapshot of wicket and there is a problem with modal
  window - I create instance of the window and add it to the page. As a
  content I use a panel which has these components:
 
  public class ModalConfirmationPanel extends Panel {
 
  public ModalConfirmationPanel(String id, final ModalWindow
 window) {
  super(id);
 
  window.setTitle(getString(titulek));
 
  Form form = new Form(confirmation);
  add(form);
  form.add(new TextArea(explanation, new Model()));
  form.add(new AjaxLink(ok) {
  @Override
  public void onClick(AjaxRequestTarget target) {
  window.close(target);
  }
  });
  form.add(new AjaxLink(storno) {
  @Override
  public void onClick(AjaxRequestTarget target) {
  window.close(target);
  }
  });
  //form.add(new AjaxSubmitButton(buttonOk, form) {
  //@Override
  //protected void onSubmit(AjaxRequestTarget target, Form
 form) {
  //window.close(target);
  //}
  //});
  //form.add(new AjaxButton(buttonStorno, form) {
  //@Override
  //protected void onSubmit(AjaxRequestTarget target, Form
 form) {
  //window.close(target);
  //}
  //});
 
 
  When I uncomment the lines and add AjaxSubmitButtons or AjaxButtons,
 the
  modal window cannot be closed anymore, neither with the buttons, nor
  with the close button in the header or with links. When I add just
  links, it works ok. It does not matter if there is window.close()
 method
  in the button's onSubmit method.
 
  If you would like I can make a quickstart. I cannot test anymore, but
 in
  beta3 it worked.
 
  Vitek
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 




Re: ModalWindow bug - unable to close when added AjaxButton in content of the window

2007-12-16 Thread Thies Edeling
never mind, seems it's the same as 
https://issues.apache.org/jira/browse/WICKET-1003


Thies Edeling wrote:

Was there any resolution for this? I have the same thing with rc2 with a
valid form. From the javascript console:

*INFO: *
Initiating Ajax POST request on ../../?wicket:interface=:4:39:::0:2random=
0.745044540904514
*INFO: *Invoking pre-call handler(s)...
*INFO: *Received ajax response (457 characters)
*INFO: *
?xml version=1.0
 encoding=UTF-8?ajax-responseevaluate![CDATA[var win;
try {
win = window.parent.Wicket.Window;
} catch (ignore) {
}
if (typeof(win) == undefined || typeof(win.current) == undefined) {
  try {
 win = window.Wicket.Window;
  } catch (ignore) {
  }
}
if (typeof(win) != undefined  typeof(win.current) != undefined) {
window.parent.setTimeout(function() {
win.current.close();
}, 0);
}]]/evaluate/ajax-response
*INFO: *Response parsed. Now invoking steps...
*ERROR: *Exception evaluating javascript: TypeError:
window.parent.setTimeout is not a function


On Sep 20, 2007 9:58 AM, Vit Rozkovec [EMAIL PROTECTED] wrote:

  

Yes, the form validates, I put the breakpoint at onSubmit and that
method was invoked.
I tried it also with empty form.
The behavior is following:
when I have only AjaxLinks in the form, it is ok.
When I add AjaxButton, the behavior changes - the first time the modal
window is displayed, it is possible to close the window with the cross
in the upper right corner and with any AjaxLink I have in the form. But
only when the first click goes to one of these elements.
When I first click on the button to close the window, suddently the
cross and the links became dead too.

Vitek

Matej Knopp wrote:


Are you sure your Form validates, when you click AjaxLink? Because
otherwise the onSubmit is not invoked. Can you put a breakpoint in
onSubmit? Also there is onError handler that is invoked when form
validation fails.

-Matej

On 9/14/07, Vit Rozkovec [EMAIL PROTECTED] wrote:

  

I am sorry, I could not replicate it in quickstart. The button works
fine there. For now I solved the problem by replacing AjaxButtons with
AjaxLinks.

Vitek

Matej Knopp wrote:



Plase create a jira issue and attach a quickstart to it. Thanks.

-Matej

On 9/13/07, Vit Rozkovec [EMAIL PROTECTED] wrote:


  

Good day,
I am using last snapshot of wicket and there is a problem with modal
window - I create instance of the window and add it to the page. As a
content I use a panel which has these components:

public class ModalConfirmationPanel extends Panel {

public ModalConfirmationPanel(String id, final ModalWindow


window) {


super(id);

window.setTitle(getString(titulek));

Form form = new Form(confirmation);
add(form);
form.add(new TextArea(explanation, new Model()));
form.add(new AjaxLink(ok) {
@Override
public void onClick(AjaxRequestTarget target) {
window.close(target);
}
});
form.add(new AjaxLink(storno) {
@Override
public void onClick(AjaxRequestTarget target) {
window.close(target);
}
});
//form.add(new AjaxSubmitButton(buttonOk, form) {
//@Override
//protected void onSubmit(AjaxRequestTarget target, Form


form) {


//window.close(target);
//}
//});
//form.add(new AjaxButton(buttonStorno, form) {
//@Override
//protected void onSubmit(AjaxRequestTarget target, Form


form) {


//window.close(target);
//}
//});


When I uncomment the lines and add AjaxSubmitButtons or AjaxButtons,


the


modal window cannot be closed anymore, neither with the buttons, nor
with the close button in the header or with links. When I add just
links, it works ok. It does not matter if there is window.close()


method


in the button's onSubmit method.

If you would like I can make a quickstart. I cannot test anymore, but


in


beta3 it worked.

Vitek

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



  

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


  



  



-
To unsubscribe, e-mail: [EMAIL 

Re: Suckerfish dropdowns for wicket

2007-12-16 Thread Ryan Sonnek
this would make a great contribution to the wicketstuff project!

On Dec 16, 2007 5:41 AM, tsuresh [EMAIL PROTECTED] wrote:

 Hi Tames,
   It worked when I upgraded from wicket 1.2.6 to 1.3 and showed no error.
 Would you please suggest me what change should I make in your code, so that
 I would have no links in the topMenuItems.
 thanks.

 Tames wrote:
 
  Hello.  I created the example (using Eclipse with MyEclipse plugin) and
  got no such error.  I did however, put in all the generics of MenuItem
  where needed (List, ArrayList, etc). Also, you have to add all of the
  various imports from org.apache.wicket, create your own MyFirstPage and
  MySecondPage classes.  Exported to Tomcat, and all worked fine.
  topMenuItems is a Java ArrayList object - no magic there. I am using java
  version 1.6.0
 
 
 
  tsuresh wrote:
 
  Dear wicketeers
   Has any one tried Suckerfish dropdowns in wicket. I saw one examle of it
  in
  http://javathoughts.capesugarbird.com/2007/11/suckerfish-dropdowns-for-wicket.html
  I tried to run the example but some error was shown with the message no
  get method for topMenuItems. Can some one please
  solve the problem and comment.
  thanks
 
 
 

 --
 View this message in context: 
 http://www.nabble.com/Suckerfish-dropdowns-for-wicket-tp14208480p14360384.html

 Sent from the Wicket - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Two home pages?

2007-12-16 Thread John Krasnay
On Sat, Dec 15, 2007 at 08:44:32PM -0800, Cristina wrote:
 
 Hello,
 
 I'm working on an app where users and admins will perform mutually exclusive
 use cases. That's quite a common situation. It looks like the simpler
 approach here would be to return one home page with the user menu and
 another one with the admin menu. The choice would be placed in the Login
 page and executed according to the profile of the username that's trying to
 access the app.
 

A technique I've used is to have a dummy home page that just redirects
to one page or the other:

public class HomePage extends WebPage {
  public HomePage() {
if (isUser()) {
  setResponsePage(UserHomePage.class);
} else {
  setResponsePage(AdminHomePage.class);
}
  }
}

You don't even need a HomePage.html file.

jk

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Redirect to a page with POST parameters

2007-12-16 Thread Pills

Hello,

I'm looking for a way to redirect to an external page that needs some POST
parameters to works.

It will be used in a paiement system implementation (it needs some data like
currency, amount... passed using post parameters).

I know how to redirect a user to a simple url (with
getRequestCycle().setRequestTarget(...)), but I don't know how to define
post vars for it.


Thanks in advance ;)
-- 
View this message in context: 
http://www.nabble.com/Redirect-to-a-page-with-POST-parameters-tp14362262p14362262.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Redirect to a page with POST parameters

2007-12-16 Thread Johan Compagner
real Post variables are not directly possible (or you have to go to a page
that has a form pre filled in and you submit that when the page is loaded)

You can generate a GET url request with parameters and use the
RedirectRequestTarget
to redirect to it.

johan


On Dec 16, 2007 3:59 PM, Pills [EMAIL PROTECTED] wrote:


 Hello,

 I'm looking for a way to redirect to an external page that needs some POST
 parameters to works.

 It will be used in a paiement system implementation (it needs some data
 like
 currency, amount... passed using post parameters).

 I know how to redirect a user to a simple url (with
 getRequestCycle().setRequestTarget(...)), but I don't know how to define
 post vars for it.


 Thanks in advance ;)
 --
 View this message in context:
 http://www.nabble.com/Redirect-to-a-page-with-POST-parameters-tp14362262p14362262.html
 Sent from the Wicket - User mailing list archive at 
 Nabble.comhttp://nabble.com/
 .


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Two home pages?

2007-12-16 Thread Martijn Dashorst
Why not:
Application#getHomePage() {
if(!isUser()) { return AdminPage.class; }
return UserPage.class;
}

On Dec 16, 2007 2:46 PM, John Krasnay [EMAIL PROTECTED] wrote:

 On Sat, Dec 15, 2007 at 08:44:32PM -0800, Cristina wrote:
 
  Hello,
 
  I'm working on an app where users and admins will perform mutually
 exclusive
  use cases. That's quite a common situation. It looks like the simpler
  approach here would be to return one home page with the user menu and
  another one with the admin menu. The choice would be placed in the Login
  page and executed according to the profile of the username that's trying
 to
  access the app.
 

 A technique I've used is to have a dummy home page that just redirects
 to one page or the other:

 public class HomePage extends WebPage {
  public HomePage() {
if (isUser()) {
  setResponsePage(UserHomePage.class);
} else {
  setResponsePage(AdminHomePage.class);
}
  }
 }

 You don't even need a HomePage.html file.

 jk

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-rc1 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-rc1/


Re: Session.invalidate()

2007-12-16 Thread NateRedding

Cool, thanks! As you can probably tell, I am new to Wicket, and haven't quite
figured out all its nuances yet! So far, I love it though! Is there a good
article about nuances such as the difference between
setResponsePage(MyPage.class) and setResponsePage(new MyPage()) and/or one
that explains the request cycle in depth?

Thanks!
Nathan


igor.vaynberg wrote:
 
 right, i meant to say setresponsepage(mypage.class) :)
 
 -igor
 
 
 On Dec 15, 2007 3:30 PM, Johan Compagner [EMAIL PROTECTED] wrote:
 Wont that just result in page expire??

 Session.invalidat() doesnt invalidate at that time but at  the end of
 the request

 I see 2 options

 Session.invalidat()
 setResponsePage(new mypage());
 setRedirect(false)

 Or
 Session.invalidat()
 setResponsePage(mypage.class);
 setRedirect(true)



 On 12/15/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
  session.invalidate();
  setresponsepage(new mypage());
  requestcycle.setredirect(true); ===
 
  -igor
 
 
  On Dec 14, 2007 8:14 PM, NateRedding [EMAIL PROTECTED] wrote:
  
   Hello,
  
   I am writing a web application that has a need to log the user out
 when a
   certain action is performed. So, I do a Session.invalidate(). This
 takes
  me
   to the Page Expired Error Page that I set in my application settings.
   However, when this particular action is performed, I simply want to
 take
  the
   user to a different page other than the Page Expired Error Page that
 does
   not require the user to be authenticated. Any recommendations on how
 to
   accomplish this?
  
   Thanks,
   Nathan
   --
   View this message in context:
  http://www.nabble.com/Session.invalidate%28%29-tp14345242p14345242.html
   Sent from the Wicket - User mailing list archive at Nabble.com.
  
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Session.invalidate%28%29-tp14345242p14365139.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Streaming a huge ZIP file

2007-12-16 Thread Johan Compagner
Stupid me of not knowing anymore what i committed myself

AbstractResourceStreamWriter writer = new AbstractResourceStreamWriter()
{
write(OutputStream output)
{
   // do your generation and output
}
};
RequestCycle.get().setRequestTarget(new ResourceStreamRequestTarget(writer,
test.zip));
johan

P.S. not everything of this example is yet in a release (will be 1.3rc3)
On Dec 13, 2007 1:16 AM, Gabor Szokoli [EMAIL PROTECTED] wrote:

 On Dec 12, 2007 11:58 PM, Igor Vaynberg [EMAIL PROTECTED] wrote:
  ((WebResponse)r.getResponse).setAttachmentHeader(foo.xls);

 Indeed!
 Thank you.


 Gabor Szokoli

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




Re: Session.invalidate()

2007-12-16 Thread Eelco Hillenius
 Cool, thanks! As you can probably tell, I am new to Wicket, and haven't quite
 figured out all its nuances yet! So far, I love it though! Is there a good
 article about nuances such as the difference between
 setResponsePage(MyPage.class) and setResponsePage(new MyPage()) and/or one
 that explains the request cycle in depth?

I think Wicket In Action talks about that in detail.

setResponsePage(MyPage.class) results in Wicket redirecting to the
bookmarkable URL to MyPage so that after the redirect a page instance
is created.

SetResponsePage(MyPage()) makes Wicket handle the request directly
using the instance you provide (rather than redirecting to a
bookmarkable URL).

Eelco

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Two home pages?

2007-12-16 Thread Maurice Marrink
Or create a single page used by both user as an entry point and have
different menu options visible depending on the user.
Hint: a security framework like swarm can easily do this. :D ;)
http://wicketstuff.org/confluence/display/STUFFWIKI/Wicket-Security

Maurice

On Dec 16, 2007 5:02 PM, Martijn Dashorst [EMAIL PROTECTED] wrote:
 Why not:
 Application#getHomePage() {
 if(!isUser()) { return AdminPage.class; }
 return UserPage.class;
 }

 On Dec 16, 2007 2:46 PM, John Krasnay [EMAIL PROTECTED] wrote:


  On Sat, Dec 15, 2007 at 08:44:32PM -0800, Cristina wrote:
  
   Hello,
  
   I'm working on an app where users and admins will perform mutually
  exclusive
   use cases. That's quite a common situation. It looks like the simpler
   approach here would be to return one home page with the user menu and
   another one with the admin menu. The choice would be placed in the Login
   page and executed according to the profile of the username that's trying
  to
   access the app.
  
 
  A technique I've used is to have a dummy home page that just redirects
  to one page or the other:
 
  public class HomePage extends WebPage {
   public HomePage() {
 if (isUser()) {
   setResponsePage(UserHomePage.class);
 } else {
   setResponsePage(AdminHomePage.class);
 }
   }
  }
 
  You don't even need a HomePage.html file.
 
  jk
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 


 --
 Buy Wicket in Action: http://manning.com/dashorst
 Apache Wicket 1.3.0-rc1 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-rc1/


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Problem with hiding/showing components with AJAX and isVisible()

2007-12-16 Thread Mika Salminen
Hello,

I encountered a problem with hiding/showing components with ajax. If a
component is initially not visible according to the isVisible() method, it
is not rendered on the page. But if it becomes visible as an effect of
ajax request and I try to update it on the client by adding the component
to AjaxRequesTarget it will still not be shown.

I think that the problem is caused by the fact that if component is not
initially visible nothing, even a placeholder for the component is not
rendered to the client. So when ajax response that tries to replace the
component in DOM tree is executed on the client, it can not find any
component with the markup id and therefore can not replace some node that
does not exist.

There are multiple quite easy workarounds for this hiding problem. For
example using CSS visibility attribute (quite ugly), or placing the
component you are willing to hide and show in a markup container that is
always rendered and sending back update of this markup container in ajax
request instead of the contained component.

But I somehow think that it is quite peculiar that one needs to find
workarounds for this kind of trivial-looking task. I did not create bug
(or improvement request) yet because I want to know what others think
about this and I'm quite new to the framework so I might be doing
something wrong.

If it is necessary to make improvements to framework to fix this, how
about adding placeholders in HTML for non-rendered components. Instead of
not rendering anything at all, empty div or span with necessary markup id
could be rendered.

Thanks,

-Mika


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



DatePickerSettings and Time?

2007-12-16 Thread Karen Schaper
Hello,

I am looking for a component that I can use that will allow users to enter a
date and a time.

I was hoping to use the following 2 classes to accomplish this.

wicket.extensions.markup.html.datepicker.DatePickerSettings ;
wicket.extensions.markup.html.datepicker.PopupDatePicker;

I don't see a way to change the format to also allow for a time to be
entered.

Is there another package that has components that allow for a time picker?

Also I ran into a problem with using the date picker in a modal window.  It
didn't work.  Any workarounds for that?

Thanks for any help.

Karen


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: DatePickerSettings and Time?

2007-12-16 Thread Eelco Hillenius
On Dec 16, 2007 1:55 PM, Karen Schaper [EMAIL PROTECTED] wrote:
 Hello,

 I am looking for a component that I can use that will allow users to enter a
 date and a time.

 I was hoping to use the following 2 classes to accomplish this.

 wicket.extensions.markup.html.datepicker.DatePickerSettings ;
 wicket.extensions.markup.html.datepicker.PopupDatePicker;

 I don't see a way to change the format to also allow for a time to be
 entered.

 Is there another package that has components that allow for a time picker?

Please take a look at the wicket-datetime project.

Eelco

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problem with hiding/showing components with AJAX and isVisible()

2007-12-16 Thread Mika Salminen

Hi,

Thanks a lot. Did not expect to get the answer in 5 minutes =).  I should
have read the docs better since the improvement I was suggesting was already
implemented. You just got a new buyer for the book.

-Mika


-- 
View this message in context: 
http://www.nabble.com/Problem-with-hiding-showing-components-with-AJAX-and-isVisible%28%29-tp14366588p14367024.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]