[Wicket-user] Model for form with variable number of fields

2007-08-04 Thread Tauren Mills
Hello,

I have a process that reads a CSV data file.  The data contains lists
of people, but the number of fields, the order and the type of fields
can vary from one CSV to another.

Because the data in each column is unknown, a form is displayed with a
preview of the data in a table.  The table column headers contain
dropdown list of possible field types for each column in the csv file.
 I'm using a RepeatingView to generate the headers.

The problem is, I'm unclear how to design the CompoundPropertyModel
for the form.  I assume my model needs to contain a collection of some
sort since I have a varying number of field.  But how do I map the set
of RepeatingView-WebMarkupContainer-DropDownChoice objects to the
model as a collection?

Here's the code:

preview = importer.previewImport(new FileInputStream(dataFile),10,2);
  ...
RepeatingView headers = new RepeatingView(header);
form.add(headers);
int numFields = preview.getRecords()[0].getFields().length;
for (int j = 0; j  numFields; j++) {
  WebMarkupContainer cell = new WebMarkupContainer(headers.newChildId());
  headers.add(cell);
  cell.add(new EdiCriteriaDropDownChoice(criteria).setRequired(true));
}

And the markup:

table cellspacing=1
  tr
th wicket:id=header
select name=select wicket:id=criteria/select
/th
  /tr
   ...
/table

What kind of model would work with this?

Thanks,
Tauren

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
IMPORTANT NOTICE:

This mailing list is shutting down. Please subscribe to the Apache Wicket user 
list. Send a message to: users-subscribe at wicket.apache.org and follow the 
instructions.
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Refreshing hibernate models

2007-07-11 Thread Tauren Mills
David,

Thanks for the feedback.  At first I thought the formula hibernate
feature was very handy, but now that I'm seeing the drawbacks to it, I
think I'm going to dump it.  I think I'll add the actual jdbc logic to
getCountReports, getAvgQuestion1, etc.  In the long run, that should
be easier to maintain.

Tauren


On 7/11/07, David Bernard [EMAIL PROTECTED] wrote:
 IMHO, because data are not managed (calculated/updated) by your application, 
 you could :
   * refresh Service from RDBMS when reports are submitted, but in this case 
 you forgot unsaved modification into Service (maybe you could do a partial 
 refresh if you extract computed property into an
 encapsulated object (with it's own cache rule)
   * or don't use formula, and do a direct JDBC query into getCoutnReports() 
 and getAvgQuestions1().

 Regards

 Tauren Mills wrote:
  I'm working on a site that allows people to rate services.  There is a
  Services entity that contains a set of Report entities.  Users can add
  new services and submit reports on those services.  The reports have
  questions that users rate from 1 to 5 stars.
 
  I am using hibernate properties with formulas to calculate several
  things.  Doing this has really simplified things, however it looks
  like it may have made other things more complex. For instance, I have
  properties like this in Service:
 
  property name=avgQuestion1
  formula=(select round(avg(r.question1)) from report r where
  r.service_id = service_id) /
  property name=countReports
  formula=(select count(*) from report r where r.service_id = 
  service_id) /
 
  The users see a dataview of services. One of the columns is the number
  of reports submitted for that service.  The problem is that when the
  user submits a report and then goes back to the dataview, the list
  isn't updated to indicate the new report.  The value of countReports
  is still the same.  Nor are the averages updated.
 
  The Services table hasn't changed when a report is submitted, so
  hibernate isn't refreshing.  However, the calculated formulas HAVE
  changed, but aren't causing the data to be re-read.
 
  Are there recommended ways to force a refresh of the data?  Should I
  do it in the dataview?  Or should I do it when a new report is
  submitted?  Any suggestions and advice is much  appreciated!
 
  Tauren
 
  -
  This SF.net email is sponsored by DB2 Express
  Download DB2 Express C - the FREE version of DB2 express and take
  control of your XML. No limits. Just data. Click to get it now.
  http://sourceforge.net/powerbar/db2/
  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user
 

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


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


[Wicket-user] Pages vs. Panels

2007-07-10 Thread Tauren Mills
I'm interested in how others typically build a web application in
regards to using many Pages or very few Pages with Panels for
different web pages of content.  I'm not referring to using smaller
reusable panels within pages/panels, but main Panels that encompass
the majority of the content of a web page.

The first wicket site I built used had one primary page with several
main panels for the content on different web pages.  It used the
tabbed interface control, so it made sense to have a single page with
different panels that get swapped in for different content web
pages.  This site had many ajax features as well, so this approach
made sense.

I'm about 70% done on another project and I've used mostly Pages for
each web page on the site. In many ways, this approach seems simpler
and more straightforward.  Plus, it makes adding bookmarkable pages
easier.  This site uses very little ajax, so that also makes the Page
approach feasible.

However, I discovered a navigation issue and am considering adding the
Breadcrumb feature to this site.  Unfortunately, it looks like the
breadcrumb control uses Panels instead of pages.  So it looks like I
need to switch everything from being page-based to panel-based.  Of
course, doing that will take some time, but it isn't the end of the
world.

So, I guess I'm just wondering, what do the rest of you end up doing?
Do you find that most of your web pages are actually Panels in a
single Page?  Or are your sites built using many Pages?  Or is it
somewhere in between?  I'm just curious if there is a majority one way
or the other and if there are any strong reasons for one approach over
the other.

Thanks!
Tauren



building another one now and it has a lot of pages.

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


Re: [Wicket-user] Wicket get together at O'Reilly Open Source convention? (Portland Oregon USA)

2007-07-10 Thread Tauren Mills
Sean,

I'm in Portland too, but I may not be in town that week.  Still
working out the details.  It does sound like a great idea.  I got a
friend here in town into wicket, so he might be interested as well.

Tauren


On 6/30/07, Eelco Hillenius [EMAIL PROTECTED] wrote:
  Are there any Wicket people coming to Portland for OSCON?

 I'd love to, especially since it's reasonably close to Seattle, but my
 deadlines and wallet won't let me. I was also too late with proposing
 for a talk.

 I hope you'll have fun there!

 Eelco

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


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


[Wicket-user] Refreshing hibernate models

2007-07-10 Thread Tauren Mills
I'm working on a site that allows people to rate services.  There is a
Services entity that contains a set of Report entities.  Users can add
new services and submit reports on those services.  The reports have
questions that users rate from 1 to 5 stars.

I am using hibernate properties with formulas to calculate several
things.  Doing this has really simplified things, however it looks
like it may have made other things more complex. For instance, I have
properties like this in Service:

property name=avgQuestion1
formula=(select round(avg(r.question1)) from report r where
r.service_id = service_id) /
property name=countReports
formula=(select count(*) from report r where r.service_id = service_id) /

The users see a dataview of services. One of the columns is the number
of reports submitted for that service.  The problem is that when the
user submits a report and then goes back to the dataview, the list
isn't updated to indicate the new report.  The value of countReports
is still the same.  Nor are the averages updated.

The Services table hasn't changed when a report is submitted, so
hibernate isn't refreshing.  However, the calculated formulas HAVE
changed, but aren't causing the data to be re-read.

Are there recommended ways to force a refresh of the data?  Should I
do it in the dataview?  Or should I do it when a new report is
submitted?  Any suggestions and advice is much  appreciated!

Tauren

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


Re: [Wicket-user] Wicket get together at O'Reilly Open Source convention? (Portland Oregon USA)

2007-07-10 Thread Tauren Mills
That sounds great!  All the action is overseas, lets get some here on
the west coast!  Planning it might be the hard part...  Lets see...
juggling 3 wicket projects right now.. can I find time to go to
Seattle?  :)  I'm sure everyone else is in the same boat...

Tauren

On 7/10/07, Eelco Hillenius [EMAIL PROTECTED] wrote:
  I'm in Portland too, but I may not be in town that week.  Still
  working out the details.  It does sound like a great idea.  I got a
  friend here in town into wicket, so he might be interested as well.

 Not directly related to this conference, but if there's enough
 interest, Jonathan and I can probably organize a low-key Wicket
 get-together in Seattle sometime. I mean: London, Copenhagen,
 Amsterdam... we can't stay behind can we?! ;=)


 Eelco

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


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


[Wicket-user] Getting compoundpropertymodel from a parent

2007-07-09 Thread Tauren Mills
I'm confused on how to access a CompoundPropertyModel from within a
child Panel. I set a CompountPropertyModel in a parent panel.  But
doing a getModel() in the child panel returns null.  I thought that
wicket would hunt back up the component tree to find an appropriate
CompountPropertyModel.  How should I do this?

Here is the parent, where I set the CPM:

public class RatingDisplayPanel extends Panel {
public RatingDisplayPanel(String id, RatingsModel ratings) {
super(id);
setModel(new CompoundPropertyModel(ratings));
add(new StarDisplay(facility, RatingBean.STARS));
}
}

Here is the child, where I do a getModel() and it returns null:

public class StarDisplay extends Panel {

private int width = 0;

public StarDisplay(String id, List choices) {
super(id);
int size = 0;
if (choices != null) {
size = choices.size();
if (getModel() != null) {
index = 
choices.indexOf(getModel().getObject(this));
}
this.width = (index + 1)*100/size;
WebMarkupContainer on = new WebMarkupContainer(on);
on.add(new AttributeModifier(style, true, new Model() 
{
public Object getObject(final Component 
component) {
return width: +width+%;
}
}));
add(on);
}
}
}

I have it working right now by passing the model like this, but I want
to simplify the code in my parent panel:

add(new StarDisplay(facility, new PropertyModel(ratings,
facility), RatingBean.STARS));

I thought perhaps I should use getNestedModel(), but it doesn't exist
in a panel.  Any help is appreciated!

Tauren

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


Re: [Wicket-user] Getting compoundpropertymodel from a parent

2007-07-09 Thread Tauren Mills
Component.initModel() calls getParent() and it returns null.  I guess
that makes sense because the child hasn't been added to the parent
yet.  That happens after the child constructor has finished.

So how would I do this?

Tauren



On 7/9/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
 On 7/9/07, Tauren Mills [EMAIL PROTECTED] wrote:

  I'm confused on how to access a CompoundPropertyModel from within a
  child Panel. I set a CompountPropertyModel in a parent panel.  But
  doing a getModel() in the child panel returns null.  I thought that
  wicket would hunt back up the component tree to find an appropriate
  CompountPropertyModel.  How should I do this?
 
  Here is the parent, where I set the CPM:
 
  public class RatingDisplayPanel extends Panel {
  public RatingDisplayPanel(String id, RatingsModel ratings) {
  super(id);
  setModel(new
 CompoundPropertyModel(ratings));
  add(new StarDisplay(facility, RatingBean.STARS));
  }
  }
 
  Here is the child, where I do a getModel() and it returns null:
 
  public class StarDisplay extends Panel {
 
  private int width = 0;
 
  public StarDisplay(String id, List choices) {
  super(id);
  int size = 0;
  if (choices != null) {
  size = choices.size();
  if (getModel() != null) {
  index =
 choices.indexOf(getModel().getObject(this));
  }
  this.width = (index + 1)*100/size;
  WebMarkupContainer on = new
 WebMarkupContainer(on);
  on.add(new AttributeModifier(style, true, new
 Model() {
  public Object
 getObject(final Component component) {
  return width:
 +width+%;
  }
  }));
  add(on);
  }
  }
  }
 
  I have it working right now by passing the model like this, but I want
  to simplify the code in my parent panel:
 
  add(new StarDisplay(facility, new PropertyModel(ratings,
  facility), RatingBean.STARS));
 
  I thought perhaps I should use getNestedModel(), but it doesn't exist
  in a panel.  Any help is appreciated!


 seems like it should work, can you walk the code and see why getmodel()
 returns null?

 -igor


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


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



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


Re: [Wicket-user] Getting compoundpropertymodel from a parent

2007-07-09 Thread Tauren Mills
Thanks Igor, putting it getObject makes total sense!  However, now I'm
confused on how to access the property I want within getObject:

public Object getObject(final Component component) {
int size = choices.size();
int index = choices.indexOf(component.getModelObject());
int width = (index + 1)*100/size;
return width: +width+%;
}

That doesn't work. I'm trying to access a parent CompoundPropertyModel
that contains a RatingsModel and want the facility property within
it.  But I can't hardcode facility as this same method should be
used for many other properties.

Not sure what this is doing, but it isn't right:
int index = choices.indexOf(component.getModelObject());

This creates an infinite loop:
int index = choices.indexOf(this.getObject(component));

So what is the correct way to access that property?

Thanks again,
Tauren


On 7/9/07, Igor Vaynberg [EMAIL PROTECTED] wrote:

 On 7/9/07, Tauren Mills [EMAIL PROTECTED] wrote:
  Component.initModel() calls getParent() and it returns null.  I guess
  that makes sense because the child hasn't been added to the parent
  yet.  That happens after the child constructor has finished.

 that makes sense

  So how would I do this?

 you have to delay the code that needs index until rendertime. move the code
 that calculates the index into the same code that uses it - inside
 model.getobject() used inside that attribute modifier.

 -igor



  Tauren
 
 
 
  On 7/9/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
   On 7/9/07, Tauren Mills [EMAIL PROTECTED] wrote:
  
I'm confused on how to access a CompoundPropertyModel from within a
child Panel. I set a CompountPropertyModel in a parent panel.  But
doing a getModel() in the child panel returns null.  I thought that
wicket would hunt back up the component tree to find an appropriate
CompountPropertyModel.  How should I do this?
   
Here is the parent, where I set the CPM:
   
public class RatingDisplayPanel extends Panel {
public RatingDisplayPanel(String id, RatingsModel ratings) {
super(id);
setModel(new
   CompoundPropertyModel(ratings));
add(new StarDisplay(facility, RatingBean.STARS));
}
}
   
Here is the child, where I do a getModel() and it returns null:
   
public class StarDisplay extends Panel {
   
private int width = 0;
   
public StarDisplay(String id, List choices) {
super(id);
int size = 0;
if (choices != null) {
size = choices.size();
if (getModel() != null) {
index =
   choices.indexOf(getModel().getObject(this));
}
this.width = (index + 1)*100/size;
WebMarkupContainer on = new
   WebMarkupContainer(on);
on.add(new AttributeModifier(style, true,
 new
   Model() {
public Object
   getObject(final Component component) {
return
 width:
   +width+%;
}
}));
add(on);
}
}
}
   
I have it working right now by passing the model like this, but I want
to simplify the code in my parent panel:
   
add(new StarDisplay(facility, new PropertyModel(ratings,
facility), RatingBean.STARS));
   
I thought perhaps I should use getNestedModel(), but it doesn't exist
in a panel.  Any help is appreciated!
  
  
   seems like it should work, can you walk the code and see why getmodel()
   returns null?
  
   -igor
  
  
Tauren
   
   
  
 -
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
   
 https://lists.sourceforge.net/lists/listinfo/wicket-user
   
  
  
  
 -
   This SF.net email is sponsored by DB2 Express
   Download DB2 Express C - the FREE version of DB2 express and take
   control of your XML. No limits. Just data. Click to get it now.
   http://sourceforge.net/powerbar/db2/
   ___
   Wicket-user mailing list
   Wicket-user@lists.sourceforge.net
  
 https://lists.sourceforge.net/lists/listinfo/wicket-user
  
  
 
 
 -
  This SF.net email is sponsored by DB2 Express
  Download DB2 Express C - the FREE version

[Wicket-user] Advice needed on custom star rating control

2007-07-03 Thread Tauren Mills
I need to allow users to rate things on a site, but as far as I can
tell, none of the star rating controls I've seen do everything I want.
 I'd like the following:

1.  Should have CSS or Javascript rollover support to highlight stars
as mouse rolls over them.
2.  Must be able to fallback to regular HTML form submission if
javascript is not availble.
3.  Needs to have multiple star rating controls in the same form on
the same page.
4.  Should be able to show the overall rating within the same control
(as colored and grey stars) and still allow mouse rollover
highlighting in another color.
5.  Should have a display-only mode where the rating feature doesn't
work, it just shows the current rating.

The Wicket rating control doesn't include the mouse rollover support:
http://wicketstuff.org/wicket13/ajax/?wicket:bookmarkablePage=%3Aorg.apache.wicket.examples.ajax.builtin.RatingsPage

This CSS only version is nice, but I don't think it does any sort of
fallback to regular HTML:
http://komodomedia.com/blog/index.php/2007/01/20/css-star-rating-redux/

This JQuery-rating plugin is probably closest with really nice HTML
fallback, but it looks like each control needs to be in its own form
and I need multiple controls in a single form:
http://sandbox.wilstuckey.com/jquery-ratings/

Before I go and start creating yet another star rating wicket control,
does anyone know of other solutions that would work?  Or any advice on
which path to take?  I'm tempted to start with the JQuery-rating
solution and build a wicket control from it, but maybe adding rollover
to the current wicket control would be better?

Thanks!
Tauren

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


Re: [Wicket-user] Advice needed on custom star rating control

2007-07-03 Thread Tauren Mills
Thanks for the ideas, Jeremy.

For my application, users will be rating services and will fill out a
form that includes several text fields, a textarea, a dropdown, and so
forth.  They need to rate this service based on multiple criteria with
a star-rating control for each criteria.  I want star-rating controls
that fallback to plain html dropdowns like the jquery-rating plugin
does.

For this reason, I'm not sure that using AjaxFallbackLinks is the best
solution.  I don't want the user to lose any input into the text
fields, textarea, dropdowns, etc.  Maybe there would be a way to do it
using AjaxSubmtiLink, but I don't think that it has Fallback
capability for users without JS enabled.  Plus, I don't want the
feedback panel appearing if they chose to rate before completing other
required fields in the form.

If you have more ideas, I'd certainly like to hear them!

Tauren



On 7/3/07, Jeremy Thomerson [EMAIL PROTECTED] wrote:
 I implemented one on our site (see example at:
 http://www.texashuntfish.com/thf/app/journals/1089/Boone-Crockett-26th-Big-Game-Awards-2004-2006-Entries-
 ).

 It's pretty straight-forward.  Do you require that it is a form submission?
 (i.e. - is it nested in another form, and the whole form must be submitted
 to save data?).  If not, I'd suggest staying away from a form altogether -
 use AjaxFallbackLink  Just paint your stars, each with an
 AjaxFallbackLink, and then if it is an ajax request, do
 target.addComponent(wholeStarPanel) to repaint the updated panel (if you
 have recalculated the star rating, etc).

 Hope this helps a little.  Sorry I didn't have more time for a better
 example.

 Jeremy Thomerson


 On 7/3/07, Tauren Mills [EMAIL PROTECTED] wrote:
 
  I need to allow users to rate things on a site, but as far as I can
  tell, none of the star rating controls I've seen do everything I want.
  I'd like the following:
 
  1.  Should have CSS or Javascript rollover support to highlight stars
  as mouse rolls over them.
  2.  Must be able to fallback to regular HTML form submission if
  javascript is not availble.
  3.  Needs to have multiple star rating controls in the same form on
  the same page.
  4.  Should be able to show the overall rating within the same control
  (as colored and grey stars) and still allow mouse rollover
  highlighting in another color.
  5.  Should have a display-only mode where the rating feature doesn't
  work, it just shows the current rating.
 
  The Wicket rating control doesn't include the mouse rollover support:
 
 http://wicketstuff.org/wicket13/ajax/?wicket:bookmarkablePage=%3Aorg.apache.wicket.examples.ajax.builtin.RatingsPage
 
  This CSS only version is nice, but I don't think it does any sort of
  fallback to regular HTML:
 
 http://komodomedia.com/blog/index.php/2007/01/20/css-star-rating-redux/
 
  This JQuery-rating plugin is probably closest with really nice HTML
  fallback, but it looks like each control needs to be in its own form
  and I need multiple controls in a single form:
  http://sandbox.wilstuckey.com/jquery-ratings/
 
  Before I go and start creating yet another star rating wicket control,
  does anyone know of other solutions that would work?  Or any advice on
  which path to take?  I'm tempted to start with the JQuery-rating
  solution and build a wicket control from it, but maybe adding rollover
  to the current wicket control would be better?
 
  Thanks!
  Tauren
 
 
 -
  This SF.net email is sponsored by DB2 Express
  Download DB2 Express C - the FREE version of DB2 express and take
  control of your XML. No limits. Just data. Click to get it now.
  http://sourceforge.net/powerbar/db2/
  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user
 
 


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



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


Re: [Wicket-user] Advice needed on custom star rating control

2007-07-03 Thread Tauren Mills
Igor,

Of course my preference would be to do exactly that -- improve the
wicket-extensions rating control and give it back to the community.
However, it is missing several features that I need, including the
javascript rollover feature as well as not supporting fallback to
html.

Of course I could implement these features, but I don't have a lot of
time to put into this right now.  Since the jQuery-ratings plugin does
almost everything I need, except for allow multiple raters in one
form, it looks like it may be quicker to implement.

Regardless, either way I'll contribute it to the wicket community.
However, I was hoping that someone might have some suggestions or know
of someone who already did something similar.  I really don't want to
sink too much time into this one little feature, but it is looking
like I might have to.

Tauren


On 7/3/07, Igor Vaynberg [EMAIL PROTECTED] wrote:

 On 7/3/07, Tauren Mills [EMAIL PROTECTED] wrote:
  The Wicket rating control doesn't include the mouse rollover support:
 http://wicketstuff.org/wicket13/ajax/?wicket:bookmarkablePage=%3Aorg.apache.wicket.examples.ajax.builtin.RatingsPage

  Before I go and start creating yet another star rating wicket control,
  does anyone know of other solutions that would work?  Or any advice on
  which path to take?  I'm tempted to start with the JQuery-rating
  solution and build a wicket control from it, but maybe adding rollover
  to the current wicket control would be better?

 why roll your own? why not patch the one in extensions and give a little
 back to the community?

 -igor

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


[Wicket-user] Consistent layouts - markup inheritance or borders?

2007-06-27 Thread Tauren Mills
It seems that there are two primary ways of having consistent layouts
across all pages:

1.  Use markup inheritance:
http://cwiki.apache.org/WICKET/markup-inheritance.html

2.  Use Borders:
http://cwiki.apache.org/WICKET/consistent-page-layout-using-borders.html

I personally have used markup inheritance for this since starting with
wicket.  But I see some advantages to using Borders too.

I'd love to hear everyone's opinion on this.  Which way do you do it?
Why?  What are the pros and cons for each method?

Thanks!
Tauren

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


[Wicket-user] Customizing ModalWindow CSS

2007-06-27 Thread Tauren Mills
What is the best way to customize the CSS styles of a ModalWindow in
1.2.6? The blue and grey borders do not go well with my site's color
scheme.  It looks like setCssClassName only selects from the blue or
grey in modal.css.  So how do I use my own stylesheet?

Should I extend ModalWindow and copy/modify the css as a new css file
for the extended class (call it MyModalWindow)?  Won't that mean both
the ModalWindow css and the MyModalWindow css files will be included
in the header?  Will I have to copy all of ModalWindow's resources
into the MyModalWindow package (png, js, etc)?

Should I just override the css attributes that I want changed in my
main css file?  But chances are the ModalWindow's css file will be
included after my main one, in which case it will override my
settings.

Something else?

Thanks!
Tauren

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


[Wicket-user] AJAX version of OrderByBorder?

2007-06-27 Thread Tauren Mills
I'd like to refresh a DataView with OrderByBorder column headers
without doing a full page refresh.  In other words, when a column
header is clicked to sort the DataView, the DataView refreshes via
ajax. Pagination can be done via ajax, but I haven't seen a way to do
sorting via ajax.  Does it exist?  If not, any advice on how to
implement it?

Thanks,
Tauren

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


Re: [Wicket-user] Customizing ModalWindow CSS

2007-06-27 Thread Tauren Mills
Sweet! Thanks so much..

On 6/27/07, Scott Swank [EMAIL PROTECTED] wrote:
 Here's everything I know.  (Not much)

 http://www.nabble.com/how-to-customize-Modal-Window%60s-appearance-tf3775853.html#a10768589

 On 6/27/07, Andrew Klochkov [EMAIL PROTECTED] wrote:
  search through the mail-list, this topic was discussed in details
 
  Tauren Mills wrote:
   What is the best way to customize the CSS styles of a ModalWindow in
   1.2.6?
  
  --
  Andrew Klochkov

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


Re: [Wicket-user] AJAX version of OrderByBorder?

2007-06-27 Thread Tauren Mills
Igor to the rescue again...  Thanks!

Tauren

On 6/27/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
 see ajaxfallbackorderbyborder

 -igor



 On 6/27/07, Tauren Mills [EMAIL PROTECTED] wrote:
 
  I'd like to refresh a DataView with OrderByBorder column headers
  without doing a full page refresh.  In other words, when a column
  header is clicked to sort the DataView, the DataView refreshes via
  ajax. Pagination can be done via ajax, but I haven't seen a way to do
  sorting via ajax.  Does it exist?  If not, any advice on how to
  implement it?
 
  Thanks,
  Tauren
 
 
 -
  This SF.net email is sponsored by DB2 Express
  Download DB2 Express C - the FREE version of DB2 express and take
  control of your XML. No limits. Just data. Click to get it now.
  http://sourceforge.net/powerbar/db2/
  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user
 


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



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


Re: [Wicket-user] Interrupt page constructor and redirect to another page

2007-06-26 Thread Tauren Mills
Igor,

Thanks, that works perfectly.

Tauren


On 6/25/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
 On 6/25/07, Tauren Mills [EMAIL PROTECTED] wrote:

  Hi everyone,
 
  I have a page constructor that adds several components.  However,
  those components are reliant on the existence of an object in the
  session.  I'd like to test if that object is null, and if it is,
  redirect the user to a different page where they can make a selection
  that adds a valid object to the session.
 
  When I wrap a test around my constructor code, the page doesn't render
  if the object in the session is null because it isn't finding the
  components on the page:
 
  WicketMessage: Unable to find component with id 'stateName' ...
 
  Here is a simplified version of the code:
 
  public RequiresStatePage() {
super();
if (((MySession)getSession()).getState() == null) {
  setResponsePage(SetStatePage.class);
} else {
  add(new
 Label(stateName,((MySession)getSession()).getState().getName()));
  ...
}
  }
 
  What is the proper way to do this?
 
  Thanks,
  Tauren

 instead of setResponsePage(SetStatePage.class) do throw new
 RestartResponseException(SetStatePage.class)

 -igor

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


[Wicket-user] Refresh page after form submit within ModalWindow

2007-06-26 Thread Tauren Mills
I have the following hierarchy:

MyPage
  MyDataView
  ModalWindow (containing a MyModalPage)
MyModalPage
  MyModalForm
AjaxSubmitLink

The modal window is used to add new items to MyDataView.

If there are errors when the form is submitted, the modal window
should stay open with feedback inside it.  I have that working.

If the submit is successful, I want MyDataView on MyPage to refresh.
I see two ways to do that:

1.  Somehow refresh the entire page with setResponsePage or some other means.
2.  Use AJAX to refresh just MyDataView

When I tried #1, the modal window didn't close and the contents of it
became the outer page (myPage).  So the modal windows contained the
content of the outer page.

add(new AjaxSubmitLink(submit,this)
{
protected void onSubmit(AjaxRequestTarget target, Form form) {
target.addComponent(feedback);
window.close(target);
myPage.setResponsePage(myPage);
}
});

When I tried #2, the form submitted properly, but myDataView didn't refresh.

add(new AjaxSubmitLink(submit,this)
{
protected void onSubmit(AjaxRequestTarget target, Form form) {
target.addComponent(feedback);
target.addComponent(myPage.getMyDataView());
window.close(target);
}
});

I don't know if myPage.getMyDataView() will work in this way since
myPage is private field of MyModalPage that accesses a getter for a
private field of MyPage called myDataView. I did
setOutputMarkupId(true) on it.

What is the best way to accomplish this? Below is the pertinent code.

Thanks,
Tauren



public class MyPage extends UserBasePage {
private DataView myDataView;

public MyPage() {
super();
MyDataProvider dp = new MyDataProvider();
myDataView = new DataView(dataview, dp)
{
 
};
myDataView.setOutputMarkupId(true);
myDataView.setItemsPerPage(40);
add(myDataView);

final ModalWindow newService;
add(newService = new ModalWindow(newService));
newService.setPageMapName(newService);
newService.setCookieName(newService);
newService.setPageCreator(new ModalWindow.PageCreator()
{
public Page createPage()
{
return new MyModalPage(MyPage.this, newService);
}
});
   }
   public DataView getMyDataView() ...
   public void setMyDataView(DataView myDataView) ...
}

public class MyModalPage extends WebPage {

private FeedbackPanel feedback;
private MyPage myPage;
private ModalWindow window;

public MyModalPage(final MyPage myPage, final ModalWindow window)
{
this.myPage = myPage;
this.window = window;
feedback = new FeedbackPanel(feedback);
feedback.setOutputMarkupId(true);
add(feedback);
Form form = new MyModalForm(form);
add(form);
}

public class MyModalForm extends Form {
public MyModalForm(String id){
  ...
add(new AjaxSubmitLink(submit,this)
{
@Override
protected void onSubmit(AjaxRequestTarget target, Form form) {
target.addComponent(feedback);
target.addComponent(myPage.getMyDataView());
window.close(target);
}

@Override
protected void onError(AjaxRequestTarget target, Form form) {
target.addComponent(feedback);
}
});
   }
}
}

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


Re: [Wicket-user] Refresh page after form submit within ModalWindow

2007-06-26 Thread Tauren Mills
Timo,

Good idea, but that doesn't work either.  The Ajax Debug window in
MyPage shows nothing being sent to do.  Note this is in Wicket 1.2.6.

INFO:
INFO: Initiating Ajax GET request on
/db/app?wicket:interface=:6:newService::IBehaviorListenerwicket:behaviorId=1random=0.9353265386317773
INFO: Invoking pre-call handler(s)...
INFO: Received ajax response (69 characters)
INFO:
?xml version=1.0 encoding=UTF-8?ajax-response/ajax-response
INFO: Response parsed. Now invoking steps...
INFO: Response processed successfully.
INFO: Invoking post-call handler(s)...

If there is nothing in the ajax response to do, then the problem
shouldn't have to do with the dataview/dataprovider, should it?

Any other ideas?

Tauren



On 6/26/07, Timo Rantalaiho [EMAIL PROTECTED] wrote:
 On Tue, 26 Jun 2007, Tauren Mills wrote:
  2.  Use AJAX to refresh just MyDataView

 Have you tried adding a placeholder container around your
 DataView and refreshing that with ajax instead?  I'm not
 sure but I think that Repeaters used to need that if you
 wanted to update them via AJAX.

 Have you checked that the DataProvider of your DataView gets
 called (and returns the new item)?

 - Timo

 --
 Timo Rantalaiho
 Reaktor Innovations OyURL: http://www.ri.fi/ 

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


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


Re: [Wicket-user] Refresh page after form submit within ModalWindow

2007-06-26 Thread Tauren Mills
I solved the problem...  In case anyone else has a similar issue in
the future, the target.addComponent needs to be set in MyPage, not in
MyModalPage.  Something like this needs to be done:

newService.setWindowClosedCallback(new
ModalWindow.WindowClosedCallback()
{
public void onClose(AjaxRequestTarget target)
{
target.addComponent(container);
}
});

Note that I'm targeting a container around MyDataView. This code was
in the ModalWindow example, I just hadn't got it right.  It works now.

Thanks for the help!
Tauren


On 6/26/07, Tauren Mills [EMAIL PROTECTED] wrote:
 Timo,

 Good idea, but that doesn't work either.  The Ajax Debug window in
 MyPage shows nothing being sent to do.  Note this is in Wicket 1.2.6.

 INFO:
 INFO: Initiating Ajax GET request on
 /db/app?wicket:interface=:6:newService::IBehaviorListenerwicket:behaviorId=1random=0.9353265386317773
 INFO: Invoking pre-call handler(s)...
 INFO: Received ajax response (69 characters)
 INFO:
 ?xml version=1.0 encoding=UTF-8?ajax-response/ajax-response
 INFO: Response parsed. Now invoking steps...
 INFO: Response processed successfully.
 INFO: Invoking post-call handler(s)...

 If there is nothing in the ajax response to do, then the problem
 shouldn't have to do with the dataview/dataprovider, should it?

 Any other ideas?

 Tauren



 On 6/26/07, Timo Rantalaiho [EMAIL PROTECTED] wrote:
  On Tue, 26 Jun 2007, Tauren Mills wrote:
   2.  Use AJAX to refresh just MyDataView
 
  Have you tried adding a placeholder container around your
  DataView and refreshing that with ajax instead?  I'm not
  sure but I think that Repeaters used to need that if you
  wanted to update them via AJAX.
 
  Have you checked that the DataProvider of your DataView gets
  called (and returns the new item)?
 
  - Timo
 
  --
  Timo Rantalaiho
  Reaktor Innovations OyURL: http://www.ri.fi/ 
 
  -
  This SF.net email is sponsored by DB2 Express
  Download DB2 Express C - the FREE version of DB2 express and take
  control of your XML. No limits. Just data. Click to get it now.
  http://sourceforge.net/powerbar/db2/
  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user
 


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


[Wicket-user] Interrupt page constructor and redirect to another page

2007-06-25 Thread Tauren Mills
Hi everyone,

I have a page constructor that adds several components.  However,
those components are reliant on the existence of an object in the
session.  I'd like to test if that object is null, and if it is,
redirect the user to a different page where they can make a selection
that adds a valid object to the session.

When I wrap a test around my constructor code, the page doesn't render
if the object in the session is null because it isn't finding the
components on the page:

WicketMessage: Unable to find component with id 'stateName' ...

Here is a simplified version of the code:

public RequiresStatePage() {
  super();
  if (((MySession)getSession()).getState() == null) {
setResponsePage(SetStatePage.class);
  } else {
add(new Label(stateName,((MySession)getSession()).getState().getName()));
...
  }
}

What is the proper way to do this?

Thanks,
Tauren

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


Re: [Wicket-user] Updating link attributes from HeaderContributor

2007-06-24 Thread Tauren Mills
Igor,

Thanks for the solution!  I'll go that route for now.

However, I'm not convinced that supporting alternate stylesheets is
outside the scope of wicket core.  Mozilla browsers support switching
to alternate stylesheets from a menu option:
http://www.w3.org/Style/Examples/007/alternatives.html

That alone is probably not a good enough incentive to include it in
core.  But my use case is to improve accessibility.  The site I'm
making is for senior citizens, so I'm providing them with a way to
easily scale the size of the font displayed on the site by clicking
font size icons on the page.  This technique is explained here:
http://alistapart.com/stories/alternate/

This solution uses javascript to activate and deactivate the alternate
stylesheets.  I prefer to utilize javascript for quick stylesheet
changes rather than a round-trip to the server.  I realize I could
accomplish the same thing with server round-trips and not need any
custom HeaderContributor.

Lastly, it is possible to group stylesheets together and activate or
deactivate them all at once if they have the same title.  Adding that
attribute would make it more robust.

Regardless, as you have shown, it isn't hard to implement my own
IHeaderContributor.  I just wasn't sure how to go about it, and now I
am.  So perhaps you are right in that it is best left out of core.

Thanks again!
Tauren



On 6/24/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
 On 6/23/07, Tauren Mills [EMAIL PROTECTED] wrote:
  I am creating an application that utilizes alternate stylesheets.  A
  javascript library also needs each stylesheet to have a title.  The
  output format should be something like this:
 
  link rel=alternate stylesheet type=text/css href= large.css
  title=large /
 
  Using HeaderContributor, I can get this output:
 
  link
 href=/db/app/resources/mypackage.MyPanel/large.css
  type=text/css rel=stylesheet
 
  Note that I need to add alternate to the rel attribute and add a
  title attribute to the HeaderContributor output.
 
  I was hoping to alter this link tag using an AttributeModifier, but
  there doesn't seem to be a way to do this since HeaderContributor is
  not a Component.
 
  Here is code:
 
  private static final CompressedResourceReference CSS_LARGE =
  new CompressedResourceReference( MyPanel.class, large.css);
 
  public MyPanel(String id) {
  super(id);
  HeaderContributor large = HeaderContributor.forCss(SS_CSS_LARGE);
  }
 
  I thought I could create my own version of
  HeaderContributor.CSSReferenceHeaderContributor, but I
 can't override
  forCss(ResourceReference) because it is final.
 
  Is there some other way to alter a tag?  Otherwise, how would I accomplish
 this?
 
  Thanks,
  Tauren
 
 

 tbh, these reqs sound a little too exotic to be supported by the core
 framework. that said, it is trivial to create your own css contributor.

 class mycontributor extends abstractbehavior implements iheadercontributor {
   private ResourceReference ref;
   private String title;
   public mycontributor(ref,title) {...}

   renderHead(final IHeaderResponse response) {
 response.renderString(style all your attributes
 href=\+requestcycle.get().urlfor(ref)+\/);
   }
 }

 done


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



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


Re: [Wicket-user] Updating link attributes from HeaderContributor

2007-06-24 Thread Tauren Mills
OK, that makes more sense then.  I wasn't considering the memory issue.

And I already have things just about ready to go as a self contained
component.  My plan was to contribute it to wicket-stuff.  I'll get
the custom HeaderContributor finished, and then will do so.

Thanks again for the help!

Tauren

On 6/24/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
 On 6/24/07, Tauren Mills [EMAIL PROTECTED] wrote:
  Igor,
 
  Thanks for the solution!  I'll go that route for now.
 
  However, I'm not convinced that supporting alternate stylesheets is
  outside the scope of wicket core.  Mozilla browsers support switching
  to alternate stylesheets from a menu option:
  http://www.w3.org/Style/Examples/007/alternatives.html
 
  That alone is probably not a good enough incentive to include it in
  core.  But my use case is to improve accessibility.  The site I'm
  making is for senior citizens, so I'm providing them with a way to
  easily scale the size of the font displayed on the site by clicking
  font size icons on the page.  This technique is explained here:
  http://alistapart.com/stories/alternate/
 
  This solution uses javascript to activate and deactivate the alternate
  stylesheets.  I prefer to utilize javascript for quick stylesheet
  changes rather than a round-trip to the server.  I realize I could
  accomplish the same thing with server round-trips and not need any
  custom HeaderContributor.
 
  Lastly, it is possible to group stylesheets together and activate or
  deactivate them all at once if they have the same title.  Adding that
  attribute would make it more robust.
 
  Regardless, as you have shown, it isn't hard to implement my own
  IHeaderContributor.  I just wasn't sure how to go about it, and now I
  am.  So perhaps you are right in that it is best left out of core.
 
  Thanks again!
  Tauren
 

 in fact, take it a bit further:

 StylesheetSwitcher switcher=new StylesheetSwitcher();
 switcher.addStylesheet(small, new ResourceReference...
 switcher.addStylesheet(medium, new ResourceReference...
 switcher.addStylesheet (large, new ResourceReference...
 add(switcher);

 add(new SwitchStylesheetLink(link, switcher, small));
 add(new IncreateStylesheetLink(plus, switcher);

 you can encapsulate all this stuff including javascript, etc, in an
 encapsulated header contributor and make it totally transparent and reusable
 across projects. then after you get it working feel free to contribute it to
 wicketstuff-minis :)

 -igor


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



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


[Wicket-user] Updating link attributes from HeaderContributor

2007-06-23 Thread Tauren Mills
I am creating an application that utilizes alternate stylesheets.  A
javascript library also needs each stylesheet to have a title.  The
output format should be something like this:

link rel=alternate stylesheet type=text/css href=large.css
title=large /

Using HeaderContributor, I can get this output:

link href=/db/app/resources/mypackage.MyPanel/large.css
type=text/css rel=stylesheet

Note that I need to add alternate to the rel attribute and add a
title attribute to the HeaderContributor output.

I was hoping to alter this link tag using an AttributeModifier, but
there doesn't seem to be a way to do this since HeaderContributor is
not a Component.

Here is code:

private static final CompressedResourceReference CSS_LARGE =
new CompressedResourceReference(MyPanel.class, large.css);

public MyPanel(String id) {
super(id);
HeaderContributor large = HeaderContributor.forCss(SS_CSS_LARGE);
}

I thought I could create my own version of
HeaderContributor.CSSReferenceHeaderContributor, but I can't override
forCss(ResourceReference) because it is final.

Is there some other way to alter a tag?  Otherwise, how would I accomplish this?

Thanks,
Tauren

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


Re: [Wicket-user] State selection from imagemap

2007-06-22 Thread Tauren Mills
Eelco,

Thanks for the reply!

 You could use the image map component (see the example in
 org.apache.wicket.examples.linkomatic), but that would indeed result
 in a lot of components for not that much gains.

The problem with the ImageMap component is that it doesn't support alt
and title parameters, and I need those.  This site is for seniors and
needs to be accessible.

 I'm pretty sure that at least in Wicket 1.3 you don't need to put the
 servlet context in your hrefs yourself, as Wicket will automatically
 prepend that for you. Which version are you using, and did you try it
 without?

I'm currently using 1.2.6.  The imagemap is on the home page, and I
was finding that the links worked correctly from my home page's
mountBookmarkablePage path, but if a link component took the user back
to the home page, then the path wouldn't work.

Because of the problems I was having, I ended up wicketizing the whole
thing. I'm not convinced that this is the best solution, and it does
mean a whole lot of components are generated for the home page.  I'd
appreciate any feedback on this solution.  I can post full code
somewhere too if desired.

The solution output is similar to this:

form id=usamap_form name=State
action=/db/app?wicket:interface=:1:usamap:form::IFormSubmitListener
method=post wicket:id=formdiv style=display:noneinput
type=hidden name=usamap_form:hf:0 id=usamap_form:hf:0 //div

select id=state name=state wicket:id=state
option selected=selected value=Choose One/option
option value=0ALASKA/option
...
/select

map id=map name=map
  area title=ALASKA
coords=20,200,11,219,11,249,17,287,90,256,77,198,42,188 alt=ALASKA
shape=poly href=/db/app/lookup/state/AK wicket:id=repeating/
   ...
/map

To fully wicketize this image map, I have a custom TreeMap called
StateMap that maps state abbreviations to State objects.  The State
objects have name, abbreviation, and a List of Area objects (some
States need more than one polygon Area).  The Area objects have shape
and coordinates attributes.  StateMap has a getAreas() method that
returns a List of all the Area objects in all of the State objects.

To create the DropDownChoice, I just get a list from the TreeMap's
values and create a DropDownChoice with it:

StateMap.getStates() {
  return (List) new ArrayListState(abbrevMap.values());
}

StateSelectForm(String id, StateMap stateMap) {
  add(new DropDownChoice(state,new
PropertyModel(this,state),stateMap.getStates()));
}

To create the imagemap, I use a RepeatingView and iterate through the
list of Area objects returned by StateMap.getAreas().  I create a
WebMarkupContainer for each area tag and add AttributeModifiers to
it for alt, title, shape, coords, and href.  All of these
just access properties of either the State or Area objects, except for
href, where I do this:

// Get the State object for the abbreviation
final State state = stateMap.getAbbreviation(abbrev);
  ...
item.add(new AttributeModifier(href, true, new AbstractReadOnlyModel()
{
  public Object getObject(Component component)
  {
// return a URL to StateLookupPage with parameters of state=abbrev
return urlFor(StateLookupPage.class, new
PageParameters(state=+state.getAbbreviation()));
   }
}));

Lastly, the StateLookupPage has two constructors, one to handle the
form and another to handle the imagemap.  When the form is submitted,
the selected State object is put into the session.  When the imagemap
is clicked, the selected state is passed as a parameter.

I know this is long winded, and I apologize.  But it would be nice to
know the best way to deal with a large imagemap like this.  I would be
happy to post this information on the wiki, but I don't want to do it
if there are better solutions.  So any advice would be appreciated.

Thanks,
Tauren


 Eelco


 On 6/19/07, Tauren Mills [EMAIL PROTECTED] wrote:
  I'm wondering if I should wicketize this form, or leave it as a
  basic html form and would like to hear your thoughts.
 
  I have a map of the USA with an imagemap.  Clicking onto a state goes
  to another page that displays a list of metro areas in the state.
 
  img src=img/map.png usemap=#map border=0 alt=US Map/
  map id=map name=map
area shape=poly alt=Maine
  coords=409,19,403,43,411,64,433,39,416,17 href=app/lookup/state/ME
  title=Maine/
area shape=poly alt=New Hampshire coords=401,43,399,69,411,65
  href=app/lookup/state/NH title=New Hampshire/
area shape=poly alt=Vermont
  coords=400,47,388,48,393,70,398,69 href=app/lookup/state/VT
  title=Vermont/
  ...
  /map
 
  I did this by using a bookmarkable page with pageparameters:
 
  mountBookmarkablePage(/lookup, StateLookupPage.class);
 
  ---
 
  public StateLookupPage(PageParameters params) {
  super(params);
  String state = (String) params.get(state);
  add(new Label(state,state));
  }
 
  The main issue I have with this is I have hardcoded my servlet context
  (app) into the HTML, so changing my

[Wicket-user] State selection from imagemap

2007-06-19 Thread Tauren Mills
I'm wondering if I should wicketize this form, or leave it as a
basic html form and would like to hear your thoughts.

I have a map of the USA with an imagemap.  Clicking onto a state goes
to another page that displays a list of metro areas in the state.

img src=img/map.png usemap=#map border=0 alt=US Map/
map id=map name=map
  area shape=poly alt=Maine
coords=409,19,403,43,411,64,433,39,416,17 href=app/lookup/state/ME
title=Maine/
  area shape=poly alt=New Hampshire coords=401,43,399,69,411,65
href=app/lookup/state/NH title=New Hampshire/
  area shape=poly alt=Vermont
coords=400,47,388,48,393,70,398,69 href=app/lookup/state/VT
title=Vermont/
...
/map

I did this by using a bookmarkable page with pageparameters:

mountBookmarkablePage(/lookup, StateLookupPage.class);

---

public StateLookupPage(PageParameters params) {
super(params);
String state = (String) params.get(state);
add(new Label(state,state));
}

The main issue I have with this is I have hardcoded my servlet context
(app) into the HTML, so changing my web.xml will require lots of
html edits.

And I also want to have a drop down select of all states and have it
get to the same place as clicking on the map.  The following form
using either post or get doesn't work:

form action=lookup method=post name=StateForm
select name=state id=state
  option selected=selected value=Choose State.../option
  option value=ALAlabama/option
  option value=AKAlaska/option
  option value=AZArizona/option
...
/select
/form

So my first thought is to make the form a wicket form with a wicket
DropDownChoice component, but then I'm unclear of the best way to make
the imagemap go to the same place.  There are about 70 polygons in the
imagemap, and making them all wicket components seems overkill.  Or is
that really the best way to deal with this?

Thanks,
Tauren

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


[Wicket-user] Customer management of site after development is completed

2007-06-18 Thread Tauren Mills
Earlier I asked how to relocate html, css, and other resources away
from the Java code and Al Maw gave me some good help in IRC.  In our
conversation, he helped me to realize that the approach I was planning
would not work the way I had desired.  I'd like to find out how others
on the list have handled this situation for their clients.

I am building a simple wicket database app for a client.  The client
would like to be able to update the static content on the site.  In
addition, she would like to change the site design in the distant
future if she wants a new look down the road.

She is not a programmer or designer in the least.  She built her
original site with FrontPage (ick!) and would like to be able to
continue editing her site.  I've made it clear that she will no
longer be able to use FrontPage, but that I will provider her with a
way to make edits to her site.

One of the main reasons I like wicket is because of the pure
separation of layout and logic. But how does one go about giving
access to the layout to an unskilled person?  She could easily mess up
the component hierarchy in the html.  And she certainly doesn't know
how to deploy a war file.

I've thought about creating a simple CMS system for the static
content in the html pages. But that really isn't in the scope of the
project.  Maybe it should be. I could extract all static content
into properties files and use Labels all over, then have the app
search for properties files somewhere external from the war on the web
server.  But neither of these will help if she wants to redesign the
layout of the site and needs to edit the html/css.

Basically, I need to be able to finish this project and walk away from
it.  I don't want to forever more be her webmaster whenever she
wants little changes made to the site.

How would you handle this?  I'd love some ideas.

Thanks,
Tauren

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


Re: [Wicket-user] Customer management of site after development is completed

2007-06-18 Thread Tauren Mills
Eelco and Rüdiger,

Thanks for your responses.  I must admit I was hoping to hear that
others had solved similar problems with a more robust solution.  I was
starting to wonder if what I wanted to do was possible, and it sounds
like it would be very difficult if even possible.

I've already designed the site with very clean and simple html with
all layout/look/feel done in CSS.  So going that direction will not be
difficult, except that getting the client up to speed on CSS seems
like a daunting task.

If I was to allow the client to customize and upload new CSS files,
how would you suggest this be done?  Where would the CSS files be
saved and how would the app know where to look for them?  How would
the override the CSS files that are within the WAR file?

Also, as far as static content management goes, I'm thinking of
putting all the static stuff into the properties files and using
labels for it.  Thus creating a very simple and cheap CMS.  Then it
would be simply a matter of editing the properties files and uploading
them.  But again, how would that work?  What would I do so that the
app would read the uploaded files instead of the ones in the WAR?

Thanks again for the ideas.  I'd still love to hear if anyone else has
solved this problem in a different way.

Tauren


On 6/18/07, Eelco Hillenius [EMAIL PROTECTED] wrote:
  I've thought about creating a simple CMS system for the static
  content in the html pages. But that really isn't in the scope of the
  project.  Maybe it should be. I could extract all static content
  into properties files and use Labels all over, then have the app
  search for properties files somewhere external from the war on the web
  server.  But neither of these will help if she wants to redesign the
  layout of the site and needs to edit the html/css.

 If I were in your shoes I would rely as much as possible on CSS for my
 layout, and if I had enough time for it, I would try to provide a
 couple of templates/ configurations (like a three column layout, a
 layout with a head- and bottom banner, etc) so that parts of the
 site's look can be changed without too much tinkering. Of course, she
 would have to learn CSS, and it might be hard to convince her to do
 that :) Otoh, if you do a good job with doing the layout with CSS,
 she'll only be able to mess up the layout, never the business logic,
 which is a completely different story compared to when you would have
 delivered e.g. JSP or PHP templates.

 It is *not* a recommendation, but If your client has 'some' coding
 skills, you could even consider using velocity panels. You can find
 some examples of that in wicket-examples.

 The bottom line is, and I think many of us have been there before,
 that promising your client a web site that he/ she can maintain
 themselves is a slippery slope. In my experience, just being able to
 do basic adjustements soon won't suffice, and before you know it,
 you'll be developing a full fledged CMS system. Which of course will
 get both and your client into trouble. But I think that if you keep
 the focus and very clear limit the kind of adjustements that can be
 done - like a choosing from couple of master templates and adjusting
 CSS - you can make something very useful.

 My 2c,

 Eelco


  Basically, I need to be able to finish this project and walk away from
  it.  I don't want to forever more be her webmaster whenever she
  wants little changes made to the site.
 
  How would you handle this?  I'd love some ideas.
 
  Thanks,
  Tauren
 
  -
  This SF.net email is sponsored by DB2 Express
  Download DB2 Express C - the FREE version of DB2 express and take
  control of your XML. No limits. Just data. Click to get it now.
  http://sourceforge.net/powerbar/db2/
  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user
 

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


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


[Wicket-user] Location of css, images, js files

2007-06-15 Thread Tauren Mills
Hello,

For a wicket 1.2 app, I've located my html files in a different
location than the class files, as decribed here:
http://cwiki.apache.org/WICKET/control-where-html-files-are-loaded-from.html

This works fine.  But I'm finding that css, images, and js files are
not being located unless I put them into the web root folder (where
the HTML files are).  I want js files in webroot/js, css in
webroot/css, and images in webroot/images.

I've been able to relocate some CSS files by adding more paths to the
resourceFinder:

CompoundResourceStreamLocator locator =
(CompoundResourceStreamLocator)getResourceSettings().getResourceStreamLocator();
WebApplicationPath resourceFinder = (WebApplicationPath)
getResourceSettings().getResourceFinder();
resourceFinder.add(web);
resourceFinder.add(web/css);
locator.add(0, new MyPageResourceStreamLocator(resourceFinder));

This allows me to have HomePage.html in web and HomePage.css in
web/css.  But if I reference images from the css files, I can't use a
path of ../images/logo.png.  Instead, I've had to put the css images
into the css folder.

I've noticed that what I did above also allows me to move my
properties files into the webroot as well.

What is the best solution to this? Am I going in the right direction?
It seems like if I was to add all these paths (web, web/css,
web/images, web/js, web/properties) to the resourceFinder, it  would
slow down the application with constant searching.

My goal is to allow a client with minimal web design skills to manage
the html, css, image, and properties files with minimal risk of
damaging the application.  I'd like the java class files to be located
in a separate location.  And I'd like the folder structure of the
webroot to be clean and make sense to the designer.

Please let me know if what I'm doing is the right thing.  If not, what
should I do?  When I have a good and solid solution to this, I'll add
the information to the wiki.

Thanks,
Tauren

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


Re: [Wicket-user] Remote Address

2007-05-07 Thread Tauren Mills
I do this:

log.info(  RemoteAddr:  +
((WebRequest)getRequest()).getHttpServletRequest().getRemoteAddr());

Works for me in 1.2.5.  Will be upgrading to 1.2.6 soon, so I hope it
still works.

Tauren


On 5/7/07, mathias axelsson [EMAIL PROTECTED] wrote:
 ((WebRequest) (WebRequestCycle.get().getRequest()))
 .getHttpServletRequest().getRemoteHost();

 should work I think.


 On 5/7/07, howzat [EMAIL PROTECTED] wrote:
 
  Thanks for the suggestion but I'm not sure I understand you properly. Have
  you tried that?
 
 ((WebRequestCycle)RequestCycle.get()).getHttpServletRequest()
  doesn't exist (1.2.6) .
 
  and
 
 ((WebRequestCycle)RequestCycle.get()).getRequest().getParameterMap().keySet()
  returns only:
  [previewForm:hf:0, userAnswer, wicket:interface]
 
  All I need is to get the ip address of the client. Has any one else had a
 go
  at this in Wicket 1.2.6 ?
 
 
 
 
 
  Johan Compagner wrote:
  
   see Timo's post about the ServletWebRequest.
  
  
 ((WebRequestCycle)RequestCycle.get()).getHttpServletRequest()
  
   johan
  
  
   On 5/7/07, howzat  [EMAIL PROTECTED] wrote:
  
  
   As stated in my initial post I am using 1.2.6 (as there is more
 published
   material to learn from for 1.x) and plan to eventually move straight up
   to
   2.0 (mainly for java 5 enhancements).
   Is there a concrete code snippet somewhere that demonstrates how to get
   the
   user's ip address in 1.2.6 ?
  
  
  
   Johan Compagner wrote:
   
which version do you use?
i think that is rewritten in 1.3 and i do see remote address there
   
johan
   
   
On 5/7/07, howzat [EMAIL PROTECTED]  wrote:
   
   
Thanks Tino  John.
I was hoping to get it using ClientInfo/ClientProperties class for
   this
from
Session.getClientInfo() as my first guess too. But I can only see
 the
following (ie no ip address) properties:
   
ClientProperties:
 {quirkIETablePercentWidthScrollbarError=true,
proprietaryIEPngAlphaFilterRequired=true,
quirkCssPositioningOneSideOnly=true,
quirkIETextareaNewlineObliteration=true,
quirkCssBorderCollapseFor0Padding=true,
quirkCssBackgroundAttachmentUseFixed=true,
 quirkIERepaint=true,
quirkCssBorderCollapseInside=true,
 browserInternetExplorer=true,
browserVersionMajor=6,
 quirkIESelectListDomUpdate=true,
proprietaryIECssExpressionsSupported=true,
 quirkIESelectZIndex=true,
quirkIESelectPercentWidth=true}
   
   
   
   
Johan Compagner wrote:

 yes you can get it right from the httprequest
 But you can also use our ClientInfo/ClientProperties class for
 this
 see Session.getClientInfo()


 On 5/7/07, Timo Rantalaiho  [EMAIL PROTECTED] wrote:

 On Sun, 06 May 2007, howzat wrote:
  What is the right way in Wicket to get the ip address of the
   client?

 We've done it by digging the HttpServletRequest from Wicket's
 own request class



   
  
 http://wicketframework.org/apidocs/wicket/protocol/http/servlet/ServletWebRequest.html

 but have no idea if this is the ideal way.

 --
 Timo Rantalaiho
 Reaktor Innovations OyURL: http://www.ri.fi/ 


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

 https://lists.sourceforge.net/lists/listinfo/wicket-user



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

 https://lists.sourceforge.net/lists/listinfo/wicket-user


   
--
View this message in context:
   
 http://www.nabble.com/Remote-Address-tf3701431.html#a10355023
Sent from the Wicket - User mailing list archive at Nabble.com.
   
   
   
  
 -
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
   
 https://lists.sourceforge.net/lists/listinfo/wicket-user
   
   
   
  
 

Re: [Wicket-user] Remote Address

2007-05-07 Thread Tauren Mills
Personally, I rarely use the IP address of the guest in my app, but I
like to log it in case I need to track something down later.  I've
seen certain use cases where you want to let the user know where they
are coming from and that the app is logging their actions.  For these
reasons, it might be nice to have it more easily accessible.

Tauren

On 5/7/07, Eelco Hillenius [EMAIL PROTECTED] wrote:
  Thanks Mathias, that's exactly what I was after and it works.
  Looking at the bigger picture, is it considered to be reasonable practice in
  Wicket to cut through all its high-level abstractions, right down to the
  wire (or servlet api anyway)? I suppose an ip address is quite a low-level
  bit of info (depending on your domain).

 Yep, sometime we don't expose things on purpose to prevent people from
 misusing it. However, I'm not sure whether this is such a case, as I
 could imagine such a method in WebRequest just fine. If you would like
 that, you could always try to open up a feature request for it.

 Eelco

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


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


[Wicket-user] Strange behavior when calling a function in appendJavascript

2007-05-05 Thread Tauren Mills
I'm having a strange problem executing javascript functions from ajax.
 Some scripts work and some don't.   I've got this java code:

target.appendJavascript(toggleSelection(document.getElementById('+getComponent().getMarkupId()+')));

And in the html I've got this:

wicket:head
script type=text/javascript src=js/reports.js/script
/wicket:head

The function toggleSelection is in reports.js.

If I make toggleSelection just a simple script, it runs fine.  But if
I add more code to it, I sometimes get the following error response.
I've verified that reports.js is included in the html source.

INFO:
INFO: Initiating Ajax POST request on
/sa/app?wicket:interface=:3:tabs:panel:reportForm:availReport:availRow:3:row:scheduled:-1:IUnversionedBehaviorListenerwicket:behaviorId=0wicket:ignoreIfNotActive=truerandom=0.5721591389578449
INFO: Invoking pre-call handler(s)...
INFO: Received ajax response (204 characters)
INFO:
?xml version=1.0
encoding=UTF-8?ajax-responseevaluate![CDATA[toggleSelection(document.getElementById('tabs_panel_reportForm_availReport_availRow_3_row_scheduled'))]]/evaluate/ajax-response
INFO: Response parsed. Now invoking steps...
ERROR: Exception evaluating javascript: ReferenceError:
toggleSelection is not defined
INFO: Response processed successfully.
INFO: Invoking post-call handler(s)...

I've gone through the JS code very carefully to see if there are any
mistakes.  I can't find any. Here is the code that causes the error:

function toggleSelection(element) {
var cn = element.parentNode.parentNode.className;
alert(cn);
switch(cn) {
case odd:
alert(in odd);
element.parentNode.parentNode.className = oddSelected;
alert(out odd);
break;
case oddSelected):
alert(in oddSelected);
element.parentNode.parentNode.className = odd;
alert(out oddSelected);
break;
case even:
alert(in even);
element.parentNode.parentNode.className = 
evenSelected;
alert(out even);
break;
case evenSelected:
alert(in evenSelected);
element.parentNode.parentNode.className = even;
alert(out evenSelected);
break;
default:
break;
}
alert(done);
}

I have it working now by using a different toggleSelection script.
Now the output is this:

INFO:
INFO: Initiating Ajax POST request on
/sa/app?wicket:interface=:7:tabs:panel:reportForm:availReport:availRow:4:row:scheduled:-1:IUnversionedBehaviorListenerwicket:behaviorId=0wicket:ignoreIfNotActive=truerandom=0.8455243647238795
INFO: Invoking pre-call handler(s)...
INFO: Received ajax response (204 characters)
INFO:
?xml version=1.0
encoding=UTF-8?ajax-responseevaluate![CDATA[toggleSelection(document.getElementById('tabs_panel_reportForm_availReport_availRow_4_row_scheduled'))]]/evaluate/ajax-response
INFO: Response parsed. Now invoking steps...
INFO: Response processed successfully.
INFO: Invoking post-call handler(s)...

And the code is this:

function toggleSelection(element) {
var cn = element.parentNode.parentNode.className;
if (cn == odd) {
element.parentNode.parentNode.className = oddScheduled;
}
else if (cn == oddScheduled) {
element.parentNode.parentNode.className = odd;
}
else if (cn == even) {
element.parentNode.parentNode.className = 
evenScheduled;
}
else if (cn == evenScheduled) {
element.parentNode.parentNode.className = even;
}
}

What causes that type of Error message in the ajax window?  Is it
javascript that doesn't execute properly?  Why would it say the method
is undefined?  Is there something wrong with that first script?  I
realize this isn't a javascript list, but I really don't see anything
wrong with it.

Thanks,
Tauren

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


[Wicket-user] Checkbox onchange event differences between IE and FF

2007-05-05 Thread Tauren Mills
I have numerous ajax calls throughout my app, and they work fine in
both FF and IE.  However, there is one that behaves differently in IE
and FF.  It seems that the onchange behavior of a checkbox happens
at different times between the browsers.  With FF, the event is sent
as soon as the checkbox is checked.  In IE, it isn't sent until the
user clicks off the checkbox somewhere else on the page.

How do I get IE to behave the same as FF?  I want the call to be made
as soon as the user clicks onto the checkbox.  Is there a solution?

It probably doesn't matter, but just in case, here is the code:

CheckBox cb = new CheckBox(scheduled,new
PropertyModel(rr.getAvailability(),scheduled));
cb.add(new AjaxFormComponentUpdatingBehavior(onchange) {
@Override
protected void onUpdate(AjaxRequestTarget target) {
// Model is changed automatically
target.appendJavascript(toggleSelection(document.getElementById('+
getComponent().getMarkupId()+')));
}
});
add(cb);

The backing model rr.getAvailability is a Hibernate entity.  When the
checkbox is checked or unchecked, the boolean property scheduled is
changed in the entity and automatically persisted to the DB.

Thanks!
Tauren

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


Re: [Wicket-user] Strange behavior when calling a function in appendJavascript

2007-05-05 Thread Tauren Mills
Hi Jim,

Thanks for the suggestion.  I haven't tried that, so I'll give it a try.

Tauren


On 5/5/07, James McLaughlin [EMAIL PROTECTED] wrote:
 hmm.

 Have you run it with firebug or venkman? When I've run into this before it
 was usually because the script had a parse error causing the interpreter  to
 barf and not load the rest of the script.

 best,
 jim


 On 5/5/07, Tauren Mills [EMAIL PROTECTED] wrote:
 
  I'm having a strange problem executing javascript functions from ajax.
  Some scripts work and some don't.   I've got this java code:
 
 target.appendJavascript(toggleSelection(
 document.getElementById('+getComponent().getMarkupId()+')));
 
  And in the html I've got this:
 
  wicket:head
  script type=text/javascript src=js/reports.js/script
  /wicket:head
 
  The function toggleSelection is in reports.js.
 
  If I make toggleSelection just a simple script, it runs fine.  But if
  I add more code to it, I sometimes get the following error response.
  I've verified that reports.js is included in the html source.
 
  INFO:
  INFO: Initiating Ajax POST request on
 
 /sa/app?wicket:interface=:3:tabs:panel:reportForm:availReport:availRow:3:row:scheduled:-1:IUnversionedBehaviorListenerwicket:behaviorId=0wicket:ignoreIfNotActive=truerandom=
 0.5721591389578449
  INFO: Invoking pre-call handler(s)...
  INFO: Received ajax response (204 characters)
  INFO:
  ?xml version=1.0
 
 encoding=UTF-8?ajax-responseevaluate![CDATA[toggleSelection(
 document.getElementById('tabs_panel_reportForm_availReport_availRow_3_row_scheduled'))]]/evaluate/ajax-response
  INFO: Response parsed. Now invoking steps...
  ERROR: Exception evaluating javascript: ReferenceError:
  toggleSelection is not defined
  INFO: Response processed successfully.
  INFO: Invoking post-call handler(s)...
 
  I've gone through the JS code very carefully to see if there are any
  mistakes.  I can't find any. Here is the code that causes the error:
 
  function toggleSelection(element) {
  var cn = element.parentNode.parentNode.className;
  alert(cn);
  switch(cn) {
  case odd:
  alert(in odd);
 
 element.parentNode.parentNode.className = oddSelected;
  alert(out odd);
  break;
  case oddSelected):
  alert(in oddSelected);
 
 element.parentNode.parentNode.className = odd;
  alert(out oddSelected);
  break;
  case even:
  alert(in even);
 
 element.parentNode.parentNode.className = evenSelected;
  alert(out even);
  break;
  case evenSelected:
  alert(in evenSelected);
 
 element.parentNode.parentNode.className = even;
  alert(out evenSelected);
  break;
  default:
  break;
  }
  alert(done);
  }
 
  I have it working now by using a different toggleSelection script.
  Now the output is this:
 
  INFO:
  INFO: Initiating Ajax POST request on
 
 /sa/app?wicket:interface=:7:tabs:panel:reportForm:availReport:availRow:4:row:scheduled:-1:IUnversionedBehaviorListenerwicket:behaviorId=0wicket:ignoreIfNotActive=truerandom=
 0.8455243647238795
  INFO: Invoking pre-call handler(s)...
  INFO: Received ajax response (204 characters)
  INFO:
  ?xml version=1.0
 
 encoding=UTF-8?ajax-responseevaluate![CDATA[toggleSelection(
 document.getElementById('tabs_panel_reportForm_availReport_availRow_4_row_scheduled'))]]/evaluate/ajax-response
  INFO: Response parsed. Now invoking steps...
  INFO: Response processed successfully.
  INFO: Invoking post-call handler(s)...
 
  And the code is this:
 
  function toggleSelection(element) {
  var cn = element.parentNode.parentNode.className;
  if (cn == odd) {
   element.parentNode.parentNode.className
 = oddScheduled;
  }
  else if (cn == oddScheduled) {
  element.parentNode.parentNode.className =
 odd;
  }
  else if (cn == even) {
 
 element.parentNode.parentNode.className = evenScheduled;
  }
  else if (cn == evenScheduled) {
   element.parentNode.parentNode.className
 = even;
  }
  }
 
  What causes that type of Error message in the ajax window?  Is it
  javascript that doesn't execute properly?  Why would it say the method
  is undefined?  Is there something wrong with that first script?  I
  realize this isn't a javascript list, but I really don't see anything
  wrong with it.
 
  Thanks,
  Tauren
 
 
 -
  This SF.net email is sponsored by DB2 Express
  Download DB2 Express C - the FREE version of DB2 express and take
  control of your XML. No limits. Just data. Click to get it now.
  http

Re: [Wicket-user] Checkbox onchange event differences between IE and FF

2007-05-05 Thread Tauren Mills
Duh!
Thanks!

On 5/5/07, Matej Knopp [EMAIL PROTECTED] wrote:
 use onclick instead of onchange.

 -Matej

 On 5/5/07, Tauren Mills [EMAIL PROTECTED] wrote:
  I have numerous ajax calls throughout my app, and they work fine in
  both FF and IE.  However, there is one that behaves differently in IE
  and FF.  It seems that the onchange behavior of a checkbox happens
  at different times between the browsers.  With FF, the event is sent
  as soon as the checkbox is checked.  In IE, it isn't sent until the
  user clicks off the checkbox somewhere else on the page.
 
  How do I get IE to behave the same as FF?  I want the call to be made
  as soon as the user clicks onto the checkbox.  Is there a solution?
 
  It probably doesn't matter, but just in case, here is the code:
 
  CheckBox cb = new CheckBox(scheduled,new
  PropertyModel(rr.getAvailability(),scheduled));
  cb.add(new AjaxFormComponentUpdatingBehavior(onchange) {
  @Override
  protected void onUpdate(AjaxRequestTarget target) {
  // Model is changed automatically
  target.appendJavascript(toggleSelection(document.getElementById('+
  getComponent().getMarkupId()+')));
  }
  });
  add(cb);
 
  The backing model rr.getAvailability is a Hibernate entity.  When the
  checkbox is checked or unchecked, the boolean property scheduled is
  changed in the entity and automatically persisted to the DB.
 
  Thanks!
  Tauren
 
  -
  This SF.net email is sponsored by DB2 Express
  Download DB2 Express C - the FREE version of DB2 express and take
  control of your XML. No limits. Just data. Click to get it now.
  http://sourceforge.net/powerbar/db2/
  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user
 

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


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


[Wicket-user] Updating textfield model in ajax onchange

2007-05-04 Thread Tauren Mills
I have a text field called 'dateField' on a form that has an
associated DatePicker control.  When someone selects a date in the
picker, I want to do an ajax call to refresh another component on the
page.  I need the dateField model to be updated in the ajax call.

I originally assumed the model would be updated automatically to the
new value, but it doesn't seem to be.  Now I'm thinking that is
because the form hasn't actually been submitted yet, which makes
sense.

So, how do I get the current value of the dateField inside an
onEvent() handler?  What is the best way to update the dateField's
model with the current value?  I've tried the following, but the model
value remains the same:

dateField.add(new AjaxEventBehavior(onchange) {
  protected void onEvent(AjaxRequestTarget target) {
// Refresh the ListView
 Logger log = Logger.getLogger(getClass());
 log.debug(Date Changed -- refreshing report);
 setSelectedDate((Date)(getComponent().getModelObject()));
 ListReportRow availList = createReportList();
 AvailabilityReportPanel arp = new
AvailabilityReportPanel(availReport, availList);
 ReportForm.this.availReport.replaceWith(arp);
 ReportForm.this.availReport = arp;
 target.addComponent(ReportForm.this.availReport);
   }
});

Note that setSelectedDate() is the setter for the dateField's model.
Also, createReportList() uses getSelectedDate() in an HQL query to
build the List.

What is the proper way to deal with this? Is there a way to indicate
that the form should submit during ajax calls?

Thanks!
Tauren

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


[Wicket-user] Adding extra row to table in ListView

2007-05-03 Thread Tauren Mills
I'm using a custom ListView to generate a table.  The content of the
table consists of four columns of data.  I have that working just
fine.  But I'd like to add an additional table row on occation to
group rows of data in the table.  Thus, there would be a groupRow
that specifies a date, then many availRows of data for that date, then
another groupRow, more availRows, and so forth.

Here is some example HTML.  I know that this HTML and code will not
work the way it is now -- it is just meant to illustrate.  The first
TR should only be displayed when the date changes.  Otherwise, only
the second TR should display in each populateItem.

table
tr wicket:id=groupRow
td colspan=4 wicket:id=date/td
/tr   
tr wicket:id=availRow
td wicket:id=lastName/td
td wicket:id=firstName/td
td wicket:id=startTime/td
td wicket:id=endTime/td
/tr
/table

Here is the custom ListView's populateItem:


protected void populateItem(final ListItem item) {
SimpleDateFormat dateDateFormat = new SimpleDateFormat(M/d/);
SimpleDateFormat timeDateFormat = new SimpleDateFormat(h:mma);
ReportRow rr = (ReportRow) item.getModelObject();
Date update = getStartDate(rr.getStartTime());
if (current == null || current.getTime()  update.getTime()) {
current = update;
item.add(new
Label(date,dateDateFormat.format(rr.getStartTime(;
}
else {
item.add(new Label(lastName,rr.getLastName()));
item.add(new Label(firstName,rr.getFirstName()));
item.add(new
Label(startTime,timeDateFormat.format(rr.getStartTime(;
item.add(new
Label(endTime,timeDateFormat.format(rr.getEndTime(;
}
}

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


Re: [Wicket-user] Adding extra row to table in ListView

2007-05-03 Thread Tauren Mills
Igor,

Yes, that makes sense.  However, I get the data for the list using a
single HQL query with joins and such. If I changed to a ListView
within a ListView, then wouldn't I also need to change to do many HQL
queries to build a bunch of small lists within a big list?  I don't
know what the performance implications would be of making this change.

Also, last night I was working on switching it to a DataView instead
of a ListView.  Could a single DataProvider supply the data for both
the outer and inner views?

Thanks!
Tauren


On 5/3/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
 what you need is a lsitview in a listview

 the first outputs the date row, and then a listview that outputs rows for
 that date.

 makes sense?

 -igor



 On 5/2/07, Tauren Mills [EMAIL PROTECTED] wrote:
 
  I'm using a custom ListView to generate a table.  The content of the
  table consists of four columns of data.  I have that working just
  fine.  But I'd like to add an additional table row on occation to
  group rows of data in the table.  Thus, there would be a groupRow
  that specifies a date, then many availRows of data for that date, then
  another groupRow, more availRows, and so forth.
 
  Here is some example HTML.  I know that this HTML and code will not
  work the way it is now -- it is just meant to illustrate.  The first
  TR should only be displayed when the date changes.  Otherwise, only
  the second TR should display in each populateItem.
 
  table
  tr wicket:id=groupRow
  td colspan=4 wicket:id=date/td
  /tr
  tr wicket:id=availRow
  td wicket:id=lastName/td
  td wicket:id=firstName/td
  td wicket:id=startTime/td
  td wicket:id=endTime/td
  /tr
  /table
 
  Here is the custom ListView's populateItem:
 
 
  protected void populateItem(final ListItem item) {
  SimpleDateFormat dateDateFormat = new
 SimpleDateFormat(M/d/);
  SimpleDateFormat timeDateFormat = new
 SimpleDateFormat(h:mma);
  ReportRow rr = (ReportRow) item.getModelObject();
  Date update = getStartDate(rr.getStartTime());
  if (current == null || current.getTime()  update.getTime()) {
  current = update;
  item.add(new
  Label(date,dateDateFormat.format(rr.getStartTime(;
  }
  else {
  item.add(new Label(lastName,rr.getLastName()));
  item.add(new Label(firstName,rr.getFirstName()));
  item.add(new
  Label(startTime,timeDateFormat.format(rr.getStartTime(;
  item.add (new
  Label(endTime,timeDateFormat.format(rr.getEndTime(;
  }
  }
 
 
 -
  This SF.net email is sponsored by DB2 Express
  Download DB2 Express C - the FREE version of DB2 express and take
  control of your XML. No limits. Just data. Click to get it now.
  http://sourceforge.net/powerbar/db2/
  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user
 


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



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


Re: [Wicket-user] Adding extra row to table in ListView

2007-05-03 Thread Tauren Mills
Igor,

Upon further thought, how can a ListView inside a ListView solve this?
 Wouldn't the hierarchy cause the html to be messed up?  I can't have
TRs within TRs.  The inner listview isn't putting child data inside of
the TR, it needs to make TRs that are siblings of the outer listview.

The output should be like this:

table
tr wicket:id=groupView   --- Outer listview
  td wicket:id=groupTitle/td
/tr
tr wicket:id=dataView --- Inner listview
  td wicket:id=data/td
/tr
/table

Not like this:

table
tr wicket:id=groupView   --- Outer listview
  td wicket:id=groupTitle/td
  tr wicket:id=dataView --- Inner listview
td wicket:id=data/td
  /tr
/tr
/table

What am I not getting?

Thanks,
Tauren


On 5/3/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
 you can still have only one list. then have an imodel implementation that
 filters that list on the fly.

 -igor



 On 5/3/07, Tauren Mills  [EMAIL PROTECTED] wrote:
  Igor,
 
  Yes, that makes sense.  However, I get the data for the list using a
  single HQL query with joins and such. If I changed to a ListView
  within a ListView, then wouldn't I also need to change to do many HQL
  queries to build a bunch of small lists within a big list?  I don't
  know what the performance implications would be of making this change.
 
  Also, last night I was working on switching it to a DataView instead
  of a ListView.  Could a single DataProvider supply the data for both
  the outer and inner views?
 
  Thanks!
  Tauren
 
 
  On 5/3/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
   what you need is a lsitview in a listview
  
   the first outputs the date row, and then a listview that outputs rows
 for
   that date.
  
   makes sense?
  
   -igor
  
  
  
   On 5/2/07, Tauren Mills  [EMAIL PROTECTED] wrote:
   
I'm using a custom ListView to generate a table.  The content of the
table consists of four columns of data.  I have that working just
fine.  But I'd like to add an additional table row on occation to
group rows of data in the table.  Thus, there would be a groupRow
that specifies a date, then many availRows of data for that date, then
another groupRow, more availRows, and so forth.
   
Here is some example HTML.  I know that this HTML and code will not
work the way it is now -- it is just meant to illustrate.  The first
TR should only be displayed when the date changes.  Otherwise, only
the second TR should display in each populateItem.
   
table
tr wicket:id=groupRow
td colspan=4 wicket:id=date/td
/tr
tr wicket:id=availRow
td wicket:id=lastName/td
td wicket:id=firstName/td
td wicket:id=startTime/td
td wicket:id=endTime/td
/tr
/table
   
Here is the custom ListView's populateItem:
   
   
protected void populateItem(final ListItem item) {
SimpleDateFormat dateDateFormat = new
   SimpleDateFormat(M/d/);
SimpleDateFormat timeDateFormat = new
   SimpleDateFormat(h:mma);
ReportRow rr = (ReportRow) item.getModelObject();
Date update = getStartDate(rr.getStartTime());
if (current == null || current.getTime() 
 update.getTime()) {
current = update;
item.add(new
Label(date,dateDateFormat.format(rr.getStartTime(;
}
else {
item.add(new Label(lastName,rr.getLastName()));
item.add(new
 Label(firstName,rr.getFirstName()));
item.add(new
Label(startTime,timeDateFormat.format(rr.getStartTime(;
item.add (new
Label(endTime,timeDateFormat.format (rr.getEndTime(;
}
}
   
   
  
 -
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
   
 https://lists.sourceforge.net/lists/listinfo/wicket-user
   
  
  
  
 -
   This SF.net email is sponsored by DB2 Express
   Download DB2 Express C - the FREE version of DB2 express and take
   control of your XML. No limits. Just data. Click to get it now.
   http://sourceforge.net/powerbar/db2/
   ___
   Wicket-user mailing list
   Wicket-user@lists.sourceforge.net
  
 https://lists.sourceforge.net/lists/listinfo/wicket-user

Re: [Wicket-user] Adding extra row to table in ListView

2007-05-03 Thread Tauren Mills
Sweet!  I do have it working with an extra tag (where you use the
span), but I didn't like that it rendered invalid html.  Didn't know
about setrenderbodyonly.  Thanks for the tip!  When I move to 1.3,
I'll use the container approach.

Thanks Igor!

Tauren



On 5/3/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
 you dont have to attach the listview to the trs though

 in 1.2.6
 you can attach it to span and do dataview.newitem(..) { return
 super.newitem(..).setrenderbodyonly(true);

 table
 span wicket:id=groupView   --- Outer listview
tr
  td wicket:id=groupTitle/td
/tr
span wicket:id=dataView  --- Inner listview
   tr
   td wicket:id=data/td
   /tr
/span
 /span
 /table

 in 1.3 we have a placeholder that makes this easier

 table
  wicket:container wicket:id=groupView   --- Outer listview
 tr
   td wicket:id=groupTitle/td
 /tr
 wicket:container wicket:id=dataView  --- Inner
 listview
tr
td wicket:id=data/td
/tr
 /wicket:container
  /wicket:container
  /table

 advantage of wicket:container is that it will validate markup even at design
 time, and it is stripped when strip-wicket-tags option is enabled.

 rarely you do hit these cases where doing this in a jsp is easier because
 the jsp renders top-down, but in my experience they are few and far in
 between. and more importantly we have solutions to make them work.

  -igor




 On 5/3/07, Tauren Mills [EMAIL PROTECTED] wrote:
 
  Igor,
 
  Upon further thought, how can a ListView inside a ListView solve this?
  Wouldn't the hierarchy cause the html to be messed up?  I can't have
  TRs within TRs.  The inner listview isn't putting child data inside of
  the TR, it needs to make TRs that are siblings of the outer listview.
 
  The output should be like this:
 
  table
  tr wicket:id=groupView   --- Outer
 listview
td wicket:id=groupTitle/td
  /tr
  tr wicket:id=dataView --- Inner
 listview
td wicket:id=data/td
  /tr
  /table
 
  Not like this:
 
  table
  tr wicket:id=groupView   --- Outer
 listview
td wicket:id=groupTitle/td
tr wicket:id=dataView --- Inner
 listview
  td wicket:id=data/td
/tr
  /tr
  /table
 
  What am I not getting?
 
  Thanks,
  Tauren
 
 
  On 5/3/07, Igor Vaynberg  [EMAIL PROTECTED] wrote:
   you can still have only one list. then have an imodel implementation
 that
   filters that list on the fly.
  
   -igor
  
  
  
   On 5/3/07, Tauren Mills  [EMAIL PROTECTED] wrote:
Igor,
   
Yes, that makes sense.  However, I get the data for the list using a
single HQL query with joins and such. If I changed to a ListView
within a ListView, then wouldn't I also need to change to do many HQL
queries to build a bunch of small lists within a big list?  I don't
know what the performance implications would be of making this change.
   
Also, last night I was working on switching it to a DataView instead
of a ListView.  Could a single DataProvider supply the data for both
the outer and inner views?
   
Thanks!
Tauren
   
   
On 5/3/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
 what you need is a lsitview in a listview

 the first outputs the date row, and then a listview that outputs
 rows
   for
 that date.

 makes sense?

 -igor



 On 5/2/07, Tauren Mills  [EMAIL PROTECTED] wrote:
 
  I'm using a custom ListView to generate a table.  The content of
 the
  table consists of four columns of data.  I have that working just
  fine.  But I'd like to add an additional table row on occation to
  group rows of data in the table.  Thus, there would be a
 groupRow
  that specifies a date, then many availRows of data for that date,
 then
  another groupRow, more availRows, and so forth.
 
  Here is some example HTML.  I know that this HTML and code will
 not
  work the way it is now -- it is just meant to illustrate.  The
 first
  TR should only be displayed when the date changes.  Otherwise,
 only
  the second TR should display in each populateItem.
 
  table
  tr wicket:id=groupRow
  td colspan=4 wicket:id=date/td
  /tr
  tr wicket:id=availRow
  td wicket:id=lastName/td
  td wicket:id=firstName/td
  td wicket:id=startTime/td
  td wicket:id=endTime/td
  /tr
  /table
 
  Here is the custom ListView's populateItem:
 
 
  protected void populateItem(final ListItem item) {
  SimpleDateFormat dateDateFormat = new
 SimpleDateFormat(M/d/);
  SimpleDateFormat timeDateFormat = new
 SimpleDateFormat

Re: [Wicket-user] Different JS 'this' object using ajax

2007-04-30 Thread Tauren Mills
Ahh, that makes sense.  I'll give that a try tomorrow. Thanks!

Tauren


On 4/30/07, Matej Knopp [EMAIL PROTECTED] wrote:
 Safest solution is to do
 item.setOutputMarkupId(true);;

 and then 
 target.appendJavascript(selectRow(document.getElementById('+item.getMarkuipId()+'));

 -Matej

 On 4/29/07, Tauren Mills [EMAIL PROTECTED] wrote:
  Hi,
 
  It appears that the javascript this object is different when I
  hardcode the javascript into the html vs. using an AjaxEventBehavior
  and appendJavascript.  For instance, the this in this refers to the
  TR which is correct and the selectRow functions works properly:
 
  tr onClick=selectRow(this) wicket:id=referees
 
  But if I use this html:
 
  tr wicket:id=referees
 
  With this code in a DataView:
 
  item.add(new AjaxEventBehavior(onClick) {
  @Override
  protected void onEvent(AjaxRequestTarget target) {
  target.appendJavascript(selectRow(this));
  }
  });
 
  Then my selectRow() method doesn't work right.  It appears this is a
  different object and not the TR.
 
  For reference, here is the javascript, which just highlights the row
  that has been clicked and removes the highlight from the previously
  selected row, if any:
 
  var lastRow;
  var lastRowClass;
 
  function selectRow(row) {
  if (lastRow != null) {
  lastRow.className = lastRowClass;
  }
  lastRow = row;
  lastRowClass = row.className;
  row.className = selected;
  }
 
  Any ideas what the this object is in the 2nd case, and what I should
  use instead?
 
  Tauren
 
  -
  This SF.net email is sponsored by DB2 Express
  Download DB2 Express C - the FREE version of DB2 express and take
  control of your XML. No limits. Just data. Click to get it now.
  http://sourceforge.net/powerbar/db2/
  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user
 

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


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


[Wicket-user] Forgot password feature

2007-04-30 Thread Tauren Mills
I'm considering different ways to implement a Forgot Password
feature.  I normally see it done one of two ways.

1.  On registration, get a Question and Answer from user.  Ask them
this question when they forget their password.  On correct answer, let
them change password.  I don't have any questions on implementing this
method.

2.  When password is forgotten, they put in their email address.  A
confirmation email is sent to user and they must click onto a link.
On the response page, they can change their password.

My preference is to implement #2. But I'm unclear on how to create a
confirmation link and a page to read it.  I'd need to add a unique
key of some sort to a URL.  That URL can't be session specific.

Any suggestions on how to format this confirmation URL and what would
need to go into the page's java to read the key from the URL?

Thanks!
Tauren

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


Re: [Wicket-user] Forgot password feature

2007-04-30 Thread Tauren Mills
Igor,

Thanks so much!

Tauren


On 4/30/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
 class resetpage extends webpage {
  public resetpage(pageparameters params) {
string key=params.get(0);
...
   }

   public static urlfor(string key) {
pageparameters params=new pageparameters();
params.put(0, key);
return requestcycle.get().urlfor(resetpage.class, params);
}
 }

 app.init() {
   mount(/reset, new indexedurlcodingstrategy(resetpage.class));
 }

 resetpage.urlfor(key) should return something like /context/reset/yourkey
 and you can email that to the user

 -igor



 On 4/30/07, Tauren Mills [EMAIL PROTECTED] wrote:
 
  I'm considering different ways to implement a Forgot Password
  feature.  I normally see it done one of two ways.
 
  1.  On registration, get a Question and Answer from user.  Ask them
  this question when they forget their password.  On correct answer, let
  them change password.  I don't have any questions on implementing this
  method.
 
  2.  When password is forgotten, they put in their email address.  A
  confirmation email is sent to user and they must click onto a link.
  On the response page, they can change their password.
 
  My preference is to implement #2. But I'm unclear on how to create a
  confirmation link and a page to read it.  I'd need to add a unique
  key of some sort to a URL.  That URL can't be session specific.
 
  Any suggestions on how to format this confirmation URL and what would
  need to go into the page's java to read the key from the URL?
 
  Thanks!
  Tauren
 
 
 -
  This SF.net email is sponsored by DB2 Express
  Download DB2 Express C - the FREE version of DB2 express and take
  control of your XML. No limits. Just data. Click to get it now.
  http://sourceforge.net/powerbar/db2/
  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user
 


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



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


Re: [Wicket-user] Forgot password feature

2007-04-30 Thread Tauren Mills
One more thing on this.  I have it working so that my URL looks like this:

/sa/app/reset/1/4xYD6JctlSPwU23eN%2Fm1isA5Cf8%3D/0/tauren

The key is the PageParameter #1.  I'm encoding a value using Base64,
which appears to include slashes, =, etc.  When this string is used in
a browser, the value is URLdecoded and ends up with an extra slash,
which messes everything up:

ERROR RequestCycle - URL fragment has unmatched key/value pair:
1/4xYD6JctlSPwU23eN/m1isA5Cf8=/0/tauren

Is there a built-in way in Wicket to url-encode the string again,
making it doubly encoded?  Or is there a different solution?  Perhaps
using something besides Base64, but I don't know what would be good to
use.

Thanks,
Tauren



On 4/30/07, Tauren Mills [EMAIL PROTECTED] wrote:
 Igor,

 Thanks so much!

 Tauren


 On 4/30/07, Igor Vaynberg [EMAIL PROTECTED] wrote:
  class resetpage extends webpage {
   public resetpage(pageparameters params) {
 string key=params.get(0);
 ...
}
 
public static urlfor(string key) {
 pageparameters params=new pageparameters();
 params.put(0, key);
 return requestcycle.get().urlfor(resetpage.class, params);
 }
  }
 
  app.init() {
mount(/reset, new indexedurlcodingstrategy(resetpage.class));
  }
 
  resetpage.urlfor(key) should return something like /context/reset/yourkey
  and you can email that to the user
 
  -igor
 
 
 
  On 4/30/07, Tauren Mills [EMAIL PROTECTED] wrote:
  
   I'm considering different ways to implement a Forgot Password
   feature.  I normally see it done one of two ways.
  
   1.  On registration, get a Question and Answer from user.  Ask them
   this question when they forget their password.  On correct answer, let
   them change password.  I don't have any questions on implementing this
   method.
  
   2.  When password is forgotten, they put in their email address.  A
   confirmation email is sent to user and they must click onto a link.
   On the response page, they can change their password.
  
   My preference is to implement #2. But I'm unclear on how to create a
   confirmation link and a page to read it.  I'd need to add a unique
   key of some sort to a URL.  That URL can't be session specific.
  
   Any suggestions on how to format this confirmation URL and what would
   need to go into the page's java to read the key from the URL?
  
   Thanks!
   Tauren
  
  
  -
   This SF.net email is sponsored by DB2 Express
   Download DB2 Express C - the FREE version of DB2 express and take
   control of your XML. No limits. Just data. Click to get it now.
   http://sourceforge.net/powerbar/db2/
   ___
   Wicket-user mailing list
   Wicket-user@lists.sourceforge.net
   https://lists.sourceforge.net/lists/listinfo/wicket-user
  
 
 
  -
  This SF.net email is sponsored by DB2 Express
  Download DB2 Express C - the FREE version of DB2 express and take
  control of your XML. No limits. Just data. Click to get it now.
  http://sourceforge.net/powerbar/db2/
  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user
 
 


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


[Wicket-user] Different JS 'this' object using ajax

2007-04-29 Thread Tauren Mills
Hi,

It appears that the javascript this object is different when I
hardcode the javascript into the html vs. using an AjaxEventBehavior
and appendJavascript.  For instance, the this in this refers to the
TR which is correct and the selectRow functions works properly:

tr onClick=selectRow(this) wicket:id=referees

But if I use this html:

tr wicket:id=referees

With this code in a DataView:

item.add(new AjaxEventBehavior(onClick) {
@Override
protected void onEvent(AjaxRequestTarget target) {
target.appendJavascript(selectRow(this));
}
});

Then my selectRow() method doesn't work right.  It appears this is a
different object and not the TR.

For reference, here is the javascript, which just highlights the row
that has been clicked and removes the highlight from the previously
selected row, if any:

var lastRow;
var lastRowClass;

function selectRow(row) {
if (lastRow != null) {
lastRow.className = lastRowClass;
}
lastRow = row;
lastRowClass = row.className;
row.className = selected;
}

Any ideas what the this object is in the 2nd case, and what I should
use instead?

Tauren

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


[Wicket-user] Different JS 'this' object using ajax

2007-04-29 Thread Tauren Mills
Hi,

It appears that the javascript this object is different when I
hardcode the javascript into the html vs. using an AjaxEventBehavior
and appendJavascript.  For instance, the this in this refers to the
TR which is correct and the selectRow functions works properly:

tr onClick=selectRow(this) wicket:id=referees

But if I use this html:

tr wicket:id=referees

With this code in a DataView:

item.add(new AjaxEventBehavior(onClick) {
@Override
protected void onEvent(AjaxRequestTarget target) {
target.appendJavascript(selectRow(this));
}
});

Then my selectRow() method doesn't work right.  It appears this is a
different object and not the TR.

For reference, here is the javascript, which just highlights the row
that has been clicked and removes the highlight from the previously
selected row, if any:

var lastRow;
var lastRowClass;

function selectRow(row) {
if (lastRow != null) {
lastRow.className = lastRowClass;
}
lastRow = row;
lastRowClass = row.className;
row.className = selected;
}

Any ideas what the this object is in the 2nd case, and what I should
use instead?

Tauren

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