Re: [Wicket-user] DynamicWebResources, ResourceLinks, and URL Parameters

2007-07-02 Thread Karl M. Davis

Igor,

I actually did figure out a way to get this working without having to do 
any (major) hacking.  Pretty simple, too, once I figured it out.  I just 
created a new IndexedParamResourceUrlCodingStrategy class (included 
below) and mounted that.  For anyone else looking to do this, here is 
the relevant code:


// Register the resource with the web application
app.getSharedResources().add(resourceName, customResource);

// Mount the resource
ResourceReference ref = new ResourceReference(resourceName);
app.mount(new IndexedParamResourceUrlCodingStrategy(mountUrl, 
ref.getSharedResourceKey()));


That takes care of just about everything.  However, right about that 
point, you'll likely run into the following bug: 
https://issues.apache.org/jira/browse/WICKET-631.  I did have to hack 
around that a bit, unfortunately.  In my DynamicWebResource class, I 
added a cachedParams ThreadLocal and cache the parameter ValueMap 
during setHeaders(WebResponse) in it, because the parameters get wiped 
out before getResourceState() is called.  Here's the code for that in 
case anyone needs it:


public class SomeResource extends DynamicWebResource
{
private static ThreadLocalValueMap cachedParams;

...

/**
 * @see 
org.apache.wicket.markup.html.DynamicWebResource#setHeaders(org.apache.wicket.protocol.http.WebResponse)
 */
@Override
protected void setHeaders(WebResponse response)
{
super.setHeaders(response);
cachedParams.set(getParameters());
}

...

/**
 * @see 
org.apache.wicket.markup.html.DynamicWebResource#getResourceState()
 */
@Override
protected ResourceState getResourceState()
{
ValueMap params = cachedParams.get();
...
}
}


And voila!  I now have mounted resources with pretty indexed parameters 
like the following:


.../myresource/folderparam/folderparam/fileparam


I'm not sure how to go about submitting patches, but the following class 
would probably help others looking to do the same out.  I stole most of 
the code for it wholesale from IndexedParamUrlCodingStrategy, anyways.


/**
* This class is similar to [EMAIL PROTECTED] IndexedParamUrlCodingStrategy}, 
but for
* [EMAIL PROTECTED] Resource}s, not bookmarkable pages.
* 
* NOTE: The code for [EMAIL PROTECTED] #appendParameters(AppendingStringBuffer, Map)} and

* [EMAIL PROTECTED] #decodeParameters(String, Map)} was copied verbatim from
* [EMAIL PROTECTED] IndexedParamUrlCodingStrategy}.
* 
* @author Karl M. Davis

*/
public class IndexedParamResourceUrlCodingStrategy extends
SharedResourceRequestTargetUrlCodingStrategy
{
/**
 * Constructor.
	 * 
	 * @param mountPath

 *the path to mount the [EMAIL PROTECTED] Resource} at
 * @param resourceKey
 *the key of the [EMAIL PROTECTED] Resource} (see
 *[EMAIL PROTECTED] 
ResourceReference#getSharedResourceKey()})
 */
public IndexedParamResourceUrlCodingStrategy(String mountPath,
String resourceKey)
{
super(mountPath, resourceKey);
}

/**
 * @see 
org.apache.wicket.request.target.coding.AbstractRequestTargetUrlCodingStrategy#appendParameters(org.apache.wicket.util.string.AppendingStringBuffer,
 *  java.util.Map)
 */
protected void appendParameters(AppendingStringBuffer url, Map 
parameters)
{
int i = 0;
while (parameters.containsKey(String.valueOf(i)))
{
String value = (String) 
parameters.get(String.valueOf(i));
url.append(/).append(urlEncode(value));
i++;
}

String pageMap = (String) parameters
.get(WebRequestCodingStrategy.PAGEMAP);
if (pageMap != null)
{
i++;
url.append(/).append(WebRequestCodingStrategy.PAGEMAP)
.append(/).append(urlEncode(pageMap));
}

if (i != parameters.size())
{
throw new WicketRuntimeException(
Not all parameters were encoded. Make sure 
all parameter names are integers in consecutive order starting with zero. Current 
parameter names are: 
+ 
parameters.keySet().toString());
}
}

/**
 * @see 
org.apache.wicket.request.target.coding.AbstractRequestTargetUrlCodingStrategy#decodeParameters(java.lang.String,
 *  java.util.Map)
 */
protected ValueMap decodeParameters(String urlFragment, Map 
urlParameters

[Wicket-user] DynamicWebResources, ResourceLinks, and URL Parameters

2007-06-30 Thread Karl M. Davis
Hey there all,

I've got a DynamicWebResource that I'm mounting via 
mountSharedResource(...) and creating a ResourceLink to.  That Resource 
requires parameters and I'd love for it to operate similar to how 
IndexedParamUrlCodingStrategy works, where my parameters are numbered 
and look like just an extension of the URL.

For example:
.../myresource/folderparam/folderparam/fileparam

Any way to do that?  I've been poking around in WebRequestCodingStrategy 
and it looks like I could override some of the stuff there to get 
started, but that looks hackish and rather complicated.  I think that'd 
only get me halfway; that would allow me to encode the URLs but I'm 
unsure of where I'd need to decode them when the link is clicked on.

I'd appreciate any pointers on this one.

Thanks much in advance,
Karl

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] OT: writing a plugin-driven app

2006-10-29 Thread Karl M. Davis



Hey there 
all,

Sorry for being 
slightly off-topic but I was hoping someone here might be able to point me in 
the right direction. I'd like my wicket app to support plugins. What 
I need is a way to dynamically discover what plugins are available to be 
instantiated. A plugin in this case would be anything that implements the 
IPlugin interface. Specifically, I'd need a way to do the 
following:

SetClassIPlugin getAvailablePlugins()
{
 
// look through the classpath for all implementations of IPlugin 
and return the classes...
}

I'm hoping for 
something fairly lightweight that can do this without a bunch of XML config 
files, etc. I was looking at Pico which seems to be as lightweight as I'd 
like but was a little short on documentation (I think its Nano subproject might 
be able to do it, but there weren't any examples).

Anyone have some 
advice/experience? Am I going about this all wrong?

Thanks!
Karl
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] ModalWindow

2006-10-23 Thread Karl M. Davis



Hello 
all,

I am having a 
problem in my first attempts to use ModalWindow. What I'm trying to do is 
have a ModalWindow that is part of a panel which is added during an Ajax 
update. When I do this-- the Ajax for that page "hangs" 
on:


INFO: 
Responseparsed.Nowinvokingsteps...
INFO: 

INFO: 
InitiatingAjaxGETrequeston/doh/resources/wicket.extensions.ajax.markup.html.modal.ModalWindow/res/modal.js
INFO: 
Invokingpre-callhandler(s)...


... and no other 
Ajax events"work" until I refresh the page manually (i.e. start a new 
request). I've checked and just simply adding the ModalWindow to the panel 
in its constructor (not setting its content or anything) is enough to cause this 
problem. If I add the ModalWindow to the page itself, everything seems to 
work fine. Any ideas what might be causing this? Can ModalWindows be 
children of panels or must they be children of pages? Can they be created 
during an Ajax event?

-- 
Karl
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] ModalWindow

2006-10-23 Thread Karl M. Davis
It's one of the 1.2.2 snapshots from the old 1.2.x branch (which seems to
have been switched to 1.x now).  I'll install the latest snapshots and let
you know if that fixes it.

-- Karl

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Matej Knopp
Sent: Monday, October 23, 2006 10:05 AM
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] ModalWindow

Can you tell me what version of Wicket are you using? There have been couple
of fixes since the latest stable release, so you might want to try the
latest svn version.

If the latest doesn't work I'll certainly look at that.

-Matej

Karl M. Davis wrote:
 Hello all,
  
 I am having a problem in my first attempts to use ModalWindow.  What 
 I'm trying to do is have a ModalWindow that is part of a panel which 
 is added during an Ajax update.  When I do this-- the Ajax for that 
 page hangs on:
 
 *INFO: *Response parsed. Now invoking steps...
 *INFO: *
 *INFO: 
 *Initiating Ajax GET request on 
 /doh/resources/wicket.extensions.ajax.markup.html.modal.ModalWindow/re
 s/modal.js
 *INFO: *Invoking pre-call handler(s)...
 
  
 ... and no other Ajax events work until I refresh the page manually 
 (i.e. start a new request).  I've checked and just simply adding the 
 ModalWindow to the panel in its constructor (not setting its content 
 or
 anything) is enough to cause this problem.  If I add the ModalWindow 
 to the page itself, everything seems to work fine.  Any ideas what 
 might be causing this?  Can ModalWindows be children of panels or must 
 they be children of pages?  Can they be created during an Ajax event?
  
 -- Karl
 
 
 --
 --
 
 --
 --- Using Tomcat but need to do more? Need to support web services, 
 security?
 Get stuff done quickly with pre-integrated technology to make your job 
 easier Download IBM WebSphere Application Server v.1.0.1 based on 
 Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=1216
 42
 
 
 --
 --
 
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job
easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] ModalWindow

2006-10-23 Thread Karl M. Davis
Matej,

Thanks-- that seems to have done it.  At least, it's crashing respectably
now with a markup error that I'll look at later (my fault, I'm sure).

-- Karl 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Karl M.
Davis
Sent: Monday, October 23, 2006 10:40 AM
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] ModalWindow

It's one of the 1.2.2 snapshots from the old 1.2.x branch (which seems to
have been switched to 1.x now).  I'll install the latest snapshots and let
you know if that fixes it.

-- Karl

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Matej Knopp
Sent: Monday, October 23, 2006 10:05 AM
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] ModalWindow

Can you tell me what version of Wicket are you using? There have been couple
of fixes since the latest stable release, so you might want to try the
latest svn version.

If the latest doesn't work I'll certainly look at that.

-Matej

Karl M. Davis wrote:
 Hello all,
  
 I am having a problem in my first attempts to use ModalWindow.  What 
 I'm trying to do is have a ModalWindow that is part of a panel which 
 is added during an Ajax update.  When I do this-- the Ajax for that 
 page hangs on:
 
 *INFO: *Response parsed. Now invoking steps...
 *INFO: *
 *INFO: 
 *Initiating Ajax GET request on
 /doh/resources/wicket.extensions.ajax.markup.html.modal.ModalWindow/re
 s/modal.js
 *INFO: *Invoking pre-call handler(s)...
 
  
 ... and no other Ajax events work until I refresh the page manually 
 (i.e. start a new request).  I've checked and just simply adding the 
 ModalWindow to the panel in its constructor (not setting its content 
 or
 anything) is enough to cause this problem.  If I add the ModalWindow 
 to the page itself, everything seems to work fine.  Any ideas what 
 might be causing this?  Can ModalWindows be children of panels or must 
 they be children of pages?  Can they be created during an Ajax event?
  
 -- Karl
 
 
 --
 --
 
 --
 --- Using Tomcat but need to do more? Need to support web services, 
 security?
 Get stuff done quickly with pre-integrated technology to make your job 
 easier Download IBM WebSphere Application Server v.1.0.1 based on 
 Apache Geronimo
 http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=1216
 42
 
 
 --
 --
 
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job
easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job
easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] ListChoice and default value

2006-10-23 Thread Karl M. Davis



Hello 
all,

This is a minor 
annoyance, but I figured I'd throw it out there anyways...

Is there a way to 
have a ListChoice that has no option selected by default and does not insert a 
default choice (e.g. "Choose One" or an empty entry if you set 
setIsNullValid(true))? It's possible in HTML but Wicket always inserts an 
extra option/ item. AbstractChoice.onComponentTagBody(...) seems 
to always call AbstractSingleSelectionChoice.getDefaultChoice(...) which will 
always insert something unless you've pre-selected an item for the 
user.

Thanks,
Karl
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] AjaxTabbedPanel - changing tab label

2006-10-22 Thread Karl M. Davis



I haven't checked, but since AbstractTab takes a Model for 
the title, you could try just changing the value that model 
returns.

e.g.
Model tabLabel = new Model("label1");
... new AbstractTab(tabLabel) {...

... onAjaxUpdate ...
tabLabel.setObject("label2");
...



From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Sharma, 
KamleshSent: Sunday, October 22, 2006 8:08 AMTo: 
wicket-user@lists.sourceforge.netSubject: Re: [Wicket-user] 
AjaxTabbedPanel - changing tab label


Hi

I am using 
AjaxTabbedPanel and needs to change some tab labels(example from existing label 
"Search" to "New Search"on onAjaxUpdate callback method. Is it 
possible?

Regards
Kam

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Open Popup via Ajax

2006-10-17 Thread Karl M. Davis



Igor,

Thanks for the reply and the suggestion to just extend 
AbstractBehavior. That definitely does work better. 


Now, however, it looks like the URL I'm generating (using Component.urlFor(Class, PageParameters)) isn't working 
out quite right. The generated ondblclick attribute 
is:




And I get a java.lang.NoSuchMethodException: 
simplepersistence.feature.dynamicPages.SnippetEditorPopupPage.init() 
exception when opening the popup. Is there a better way that I should be 
trying to do all of this? Something a little less hacky than abusing 
PopupSettings like this, perhaps?

-- 
Karl



From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Igor 
VaynbergSent: Monday, October 16, 2006 9:16 PMTo: 
wicket-user@lists.sourceforge.netSubject: Re: [Wicket-user] Open 
Popup via Ajax
you are kinda abusing popup settings class, its not meant to generate 
_javascript_ for that usecase. the problem is that "return false;" in the js it 
generates which is mean to abort he current click event.you def dont 
need ajax to do this, try whats belowprivate static class 
DoubleClickEditorBehavior extends AbstractBehavior {void 
onComponentTag(ComponentTag tag) {PopupSettings popupSettings = new 
PopupSettings(PageMap.forName("contentEditorPageMap")).setHeight(SnippetEditorPopupPage.WINDOWS_HEIGHT).setWidth(SnippetEditorPopupPage.WINDOW_WIDTH);popupSettings.setTarget("'" 
+ url + "'");if(target != 
null) tag.put("ondblclick", 
target.appendJavascript(popupSettings.getPopupJavaScript());}}-igor
On 10/16/06, Karl M. 
Davis [EMAIL PROTECTED] 
wrote:

  
  Hello all,
  
  What I'm trying to do is have a Label that 
  I can double click to open a popup window. I don't really care if it's 
  Ajax or static _javascript_, I just need it to work. However, Ajax seemed 
  easiest so I've added the following Ajax behavior to a 
  Label:
  
  
  private static class 
  DoubleClickEditorAjaxBehavior extends 
  AjaxEventBehavior{// 
  Constantsprivate static final long serialVersionUID = 
  460292942456978352L;// Member 
  Variablesprivate String url;
  
  /** * 
  Constructor. */public 
  DoubleClickEditorAjaxBehavior(String 
  url){super("onDblClick");this.url 
  = "">}
  
  /** * Opens the [EMAIL PROTECTED] SnippetEditorPopupPage}. *  
  * @see 
  wicket.ajax.AjaxEventBehavior#onEvent(wicket.ajax.AjaxRequestTarget) 
  */@Overrideprotected void 
  onEvent(AjaxRequestTarget 
  target){PopupSettings popupSettings = 
  new 
  PopupSettings(PageMap.forName("contentEditorPageMap")).setHeight(SnippetEditorPopupPage.WINDOWS_HEIGHT).setWidth(SnippetEditorPopupPage.WINDOW_WIDTH);popupSettings.setTarget("'" 
  + url + "'");if(target != 
  null)target.appendJavascript(popupSettings.getPopupJavaScript());}}
  
  It doesn't seem to do anything, though the 
  Ajax debug window shows the following every time I double 
  click:
  INFO:INFO: Initiating Ajax 
  GET request on 
  /doh?wicket:interface=:0:dynamicPageContent::IBehaviorListenerwicket:behaviorId=3random=0.5027223472182086INFO: 
  Invoking pre-call handler(s)...INFO: Received ajax response (354 
  characters)INFO:?xml version="1.0" 
  encoding="UTF-8"?ajax-responseevaluate![CDATA[window.open('/doh?wicket:bookmarkablePage=:simplepersistence.feature.dynamicPages.SnippetEditorPopupPage0=karl1=1', 
  'contentEditorPageMap', 
  'scrollbars=no,location=no,menuBar=no,resizable=no,status=no,toolbar=no,width=750,height=550'); 
  return false;]]/evaluate/ajax-responseINFO: Response 
  parsed. Now invoking steps...ERROR: Exception evaluating _javascript_: 
  SyntaxError: invalid returnINFO: Response processed successfully.INFO: 
  Invoking post-call handler(s)...
  
  
  Can anyone point out what I might be doing 
  wrong or a better way to go about this?
  
  Thanks,
  Karl-Using 
  Tomcat but need to do more? Need to support web services, security?Get 
  stuff done quickly with pre-integrated technology to make your job easier 
  Download IBM WebSphere Application Server v.1.0.1 based on Apache 
  Geronimohttp://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___Wicket-user 
  mailing listWicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user 
  
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Open Popup via Ajax

2006-10-17 Thread Karl M. Davis



Wow, that was idiotic of me. I somehow got it stuck 
in my head that the page I was linking to was bookmarkable-- it's 
not.

Is there a way to have _javascript_ open a popup to a page 
that is not bookmarkable? Looking through the Wicket source I don't see 
anything quite as simple as urlFor(...) that takes a reference to a 
Page.

-- Karl


From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Igor 
VaynbergSent: Tuesday, October 17, 2006 7:23 AMTo: 
wicket-user@lists.sourceforge.netSubject: Re: [Wicket-user] Open 
Popup via Ajax
this has nothing to do with popup settings. if you have a 
bookmarkable page - which looks like you do because you are using that urlfor 
variant you must provide either the default constructonr () or since you are 
using parameters a (PageParemeters params) constructor. 
-igpr
On 10/17/06, Karl M. 
Davis [EMAIL PROTECTED] 
wrote:

  
  Igor,
  
  Thanks for the reply and 
  the suggestion to just extend AbstractBehavior. That definitely does 
  work better. 
  
  Now, however, it looks 
  like the URL I'm generating (using Component.urlFor(Class, PageParameters)) isn't 
  working out quite right. The generated ondblclick attribute 
  is:
  
  
  
  
  And I get a 
  java.lang.NoSuchMethodException: 
  simplepersistence.feature.dynamicPages.SnippetEditorPopupPage.init() 
  exception when opening the popup. Is there a better way that I should be 
  trying to do all of this? Something a little less hacky than abusing 
  PopupSettings like this, perhaps?
  
  -- Karl
  
  
  
  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of 
  Igor VaynbergSent: Monday, October 16, 2006 9:16 
  PMTo: wicket-user@lists.sourceforge.netSubject: Re: 
  [Wicket-user] Open Popup via Ajax
  
  you are kinda abusing popup settings class, its not meant to 
  generate _javascript_ for that usecase. the problem is that "return false;" in 
  the js it generates which is mean to abort he current click event.you 
  def dont need ajax to do this, try whats belowprivate static class 
  DoubleClickEditorBehavior extends AbstractBehavior {void 
  onComponentTag(ComponentTag tag) {PopupSettings popupSettings = new 
  PopupSettings(PageMap.forName("contentEditorPageMap")).setHeight(SnippetEditorPopupPage.WINDOWS_HEIGHT).setWidth(SnippetEditorPopupPage.WINDOW_WIDTH);popupSettings.setTarget("'" 
  + url + "'");if(target != 
  null) tag.put("ondblclick", 
  target.appendJavascript(popupSettings.getPopupJavaScript());}}-igor
  On 10/16/06, Karl M. 
  Davis [EMAIL PROTECTED] wrote: 
  

Hello all,

What I'm trying to do is have a Label 
that I can double click to open a popup window. I don't really care if 
it's Ajax or static _javascript_, I just need it to work. However, Ajax 
seemed easiest so I've added the following Ajax behavior to a 
Label:


private static class 
DoubleClickEditorAjaxBehavior extends 
AjaxEventBehavior{// 
Constantsprivate static final long serialVersionUID = 
460292942456978352L;// Member 
Variablesprivate String url;

/** * 
Constructor. */public 
DoubleClickEditorAjaxBehavior(String 
url){super("onDblClick");this.url 
= "">}

/** * Opens the [EMAIL PROTECTED] 
SnippetEditorPopupPage}. 
*  * @see 
wicket.ajax.AjaxEventBehavior#onEvent(wicket.ajax.AjaxRequestTarget) 
*/@Overrideprotected void 
onEvent(AjaxRequestTarget 
target){PopupSettings popupSettings = 
new 
PopupSettings(PageMap.forName("contentEditorPageMap")).setHeight(SnippetEditorPopupPage.WINDOWS_HEIGHT).setWidth(SnippetEditorPopupPage.WINDOW_WIDTH);popupSettings.setTarget("'" 
+ url + "'");if(target != 
null)target.appendJavascript(popupSettings.getPopupJavaScript());}}

It doesn't seem to do anything, though 
the Ajax debug window shows the following every time I double 
click:
INFO:INFO: Initiating 
Ajax GET request on 
/doh?wicket:interface=:0:dynamicPageContent::IBehaviorListenerwicket:behaviorId=3random=0.5027223472182086INFO: 
Invoking pre-call handler(s)...INFO: Received ajax response (354 
characters)INFO:?xml version="1.0" 
encoding="UTF-8"?ajax-responseevaluate![CDATA[window.open('/doh?wicket:bookmarkablePage=:simplepersistence.feature.dynamicPages.SnippetEditorPopupPage0=karl1=1', 
'contentEditorPageMap', 
'scrollbars=no,location=no,menuBar=no,resizable=no,status=no,toolbar=no,width=750,height=550'); 
return false;]]/evaluate/ajax-responseINFO: Response 
parsed. Now invoking steps...ERROR: Exception evaluating _javascript_: 
SyntaxError: invalid returnINFO: Response processed 
successfully.INFO: Invoking post-call 
handler(s)...


Can anyone point out what I might be 
doing wrong or a better way to go about this?

Thanks,
Karl-

Re: [Wicket-user] Open Popup via Ajax

2006-10-17 Thread Karl M. Davis



Igor,

I'm trying to have a Label (not a link) that opens a popup 
when double-clicked.

-- Karl


From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Igor 
VaynbergSent: Tuesday, October 17, 2006 4:53 PMTo: 
wicket-user@lists.sourceforge.netSubject: Re: [Wicket-user] Open 
Popup via Ajax
erm, the problem is the url - if the page is not bookmarkable you 
cannot create a url to it without having a page instance. that would be bad 
cause you would be precreating the page instance so you have its url available 
in the page that calls it. what is the usecase? does the link do 
something different if it is single clicked?-Igor
On 10/17/06, Igor 
Vaynberg  
[EMAIL PROTECTED] wrote:
if 
  its not bookmarkable then you can just put that code into attribute modifier 
  and attach it to the link. js poupup settings generates should work fine 
  there. -Igor
  
  On 10/17/06, Karl M. 
  Davis [EMAIL PROTECTED] wrote:
  

Wow, 
that was idiotic of me. I somehow got it stuck in my head that the 
page I was linking to was bookmarkable-- it's not.

Is there 
a way to have _javascript_ open a popup to a page that is not 
bookmarkable? Looking through the Wicket source I don't see anything 
quite as simple as urlFor(...) that takes a reference to a 
Page.

-- 
Karl


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of 
Igor VaynbergSent: Tuesday, October 17, 2006 7:23 
AM
To: wicket-user@lists.sourceforge.netSubject: Re: 
[Wicket-user] Open Popup via Ajax

this has nothing to do with popup settings. if you have a 
bookmarkable page - which looks like you do because you are using that 
urlfor variant you must provide either the default constructonr () or since 
you are using parameters a (PageParemeters params) constructor. 
-igpr
On 10/17/06, Karl M. 
Davis [EMAIL PROTECTED] wrote: 

  
  Igor,
  
  Thanks for the reply 
  and the suggestion to just extend AbstractBehavior. That definitely 
  does work better. 
  
  Now, however, it 
  looks like the URL I'm generating (using Component.urlFor(Class, PageParameters)) isn't 
  working out quite right. The generated ondblclick attribute 
  is:
  
  
  
  
  And I get a 
  java.lang.NoSuchMethodException: 
  simplepersistence.feature.dynamicPages.SnippetEditorPopupPage.init() 
  exception when opening the popup. Is there a better way that I 
  should be trying to do all of this? Something a little less hacky 
  than abusing PopupSettings like this, perhaps?
  
  -- 
Karl
  
  
  
  From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]] On Behalf 
  Of Igor VaynbergSent: Monday, October 16, 2006 9:16 
  PMTo: wicket-user@lists.sourceforge.netSubject: Re: 
  [Wicket-user] Open Popup via Ajax
  
  you are kinda abusing popup settings class, its not meant to 
  generate _javascript_ for that usecase. the problem is that "return false;" 
  in the js it generates which is mean to abort he current click 
  event.you def dont need ajax to do this, try whats 
  belowprivate static class DoubleClickEditorBehavior extends 
  AbstractBehavior {void onComponentTag(ComponentTag tag) 
  {PopupSettings 
  popupSettings = new 
  PopupSettings(PageMap.forName("contentEditorPageMap")).setHeight(SnippetEditorPopupPage.WINDOWS_HEIGHT).setWidth(SnippetEditorPopupPage.WINDOW_WIDTH);popupSettings.setTarget("'" 
  + url + "'");if(target != 
  null) tag.put("ondblclick", 
  target.appendJavascript(popupSettings.getPopupJavaScript());}}-igor
  On 10/16/06, Karl 
  M. Davis [EMAIL PROTECTED] wrote: 
  

Hello all,

What I'm trying to do is have a Label 
that I can double click to open a popup window. I don't really 
care if it's Ajax or static _javascript_, I just need it to work. 
However, Ajax seemed easiest so I've added the following Ajax behavior 
to a Label:


private static class 
DoubleClickEditorAjaxBehavior extends 
AjaxEventBehavior{// 
Constantsprivate static final long serialVersionUID = 
460292942456978352L;// Member 
Variablesprivate String url;

/** * Constructor. 
*/public DoubleClickEditorAjaxBehavior(String 
url){super("onDblClick");this.url 
= "">}

/** * Opens the [EMAIL PROTECTED] 
SnippetEditorPopupPage}. * 
 * @see 
wicket.ajax.AjaxEventBehavior#onEvent(wicket.ajax.AjaxRequestTarget) 
*/@Overrideprotected void 
onEvent(AjaxRequestTarget 
target){PopupSettings 
popupSettings = new 
PopupSettings(PageMap.forName("con

Re: [Wicket-user] Handling tree node onclick

2006-10-13 Thread Karl M. Davis
Matej,

Doesn't it make more sense just to override onNodeLinkClicked(...)?  That's
what I've been doing, anyways.  That way you don't have to worry about how
the ndoes are created-- just what to do with them once one is clicked.  If
you want to control how the nodes look, override renderNode(...) to
customize the node's text, and getNodeIcon(...).

-- Karl 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Matej Knopp
Sent: Thursday, October 12, 2006 7:18 AM
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] Handling tree node onclick

I assume you are talking about the new (ajax) tree.

Override the method newNodeLink to create link with action you want.

-Matej

billa wrote:
 Can someone point me to some sample code for intercepting a tree node 
 onclick event? I would like the tree node click to update a pane on 
 the same page that contains an edit form for the object represented by the
node.
 
 


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job
easier Download IBM WebSphere Application Server v.1.0.1 based on Apache
Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Problem Selecting Tree Nodes

2006-09-27 Thread Karl M. Davis
Matej,

Thanks very much!  I checked it out, and it does work just fine.  I'll buy
you a beer if you're ever in the Tucson, Arizona area.

-- Karl


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Matej Knopp
Sent: Tuesday, September 26, 2006 1:05 PM
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] Problem Selecting Tree Nodes

Thanks for the example. Fix is in SVN (both 1-x and 2.0), would you mind
trying it? I also fixed the refresh of item before the added ( or
removed) item, so that the tree lines are changed properly.

-Matej

Karl M. Davis wrote:
 Matej,
 
 Ended up with some extra free time today.
 
 I took a look at the existing unit tests and didn't see any that 
 jumped out at me for testing the tree component.  So instead of a unit 
 test, I put together a modified version of 
 wicket.examples.ajax.builtin.tree.BaseTreePage that has an added link 
 that will insert a node, select it in the tree state, and then try to 
 update the tree via Ajax.  It's throwing the same exception.  The java 
  html files are attached, though I'm not sure the mailing list 
 accepts attachments so I'm also pasting them in below.
 
 -- Karl
 
 BaseTreePage.html
 -
 wicket:extend
 
   div style=border-bottom: 1px solid gray; width: 30em;
 margin-bottom: 1em; padding-bottom: 0.3em; margin-top: -2.89em;
margin-left:
 10em;
   wicket:link
   a href=SimpleTreePage.htmlSimple tree/a
   nbsp;nbsp;
   a href=TreeTablePage.htmlTree table/a 
   nbsp;nbsp;
   a href=EditableTreeTablePage.htmlEditable tree table/a
 
   /wicket:link
   /div
 
   a wicket:id=expandAllExpand all nodes/anbsp;nbsp;
   a wicket:id=collapseAllCollapse all nodes/anbsp;nbsp;
   a wicket:id=switchRootlessSwitch rootless mode/anbsp;nbsp;
   a wicket:id=insertSingleNodeInsert New Node Bob/a
   wicket:child/
   
 /wicket:extend
 
 
 BaseTreePage.java
 -
 package wicket.examples.ajax.builtin.tree;
 
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
 import javax.swing.tree.DefaultMutableTreeNode;
 import javax.swing.tree.DefaultTreeModel;
 import javax.swing.tree.TreeModel;
 import javax.swing.tree.TreeNode;
 
 import wicket.ajax.AjaxRequestTarget;
 import wicket.ajax.markup.html.AjaxLink; import 
 wicket.examples.ajax.builtin.BasePage;
 import wicket.extensions.markup.html.tree.AbstractTree;
 
 /**
  * This is a base class for all pages with tree example.
  *
  * @author Matej Knopp
  */
 public abstract class BaseTreePage extends BasePage {
 
   /**
* Default constructor
*/
   public BaseTreePage()
   {   
   add(new AjaxLink(expandAll) 
   {
   public void onClick(AjaxRequestTarget target)
   {
   getTree().getTreeState().expandAll();
   getTree().updateTree(target);
   }
   });
   
   add(new AjaxLink(collapseAll) 
   {
   public void onClick(AjaxRequestTarget target)
   {
   getTree().getTreeState().collapseAll();
   getTree().updateTree(target);
   }
   });
   
   add(new AjaxLink(switchRootless) 
   {
   public void onClick(AjaxRequestTarget target)
   {
   
 getTree().setRootLess(!getTree().isRootLess());
   getTree().updateTree(target);
   }
   });
   
   add(new AjaxLink(insertSingleNode)
   {
   public void onClick(AjaxRequestTarget target)
   {
   CustomTreeModel treeModel =
 (CustomTreeModel)getTree().getModelObject();
   DefaultMutableTreeNode bob =
 treeModel.insertSingleNode((DefaultMutableTreeNode)treeModel.getRoot()
 ,
 Bob);
   getTree().getTreeState().selectNode(bob,
 true);
   
   if(target != null)
   getTree().updateTree(target);
   }
   });
   }
 
   /**
* Returns the tree on this pages. This is used to collapse, expand 
 the tree
* and to switch the rootless mode.
* 
* @return
*  Tree instance on this page
*/
   protected abstract AbstractTree getTree();
   
   /**
* Creates the model that feeds the tree.
* @return
*  New instance of tree model

[Wicket-user] Problem Selecting Tree Nodes

2006-09-26 Thread Karl M. Davis



Matej,

I'm getting an 
ArrayIndexOutOfBounds when I go to select a tree node right after it has been 
inserted into the treewhen I callTree.updateTree(target); (my tree 
model is firing the correct events). If you'd like, I can get you a test 
case for this in a day or two, but I just wanted to make sure I wasn't trying to 
do something I can't first.

Dummy 
Code:
myTreeModel.insertNewNode(parentNode, newNode);
myTree.getTreeState().selectNode(newNode, true);
if(target != 
null)
 
myTree.updateTree(target);

Dump:
00:25:18.609 
ERROR! [SocketListener0-1] wicket.RequestCycle.step(RequestCycle.java:1009) 
20 -2java.lang.ArrayIndexOutOfBoundsException: -2at 
java.util.ArrayList.get(ArrayList.java:323)at 
wicket.extensions.markup.html.tree.AbstractTree.updateTree(AbstractTree.java:753)at 
simplepersistence.feature.dynamicPages.PageEditorPanel$SaveButton.onSubmit(PageEditorPanel.java:240)at 
wicket.ajax.markup.html.form.AjaxSubmitButton$1.onSubmit(AjaxSubmitButton.java:60)at 
wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:92)at 
wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:167)at 
wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:236)at 
wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:98)at 
wicket.request.compound.DefaultEventProcessorStrategy.processEvents(DefaultEventProcessorStrategy.java:65)at 
wicket.request.compound.AbstractCompoundRequestCycleProcessor.processEvents(AbstractCompoundRequestCycleProcessor.java:57)at 
wicket.RequestCycle.doProcessEventsAndRespond(RequestCycle.java:862)at 
wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:900)at 
wicket.RequestCycle.step(RequestCycle.java:976)at 
wicket.RequestCycle.steps(RequestCycle.java:1050)at 
wicket.RequestCycle.request(RequestCycle.java:454)at 
wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:217)at 
wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:260)at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:616)at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)at 
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)at 
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:473)at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)at 
org.mortbay.http.HttpContext.handle(HttpContext.java:1530)at 
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:633)at 
org.mortbay.http.HttpContext.handle(HttpContext.java:1482)at 
org.mortbay.http.HttpServer.service(HttpServer.java:909)at 
org.mortbay.http.HttpConnection.service(HttpConnection.java:820)at 
org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)at 
org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)at 
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)at 
org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)at 
org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)

-- 
Karl
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Problem Selecting Tree Nodes

2006-09-26 Thread Karl M. Davis
Matej,

I got and installed the latest SVN rev right before I sent the email.  I
should have some time Wed. to put together a quick test case for you.
Should I just mimic one of the existing Junit tests or can I just send you a
class  html file?

-- Karl 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Matej Knopp
Sent: Tuesday, September 26, 2006 12:33 AM
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] Problem Selecting Tree Nodes

Please send a test case, I'll look at it. your code seems to be fine, it's
nothing illegal, it can be bug in tree.

Would you mind testing svn version first, it _might_ be already fixed.

Thanks,

-Matej

Karl M. Davis wrote:
 Matej,
  
 I'm getting an ArrayIndexOutOfBounds when I go to select a tree node 
 right after it has been inserted into the tree when I call 
 Tree.updateTree(target); (my tree model is firing the correct events).  
 If you'd like, I can get you a test case for this in a day or two, but 
 I just wanted to make sure I wasn't trying to do something I can't 
 first.
  
 *Dummy Code:*
 myTreeModel.insertNewNode(parentNode, newNode); 
 myTree.getTreeState().selectNode(newNode, true); if(target != null)
 myTree.updateTree(target);
  
 *Dump:*
 00:25:18.609 ERROR! [SocketListener0-1]
 wicket.RequestCycle.step(RequestCycle.java:1009) 20 -2
 java.lang.ArrayIndexOutOfBoundsException: -2  at 
 java.util.ArrayList.get(ArrayList.java:323)
  at
 wicket.extensions.markup.html.tree.AbstractTree.updateTree(AbstractTre
 e.java:753)
  at
 simplepersistence.feature.dynamicPages.PageEditorPanel$SaveButton.onSu
 bmit(PageEditorPanel.java:240)
  at
 wicket.ajax.markup.html.form.AjaxSubmitButton$1.onSubmit(AjaxSubmitBut
 ton.java:60)
  at
 wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior
 .java:92)  at 
 wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:167)
  at
 wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxB
 ehavior.java:236)
  at
 wicket.request.target.component.listener.BehaviorRequestTarget.process
 Events(BehaviorRequestTarget.java:98)
  at
 wicket.request.compound.DefaultEventProcessorStrategy.processEvents(De
 faultEventProcessorStrategy.java:65)
  at
 wicket.request.compound.AbstractCompoundRequestCycleProcessor.processE
 vents(AbstractCompoundRequestCycleProcessor.java:57)
  at 
 wicket.RequestCycle.doProcessEventsAndRespond(RequestCycle.java:862)
  at wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:900)
  at wicket.RequestCycle.step(RequestCycle.java:976)
  at wicket.RequestCycle.steps(RequestCycle.java:1050)
  at wicket.RequestCycle.request(RequestCycle.java:454)
  at wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:217)
  at wicket.protocol.http.WicketServlet.doPost(WicketServlet.java:260)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:616)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
  at 
 org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
  at
 org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicatio
 nHandler.java:473)  at 
 org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:56
 8)  at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
  at
 org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationC
 ontext.java:633)  at 
 org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
  at org.mortbay.http.HttpServer.service(HttpServer.java:909)
  at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
  at 
 org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
  at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
  at
 org.mortbay.http.SocketListener.handleConnection(SocketListener.java:2
 45)  at 
 org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
  at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
  
 -- Karl
 
 
 --
 --
 
 --
 --- Take Surveys. Earn Cash. Influence the Future of IT Join 
 SourceForge.net's Techsay panel and you'll get the chance to share 
 your opinions on IT  business topics through brief surveys -- and 
 earn cash 
 http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEV
 DEV
 
 
 --
 --
 
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user


-
Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's
Techsay panel and you'll get the chance to share your opinions on IT 
business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV

Re: [Wicket-user] Problem Selecting Tree Nodes

2006-09-26 Thread Karl M. Davis
);
l2.add(test 2.5);
l2.add(test 2.6);

l3 = new ArrayList();
l3.add(test 3.1);
l3.add(test 3.2);
l3.add(test 3.3);
l2.add(l3);

l1.add(l2);

l2 = new ArrayList();
l2.add(test 2.1);
l2.add(test 2.2);
l2.add(test 2.3);

l1.add(l2); 

l1.add(test 1.3);
l1.add(test 1.4);
l1.add(test 1.5);

return convertToTreeModel(l1);
}

private TreeModel convertToTreeModel(List list)
{
TreeModel model = null;
DefaultMutableTreeNode rootNode = new
DefaultMutableTreeNode(new ModelBean(ROOT));
add(rootNode, list);
model = new CustomTreeModel(rootNode);  
return model;
}

private void add(DefaultMutableTreeNode parent, List sub)
{
for (Iterator i = sub.iterator(); i.hasNext();)
{
Object o = i.next();
if (o instanceof List)
{
DefaultMutableTreeNode child = new
DefaultMutableTreeNode(new ModelBean(subtree...));
parent.add(child);
add(child, (List)o);
}
else
{
DefaultMutableTreeNode child = new
DefaultMutableTreeNode(new ModelBean(o.toString()));
parent.add(child);
}
}
}

private class CustomTreeModel extends DefaultTreeModel
{
public CustomTreeModel(TreeNode root)
{
super(root);
// TODO Auto-generated constructor stub
}

protected DefaultMutableTreeNode
insertSingleNode(DefaultMutableTreeNode parent, String nodeText)
{
DefaultMutableTreeNode child = new
DefaultMutableTreeNode(new ModelBean(nodeText));
parent.add(child);
fireTreeNodesInserted(this, parent.getPath(), new
int[]{parent.getIndex(child)}, new Object[]{child});
return child;
}
}
}

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Karl M.
Davis
Sent: Tuesday, September 26, 2006 2:12 AM
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] Problem Selecting Tree Nodes

Matej,

I got and installed the latest SVN rev right before I sent the email.  I
should have some time Wed. to put together a quick test case for you.
Should I just mimic one of the existing Junit tests or can I just send you a
class  html file?

-- Karl 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Matej Knopp
Sent: Tuesday, September 26, 2006 12:33 AM
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] Problem Selecting Tree Nodes

Please send a test case, I'll look at it. your code seems to be fine, it's
nothing illegal, it can be bug in tree.

Would you mind testing svn version first, it _might_ be already fixed.

Thanks,

-Matej

Karl M. Davis wrote:
 Matej,
  
 I'm getting an ArrayIndexOutOfBounds when I go to select a tree node 
 right after it has been inserted into the tree when I call 
 Tree.updateTree(target); (my tree model is firing the correct events).
 If you'd like, I can get you a test case for this in a day or two, but 
 I just wanted to make sure I wasn't trying to do something I can't 
 first.
  
 *Dummy Code:*
 myTreeModel.insertNewNode(parentNode, newNode); 
 myTree.getTreeState().selectNode(newNode, true); if(target != null)
 myTree.updateTree(target);
  
 *Dump:*
 00:25:18.609 ERROR! [SocketListener0-1]
 wicket.RequestCycle.step(RequestCycle.java:1009) 20 -2
 java.lang.ArrayIndexOutOfBoundsException: -2  at
 java.util.ArrayList.get(ArrayList.java:323)
  at
 wicket.extensions.markup.html.tree.AbstractTree.updateTree(AbstractTre
 e.java:753)
  at
 simplepersistence.feature.dynamicPages.PageEditorPanel$SaveButton.onSu
 bmit(PageEditorPanel.java:240)
  at
 wicket.ajax.markup.html.form.AjaxSubmitButton$1.onSubmit(AjaxSubmitBut
 ton.java:60)
  at
 wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior
 .java:92)  at
 wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:167)
  at
 wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxB
 ehavior.java:236)
  at
 wicket.request.target.component.listener.BehaviorRequestTarget.process
 Events(BehaviorRequestTarget.java:98

Re: [Wicket-user] Problem with tree width

2006-09-24 Thread Karl M. Davis
Matej,

Instead of using floats and background images, would it be possible for the
tree to use real img/ tags with a set width?  I'm not 100% positive, but I
think the floats are what prevent overflow: scroll from working properly.
Does that sound right?

-- Karl

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Matej Knopp
Sent: Saturday, September 23, 2006 11:43 AM
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] Problem with tree width

Sure, and don't forget to provide css to table layout the tree with lines
and everything that is at least as good as current solution (which is
actually rather good, I think ;-). Because all my attempts to layout the
tree-table with table failed at least in firefox.

-Matej

Igor Vaynberg wrote:
 time to work on that magical tr replacing ajax stuff :)
 
 -Igor
 
 
 On 9/23/06, *Matej Knopp* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
 wrote:
 
 Btw. I've commited fix to 1.x that prevents the text from hiding (it's
 being clipped instead).
 
 -Matej
 
 Matej Knopp wrote:
   If it was only tree, I'd be probably using nested divs. The
 reason for
   using div per row is actually the TreeTable. Initially, I wanted to
   build tree table using tabletr... - I couldn't nest table
 rows. Then
   I found out that replacing tr in ajax doesn't work in ie (and
 opera), so
   I had to use divs instead. However, I still think using nested
 divs for
   tree table wouldn't work well.
  
   -Matej
  
   Karl M. Davis wrote:
   Matej,
  
   I've been wondering why you chose to implement the tree as a set
of
   floated divs rather than as a nested list?  The list would be
 much more
   semantic and fallback gracefully if the user has CSS turned off as
   well.  This is one of the better examples of this I've seen:
   http://www.silverstripe.com/downloads/tree/
 http://www.silverstripe.com/downloads/tree/
  
   I've been toying with the idea of writing my own implementation of
   AbstractTree using this HTML and CSS as the overflow issues
 annoy me...
   any thoughts?
  
   -- Karl
  
  


   *From:* [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]
   [mailto:[EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED]] *On Behalf Of
   *Marc-Andre Houle
   *Sent:* Friday, September 22, 2006 5:47 AM
   *To:* wicket-user@lists.sourceforge.net
 mailto:wicket-user@lists.sourceforge.net
   *Subject:* Re: [Wicket-user] Problem with tree width
  
   It is not that important for now, I was just trying to know if the
   problem was on my side or on the wicket platform.
  
   Thanks for your help and I'm pleased to know someone better than
 me is
   working on that issue.  I'm not really a master in CSS!
  
   Marc
  
   On 9/22/06, *Matej Knopp* [EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 mailto:[EMAIL PROTECTED] wrote:
  
   I've fixed the problem of disappearing item captions, but
 only for
   tree-table. I'll have to look at tree css, I just had no
 time. It might
   some serious changes to stylesheet to get this working for
 Tree.
  
   So if this really is a showstopper for you, try to use tree
 table (with
   the css from current svn).
  
   -Matej
  
   Marc-Andre Houle wrote:
 Since I got no one to help me, I have continued to search
 for this
 problem with no result.  Also, maybe I wasn't clear enough
to
 demonstrate the problem, so I will make a new effort to
 display it.

 Here is easy Path to demonstrate the problem
 1 - got the web developper extension for firefox if it is
 not already
 done (Really usefull :
 https://addons.mozilla.org/firefox/60/)

 2- go to page

  

http://www.wicket-library.com/wicket-examples/ajax?wicket:bookmarkablePage=:
wicket.examples.ajax.builtin.tree.SimpleTreePage

 3- Click the link to expand all node

 4- Open up the the CSS edit tool ( CTRL-SHIFT-E )

 5 - In div wicket-tree, set the width variable to 15.

 Now, you should see that some of the element of the table
 disapred
 because there was no place to display them.  My problem,
 while
   not being
 exclusively that, is related to that.  Is it not possible
 to make the
 tree scrollable horizontally when the content is larger
 that the
   space
 to display the tree?

 It seems to be only a CSS problem, but I still

[Wicket-user] Run Javascript before Ajax Form submit

2006-09-18 Thread Karl M. Davis



Hello 
all,

I have a form I'd 
like to submit via AJAX. The problem is, before the form can be submitted, 
I need to run a _javascript_ command:
"tinyMCE.triggerSave(true, true);"

I've tried adding a 
normal Button with it's getOnClickScript() overridden to return this. That 
works fine-- until I add an AjaxFormSubmitBehavior to the button, which 
overrides the _javascript_ in getOnClickScript() (the getOnClickScript() code does 
not appear in the DOM Explorer for the onclick event of the button; only the 
ajax code is there).

I suppose my 
question can be generalized: how do I add _javascript_ to a button thatwill 
berun before any AJAX behaviors are processed?

Thanks,
Karl
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] Matej's Tree Overflow problems

2006-09-09 Thread Karl M. Davis



Hey 
there,

I'm having a problem 
with Matej's tree. The way it's set up, if any of the rows' text is too 
wide for the 20em space allocated to the tree, the row "disappears". I can 
make the tree wider, but this becomes a problem for arbitrarily-large 
trees.
I'm hoping this is 
something I can fix by just overriding the default tree's stylesheet but so far 
I've been unable to do that. Can anyone provide some 
guidance?

Thanks,
Karl
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] Matej's Tree Demo

2006-08-29 Thread Karl M. Davis



Hey 
there,

Just wanted to 
mention that the demo of Matej's "new" tree on the web page (http://wicketframework.org/wicket-extensions/index.html) 
is down.

Does anyone know 
where I can find some sample code and/or a working demo? I'd really love 
to start using this and it's always easier to figure out when there's an example 
available.

Thanks,
Karl
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] AbstractRequestTargetUrlCodingStrategy implementation

2006-08-14 Thread Karl M. Davis



Hello 
all,

What I would like to 
have is a sitewhere user-specific feature pages map to hierarchical 
URLs. For example:* /site/user/karl/blog/2006/08/14 maps to 
BlogViewer(bob, "2006", "08", "14")* 
/site/user/karl/content/BestEssayEver maps to ContentViewer(fred, 
"MyLifeStory")* /site/user/fred/content/BestEssayEver maps to 
ContentViewer(fred, "BestEssayEver")

I could "cheat" and 
use Bookmarkable pages but this would leave the users also being passed as 
strings-- I'd rather resolve them ahead of time and pass the pages the real 
Actor instances.

In order to do that, 
I thinkI'll have to write an implementation of 
AbstractRequestTargetUrlCodingStrategy that encodes and decodes the pages. 
Also, I will have to have a "guarantee" that each of the mounted pages has a 
constructor in the form of Constructor(user, string[] 
params).

The 
AbstractRequestTargetUrlCodingStrategy shouldn't be all that hard to write, but 
I think the aforementioned "guarantee" will require an implementation of 
IRequestTarget similar to IBookmarkablePageRequestTarget that stores the 
request's parameters for the pages. From what I can see, this would also 
be simple to write as it seems to be mostly a data-storage class. However, 
I am unsure of how to "wire up" Wicket to use my new IRequestTarget 
implementation once I have completed it.

Can anyone 
help me with that? I would also really appreciate any insight/links 
someone could provide on how Wicket's entire URLmapping scheme works-- I haven't 
been able to find any architecture documents or anything that explain this in a 
general sense. I'm used to using IIS and writing URL filters so this is 
pretty new territory for me.
Thanks in 
advance,
Karl
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Wicket Newbie Best Practices Questions

2006-06-11 Thread Karl M. Davis








Hello again all,



Thanks very much for all of your advice. I think I'm
starting to grasp how models should be used now. Just a couple of follow
up questions:



Model for ListChoice selections:

I am now using a LoadableDetachableModel for pulling the list of snippets on each page load.
However, I still use the following to track which entry in the ListChoice is selected:



public
HtmlSnippetDemo()

{

 ...

 frmEdit.setModel(new
CompoundPropertyModel(selectedSnippetModel));

 frmEdit.add(new
ListChoice(selectSnippets, new SnippetListModel(),

 new
ChoiceRenderer(name, datastoreId)));

 ...

}



private
static final class SelectedSnippetModel implements Serializable

{

 public
HtmlSnippet selectSnippets = null;

}



Should I make the SelectedSnippetModel detachable
as well? Even though I use the ChoiceRenderer to tell the
ListChoice to just use the datastoreId for
selection-tracking, it still seems to return an HtmlSnippet instance.
I already have a detachable SnippetModel Im using for the editor panel,
but it is read-only. I would need one that works with setObject to use with
the ListChoice, right?



Adding/Setting Attributes on Components:

The TextField component
does not have a setReadonly method but
it does have a setEnabled method.
Is there a simple way to add the readonly attribute
to the markup rendered by the component? If I use setEnabled, the browser
does not allow the user to select or copy the text in the rendered input/ element.



Thanks again!

Karl





-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Eelco Hillenius
Sent: Wednesday, June 07, 2006 11:02 AM
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] Wicket Newbie Best Practices Questions



In general, I think your code looks fine. It looks like how you would

write things if it were a Swing app.



A possible improvement is to rely more on the request-response nature

of Wicket. In desktop applications, you are generally in charge of

letting dependent components know some state has changed, and you

typically construct a network of property listeners to propogate such

changes. You can do the same with Wicket, but alternatively you can

make use of the knowledge that when a request comes in, the whole set

of components will be visited (for rendering), including the models

etc. If you use that knowledge, you can invert the strategy from

pushing changes to interested listeners, to models just pulling the

their state just in time.



For example, instead of:



private final ArrayListString listSnippetIds = new
ArrayListString();



private void updateSnippetList() {


listSnippetIds.clear();

 JpoxDataAccess da =
new JpoxDataAccess();

 for (Object
objCurSnippet : da.getBoExtent(HtmlSnippet.class))


listSnippetIds.add(((HtmlSnippet)

objCurSnippet).getDatastoreId());

}



you could have a model like this:



private static final class SnippetListModel extends
LoadableDetachableModel {

 protected abstract Object load() {

 ListHtmlSnippet list = new
ArrayListHtmlSnippet()

 JpoxDataAccess da = new
JpoxDataAccess();

 for (Object objCurSnippet :
da.getBoExtent(HtmlSnippet.class)) {


list.add((HtmlSnippet) objCurSnippet);

 }

 return list;

 }

}



frmEdit.add(new ListChoice(selectSnippets, new
SnippetListModel()));





You don't need the instance variable snippet ids then. Also you can

work with the complete objects instead of id's while even being more

efficient then before. This is because LoadableDetachableModel is a

detachable model, meaning that on first use it will be attached (in

this case will have the effect that method 'load' is called, and the

result of load is set as a temporary, transient value of the model)

and after the request is done, the model will be detached (in this

will have the effect that the temporary var - the result of load - is

set to null again, so that next time getObject is called, the model

will be attached again first).



So what we achieved here is that you always work with the objects as

fresh as they get, while nothing is stored as page state except for

the model instance itself; during a request the snippets are loaded

from the database, and at the end of the request, the snippets are

removed again.



Another thing we achieved here is that we now have a completely

standalone model. As there is no dependency with the page, you could

reuse this model anywhere you need a list of snippets. There are

endless variations of course, including having full-fledged models

that take parameters for filtering, sorting etc.



A similar thing can be said about the snippetBeingEdited variable.

Everyone should be very careful with storing persistent objects (JDO,

Hibernate, EJB objects) as page state. In most cases you shouldn't do

that, as it'll give you problems with lazy collections, the

persistence engine's session (like Hibernate's Session) they are

supposed to be part of, the transaction they might take