Re: change localized number format globally in application

2008-08-14 Thread Matthew Young
I am not quite sure why Double and Integer are handled differently when it
comes to grouping

in AbstractIntegerConverter, NumberFormat is initialized with this:

numberFormat.setGroupingUsed(false);

I asked long time ago while different policy for integer and float and the
answer was for integer, most use case don't want grouping.  But I think the
real reason is so we can figure how to make custom converter and how to
install it application wide :)

On Thu, Aug 14, 2008 at 10:33 AM, pixologe [EMAIL PROTECTED] wrote:



 igor.vaynberg wrote:
 
  you can install your converter globally by overriding
  application.newconverterlocator
 

 thanks for pointing me in the right direction, igor :)

 lazy as i am, i chose a one-line solution which is obviously not the most
 elegant one - however it does the job for now:


 ((ConverterLocator)getConverterLocator()).set(Integer.class,FloatConverter.INSTANCE);

 just switching the integerconverter against a floatconverter does the trick
 :)

 however, having a custom converter locator + integer converter would def be
 the cleaner solution, i know

 thanks again

 --
 View this message in context:
 http://www.nabble.com/change-localized-number-format-globally-in-application-tp18983927p18986192.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: Float Validation

2008-07-25 Thread Matthew Young
Provide your own IConverter from the TextField to not format number with
radix sign:

add(new TextField(id) {
@Override public final IConverter getConverter(Class type) {
return new IntegerConverter();
}
});

On Fri, Jul 25, 2008 at 2:55 AM, mabel25 [EMAIL PROTECTED] wrote:


 Hi,
 I have been trying to validate FLOAT values by using the NumberValidator.
 However, when I retrieve values such as '12000' from the database into a
 TextField, the textfield will automatically insert commas to become
 '12,000'
 and it will cause problems when I update the database.
 Can anyone please help? Thank you!
 --
 View this message in context:
 http://www.nabble.com/Float-Validation-tp18648670p18648670.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: PageableListView and Detachable Models

2008-06-24 Thread Matthew Young
implement your own List interface

Just in case if anyone not aware of, you only need to implement the size()
and get(int index) methods of the List interface, everything else can just
be unsupported.

On Mon, Jun 23, 2008 at 2:21 PM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 well, thats part of the problem with listview :)

 see idataprovider and dataview

 if you do want to use listview then you have to implement your own
 List interface that loads windows of data at a time depending on which
 get(index) is used.

 -igor

 On Mon, Jun 23, 2008 at 2:16 PM, Jürgen Lind [EMAIL PROTECTED]
 wrote:
  Ok, but since I pass the model into the constructor of the listview, how
  is the model informed which part of the data to load? Is there a method
  that I have been missing?
 
  J.
 
  Igor Vaynberg wrote:
 
  the model can be aware that it is used by the listview. the separation
  here is that the listview is unaware of where or how its list is
  built.
 
  for database stuff i prefer using dataview, it has database semantics
  more closely built into it.
 
  -igor
 
  On Mon, Jun 23, 2008 at 1:55 PM, Jürgen Lind [EMAIL PROTECTED]
  wrote:
 
  Hi,
 
  I am still a bit confused about one thing in the remark below: how can
  the model of the list view return the required items? Should not the
  model
  be unaware that it is used by a list view?
 
  J.
 
  in that case store the list of ids in your resultset as
  a property of the page. the model of the listview can then retrieve
  the subset of this list (based on the current page and number of
 items
  needed) and do a select from foo where id in ( subset of id list )
  query to retrieve the current window of data.
 
  --
  Dr. Jürgen Lind
  iteratec GmbHFon: +49 (0)89 614551-44
  Inselkammerstrasse 4 Fax: +49 (0)89 614551-10
  82008 Unterhaching   Web: www.iteratec.de
 
  Sitz und Registergericht der iteratec GmbH: München HRB 113 519
  Geschäftsführer: Klaus Eberhardt, Mark Goerke, Inge Hanschke, Ralf
 Menzel
 
 
  -
  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]
 
 
  --
  Mit freundlichen Grüßen,
 
  Jürgen Lind
 
  --
  Dr. Jürgen Lind
  iteratec GmbHFon: +49 (0)89 614551-44
  Inselkammerstrasse 4 Fax: +49 (0)89 614551-10
  82008 Unterhaching   Web: www.iteratec.de
 
  Sitz und Registergericht der iteratec GmbH: München HRB 113 519
  Geschäftsführer: Klaus Eberhardt, Mark Goerke, Inge Hanschke, Ralf Menzel
 
 
  -
  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: Style implementation for Round Cornered Tabbed Panels

2008-06-24 Thread Matthew Young
The wicket tab panel example does exactly this

http://www.wicket-library.com/wicket-examples/ajax/tabbed-panel.1

It uses the sliding door technique describe here:

http://www.alistapart.com/articles/slidingdoors/

On Tue, Jun 24, 2008 at 5:02 PM, Brill Pappin [EMAIL PROTECTED] wrote:

 I've seen this done pretty much how you describe (in fact I think there is
 a demo inthe wicket examples) That use two images (left and right).
 the left one is narrow, just enough to contain the rounded corners, the
 right side however is extra long; long enough to fit pretty much any text
 you put in.

 As the tab expands, the right side move to the right and simply clips to
 the left as needed.


 - Brill Pappin



 On 24-Jun-08, at 6:01 PM, Francisco Diaz Trepat - gmail wrote:

  Hi all,

 I need to make each tab on an AjaxTabbedPanel have round corners. No big
 deal so far:

 *div.tabpanel div.tab-row li* {
   background:url(my-round-corner-tab-background.png) no-repeat left top;
 }

 But what if I want to have a resizable round cornered tab. Therefore if
 i
 have a tab title hi and another good bye and have a wonderful
 weekend!!!
 I wouldn't need to have two different background images: one for small
 normal titles and another background for huge horrible ones.

 I believe the technique is to have the two corners edges (left and right)
 and have the middle space with the same colored background.

 so, any ideas on how, and if I could implement that without touching so
 much
 the AjaxTabbedPanel implementation (extending).

 I think I might be able to put the left corner background image on the
 *div.tabpanel
 div.tab-row li a *and the right one on the *div.tabpanel div.tab-row li a
 span

 *This would be, uggly even if I could do it.

 So, any better way of doing this without having to extend the current
 AjaxTabbedPanel?

 thanks,
 f(t)



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




Re: users, please give us your opinion: what is your take on generics with Wicket

2008-06-01 Thread Matthew Young
  [X] Can best be done in a limited fashion, where we only generify
IModel but not components. I care more about what generifying can do
for API clarity (declaring a component to only accept certain models
for instance) than static type checking.

[X] I might rethink upgrading if my choice doesn't win.

On Sun, Jun 1, 2008 at 1:44 PM, Eelco Hillenius [EMAIL PROTECTED]
wrote:

 Hi all,

 We have had several threads in this and the dev list, and some
 discussions in the public on how to incorporate generics in Wicket.

 I'd like to use this thread to gather the opinions of as many regular
 Wicket users as we can. Please help us get an impression of what our
 users think about the issue by completing this simple survey. Note
 that it is not a vote; we only want to get an idea of what you think.

 1) Generifying* Wicket
   [ ] Can best be done like currently in the 1.4 branch, where models
 and components are both generified. I care most about the improved
 static type checking generified models and components give Wicket.
   [ ] Can best be done in a limited fashion, where we only generify
 IModel but not components. I care more about what generifying can do
 for API clarity (declaring a component to only accept certain models
 for instance) than static type checking.
   [ ] Should be avoided, I prefer the way 1.3 works. Because... (fill
 in your opinion here).
   [ ]  (anything other than these choices?)

 2) How strongly do you feel about your choice above?
   [ ] Whatever choice ultimately made, I'll happily convert/ start
 using 1.4 and up.
   [ ] I might rethink upgrading if my choice doesn't win.
   [ ] I definitively won't be using 1.4. if Wicket doesn't go for my
 preference.

 Thanks in advance for everyone participating, and pls feel free to
 explain yourself further beyond just answering these questions!

 Eelco

 p.s. I suggest that the core devs and most active participants and
 previous discussions wait a few days before giving their opinions so
 that we don't flood the thread right from the start.

 * Parameterizing would probably be the better word to use, but
 generifying seems to be the word that many people use.

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




Re: Ajax postcall handler does not get called every time

2008-05-21 Thread Matthew Young
I filed a bug report: https://issues.apache.org/jira/browse/WICKET-1572

This bug is so unfathomable, there is got to be some psychic being involve.


On Wed, May 21, 2008 at 2:32 AM, TonyVegas [EMAIL PROTECTED] wrote:


 *revive zombie*

 has any simple solution been found? I am dealing with the same issue.



 RobinShine wrote:
 
  Hi Matt,
 
  Thanks for your quick answer. Although in this simple case,  it is enough
  to only update the count label.  However in my application, it is
  necessary to update the whole region including the component initiating
  the ajax action. One scenario is that I've written a treetable component
  based on table structure, and it encloses ajax links used to
  expand/collpase tree nodes. In the event handler of thse links, I modify
  tree structure to satisfy node expanding/collapsing, and add the whole
  treetable component to the ajax request target for simplicity reason.
 
  From your words, it seems that it is not safe to use Wicket Ajax this
 way.
  However, my application uses this pattern extensively. Are there any
  other approaches for my scenario?
 
  Regards.
  Robin
 
  Matthew Young [EMAIL PROTECTED] wrote: The problem is you are ajax
  updating this whole thing including the nested
  ajaxlink:
 
 
 
 
 link
 
 
 
 
  it causes the wicket-ajax js stuff header contributed everytime the link
  is
  clicked.  Open the ajax debug window to see.  This re-init wipe out the
  postcallhandler install on page load so there is nothing there to call
  once
  the link is clicked.
 
  I cannot explain why you need to close and re-open the browser for this
 to
  happen. It shouldn't work at all.  I'm sure Matej and Igor can explain.
 
  Change your page to this and only ajax update the count then you have
 no
  problem:
 
 
 
 
 
 
 
 link
 
 
 

 --
 View this message in context:
 http://www.nabble.com/Ajax-postcall-handler-does-not-get-called-every-time-tp16659218p17359455.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: Form models not populated when using FileUploadField and multipart/form-data .. ?

2008-05-19 Thread Matthew Young
I'd forgotten that this was required on multipart forms:
f.setMultiPart(true);

Odd, I didn't call .setMultiPart(true); and I have no problem at all.


On Mon, May 19, 2008 at 6:24 AM, Joel Halbert [EMAIL PROTECTED]
wrote:

 I am an idiot.
 I'd forgotten that this was required on multipart forms:
 f.setMultiPart(true);

 (hanging head in shame)

 --
 From: Joel Halbert [EMAIL PROTECTED]
 Sent: Monday, May 19, 2008 2:10 PM
 To: users@wicket.apache.org
 Subject: Re: Forn models not populated when using FileUploadField and
 multipart/form-data .. ?

  I've identified that in the cases where this is working the request type
 Wicket creates to handle the form submission is a
 MultipartServletWebRequest, and in those where it is not the request type
 is a standard ServletWebRequest.

 The form markup on both pages looks the same

 Form that does work:
 form id=addb enctype=multipart/form-data
 action=?wicket:bookmarkablePage=%3ARatingAddamp;wicket:interface=%3A7%3Aadd%3A%3AIFormSubmitListener%3A%3Aamp;bottomTab=0amp;topTab=0
 method=post wicket:id=add


 Form that doesn't work:
 form id=register7 enctype=multipart/form-data
 action=?wicket:bookmarkablePage=%3ARegisterUseramp;wicket:interface=%3A2%3Aregister%3A%3AIFormSubmitListener%3A%3Aamp;bottomTab=0amp;topTab=0
 method=post wicket:id=register


 Any ideas why  a ServletWebRequest would be used to handle a form of type
 multipart ?

 --
 From: Joel Halbert [EMAIL PROTECTED]
 Sent: Monday, May 19, 2008 1:14 PM
 To: users@wicket.apache.org
 Subject: Forn models not populated when using FileUploadField and
 multipart/form-data .. ?

  Hi,

 I'm experiencing a problem on a form whereby if I include a
 FileUploadField in the form, causing the form encoding type to become
 multipart/form-data, none of the model objects from other fields on the
 form are correctly populated when the form is submitted. Oddly enough we do
 have other pages that do use FileUploadField with no problems, and I'm
 unable to see any differences between the page that doesn't work and those
 that do.

 Is there any obvious reason why model objects might not get populated
 when the form enctype becomes multipart/form-data as is the case when
 using a FileUploadField ? If i remove the FileUploadField from the form
 everything works as expected.

 Thanks,
 Joel



 -
 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: Text handling in wicket

2008-05-18 Thread Matthew Young
He is probably talking about if resource string is html code, then there can
be css class string in there like this:

resource-string-x=This is span class=stand-outsomething something/span
and span class=another-classsomething something/span.

He is worry that if the designer change the class name stand-out or
another-class, then you will have to edit many property resource file.

On Sun, May 18, 2008 at 11:28 AM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 i dont really understand what you are talking about

 -igor

 On Sun, May 18, 2008 at 11:25 AM, Mathias P.W Nilsson
 [EMAIL PROTECTED] wrote:
 
  Doesn't this meen that if I use a class for css or id then I need to
  consider, html file, property file and css file. So If a designer changes
  the css then I need to change the property file as well. Is this really
  good?
  --
  View this message in context:
 http://www.nabble.com/Text-handling-in-wicket-tp17303050p17306072.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: Account Activation Email generation and response processing: any design example?

2008-05-16 Thread Matthew Young
You may also want to have a enum/int to represent what kind of token it is.
New user, new email, forgot password, etc..

To have a field in the user-account table to store this value?  Or do you
mean to send this as part of the activation URL?

And what is the purpose to have this?

On Thu, May 15, 2008 at 6:42 PM, Ryan Gravener [EMAIL PROTECTED]
wrote:

 You may also want to have a enum/int to represent what kind of token it is.
 New user, new email, forgot password, etc..

 On Thu, May 15, 2008 at 7:01 PM, James Carman [EMAIL PROTECTED]
 wrote:

  java.util.UUID.randomUUID().toString()
 
  On Thu, May 15, 2008 at 6:57 PM, Matthew Young [EMAIL PROTECTED]
 wrote:
   I need to implement the usual account activation via email function.
  Can
   anyone point me to some example of how this is implemented? If in
 Wicket
   even better but anything would help me a lot.
  
   One question I have is how to generate hard to guess unique keys in the
   email link? I use Hibernate  MySql, does this give me some easy way to
   generate these keys? Use Jakarta common-id to generate uuid?
  
   I plan to have an activation field in the user table to store the
  activation
   key, once the user respond to the activation email link, clear the
 field
  to
   indicate the account is activated. Is this how it's done?
  
   Thanks for any help!
  
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 


 --
 Ryan Gravener
 http://twitter.com/ryangravener



Re: Account Activation Email generation and response processing: any design example?

2008-05-16 Thread Matthew Young
What is the advantage of using message digest over uuid?  Isn't message
digest not guaranteed to be unique where as UUID is always unique?

On Thu, May 15, 2008 at 7:39 PM, Martin Makundi 
[EMAIL PROTECTED] wrote:

 You could also just use a md5 hashkey with content specific to the account:

MessageDigest messageDigest = MessageDigest.getInstance(MD5);
return new String(messageDigest.digest((encryptionKey +
 value).getBytes()));

 **
 Martin

 2008/5/16 Ryan Gravener [EMAIL PROTECTED]:
  You may also want to have a enum/int to represent what kind of token it
 is.
  New user, new email, forgot password, etc..
 
  On Thu, May 15, 2008 at 7:01 PM, James Carman 
 [EMAIL PROTECTED]
  wrote:
 
  java.util.UUID.randomUUID().toString()
 
  On Thu, May 15, 2008 at 6:57 PM, Matthew Young [EMAIL PROTECTED]
 wrote:
   I need to implement the usual account activation via email function.
  Can
   anyone point me to some example of how this is implemented? If in
 Wicket
   even better but anything would help me a lot.
  
   One question I have is how to generate hard to guess unique keys in
 the
   email link? I use Hibernate  MySql, does this give me some easy way
 to
   generate these keys? Use Jakarta common-id to generate uuid?
  
   I plan to have an activation field in the user table to store the
  activation
   key, once the user respond to the activation email link, clear the
 field
  to
   indicate the account is activated. Is this how it's done?
  
   Thanks for any help!
  
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
  --
  Ryan Gravener
  http://twitter.com/ryangravener
 

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




Re: RequiredBorder being applied multiple times in ajax calls

2008-05-15 Thread Matthew Young
Sorry I can't help you with your question.  But may I ask where you get the
PhoneFormatter?

On Wed, May 14, 2008 at 5:58 PM, Sam Barnum [EMAIL PROTECTED] wrote:

 Using the tips in this PDF
 http://londonwicket.org/content/LondonWicket-FormsWithFlair.pdf

 I created the simple RequiredBorder class as follows:

 public class RequiredBorder extends MarkupComponentBorder {
public void renderAfter(Component component) {
FormComponent fc = (FormComponent) component;
if (fc.isRequired()) {
super.renderAfter(component);
}
}
 }

 This basically adds a * after any required fields.  It seemed to work
 great until I used it with an ajax phone formatter behavior:

 new AjaxFormComponentUpdatingBehavior(onchange) {
protected void onUpdate(AjaxRequestTarget target) {
Object oldValue = component.getValue();
String formatted = new PhoneFormatter().format(oldValue);
component.setModelObject(formatted);
target.addComponent(component);
}
 }


 This caused duplicate * indicators to appear after my phone field when
 the phone number changed, one per onchange request.  I tried adding a
 boolean field to the RequiredBorder so it only gets processed once.  This
 fixed the phone formatter duplicates, but if the form submits and stays on
 the same page, all the * marks disappear from the required fields.

 This is definitely some sort of lifecycle problem, but how do you fix it?

 On a related note, is it generally a bad idea to mix AJAX and non-ajax
 actions?  It seems like this is one of many issues I've run into when doing
 this.

 Thanks,

 -Sam Barnum


Account Activation Email generation and response processing: any design example?

2008-05-15 Thread Matthew Young
I need to implement the usual account activation via email function.  Can
anyone point me to some example of how this is implemented? If in Wicket
even better but anything would help me a lot.

One question I have is how to generate hard to guess unique keys in the
email link? I use Hibernate  MySql, does this give me some easy way to
generate these keys? Use Jakarta common-id to generate uuid?

I plan to have an activation field in the user table to store the activation
key, once the user respond to the activation email link, clear the field to
indicate the account is activated. Is this how it's done?

Thanks for any help!


Re: Is there a setGatherAbbreviatedBrowserInfo(true) as appose to setGatherExtendedBrowserInfo(true)?

2008-05-05 Thread Matthew Young
Thank you! I see how this work now.

On Sun, May 4, 2008 at 10:17 PM, Eelco Hillenius [EMAIL PROTECTED]
wrote:

 On Fri, May 2, 2008 at 4:59 PM, Matthew Young [EMAIL PROTECTED] wrote:
  I only want to find out the user's timezone.
   setGatherExtendedBrowserInfo(true) redirect page take too long,
 sometimes
 it
   stays on the screen many seconds.

 You can often best do this in a custom way by either creating your own
 variant of WebRequestCycle#newClientInfo or e.g. by integrating it in a
 login form for instance (which of course only works for applications where
 users have to be logged in before they get to the point where your browser
 info matters).

 That roughly works like this:

 Java:

 pubic LoginForm(String id) {
  super(id, new CompoundPropertyModel(new ClientPropertiesBean()));
  add(new HiddenField(navigatorAppName));
  add(new HiddenField(navigatorAppVersion));
  add(new HiddenField(navigatorAppCodeName));
  add(new HiddenField(navigatorCookieEnabled));
  add(new HiddenField(navigatorJavaEnabled));
  add(new HiddenField(navigatorLanguage));
  add(new HiddenField(navigatorPlatform));
  add(new HiddenField(navigatorUserAgent));
  add(new HiddenField(screenWidth));
  add(new HiddenField(screenHeight));
  add(new HiddenField(screenColorDepth));
  add(new HiddenField(utcOffset));
  ...

 HTML template:

 wicket:head!-- if in a panel --
  script language=javascript src=/html/static/js/rollover.js/script
 /wicket:head
 ...
 form name=login wicket:id=login style=margin: 0px; 
 onsubmit=submitform(this)
  span style=display: hidden;
   input type=hidden name=navigatorAppName
 wicket:id=navigatorAppName
 value=test /
   input type=hidden name=navigatorAppVersion
 wicket:id=navigatorAppVersion value=test /
   input type=hidden name=navigatorAppCodeName
 wicket:id=navigatorAppCodeName /
   input type=hidden name=navigatorCookieEnabled
 wicket:id=navigatorCookieEnabled /
   input type=hidden name=navigatorJavaEnabled
 wicket:id=navigatorJavaEnabled /
   input type=hidden name=navigatorLanguage
 wicket:id=navigatorLanguage /
   input name=navigatorPlatform type=hidden
 wicket:id=navigatorPlatform /
   input name=navigatorUserAgent  type=hidden
  wicket:id=navigatorUserAgent /
   input name=screenWidth type=hidden wicket:id=screenWidth /
   input name=screenHeight type=hidden wicket:id=screenHeight /
   input name=screenColorDepth type=hidden
 wicket:id=screenColorDepth
 /
   input name=utcOffset type=hidden wicket:id=utcOffset /
  /span
  ...
 /form
 ...

 Login.js:

 function submitform(form) {
  form.navigatorAppName.value = window.navigator.appName;
  form.navigatorAppVersion.value = window.navigator.appVersion;
  form.navigatorAppCodeName.value = window.navigator.appCodeName;
  var cookieEnabled = (window.navigator.cookieEnabled)? true : false;
  if (typeof window.navigator.cookieEnabled == undefined 
 !cookieEnabled)
 {
   document.cookie = wickettestcookie;
   cookieEnabled = (document.cookie.indexOf(wickettestcookie)!=-1)? true
 :
 false;
  }
  form.navigatorCookieEnabled.value = cookieEnabled;
  form.navigatorJavaEnabled.value =  window.navigator.javaEnabled();
  form.navigatorLanguage.value = window.navigator.language ?
 window.navigator.language : window.navigator.userLanguage;
  form.navigatorPlatform.value = window.navigator.platform;
  form.navigatorUserAgent.value = window.navigator.userAgent;
  if (window.screen) {
  form.screenWidth.value = window.screen.width;
  form.screenHeight.value = window.screen.height;
  form.screenColorDepth.value = window.screen.colorDepth;
  }
  form.utcOffset.value = (new Date().getTimezoneOffset() / -60);
  return true;
 }


 That should give you an idea :-)

 Eelco



Can the UploadProgressBar not submit if the file field is blank?

2008-05-02 Thread Matthew Young
Instead of submit, pop up a dialog telling the user to choose a file to
upload?  As is now, the UploadProgressBar show up, form submit ,
getFileUpload returns null and error handling happens on the server.


Re: Can the UploadProgressBar not submit if the file field is blank?

2008-05-02 Thread Matthew Young
Can you just mark it as required?

It's not the validation part I have problem with. I want to prevent the
UploadProgressBar from showing up when the field is blank and show a
javascript alert in that case.  There is no need to submit to the server.

The UploadProgressBar installs an 'onsubmit' event handler to show itself.
It's installed by adding a AttributeModifier to the form. Is there any way I
can put stuff *in front* of its javascript?  So I can have something like
this:

if (field.value == null || field.value==){alert(You must choose a file
to upload);return false;}[the rest of UploadProgressBar stuff]



On Fri, May 2, 2008 at 3:19 AM, James Carman [EMAIL PROTECTED]
wrote:

 Can you just mark it as required?

 On Fri, May 2, 2008 at 2:15 AM, Matthew Young [EMAIL PROTECTED] wrote:
  Instead of submit, pop up a dialog telling the user to choose a file to
   upload?  As is now, the UploadProgressBar show up, form submit ,
   getFileUpload returns null and error handling happens on the server.
 

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




Re: Can the UploadProgressBar not submit if the file field is blank?

2008-05-02 Thread Matthew Young
I solve this problem by putting an 'onclick' handler on the Submit button to
check for blank input.


Is there a setGatherAbbreviatedBrowserInfo(true) as appose to setGatherExtendedBrowserInfo(true)?

2008-05-02 Thread Matthew Young
I only want to find out the user's timezone.
setGatherExtendedBrowserInfo(true) redirect page take too long, sometimes it
stays on the screen many seconds.


Re: RTFM messages

2008-05-01 Thread Matthew Young
Just want to add my appreciation to all the help I got here, especially from
Igor.  Sometime I receive the answer instantly, even on weekend!  One thing
I learn to do is not only read the javadoc but read the code.  A lot of the
component stuffs are pretty easy to follow, especially if you use something
like Eclipse's Java Browsing.  Go Wicket!


Re: How to show a bottom-of-the-page feedback panel?

2008-05-01 Thread Matthew Young
public class YourPage extends WebPage implement IHeadContributor {



// in case form has error, scroll down
@Override public void renderHead(IHeaderResponse r) {
if (form.hasError()) {
r.renderOnLoadJavascript(location.hash='YOUR-ANCHOR');
}
}

}

On Thu, May 1, 2008 at 4:08 PM, nate roe [EMAIL PROTECTED] wrote:

 If I have a feedback panel positioned together with a form at the bottom
 of
 a very long page, how can I cause the browser to snap to that feedback
 panel
 upon validation error?

 I could use an anchor tag at the feedback panel, but how would I tell
 Wicket
 to go to that anchor upon validation error?

 Thanks,
 Nate Roe



How to run some javascript some # of seconds after page is loaded

2008-04-30 Thread Matthew Young
I have a feedback panel on the page I want to fade way after 7 seconds.  I
tried adding this to the page:

private static AbstractBehavior feedbackSelfDisappear = new
AbstractBehavior() {
private static final long serialVersionUID = 1L;
@Override public void renderHead(IHeaderResponse response) {
super.renderHead(response);

response.renderOnDomReadyJavascript(window.setTimeout(Effect.Fade('feedback-id'),
7000));
}
};


But the fade happens immediately without delay.  I tried these and all the
same:


response.renderOnDomReadyJavascript(setTimeout(Effect.Fade('feedback-id'),
7000));

response.renderOnLoadReadyJavascript(window.setTimeout(Effect.Fade('feedback-id'),
7000));

response.renderOnLoadReadyJavascript(setTimeout(Effect.Fade('feedback-id'),
7000));

What's the right way to get make this happen?


Re: How to run some javascript some # of seconds after page is loaded

2008-04-30 Thread Matthew Young
Alright, that worked.  Thanks!

On Wed, Apr 30, 2008 at 6:13 PM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 window.setTimeout(function() {Effect.Fade('feedback-id');}, 7000)

 -igor


 On Wed, Apr 30, 2008 at 6:08 PM, Matthew Young [EMAIL PROTECTED] wrote:
  I have a feedback panel on the page I want to fade way after 7 seconds.
  I
   tried adding this to the page:
 
  private static AbstractBehavior feedbackSelfDisappear = new
   AbstractBehavior() {
  private static final long serialVersionUID = 1L;
  @Override public void renderHead(IHeaderResponse response) {
  super.renderHead(response);
 
 
  
 response.renderOnDomReadyJavascript(window.setTimeout(Effect.Fade('feedback-id'),
   7000));
  }
  };
 
 
   But the fade happens immediately without delay.  I tried these and all
 the
   same:
 
 
 
  response.renderOnDomReadyJavascript(setTimeout(Effect.Fade('feedback-id'),
   7000));
 
 
  
 response.renderOnLoadReadyJavascript(window.setTimeout(Effect.Fade('feedback-id'),
   7000));
 
 
  response.renderOnLoadReadyJavascript(setTimeout(Effect.Fade('feedback-id'),
   7000));
 
   What's the right way to get make this happen?
 

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




Anyone seen this Firefox bug: tabs stop working after ajax update

2008-04-28 Thread Matthew Young
I have a tabpanel.  After ajax update to a div inside the tab-panel, the tab
stop working: rollover hover doesn't work, no reaction to click.  This only
happen to Firefox both Windows and Linux. No problem with IE7, Opera or
Safari.  You can see this in action here: 
http://208.131.142.119:8080/gsweb/invitations;.  Scroll to the bottom and
click on the navigator.  This triggers an ajax update to a div inside the
tab-panle div and the navigator itself.  After that, the tabs stop working.
What is going on?


Re: Anyone seen this Firefox bug: tabs stop working after ajax update

2008-04-28 Thread Matthew Young
I think that your images div is overlapping the tab-row div.

Oh wow, thanks for spotting this.  The tab-panel div is overlapping tab-row
div. I have no idea why though.

I use your suggestion on tab-panel:

  div.tab-panel { margin-top: 45px; }

and no more problem with the tabs.

But how did they become overlap?  Margin properties are not inherited so it
couldn't be from the parent.

Thanks a lot for your help.

On Mon, Apr 28, 2008 at 10:26 AM, Cristi Manole [EMAIL PROTECTED]
wrote:

 I think that your images div is overlapping the tab-row div.

 You could try to *add margin-top: 45px;* in the #photos style [line 172 in
 your style.css].

 I am not sure if this will work since I see the first time the page loads
 the tabs work... anyways, by changing those on the fly in my browser I
 managed to get it working after clicking the navigator, as you need it to.

 Hope this helps,
 Cristi Manole

 On Mon, Apr 28, 2008 at 9:18 AM, Matthew Young [EMAIL PROTECTED] wrote:

  I have a tabpanel.  After ajax update to a div inside the tab-panel, the
  tab
  stop working: rollover hover doesn't work, no reaction to click.  This
  only
  happen to Firefox both Windows and Linux. No problem with IE7, Opera or
  Safari.  You can see this in action here: 
  http://208.131.142.119:8080/gsweb/invitations;.  Scroll to the bottom
 and
  click on the navigator.  This triggers an ajax update to a div inside
 the
  tab-panle div and the navigator itself.  After that, the tabs stop
  working.
  What is going on?
 



Is it kosher to have wicket-event.js and wicket-ajax.js contributed on every ajax update?

2008-04-27 Thread Matthew Young
The AjaxPagingNavigator is header-contributing wicket-event.js and
wicket-ajax.js everytime a link is clicked.  There must be something in
these js to make this ok?


Re: Is it kosher to have wicket-event.js and wicket-ajax.js contributed on every ajax update?

2008-04-27 Thread Matthew Young
filter out the duplicates on the client side

  How do you do that?  Would it be possible to make stuff like scriptaculous
effects to work like that?  Scriptaculous doesn't work if it's ajax
contributed more than once.

On Sat, Apr 26, 2008 at 11:25 PM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 wicket will filter out the duplicates on the client side

 -igor

 On Sat, Apr 26, 2008 at 11:20 PM, Matthew Young [EMAIL PROTECTED] wrote:
  The AjaxPagingNavigator is header-contributing wicket-event.js and
   wicket-ajax.js everytime a link is clicked.  There must be something
 in
   these js to make this ok?
 

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




Re: Is it kosher to have wicket-event.js and wicket-ajax.js contributed on every ajax update?

2008-04-27 Thread Matthew Young
Wicket filters the contributions on client side (according to the
URL)

Can explain what is (according to the URL)?  Does the filtering apply to any
js?

If wicket js is filtered on the client side, then I don't know what's going
on with this question:

http://www.nabble.com/Ajax-postcall-handler-does-not-get-called-every-time-td16659218.html#a16663054

Can you please elaborate on scriptaculous not working?

I run into this problem with the lightbox component in wicket-stuff.
Lightbox uses scriptaculous. My page also uses scriptaculous so I includes
the lib (implements IHeaderContributor and renderHead on the page).  On ajax
update, the lightbox component contributes scriptaculous.  Once that happen,
scriptaculous effects stops working.  I had to disable lightbox from
contributing scriptaculous.

Another problem is the lightbox.js needs to be part of the page because it
initializes itself on window load event.  Lightbox doesn't work if
lightbox.js is loaded via ajax because there is no window load event to hook
itself up.

On Sun, Apr 27, 2008 at 2:15 AM, Matej Knopp [EMAIL PROTECTED] wrote:

 Wicket filters the contributions on client side (according to the
 URL). Can you please elaborate on scriptaculous not working?

 -Matej

 On Sun, Apr 27, 2008 at 9:43 AM, Matthew Young [EMAIL PROTECTED] wrote:
  filter out the duplicates on the client side
 
How do you do that?  Would it be possible to make stuff like
 scriptaculous
   effects to work like that?  Scriptaculous doesn't work if it's ajax
   contributed more than once.
 
   On Sat, Apr 26, 2008 at 11:25 PM, Igor Vaynberg 
 [EMAIL PROTECTED]
   wrote:
 
 
 
wicket will filter out the duplicates on the client side
   
-igor
   
On Sat, Apr 26, 2008 at 11:20 PM, Matthew Young [EMAIL PROTECTED]
 wrote:
 The AjaxPagingNavigator is header-contributing wicket-event.js
 and
  wicket-ajax.js everytime a link is clicked.  There must be
 something
in
  these js to make this ok?

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



 --
 Resizable and reorderable grid components.
 http://www.inmethod.com

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




Re: Is it kosher to have wicket-event.js and wicket-ajax.js contributed on every ajax update?

2008-04-27 Thread Matthew Young
That would be a wicket bug, is there a jira entry for it?

Just created one:

https://issues.apache.org/jira/browse/WICKET-1572

This one should not be called a bug. Open browser first, then start wicket
app, it's fine. But start wicket app first, then open browser, it's not.
What difference do it make? The fix and the explanation will be real
interesting.

In that case lightbox needs to be fixed

lightbox.js does this at the very end:

function initLightbox() { myLightbox = new Lightbox(); }
Event.observe(window, 'load', initLightbox, false);

So how to fix this? Change lightbox.js?


A question for Igor

2008-04-24 Thread Matthew Young
I am looking at the wicket.markup.html.tabs.TabbedPanel
(wicket-extensions)http://wicketstuff.org/wicket13/compref/?wicket:bookmarkablePage=%3Aorg.apache.wicket.examples.compref.TabbedPanelPageexample
on
http://wicketstuff.org/wicket13/compref/, I couldn't figure out how you
switch the css.  Is that done in WicketExamplePage?  Unfortunately,
WicketExamplePage.java is not part of the source.


Re: A question for Igor

2008-04-24 Thread Matthew Young
Ah, I see.  Thanks!

// add the new tabbed panel, attribute modifier only used to switch
// between different css variations
add(new TabbedPanel(tabs, tabs).add(new AttributeModifier(class,
 true,
TabbedPanelPage.this.getModel(;


On Wed, Apr 23, 2008 at 11:12 PM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 the code is on TabbedPanelPage, the links simply switch the css class
 that is on the div tag used to attach to tabbed panel.

 -igor


 On Wed, Apr 23, 2008 at 11:08 PM, Matthew Young [EMAIL PROTECTED] wrote:
  I am looking at the wicket.markup.html.tabs.TabbedPanel
   (wicket-extensions)
 http://wicketstuff.org/wicket13/compref/?wicket:bookmarkablePage=%3Aorg.apache.wicket.examples.compref.TabbedPanelPage
 example
   on
   http://wicketstuff.org/wicket13/compref/, I couldn't figure out how you
   switch the css.  Is that done in WicketExamplePage?  Unfortunately,
   WicketExamplePage.java is not part of the source.
 

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




Re: Anyway to fix this generic warning?

2008-04-24 Thread Matthew Young
ArthIT: How to suppress the warning is not why I asked the question.  I want
to be sure generify Wicket is correct so user code can be clean and warning
free.

in Eclipse go to Window - Preferences
Type Generic in the search box. Now you should see the
Java-compiler-Errors/Warnings Node.
Open it, and change settings under Generic types to whatever you want
(Ignore f.e.)

I don't do this because that covers up all the warnings of that kind. I
prefer to see the warnings and deal with them.  If the warning cannot be
fixed, I use @SupressWarning on the spot.

On Thu, Apr 24, 2008 at 3:53 AM, ArthIT [EMAIL PROTECTED] wrote:


 Hi,

 in Eclipse go to Window - Preferences
 Type Generic in the search box. Now you should see the
 Java-compiler-Errors/Warnings Node.
 Open it, and change settings under Generic types to whatever you want
 (Ignore f.e.)

 Cheerz


 MYoung wrote:
 
  (Other than using @SupressWarnings)
 
 AjaxFallbackButtonPage1 submitButton = new
  AjaxFallbackButtonPage1(submitButton, form) {
 
  @Override protected void onSubmit(AjaxRequestTarget target,
  Form
  f) {  Warning here
  .
 
  Form is a raw type. References to generic type FormT should be
  parameterized.
 
 

 --
 View this message in context:
 http://www.nabble.com/Anyway-to-fix-this-generic-warning--tp16848154p16849776.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: image resource

2008-04-24 Thread Matthew Young
new WebMarkupContainer(wicketId) {
private static final long serialVersionUID = 1L;
@Override protected void onComponentTag(final ComponentTag tag){
super.onComponentTag(tag);
tag.put(src, http://www.someothersite.com/image.gif;);
}
};


On Thu, Apr 24, 2008 at 11:47 AM, i ii [EMAIL PROTECTED] wrote:


 how to get image src from other site? i need to update image based on user
 input

 // does not work
 new Image(wicketId, new Model(http://www.someothersite.com/image.gif
 ));



Re: Anyway to fix this generic warning?

2008-04-23 Thread Matthew Young
Form?

I tried that already and it's no good.

Compile Error: Name clash: The method onSubmit(AjaxRequetTarget, Form?) of
type new AjaxFallbackButtonPage1(){} has the same erasure as
onSubmit(AjaxRequestTarget, Form) of type AjaxFallbackButtonT but does not
override it.

On Wed, Apr 23, 2008 at 2:54 AM, Johan Compagner [EMAIL PROTECTED]
wrote:

 Form?

 On Wed, Apr 23, 2008 at 6:52 AM, Matthew Young [EMAIL PROTECTED] wrote:

  (Other than using @SupressWarnings)
 
AjaxFallbackButtonPage1 submitButton = new
  AjaxFallbackButtonPage1(submitButton, form) {
 
 @Override protected void onSubmit(AjaxRequestTarget target,
  Form
  f) {  Warning here
  .
 
   Form is a raw type. References to generic type FormT should be
  parameterized.
 



Anyway to fix this generic warning?

2008-04-22 Thread Matthew Young
(Other than using @SupressWarnings)

   AjaxFallbackButtonPage1 submitButton = new
AjaxFallbackButtonPage1(submitButton, form) {

@Override protected void onSubmit(AjaxRequestTarget target, Form
f) {  Warning here
.

 Form is a raw type. References to generic type FormT should be
parameterized.


PageableListView need to be generified?

2008-04-22 Thread Matthew Young
I'm getting warning on:

new PageableListView() {

 @Override protected void populateItem(ListItem item) {

 ListItem is generic. References to generic type ListItemT should be
parameterized.


Re: Why is LoadDetachableModel called twice?

2008-04-18 Thread Matthew Young
dump the stack trace and see?

   new Exception().printStackTrace();

On Fri, Apr 18, 2008 at 8:45 PM, Fernando Wermus [EMAIL PROTECTED]
wrote:

 Warren,
  I am new using LoadableDetacheModel. I would like to know why is
 called twice in your example.

 Thanks.

 --
 Fernando Wermus.



Re: possible html parsing bug?

2008-04-16 Thread Matthew Young
public class WicketApplication extends WebApplication
{
@Override public void init() {
this.getMarkupSettings().setStripXmlDeclarationFromOutput(true);
}
}

On Wed, Apr 16, 2008 at 3:06 AM, [EMAIL PROTECTED] wrote:

 Hi:
 It took me a while to find out why my iframe was not displaying properly.
 I have a parent/container page like

 ?xml version=1.0 encoding=UTF-8?
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
  http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket=
 http://wicket.apache.org/;
 ...
 wicket:childiframe child/wicket:child

 and the child page is like

 ?xml version=1.0 encoding=UTF-8?
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
  http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket=
 http://wicket.apache.org/;
 ...
 wicket:extend

 The final rendering the html page would contain ?xml. declaration ,
 which results in improper display in browser.  Once I remove the ?xml..
 line from the child html file,  the final rendering of html
 does not show ?xml  line, i.e. the first line is !DOCTYPE..., and this
 somehow make the browser happy and display the page correctly.
 My understanding is that for child page, wicket would discard anything
 outside wicket:extend, but apparently, the presence of ?xml as the
 first line in child html somehow forced the parser to add the ?xml  to the
 final html output as the first line, which also surprises as I thought
 wicket would stream out content as it goes instead of waiting to parse the
 entire tree.

 Thanks



Re: Ajax postcall handler does not get called every time

2008-04-13 Thread Matthew Young
The problem is you are ajax updating this whole thing including the nested
ajaxlink:

   div wicket:id=container
   div wicket:id=count/div
   a wicket:id=linklink/a
   /div


it causes the wicket-ajax js stuff header contributed everytime the link is
clicked.  Open the ajax debug window to see.  This re-init wipe out the
postcallhandler install on page load so there is nothing there to call once
the link is clicked.

I cannot explain why you need to close and re-open the browser for this to
happen. It shouldn't work at all.  I'm sure Matej and Igor can explain.

Change your page to this and only ajax update the count then you have no
problem:


   div wicket:id=container
   div wicket:id=count/div
   /div
   a wicket:id=linklink/a


Re: Ajax postcall handler does not get called every time

2008-04-12 Thread Matthew Young
Where is the attachment?


How to get wicket-SNAPSHOT?

2008-04-10 Thread Matthew Young
I want to use wicket-SNAPSHOT to give 1.4 a try.  But I get mvn error:

[INFO] snapshot org.apache.wicket:wicket:SNAPSHOT: checking for updates from
wicket-snapshots
Downloading:
http://wicketstuff.org/maven/repository//org/apache/wicket/wicket/SNAPSHOT/wicket-SNAPSHOT.pom
Downloading:
http://wicketstuff.org/maven/repository//org/apache/wicket/wicket/SNAPSHOT/wicket-SNAPSHOT.jar
[WARNING] An error occurred during dependency resolution.Failed to
retrieve org.apache.wicket:wicket-SNAPSHOT
Caused by: Unable to download the artifact from any repository


Here is my pom.xml

...
  repositories
repository
  idwicket-snapshots/id
  nameWicket snapshot repository/name
  urlhttp://wicketstuff.org/maven/repository//url
/repository
  /repositories



properties
wicket.versionSNAPSHOT/wicket.version
jetty.version6.1.7/jetty.version
/properties


What am I doing wrong?


Migrating to 1.4-SNAPSHOT: how to rid of generic warnings?

2008-04-10 Thread Matthew Young
Oh mine, some many generic warnings after moving to 1.4.  I got rid of them
by putting in type parameters but I'm not sure if I'm doing the right thing.
There is one warning I don't know how to fix:

WARNING: Type safety: the method add(Component) belongs to the raw type
MarkupContainer. Reference to generic type MarkupContainerT should be
parameterized.


What are the benefits of generifying Wicket? I only know one is type safe
model.  What else?



Here is a little test page, please take a look and see if I'm doing thing
correctly?

public class HomePage extends WebPage {

private static final long serialVersionUID = 1L;

private String hi =;
private int count;

public HomePage(final PageParameters parameters) {

// WARNING HERE and next line
add(new LabelHomePage(message, If you see this message wicket
is properly configured and running));
add(new FeedbackPanel(feedback));
FormHomePage form = new FormHomePage(form, new
CompoundPropertyModelHomePage(this)) {
private static final long serialVersionUID = 1L;
@Override public void onSubmit() {
++count;
}
};
add(form);// WARNING HERE
form.add(new TextFieldHomePage(hi).setRequired(true));
// WARNING HERE
add(new LabelHomePage(hihi, new PropertyModelHomePage(this,
hello)));
}

public String getHello() {
return hi + : you say hello  + count +  times.;
}
}


Re: Migrating to 1.4-SNAPSHOT: how to rid of generic warnings?

2008-04-10 Thread Matthew Young
 public class HomePage extends WebPageObject {

ERROR: The type WebPage is not generic; it cannot be parameterized with
arguments Object



you COULD use the @SuppressWarnings({unchecked})

I would rather not use @SupressWarnings if I can do the right thing.

On Thu, Apr 10, 2008 at 4:49 PM, Matej Knopp [EMAIL PROTECTED] wrote:

 Problem is that WebPage is generic class but your instance doesn't
 have the type specified. Since you page doesn't have a model object
 the type is not really necessary, but the compiler doesn't know that.

 You can try this:


 public class HomePage extends WebPageObject {

 This should get rid of the wanings when adding components.

 -Matej

 On Fri, Apr 11, 2008 at 1:19 AM, Matthew Young [EMAIL PROTECTED] wrote:
  Oh mine, some many generic warnings after moving to 1.4.  I got rid of
 them
   by putting in type parameters but I'm not sure if I'm doing the right
 thing.
   There is one warning I don't know how to fix:
 
   WARNING: Type safety: the method add(Component) belongs to the raw type
   MarkupContainer. Reference to generic type MarkupContainerT should be
   parameterized.
 
 
   What are the benefits of generifying Wicket? I only know one is type
 safe
   model.  What else?
 
 
 
   Here is a little test page, please take a look and see if I'm doing
 thing
   correctly?
 
   public class HomePage extends WebPage {
 
  private static final long serialVersionUID = 1L;
 
  private String hi =;
  private int count;
 
  public HomePage(final PageParameters parameters) {
 
  // WARNING HERE and next line
  add(new LabelHomePage(message, If you see this message
 wicket
   is properly configured and running));
  add(new FeedbackPanel(feedback));
  FormHomePage form = new FormHomePage(form, new
   CompoundPropertyModelHomePage(this)) {
  private static final long serialVersionUID = 1L;
  @Override public void onSubmit() {
  ++count;
  }
  };
  add(form);// WARNING HERE
  form.add(new TextFieldHomePage(hi).setRequired(true));
  // WARNING HERE
  add(new LabelHomePage(hihi, new
 PropertyModelHomePage(this,
   hello)));
  }
 
  public String getHello() {
  return hi + : you say hello  + count +  times.;
  }
   }
 



 --
 Resizable and reorderable grid components.
 http://www.inmethod.com

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




Re: Invoulentary session sharing/leakage in Wicket 1.3.x

2008-04-08 Thread Matthew Young
log.error(Session.get().getId() +   + Session.get().hashCode() +   +
currentIp +  C:  + currentCustomer != null ? currentCustomer.getFullName()
: nocustomer);

You should put parent around ?:.  The '+' op is evaluated before !=.  Your
statement is effectively this:

   (C: + currentCustomer) != null ? currentCustomer.getFullName() :
nocustomer

So != null is always true and you get NPE on currentCustomer.getFullName()

Do this:

C: + (currentCustomer != null ? currentCustomer.getFullName() :
nocustomer));

then you are safe.

On Tue, Apr 8, 2008 at 8:01 AM, Edvin Syse [EMAIL PROTECTED] wrote:

 I think I have something... Look at the attached stacktrace. It seems I
 get an NPE on the line where I do:

 log.error(Session.get().getId() +   + Session.get().hashCode() +   +
 currentIp +  C:  + currentCustomer != null ? currentCustomer.getFullName()
 : nocustomer);

 I think that Session.get() returns null somehow.. That's not supposed to
 happen, is it?

 -- Edvin



 16:54:20,902 ERROR [RequestCycle] [btpool0-9]
 org.mortbay.jetty.EofException
 org.apache.wicket.WicketRuntimeException: org.mortbay.jetty.EofException
at
 org.apache.wicket.protocol.http.request.WebErrorCodeResponseTarget.respond(WebErrorCodeResponseTarget.java:96)
at
 org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:104)
at
 org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1172)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1243)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1330)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
at
 org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:358)
at
 org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194)
at
 org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
 org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
at
 org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at
 org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at
 org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
at
 org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at
 org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
at
 org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at
 org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
at org.mortbay.jetty.Server.handle(Server.java:324)
at
 org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at
 org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:828)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at
 org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at
 org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:450)
 Caused by: org.mortbay.jetty.EofException
at org.mortbay.jetty.HttpGenerator.flush(HttpGenerator.java:760)
at
 org.mortbay.jetty.AbstractGenerator$Output.flush(AbstractGenerator.java:566)
at
 org.mortbay.jetty.HttpConnection$Output.flush(HttpConnection.java:910)
at
 org.mortbay.jetty.AbstractGenerator$Output.write(AbstractGenerator.java:650)
at
 org.mortbay.jetty.AbstractGenerator$Output.write(AbstractGenerator.java:577)
at
 org.mortbay.util.ByteArrayISO8859Writer.writeTo(ByteArrayISO8859Writer.java:103)
at
 org.mortbay.jetty.handler.ErrorHandler.handle(ErrorHandler.java:55)
at
 org.mortbay.jetty.servlet.ErrorPageErrorHandler.handle(ErrorPageErrorHandler.java:117)
at org.mortbay.jetty.Response.sendError(Response.java:274)
at org.mortbay.jetty.Response.sendError(Response.java:340)
at
 org.apache.wicket.protocol.http.request.WebErrorCodeResponseTarget.respond(WebErrorCodeResponseTarget.java:91)
... 24 more
 Caused by: java.io.IOException: Connection reset by peer
at sun.nio.ch.FileDispatcher.writev0(Native Method)
at sun.nio.ch.SocketDispatcher.writev(SocketDispatcher.java:33)
at sun.nio.ch.IOUtil.write(IOUtil.java:164)
at sun.nio.ch.SocketChannelImpl.write0(SocketChannelImpl.java:365)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:388)
at java.nio.channels.SocketChannel.write(SocketChannel.java:360)
at
 org.mortbay.io.nio.ChannelEndPoint.flush(ChannelEndPoint.java:229)
at
 org.mortbay.io.nio.SelectChannelEndPoint.flush(SelectChannelEndPoint.java:197)
at 

Re: Page loads too slow

2008-04-08 Thread Matthew Young
this page takes about 2-5 seconds to load, but this
only happens when it's loaded for the first time

I observe the same thing and this has to do with Captcha.  I think it's
because it uses Java graphic stuff and it take time to load and initialize.

On Tue, Apr 8, 2008 at 7:48 AM, Sergey Podatelev [EMAIL PROTECTED]
wrote:

 Hello,

 I have this problem which is hard to debug, perhaps you guys will give me
 some pointers.

 The page is a registration page, so it has a form with a number of inputs
 and select-s, one of which is pretty huge -- it contains about sixty
 countries, and a captcha.

 The actual problem is -- this page takes about 2-5 seconds to load, but
 this
 only happens when it's loaded for the first time after application is
 deployed. After that, page load takes no longer than any other one.
 I've tried the obvious and put some time printouts, but all the page
 construction took less than a tenth of a second, and the latest printout
 from the onAfterRender() pops after another half a second.

 Can anyone think of a way to debug this issue?

 --
 sp



Problem: IntegerConverter cannot parse or display locale specific format like 999,999

2008-04-07 Thread Matthew Young
I want a Label to display Integer as 999,999,999 but it's not happening.

Basic problem is inside IntegerConverter, NumberFormat is created in
abstractIntegerConverter like this:

public NumberFormat getNumberFormat(Locale locale)
{
NumberFormat numberFormat = (NumberFormat)numberFormats.get(locale);
if (numberFormat == null)
{
numberFormat = NumberFormat.getIntegerInstance(locale);
numberFormat.setParseIntegerOnly(true);
numberFormat.setGroupingUsed(false); //
 !!! why set to false?
numberFormats.put(locale, numberFormat);
}
return (NumberFormat)numberFormat.clone();
}


Because setGroupingUsed(false), IntegerConverter cannot parse locale
formatted input like 999,999(raise conversion exception) or output in
locale specific format. DecimalConverter is not like this.

Is there some specific reason to call setGroupingUsed(false)?  Can we have
this remove?


Re: IntegerConverter cannot parse or display locale specific format like 999,999

2008-04-07 Thread Matthew Young
Any reply?


Re: IntegerConverter cannot parse or display locale specific format like 999,999

2008-04-07 Thread Matthew Young
I don't see any good reason to call numberFormat.setGroupingUsed(false);,
it just disable the locale capability.  This just doesn't make any sense to
me.

Why not subclass label and override getNumberFormat(Locale)?  Pretty easy.

You probably mean override Component#getConverter(Class type).  Another
option is to install my integerconverter in my app.

Anyway, this should be corrected in Wicket if it's wrong.  I filed a bug
report: https://issues.apache.org/jira/browse/WICKET-1494


On Mon, Apr 7, 2008 at 7:23 PM, Nick Heudecker [EMAIL PROTECTED] wrote:

 Why not subclass label and override getNumberFormat(Locale)?  Pretty easy.


 On Mon, Apr 7, 2008 at 7:02 PM, Matthew Young [EMAIL PROTECTED] wrote:

  Any reply?
 



 --
 Nick Heudecker



Re: DoubleConverter broken for locale vi (vietnamese)

2008-04-05 Thread Matthew Young
For the vi locale, . is the radix mark and , is the decimal mark.  So
99,0 is 990. See this:

Double doubleValue = new Double(999.999);
String convertString = iConverter.convertToString(doubleValue,
newLocale(vi));
System.out.println(Double value:  + doubleValue + := converted
value:  + convertString);

Output:

Double value: 999.999:= converted value: 9.999.999,999

This is how Sun has setup the DecimalFormat for the vi locale.  Nothing to
do with Wicket.

On Sat, Apr 5, 2008 at 9:27 AM, petrisoft [EMAIL PROTECTED] wrote:


 Hi I am using wicket 1.3.2 and it seems the Double Converter is broken for
 the Vietnamese language. How would I get round this?. It keeps on adding
 an
 extra zero.

 IConverter iConverter = new DoubleConverter();
 String valueStr = 99.0;
 Double convertValue = (Double) iConverter.convertToObject(valueStr, new
 Locale(vi));
 System.out.println(Double entered String value:  + valueStr + :=
 converted value:  + convertValue);

 Output:
 Double entered String value: 99.0:= converted value: 990.0

 Thanks Petrisoft
 --
 View this message in context:
 http://www.nabble.com/DoubleConverter-broken-for-locale-vi-%28vietnamese%29-tp16515228p16515228.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: FeedbackPanel ul has no class

2008-04-05 Thread Matthew Young
The book is incorrect.  There is no class attribute in the ul tag and
there is no way to add one through FeedbackPanel class.  But you can do
this:

div class=feedbackPanel wicket:id=feedbackF/div

and style the feedback ul:

.feedbackPanel ul {
etc etc
}

On Sat, Apr 5, 2008 at 12:57 PM, Zach Cox [EMAIL PROTECTED] wrote:

 In the latest early access version of Wicket in Action, page 202, it
 gives this as the markup that FeedbackPanel produces:

 ul class=feedbackPanel
   li class=feedbackPanelERROR
  span class=feedbackPanelERRORField 'name' is required./span
   /li
 /ul

 However, in real usage the ul element has no class attribute.  Is this
 a bug in Wicket 1.3.2 or am I missing something?

 Thanks,
 Zach

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




Re: FeedbackPanel ul has no class

2008-04-05 Thread Matthew Young
Jira added: https://issues.apache.org/jira/browse/WICKET-1485

On Sat, Apr 5, 2008 at 2:11 PM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 you can just subclass the panel and provide your own markup with the
 class on the ul. also add a jira issue to have it added to the core
 panel

 -igor


 On Sat, Apr 5, 2008 at 2:08 PM, Matthew Young [EMAIL PROTECTED] wrote:
  The book is incorrect.  There is no class attribute in the ul tag and
   there is no way to add one through FeedbackPanel class.  But you can do
   this:
 
   div class=feedbackPanel wicket:id=feedbackF/div
 
   and style the feedback ul:
 
   .feedbackPanel ul {
  etc etc
 
 
  }
 
   On Sat, Apr 5, 2008 at 12:57 PM, Zach Cox [EMAIL PROTECTED] wrote:
 
In the latest early access version of Wicket in Action, page 202, it
gives this as the markup that FeedbackPanel produces:
   
ul class=feedbackPanel
  li class=feedbackPanelERROR
 span class=feedbackPanelERRORField 'name' is
 required./span
  /li
/ul
   
However, in real usage the ul element has no class attribute.  Is
 this
a bug in Wicket 1.3.2 or am I missing something?
   
Thanks,
Zach
   
-
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: DataPicker problem

2008-04-04 Thread Matthew Young
If you use Maven, just add the dependency:

dependency
groupIdorg.apache.wicket/groupId
artifactIdwicket-extensions/artifactId
version${wicket.version}/version
/dependency


dependency
groupIdorg.apache.wicket/groupId
artifactIdwicket-datetime/artifactId
version${wicket.version}/version
/dependency

wicket-extensions for the DatePicker
wicket-datetime will pull its dependency including Joda


On Fri, Apr 4, 2008 at 4:04 AM, lienok
[EMAIL PROTECTED][EMAIL PROTECTED]
wrote:


 Hi,

 thank you for the obvious advice =) It helped of course.
 I just do not understand what was the problem. I have run the same code
 few
 weeks ago on my home computer without any problem and I did NOT add any
 joda-time jar.
 confused .. :confused:


 Fabien D. wrote:
 
  search joda-time... and this package is obligatory :)
 

 --
 View this message in context:
 http://www.nabble.com/DataPicker-problem-tp16487490p16491005.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: Changing Wickets default styles

2008-04-01 Thread Matthew Young
and is indented as in the original

I think some browser use padding, others use margin to shift li.  You need
to set both padding-left and margin-left to have them look the same on all
browsers.

On Tue, Apr 1, 2008 at 6:33 AM, Steen Larsen [EMAIL PROTECTED] wrote:

 Hi,

 I have made a stylesheet to change the default look of the FeedbackPanel,
 and loaded it with response.renderCSSReference(new ResourceReference(
 Style.class,yousee.css), screen), where the class Style and the css is
 in the same package. The css looks like this:

 li.feedbackPanelERROR {
background-image: none;
color: red;
padding-left: 0px;
background-repeat: no-repeat;
background-position: 0px;
list-style-type: none;
 }

 li.feedbackPanelINFO {
background-image: none;
color: red;
padding-left: 0px;
background-repeat: no-repeat;
background-position: 0px;
list-style-type: none;
 }

 This works fine in IE7, but for some reason only works partly in Firefox.
 The green background-image is removed but the text is not red, and is
 indented as in the original. Looking at the styles with Firefoxs
 WebDeveloper shows the correct styles. Anybody experienced this and found
 a
 solution ?.

 /Steen



Re: How to make img src in a component's template resolve to the image files in the package?

2008-03-31 Thread Matthew Young
urlfor(new ResourceReference(MyComponent.class, image.png));

Alright! That works.

And Enrique, now I understand what you were telling me.  Thanks.


Igor, I made this little thing:

public class PackageImage extends WebComponent {
private static final long serialVersionUID = 1L;
private Class? location;

public PackageImage(String id, Class? location) {
super(id);
this.location = location;
}

@Override protected void onComponentTag(final ComponentTag tag) {
checkComponentTag(tag, img);
super.onComponentTag(tag);
tag.put(src, urlFor(new ResourceReference(location, tag.getString
(src).toString(;
}

}


So that I can have in MyComponent.html:

   img wicket:id=img src=open.png/   -- just the image file
name --

and in MyComponent.java:

   add(new PackageImage(img, MyComponent.class));

And this gets the src fixed up to point to the image file.  I think it could
be useful in general.  Should Wicket have one built-in?



On Sun, Mar 30, 2008 at 9:33 PM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 urlfor(new ResourceReference(MyComponent.class, image.png));

 -igor


 On Sun, Mar 30, 2008 at 9:28 PM, Matthew Young [EMAIL PROTECTED] wrote:
  wicket:link doesnt touch components afaik
 
   :(  I need it to be a component.  My code is basically this:
 
  add(new WebMarkupContainer(img));
 
   Can I do something like this:
 
   add(new WebMarkupContainer(img) {
 
   @Override protected void onComponentTag(final ComponentTag tag)
  {
  super.onComponentTag(tag);
  tag.put(src, GIVE-ME-YOU-LOCATION-PLEASE + tag.getString
 (src));
  }
 
   });
 
   where GIVE-ME-YOU-LOCATION-PLEASE is some method to get
   /resources/com.mycompany.component.MyComponent/?
 
   On Sun, Mar 30, 2008 at 9:05 PM, Igor Vaynberg [EMAIL PROTECTED]
 
 
 
  wrote:
 
thats because you have a wicket:id there. wicket:link doesnt touch
components afaik
   
-igor
   
   
On Sun, Mar 30, 2008 at 8:57 PM, Matthew Young [EMAIL PROTECTED]
 wrote:
 So I did this:


  html xmlns:wicket
  body
   wicket:panel
 wicket:linkimg wicket:id=open src=open.png
 //wicket:link
   /wicket:panel
  /body
  /html

  the src attr doesn't change, it stays as open.png and not change
 to

 /resources/com.mycompany.component.MyComponent/open.png



 On Sun, Mar 30, 2008 at 8:37 PM, [EMAIL PROTECTED] wrote:

   Use wicket:link tags around the image
  
   -igor
  
   On 3/30/08, Enrique Rodriguez [EMAIL PROTECTED] wrote:
On Sun, Mar 30, 2008 at 7:45 PM, Matthew Young 
 [EMAIL PROTECTED]
   wrote:
 ...
 I don't want to hard code
 /resources/com.mycompany.component.MyComponent/open.png in
 the
   template
 and just have img src=open.png .../. Is there someway to
 work
out
the
 prefix /resources/com.mycompany.component.MyComponent/ and
 fix
up
   src
 attribute in code?
   
If you are in a Component you can call Component#urlFor().
   
If not in a Component, you can call:
   
RequestCycle.get()#urlFor();
   
You can use the form that takes a ResourceReference for the
 image.
   
HTH,
   
Enrique
   
   
-
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: How to make img src in a component's template resolve to the image files in the package?

2008-03-31 Thread Matthew Young
To Igor and James:

so if that is all it does why does it need to be a component?

Why do you need it to be a component?  Are you controlling the
visibility of it via code?

#1, I need to add(IBehavior) to the img's to make change to their class
attribute, so I need them to be a component.

#2, I don't like img src attributes in template like this:

src=resources/com.mycompany.component.MyComponent/open.png
src=resources/com.mycompany.component.MyComponent/close.png
src=resources/com.mycompany.component.MyComponent/north.png
src=resources/com.mycompany.component.MyComponent/sourth.png
etc

This would break if I re-name the component or move it to a different
package. It would be better if they are:

src=open.png
src=close.png
src=north.png
src=sourth.png
etc

and change the src attribute to full paths in code. The little PackageImage
class solve this use case.

so i would say, no, it takes 10 minutes to write one

I completely agree it's very trivial to create after getting help here
:)   Still I commit error by holding on to Class reference (thanks for
pointing out).  If there is such class built-in, then no chance for such
error and this use case is taken care of.

i can come up with at least 10 trivial classes that have to do with images
off the top of my head

Well, this is the thing: you know Wicket inside out. Stuffs that are trivial
for you may not be so trivial to regular Wicket user.  But I totally
understand your reluctance to add stuff to Wicket.  It's like adding key
words to Java, the answer is almost always no.  So if not adding these
little trivial stuff, a wiki showing all the little image use cases
would be great.

Anyway, I am not happy with my little PackageImage class.  I want to allow
application to override the image files to have different look and only
fallback to the built-in images, just like localization. How can this be
done?

On Mon, Mar 31, 2008 at 4:35 AM, James Carman [EMAIL PROTECTED]
wrote:

 On Mon, Mar 31, 2008 at 12:28 AM, Matthew Young [EMAIL PROTECTED] wrote:
  wicket:link doesnt touch components afaik
 
   :(  I need it to be a component.  My code is basically this:
 
  add(new WebMarkupContainer(img));

 Why do you need it to be a component?  Are you controlling the
 visibility of it via code?

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




Possible to modify a decedent html tag attr of a component without the tag being a child component?

2008-03-30 Thread Matthew Young
I have a link like this:

a wicket:id=linkimg src=face.png//a

When link.isEnable() == false, I need to add style attribute to the img
tag.  Is it possible to do this without turning the img into a child
component of the link?


Re: Possible to modify a decedent html tag attr of a component without the tag being a child component?

2008-03-30 Thread Matthew Young
I forgot to mention: the link is created by other people's code.  I can't
change the template: I can't put wicket:id in the img tag.

new image(...) {
 oncomponenttag(tag) {
 if (link.isenabled()==false) { tag.put(class,foo); }

So how would this work?

new Image(there-is-not-wicket-id-to-use...

Anyway, I was hoping I can do:

link.add(new AbstractBehavior() {

  onComponentTag(Component c, Component tag) {
use 'c' or 'tag' to get img
put attr into img
  }
);

On Sun, Mar 30, 2008 at 11:31 AM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 new image(...) {
  oncomponenttag(tag) {
  if (link.isenabled()==false) { tag.put(class,foo); }
  }
 }

 -igor


 On Sun, Mar 30, 2008 at 11:27 AM, Matthew Young [EMAIL PROTECTED] wrote:
  I have a link like this:
 
   a wicket:id=linkimg src=face.png//a
 
   When link.isEnable() == false, I need to add style attribute to the
 img
   tag.  Is it possible to do this without turning the img into a child
   component of the link?
 

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




Re: How to make img src in a component's template resolve to the image files in the package?

2008-03-30 Thread Matthew Young
So I did this:

html xmlns:wicket
body
  wicket:panel
wicket:linkimg wicket:id=open src=open.png//wicket:link
  /wicket:panel
/body
/html

the src attr doesn't change, it stays as open.png and not change to
/resources/com.mycompany.component.MyComponent/open.png

On Sun, Mar 30, 2008 at 8:37 PM, [EMAIL PROTECTED] wrote:

 Use wicket:link tags around the image

 -igor

 On 3/30/08, Enrique Rodriguez [EMAIL PROTECTED] wrote:
  On Sun, Mar 30, 2008 at 7:45 PM, Matthew Young [EMAIL PROTECTED]
 wrote:
   ...
   I don't want to hard code
   /resources/com.mycompany.component.MyComponent/open.png in the
 template
   and just have img src=open.png .../. Is there someway to work out
  the
   prefix /resources/com.mycompany.component.MyComponent/ and fix up
 src
   attribute in code?
 
  If you are in a Component you can call Component#urlFor().
 
  If not in a Component, you can call:
 
  RequestCycle.get()#urlFor();
 
  You can use the form that takes a ResourceReference for the image.
 
  HTH,
 
  Enrique
 
  -
  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: How to make img src in a component's template resolve to the image files in the package?

2008-03-30 Thread Matthew Young
wicket:link doesnt touch components afaik

:(  I need it to be a component.  My code is basically this:

add(new WebMarkupContainer(img));

Can I do something like this:

add(new WebMarkupContainer(img) {

@Override protected void onComponentTag(final ComponentTag tag)
{
super.onComponentTag(tag);
tag.put(src, GIVE-ME-YOU-LOCATION-PLEASE + tag.getString(src));
}

});

where GIVE-ME-YOU-LOCATION-PLEASE is some method to get
/resources/com.mycompany.component.MyComponent/?

On Sun, Mar 30, 2008 at 9:05 PM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 thats because you have a wicket:id there. wicket:link doesnt touch
 components afaik

 -igor


 On Sun, Mar 30, 2008 at 8:57 PM, Matthew Young [EMAIL PROTECTED] wrote:
  So I did this:
 
 
   html xmlns:wicket
   body
wicket:panel
  wicket:linkimg wicket:id=open src=open.png//wicket:link
/wicket:panel
   /body
   /html
 
   the src attr doesn't change, it stays as open.png and not change to
 
  /resources/com.mycompany.component.MyComponent/open.png
 
 
 
  On Sun, Mar 30, 2008 at 8:37 PM, [EMAIL PROTECTED] wrote:
 
Use wicket:link tags around the image
   
-igor
   
On 3/30/08, Enrique Rodriguez [EMAIL PROTECTED] wrote:
 On Sun, Mar 30, 2008 at 7:45 PM, Matthew Young [EMAIL PROTECTED]
wrote:
  ...
  I don't want to hard code
  /resources/com.mycompany.component.MyComponent/open.png in the
template
  and just have img src=open.png .../. Is there someway to work
 out
 the
  prefix /resources/com.mycompany.component.MyComponent/ and fix
 up
src
  attribute in code?

 If you are in a Component you can call Component#urlFor().

 If not in a Component, you can call:

 RequestCycle.get()#urlFor();

 You can use the form that takes a ResourceReference for the image.

 HTH,

 Enrique


 -
 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: Fileupload?

2008-03-29 Thread Matthew Young
 I suddenly are a bit stomped why you have todo so much when it comes to
uploading files (and yes I am aware that it is only a few more lines of
code)..

What is todo so much? You need to tell people what it is exactly, like put
up some code?  Otherwise no one can tell exactly what you are doing.

Anyway, isn't fileupoad just as simple as textfield?

upload = new FileUploadField(upload);
form.add(upload);


On Sat, Mar 29, 2008 at 4:53 AM, Nino Saturnino Martinez Vazquez Wael 
[EMAIL PROTECTED] wrote:

 As I am getting very used to the wicket way,  using compound models with
 my form fields labels an so on.

 I suddenly are a bit stomped why you have todo so much when it comes to
 uploading files (and yes I am aware that it is only a few more lines of
 code).. I think the fileupload field should work just as text field etc..

 But as with other stuff I get puzzled by there are probably a very good
 reason why it dosent?

 --
 -Wicket for love

 Nino Martinez Wael
 Java Specialist @ Jayway DK
 http://www.jayway.dk
 +45 2936 7684


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




Re: Page-dependent timeout values for session

2008-03-29 Thread Matthew Young
Can you put a ajaxtimerbehavior in the iframe to call the server to keep the
session alive?

On Sat, Mar 29, 2008 at 2:32 AM, Per Newgro [EMAIL PROTECTED] wrote:

 Hi *,

 we added an IFRAME to out homepage. This gets an url to he
 wicket-application
 by assignment to src attribute. If the user uses the button in IFRAME a
 new
 window is open and the application is displayed.

 We set the session timeout limit in web.xml. Everything ok so far. But we
 have
 the effect, that the part displayed in the IFRAME runs into timeout. This
 looks always a bit ugly.

 Now my question: Can we set the timeout to different values for a page?
 Stateless stuff seems not to be relevant here because we use some ajax
 behavior in IFRAME part.

 Hope i made my point clear.
 Cheers
 Per

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




Re: PagingNavigator: styling a link to a current page?

2008-03-29 Thread Matthew Young
The current page is like this:

span id=pageLink21 wicket:id=pageLinkemspan
wicket:id=pageNumber7/span/em/span

So you can just style the em tag to whichever way you like.

On Sat, Mar 29, 2008 at 4:46 PM, Vitaly Tsaplin [EMAIL PROTECTED]
wrote:

   Hi,

   How do I change an appearance of a link pointing to a currently
 presented page? It seems I am supposed to implement my own navigator
 component from scratch? Any ideas?

   Vitalz

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




Re: PagingNavigator: styling a link to a current page?

2008-03-29 Thread Matthew Young
Ok, I see what your problem really is.  Here is your solution:

final IBehavior currentPageLinkClassifier = new AbstractBehavior() {
private static final long serialVersionUID = 1L;
@Override public void onComponentTag(Component c, ComponentTag tag)
{
if (((Link) c).isEnabled() == false) {
CharSequence current = tag.getString(class);
tag.put(class, current_page_link 
+ (current == null ?  : current));
}
}
};



  navigator = new PagingNavigator(navigator, photoListView) {
private static final long serialVersionUID = 1L;
@Override protected PagingNavigation newNavigation(final
IPageable pageable,
final IPagingLabelProvider labelProvider) {
return new AjaxPagingNavigation(navigation, pageable,
labelProvider) {
private static final long serialVersionUID = 1L;
@Override protected Link newPagingNavigationLink(String
id, IPageable pageable, int pageIndex) {
Link link = super.newPagingNavigationLink(id,
pageable, pageIndex);
link.add(currentPageLinkClassifier);
return link;
}
};
}
};


.current_page_link {

   whatever

}

On Sat, Mar 29, 2008 at 5:56 PM, Vitaly Tsaplin [EMAIL PROTECTED]
wrote:

   It works but as I said it highlights not only the link to a current
 page, but also links to next and previous pages (increments) if you
 navigate to the leftmost or rightmost page since em is created for
 links to which a navigation is impossible or makes no sense.

 On Sun, Mar 30, 2008 at 1:38 AM, Igor Vaynberg [EMAIL PROTECTED]
 wrote:
  div class=nav wicket:id=navigator
 
   style div.nav em { color:red; } /style
 
   -igor
 
 
   On Sat, Mar 29, 2008 at 5:04 PM, Vitaly Tsaplin
 
 
  [EMAIL PROTECTED] wrote:
   It simply doesn't work. That's why I am asking... em tag is
 created for surrounding disabled links and a for active ones. I
 do
 not see any way how to distinguish the current page...
   
   
   
 On Sun, Mar 30, 2008 at 12:59 AM, Matthew Young [EMAIL PROTECTED]
 wrote:
  The current page is like this:
 
   span id=pageLink21 wicket:id=pageLinkemspan
   wicket:id=pageNumber7/span/em/span
 
   So you can just style the em tag to whichever way you like.
 
   On Sat, Mar 29, 2008 at 4:46 PM, Vitaly Tsaplin 
 [EMAIL PROTECTED]
   wrote:
 
 
 
  Hi,
   
  How do I change an appearance of a link pointing to a
 currently
presented page? It seems I am supposed to implement my own
 navigator
component from scratch? Any ideas?
   
  Vitalz
   
   
 -
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]




Any example of how to use PageableListView and PagingNavigation, PagingNavigator?

2008-03-27 Thread Matthew Young
I need to display a list of numbers of 1,2,3,4 ... to n, 'n' being some big
number. I want to display the number 20 number per page and have some
navigation bar to page through the numbers.


How to make form/link response jump to an anchor in the page, not the top of page?

2008-03-26 Thread Matthew Young
My form is at the bottom of a long page.  I have a name=myform/ before
the form.  Is there a way to:

1) on fail form validation, response jump to the form?

2) Same for [EMAIL PROTECTED](): response jump to the form?


Re: How to make form/link response jump to an anchor in the page, not the top of page?

2008-03-26 Thread Matthew Young
link has overridable String getAnchor()

It's actually 'Component getAnchor()' and I don't understand where to get
this anchor component.  There is little javadoc in getAnchor() but
setAnchor(Component c) has more details but I don't understand it at all.

My page is like this:

=== top of page ===
...
a href=#setupGo To Setup/a
... very long stuffs follow
.
.
.
bottom of page
a name=setupSetup Form/a
form

a wicket:id=resetKeyGive me another key/a

/form

I want response to onClick of resetKey, jump back to #setup.  I don't
understand how to use Link#getAnchor(), Link#setAnchor(Component c) do
this.  Please help.

  1) on fail form validation, response jump to the form?

this is a bit tricky. perhaps you can subclass the feedbackpanel and
if there are messages have it spit out some javascript to scroll the
page.

Javascript is fine.  But I am not using FeedbackPanel. I am pulling the
error message out from FormComponents and show them along side it.  Can I
just query the session to see if it has any error?  If so, where and how to
insert his code and do the spit out some javascript? And what is the
javascript? location.hash='setup'?


On Wed, Mar 26, 2008 at 11:26 AM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 On Wed, Mar 26, 2008 at 11:13 AM, Matthew Young [EMAIL PROTECTED] wrote:
  My form is at the bottom of a long page.  I have a name=myform/
 before
   the form.  Is there a way to:
 
   1) on fail form validation, response jump to the form?

 this is a bit tricky. perhaps you can subclass the feedbackpanel and
 if there are messages have it spit out some javascript to scroll the
 page.

 if you dont want javascript then you will need an extra redirect in
 which case you will need to do:

 string url=urlfor(mypage.this); url+=#anchor;
 requestcycle().setrequesttarget(new redirectrequesttarget(url));

 but you may or may not lose some feedback messages, not sure.

   2) Same for [EMAIL PROTECTED](): response jump to the form?

 link has overridable String getAnchor()

 -igor

 

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




Re: Re-render after AbstractRestartResponseException() not working in Ajax case

2008-03-25 Thread Matthew Young
Done: https://issues.apache.org/jira/browse/WICKET-1450


How to Ajax refresh captcha image (a image backed by DynamicImageResource)?

2008-03-25 Thread Matthew Young
I want to be able to show a new captcha image via an AjaxFallbackLink.  But
I don't know what to do in onClick to make the captcha img tag reload.

public MyPage extends WebPage {

 private CaptchaImageResouce captchaImageResource;

 public MyPage() {

add(new Image(captchaImg, new PropertyModel(this,
captchaImageResource)) {
private static final long serialVersionUID = 1L;
@Override protected void onBeforeRender() {
regenerateCaptcha();// make a new image
super.onBeforeRender();
}
}.setOutputMarkupId(true));

   add(new AjaxFallbackLink(link) {
@Override public void onClick(AjaxRequestTarget target) {

// WHAT DO I DO HERE? Is there some javascript to make the
img tag reload?
if (target != null) {
target.addComonent(MyPage.this.get(captchaImg));   //
This is not enough to make it show
}
}

}
}


public void regenerateCaptcha() {
captchaResource = new CaptchaImageResource(randomString(3, 5));
}
}


Re-render after AbstractRestartResponseException() not working in Ajax case

2008-03-24 Thread Matthew Young
Here is my test code:

public class HomePage extends WebPage {

private static final long serialVersionUID = 1L;

private String word;

public HomePage(final PageParameters parameters) {

add(new FeedbackPanel(feedback) {
private static final long serialVersionUID = 1L;
@Override protected void onBeforeRender() {
System.out.println(= = = = FeedbackPanel
onBeforeRender());
   System.out.println( FeedbackbackMessageModel = 
+ getFeedbackMessagesModel().getObject());
super.onBeforeRender();
}
}.setOutputMarkupPlaceholderTag(true));
// if the word blowup is entered,
//this register a error message and throw new
AbstractRestartResponseException()
IModel model = new Model() {
private static final long serialVersionUID = 1L;
@Override public Object getObject() {
if (word != null  word.equals(blowup)) {
word = -w-e-b-l-e-w-u-p-;
HomePage.this.fatal([2/2]This message is from
Model.); // why this is NOT render in Ajax?
getPage().detach();
System.out.println(! ! ! ! ! throwing  new
AbstractRestartResponseException());
throw new AbstractRestartResponseException() {
private static final long serialVersionUID = 1L;
};
} else {
return The word is: \ + (word == null ?  n u l l  :
word) + \;
}
}
};
add(new Label(message, model) {
private static final long serialVersionUID = 1L;
@Override protected void onBeforeRender() {
System.out.println(= = = = Label onBeforeRender(), model =
 + getModel().getObject());
super.onBeforeRender();
}
}.setOutputMarkupId(true));
Form form = new Form(form, new CompoundPropertyModel(this));
add(form);
form.add(new TextField(word).setRequired(true));
AjaxFallbackButton submitButton = new
AjaxFallbackButton(submitButton, form) {
private static final long serialVersionUID = 1L;
@Override protected void onSubmit(AjaxRequestTarget target, Form
f) {
if (word != null  word.equals(blowup)) {
HomePage.this.error([1/2]This message is from onSubmit.
There should also be a message from model);
}
if (target != null) {
target.addComponent(HomePage.this.get(feedback));
// clear error feedback if any
target.addComponent(HomePage.this.get(message));
}
}

@Override protected void onError(AjaxRequestTarget target, Form
f) {
target.addComponent(HomePage.this.get(feedback));
// show updated error feedback
}
};
form.add(submitButton);
}
}

Things work perfectly in non-Ajax.  But in Ajax, after 'throw new
AbstractRestartResponseException()' in model, the Ajax response to the
browser is wrong in two places.  1) the feedback component don't have the
second message register in the model, only the message from onSubmit(target)
show. 2) the Ajax response is missing the second half:  no Label component
and the /ajax-response end tag.

= This is the normal Ajax response copy from the debug panel:

INFO: Received ajax response (257 characters)
INFO:
?xml version=1.0 encoding=UTF-8?ajax-responsecomponent
id=feedback4 ![CDATA[span id=feedback4

/span]]/componentcomponent id=message1 ![CDATA[span
id=message1The word is: bla/span]]/component/ajax-response
INFO: Response parsed. Now invoking steps...
INFO: Response processed successfully.

= This is the Ajax response after 'throw new
AbstractRestartResponseException()':

INFO: Received ajax response (339 characters)
INFO:
?xml version=1.0 encoding=UTF-8?ajax-responsecomponent
id=feedback4  encoding=wicket1 ![CDATA[span id=feedback4
  ul
li class=feedbackPanelERROR
  span class=feedbackPanelERROR[1/2]^This message is from onSubmit.
There should also be a message from model/span
/li
  /ul
/span]]/component
ERROR: Error while parsing response: Could not find root ajax-response
element
INFO: Invoking post-call handler(s)...
INFO: Invoking failure handler(s)...

From tracing the wicket code, I just don't see how this can be.  I see
AjaxResponseTarget#response() is called again, and
response.write(/ajax-response);
is called on line 539.  But in the end the Ajax response is wrong.

What is wrong?  Is this a bug?


Here is the WicketApplication for the non-Ajax case:

public class WicketApplication extends WebApplication
{
public WicketApplication() {
}

public Class? extends WebPage getHomePage() {
return HomePage.class;
}


@Override public RequestCycle newRequestCycle(Request request, Response
response) {
  

Re: Funky issue with double quotes (when copied from WIA ebook)

2008-03-24 Thread Matthew Young
The quote marks in the PDF must be the typographer's quote: like this pair
and not the straight quote like this pair.  The straight quote marks
probably got converted when the code is pasted into the page layout
program.  The author should probably turn of auto quote mark convertion off
in the page layout program.

On Mon, Mar 24, 2008 at 12:05 PM, Phil Grimm [EMAIL PROTECTED] wrote:

 Guys,

 More than a few times, I've been bitten by a problem with double quote
 characters when I copy Wicket tags from the WIA PDF into to HTML editor of
 my IDE (NetBeans).

 In the NetBeans editor, the copied double-quote characters display with a
 slight tilt to the right (the normal double quotes display as two
 vertical
 lines). So, they are a different type of character, but NetBeans editor
 renders them fine. And I think the browser (firefox) parses them ok.

 But when the webapp is run, Wicket gives the following error..

WicketMessage:
The wicket:id attribute value must not be empty. May be unmatched
 quotes?!?

 And here, you can see the display of the double-quote characters (in the
 browser error page).

   a href=”#” wicket:id=”registerLink”Register/a

 To fix this, I just go delete the double quotes in the NetBeans editor and
 re-type them.
 I realize this is probably some kind of font issue, but if there is a way
 to
 address this, it would save some people frustration.
 This is not a big deal, but if someone understands the issue, it might
 help
 some of us avoid this.

 Then again, if it's not obvious what the problem is, if it hurts, don't
 do
 it might be a reasonable response.
 Probably not worth spending any time on investigating.


 Phil

 --
 Phil Grimm
 Mobile: (858) 335-3426
 Skype: philgrimm336



Re: Re-render after AbstractRestartResponseException() not working in Ajax case

2008-03-24 Thread Matthew Young
So in getObject that is only called in the renderphase in an ajax
request you throw an restart exception?

To be very clear, no exception is thrown on re-render, the restart exception
is only thrown in the initial render.   I trace the Wicket code and it's
re-rendering, but the end result on the browser side is wrong.  Why in Ajax,
only half of the ajax-response get to the browser and the exact same work in
non-Ajax?

i believe that igor had the same kind of thread a few days back

Yes, this is a follow up of that.  Igor showed an ErrorAwareModelAdapter. My
simplified test does the same on model error: call page.detach(), throw new
AbstractRestartResponseException().

Is it possible to try running my test code and see what is going on?  Maybe
something is not quite right in Wicket?

On Mon, Mar 24, 2008 at 3:16 PM, Johan Compagner [EMAIL PROTECTED]
wrote:

 So in getObject that is only called in the renderphase in an ajax
 request you throw an restart exception? We dont really support  that
 and i believe that igor had the same kind of thread a few days back.

 Make a issue for this if you want.

 On 3/24/08, Matthew Young [EMAIL PROTECTED] wrote:
  Here is my test code:
 
  public class HomePage extends WebPage {
 
  private static final long serialVersionUID = 1L;
 
  private String word;
 
  public HomePage(final PageParameters parameters) {
 
  add(new FeedbackPanel(feedback) {
  private static final long serialVersionUID = 1L;
  @Override protected void onBeforeRender() {
  System.out.println(= = = = FeedbackPanel
  onBeforeRender());
 System.out.println( FeedbackbackMessageModel
 = 
  + getFeedbackMessagesModel().getObject());
  super.onBeforeRender();
  }
  }.setOutputMarkupPlaceholderTag(true));
  // if the word blowup is entered,
  //this register a error message and throw new
  AbstractRestartResponseException()
  IModel model = new Model() {
  private static final long serialVersionUID = 1L;
  @Override public Object getObject() {
  if (word != null  word.equals(blowup)) {
  word = -w-e-b-l-e-w-u-p-;
  HomePage.this.fatal([2/2]This message is from
  Model.); // why this is NOT render in Ajax?
  getPage().detach();
  System.out.println(! ! ! ! ! throwing  new
  AbstractRestartResponseException());
  throw new AbstractRestartResponseException() {
  private static final long serialVersionUID = 1L;
  };
  } else {
  return The word is: \ + (word == null ?  n u l l
  :
  word) + \;
  }
  }
  };
  add(new Label(message, model) {
  private static final long serialVersionUID = 1L;
  @Override protected void onBeforeRender() {
  System.out.println(= = = = Label onBeforeRender(),
 model =
   + getModel().getObject());
  super.onBeforeRender();
  }
  }.setOutputMarkupId(true));
  Form form = new Form(form, new CompoundPropertyModel(this));
  add(form);
  form.add(new TextField(word).setRequired(true));
  AjaxFallbackButton submitButton = new
  AjaxFallbackButton(submitButton, form) {
  private static final long serialVersionUID = 1L;
  @Override protected void onSubmit(AjaxRequestTarget target,
 Form
  f) {
  if (word != null  word.equals(blowup)) {
  HomePage.this.error([1/2]This message is from
 onSubmit.
  There should also be a message from model);
  }
  if (target != null) {
  target.addComponent(HomePage.this.get(feedback));
  // clear error feedback if any
  target.addComponent(HomePage.this.get(message));
  }
  }
 
  @Override protected void onError(AjaxRequestTarget target,
 Form
  f) {
  target.addComponent(HomePage.this.get(feedback));
  // show updated error feedback
  }
  };
  form.add(submitButton);
  }
  }
 
  Things work perfectly in non-Ajax.  But in Ajax, after 'throw new
  AbstractRestartResponseException()' in model, the Ajax response to the
  browser is wrong in two places.  1) the feedback component don't have
 the
  second message register in the model, only the message from
 onSubmit(target)
  show. 2) the Ajax response is missing the second half:  no Label
 component
  and the /ajax-response end tag.
 
  = This is the normal Ajax response copy from the debug panel:
 
  INFO: Received ajax response (257 characters)
  INFO:
  ?xml version=1.0 encoding=UTF-8?ajax-responsecomponent
  id=feedback4 ![CDATA[span id=feedback4
 
  /span

Re: Re-render after AbstractRestartResponseException() not working in Ajax case

2008-03-24 Thread Matthew Young
I forgot to include the HomePage.html.  Here is all the files of my small
test.  Please check it out if possible.  If you run it with JS off, all is
fine.  With JS on, Ajax response is wrong.

HomePage.html:

html
head/head
span wicket:id=messagemessage will be here/span
form wicket:id=form
input type=text wicket:id=word/
input type=submit value=Enter wicket:id=submitButton/
/form
span wicket:id=feedbackFEEDBACK/span
/html

HomePage.java:

public class HomePage extends WebPage {

private static final long serialVersionUID = 1L;

private String word;

public HomePage(final PageParameters parameters) {

add(new FeedbackPanel(feedback) {
private static final long serialVersionUID = 1L;
@Override protected void onBeforeRender() {
System.out.println(= = = = FeedbackPanel
onBeforeRender());
   System.out.println( FeedbackbackMessageModel = 
+ getFeedbackMessagesModel().getObject());
super.onBeforeRender();
}
}.setOutputMarkupPlaceholderTag(true));
// if the word blowup is entered,
//this register a error message and throw
IModel model = new Model() {
private static final long serialVersionUID = 1L;
@Override public Object getObject() {
if (word != null  word.equals(blowup)) {
word = -w-e-b-l-e-w-u-p-;
HomePage.this.fatal([2/2]This message is from Model.);
getPage().detach();
System.out.println(! ! ! ! ! throwing  new
AbstractRestartResponseException());
throw new AbstractRestartResponseException() {
private static final long serialVersionUID = 1L;
};
} else {
return The word is: \ + (word == null ?  n u l l  :
word) + \;
}
}
};
add(new Label(message, model) {
private static final long serialVersionUID = 1L;
@Override protected void onBeforeRender() {
System.out.println(= = = = Label onBeforeRender(), model =
 + getModel().getObject());
super.onBeforeRender();
}
}.setOutputMarkupId(true));
Form form = new Form(form, new CompoundPropertyModel(this));
add(form);
form.add(new TextField(word).setRequired(true));
AjaxFallbackButton submitButton = new
AjaxFallbackButton(submitButton, form) {
private static final long serialVersionUID = 1L;
@Override protected void onSubmit(AjaxRequestTarget target, Form
f) {
if (word != null  word.equals(blowup)) {
HomePage.this.error([1/2]This message is from onSubmit.
There should also be a message from model);
}
if (target != null) {
target.addComponent(HomePage.this.get(feedback));
// clear error feedback if any
target.addComponent(HomePage.this.get(message));
}
}

@Override protected void onError(AjaxRequestTarget target, Form
f) {
target.addComponent(HomePage.this.get(feedback));
// show updated error feedback
}
};
form.add(submitButton);
}
}



WicketApplication.java:

public class WicketApplication extends WebApplication
{
public WicketApplication() {
}

public Class? extends WebPage getHomePage() {
return HomePage.class;
}


@Override public RequestCycle newRequestCycle(Request request, Response
response) {
return new WebRequestCycle(this, (WebRequest) request, (WebResponse)
response) {
@Override public Page onRuntimeException(Page page,
RuntimeException e) {
// page can be null
if (page == null) {
return super.onRuntimeException(page, e);
}
return page;
}
};
}

}


Re: How to get error message register in IModel.getObject() to show up in FeedbackPanel?

2008-03-21 Thread Matthew Young
Thank you Igor for showing me this.  Wow, so much new stuff for me in
there.  I'll dig in and try to understand it all.

On Thu, Mar 20, 2008 at 3:54 PM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 in a real app people will be invested in fixing the issue and not
 having someone else do their homework for them :)

 like i said, right now we consider errors in models unrecoverable - eg
 you go to an error page. seemed to satisfy everyone for 3? years that
 wicket has been out.

 that said, you can get a little creative and come up with something.
 stuff below should work with regular requests, havent tested it with
 ajax yet.


 -igor

public abstract static class ErrorAwareModelAdapter
implements
IModel,
IComponentAssignedModel,
IWrapModel
{
private boolean error = false;
private final IModel delegate;
private Component component;

public ErrorAwareModelAdapter(IModel delegate)
{

this.delegate = delegate;
}

/** gets value that should be returned from
 getobject() if exception is thrown */
protected Object getErrorResult()
{
return null;
}

/** handles the error - such as
 component.getsession().error(e.getmessage()); */
protected void handleError(RuntimeException e)
{

}

@Override
public Object getObject()
{
if (error)
{
error = false;
return getErrorResult();
}
else
{
try
{
return delegate.getObject();
}
catch (RuntimeException e)
{
error = true;
handleError(e);
component.getPage().detach();
throw new
 AbstractRestartResponseException()
{
};
}
}
}


@Override
public void setObject(Object object)
{
delegate.setObject(object);
}


@Override
public void detach()
{
delegate.detach();
}


@Override
public IWrapModel wrapOnAssignment(Component component)
{
this.component = component;
return this;
}


@Override
public IModel getWrappedModel()
{
return delegate;
 }

}


 On Thu, Mar 20, 2008 at 2:48 PM, Matthew Young [EMAIL PROTECTED] wrote:
  Then what? In real app, the model is calling some flakey remote service
 that
   can fail.  Is there no way to show error message on the same page?
  That the
   only thing is put up a different error page?
 
 
 
   On Thu, Mar 20, 2008 at 1:29 PM, Matej Knopp [EMAIL PROTECTED]
 wrote:
 
This doesn't work because the model.getObject method is only called
when the value is pulled out of the model, which is on label render.
Even if you refresh it on ajax request, it might be too late because
the feedback panel retrieves the feedback messages in onBeforeRender
(before actual rendering).
   
-Matej
   
On Wed, Mar 19, 2008 at 10:04 PM, Matthew Young [EMAIL PROTECTED]
 wrote:
  I register an error to the page in the model but the feedback
 message
  doesn't show in FeedbackPanel.  Only the error message register in
  onSubmit() event handler shows.  Please have a look.  Thanks!

  HomePage.html:

  html
  head/head
 span wicket:id=messagemessage will be here/span
 form wicket:id=form
 input type=text wicket:id=word/
 input type=submit value=Enter
 wicket:id=submitButton/
 /form
 span wicket:id=feedbackFEEDBACK/span
  /html


  HomePage.java

  import ...

  public class HomePage extends WebPage {private static final
 long
  serialVersionUID = 1L;

 private String word;

 public HomePage(final PageParameters parameters) {

 add(new
  FeedbackPanel(feedback

Re: How to get error message register in IModel.getObject() to show up in FeedbackPanel?

2008-03-20 Thread Matthew Young
On Wed, Mar 19, 2008 at 10:54 PM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 yes. there is a phase of processing that goes through and collects the
 feedback messages. you are reporting the error after that phase most
 likely, so it will get picked up next request. i wonder if calling
 feedbackpanel.detach() will help before you add it to the ajax request
 target...

 -igor


 On Wed, Mar 19, 2008 at 7:06 PM, Matthew Young [EMAIL PROTECTED] wrote:
Overriding onBeforeRender() doesn't work on Ajax, it's not called :(
   
   it is, but only on components that get updated via ajax...so you might
   want to move the code to one of those...
 
   Now the code gets call in Ajax. But the error message still doesn't
 show up
   in FeedbackPanel.  Does this make sense to you at all?
 
 
   On Wed, Mar 19, 2008 at 6:23 PM, Igor Vaynberg [EMAIL PROTECTED]
 
 
 
  wrote:
 
On Wed, Mar 19, 2008 at 5:54 PM, Matthew Young [EMAIL PROTECTED]
 wrote:
 Hi Igor,

  Overriding onBeforeRender() doesn't work on Ajax, it's not called
 :(
   
it is, but only on components that get updated via ajax...so you
 might
want to move the code to one of those...
   
  Is there anyway to handle this kind of error condition for both
 Ajax
and
  non-Ajax?
   
see above
   
  Having to abandon LoadableDeachableModel is a pity.  The code is
 much
  clearer with LoadableDeachableModel.  Anyway, does Wicket have any
 way
to
  let user code handle model error late in the render phase?
   
yes it is a pity. we consider errors that happen inside models
unrecoverable because they can happen at a lot of different points in
the lifecycle of the component. i think throwing a
restartresponseexception from inside a model might work, but that
 will
only get you to a different pagehmm, maybe... { error(failed);
throw restartresponseexception(MyPage.this); } will work, but then
 you
gotta watch out for an infinite loop... you would have to first check
if the page contains any error messages...
   
-igor
   
   
   
   
  Thanks!

  On Wed, Mar 19, 2008 at 2:53 PM, Igor Vaynberg 
 [EMAIL PROTECTED]

  wrote:



   im thinking it might be too late at that point to register the
   messages because the feedback panel might have already
 rendered...
  
   perhaps instead of using a loadable detachable model you do
 something
like
   this:
  
   class mypage {
private List result;
  
onbeforerender() {
try {
  result=populatelist();
} catch (exception e) {
  error(foo);
}
super.onbeforerender();
 }
  
 ondetach() { result=null; super.ondetach(); }
  
  
 .. add(new listview(foo, new propertymodel(this, result));
  
   }
  
   -igor
  
  
  
   On Wed, Mar 19, 2008 at 2:04 PM, Matthew Young 
 [EMAIL PROTECTED]
wrote:
 I register an error to the page in the model but the feedback
message
 doesn't show in FeedbackPanel.  Only the error message
 register in
 onSubmit() event handler shows.  Please have a look.  Thanks!
   
 HomePage.html:
   
 html
 head/head
span wicket:id=messagemessage will be here/span
form wicket:id=form
input type=text wicket:id=word/
input type=submit value=Enter
wicket:id=submitButton/
/form
span wicket:id=feedbackFEEDBACK/span
 /html
   
   
 HomePage.java
   
 import ...
   
 public class HomePage extends WebPage {private static
 final
long
 serialVersionUID = 1L;
   
private String word;
   
public HomePage(final PageParameters parameters) {
   
add(new
   
  FeedbackPanel(feedback).setOutputMarkupPlaceholderTag(true));
// if the word 'blowup' is entered, this model
 register a
error
 message to the page
IModel model = new Model() {private static
final
   long
 serialVersionUID = 1L;
@Override public Object getObject() {
if (word != null  word.equals(blowup)) {
word = -b-l-o-w-u-p-;
HomePage.this.fatal(This message is from
model.);
return BAD THING HAPPENED IN MODEL;
} else {
return The word is: \ + (word == null ?
  n
u l l
:
 word) + \;
}
}
};
add(new Label(message,
 model).setOutputMarkupId(true));
Form form = new Form(form, new
CompoundPropertyModel(this));
add(form

Re: My Wicket Flickr Demo a la Ruby On Rails

2008-03-20 Thread Matthew Young
if you are willing to work with us on it i think we might
be able to host it on wicket-stuff...

I'll glad to.  Just let me know what to do.

On Wed, Mar 19, 2008 at 10:53 PM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 ah, i see. if you are willing to work with us on it i think we might
 be able to host it on wicket-stuff...

 -igor


 On Wed, Mar 19, 2008 at 7:00 PM, Matthew Young [EMAIL PROTECTED] wrote:
  My original is big and hi res.  But once I upload to any one of these
 sites,
   they all down res file to tiny size.
 
   On Wed, Mar 19, 2008 at 6:24 PM, Igor Vaynberg [EMAIL PROTECTED]
 
   wrote:
 
 
 
why not use one of those desktop recording things like wink? ive seen
people put together 1024x768 screencasts with those, or even higher..
   
-igor
   
   
On Wed, Mar 19, 2008 at 6:04 PM, Matthew Young [EMAIL PROTECTED]
 wrote:
 I've not found any site that support high res video.
 Photobucket.com,
  vimeo.com are just like Youtube: take high res file and down size
 to
tiny
  flash file.  If they can convert to big screen flash, they will
 stand
out
  better from Youtube.

  Let me see if I can find a good avi to flash converter.  If I do,
 I'll
  re-record the screencast with sound.

  On Wed, Mar 19, 2008 at 5:51 PM, Jonathan Locke 
[EMAIL PROTECTED]


 wrote:

  
  
   shucks.  even on vimeo the resolution is still almost
 unreadable.
 and
   with
   no audio, i feel like i'm missing out still.  a nice screencast
 of
this
   with
   sound would be like a wicket infomercial... aren't there sites
 that
do
   video-efficient, high resolution screencasts?
  
  
   MYoung wrote:
   
is there supposed to be sound?
   
No, it's a silent film :).
   
On Wed, Mar 19, 2008 at 5:22 PM, Jonathan Locke 
   [EMAIL PROTECTED]
wrote:
   
   
   
is there supposed to be sound?
   
   
MYoung wrote:

 Ok, it there: http://vimeo.com/802144

 scroll down to the bottom to download the original.

 On Wed, Mar 19, 2008 at 8:30 AM, Frank Bille 
[EMAIL PROTECTED]
 wrote:

 I would suggest uploading it to vimeo.com. It supports HD
videos as
 well as support for downloading the original file.

 Frank

 On Wed, Mar 19, 2008 at 3:29 AM, Jonathan Locke
 [EMAIL PROTECTED] wrote:
 
 
   this looks like it's probably cool, but there's no
 audio and
the
video
 size
   is such that i can't read anything.
 
 
 
   MYoung wrote:
   
Hi, I am new to Wicket and to help me learn, I
 created a
Wicket
 version of
the Flickr demo like the one on the Ruby on Rails
 site
seen
   here
http://www.rubyonrails.org/screencasts. I put my
 version
in my
blog
 here:
   
 http://limboville.blogspot.com/2008_03_01_archive.html.
 Please
take
 a
look
and give me some feedback.
   
Thanks!
   
   
 
   --
   View this message in context:

   
  
   
 http://www.nabble.com/My-Wicket-Flickr-Demo-a-la-Ruby-On-Rails-tp16106896p16135954.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]




   
--
View this message in context:
   
  
   
 http://www.nabble.com/My-Wicket-Flickr-Demo-a-la-Ruby-On-Rails-tp16106896p16168460.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]
   
   
   
   
  
   --
   View this message in context:
  
   
 http://www.nabble.com/My-Wicket-Flickr-Demo-a-la-Ruby-On-Rails-tp16106896p16168924.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: How to get error message register in IModel.getObject() to show up in FeedbackPanel?

2008-03-20 Thread Matthew Young
Don't know what happen to my last reply.  Try again:

i wonder if calling
feedbackpanel.detach() will help before you add it to the ajax request
target...

No, this doesn't make the message show up either.

yes. there is a phase of processing that goes through and collects the
feedback messages. you are reporting the error after that phase most
likely, so it will get picked up next request.

But why then the error message show in non-Ajax? It should have pass the
feedbackpanel render phase, too.  Yes?  But I must add this behavior is not
consistent, in my small test case, message does not show up at all no matter
Ajax or non-Ajax.  I try moving the feedbackpanel up and down in my template
and didn't make any different.

Is it possible to mark FeedbackPanel dirty and then Wicket render it?
Also, seems if Wicket support component render priority of early to late,
then things like FeedbackPanel can say render me last, and problem solve?

I also try throw new RuntimeException() and add this in my App:

@Override public RequestCycle newRequestCycle(Request request, Response
response) {
return new WebRequestCycle(this, (WebRequest) request, (WebResponse)
response) {
@Override public Page onRuntimeException(Page page,
RuntimeException e) {
// --
// case 1: message DO NOT show
//
page.fatal(An error occured:  + e.getCause
().getMessage());
return page;

// --
// case 2: message DO NOT show
//
page = new SamePage();
page.fatal(An error occured:  + e.getCause
().getMessage());
return page;

// --
// case 3: message show
//
page = new AnotherPage();
page.fatal(An error occured:  + e.getCause
().getMessage());
return page;
}
};
}


Seems Wicket just won't show error message when the page is the same, even
of a newly created instance. There must be some short cut somewhere to not
render page if type is the same.

Small wish: in GMail, when their Ajax submit fails (either user submit or
auto background submit), they don't go to a new page, they flash a message
System error, trying again.  It would be great if Wicket can support this
way of Ajax error handling when error happen very late during render.


Re: How to get error message register in IModel.getObject() to show up in FeedbackPanel?

2008-03-20 Thread Matthew Young
add an iajaxcalldecorator override failed script

Would that work if failure happen late in rendering?  By that time, Wicket
would be on the onSuccess path, right?

For my Wicket education: I notice the IAjaxCallDecorator callbacks are only
called once.  So are these for fixed static script only?  And that I should
use target.appendJavascript() for dynamic JS?


On Thu, Mar 20, 2008 at 1:21 PM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 On Thu, Mar 20, 2008 at 12:59 PM, Matthew Young [EMAIL PROTECTED] wrote:
   Small wish: in GMail, when their Ajax submit fails (either user submit
 or
   auto background submit), they don't go to a new page, they flash a
 message
   System error, trying again.  It would be great if Wicket can support
 this
   way of Ajax error handling when error happen very late during render.

 this we do support. just throw an error, and in your button add an
 iajaxcalldecorator, override failed script and make it show the popup

 -igor

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




Re: How to get error message register in IModel.getObject() to show up in FeedbackPanel?

2008-03-20 Thread Matthew Young
Then what? In real app, the model is calling some flakey remote service that
can fail.  Is there no way to show error message on the same page?  That the
only thing is put up a different error page?

On Thu, Mar 20, 2008 at 1:29 PM, Matej Knopp [EMAIL PROTECTED] wrote:

 This doesn't work because the model.getObject method is only called
 when the value is pulled out of the model, which is on label render.
 Even if you refresh it on ajax request, it might be too late because
 the feedback panel retrieves the feedback messages in onBeforeRender
 (before actual rendering).

 -Matej

 On Wed, Mar 19, 2008 at 10:04 PM, Matthew Young [EMAIL PROTECTED] wrote:
   I register an error to the page in the model but the feedback message
   doesn't show in FeedbackPanel.  Only the error message register in
   onSubmit() event handler shows.  Please have a look.  Thanks!
 
   HomePage.html:
 
   html
   head/head
  span wicket:id=messagemessage will be here/span
  form wicket:id=form
  input type=text wicket:id=word/
  input type=submit value=Enter wicket:id=submitButton/
  /form
  span wicket:id=feedbackFEEDBACK/span
   /html
 
 
   HomePage.java
 
   import ...
 
   public class HomePage extends WebPage {private static final long
   serialVersionUID = 1L;
 
  private String word;
 
  public HomePage(final PageParameters parameters) {
 
  add(new
   FeedbackPanel(feedback).setOutputMarkupPlaceholderTag(true));
  // if the word 'blowup' is entered, this model register a error
   message to the page
  IModel model = new Model() {private static final
 long
   serialVersionUID = 1L;
  @Override public Object getObject() {
  if (word != null  word.equals(blowup)) {
  word = -b-l-o-w-u-p-;
  HomePage.this.fatal(This message is from model.);
  return BAD THING HAPPENED IN MODEL;
  } else {
  return The word is: \ + (word == null ?  n u l l
  :
   word) + \;
  }
  }
  };
  add(new Label(message, model).setOutputMarkupId(true));
  Form form = new Form(form, new CompoundPropertyModel(this));
  add(form);
  form.add(new TextField(word).setRequired(true));
 
  AjaxFallbackButton submitButton = new
   AjaxFallbackButton(submitButton, form) {
  private static final long serialVersionUID = 1L;
  @Override protected void onSubmit(AjaxRequestTarget target,
 Form
   f) {
  if (word != null  word.equals(blowup)) {
  HomePage.this.error(This message is from onSubmit.
   There should also be a message from model);
  }
  if (target != null) {
  target.addComponent(HomePage.this.get(feedback));
  target.addComponent(HomePage.this.get(message));
  }
  }
 
  @Override protected void onError(AjaxRequestTarget target,
 Form
   f) {
  target.addComponent(HomePage.this.get(feedback));
   // show updated error feedback
  }
  };
  form.add(submitButton);
  }
   }
 



 --
 Resizable and reorderable grid components.
 http://www.inmethod.com

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




Re: How to get error message register in IModel.getObject() to show up in FeedbackPanel?

2008-03-20 Thread Matthew Young
 they are executed every time the component rendered

That's true for non-Ajax, but if Ajax, it's not called again.  It make sense
to me because the form is not rendered.

no you shouldnt touch ajaxreqesttarget from a call decorator

I don't mean in the decorator. I mean in the AjaxButton#onSubmit()
#onError() because like I said, the decorator callback is not called again
in Ajax.

On Thu, Mar 20, 2008 at 2:41 PM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 why would it be onsuccess path? this is something that runs clientside...

 they are executed every time the component rendered, and no you
 shouldnt touch ajaxreqesttarget from a call decorator, notice how it
 is not passed in...

 -igor


 On Thu, Mar 20, 2008 at 2:38 PM, Matthew Young [EMAIL PROTECTED] wrote:
  add an iajaxcalldecorator override failed script
 
   Would that work if failure happen late in rendering?  By that time,
 Wicket
   would be on the onSuccess path, right?
 
   For my Wicket education: I notice the IAjaxCallDecorator callbacks are
 only
   called once.  So are these for fixed static script only?  And that I
 should
   use target.appendJavascript() for dynamic JS?
 
 
   On Thu, Mar 20, 2008 at 1:21 PM, Igor Vaynberg [EMAIL PROTECTED]
 
   wrote:
 
 
 
On Thu, Mar 20, 2008 at 12:59 PM, Matthew Young [EMAIL PROTECTED]
 wrote:
  Small wish: in GMail, when their Ajax submit fails (either user
 submit
or
  auto background submit), they don't go to a new page, they flash a
message
  System error, trying again.  It would be great if Wicket can
 support
this
  way of Ajax error handling when error happen very late during
 render.
   
this we do support. just throw an error, and in your button add an
iajaxcalldecorator, override failed script and make it show the popup
   
-igor
   
 
 
   -
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: Insert dynamic/external HTML string in a page

2008-03-19 Thread Matthew Young
background : url(images/bgimage.jpg);

I think you need to put a / in front of images like:

background : url(/images/bgimage.jpg);

On Wed, Mar 19, 2008 at 8:54 AM, Martin Makundi 
[EMAIL PROTECTED] wrote:

 Well.. my specific experience is from having
 html
 head
 script type=css..
 .body {
  background : url(images/bgimage.jpg);
 }
 /script

 I have had difficulties in getting he bg image to display properly if
 defined as above without proper context path, because it is different
 from the application itself. (the image is in webapp/images
 -directory).

 Also if I have a href=MyBookmarkableWicketPageTry this link/a
 clicking the link takes me to /contextRoot/ without the
 appicationContext url segment (say,
 http://localhost/contextRoot/myApp/MyBookmarkableWicketPage where
 myApp is the missing applicationContext root).

 **
 Martin

 2008/3/19, Martijn Dashorst [EMAIL PROTECTED]:
  remove the /APPLICATION_CONTEXT/ from the src field. If they are in
   your HTML document when Wicket reads it into the cache, these
   attributes will be made context relative automatically.
 
   Obviously this doesn't work for img tags that are inserted through a
   label, as Wicket doesn't know what you mean with the markup.
 
   Martijn
 
 
   On 3/19/08, James Carman [EMAIL PROTECTED] wrote:
On 3/19/08, Martin Makundi [EMAIL PROTECTED]
 wrote:
  I have a somewhat similar situation without a solution (yet).
 
   I have some static resources (images and css files) on the
 server.
   Whenever I deploy the application, the URL of those resources
 depend
   on the environment as the application context root changes. What
 is
   the best/only way to tackle this?
 
   html
   body
   static image:
   img src=/APPLICATION_CONTEXT/images/static_image.jpg/
   /body
   /html
 
   
   
Have you tried wrapping your img tags with  wicket:link?  When
 you
 do this, you can get your browser to display the image properly
 using
 relative URLs.  Beware, however, that the image URL must be relative
 to the current package of the page you're writing (at least until
 they
 apply my patch, hopefully).
   

   Is the only solution to make it a wicket element? This slows down
   transferring a layout design into wicket significantly and seems
 like
   an overkill. Back in the old days I would just have a tag
 replacement:
 
   img src=@APPLICATION_CONTEXT/images/static_image.jpg/
 
   What is the wicket-way to do this without requiring a wicket id
 and a
   hardcoded markup element for the Image in the Page java code.
 
   **
   Martin
 
 
   2008/3/19, Erik van Oosten [EMAIL PROTECTED]:
 
   You were on the right track, label is the right choice.
   
 You need to provide Label a model that retrieves the string
 from your
 db. How you write that model is up to you. (I guess you
 already have
 this part.)
   
 If you do not want the encoding, call
 setEscapeModelStrings(false) on
 the label.
   
 Regards,
 Erik.
   
   
   
 mmocnik wrote:
  Hi,
 
  I'm currently searching for a way to insert an HTML String
 which I get out
  of a DB into a Wicket Page.
  The HTML string is from another application, so I can't
 change anything in
  it.
 
  My first approach was to use a Label, but as Labels encode
 HTML entities,
  this failed...
  I just can't find any Component, that would fit here.
 
  Any sugestions on a component or alternate aproaches?
 
  Thanks and regards,
  Marko
 
   
   
 --
   
Erik van Oosten
 http://www.day-to-day-stuff.blogspot.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]
   
   
 
 
 
  --
   Buy Wicket in Action: http://manning.com/dashorst
   Apache Wicket 1.3.2 is released
   Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.2
 
 
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
 
 

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

Re: My Wicket Flickr Demo a la Ruby On Rails

2008-03-19 Thread Matthew Young
Ok, it there: http://vimeo.com/802144

scroll down to the bottom to download the original.

On Wed, Mar 19, 2008 at 8:30 AM, Frank Bille [EMAIL PROTECTED] wrote:

 I would suggest uploading it to vimeo.com. It supports HD videos as
 well as support for downloading the original file.

 Frank

 On Wed, Mar 19, 2008 at 3:29 AM, Jonathan Locke
 [EMAIL PROTECTED] wrote:
 
 
   this looks like it's probably cool, but there's no audio and the video
 size
   is such that i can't read anything.
 
 
 
   MYoung wrote:
   
Hi, I am new to Wicket and to help me learn, I created a Wicket
 version of
the Flickr demo like the one on the Ruby on Rails site seen here
http://www.rubyonrails.org/screencasts. I put my version in my blog
 here:
http://limboville.blogspot.com/2008_03_01_archive.html.  Please take
 a
look
and give me some feedback.
   
Thanks!
   
   
 
   --
   View this message in context:
 http://www.nabble.com/My-Wicket-Flickr-Demo-a-la-Ruby-On-Rails-tp16106896p16135954.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]




wicket:component does not work with HeaderContributor.forCss()?

2008-03-19 Thread Matthew Young
Hi, I am finding that wicket:component doesn't add stylesheet link in
head from add(HeaderContributor). Is there any way to make it work?

I want to use wicket:component because can I add border around without
changing my component hierarchy.  If I add my border component in .java, it
works as expected but is something I rather not do in this situation:  I am
adding border around in base page and I don't want the child page to know
and just work as if no border component is added.

Here is a small case to demonstrate:

SomePage.java

import org.apache.wicket.markup.html.WebPage;

public class SomePage extends WebPage {
public SomePage() {
//add(new MyBorder(box));   // this work
}

}


SomePage.html

html
head/head
body
wicket:component class=com.mycompany.MyBorder
pYou should see a yellow backgroundbr/
   and a red border/p
/wicket:component

!--span wicket:id=boxThis is a box/span --  !-- if this is use,
stylesheet show up --
/body
/html


MyBorder.java

public class MyBorder extends Border {
private static final long serialVersionUID = 1L;
public MyBorder(String id)  {
super(id);
add(getCssContributor());
}

protected HeaderContributor getCssContributor()  {
return HeaderContributor.forCss(MyBorder.class, style.css);
}
}


MyBorder.html

html
  body
wicket:border
  div class=box_me_up
 wicket:body/
  /div
/wicket:border
  /body
/html


style.css

.box_me_up {
margin: 5px;
padding: 5px;
background: yellow;
border: 2px solid red;
}


How to get error message register in IModel.getObject() to show up in FeedbackPanel?

2008-03-19 Thread Matthew Young
 I register an error to the page in the model but the feedback message
doesn't show in FeedbackPanel.  Only the error message register in
onSubmit() event handler shows.  Please have a look.  Thanks!

HomePage.html:

html
head/head
span wicket:id=messagemessage will be here/span
form wicket:id=form
input type=text wicket:id=word/
input type=submit value=Enter wicket:id=submitButton/
/form
span wicket:id=feedbackFEEDBACK/span
/html


HomePage.java

import ...

public class HomePage extends WebPage {private static final long
serialVersionUID = 1L;

private String word;

public HomePage(final PageParameters parameters) {

add(new
FeedbackPanel(feedback).setOutputMarkupPlaceholderTag(true));
// if the word 'blowup' is entered, this model register a error
message to the page
IModel model = new Model() {private static final long
serialVersionUID = 1L;
@Override public Object getObject() {
if (word != null  word.equals(blowup)) {
word = -b-l-o-w-u-p-;
HomePage.this.fatal(This message is from model.);
return BAD THING HAPPENED IN MODEL;
} else {
return The word is: \ + (word == null ?  n u l l  :
word) + \;
}
}
};
add(new Label(message, model).setOutputMarkupId(true));
Form form = new Form(form, new CompoundPropertyModel(this));
add(form);
form.add(new TextField(word).setRequired(true));

AjaxFallbackButton submitButton = new
AjaxFallbackButton(submitButton, form) {
private static final long serialVersionUID = 1L;
@Override protected void onSubmit(AjaxRequestTarget target, Form
f) {
if (word != null  word.equals(blowup)) {
HomePage.this.error(This message is from onSubmit.
There should also be a message from model);
}
if (target != null) {
target.addComponent(HomePage.this.get(feedback));
target.addComponent(HomePage.this.get(message));
}
}

@Override protected void onError(AjaxRequestTarget target, Form
f) {
target.addComponent(HomePage.this.get(feedback));
// show updated error feedback
}
};
form.add(submitButton);
}
}


Re: My Wicket Flickr Demo a la Ruby On Rails

2008-03-19 Thread Matthew Young
 is there supposed to be sound?

No, it's a silent film :).

On Wed, Mar 19, 2008 at 5:22 PM, Jonathan Locke [EMAIL PROTECTED]
wrote:



 is there supposed to be sound?


 MYoung wrote:
 
  Ok, it there: http://vimeo.com/802144
 
  scroll down to the bottom to download the original.
 
  On Wed, Mar 19, 2008 at 8:30 AM, Frank Bille [EMAIL PROTECTED]
  wrote:
 
  I would suggest uploading it to vimeo.com. It supports HD videos as
  well as support for downloading the original file.
 
  Frank
 
  On Wed, Mar 19, 2008 at 3:29 AM, Jonathan Locke
  [EMAIL PROTECTED] wrote:
  
  
this looks like it's probably cool, but there's no audio and the
 video
  size
is such that i can't read anything.
  
  
  
MYoung wrote:

 Hi, I am new to Wicket and to help me learn, I created a Wicket
  version of
 the Flickr demo like the one on the Ruby on Rails site seen here
 http://www.rubyonrails.org/screencasts. I put my version in my
 blog
  here:
 http://limboville.blogspot.com/2008_03_01_archive.html.  Please
 take
  a
 look
 and give me some feedback.

 Thanks!


  
--
View this message in context:
 
 http://www.nabble.com/My-Wicket-Flickr-Demo-a-la-Ruby-On-Rails-tp16106896p16135954.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]
 
 
 
 

 --
 View this message in context:
 http://www.nabble.com/My-Wicket-Flickr-Demo-a-la-Ruby-On-Rails-tp16106896p16168460.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: How to get error message register in IModel.getObject() to show up in FeedbackPanel?

2008-03-19 Thread Matthew Young
Hi Igor,

Overriding onBeforeRender() doesn't work on Ajax, it's not called :(

Is there anyway to handle this kind of error condition for both Ajax and
non-Ajax?

Having to abandon LoadableDeachableModel is a pity.  The code is much
clearer with LoadableDeachableModel.  Anyway, does Wicket have any way to
let user code handle model error late in the render phase?

Thanks!

On Wed, Mar 19, 2008 at 2:53 PM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 im thinking it might be too late at that point to register the
 messages because the feedback panel might have already rendered...

 perhaps instead of using a loadable detachable model you do something like
 this:

 class mypage {
  private List result;

  onbeforerender() {
  try {
result=populatelist();
  } catch (exception e) {
error(foo);
  }
  super.onbeforerender();
   }

   ondetach() { result=null; super.ondetach(); }


   .. add(new listview(foo, new propertymodel(this, result));

 }

 -igor



 On Wed, Mar 19, 2008 at 2:04 PM, Matthew Young [EMAIL PROTECTED] wrote:
   I register an error to the page in the model but the feedback message
   doesn't show in FeedbackPanel.  Only the error message register in
   onSubmit() event handler shows.  Please have a look.  Thanks!
 
   HomePage.html:
 
   html
   head/head
  span wicket:id=messagemessage will be here/span
  form wicket:id=form
  input type=text wicket:id=word/
  input type=submit value=Enter wicket:id=submitButton/
  /form
  span wicket:id=feedbackFEEDBACK/span
   /html
 
 
   HomePage.java
 
   import ...
 
   public class HomePage extends WebPage {private static final long
   serialVersionUID = 1L;
 
  private String word;
 
  public HomePage(final PageParameters parameters) {
 
  add(new
   FeedbackPanel(feedback).setOutputMarkupPlaceholderTag(true));
  // if the word 'blowup' is entered, this model register a error
   message to the page
  IModel model = new Model() {private static final
 long
   serialVersionUID = 1L;
  @Override public Object getObject() {
  if (word != null  word.equals(blowup)) {
  word = -b-l-o-w-u-p-;
  HomePage.this.fatal(This message is from model.);
  return BAD THING HAPPENED IN MODEL;
  } else {
  return The word is: \ + (word == null ?  n u l l
  :
   word) + \;
  }
  }
  };
  add(new Label(message, model).setOutputMarkupId(true));
  Form form = new Form(form, new CompoundPropertyModel(this));
  add(form);
  form.add(new TextField(word).setRequired(true));
 
  AjaxFallbackButton submitButton = new
   AjaxFallbackButton(submitButton, form) {
  private static final long serialVersionUID = 1L;
  @Override protected void onSubmit(AjaxRequestTarget target,
 Form
   f) {
  if (word != null  word.equals(blowup)) {
  HomePage.this.error(This message is from onSubmit.
   There should also be a message from model);
  }
  if (target != null) {
  target.addComponent(HomePage.this.get(feedback));
  target.addComponent(HomePage.this.get(message));
  }
  }
 
  @Override protected void onError(AjaxRequestTarget target,
 Form
   f) {
  target.addComponent(HomePage.this.get(feedback));
   // show updated error feedback
  }
  };
  form.add(submitButton);
  }
   }
 

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




Re: My Wicket Flickr Demo a la Ruby On Rails

2008-03-19 Thread Matthew Young
My original is big and hi res.  But once I upload to any one of these sites,
they all down res file to tiny size.

On Wed, Mar 19, 2008 at 6:24 PM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 why not use one of those desktop recording things like wink? ive seen
 people put together 1024x768 screencasts with those, or even higher..

 -igor


 On Wed, Mar 19, 2008 at 6:04 PM, Matthew Young [EMAIL PROTECTED] wrote:
  I've not found any site that support high res video.  Photobucket.com,
   vimeo.com are just like Youtube: take high res file and down size to
 tiny
   flash file.  If they can convert to big screen flash, they will stand
 out
   better from Youtube.
 
   Let me see if I can find a good avi to flash converter.  If I do, I'll
   re-record the screencast with sound.
 
   On Wed, Mar 19, 2008 at 5:51 PM, Jonathan Locke 
 [EMAIL PROTECTED]
 
 
  wrote:
 
   
   
shucks.  even on vimeo the resolution is still almost unreadable.
  and
with
no audio, i feel like i'm missing out still.  a nice screencast of
 this
with
sound would be like a wicket infomercial... aren't there sites that
 do
video-efficient, high resolution screencasts?
   
   
MYoung wrote:

 is there supposed to be sound?

 No, it's a silent film :).

 On Wed, Mar 19, 2008 at 5:22 PM, Jonathan Locke 
[EMAIL PROTECTED]
 wrote:



 is there supposed to be sound?


 MYoung wrote:
 
  Ok, it there: http://vimeo.com/802144
 
  scroll down to the bottom to download the original.
 
  On Wed, Mar 19, 2008 at 8:30 AM, Frank Bille 
 [EMAIL PROTECTED]
  wrote:
 
  I would suggest uploading it to vimeo.com. It supports HD
 videos as
  well as support for downloading the original file.
 
  Frank
 
  On Wed, Mar 19, 2008 at 3:29 AM, Jonathan Locke
  [EMAIL PROTECTED] wrote:
  
  
this looks like it's probably cool, but there's no audio and
 the
 video
  size
is such that i can't read anything.
  
  
  
MYoung wrote:

 Hi, I am new to Wicket and to help me learn, I created a
 Wicket
  version of
 the Flickr demo like the one on the Ruby on Rails site
 seen
here
 http://www.rubyonrails.org/screencasts. I put my version
 in my
 blog
  here:
 http://limboville.blogspot.com/2008_03_01_archive.html.
  Please
 take
  a
 look
 and give me some feedback.

 Thanks!


  
--
View this message in context:
 

   
 http://www.nabble.com/My-Wicket-Flickr-Demo-a-la-Ruby-On-Rails-tp16106896p16135954.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]
 
 
 
 

 --
 View this message in context:

   
 http://www.nabble.com/My-Wicket-Flickr-Demo-a-la-Ruby-On-Rails-tp16106896p16168460.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]




   
--
View this message in context:
   
 http://www.nabble.com/My-Wicket-Flickr-Demo-a-la-Ruby-On-Rails-tp16106896p16168924.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: My Wicket Flickr Demo a la Ruby On Rails

2008-03-18 Thread Matthew Young
Thank you Matej and Igor.  I learned several new things.  IAjaxCallDecorator
is very cool and I did not realize wicket:link works on stylesheet ref,
too. The wiki here:
http://cwiki.apache.org/WICKET/wickets-xhtml-tags.html#Wicket%2527sXHTMLtags-WicketTags
make it seem like it only work with a href and img src.

Igor: I'm not very on this one (src wmc):

 you can just create an anon subclass of src wmc and subclass
oncomponenttag() directly and save some space.

Do you mean this:

WebMarkupContainer img = new WebMarkupContainer(thumbnail) {
private static final long serialVersionUID = 1L;
@Override protected void onComponentTag(final ComponentTag tag){
super.onComponentTag(tag);
tag.put(src, thumbnailUrl);
}
};


== I have a couple of questions: ==

In Ajax mode, the browser address always show:

http://localhost:8080

so if I refresh, I get a new page, not the same existing page.  How can I
have the address like this:

http://localhost:8080/?wicket:interface=:0:1:::

so on refresh I get the same page (like in non-Ajax mode)?

2) When something goes wrong in Flickr, I throw a RuntimeException which
blows up in ListView's model.getObject().  I want to Ajax update the
feedbackPanel to show some error message. How can this be done?

Thank you very much.

On Mon, Mar 17, 2008 at 3:15 PM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 there are a couple of things i would change

 1) add(new StyleSheetReference(pageCss, getClass(), flickr.css));

 do you really need that? can you not simply put link tag inside
 wicket:link tags?

 2) // Initially there is no photo to display so add a temporary place
 holder component to make Wicket happy

 you dont need to do that, make loadable detachable model that is
 pulling image links return an empty list if tags string is empty, that
 way you add the listview right away and dont need that replace mambo
 jumbo

 3) Photo photo = (Photo) item.getModelObject(); item.add(new
 Thumbnail(t, photo));

 im not a big fan of that, why not simply item.add(new Thumbnail(t,
 item.getModel()));

 it makes code simpler, you dont load the model object needlessly, and
 it makes thumbnail more flexible by taking an imodel.

 4) img.add(new SimpleAttributeModifier(src, photo.getSmallSquareUrl()));

 you can just create an anon subclass of src wmc and subclass
 oncomponenttag() directly and save some space.

 pretty sweet tutorial though, thanks

 -igor


 On Mon, Mar 17, 2008 at 1:04 PM, Matthew Young [EMAIL PROTECTED] wrote:
  Hi, I am new to Wicket and to help me learn, I created a Wicket version
 of
   the Flickr demo like the one on the Ruby on Rails site seen here
   http://www.rubyonrails.org/screencasts. I put my version in my blog
 here:
   http://limboville.blogspot.com/2008_03_01_archive.html.  Please take a
 look
   and give me some feedback.
 
   Thanks!
 

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




Re: My Wicket Flickr Demo a la Ruby On Rails

2008-03-18 Thread Matthew Young
It's Amateras:
http://amateras.sourceforge.jp/cgi-bin/fswiki_en/wiki.cgi?page=EclipseHTMLEditor


On Mon, Mar 17, 2008 at 7:57 PM, Fernando Wermus [EMAIL PROTECTED]
wrote:

 Which is the name of the embebed Eclipse browser you are using?

 On Mon, Mar 17, 2008 at 7:15 PM, Igor Vaynberg [EMAIL PROTECTED]
 wrote:

  there are a couple of things i would change
 
  1) add(new StyleSheetReference(pageCss, getClass(), flickr.css));
 
  do you really need that? can you not simply put link tag inside
  wicket:link tags?
 
  2) // Initially there is no photo to display so add a temporary place
  holder component to make Wicket happy
 
  you dont need to do that, make loadable detachable model that is
  pulling image links return an empty list if tags string is empty, that
  way you add the listview right away and dont need that replace mambo
  jumbo
 
  3) Photo photo = (Photo) item.getModelObject(); item.add(new
  Thumbnail(t, photo));
 
  im not a big fan of that, why not simply item.add(new Thumbnail(t,
  item.getModel()));
 
  it makes code simpler, you dont load the model object needlessly, and
  it makes thumbnail more flexible by taking an imodel.
 
  4) img.add(new SimpleAttributeModifier(src, photo.getSmallSquareUrl
 ()));
 
  you can just create an anon subclass of src wmc and subclass
  oncomponenttag() directly and save some space.
 
  pretty sweet tutorial though, thanks
 
  -igor
 
 
  On Mon, Mar 17, 2008 at 1:04 PM, Matthew Young [EMAIL PROTECTED]
 wrote:
   Hi, I am new to Wicket and to help me learn, I created a Wicket
 version
  of
the Flickr demo like the one on the Ruby on Rails site seen here
http://www.rubyonrails.org/screencasts. I put my version in my blog
  here:
http://limboville.blogspot.com/2008_03_01_archive.html.  Please take
 a
  look
and give me some feedback.
  
Thanks!
  
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 


 --
 Fernando Wermus.



Re: My Wicket Flickr Demo a la Ruby On Rails

2008-03-18 Thread Matthew Young
Hi, Igor:

nstead of throwing the exception call error(message) on the page and
return an empty list from the model

So I register a error to the page in the model but the feedback message
doesn't show.  Here is a small sample to demonstrate:

HomePage.html:

html
head/head
span wicket:id=messagemessage will be here/span
form wicket:id=form
input type=text wicket:id=word/
input type=submit value=Enter wicket:id=submitButton/
/form
span wicket:id=feedbackFEEDBACK/span
/html


HomePage.java

import org.apache.wicket.PageParameters;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

public class HomePage extends WebPage {

private static final long serialVersionUID = 1L;

private String word;

public HomePage(final PageParameters parameters) {

add(new
FeedbackPanel(feedback).setOutputMarkupPlaceholderTag(true));
// if the word 'blowup' is entered, this register a error message to
the page
IModel model = new Model() {
private static final long serialVersionUID = 1L;
@Override public Object getObject() {
if (word != null  word.equals(blowup)) {
word = -b-l-o-w-u-p-;
HomePage.this.fatal(This message is from model.);
return BAD THING HAPPENED IN MODEL;
} else {
return The word is: \ + (word == null ?  n u l l  :
word) + \;
}
}
};
add(new Label(message, model).setOutputMarkupId(true));
Form form = new Form(form, new CompoundPropertyModel(this));
add(form);
form.add(new TextField(word).setRequired(true));
AjaxFallbackButton submitButton = new
AjaxFallbackButton(submitButton, form) {
private static final long serialVersionUID = 1L;
@Override protected void onSubmit(AjaxRequestTarget target, Form
f) {
if (word != null  word.equals(blowup)) {
HomePage.this.error(This message is from onSubmit.
There should also be a message from model);
}
if (target != null) {
target.addComponent(HomePage.this.get(feedback));
// clear error feedback if any
target.addComponent(HomePage.this.get(message));
}
}

@Override protected void onError(AjaxRequestTarget target, Form
f) {
target.addComponent(HomePage.this.get(feedback));
// show updated error feedback
}
};
form.add(submitButton);
}
}



Enter the word 'blowup' and the Model registers a error message to the page,
this message doesn't show.


On Tue, Mar 18, 2008 at 12:19 PM, Igor Vaynberg [EMAIL PROTECTED]
wrote:

 On Tue, Mar 18, 2008 at 11:48 AM, Matthew Young [EMAIL PROTECTED] wrote:
   Do you mean this:
 
  WebMarkupContainer img = new WebMarkupContainer(thumbnail) {
  private static final long serialVersionUID = 1L;
  @Override protected void onComponentTag(final ComponentTag
 tag){
  super.onComponentTag(tag);
  tag.put(src, thumbnailUrl);
  }
  };

 yep

   2) When something goes wrong in Flickr, I throw a RuntimeException
 which
   blows up in ListView's model.getObject().  I want to Ajax update the
   feedbackPanel to show some error message. How can this be done?

 instead of throwing the exception call error(message) on the page and
 return an empty list from the model

 -igor

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




Re: My Wicket Flickr Demo a la Ruby On Rails

2008-03-18 Thread Matthew Young
Hi,

How to make HybridUrlCodingStrategy work on home page if my
contextpath=/?  HybridUrlCodingStrategy doesn't allow mapping /.

On Tue, Mar 18, 2008 at 11:52 AM, Matej Knopp [EMAIL PROTECTED] wrote:

 Hi,

 you can mount your page using HybridUrlCodingStrategy. Then it should
 automatically redirect to URL that has page instance information in
 it.

 -Matej

 On Tue, Mar 18, 2008 at 7:48 PM, Matthew Young [EMAIL PROTECTED] wrote:
  Thank you Matej and Igor.  I learned several new things.
  IAjaxCallDecorator
   is very cool and I did not realize wicket:link works on stylesheet
 ref,
   too. The wiki here:
 
 http://cwiki.apache.org/WICKET/wickets-xhtml-tags.html#Wicket%2527sXHTMLtags-WicketTags
   make it seem like it only work with a href and img src.
 
   Igor: I'm not very on this one (src wmc):
 
 
you can just create an anon subclass of src wmc and subclass
   oncomponenttag() directly and save some space.
 
   Do you mean this:
 
  WebMarkupContainer img = new WebMarkupContainer(thumbnail) {
  private static final long serialVersionUID = 1L;
  @Override protected void onComponentTag(final ComponentTag
 tag){
  super.onComponentTag(tag);
  tag.put(src, thumbnailUrl);
  }
  };
 
 
   == I have a couple of questions: ==
 
   In Ajax mode, the browser address always show:
 
  http://localhost:8080
 
   so if I refresh, I get a new page, not the same existing page.  How can
 I
   have the address like this:
 
  http://localhost:8080/?wicket:interface=:0:1:::
 
   so on refresh I get the same page (like in non-Ajax mode)?
 
   2) When something goes wrong in Flickr, I throw a RuntimeException
 which
   blows up in ListView's model.getObject().  I want to Ajax update the
   feedbackPanel to show some error message. How can this be done?
 
   Thank you very much.
 
 
   On Mon, Mar 17, 2008 at 3:15 PM, Igor Vaynberg [EMAIL PROTECTED]
 
   wrote:
 
 
 
   there are a couple of things i would change
   
1) add(new StyleSheetReference(pageCss, getClass(), flickr.css));
   
do you really need that? can you not simply put link tag inside
wicket:link tags?
   
2) // Initially there is no photo to display so add a temporary place
holder component to make Wicket happy
   
you dont need to do that, make loadable detachable model that is
pulling image links return an empty list if tags string is empty,
 that
way you add the listview right away and dont need that replace mambo
jumbo
   
3) Photo photo = (Photo) item.getModelObject(); item.add(new
Thumbnail(t, photo));
   
im not a big fan of that, why not simply item.add(new Thumbnail(t,
item.getModel()));
   
it makes code simpler, you dont load the model object needlessly, and
it makes thumbnail more flexible by taking an imodel.
   
4) img.add(new SimpleAttributeModifier(src, photo.getSmallSquareUrl
 ()));
   
you can just create an anon subclass of src wmc and subclass
oncomponenttag() directly and save some space.
   
pretty sweet tutorial though, thanks
   
-igor
   
   
On Mon, Mar 17, 2008 at 1:04 PM, Matthew Young [EMAIL PROTECTED]
 wrote:
 Hi, I am new to Wicket and to help me learn, I created a Wicket
 version
of
  the Flickr demo like the one on the Ruby on Rails site seen here
  http://www.rubyonrails.org/screencasts. I put my version in my
 blog
here:
  http://limboville.blogspot.com/2008_03_01_archive.html.  Please
 take a
look
  and give me some feedback.

  Thanks!

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



 --
 Resizable and reorderable grid components.
 http://www.inmethod.com

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




Re: [vote] Release 1.4 with only generics and stop support for 1.3

2008-03-17 Thread Matthew Young
+1

On Mon, Mar 17, 2008 at 1:13 AM, Martijn Dashorst 
[EMAIL PROTECTED] wrote:

 This thread is for voting only. Use the [discuss] thread for voicing
 your opinion or asking questions. This makes counting the votes much
 easier.

 The discussion on our development list makes it clear that a lot of
 folks are anxious for generified models. Most users if not all wish us
 to release a quick release which is 1.3 + generics. The consequence is
 that the core team will stop to support 1.3, and that everybody that
 wishes updates will have to migrate to 1.4, and upgrade to Java 5.

 Everybody is invited to vote! Please use

 [ ] +1, Wicket 1.4 is 1.3 + generics, drop support for 1.3
 [ ] -1, I need a supported version running on Java 1.4

 Let your voices be heard!

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

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




My Wicket Flickr Demo a la Ruby On Rails

2008-03-17 Thread Matthew Young
Hi, I am new to Wicket and to help me learn, I created a Wicket version of
the Flickr demo like the one on the Ruby on Rails site seen here
http://www.rubyonrails.org/screencasts. I put my version in my blog here:
http://limboville.blogspot.com/2008_03_01_archive.html.  Please take a look
and give me some feedback.

Thanks!


Re: Double submit problem

2008-03-17 Thread Matthew Young
Does this stuff here prevent double submit?

http://wicket.apache.org/docs/wicket-1.3.2/wicket/apidocs/org/apache/wicket/settings/IRequestCycleSettings.html

...so that not only form submits are shielded from the double submit
problem...

On Mon, Mar 10, 2008 at 6:56 AM, Joel Hill [EMAIL PROTECTED] wrote:

 I'm trying to prevent the double submit problem, where the user clicks the
 submit button more than once causing a double post.

 I tried implementing the soluion suggested here:
 http://www.nabble.com/Re%3A-double-form-submission-handling---p13850262.html

 The problem is if there's a validation error and the user gets sent back
 to the same page (without a call to setResponsePage), the page still
 registers as submitted, so when the user fixes the form and submits, it's
 stuck in the resubmit state (which in my case sends the user to an error
 page).  I even have one page where I don't call setResponsePage on a
 successful submit, because it just returns to that same page after a submit
 because there's a lot of overhead in constructing the page the first time.
  I don't want the submit to take a long time.

 I tried resetting the submitted boolean during the submit process, but no
 matter where I could find to put that code, it always seems to get executed
 before the 2nd submit get processed by wicket.

 I'd prefer not to implment a javascript solution (e.g. disabling the
 submit button after the first click), becuase I think the soultion linked
 above lends itself better to reusability across any form.  So is there any
 way to differentiate between a double submit situation, and simply not
 calling setResponsePage?  Or is there anywhere in wicket I can reset the
 submitted flag AFTER the double submit has begun to process (I'd prefer not
 to implement an artificial timer to reset the flag after a hard-coded number
 of seconds).  Some point in the request cycle that occurs after the old page
 is unloaded?

 Now that I think about it, maybe some ajax that fires on the onunload
 event would be appropriate here.  I'll try that while I wait to see of
 anyone has any better suggestions.

 Thanks.

 Joel


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