Re: A safer way to build PropertyModels

2011-07-21 Thread Iain Reddick
I LOLed at this:

Unfortunately, most of us are stuck in Java world where proper functions are 
still considered science fiction like flying cars and World Peace.

- Original Message -
From: Carl-Eric Menzel cmen...@wicketbuch.de
To: users@wicket.apache.org
Sent: Thursday, 21 July, 2011 7:45:02 PM
Subject: A safer way to build PropertyModels

After seeing the LambdaJ-based model idea at
https://cwiki.apache.org/WICKET/working-with-wicket-models.html#WorkingwithWicketmodels-LambdaJ
I thought I'd try and implement something like that in a ready-to-use
fashion, and simplify it a little.

The result is here:
https://github.com/duesenklipper/wicket-safemodel

This is a way to refactor-safely and type-safely build models, without
relying on brittle string literals:

  SomeBean myBean = ...
  IModelString childNameModel =
  model(from(myBean).getChild().getName());

No cast, no string literal, only getters. It works with regular
JavaBeans, Lists, and with Maps (string keys only though).

Instead of requiring a compile-time step this does some proxying in the
background to construct a property expression.

Anybody interested please give it a try and let me know of any issues.

Note: If you feel comfortable with configuring an annotation
processor in your Maven build as well as your IDE build, go ahead and
try Igor's metagen [https://github.com/42Lines/metagen]. That way you
don't have any runtime magic.

Use SafeModel if you don't want an additional compile step and do want
(very slightly) less keyboard typing.

Carl-Eric
www.wicketbuch.de

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


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



Re: wicket-dnd not working on IE9 and only partially on IE8

2011-06-08 Thread Iain Reddick
Without looking at the implementation, to see if the styling is causing an 
issue:

1) Delete all style declarations from the css file (i.e. blank it)

2) See if the issue persists - in which case it's probably something else

3) Add your style declarations back one at a time to the css file to see which 
one causes the problem

- Original Message -
From: lucast lucastol...@hotmail.com
To: users@wicket.apache.org
Sent: Wednesday, 8 June, 2011 6:18:57 PM
Subject: Re: wicket-dnd not working on IE9 and only partially on IE8

Hi Sven,
I found what causes the drop functionality not to work on IE8.
I have a panel which has wicket-dnd draggable and droppable functionality. I
allocate that panel to each table cell.
On the html file for the panel, I have the following header which already
exists on the homePage.html file:
head
wicket:head
wicket:link
link href=panelStyle.css rel=stylesheet
/wicket:link
/wicket:head
/head
If I remove that from SlotDragDropPanel.html (attached), then wicket-dnd
works fine on IE8. 
Why that is, I just don't know. I should find out but I'm just happy and
relieved to have got this out of the way with my release date so soon.
Attached are the files I used for this app.
http://apache-wicket.1842946.n4.nabble.com/file/n3583128/WicketApplication.java
WicketApplication.java 
http://apache-wicket.1842946.n4.nabble.com/file/n3583128/HomePage.java
HomePage.java 
http://apache-wicket.1842946.n4.nabble.com/file/n3583128/HomePage.html
HomePage.html 
http://apache-wicket.1842946.n4.nabble.com/file/n3583128/GuestListView.java
GuestListView.java 
http://apache-wicket.1842946.n4.nabble.com/file/n3583128/SlotDragDropPanel.java
SlotDragDropPanel.java 
http://apache-wicket.1842946.n4.nabble.com/file/n3583128/SlotDragDropPanel.html
SlotDragDropPanel.html 
http://apache-wicket.1842946.n4.nabble.com/file/n3583128/style.css style.css 

If you comment out the head section on SlotDragDropPanel.html then the
problem disappears.
Thanks for taking the time to look into this,
Lucas

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/wicket-dnd-not-working-on-IE9-and-only-partially-on-IE8-tp3580258p3583128.html
Sent from the Users forum mailing list archive at Nabble.com.

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


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



Re: Refreshing loadable detachable model object inside an ajax call

2011-04-14 Thread Iain Reddick
Firstly, that LDM code is broken - calling detach() on load() makes no sense.

Also, it will hit hibernate on every call to getObject(), as you aren't caching 
the loaded Parent entity. This is probably the cause of the hibernate 
exceptions you are seeing.

Check out http://wicketinaction.com/2008/09/building-a-smart-entitymodel/ for a 
solid persistence backed LDM implementation.

Unrelated, your ParentsService.load() method probably doesn't need to take the 
entity class a parameter - the service should know the entity type it is 
querying hibernate for.

- Original Message -
From: lucast lucastol...@hotmail.com
To: users@wicket.apache.org
Sent: Wednesday, 13 April, 2011 7:20:15 PM
Subject: Re: Refreshing loadable detachable model object inside an ajax call

Hi Clint, thanks for your email.

After reading your post, this is how I've implemented the LDM class:


public class LoadableParentModel extends LoadableDetachableModel {

Long id;

public LoadableParentModel(Long id){

this.id = id;

}

@Override   protected Parent load() {

Parent Parent =
WicketApplication.get().getParents_service().load(Parent.class, id);

detach();

return Parent;

}

}




Is that what you mean by explicitly calling .detach() on the LDM?

I apologise if I didn't get that right straight away. I have implemented it
as in the above example but when I call (Parent) model.getObject(); I get
the same exception as before.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Refreshing-loadable-detachable-model-object-inside-an-ajax-call-tp3446979p3447904.html
Sent from the Users forum mailing list archive at Nabble.com.

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


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



Re: JFreeChart with clickable imagemap

2010-10-04 Thread Iain Reddick
 Doesn't that code render the chart twice, with the rendering for the 
image map simply being dumped?


On 04/10/2010 07:51, Peter Karich wrote:

thanks!


Dear all,

I've added a new wiki page JFreeChart with tooltip
examplehttps://cwiki.apache.org/confluence/display/WICKET/JFreeChart+with+tooltip+example,
which outlines the steps to follow to create JFreeChart based charts that
can display tooltips.

On Fri, Oct 1, 2010 at 3:05 PM, Jamesjames.eliye...@gmail.com  wrote:



Thanks Ernesto.
I'll do the same.


On Fri, Oct 1, 2010 at 2:24 PM, Ernesto Reinaldo Barreiro
reier...@gmail.com  wrote:



James,

why not add this bit to the wiki page you mentioned? So that others
can avoid loosing the hours you lost;-)

Cheers,

Ernesto

On Fri, Oct 1, 2010 at 8:18 AM, Jamesjames.eliye...@gmail.com  wrote:


Guys,

Finally managed to display the tooltip generated by JFreeChart in the


wicket


page by following these
instructions


http://markmail.org/message/r36cvdt2o3c4pki6#query:wicket%20jfreechart%20tooltips+page:1+mid:xqpnjdsj2lnkoinq+state:results


.
Had only an example markup been given in that post, it would have saved


lots


of frustrating hours I spent. :-(

For anyone looking forward for showing the tooltips in a chart generated


by


JFreeChart, here is the markup you might need.

code
img wicket:id=chart usemap=#tooltip/img
/code

For the java part, use this
code


http://markmail.org/message/r36cvdt2o3c4pki6#query:wicket%20jfreechart%20tooltips+page:1+mid:xqpnjdsj2lnkoinq+state:results


.

Your output should look something like this..

code
   img wicket:id=chart usemap=#tooltip src=blah blah/img
   map id=tooltip name=tooltip
area/
   /map
/code


NOTE:

  - You must usecode  img wicket:id=chart usemap=#tooltip/img
/code  and notcode  img wicket:id=chart usemap=#tooltip/


/code


  - You must use the # symbol before the usemap id.
  - The image map related html markup is generated by the api provided by
JFreeChart.



On Fri, Oct 1, 2010 at 10:34 AM, Jamesjames.eliye...@gmail.com


wrote:




Hi Peter,

Thanks for your prompt reply.
I don't know how I missed this wonderful mailing list for this long..


;-(


I have tried passing models to constructImageMap (wrapping the chart


image


object as a model) but somehow the map was not updated.

I checked jetwick and it looks cool. ;-)
Do you use JFreeChart to create those charts?
I'm willing to try that option as well. Kindly blog about it!

Thanks once again for taking your time to reply.


On Thu, Sep 30, 2010 at 7:27 PM, Peter Karichpeat...@yahoo.de


wrote:




Hi James,

In the constructImageMap you whill have to pass a model as well, but


I'm


not sure how :-(

Another way would be to adapt constructImageMap to updateImageMap
so that you can call it in ChartImage.createBufferedImage (or every


time


the model updates)

BTW: For jetwick I used an html solution with div's to display bar


charts.


which is customizable by the designer (if any ;-)), readable by


spiders


etc
and didn't need those imagemaps. Are you interested in this solution?


I


could blog about it.

Regards,
Peter (aka timetabling on twitter ;-)).



Hi Guys,

I followed the instructions in the wiki JFreeChart with clickable
imagemap




https://cwiki.apache.org/WICKET/jfreechart-with-clickable-imagemap.html


to create a chart.
I have a requirement whereby the chart has to be generated


dynamically


based


on certain inputs.
I managed to create the chart image by using LoadableDetachableModel


but


struggling to get the imagemap updated as the chart image changes.
Kindly give your valuable suggestions.




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




--
Thanks  Regards,
James




--
Thanks  Regards,
James



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




--
Thanks  Regards,
James



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




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



Re: OT: Best practices regarding service layers DAOs

2010-08-31 Thread Iain Reddick
 Here is an interesting generic query DSL that should work well with 
Wicket. Clauses can be both added and removed from the query in an OO 
fashion, unlike Query DSL and Quaere (which seem more focussed on syntax).


http://code.google.com/p/hibernate-generic-dao/

On 31/08/2010 04:18, Brian Topping wrote:

While I haven't (yet) had this opportunity, I can't wait until the day that I 
wrap service interfaces with Web Services and connect it to a mobile UI.

For that case alone, I focus my strategy on Spring managing the transaction 
with load-time weaving.

$0.02...

On Aug 30, 2010, at 10:31 PM, Alexander Morozov wrote:


Brain thank you for comment,

saying about Wicket and transactions, from my point of view, we have 2
posibilities:
1. manage transaction boundaries on per-request way (override
RequestCycle.onBeginRequest(), RequestCycle.onEndRequest(),
RequestCycle.onRuntimeException()) with PlatformTransactionManagement (do
not forget to proper configure TM with
SYNCHRONIZATION_ON_ACTUAL_TRANSACTION)
2. propagate transaction by means of AspectJ and load-time weaving for
actionable wicket subtypes (such as IFormSubmitListener, ILinkListener and
etc.)

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/OT-Best-practices-regarding-service-layers-DAOs-tp2400408p2400954.html
Sent from the Wicket - User mailing list archive at Nabble.com.

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




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




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



Model object string manipulation

2010-08-04 Thread Iain Reddick
What's the cleanest way of doing string manipulation with a component that uses 
a String as a model (e.g. a Label). I'm thinking of mutations such as to 
uppercase and to lowercase, etc.

An obvious place is to do it in the model, but I'm interested to hear what 
other developer's approaches are. Is there a nicer way of doing this - via a 
behaviour for instance?

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



Re: Model object string manipulation

2010-08-04 Thread Iain Reddick
To elaborate a bit - I'm talking about one off situations and also re-usable 
solutions, such as the aforementioned to upper and to lower cases.

- Original Message -
From: Iain Reddick iain.redd...@beatsystems.com
To: users@wicket.apache.org
Sent: Wednesday, 4 August, 2010 9:19:46 PM
Subject: Model object string manipulation

What's the cleanest way of doing string manipulation with a component
that uses a String as a model (e.g. a Label). I'm thinking of mutations
such as to uppercase and to lowercase, etc.

An obvious place is to do it in the model, but I'm interested to hear
what other developer's approaches are. Is there a nicer way of doing
this - via a behaviour for instance?

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

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



Re: Model object string manipulation

2010-08-04 Thread Iain Reddick
Thanks Igor - that's the approach that I would automatically take.

My question was really related to explaining to developers from an MVC 
background what the process is for getting data from somewhere to the view. 
Nested models as a data tranformation pipeline is the mental model I was going 
to use. I just need to fit behaviours as component mutators in there 
somewhere and I'll be set! 

- Original Message -
From: Igor Vaynberg igor.vaynb...@gmail.com
To: users@wicket.apache.org
Sent: Wednesday, 4 August, 2010 9:29:34 PM
Subject: Re: Model object string manipulation

for reusable situations, or even one off, you can write a simple
decorator model

-igor

On Wed, Aug 4, 2010 at 1:27 PM, Iain Reddick
iain.redd...@beatsystems.com wrote:
 To elaborate a bit - I'm talking about one off situations and also
 re-usable solutions, such as the aforementioned to upper and to
 lower cases.

 - Original Message -
 From: Iain Reddick iain.redd...@beatsystems.com
 To: users@wicket.apache.org
 Sent: Wednesday, 4 August, 2010 9:19:46 PM
 Subject: Model object string manipulation

 What's the cleanest way of doing string manipulation with a component
 that uses a String as a model (e.g. a Label). I'm thinking of
 mutations such as to uppercase and to lowercase, etc.

 An obvious place is to do it in the model, but I'm interested to hear
 what other developer's approaches are. Is there a nicer way of doing
 this - via a behaviour for instance?

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

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



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

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



Re: When object is null

2010-07-27 Thread Iain Reddick
I've come across similar scenarios fairly often - i.e. where a the 
construction of component is impossible if its model object is null, or 
some other construction parameter is null.


I'm still not sure what the best approach is in this situation.

One of the methods I've used is to late-bind the optional component in 
the onBeforeRender() of a special wrapper container (e.g. if the model 
object != null, add the component, make the wrapper visible. If model 
object == null, don't add the component and make the wrapper 
non-visible). This seems like a blatant hack, however.


see these threads:
http://apache-wicket.1842946.n4.nabble.com/Nullable-resource-link-td1886391.html#a1886395
http://apache-wicket.1842946.n4.nabble.com/Components-and-nullable-data-td1888023.html#none

Abid K wrote:

Thanks Josh and Daniel - both methods have worked. I have gone with checking
if the object is null or not like so...

  public class SomePanel extends Panel {
public SomePanel(String id) {
  super(id);

  if ( data == null ) {
return;
  }

  Label label = new Label(someLabel, String.valueOf(data.getId()));
  add(label);
}
  }

I have decided to do this because I am not sure how I can format a date
without doing this...
  SimpleDateFormat dateFormat = new SimpleDateFormat( dd/MM/ );
  Label dateLabel = new Label( date, dateFormat.format( data.getDate(
) ) );

Thanks.

  



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



Re: Show/hide form components best practice

2010-06-16 Thread Iain Reddick
I looked at this again today and realised that my examples are basically broken 
(also typos in the last one :) ).

Obviously, you can't use the converted input of a FormComponent before 
validation has happened. This means that using the CheckBox converted input to 
determine whether another form component is used in the submission is wrong - 
it will only return the value it held before the submit. You would actually 
have to look at the raw input.

So I'm back at square one with this again.

I suppose my question is Is component visibility the only means of determining 
whether a form component should be considered in the form submit mechanism?.

- Original Message -
From: Iain Reddick iain.redd...@beatsystems.com
To: users@wicket.apache.org
Sent: Wednesday, 9 June, 2010 8:35:13 PM
Subject: Re: Show/hide form components best practice

Looking at the wicket source regarding this, I don't think it's possible
to get the desired behaviour.

It looks like a new hook is needed in FormComponent.validate() that is
called before any of the other logic.

Something like FormComponent.isUsed(). If this returns false, just exit
the validate() methods.

Default FormComponent implementation would return true for this method,
but it can be overriden to provide the desired behaviour.

As I understand the submit/validate/bind sequence, this would mean that
the form component's raw input is updated (which makes sense), but
validation/model object doesn't happen.

Is this feasible, and would it impact elsewhere?


Here's an update of my previous example showing how it would be used:

private class TestForm extends Form {

private String always;
private boolean useOptional = false;
private String optional;

public TestForm(String id) {
super(id);

add( new TextField(always, new PropertyModel(this,
always)).setRequired(true) );
final CheckBox useOptionalCheck = new CheckBox( useOptional, new
PropertyModel(this, useOptional) );
add( useOptionalCheck );
add( new TextField(optional, new PropertyModel(this, optional)) {
@Override public boolean isUsed() {
return ((Boolean)useOptionalCheck.getConvertedInput()).booleanValue();
}

@Override
public boolean isRequired() {
isUsed(); }
}.add(MinimumLengthValidator.minimumLength(3)) );
}

}


- Original Message -
From: Xavier López xavil...@gmail.com
To: users@wicket.apache.org
Sent: Thursday, 3 June, 2010 2:56:33 PM
Subject: Re: Show/hide form components best practice

I'm with you on this one, this code feels like doing something that it
shouldn't, looks kind of bloated for such a simple and common
requirement. Maybe we need some stuffing of nice, pre-canned
FormValidators ? :)

The problem with wicket's validators, as I see it, is that they are at a
Component level. They do their job based on that component's
input/state, only. In fact, they are called in Form's
validateComponents() one by one in
a traversal. If another component's input or state is required to
perform the validation, i'd do it inside a FormValidator. That copes
with your
requirement of ignore the input for this component completely,
although I
don't know how would that be achieved.

Of course, in all those comments, I assume you can not rely on
javascript nor ajax to perform those validations, in which case the
visibility approach
simply couldn't work.

Cheers,
Xavier

2010/6/3 Iain Reddick iain.redd...@beatsystems.com

 The problem with this approach is that you throw away all the nice,
 re-usable pre-canned validators that wicket has, and that it seems
 very wrong.

 I'd actually push the behaviour I would like to see even further - in
 the example I gave, I don't even want the optional field to update
 it's model
 when the check box isn't selected.

 Effectively, I want to be able to specify logic which says ignore the
 input for this component completely. Currently, the only way to do
 this is
 by using component visibility (unless I'm completely wrong on this).

 Xavier López wrote:

 Hi Iain,

 I would do it like this, with a FormValidator. I moved the minimum
 length validation also to the formValidator, because doing it with a
 MinimumLenghtValidator would trigger it before the formValidator
 executes, and may raise errors when the input is not valid (i.e. not
 mandatory) :

 private class TestForm extends Form {

 IModel modelAlways;
 IModel modelCheckOptional;
 IModel modelOptional;

  public TestForm(String id) {
   super(id);

   modelAlways = new Model();
   modelCheckOptional = Boolean.FALSE;
   modelOptional = new Model();
   final TextField alwaysTextfield = new TextField(always,
   modelAlways); alwaysTextField.setRequired(true);
   add(alwaysTextField); final CheckBox useOptionalCheck = new
   CheckBox( useOptional,
 modelCheckOptional);
   add( useOptionalCheck );
   final TextField optionalTextField = new TextField(optional,
 modelOptional);
   add(optionalTextField);

   add(new IFormValidator(){
  protected FormComponent getDependentFormComponents(){ return
  null

Re: Show/hide form components best practice

2010-06-09 Thread Iain Reddick
Looking at the wicket source regarding this, I don't think it's possible to get 
the desired behaviour.

It looks like a new hook is needed in FormComponent.validate() that is called 
before any of the other logic.

Something like FormComponent.isUsed(). If this returns false, just exit the 
validate() methods.

Default FormComponent implementation would return true for this method, but it 
can be overriden to provide the desired behaviour.

As I understand the submit/validate/bind sequence, this would mean that the 
form component's raw input is updated (which makes sense), but validation/model 
object doesn't happen.

Is this feasible, and would it impact elsewhere?


Here's an update of my previous example showing how it would be used:

private class TestForm extends Form {

  private String always;
  private boolean useOptional = false;
  private String optional;

  public TestForm(String id) {
super(id);

add( new TextField(always, new PropertyModel(this, 
always)).setRequired(true) );
final CheckBox useOptionalCheck = new CheckBox( useOptional, new 
PropertyModel(this, useOptional) );
add( useOptionalCheck );
add( new TextField(optional, new PropertyModel(this, optional)) {
  @Override
  public boolean isUsed() {
return ((Boolean)useOptionalCheck.getConvertedInput()).booleanValue();
  }

  @Override
  public boolean isRequired() {
isUsed();
  }  
}.add(MinimumLengthValidator.minimumLength(3)) );
  }

}


- Original Message -
From: Xavier López xavil...@gmail.com
To: users@wicket.apache.org
Sent: Thursday, 3 June, 2010 2:56:33 PM
Subject: Re: Show/hide form components best practice

I'm with you on this one, this code feels like doing something that it
shouldn't, looks kind of bloated for such a simple and common
requirement. Maybe we need some stuffing of nice, pre-canned
FormValidators ? :)

The problem with wicket's validators, as I see it, is that they are at a
Component level. They do their job based on that component's
input/state, only. In fact, they are called in Form's
validateComponents() one by one in
a traversal. If another component's input or state is required to
perform the validation, i'd do it inside a FormValidator. That copes
with your
requirement of ignore the input for this component completely,
although I
don't know how would that be achieved.

Of course, in all those comments, I assume you can not rely on
javascript nor ajax to perform those validations, in which case the
visibility approach
simply couldn't work.

Cheers,
Xavier

2010/6/3 Iain Reddick iain.redd...@beatsystems.com

 The problem with this approach is that you throw away all the nice,
 re-usable pre-canned validators that wicket has, and that it seems
 very wrong.

 I'd actually push the behaviour I would like to see even further - in
 the example I gave, I don't even want the optional field to update
 it's model
 when the check box isn't selected.

 Effectively, I want to be able to specify logic which says ignore the
 input for this component completely. Currently, the only way to do
 this is
 by using component visibility (unless I'm completely wrong on this).

 Xavier López wrote:

 Hi Iain,

 I would do it like this, with a FormValidator. I moved the minimum
 length validation also to the formValidator, because doing it with a
 MinimumLenghtValidator would trigger it before the formValidator
 executes, and may raise errors when the input is not valid (i.e. not
 mandatory) :

 private class TestForm extends Form {

 IModel modelAlways;
 IModel modelCheckOptional;
 IModel modelOptional;

  public TestForm(String id) {
   super(id);

   modelAlways = new Model();
   modelCheckOptional = Boolean.FALSE;
   modelOptional = new Model();
   final TextField alwaysTextfield = new TextField(always,
   modelAlways); alwaysTextField.setRequired(true);
   add(alwaysTextField); final CheckBox useOptionalCheck = new
   CheckBox( useOptional,
 modelCheckOptional);
   add( useOptionalCheck );
   final TextField optionalTextField = new TextField(optional,
 modelOptional);
   add(optionalTextField);

   add(new IFormValidator(){
  protected FormComponent getDependentFormComponents(){ return
  null; }
  public boolean validate(Form f){
  if
  (Boolean.TRUE.equals(useOptionalCheck.getConvertedInput()){
String optionalValue =
 optionalTextField.getConvertedInput();
if (Strings.isEmpty(optionalValue ){
   error (field optional is required);
} else if (optionalValue.length  3){
   error (optional value's length must be at
   least 3);
}
  }.
 } });

 Cheers,
 Xavier

 2010/6/2 Iain Reddick iain.redd...@beatsystems.com



 Here's some example code (wicket 1.3.x):

 Java:

 private class TestForm extends Form {

  private String always;
  private boolean useOptional = false;
  private String optional

Re: Show/hide form components best practice

2010-06-03 Thread Iain Reddick
The problem with this approach is that you throw away all the nice, 
re-usable pre-canned validators that wicket has, and that it seems very 
wrong.


I'd actually push the behaviour I would like to see even further - in 
the example I gave, I don't even want the optional field to update it's 
model when the check box isn't selected.


Effectively, I want to be able to specify logic which says ignore the 
input for this component completely. Currently, the only way to do this 
is by using component visibility (unless I'm completely wrong on this).


Xavier López wrote:

Hi Iain,

I would do it like this, with a FormValidator. I moved the minimum length
validation also to the formValidator, because doing it with a
MinimumLenghtValidator would trigger it before the formValidator executes,
and may raise errors when the input is not valid (i.e. not mandatory) :

private class TestForm extends Form {

IModel modelAlways;
IModel modelCheckOptional;
IModel modelOptional;

 public TestForm(String id) {
   super(id);

   modelAlways =  new Model();
   modelCheckOptional = Boolean.FALSE;
   modelOptional = new Model();
   final TextField alwaysTextfield = new TextField(always, modelAlways);
   alwaysTextField.setRequired(true);
   add(alwaysTextField);
   final CheckBox useOptionalCheck = new CheckBox( useOptional,
modelCheckOptional);
   add( useOptionalCheck );
   final TextField optionalTextField = new TextField(optional,
modelOptional);
   add(optionalTextField);

   add(new IFormValidator(){
  protected FormComponent getDependentFormComponents(){ return null; }
  public boolean validate(Form f){
  if (Boolean.TRUE.equals(useOptionalCheck.getConvertedInput()){
String optionalValue =
optionalTextField.getConvertedInput();
if (Strings.isEmpty(optionalValue ){
   error (field optional is required);
}
else if (optionalValue.length  3){
   error (optional value's length must be at least 3);
}
  }.
}
});

Cheers,
Xavier

2010/6/2 Iain Reddick iain.redd...@beatsystems.com

  

Here's some example code (wicket 1.3.x):

Java:

private class TestForm extends Form {

 private String always;
 private boolean useOptional = false;
 private String optional;

 public TestForm(String id) {
   super(id);

   add( new TextField(always, new PropertyModel(this,
always)).setRequired(true) );
   final CheckBox useOptionalCheck = new CheckBox( useOptional, new
PropertyModel(this, useOptional) );
   add( useOptionalCheck );
   add( new TextField(optional, new PropertyModel(this, optional)) {
 @Override
 public boolean isRequired() {
   return
((Boolean)useOptionalCheck.getConvertedInput()).booleanValue();
 }
   }.add(MinimumLengthValidator.minimumLength(3)) );
 }

}

Markup:

form wicket:id=testForm
 input wicket:id=always type=text /
 input wicket:id=useOptional type=checkbox /
 input wicket:id=optional type=text /
 input type=submit /
/form

How can I express that I want the optional text field to only be used when
the checkbox is selected?

- Original Message -
From: Igor Vaynberg igor.vaynb...@gmail.com
To: users@wicket.apache.org
Sent: Wednesday, 2 June, 2010 4:00:57 PM
Subject: Re: Show/hide form components best practice

if the form contains all the state then the answer is simple: write a
bit of javascript that does it for you.

-igor

On Wed, Jun 2, 2010 at 2:53 AM, Iain Reddick
iain.redd...@beatsystems.com wrote:


That's just a server round-trip on client-side state changem, which is
basically (1) in my initial list.

Basically, this type of form behaviour is very common and the question
of how to implement it with Wicket has been raised by every developer
I know
who has worked with the framework.

I know that Wicket generally works best when you round-trip
client-side state changes to the server, but I think that in this
situation it is silly,
as the submitted form contains all the required state.

Jeremy Thomerson wrote:
  

return true from wantOnSelectionChangedNotifications and put your
visibility changing code in onSelectionChanged





http://wicket.apache.org/docs/1.4/org/apache/wicket/markup/html/form/CheckGroup.html#wantOnSelectionChangedNotifications()http://wicket.apache.org/docs/1.4/org/apache/wicket/markup/html/form/CheckGroup.html#wantOnSelectionChangedNotifications%28%29



http://wicket.apache.org/docs/1.4/org/apache/wicket/markup/html/form/CheckGroup.html#wantOnSelectionChangedNotifications()http://wicket.apache.org/docs/1.4/org/apache/wicket/markup/html/form/CheckGroup.html#wantOnSelectionChangedNotifications%28%29


On Tue, Jun 1, 2010 at 5:37 AM, Iain Reddick
iain.redd...@beatsystems.comwrote:




Say I have a form with a check box that, when checked, shows some
other field (i.e. it controls the visibility of other form
components).

What is the best approach to handling this?

From what I understand

Re: Show/hide form components best practice

2010-06-02 Thread Iain Reddick
That's just a server round-trip on client-side state changem, which is 
basically (1) in my initial list.


Basically, this type of form behaviour is very common and the question 
of how to implement it with Wicket has been raised by every developer I 
know who has worked with the framework.


I know that Wicket generally works best when you round-trip client-side 
state changes to the server, but I think that in this situation it is 
silly, as the submitted form contains all the required state.


Jeremy Thomerson wrote:

return true from wantOnSelectionChangedNotifications and put your visibility
changing code in onSelectionChanged

http://wicket.apache.org/docs/1.4/org/apache/wicket/markup/html/form/CheckGroup.html#wantOnSelectionChangedNotifications()
http://wicket.apache.org/docs/1.4/org/apache/wicket/markup/html/form/CheckGroup.html#wantOnSelectionChangedNotifications()

On Tue, Jun 1, 2010 at 5:37 AM, Iain Reddick
iain.redd...@beatsystems.comwrote:

  

Say I have a form with a check box that, when checked, shows some other
field (i.e. it controls the visibility of other form components).

What is the best approach to handling this?

From what I understand, you have 3 options:

1. Add ajax behaviour to the check box (re-render relevant components).
2. Add javascript from the Java code (e.g. add some kind of show/hide
behaviour).
3. Add javascript directly to the HTML.

What are peoples experiences of the 3 methods, and which is best?

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






  




Re: Show/hide form components best practice

2010-06-02 Thread Iain Reddick
Here's some example code (wicket 1.3.x):

Java:

private class TestForm extends Form {

  private String always;
  private boolean useOptional = false;
  private String optional;

  public TestForm(String id) {
super(id);

add( new TextField(always, new PropertyModel(this, 
always)).setRequired(true) );
final CheckBox useOptionalCheck = new CheckBox( useOptional, new 
PropertyModel(this, useOptional) );
add( useOptionalCheck );
add( new TextField(optional, new PropertyModel(this, optional)) {
  @Override
  public boolean isRequired() {
return ((Boolean)useOptionalCheck.getConvertedInput()).booleanValue();
  }
}.add(MinimumLengthValidator.minimumLength(3)) );
  }

}

Markup:

form wicket:id=testForm
  input wicket:id=always type=text /
  input wicket:id=useOptional type=checkbox /
  input wicket:id=optional type=text /
  input type=submit /
/form

How can I express that I want the optional text field to only be used when the 
checkbox is selected?

- Original Message -
From: Igor Vaynberg igor.vaynb...@gmail.com
To: users@wicket.apache.org
Sent: Wednesday, 2 June, 2010 4:00:57 PM
Subject: Re: Show/hide form components best practice

if the form contains all the state then the answer is simple: write a
bit of javascript that does it for you.

-igor

On Wed, Jun 2, 2010 at 2:53 AM, Iain Reddick
iain.redd...@beatsystems.com wrote:
 That's just a server round-trip on client-side state changem, which is
 basically (1) in my initial list.

 Basically, this type of form behaviour is very common and the question
 of how to implement it with Wicket has been raised by every developer
 I know
 who has worked with the framework.

 I know that Wicket generally works best when you round-trip
 client-side state changes to the server, but I think that in this
 situation it is silly,
 as the submitted form contains all the required state.

 Jeremy Thomerson wrote:

 return true from wantOnSelectionChangedNotifications and put your
 visibility changing code in onSelectionChanged


 http://wicket.apache.org/docs/1.4/org/apache/wicket/markup/html/form/CheckGroup.html#wantOnSelectionChangedNotifications()

 http://wicket.apache.org/docs/1.4/org/apache/wicket/markup/html/form/CheckGroup.html#wantOnSelectionChangedNotifications()

 On Tue, Jun 1, 2010 at 5:37 AM, Iain Reddick
 iain.redd...@beatsystems.comwrote:



 Say I have a form with a check box that, when checked, shows some
 other field (i.e. it controls the visibility of other form
 components).

 What is the best approach to handling this?

 From what I understand, you have 3 options:

 1. Add ajax behaviour to the check box (re-render relevant
 components). 2. Add javascript from the Java code (e.g. add some
 kind of show/hide
 behaviour). 3. Add javascript directly to the HTML.

 What are peoples experiences of the 3 methods, and which is best?

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









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

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



Show/hide form components best practice

2010-06-01 Thread Iain Reddick
Say I have a form with a check box that, when checked, shows some other 
field (i.e. it controls the visibility of other form components).


What is the best approach to handling this?

From what I understand, you have 3 options:

1. Add ajax behaviour to the check box (re-render relevant components).
2. Add javascript from the Java code (e.g. add some kind of show/hide 
behaviour).

3. Add javascript directly to the HTML.

What are peoples experiences of the 3 methods, and which is best?

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



Re: Show/hide form components best practice

2010-06-01 Thread Iain Reddick

With (2) and (3), what is the best way of handling validation?

With (1), the server-side state for the form is correct, and the hidden 
component won't be validated on form submit.


With (2) and (3), the visible state of the toggled component is purely 
client side. This means that on form submit, the hidden component will 
still be validated.


Pedro Santos wrote:

2 or 3 since there is no relevant state on the server side you want to
consider to implement the component visibility rule.

On Tue, Jun 1, 2010 at 7:37 AM, Iain Reddick
iain.redd...@beatsystems.comwrote:

  

Say I have a form with a check box that, when checked, shows some other
field (i.e. it controls the visibility of other form components).

What is the best approach to handling this?

From what I understand, you have 3 options:

1. Add ajax behaviour to the check box (re-render relevant components).
2. Add javascript from the Java code (e.g. add some kind of show/hide
behaviour).
3. Add javascript directly to the HTML.

What are peoples experiences of the 3 methods, and which is best?

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






  



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



Re: Basic page routing

2010-05-28 Thread Iain Reddick
mountBookmarkablePage is a convenience method for mounting the most common URL 
form.

Look here for more info: 
https://cwiki.apache.org/WICKET/url-coding-strategies.html

You can also create your and mount your own URL decoding strategies.

- Original Message -
From: Mike Quilleash mike.quille...@junifersystems.com
To: users@wicket.apache.org
Sent: Friday, 28 May, 2010 11:43:00 AM
Subject: RE: Basic page routing

OK it seems I was missing the concept of bookmarkable page.

Adding the following line into my Application.init() solved it for that
page.

mountBookmarkablePage( /HomePage, HomePage.class );

I guess the default wicket config is to only allow direct URL access via
the / homepage and everything then navigates from there. To allow
additional direct URLs they need to be mounted.

-Original Message-
From: Mike Quilleash [mailto:mike.quille...@junifersystems.com]
Sent: den 27 maj 2010 19:34
To: users@wicket.apache.org
Subject: Basic page routing

Hi all,

I'm a new user to wicket. I'd heard some good things about it so I
thought I'd try it out for a mini-web project I have.

Using Wicket 1.4.18 and Java 6. I have an existing application using
Spring (@Autowired everywhere) and I want to use some of the existing
spring beans.

In the short term I've got an existing set of static web pages done by a
web designer as a template that I want to have the content driven from
our DB. Wicket seemed like a good choice because it doesn't touch the
view file much (add some wicket:id attributes).

I've got a basic Application up, running on embedded Jetty server, with
a welcome page which use @SpringBean to inject a couple of beans. That
all works fine.

However I can't figure out how to get URLs other than / to work. If I go
http://localhost:9090/ it works ok, I get the welcome page and the Java
executes. If I go to http://localhost:9090/HomePage.html it renders the
page but doesn't invoke the wicket Java component so the label doesn't
get rendered with the correct text. I'm sure this is incredibly basic,
but how do I get this to work properly?

Cheers.


My Application and home page classes below + web.xml.


// application class
public class WebPortalApplication extends WebApplication
{ public Class? extends Page getHomePage()
{ return HomePage.class;
}

@Override
protected void init()
{ ClassPathXmlApplicationContext applicationContext = new
ClassPathXmlApplicationContext( META-INF/config/spring/web-portal.xml
); applicationContext.start();

addComponentInstantiationListener( new SpringComponentInjector( this,
applicationContext, false ) );
} }


// home page
public class HomePage extends WebPage
{ @SpringBean
private HibernateOperations hibernateOperations;

public HomePage()
{ add( new Label( message, Hello World! ) );
} }



// web.xml
?xml version=1.0 encoding=UTF-8?
!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
http://java.sun.com/dtd/web-app_2_3.dtd;

web-app
display-nameWicket Examples/display-name
filter filter-nameHelloWorldApplication/filter-name
filter-classorg.apache.wicket.protocol.http.WicketFilter/filter-class
init-param param-nameapplicationClassName/param-name
param-valuecom.xxx.webportal.WebPortalApplication/param-value
/init-param /filter
filter-mapping filter-nameHelloWorldApplication/filter-name
url-pattern/*/url-pattern /filter-mapping
/web-app

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

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



Re: Form, panel and model reuse (newbie)

2010-04-29 Thread Iain Reddick

In reply to (6) and (7):

6) Do your construction in the constructor.

7) If the JFreeChartImage component implementation is the one seen 
here:  http://wiki.github.com/tita/tita/wicket-jfreechart-tutorial , 
then it needs re-worked, as it only supports a static image. Instead, 
the constructor should take a model that returns the JFreeChart, which 
should be generated from your data list each time getObject() is called 
(e.g. a dynamic model).


Anatoliy Knyazev wrote:

Dear Wicket users,

I'm seeking your advice on designing a small Wicket application. I'm new to
the list, hope I'm not violating any rules with such newbie questions. I've
studied the examples, the sample phonebook app and the mailing list archive
on Nabble, yet I haven't find the best practices for what I'm trying to
achieve. Please feel free to point me to an appropriate example if I'm
asking too much questions.

Basically, I'd like to have one form, used to search POJOs, shared
by several pages, each showing the set of POJOs in a different way, e.g. as
a number of JFreeChart images, as a ListView with limited number of items,
as a DataView with paging.

The Form seems pretty straightforward:

 public class TasksFilterForm extends FormTasksFilter
  

{

 public TasksFilterForm(String id, IModelTasksFilter tasksFilterModel)

 {

 super(id, new CompoundPropertyModelTasksFilter(tasksFilterModel));



 add(new DateTimeField(beginDate));


 add(new DateTimeField(endDate));

/*skipped the rest of fields

 }

}




In order to reuse it, I've created a Panel:

public class TasksFilterPanel extends Panel

{

 private IModelArrayListCleoTask tasksModel;


  

 public TasksFilterPanel(String id, final TasksDAO tasksDAO,
IModelTasksFilter tasksFilterModel, final IModelArrayListCleoTask
tasksModel)



 {

 super(id, tasksModel);

 this.tasksModel = tasksModel;

 add(new TasksFilterForm(tasksform, tasksFilterModel) {

 @Override

 protected void onSubmit()

 {

 tasksModel.setObject(tasksDAO.findByFilter(getModelObject()));

 }

 });

 }


1)I'm passing the IModelArrayListCleoTask tasksModel as the constructor
argument for the panel, is this correct?
2)And what is the most appropriate model for a list of POJOs? Can you show
me an example with an LDM, perhaps? What if I'd like to access it from the
DataView?
3)I'm not using any ORM, just simple DAOs. Which is the most elegant way to
inject them? I've checked the Spring+Wicket entry in the wiki, the approach
described there works for pages, not for panels.

The TasksFilterPanel is in turn used in a number of pages like this one:

  

 public class ClusterPage extends SVAStartPage

{

 private TasksFilter tasksFilter = new TasksFilter();

 ArrayListCleoTask tasks;

 private PropertyModelArrayListCleoTask tasksModel;




 public ClusterPage() throws SQLException
  

 {

 ArrayListString users = getDB().getCleoUsersArray();

 tasksFilter.setUsers(users);




 tasksModel = new PropertyModelArrayListCleoTask(this, tasks);
  

 add(new TasksFilterPanel(tasksformpanel, new TasksDAO(getDB()), new


PropertyModelTasksFilter(this, tasksFilter), tasksModel));
  

 add(new TasksChartPanel(taskschartpanel, tasksModel));

 }

}

4)Should I hold a reference to the tasksModel and tasksFilter from the


TasksPage (declare it as a field, as above) ?
5)Where should I populate the tasksFilter with default values (e.g. existing
users) - in the page? But then I'd have to copy/paste the code across
pages...

In order to display the POJOs, I've created a Panel that shows JFreeChart
images.

  

public class TasksChartPanel extends Panel



{

 private IModelArrayListCleoTask tasksModel;

 private JFreeChartImage cImage;


  

 public TasksChartPanel(String id, IModelArrayListCleoTask tasksModel)



 {

 super(id, tasksModel);

 this.tasksModel = tasksModel;

 }


  

 @Override



 protected void onBeforeRender()

 {

 super.onBeforeRender();


  

 ArrayListCleoTask tasks = tasksModel.getObject();




  

 IntervalXYDataset ds = ... /* produce a dataset from tasks */



 JFreeChart chart = ChartFactory.createScatterPlot(/* plot parameters */)

 if (cImage != null) remove(cImage);


  

 cImage = new JFreeChartImage(cImage, chart, 1500, 550);



 add(cImage);

 }


  

 @Override



 public boolean isVisible()

 {

 return tasksModel.getObject() != null;

 }

}

 6) I don't have a solid understanding of the request cycle yet, so I'm
doing all the processing in the onBeforeRender - is this correct?
7)With this approach, I have to manually remove and re-add the image every
time the set of POJOs changes - perhaps Wicket can take care of this, I just
didn't find a way?

That's it for now, I've tried to pinpoint the questions and not be too
vague.

Thank you in advance!
Anatoliy.

  



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

Re: New blog post Components v.s. Pages

2010-04-16 Thread Iain Reddick
Thanks - I think insights from more experienced wicket developers are very 
welcome at the moment.

I agree very much with what you say in the post that it's hard to find 
information about the best shape for a wicket application to meet your needs. 
Also the comment re component swapping - I certainly wasn't aware of this for 
quite some time, and it does shed a completely different light on how the 
framework can be used.

- Original Message -
From: Erwin Bolwidt ebolw...@worldturner.nl
To: users@wicket.apache.org
Sent: Friday, 16 April, 2010 2:35:50 PM
Subject: New blog post Components v.s. Pages

Hi,

I created a blog posted titled  Wicket best practices: Components v.s. 
Pages

http://blog.worldturner.com/worldturner/entry/wicket_best_practices_components_v

We've been using wicket at my current location for quite a few projects 
now and I'm writing a few blog entries on the things that we've found 
most convenient.

Regards,
   Erwin Bolwidt



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



Re: How to pass object as parameter to popup window

2010-04-14 Thread Iain Reddick
The data you want to show on the page is transient, so it isn't really 
bookmarkable.


Use a regular Link and give the page class a constructor that takes your 
DTO.


Mathias Nilsson wrote:

Session or pageParameters
  



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



Re: Forms in a base class

2010-04-07 Thread Iain Reddick

If you want to use inheritance:

Put your base form in a panel with the associated markup for the base 
fields (making sure there is a wicket:child / tag in the correct 
place). Then just extend this panel, adding the required child form 
components and supplying the appropriate markup extension (using 
wicket:extend). Remember that the child form components need to be 
added to the form in the base panel.


You could also use composition instead of inheritance:

Create a panel for the block of base form fields (e.g. name + 
description) and then add it to the child forms. Basically makes the 
base form components into a composite form component. Benefit of this 
method is that the overall form layout is controlled by the child form.


Elad Katz wrote:

Hi All, I'm sorry if this is off-topic but I have a problem that's very
similar and since you are talking about this here and seem to know what
you're doing, I was thinking you might be able to help.
I'm trying to create a basic form that all other forms in my project will
extend, it's gonna have basic fields like name and description, and the rest
(type specific fields) will be implemented by the children.
however, my question is, does a form have an associated html file like a
panel, or should all the children write the name and description fields in
their respective markups?
Now I saw that you're using a different methodology, which could maybe apply
to my use case, but this method makes more sense to me but maybe it's not
possible.
just to reiterate, here's what I'm trying to do:
Let's say i have 2 Pages A and B
Now these both share a form that has a name and description field (and a
specific ajax submit button and action)
so page 1 will have a line like:
add(new BaseForm());
and then we will add other fields to that form
and the same will be in page 2
but the question is, will this form have an associated html?
are we going to have to write the html with the name and description wicket
fields on each page that has that form, or is there a way to generalize it?
or should i just use the method defined in the thread above?

  



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



Re: Model property name different than wicket:id, is possible?

2009-10-21 Thread Iain Reddick

Hi,

You use it like this:

(assuming myModel is the compound property model)

Label idLabel = new Label(idLabel, myModel.bind(id));

This would  give component  id idLabel, using property id.

CompoundPropertyModel.bind() basically returns a PropertyModel.


iainr


Manuel Corrales wrote:

Ok, I have found a few things but still can't figure this out. Apparently
the BoundCompoundPropertyModel is what i need, but it is deprecated. And I
have read the javadoc but still can't figure out how to achieve having
wicket:id on HTML different than the property name in the model. The javadoc
mentions CompoundPropertyModel bind method, but can't figure out how to use
it.
Any help?

Thanks!

On Tue, Oct 20, 2009 at 3:57 PM, Manuel Corrales
manuelcorra...@gmail.comwrote:

  

Hello. I have a (i hope) reusable panel. This panel has a textField, a
hiddenField and a link that open up a modalWindow. Then you can select an
item from a list in the modal window and the field and hidden field
completes according to the selected value. I want the hidden field to be
binded with a property of the model I am using in a form (using
CompoundPropertyModel). I intend to use this panel in several forms in my
application, the problem I have is that the field name of the model object
is different on every form, and the wicket:id is the same (because it is the
same hiddenField).
How can I solve this? Is there a way of having a wicket:id with a different
name than a model property name?

Please ask for anything you need to help me, I don't know if I was clear on
my problem.

Thanks in advance!
Manuel.




  




Re: Transaction filters and redirection problem

2009-10-14 Thread Iain Reddick
For anyone in this situation (having to use a transaction filter), here 
is a solution that uses a response wrapper to delay the redirect until 
after the transaction has completed:


private class DelayedRedirectWrapper extends HttpServletResponseWrapper {

   private String redirectLocation;
  
   public DelayedRedirectWrapper(HttpServletResponse response) {

   super(response);
   }
  
   @Override

   public void sendRedirect(String location) throws IOException {
   redirectLocation = location;
   }
  
   public void doCachedRedirect() throws IOException {

   if ( redirectLocation != null ) {
   super.sendRedirect( redirectLocation );
   }
   }
}

This is then used in the filter's doFilter method like this:

...
DelayedRedirectWrapper responseWrapper = new DelayedRedirectWrapper( 
response );

beginTransaction();
filterChain.doFilter( request, wrappedResponse );
doCommit();
endTransaction();
responseWrapper.doCachedRedirect();
...

You could easily put the redirect-delaying code in it's own filter, for 
re-usabilty.



iainr

Iain Reddick wrote:

Hi,

I'm working on a Wicket / Hibernate / Spring app, with a configuration 
that uses spring's OSIV filter and my own transaction filter 
(basically a transaction per-request pattern).


I've run into a problem involving the order of transaction commits and 
redirect reponses (triggered by setResponsePage()).


The problem state is shown below:

1. User submits a form to create a new entity
2. Submit handler calls service to save new entity
3. Submit handler calls setResponsePage for page showing overview of 
new entity
4. Wicket request cycle completes (I'm assuming this is where wicket 
does the response.redirect())

5. Redirect is sent to browser
6. Browser requests new page, which fails as backing entity hasn't 
been persisted yet

7. Transaction is commited, and new entity is persisted

This is obviously a race condition between 6 and 7 (i.e. if 6 and 7 
are reversed, everything is OK).


Now, I'm aware that this isn't a wicket-specific issue, but the way 
wicket works as a framework means that this situation is much more 
likely than in a model 2 style framework.


Is transaction per-request using filters a reasonable configuration to 
use with wicket and, if so, how can I ensure that any redirects occur 
after my transaction has been committed?


(My guess is to use onBeginRequest and onEndRequest, but that assumes 
that onEndRequest happens before redirection)



iainr



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




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



Nullable resource link

2009-10-14 Thread Iain Reddick

Hi,

I need to display a resource link conditionally, based on whether a 
resource exists, or is null. The resource itself is bytes in a database 
and should not be anchored to a component.


How should I handle this, with regard to the resource being nullable?

Thanks.

iainr

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



Re: Nullable resource link

2009-10-14 Thread Iain Reddick
I'm fishing for best practice in this type of situation - do I use the 
solution you outlined, or do I add a simple invisible dummy link instead 
of the the resource link, or is there a better solution that I'm missing?


Luca Provenzani wrote:

i don't understand the problem

can't you check the resource before link is rendered?
You can create a new resource object empty in the case of null bytesand
setVisible(false) or extend link to do this automatically on empty
resource...

Luca

2009/10/14 Iain Reddick iain.redd...@beatsystems.com

  

Hi,

I need to display a resource link conditionally, based on whether a
resource exists, or is null. The resource itself is bytes in a database and
should not be anchored to a component.

How should I handle this, with regard to the resource being nullable?

Thanks.

iainr

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





  




Re: Nullable resource link

2009-10-14 Thread Iain Reddick

I think my best solution is to use a lightweight container like this:

public class NullableContainer extends WebMarkupContainer {

   public NullableContainer(String id) {
   super(id);
   }
  
   public NullableContainer(String id, IModel model) {

   super(id, model);
   }

   @Override
   protected void onBeforeRender() {
   super.onBeforeRender();
   onPopulate();   
   }
  
   /**

* Convenience method for lazy-adding of children
*/
   protected void onPopulate() {
   }

   @Override
   public boolean isVisible() {
   return getModelObject() != null;
   }
  
}


I then can override onPopulate() and add my children that depend on the 
nullable for construction.

It's basically the logic equivalent of if model is not null, add children.

Iain Reddick wrote:
I'm fishing for best practice in this type of situation - do I use the 
solution you outlined, or do I add a simple invisible dummy link 
instead of the the resource link, or is there a better solution that 
I'm missing?


Luca Provenzani wrote:

i don't understand the problem

can't you check the resource before link is rendered?
You can create a new resource object empty in the case of null 
bytesand

setVisible(false) or extend link to do this automatically on empty
resource...

Luca

2009/10/14 Iain Reddick iain.redd...@beatsystems.com

 

Hi,

I need to display a resource link conditionally, based on whether a
resource exists, or is null. The resource itself is bytes in a 
database and

should not be anchored to a component.

How should I handle this, with regard to the resource being nullable?

Thanks.

iainr

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





  






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



Re: Nullable resource link

2009-10-14 Thread Iain Reddick
I don't want to keep a reference to to the resources byte array in the 
link - I'd rather it was retrieved dynamically when requested. I also 
don't really like constructing a bunch of stuff that's never going to be 
used (and to be null - which is often a headache).


If I use the container component I outlined earlier, I can make the 
model object be the object that holds the resource data (a hibernate 
entity in my case). This means I can use getModelObject().getBytes(), 
etc. in the wrapped link construction. An additional plus point with 
this solution is that it is properly dynamic.


I think this works pretty well for this type of situation - there is no 
extra null checking required (as it's all in the wrapper) and the logic 
of it seems quite clear.


iainr

Luca Provenzani wrote:

why not something more directly like:

*public class ProvaLink extends ResourceLink {
ResourceReference resourceReference;


@Override
public boolean isVisible() {
if(resourceReference==null)return false;
else return true;
}

}

*hope to help...

Luca

2009/10/14 Iain Reddick iain.redd...@beatsystems.com

  

I think my best solution is to use a lightweight container like this:

public class NullableContainer extends WebMarkupContainer {

  public NullableContainer(String id) {
  super(id);
  }
public NullableContainer(String id, IModel model) {
  super(id, model);
  }

  @Override
  protected void onBeforeRender() {
  super.onBeforeRender();
  onPopulate(); }
/**
   * Convenience method for lazy-adding of children
   */
  protected void onPopulate() {
  }

  @Override
  public boolean isVisible() {
  return getModelObject() != null;
  }
 }

I then can override onPopulate() and add my children that depend on the
nullable for construction.
It's basically the logic equivalent of if model is not null, add
children.


Iain Reddick wrote:



I'm fishing for best practice in this type of situation - do I use the
solution you outlined, or do I add a simple invisible dummy link instead of
the the resource link, or is there a better solution that I'm missing?

Luca Provenzani wrote:

  

i don't understand the problem

can't you check the resource before link is rendered?
You can create a new resource object empty in the case of null
bytesand
setVisible(false) or extend link to do this automatically on empty
resource...

Luca

2009/10/14 Iain Reddick iain.redd...@beatsystems.com





Hi,

I need to display a resource link conditionally, based on whether a
resource exists, or is null. The resource itself is bytes in a database
and
should not be anchored to a component.

How should I handle this, with regard to the resource being nullable?

Thanks.

iainr

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




  





  

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





  




Re: Transaction filters and redirection problem

2009-10-14 Thread Iain Reddick

I'm considering it :)

There are a lot of benefits to doing transactions at service call level 
(truthful user feedback for one, not having to deal with requests for 
resources hitting the transaction filter being another). Spring's AOP 
support actually makes doing this as simple and maintainable as it's 
ever likely to be (@Transactional annotations, or marking a whole class 
as transactional), so if we decide it's necessary it is reasonably 
trivial to implement.


The main pro for per-request transactions is the complete seperation of 
transaction concerns.


In the meantime I have a Filter-based solution, or I can hook into the 
wicket request cycle.


iainr

For now,
James Carman wrote:

That's the problem with transaction-per-request.  Why not put your
transaction around your service/domain methods rather than around the
entire request cycle?

On Wed, Oct 14, 2009 at 5:19 AM, Iain Reddick
iain.redd...@beatsystems.com wrote:
  

For anyone in this situation (having to use a transaction filter), here is a
solution that uses a response wrapper to delay the redirect until after the
transaction has completed:

private class DelayedRedirectWrapper extends HttpServletResponseWrapper {

  private String redirectLocation;
public DelayedRedirectWrapper(HttpServletResponse response) {
  super(response);
  }
@Override
  public void sendRedirect(String location) throws IOException {
  redirectLocation = location;
  }
public void doCachedRedirect() throws IOException {
  if ( redirectLocation != null ) {
  super.sendRedirect( redirectLocation );
  }
  }
}

This is then used in the filter's doFilter method like this:

...
DelayedRedirectWrapper responseWrapper = new DelayedRedirectWrapper(
response );
beginTransaction();
filterChain.doFilter( request, wrappedResponse );
doCommit();
endTransaction();
responseWrapper.doCachedRedirect();
...

You could easily put the redirect-delaying code in it's own filter, for
re-usabilty.


iainr

Iain Reddick wrote:


Hi,

I'm working on a Wicket / Hibernate / Spring app, with a configuration
that uses spring's OSIV filter and my own transaction filter (basically a
transaction per-request pattern).

I've run into a problem involving the order of transaction commits and
redirect reponses (triggered by setResponsePage()).

The problem state is shown below:

1. User submits a form to create a new entity
2. Submit handler calls service to save new entity
3. Submit handler calls setResponsePage for page showing overview of new
entity
4. Wicket request cycle completes (I'm assuming this is where wicket does
the response.redirect())
5. Redirect is sent to browser
6. Browser requests new page, which fails as backing entity hasn't been
persisted yet
7. Transaction is commited, and new entity is persisted

This is obviously a race condition between 6 and 7 (i.e. if 6 and 7 are
reversed, everything is OK).

Now, I'm aware that this isn't a wicket-specific issue, but the way wicket
works as a framework means that this situation is much more likely than in a
model 2 style framework.

Is transaction per-request using filters a reasonable configuration to use
with wicket and, if so, how can I ensure that any redirects occur after my
transaction has been committed?

(My guess is to use onBeginRequest and onEndRequest, but that assumes that
onEndRequest happens before redirection)


iainr



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

  

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





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

  




Transaction filters and redirection problem

2009-10-09 Thread Iain Reddick

Hi,

I'm working on a Wicket / Hibernate / Spring app, with a configuration 
that uses spring's OSIV filter and my own transaction filter (basically 
a transaction per-request pattern).


I've run into a problem involving the order of transaction commits and 
redirect reponses (triggered by setResponsePage()).


The problem state is shown below:

1. User submits a form to create a new entity
2. Submit handler calls service to save new entity
3. Submit handler calls setResponsePage for page showing overview of new 
entity
4. Wicket request cycle completes (I'm assuming this is where wicket 
does the response.redirect())

5. Redirect is sent to browser
6. Browser requests new page, which fails as backing entity hasn't been 
persisted yet

7. Transaction is commited, and new entity is persisted

This is obviously a race condition between 6 and 7 (i.e. if 6 and 7 are 
reversed, everything is OK).


Now, I'm aware that this isn't a wicket-specific issue, but the way 
wicket works as a framework means that this situation is much more 
likely than in a model 2 style framework.


Is transaction per-request using filters a reasonable configuration to 
use with wicket and, if so, how can I ensure that any redirects occur 
after my transaction has been committed?


(My guess is to use onBeginRequest and onEndRequest, but that assumes 
that onEndRequest happens before redirection)



iainr



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



DropDownChoice and hibernate entities

2009-09-04 Thread Iain Reddick
I'm having difficulty in seeing the best-practice way of handling DDCs 
who's choices are hibernate persisted entities.


Obviously the selection in this case would be a reference to a persisted 
entity, which is inherently bad, as this would put the entity into the 
session and also result in a stale entity reference on the next 
request (assuming you are using OSIV filter).


I'm aware that on form submit, the HTML selection results in a fresh 
object being pulled from the DDC choice list and set as the selection. 
As long as the choices are loaded dynamically, this works (although the 
selected entity will end up in the session).


However, I am using a wizard in the app that I am working on and want to 
pre-select a choice from a list of persisted entities. This DDC is used 
in step 3, which gives a hibernate no session exception when when the 
step is reached. This is understandable, as wicket's rendering needs 
will cause an attempted initialization of the proxy, which is attached 
to an old session.


The obvious solution is for the selection to be the entity's id.

What is the best way of handling this situation?



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



Re: Dynamic Optgroups in Wicket

2009-09-01 Thread Iain Reddick
Looking at the API docs for the Select component, it would seem to be 
designed for more complex select situations (multi-select and 
optgroups). Unfortunately, I can't find any examples on using it with 
dynamically generated optgroups.


Can anyone clarify how you would use the component like this, or suggest 
an alternative?



Pedro Santos wrote:

correction:
In your application u CAN populate your list of options, and pass it to an
similar component.

On Tue, Sep 1, 2009 at 9:07 AM, Pedro Santos pedros...@gmail.com wrote:

  

Gary,

Take a look at 
wicket.markup.html.form.DropDownChoicehttp://wicketstuff.org/wicket13/compref/;jsessionid=9632D2AC608C8E9715009EAA5EEBD3FF?wicket:bookmarkablePage=:org.apache.wicket.examples.compref.DropDownChoicePageat
http://wicketstuff.org/wicket13/compref/
on these examples, the option values ar not fixed in markup with no
wicket:ids. They are passed to constructor of 2 lists that are used by 
DropDownChoice
component model. In your application u can't populate your list of
options, and pass it to an similar component.


On Tue, Sep 1, 2009 at 8:57 AM, gary black gar20...@yahoo.com wrote:



Hi,I am kind of new to Wicket and am having a difficult time finding some
decent info on creating optgroups within selects.I basically have a
structured list in my DB which in turn has children - perfect solution would
be to use dynamically generated optgroups with their children which will of
course be option tags.All the examples containing optgroups seem to have the
optgroups fixed in markup with no wicket:ids.Any thoughts would be most
welcomed.Gary



  





  



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



Re: Truncating DataTable content

2009-08-24 Thread Iain Reddick
Create some kind of generic StringTruncatingModel that does the ... 
truncation on getObject().


In DataTable.populateItem(), wrap the row model in a 
StringTruncatingModel, before passing to the Label being used to show 
the string?


Linda van der Pal wrote:
I thought it would be a cool idea to truncate the data in my table, so 
the data isn't spread over several lines in the table row. It should 
then be possible to read the complete content in a tooltip. After 
digging into the code of the AjaxFallbackDefaultDataTable I found that 
to do this I would have to alter/copy the entire structure, as it 
seemed the code I need to alter is inside AbstractDataGridView.


This seems like an aweful lot of work for such a relatively small 
feature. So my question is, has anybody ever tried this before? And 
even if not, do you have a better idea how to tackle this?


So I want the content of a single field to go from this:

Struts: the
complete
reference

to

Struts: the... (with a tooltip listing the whole title)


Regards,
Linda

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




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



Re: Truncating DataTable content

2009-08-24 Thread Iain Reddick

Like this (for a basic html tooltip):

cellItem.add( new SimpleAttributeModifier(title, maximalStringModel) );

Or use one of the js-library wrappers from Wicket Stuff for something 
slicker?


Linda van der Pal wrote:
Thanks for the ideas, but the truncating itself is not the main 
problem. (I could easily truncate the data in the 
SortableDataProvider.) The main problem that requires met to dive 
deeply into the code is my requirement to also show the full data in a 
tooltip.


Regards,
Linda

Iain Reddick wrote:
Create some kind of generic StringTruncatingModel that does the ... 
truncation on getObject().


In DataTable.populateItem(), wrap the row model in a 
StringTruncatingModel, before passing to the Label being used to show 
the string?


Linda van der Pal wrote:
I thought it would be a cool idea to truncate the data in my table, 
so the data isn't spread over several lines in the table row. It 
should then be possible to read the complete content in a tooltip. 
After digging into the code of the AjaxFallbackDefaultDataTable I 
found that to do this I would have to alter/copy the entire 
structure, as it seemed the code I need to alter is inside 
AbstractDataGridView.


This seems like an aweful lot of work for such a relatively small 
feature. So my question is, has anybody ever tried this before? And 
even if not, do you have a better idea how to tackle this?


So I want the content of a single field to go from this:

Struts: the
complete
reference

to

Struts: the... (with a tooltip listing the whole title)


Regards,
Linda

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




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



No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.5.409 / Virus Database: 
270.13.65/2322 - Release Date: 08/23/09 18:03:00


  



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




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



Re: Datepicker popup when textfield is selected

2009-08-14 Thread Iain Reddick

see: org.apache.wicket.extensions.yui.calendar.DateField

http://static.ddpoker.com/javadoc/wicket-datetime/1.3.3/index.html

copenhag copenhagen wrote:

Hi,

Would it be possible to make the datepicker popup whenever a textfield is
selected?

Thereby the textfield will be no editable, but only the datepicker will
modify the textfield value.

Here is an example on the behaviour i am looking for with the wicket
datepicker object:

http://blog.davglass.com/files/yui/cal2/

Best Regards
Cem...

  



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



Re: Datepicker popup when textfield is selected

2009-08-14 Thread Iain Reddick

Sorry - misread your question.

Iain Reddick wrote:

see: org.apache.wicket.extensions.yui.calendar.DateField

http://static.ddpoker.com/javadoc/wicket-datetime/1.3.3/index.html

copenhag copenhagen wrote:

Hi,

Would it be possible to make the datepicker popup whenever a 
textfield is

selected?

Thereby the textfield will be no editable, but only the datepicker will
modify the textfield value.

Here is an example on the behaviour i am looking for with the wicket
datepicker object:

http://blog.davglass.com/files/yui/cal2/

Best Regards
Cem...

  



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




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



Re: Components and nullable data

2009-08-03 Thread Iain Reddick
Thanks - that's very neat. It also made me spend some time looking at 
that area of the framework, which will be useful in the future.


With that strategey and annotation, handling nullable data is a 
non-issue when a component uses a model for all its data requirements. 
There are obviously complications if a component requires secondary 
construction data related to the nullable, but I need to reflect on 
whether this is ever really an issue.


Igor Vaynberg wrote:

instead of creating a lot of subclasses you can use the
iauthorizationstrategy to do this:

onaction(component, action) {
 if (action==component.render) {
  if (component.hasannotation(@HideIfModelIsNull)) {
  return false;
  }
  }
  return true;
}

you get this behavior for any component via a simple annot.

-igor

On Fri, Jul 31, 2009 at 6:39 AM, Iain
Reddickiain.redd...@beatsystems.com wrote:
  

Thanks for the reply - I think I'm perhaps trying to bend the framework
rather than work with it.

I suppose I'm really wondering about the following kind of thing, and
whether it's worth trying to build similar re-usable components:

public class NullableLabel extends Label {
 private boolean visibleWhenNull = true;
 ...
 public boolean isVisible() {
  if ( getModelObject() != null ) {
return true;
  } else {
return visibleWhenNull;
  }
 }

 public void setVisibleWhenNull(...) {
  ...
 }
}
This adds simple, configurable null-aware behaviour to a label.

Is this kind of thinking worth pursuing?



add(new LinkUser(editgroup, user) {
 onclick() {
 ...
 }

 isvisible() {
 return user.getgroup()!=null;
 }
}

?

-igor

2009/7/30 Iain Reddick iain.redd...@beatsystems.com:
  

Hi all,

One of the difficulties I am finding with wicket is the best practice
when
displaying/using data that is potentially null.

Example:

I have a user object which has a nullable group property. I want to
show
a link to the group details page when the group property is not null,
but
show nothing otherwise (let's keep this simple).

My issue is that either way, I have to construct the link component and
add
it to the page, whether I want it is visible or not. This is tricky at
the
best of times, as I must always carry out a lot of  is null logic.

The construction issue becomes multiplied if I want the same behaviour
on a
stateful page (i.e. the link, etc. can be appropriate for linking to the
group, or be null and not visible and can switch between the two
states).

My question is - am I missing something, or do I just need to have a
better
strategy for this type of situation?

If the answer is the latter, does anyone have any tips and/or components
that would cut down on the extra coding?

Thanks

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




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


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





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

  



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



Components and nullable data

2009-07-31 Thread Iain Reddick

Thanks for the reply - I think I'm perhaps trying to bend the framework rather 
than work with it.

I suppose I'm really wondering about the following kind of thing, and whether 
it's worth trying to build similar re-usable components:

public class NullableLabel extends Label {
 private boolean visibleWhenNull = true;
 ...
 public boolean isVisible() {
   if ( getModelObject() != null ) {
 return true;
   } else {
 return visibleWhenNull;
   }
 }

 public void setVisibleWhenNull(...) {
   ...
 }
}
This adds simple, configurable null-aware behaviour to a label.

Is this kind of thinking worth pursuing?



add(new LinkUser(editgroup, user) {
 onclick() {
  ...
 }

 isvisible() {
  return user.getgroup()!=null;
 }
}

?

-igor

2009/7/30 Iain Reddick iain.redd...@beatsystems.com:



 Hi all,

 One of the difficulties I am finding with wicket is the best practice when
 displaying/using data that is potentially null.

 Example:

 I have a user object which has a nullable group property. I want to show
 a link to the group details page when the group property is not null, but
 show nothing otherwise (let's keep this simple).

 My issue is that either way, I have to construct the link component and add
 it to the page, whether I want it is visible or not. This is tricky at the
 best of times, as I must always carry out a lot of  is null logic.

 The construction issue becomes multiplied if I want the same behaviour on a
 stateful page (i.e. the link, etc. can be appropriate for linking to the
 group, or be null and not visible and can switch between the two states).

 My question is - am I missing something, or do I just need to have a better
 strategy for this type of situation?

 If the answer is the latter, does anyone have any tips and/or components
 that would cut down on the extra coding?

 Thanks

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


  


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


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



Re: Beginner problems with TabbedPanel

2009-07-30 Thread Iain Reddick

Surely this is what you want for a non-ajax solution:

class MyPage extends Page {
 private TabbedPanel tabPanel;
 ...
 public MyPage() {
   tabPanel = new TabPanel(...);
   add( tabPanel );
   ...
   confirmBtn = new Button(confirm) {
 private static final long serialVersionUID = 1L;

 @Override
 public void onSubmit() {
   tabPanel.setSelectedTab(0);
 }
   };
   add( confirmBtn );
 }
}

And for an ajax solution, just add tabPanel to the ajax request in the 
submit handler?


Sorry if this isn't right, but I don't see what the issue is.

Gajo Csaba wrote:
That may be true Igor, but there doesn't seem to be any other solution 
to make this work:


confirmBtn = new Button(confirm) {
   private static final long serialVersionUID = 1L;
   @Override
   public void onSubmit() {
   Page page = getPage();
   TabbedPanel tabPanel = 
((HomePage)getWebPage()).getTabbedPanel();  
tabPanel.setSelectedTab(0);

   setResponsePage(page);
   }
};

I cannot repaint the tabPanel (either with render() or 
renderComponent()), cannot repaint the whole page, cannot go with 
Linda's suggestion because even after Martin's fix it still generates 
an error. I just want to set the tabbedpanel's selected tab to be #0. 
It's not that complicated. In Swing, I would write: 
tabPanel.setSelectedTab(0); and that would be it.


Now I'm not very critical about how software systems are constructed, 
and don't care if some features may cause minor side-effects, or cause 
the programmer to write a bit hacky code. But having the 
setSelectedTab() method detach the page for no apparent reason and 
without any warning is as bad as having a goto command in a 
programming language. Side effects are one of the first thing that 
you learn in college, and why you should avoid them at all cost. The 
documentation for the setSelectedTab() says sets the selected tab. 
What it's missing is a big warning sign WARNING IT DETACHES THE 
PAGE WILL CAUSE UNRELATED ERROR MESSAGES!!!


So what is your suggestion Igor? How should I use the framework properly?

Regards,
Csaba


Igor Vaynberg wrote:

of course there is no reason to use an ajax link if all you are going
to do is repaint the entire page anyways...

also code like this: setresponsepage(getpage()) is always suspect. by
default wicket repaints the same page so there is no need to call
this. when inside ajax you should add components you want repainted to
the request target that is passed in to you.

setresponsepage should only be used when actually going to a different
page. you are not using the framework properly...

-igor

2009/7/29 Martin Makundi martin.maku...@koodaripalvelut.com:
 

1.

You can fix linda's suggestion by calling setOutputMarkupId(true) on
your tabbedpanel.

2. The reason for:

10:42:27 ERROR [RequestCycle] - No Page found for component
[MarkupContainer [Component id = panel]]
java.lang.IllegalStateException: No Page found for component
[MarkupContainer [Component id = panel]]
 at org.apache.wicket.Component.getPage(Component.java:1729)

Is that you just called setSelectedTab() which DISCONNECTS the current
tab from the page hierarcy. Try getting the page before that:
onClick() {
 Page page = getPage();
 tabbedPanel.setSelectedTab(0);
 setREsponsePage(page);
}


**
Martin


**
Martin

2009/7/29 Gajo Csaba cg...@i-rose.si:
   

Hmm there's something very wrong here...

I try to refresh the page like this:
setResponsePage(getPage());

When this is the only action, the current page is refreshed. When I 
write

setSelectedTab(0) above it, I get an error.

10:42:27 ERROR [RequestCycle] - No Page found for component 
[MarkupContainer

[Component id = panel]]
java.lang.IllegalStateException: No Page found for component
[MarkupContainer [Component id = panel]]
  at org.apache.wicket.Component.getPage(Component.java:1729)
  at
si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:160) 


  at
si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45) 


  at
si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95) 


  at
org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74) 


  at
org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140) 


  at
org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166) 


  at
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299) 


  at
org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105) 


  at
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92) 


  at
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192) 


  at org.apache.wicket.RequestCycle.step(RequestCycle.java:1271)
  at 

Re: Beginner problems with TabbedPanel

2009-07-30 Thread Iain Reddick

Sorry - I've re-read your initial post and see what your issue is.

Iain Reddick wrote:

Surely this is what you want for a non-ajax solution:

class MyPage extends Page {
 private TabbedPanel tabPanel;
 ...
 public MyPage() {
   tabPanel = new TabPanel(...);
   add( tabPanel );
   ...
   confirmBtn = new Button(confirm) {
 private static final long serialVersionUID = 1L;

 @Override
 public void onSubmit() {
   tabPanel.setSelectedTab(0);
 }
   };
   add( confirmBtn );
 }
}

And for an ajax solution, just add tabPanel to the ajax request in the 
submit handler?


Sorry if this isn't right, but I don't see what the issue is.

Gajo Csaba wrote:
That may be true Igor, but there doesn't seem to be any other 
solution to make this work:


confirmBtn = new Button(confirm) {
   private static final long serialVersionUID = 1L;
   @Override
   public void onSubmit() {
   Page page = getPage();
   TabbedPanel tabPanel = 
((HomePage)getWebPage()).getTabbedPanel();  
tabPanel.setSelectedTab(0);

   setResponsePage(page);
   }
};

I cannot repaint the tabPanel (either with render() or 
renderComponent()), cannot repaint the whole page, cannot go with 
Linda's suggestion because even after Martin's fix it still generates 
an error. I just want to set the tabbedpanel's selected tab to be #0. 
It's not that complicated. In Swing, I would write: 
tabPanel.setSelectedTab(0); and that would be it.


Now I'm not very critical about how software systems are constructed, 
and don't care if some features may cause minor side-effects, or 
cause the programmer to write a bit hacky code. But having the 
setSelectedTab() method detach the page for no apparent reason and 
without any warning is as bad as having a goto command in a 
programming language. Side effects are one of the first thing that 
you learn in college, and why you should avoid them at all cost. The 
documentation for the setSelectedTab() says sets the selected tab. 
What it's missing is a big warning sign WARNING IT DETACHES THE 
PAGE WILL CAUSE UNRELATED ERROR MESSAGES!!!


So what is your suggestion Igor? How should I use the framework 
properly?


Regards,
Csaba


Igor Vaynberg wrote:

of course there is no reason to use an ajax link if all you are going
to do is repaint the entire page anyways...

also code like this: setresponsepage(getpage()) is always suspect. by
default wicket repaints the same page so there is no need to call
this. when inside ajax you should add components you want repainted to
the request target that is passed in to you.

setresponsepage should only be used when actually going to a different
page. you are not using the framework properly...

-igor

2009/7/29 Martin Makundi martin.maku...@koodaripalvelut.com:
 

1.

You can fix linda's suggestion by calling setOutputMarkupId(true) on
your tabbedpanel.

2. The reason for:

10:42:27 ERROR [RequestCycle] - No Page found for component
[MarkupContainer [Component id = panel]]
java.lang.IllegalStateException: No Page found for component
[MarkupContainer [Component id = panel]]
 at org.apache.wicket.Component.getPage(Component.java:1729)

Is that you just called setSelectedTab() which DISCONNECTS the current
tab from the page hierarcy. Try getting the page before that:
onClick() {
 Page page = getPage();
 tabbedPanel.setSelectedTab(0);
 setREsponsePage(page);
}


**
Martin


**
Martin

2009/7/29 Gajo Csaba cg...@i-rose.si:
  

Hmm there's something very wrong here...

I try to refresh the page like this:
setResponsePage(getPage());

When this is the only action, the current page is refreshed. When 
I write

setSelectedTab(0) above it, I get an error.

10:42:27 ERROR [RequestCycle] - No Page found for component 
[MarkupContainer

[Component id = panel]]
java.lang.IllegalStateException: No Page found for component
[MarkupContainer [Component id = panel]]
  at org.apache.wicket.Component.getPage(Component.java:1729)
  at
si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:160) 


  at
si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45) 


  at
si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95) 


  at
org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74) 


  at
org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140) 


  at
org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166) 


  at
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299) 


  at
org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105) 


  at
org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92) 


  at
org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1192

Re: Beginner problems with TabbedPanel

2009-07-30 Thread Iain Reddick


confirmBtn = new Button(confirm) {
  private static final long serialVersionUID = 1L;
  @Override
  public void onSubmit() {
  Page homePage = (HomePage)getPage();
  homePage.getTabbedPanel().setSelectedTab(0);
  }
};

Iain Reddick wrote:

Sorry - I've re-read your initial post and see what your issue is.

Iain Reddick wrote:

Surely this is what you want for a non-ajax solution:

class MyPage extends Page {
 private TabbedPanel tabPanel;
 ...
 public MyPage() {
   tabPanel = new TabPanel(...);
   add( tabPanel );
   ...
   confirmBtn = new Button(confirm) {
 private static final long serialVersionUID = 1L;

 @Override
 public void onSubmit() {
   tabPanel.setSelectedTab(0);
 }
   };
   add( confirmBtn );
 }
}

And for an ajax solution, just add tabPanel to the ajax request in 
the submit handler?


Sorry if this isn't right, but I don't see what the issue is.

Gajo Csaba wrote:
That may be true Igor, but there doesn't seem to be any other 
solution to make this work:


confirmBtn = new Button(confirm) {
   private static final long serialVersionUID = 1L;
   @Override
   public void onSubmit() {
   Page page = getPage();
   TabbedPanel tabPanel = 
((HomePage)getWebPage()).getTabbedPanel();  
tabPanel.setSelectedTab(0);

   setResponsePage(page);
   }
};

I cannot repaint the tabPanel (either with render() or 
renderComponent()), cannot repaint the whole page, cannot go with 
Linda's suggestion because even after Martin's fix it still 
generates an error. I just want to set the tabbedpanel's selected 
tab to be #0. It's not that complicated. In Swing, I would write: 
tabPanel.setSelectedTab(0); and that would be it.


Now I'm not very critical about how software systems are 
constructed, and don't care if some features may cause minor 
side-effects, or cause the programmer to write a bit hacky code. But 
having the setSelectedTab() method detach the page for no apparent 
reason and without any warning is as bad as having a goto command in 
a programming language. Side effects are one of the first thing 
that you learn in college, and why you should avoid them at all 
cost. The documentation for the setSelectedTab() says sets the 
selected tab. What it's missing is a big warning sign WARNING 
IT DETACHES THE PAGE WILL CAUSE UNRELATED ERROR MESSAGES!!!


So what is your suggestion Igor? How should I use the framework 
properly?


Regards,
Csaba


Igor Vaynberg wrote:

of course there is no reason to use an ajax link if all you are going
to do is repaint the entire page anyways...

also code like this: setresponsepage(getpage()) is always suspect. by
default wicket repaints the same page so there is no need to call
this. when inside ajax you should add components you want repainted to
the request target that is passed in to you.

setresponsepage should only be used when actually going to a different
page. you are not using the framework properly...

-igor

2009/7/29 Martin Makundi martin.maku...@koodaripalvelut.com:
 

1.

You can fix linda's suggestion by calling setOutputMarkupId(true) on
your tabbedpanel.

2. The reason for:

10:42:27 ERROR [RequestCycle] - No Page found for component
[MarkupContainer [Component id = panel]]
java.lang.IllegalStateException: No Page found for component
[MarkupContainer [Component id = panel]]
 at org.apache.wicket.Component.getPage(Component.java:1729)

Is that you just called setSelectedTab() which DISCONNECTS the 
current

tab from the page hierarcy. Try getting the page before that:
onClick() {
 Page page = getPage();
 tabbedPanel.setSelectedTab(0);
 setREsponsePage(page);
}


**
Martin


**
Martin

2009/7/29 Gajo Csaba cg...@i-rose.si:
 

Hmm there's something very wrong here...

I try to refresh the page like this:
setResponsePage(getPage());

When this is the only action, the current page is refreshed. When 
I write

setSelectedTab(0) above it, I get an error.

10:42:27 ERROR [RequestCycle] - No Page found for component 
[MarkupContainer

[Component id = panel]]
java.lang.IllegalStateException: No Page found for component
[MarkupContainer [Component id = panel]]
  at org.apache.wicket.Component.getPage(Component.java:1729)
  at
si.irose.iprojekti.treeview.TreeViewPanel.deleteBtnClick(TreeViewPanel.java:160) 


  at
si.irose.iprojekti.treeview.TreeViewPanel.access$200(TreeViewPanel.java:45) 


  at
si.irose.iprojekti.treeview.TreeViewPanel$3.onSubmit(TreeViewPanel.java:95) 


  at
org.apache.wicket.ajax.markup.html.form.AjaxFallbackButton$1.onSubmit(AjaxFallbackButton.java:74) 


  at
org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:140) 


  at
org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:166) 


  at
org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:299) 


  at
org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents

Components and nullable data

2009-07-30 Thread Iain Reddick

Hi all,

One of the difficulties I am finding with wicket is the best practice 
when displaying/using data that is potentially null.


Example:

I have a user object which has a nullable group property. I want to 
show a link to the group details page when the group property is not 
null, but show nothing otherwise (let's keep this simple).


My issue is that either way, I have to construct the link component and 
add it to the page, whether I want it is visible or not. This is tricky 
at the best of times, as I must always carry out a lot of  is null logic.


The construction issue becomes multiplied if I want the same behaviour 
on a stateful page (i.e. the link, etc. can be appropriate for linking 
to the group, or be null and not visible and can switch between the two 
states).


My question is - am I missing something, or do I just need to have a 
better strategy for this type of situation?


If the answer is the latter, does anyone have any tips and/or components 
that would cut down on the extra coding?


Thanks

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



Re: Disabled Auto link bookmarkable page

2009-07-27 Thread Iain Reddick

I guess the view is that using a span gives safe markup in any situation.

The disableLink() method can be overriden it if you need cleaner markup 
in a particular situation.


Cassio wrote:

But it would change only the em and /em default markups and not the
span that replace the a tag at
org.apache.wicket.markup.html.link.AbstractLink.disableLink(final
ComponentTag tag) method.

code:

// Change anchor link to span tag
tag.setName(span);



2009/7/24 Iain Reddick iain.redd...@beatsystems.com

  

The wrapping markup used can be set via methods in AbstractLink:

setAfterDisabledLink()
setBeforeDisabledLink()

or, you can set a default at application level:

setDefaultAfterDisabledLink()
setDefaultBeforeDisabledLink()



Cassio wrote:



Hello everybody!

Does anyone know for what reason an disabled auto link gets nested inside
a
span tag?
It's messing the page layout...

Thanks...

Cássio Landim Ribeiro



  

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





  



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



Re: Disabled Auto link bookmarkable page

2009-07-24 Thread Iain Reddick

The wrapping markup used can be set via methods in AbstractLink:

setAfterDisabledLink()
setBeforeDisabledLink()

or, you can set a default at application level:

setDefaultAfterDisabledLink()
setDefaultBeforeDisabledLink()


Cassio wrote:

Hello everybody!

Does anyone know for what reason an disabled auto link gets nested inside a
span tag?
It's messing the page layout...

Thanks...

Cássio Landim Ribeiro

  



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



Re: Generic Navigation Panel

2009-07-22 Thread Iain Reddick
You can actually configure the tags that are put around a disabled link 
at application level, like this:


getMarkupSettings().setDefaultBeforeDisabledLink(  );
getMarkupSettings().setDefaultAfterDisabledLink(  );

This would give span*linktext*/span for disabled lnks (such as an 
autolink to the current page).


Matthias Keller wrote:

Hi

I'm creating a new website with wicket which should have a normal 
navigation bar. I'd like to be able to detect whether a link points to 
the current page to give the surrounding div a special class.

For example on page1:
div class=activeLink
   a href=page1page1/a
/div
div
   a href=page2page2/a
/div

I thought about autolinking which does that automatically, except it 
adds very ugly spanem tags. I also don't want to change this 
globally just to have a nicer navigation autolinking going. In 
addition this would be tricky as I need the divs around the links, 
but with different CSS classes.


I'm thinking about creating a panel (representing the div with the 
link) which then adds the link and which has to be created by giving 
the current page via the constructor in order for it to find out if 
the link represents the current page. But this seems to be very 
complicated so I think there must be a more elegant solution for that, 
as this requirement surely isn't anything new?!


Thanks for your hints

Matt




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



Re: Accessing the rowItem from the populateItem of a column

2009-07-16 Thread Iain Reddick

That should work fine in 1.3.3.

I thought this was what you were looking for:

public class SomeColumnClass extends AbstractColumn {
   public void populateItem( Item cellItem, String componentId, IModel 
rowModel ) {  
   MarkupContainer rowItem = cellItem.getParent().getParent();

   rowItem.add( new SomeBehaviour() );
   }
}

?

Lorenzo Bolzani wrote:

2009/7/15 Iain Reddick iain.redd...@beatsystems.com:
  

cellItem.getParent().getParent() will get the row component, but it's not a
very clean solution.




Hi, thanks for the replies.

I'm using wicket 1.3.3 and this method was not yet present. I'm not
upgrading due to some problems with ajax tests and WicketTester.

Anyway I cannot see many other options, other than using a ListView
instead of a table or the one described above.


Bye

Lorenzo

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

  



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



Re: Accessing the rowItem from the populateItem of a column

2009-07-15 Thread Iain Reddick
cellItem.getParent().getParent() will get the row component, but it's 
not a very clean solution.


Pierre Goupil wrote:

Hello,

Can't you just make the parent's field final and use : Parent.this.cellItem
?

HTH,

Pierre


On Wed, Jul 15, 2009 at 11:33 AM, Lorenzo Bolzani l.bolz...@gmail.comwrote:

  

Hi all,
I need to do an ajax refresh of a whole line of a table.

On the left of the table there is a dropdown and when the selection is
changed the other fields of the table should be refreshed accordingly.

So I have a column where the dropdown is defined and here I add an
onchange behaviour where I should add the entire row to the ajax
target.

But in the populateItem of ICellPopulator I have no access to the rowItem.

With this hack

Object repeatingView =
ReflectionUtil.getPrivateField(cellItem, parent);
return (Item) ReflectionUtil.getPrivateField(repeatingView,
parent);

I can reach the rowItem and everything works perfectly.

Now I was looking for a cleaner way to do this.

The item I need is the one that is received from the
populateItem(Item) of AbstractDataGridView so I could override this
call super and add the tracking of the current rowItem making it
available, as a field, in subsequent ICellPopulator.populateItem
calls. Not very nice anyway.

Do you have any suggestion? Could a getParent method added to cellItem
to access to the rowItem it belongs to?

Thanks, bye

Lorenzo
--
It has to start somewhere, It has to start sometime.
What better place than here, what better time than now?

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






  



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



XsltTransformerBehavior without component tags

2009-07-13 Thread Iain Reddick

Hi,

We are trying to use XsltTransformerBehavior with pre-existing XSLT 
templates to display various kinds of XML data in a panel.


While this is working fine, it looks as if we will have to modify our 
XSL to take account of the fact that the transforming component's tags 
become the root element before the XML is put through the transformer. 
This is a problem for us, as we would have a large number of templates 
to update.


Assuming our source XML is well-formed, is it possible to not wrap the 
source data in the component tags before transformation occurs? I've 
tried simply setting renderBodyOnly to true, but this causes an XSLT 
parsing exception.


Any ideas would be welcome.



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



Re: Best way to do a tracking Nav Bar in Wicket?

2009-06-04 Thread Iain Reddick
Why not just have each page be able to report the section it belongs to 
( e.g. getSection() method ). The section navbar component can then 
simply call that method on it's page and update the bar accordingly.


Ben Hutchison wrote:
We need to build a Nav Bar that tracks  visually indicates what 
section of the site the user is in:


- 5 section links across the top of the site which go to section entry 
pages, eg Buyers, Sellers, Knowledge Base, Forum etc
- All pages in the site live in a section, but there are more than 1 
pages in each section

- The nav bar should show what section the current page is in.
- Some links take the user to a page in another section. In this case, 
the nav bar should update when the page change occurs.


This problem requires a mapping from Page = Section. So far, I 
haven't found anything preexisting in Wicket that handles this 
use-case or mapping. Any suggestions for something I could re-use, or 
examples, appreciated.


Thanks
Ben

PS Thank you also for the responses to my recent question on 
context-sensitive authorization, v useful.





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