Re: How to remove panel in a list?

2013-02-13 Thread vineet semwal
Hi,

1)use dataview +reuseifmodelsequalstrategy
2) model object should be your data object and not component,
see examples  in the wicket distribution.

On Wed, Feb 13, 2013 at 3:06 AM, Celia Xu  wrote:
> Hi,
> I want to use a repeater to paint my panels so now I have a listview which
> only remove the last item in the list. I browsed and found some people
> recommend to use refreshingView but I'm not sure how to populate my panel
> items.
> any suggestion?
> thanks
>
> LinkedList myPanelList= new LinkedList();
>
> RefreshingView refreshingView = new RefreshingView>("myPanel "){
> @Override
> protected Iterator> getItemModels() {
>
> *//HOW to convert my panel object to IModel?*
> }
>
> @Override
> protected void populateItem(final Item item) {
>  item.add(item.getModelObject());
>  int index = item.getIndex() ;
>  item.add(new Label("index", (index +1 )+ "."));
>
> AjaxFallbackButton removePanelLink = new
> AjaxFallbackButton("remove", form) {
> @Override
> protected void onSubmit(AjaxRequestTarget
> ajaxRequestTarget, Form form) {
> interactivePanels.remove(item.getIndex());
> if (ajaxRequestTarget != null) {
> ajaxRequestTarget.add(wmc);
> }
> }
> };
>
> removePanelLink.setDefaultFormProcessing(false);
> removePanelLink.setOutputMarkupId(true);
> item.add(removePanelLink);
> }
> }.setItemReuseStrategy(new ReuseIfModelsEqualStrategy());
>
>
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/How-to-remove-panel-in-a-list-tp4656293.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
>



-- 
regards,

Vineet Semwal

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



Re: AbstractAjaxTimerBehavior Problem

2013-02-13 Thread Ernesto Reinaldo Barreiro
Hi,

Ajax request are queued so if you do

while (true) {
//
}


then this thread will be locked till you get a time out... Maybe what you
want is

1- Create some "context" for monitoring progress
2- On onclick start a new thread and pass it context in 1). This thread
will increase progress in background.
3- Timer will also have access to context and update progress according to
it.




On Tue, Feb 12, 2013 at 8:44 AM, smöker  wrote:

> hi guys,
>
> i'm running into problems using AbstractAjaxTimerBehavior in combination
> with ordinary AjaxLinks/AjaxButtons.
>
> The AbstractAjaxTimerBehavior stops working as soon as another
> AjaxFunctionality within the same page is executed by
> AjaxLinks/AjaxButtons.
>
> The purpose of my tests : I'd like to show up a Progress Bar, as soon as a
> Long Running Process is started by an ajax button/link.
>
> The Problem : The Timer stops, as soon as another ajax functionality is
> executed.
>
> Here's a snippet representing the problem (Wicket 1.5.7, jquery-ui-core
> 1.3.1) :
>
>
>
>
>
>
> Any Help to point me into the right direction would be welcome!
>
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/AbstractAjaxTimerBehavior-Problem-tp4656255.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
>
>


-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ 


Re: problems with "AJAX function" processEvaluation (1.4.x - 6.x)

2013-02-13 Thread Ernesto Reinaldo Barreiro
Hi,

On Wed, Feb 13, 2013 at 8:38 AM, Ernesto Reinaldo Barreiro <
reier...@gmail.com> wrote:

> Hi,
>
> We are having problems on Wicket 1.4.x with and "AJAX function"
> processEvaluation... and I see the code is practically the same at 6.x. So,
> let's bring the subject to the list...
>
> Our problem is that after evaluating some expressions with errors, screen
> "freezes" because post-call handlers are not called. Problem seems to be
> related to the code.
>
> // test if the javascript is in form of
> identifier|code
> // if it is, we allow for letting the javascript decide when the rest of
> processing will continue
>  // by invoking identifier();
> var res = text.match(new
> RegExp("^([a-z|A-Z_][a-z|A-Z|0-9_]*)\\|((.|\\n)*)$"));
>
> if (res !== null) {
> var f = jQuery.noop;
> text = "f = function(" + res[1] + ") {" + res[2] + "};";
>
> try {
> // do the evaluation
> eval(text);
>  f(notify);
> } catch (exception) {
> Wicket.Log.error("Wicket.Ajax.Call.processEvaluation: Exception evaluating
> javascript: " + exception + ", text: " + text);
>  }
>
> }
>
>
> Questions:
>
> 1- Shouldn't
>
> text = "f = function(" + res[1] + ") {" + res[2] + "};";
>
> be
>
> text = "f = function(" + res[1] + ") {" + res[2] + ";" + res[1]+"();"
> +"};";
>
> so that f(notify) ==> notify() gets called?
>

Ok. This part is clearly correct according to

// test if the javascript is in form of identifier|code
// if it is, we allow for letting the javascript decide when the rest of
processing will continue
// by invoking identifier();
var res = text.match(new
RegExp("^([a-z|A-Z_][a-z|A-Z|0-9_]*)\\|((.|\\n)*)$"));

So, forget my question.


>
> 2- In case of error. Shouldn't it be
>
>   try {
> // do the evaluation
>  eval(text);
> f(notify);
> } catch (exception) {
>  Wicket.Log.error("Wicket.Ajax.Call.processEvaluation: Exception
> evaluating javascript: " + exception + ", text: " + text);
> notify();
> }
>

This I think is an error... as if eval fails... processing should continue.
Shall I create an issue for this?

>
> So that next steps in processing get called. The above solves or freezing
> problem in case of error but... I'm still not sure about 1) above.
>
> Can someone shed some light on the above?
>
> Thanks in advance!
>
> --
> Regards - Ernesto Reinaldo Barreiro
> Antilia Soft
> http://antiliasoft.com/ 
>



-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ 


Request scoped variables, in ajaxrequesttarget

2013-02-13 Thread Oscar Besga Arcauz
 Hi wickers !

I was wondering If there's any method to have request-scoped variables ( as 
HttpServletRequest.get/setAttributes )
Specially with AjaxRequestTarget, in AJAX calls. 

I'm  using my own events within ajax calls. I know that an ajax call fires  an 
event into every component of a application; and I'd like to use this  event 
and avoid sending a second custom event.
Because of that, I want to attach some data to the request - to the 
AjaxRequestTarget maybe.


For  I've read in the forum, the way to do it could be a transient variable  
into the page which is nullyfied on the onDetach method.
But I find it not very elegant

Any ideas ?

Thanks


> > > Oscar Besga Arcauz  < < < 


PS.  I'm supposing that a ajax event called over one page of one user  
(session) is not propaged over other pages and other users (sessions)

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



Re: Request scoped variables, in ajaxrequesttarget

2013-02-13 Thread Ernesto Reinaldo Barreiro
Hi Oscar,

On Wed, Feb 13, 2013 at 12:54 PM, Oscar Besga Arcauz wrote:

>  Hi wickers !
>
> I was wondering If there's any method to have request-scoped variables (
> as HttpServletRequest.get/setAttributes )
> Specially with AjaxRequestTarget, in AJAX calls.
>
>
Maybe RequestCycle#setMetaData might be useful for that.


Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ 


Re: problems with "AJAX function" processEvaluation (1.4.x - 6.x)

2013-02-13 Thread Sven Meier

This I think is an error... as if eval fails... processing should continue.
Shall I create an issue for this?


Please create an issue for Wicket 6 (or 1.5.x). As you know, 1.4.x doesn't get 
bug fixes any longer.

Sven


On 02/13/2013 10:25 AM, Ernesto Reinaldo Barreiro wrote:

Hi,

On Wed, Feb 13, 2013 at 8:38 AM, Ernesto Reinaldo Barreiro <
reier...@gmail.com> wrote:


Hi,

We are having problems on Wicket 1.4.x with and "AJAX function"
processEvaluation... and I see the code is practically the same at 6.x. So,
let's bring the subject to the list...

Our problem is that after evaluating some expressions with errors, screen
"freezes" because post-call handlers are not called. Problem seems to be
related to the code.

 // test if the javascript is in form of
identifier|code
// if it is, we allow for letting the javascript decide when the rest of
processing will continue
  // by invoking identifier();
var res = text.match(new
RegExp("^([a-z|A-Z_][a-z|A-Z|0-9_]*)\\|((.|\\n)*)$"));

if (res !== null) {
var f = jQuery.noop;
text = "f = function(" + res[1] + ") {" + res[2] + "};";

try {
// do the evaluation
eval(text);
  f(notify);
} catch (exception) {
Wicket.Log.error("Wicket.Ajax.Call.processEvaluation: Exception evaluating
javascript: " + exception + ", text: " + text);
  }

}


Questions:

1- Shouldn't

text = "f = function(" + res[1] + ") {" + res[2] + "};";

be

text = "f = function(" + res[1] + ") {" + res[2] + ";" + res[1]+"();"
+"};";

so that f(notify) ==> notify() gets called?


Ok. This part is clearly correct according to

// test if the javascript is in form of identifier|code
// if it is, we allow for letting the javascript decide when the rest of
processing will continue
// by invoking identifier();
var res = text.match(new
RegExp("^([a-z|A-Z_][a-z|A-Z|0-9_]*)\\|((.|\\n)*)$"));

So, forget my question.



2- In case of error. Shouldn't it be

   try {
// do the evaluation
  eval(text);
f(notify);
} catch (exception) {
  Wicket.Log.error("Wicket.Ajax.Call.processEvaluation: Exception
evaluating javascript: " + exception + ", text: " + text);
 notify();
}


This I think is an error... as if eval fails... processing should continue.
Shall I create an issue for this?


So that next steps in processing get called. The above solves or freezing
problem in case of error but... I'm still not sure about 1) above.

Can someone shed some light on the above?

Thanks in advance!

--
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ 







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



Re: problems with "AJAX function" processEvaluation (1.4.x - 6.x)

2013-02-13 Thread Ernesto Reinaldo Barreiro
Sven,

Thank you for your answer.

On Wed, Feb 13, 2013 at 1:10 PM, Sven Meier  wrote:

> This I think is an error... as if eval fails... processing should continue.
>> Shall I create an issue for this?
>>
>
> Please create an issue for Wicket 6 (or 1.5.x). As you know, 1.4.x doesn't
> get bug fixes any longer.
>
> Sven
>
>

Yes I know 1.4.x is frozen... Fixing that on 6.x (and 1.5.x) will be more
than enough.

We will back-port solution to our local 1.4.x branch: in fact, we already
patched it for that problem but I wanted to be sure I was not wrong... and
also that we do not encounter the same problem if we migrate to a newer
version;-)

Cheers

Ernesto Reinaldo Barreiro


Re: problems with "AJAX function" processEvaluation (1.4.x - 6.x)

2013-02-13 Thread Ernesto Reinaldo Barreiro
Hi,

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

On Wed, Feb 13, 2013 at 1:10 PM, Sven Meier  wrote:

> This I think is an error... as if eval fails... processing should continue.
>> Shall I create an issue for this?
>>
>
> Please create an issue for Wicket 6 (or 1.5.x). As you know, 1.4.x doesn't
> get bug fixes any longer.
>
> Sven
>
>
>
> On 02/13/2013 10:25 AM, Ernesto Reinaldo Barreiro wrote:
>
>> Hi,
>>
>> On Wed, Feb 13, 2013 at 8:38 AM, Ernesto Reinaldo Barreiro <
>> reier...@gmail.com> wrote:
>>
>>  Hi,
>>>
>>> We are having problems on Wicket 1.4.x with and "AJAX function"
>>> processEvaluation... and I see the code is practically the same at 6.x.
>>> So,
>>> let's bring the subject to the list...
>>>
>>> Our problem is that after evaluating some expressions with errors, screen
>>> "freezes" because post-call handlers are not called. Problem seems to be
>>> related to the code.
>>>
>>>  // test if the javascript is in form of
>>> identifier|code
>>> // if it is, we allow for letting the javascript decide when the rest of
>>> processing will continue
>>>   // by invoking identifier();
>>> var res = text.match(new
>>> RegExp("^([a-z|A-Z_][a-z|A-Z|**0-9_]*)\\|((.|\\n)*)$"));
>>>
>>> if (res !== null) {
>>> var f = jQuery.noop;
>>> text = "f = function(" + res[1] + ") {" + res[2] + "};";
>>>
>>> try {
>>> // do the evaluation
>>> eval(text);
>>>   f(notify);
>>> } catch (exception) {
>>> Wicket.Log.error("Wicket.Ajax.**Call.processEvaluation: Exception
>>> evaluating
>>> javascript: " + exception + ", text: " + text);
>>>   }
>>>
>>> }
>>>
>>>
>>> Questions:
>>>
>>> 1- Shouldn't
>>>
>>> text = "f = function(" + res[1] + ") {" + res[2] + "};";
>>>
>>> be
>>>
>>> text = "f = function(" + res[1] + ") {" + res[2] + ";" + res[1]+"();"
>>> +"};";
>>>
>>> so that f(notify) ==> notify() gets called?
>>>
>>>  Ok. This part is clearly correct according to
>>
>> // test if the javascript is in form of identifier|code
>> // if it is, we allow for letting the javascript decide when the rest of
>> processing will continue
>> // by invoking identifier();
>> var res = text.match(new
>> RegExp("^([a-z|A-Z_][a-z|A-Z|**0-9_]*)\\|((.|\\n)*)$"));
>>
>> So, forget my question.
>>
>>
>>  2- In case of error. Shouldn't it be
>>>
>>>try {
>>> // do the evaluation
>>>   eval(text);
>>> f(notify);
>>> } catch (exception) {
>>>   Wicket.Log.error("Wicket.Ajax.**Call.processEvaluation: Exception
>>> evaluating javascript: " + exception + ", text: " + text);
>>>  notify();
>>> }
>>>
>>>  This I think is an error... as if eval fails... processing should
>> continue.
>> Shall I create an issue for this?
>>
>>  So that next steps in processing get called. The above solves or freezing
>>> problem in case of error but... I'm still not sure about 1) above.
>>>
>>> Can someone shed some light on the above?
>>>
>>> Thanks in advance!
>>>
>>> --
>>> Regards - Ernesto Reinaldo Barreiro
>>> Antilia Soft
>>> http://antiliasoft.com/ 
>>> 
>>> >
>>>
>>>
>>
>>
>
> --**--**-
> To unsubscribe, e-mail: 
> users-unsubscribe@wicket.**apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ 


Migration issue: code using MarkupStream.findCOmponentINdex

2013-02-13 Thread Martin Dietze
I am currently migrating a project based on Wicket 1.4 to 6.60. 
At some point in that project we have this code:

| class Foo extends Panel {
| // ...
| private boolean hasFragment( final String fragmentId, final MarkupStream 
markupStream ) {
| final boolean found = markupStream.findComponentIndex( null, fragmentId ) 
>= 0;
| return found;
| }

This code is used to find if the markup stream for this component
contains the markup for a fragment with the given id. If found,
this markup is used for initialising an inner fragment class
with this markup.

Using a self-defined scheme for defining the Wicket markup ids,
this is used for allowing our HTML authors to define specialised
views for a group of model objects (e.g. a creature has a
generic view while cats and dogs have their own ones).

Now the findComponentIndex method has disappeared from
MarkupStream.

How can I do what I used to do in Wicket 6.60?

Cheers,

M'bert

-- 
--- / http://herbert.the-little-red-haired-girl.org / -
=+= 
while (!asleep)
  ++sheep;

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



Re: Regarding using jetty 6 in wicket

2013-02-13 Thread Ernesto Reinaldo Barreiro
I think

http://wicket.apache.org/start/quickstart.html

for 1.4.21 will uses jetty 6.1.25. Use that quickstart and replace 1.4.x
wicket with 6.x

On Wed, Feb 13, 2013 at 3:05 PM, kshitiz  wrote:

> Hi,
>
> The code that you have described would only work for jetty 7 or above. For
> jetty 6, the jars that I am using, the code would be different as shown in
> the link I posted but is also throwing syntax error. I am not able to get
> jars for the link you described.
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Regarding-using-jetty-6-in-wicket-tp4656286p4656310.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
>
>


-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ 


Re: Request scoped variables, in ajaxrequesttarget

2013-02-13 Thread Oscar Besga Arcauz
Ok, it's a little complicated to create the metadata

If I'm rigth, the process is - for example when click on an AjaxLink into the 
page

1- Execute the method onClick of the AjaxLink
2- Send an event to all the components of the page (the page itself included, 
on first place, but not other pages ?),
   - The source of the event is the page itself
   - The type of broadcast is BREADTH 
   - The payload is the AjaxRequestTarget (from the onclick method call)

/ EXAMPLE OF DATA /
public class MyEventData {
    
    static  MetaDataKey METAKEY_MYEVENTDATA = new 
MetaDataKey(){}; 
    
    String s = "";

    public MyEventData(){}
    
    public MyEventData(String s) {
    this.s = s;
    }


    
    public MetaDataKey getWicketMetadataData(){
    // A little complicated
    MetaDataKey key = new MetaDataKey(){};
    MetaDataEntry metaDataEntry = new 
MetaDataEntry(key,this);
    MetaDataEntry[] arrayMetaDataEntry =  new 
MetaDataEntry[]{metaDataEntry};
    key.set(arrayMetaDataEntry,this);
    return key;
    }
    
    public void setIntoRequest(RequestCycle rc){
    rc.setMetaData(getWicketMetadataData(),this);
    }
    
    public static MyEventData getFromRequest(RequestCycle rc){
    return rc.getMetaData(METAKEY_MYEVENTDATA);
    }
    
}


> > > Oscar Besga Arcauz  < < < 

-Ernesto Reinaldo Barreiro  escribió: -
Para: users@wicket.apache.org
De: Ernesto Reinaldo Barreiro 
Fecha: 13/02/2013  13:00
Asunto: Re: Request scoped variables, in ajaxrequesttarget

Hi Oscar,

On Wed, Feb 13, 2013 at 12:54 PM, Oscar Besga Arcauz wrote:

>  Hi wickers !
>
> I was wondering If there's any method to have request-scoped variables (
> as HttpServletRequest.get/setAttributes )
> Specially with AjaxRequestTarget, in AJAX calls.
>
>
Maybe RequestCycle#setMetaData might be useful for that.


Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ 

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



FormComponentPanel.convertInput()

2013-02-13 Thread Richard W. Adams
I'm writing my first FormComponentPanel, and have a couple of books 
showing how to do this. Most of it seems straightforward, except one 
point: In the books' examples, FormComopnentPanel.convertInput() creates a 
new model object and populates it from a series of calls to 
getConvertedInput() on the panel fields. The examples then call 
setConvertedInput() to store the newly populated model object.

The part I don't understand is this: Why create a NEW model object? Why 
not just call getModelObject() to get the ORIGINAL model, and populate IT 
with the new values? That would avoid the caller having to call 
getConvertedInput() on the panel component: The ORIGINAL model would be 
"magically" updated with the user-entered values when the form is 
submitted. That requires less work on the caller's part, and (IMHO) seems 
more consistent with the way other  property model paradigms work  in 
Wicket. (This, of  course, assumes the original model is mutable, which 
mine is.)

Anyone have any thoughts on the pros & cons of these two approaches?


**

This email and any attachments may contain information that is confidential 
and/or privileged for the sole use of the intended recipient.  Any use, review, 
disclosure, copying, distribution or reliance by others, and any forwarding of 
this email or its contents, without the express permission of the sender is 
strictly prohibited by law.  If you are not the intended recipient, please 
contact the sender immediately, delete the e-mail and destroy all copies.
**


Re: Request scoped variables, in ajaxrequesttarget

2013-02-13 Thread Ernesto Reinaldo Barreiro
why do you need to fire a custom event? Can't you just use AJAX event
triggered by ART?

On Wed, Feb 13, 2013 at 3:31 PM, Oscar Besga Arcauz wrote:

> Ok, it's a little complicated to create the metadata
>
> If I'm rigth, the process is - for example when click on an AjaxLink into
> the page
>
> 1- Execute the method onClick of the AjaxLink
> 2- Send an event to all the components of the page (the page itself
> included, on first place, but not other pages ?),
>- The source of the event is the page itself
>- The type of broadcast is BREADTH
>- The payload is the AjaxRequestTarget (from the onclick method call)
>
> / EXAMPLE OF DATA /
> public class MyEventData {
>
> static  MetaDataKey METAKEY_MYEVENTDATA = new
> MetaDataKey(){};
>
> String s = "";
>
> public MyEventData(){}
>
> public MyEventData(String s) {
> this.s = s;
> }
>
>
>
> public MetaDataKey getWicketMetadataData(){
> // A little complicated
> MetaDataKey key = new MetaDataKey(){};
> MetaDataEntry metaDataEntry = new
> MetaDataEntry(key,this);
> MetaDataEntry[] arrayMetaDataEntry =  new
> MetaDataEntry[]{metaDataEntry};
> key.set(arrayMetaDataEntry,this);
> return key;
> }
>
> public void setIntoRequest(RequestCycle rc){
> rc.setMetaData(getWicketMetadataData(),this);
> }
>
> public static MyEventData getFromRequest(RequestCycle rc){
> return rc.getMetaData(METAKEY_MYEVENTDATA);
> }
>
> }
>
>
> > > > Oscar Besga Arcauz  < < <
>
> -Ernesto Reinaldo Barreiro  escribió: -
> Para: users@wicket.apache.org
> De: Ernesto Reinaldo Barreiro 
> Fecha: 13/02/2013  13:00
> Asunto: Re: Request scoped variables, in ajaxrequesttarget
>
> Hi Oscar,
>
> On Wed, Feb 13, 2013 at 12:54 PM, Oscar Besga Arcauz  >wrote:
>
> >  Hi wickers !
> >
> > I was wondering If there's any method to have request-scoped variables (
> > as HttpServletRequest.get/setAttributes )
> > Specially with AjaxRequestTarget, in AJAX calls.
> >
> >
> Maybe RequestCycle#setMetaData might be useful for that.
>
>
> Regards - Ernesto Reinaldo Barreiro
> Antilia Soft
> http://antiliasoft.com/ 
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ 


Re: Request scoped variables, in ajaxrequesttarget

2013-02-13 Thread Bas Gooren

Well, it's a lot simpler than that.

Simply call rc.setMetaData( METAKEY_MYEVENTDATA, this );

Wicket handles the actual storage details (like storing your data in a 
MetaDataEntry array etc).

Nothing you need to think about :-)

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 13-2-2013 15:31, schreef Oscar Besga Arcauz:

Ok, it's a little complicated to create the metadata

If I'm rigth, the process is - for example when click on an AjaxLink into the 
page

1- Execute the method onClick of the AjaxLink
2- Send an event to all the components of the page (the page itself included, 
on first place, but not other pages ?),
- The source of the event is the page itself
- The type of broadcast is BREADTH
- The payload is the AjaxRequestTarget (from the onclick method call)

/ EXAMPLE OF DATA /
public class MyEventData {
 
 static  MetaDataKey METAKEY_MYEVENTDATA = new MetaDataKey(){};
 
 String s = "";


 public MyEventData(){}
 
 public MyEventData(String s) {

 this.s = s;
 }


 
 public MetaDataKey getWicketMetadataData(){

 // A little complicated
 MetaDataKey key = new MetaDataKey(){};
 MetaDataEntry metaDataEntry = new 
MetaDataEntry(key,this);
 MetaDataEntry[] arrayMetaDataEntry =  new 
MetaDataEntry[]{metaDataEntry};
 key.set(arrayMetaDataEntry,this);
 return key;
 }
 
 public void setIntoRequest(RequestCycle rc){

 rc.setMetaData(getWicketMetadataData(),this);
 }
 
 public static MyEventData getFromRequest(RequestCycle rc){

 return rc.getMetaData(METAKEY_MYEVENTDATA);
 }
 
}



 > > > Oscar Besga Arcauz  < < <

-Ernesto Reinaldo Barreiro  escribió: -
Para: users@wicket.apache.org
De: Ernesto Reinaldo Barreiro 
Fecha: 13/02/2013  13:00
Asunto: Re: Request scoped variables, in ajaxrequesttarget

Hi Oscar,

On Wed, Feb 13, 2013 at 12:54 PM, Oscar Besga Arcauz wrote:


  Hi wickers !

I was wondering If there's any method to have request-scoped variables (
as HttpServletRequest.get/setAttributes )
Specially with AjaxRequestTarget, in AJAX calls.



Maybe RequestCycle#setMetaData might be useful for that.


Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ 

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





Re: FormComponentPanel.convertInput()

2013-02-13 Thread Sven Meier

Hi,

#convertInput() should not modify the current model object, because form 
submission might still fail with a conversion error on another field.


Pushing the new input in the FormComponent's model is done later in 
#updateModel().


Hope this helps
Sven

On 02/13/2013 03:33 PM, Richard W. Adams wrote:

I'm writing my first FormComponentPanel, and have a couple of books
showing how to do this. Most of it seems straightforward, except one
point: In the books' examples, FormComopnentPanel.convertInput() creates a
new model object and populates it from a series of calls to
getConvertedInput() on the panel fields. The examples then call
setConvertedInput() to store the newly populated model object.

The part I don't understand is this: Why create a NEW model object? Why
not just call getModelObject() to get the ORIGINAL model, and populate IT
with the new values? That would avoid the caller having to call
getConvertedInput() on the panel component: The ORIGINAL model would be
"magically" updated with the user-entered values when the form is
submitted. That requires less work on the caller's part, and (IMHO) seems
more consistent with the way other  property model paradigms work  in
Wicket. (This, of  course, assumes the original model is mutable, which
mine is.)

Anyone have any thoughts on the pros & cons of these two approaches?


**

This email and any attachments may contain information that is confidential 
and/or privileged for the sole use of the intended recipient.  Any use, review, 
disclosure, copying, distribution or reliance by others, and any forwarding of 
this email or its contents, without the express permission of the sender is 
strictly prohibited by law.  If you are not the intended recipient, please 
contact the sender immediately, delete the e-mail and destroy all copies.
**




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



Re: Request scoped variables, in ajaxrequesttarget

2013-02-13 Thread Oscar Besga Arcauz
Yes, this works ok !

> why do you need to fire a custom event?
I've four main panels in my app, in order to communicate each other withour 
listeners

>Can't you just use AJAX event triggered by ART?
ART ?
Maybe ApplicationRuntime

Ok, that's what I want to use, the AJAX event, but I want to have shared data 
in the request within the components

Thanks !!!


> / EXAMPLE OF DATA /
> public class MyEventData {
>  
>  static  MetaDataKey METAKEY_MYEVENTDATA = new 
> MetaDataKey(){};
>  
>  String s = "";
>
>  public MyEventData(){}
>  
>  public MyEventData(String s) {
>  this.s = s;
>  }
>
>
>  
>  
>  public void setIntoRequest(RequestCycle rc){
>  rc.setMetaData(METAKEY_MYEVENTDATA,this);
>  }
>  
>  public static MyEventData getFromRequest(RequestCycle rc){
>  return rc.getMetaData(METAKEY_MYEVENTDATA);
>  }
>  
> }

> > > Oscar Besga Arcauz  < < < 

-Bas Gooren  escribió: -
Para: users@wicket.apache.org
De: Bas Gooren 
Fecha: 13/02/2013  15:35
Asunto: Re: Request scoped variables, in ajaxrequesttarget

Well, it's a lot simpler than that.

Simply call rc.setMetaData( METAKEY_MYEVENTDATA, this );

Wicket handles the actual storage details (like storing your data in a 
MetaDataEntry array etc).
Nothing you need to think about :-)

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 13-2-2013 15:31, schreef Oscar Besga Arcauz:
> Ok, it's a little complicated to create the metadata
>
> If I'm rigth, the process is - for example when click on an AjaxLink into the 
> page
>
> 1- Execute the method onClick of the AjaxLink
> 2- Send an event to all the components of the page (the page itself included, 
> on first place, but not other pages ?),
>     - The source of the event is the page itself
>     - The type of broadcast is BREADTH
>     - The payload is the AjaxRequestTarget (from the onclick method call)
>
> / EXAMPLE OF DATA /
> public class MyEventData {
>      
>      static  MetaDataKey METAKEY_MYEVENTDATA = new 
> MetaDataKey(){};
>      
>      String s = "";
>
>      public MyEventData(){}
>      
>      public MyEventData(String s) {
>          this.s = s;
>      }
>
>
>      
>      public MetaDataKey getWicketMetadataData(){
>          // A little complicated
>          MetaDataKey key = new MetaDataKey(){};
>          MetaDataEntry metaDataEntry = new 
> MetaDataEntry(key,this);
>          MetaDataEntry[] arrayMetaDataEntry =  new 
> MetaDataEntry[]{metaDataEntry};
>          key.set(arrayMetaDataEntry,this);
>          return key;
>      }
>      
>      public void setIntoRequest(RequestCycle rc){
>          rc.setMetaData(getWicketMetadataData(),this);
>      }
>      
>      public static MyEventData getFromRequest(RequestCycle rc){
>          return rc.getMetaData(METAKEY_MYEVENTDATA);
>      }
>      
> }
>
>
>      > > > Oscar Besga Arcauz  < < <
>
> -Ernesto Reinaldo Barreiro  escribió: -
> Para: users@wicket.apache.org
> De: Ernesto Reinaldo Barreiro 
> Fecha: 13/02/2013  13:00
> Asunto: Re: Request scoped variables, in ajaxrequesttarget
>
> Hi Oscar,
>
> On Wed, Feb 13, 2013 at 12:54 PM, Oscar Besga Arcauz wrote:
>
>>   Hi wickers !
>>
>> I was wondering If there's any method to have request-scoped variables (
>> as HttpServletRequest.get/setAttributes )
>> Specially with AjaxRequestTarget, in AJAX calls.
>>
>>
> Maybe RequestCycle#setMetaData might be useful for that.
>
>
> Regards - Ernesto Reinaldo Barreiro
> Antilia Soft
> http://antiliasoft.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: Request scoped variables, in ajaxrequesttarget

2013-02-13 Thread Ernesto Reinaldo Barreiro
Hi,

On Wed, Feb 13, 2013 at 3:52 PM, Oscar Besga Arcauz wrote:

> Yes, this works ok !
>
> > why do you need to fire a custom event?
> I've four main panels in my app, in order to communicate each other
> withour listeners
>
> >Can't you just use AJAX event triggered by ART?
> ART ?
> Maybe ApplicationRuntime
>
>
 ART = AjaxRequestTarget.


> Ok, that's what I want to use, the AJAX event, but I want to have shared
> data in the request within the components
>
>
1- on component A

onClick(ART ...) {
  re.setMatadata()
}

2 componentB

public void onEvent(IEvent event) {
if(event.getPayload() instanceof AjaxRequestTarget) {
RequestCycle.get().getMetaData(key);
}
}
-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ 


Re: FormComponentPanel.convertInput()

2013-02-13 Thread Richard W. Adams
You're right: The "later in #updateModel()" was the piece I wasn't 
considering. Tks.




From:   Sven Meier 
To: users@wicket.apache.org
Date:   02/13/2013 08:48 AM
Subject:Re: FormComponentPanel.convertInput()



Hi,

#convertInput() should not modify the current model object, because form 
submission might still fail with a conversion error on another field.

Pushing the new input in the FormComponent's model is done later in 
#updateModel().

Hope this helps
Sven

On 02/13/2013 03:33 PM, Richard W. Adams wrote:
> I'm writing my first FormComponentPanel, and have a couple of books
> showing how to do this. Most of it seems straightforward, except one
> point: In the books' examples, FormComopnentPanel.convertInput() creates 
a
> new model object and populates it from a series of calls to
> getConvertedInput() on the panel fields. The examples then call
> setConvertedInput() to store the newly populated model object.
>
> The part I don't understand is this: Why create a NEW model object? Why
> not just call getModelObject() to get the ORIGINAL model, and populate 
IT
> with the new values? That would avoid the caller having to call
> getConvertedInput() on the panel component: The ORIGINAL model would be
> "magically" updated with the user-entered values when the form is
> submitted. That requires less work on the caller's part, and (IMHO) 
seems
> more consistent with the way other  property model paradigms work  in
> Wicket. (This, of  course, assumes the original model is mutable, which
> mine is.)
>
> Anyone have any thoughts on the pros & cons of these two approaches?
>
>
> **
>
> This email and any attachments may contain information that is 
confidential and/or privileged for the sole use of the intended recipient. 
 Any use, review, disclosure, copying, distribution or reliance by others, 
and any forwarding of this email or its contents, without the express 
permission of the sender is strictly prohibited by law.  If you are not 
the intended recipient, please contact the sender immediately, delete the 
e-mail and destroy all copies.
> **
>


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




**

This email and any attachments may contain information that is confidential 
and/or privileged for the sole use of the intended recipient.  Any use, review, 
disclosure, copying, distribution or reliance by others, and any forwarding of 
this email or its contents, without the express permission of the sender is 
strictly prohibited by law.  If you are not the intended recipient, please 
contact the sender immediately, delete the e-mail and destroy all copies.
**


Re: a "loading ..." something ...

2013-02-13 Thread Stephen Walsh
What about a lazyload panel?

http://www.wicket-library.com/wicket-examples/ajax/lazy-loading;jsessionid=88070A23F11D560015390052668E124D?0

___
Stephen Walsh | http://connectwithawalsh.com


On Wed, Feb 13, 2013 at 11:15 AM, grazia wrote:

> There are some pages in my app that load slowly due to the amount of data
> the
> customer needs to have (we have already optimized the retrieval part as
> much
> as possible). So I thought it would be nice to have a "Loading ..." dialog
> or something that disappears as soon as the data on the page have finished
> loading.
> What would you recommend for a Wicket app ? Any examples I could look at ?
> Thank you !
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/a-loading-something-tp4656323.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
>
>


Re: a "loading ..." something ...

2013-02-13 Thread Nick Pratt
AjaxLazyLoadingPanel or write your own async models.

Look back at the recent mailing list history - someone kindly posted an
example application utilizing various async loading techniques.

This would be a good topic for the new ref docs!

N

On Wed, Feb 13, 2013 at 12:15 PM, grazia wrote:

> There are some pages in my app that load slowly due to the amount of data
> the
> customer needs to have (we have already optimized the retrieval part as
> much
> as possible). So I thought it would be nice to have a "Loading ..." dialog
> or something that disappears as soon as the data on the page have finished
> loading.
> What would you recommend for a Wicket app ? Any examples I could look at ?
> Thank you !
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/a-loading-something-tp4656323.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
>
>


Re: a "loading ..." something ...

2013-02-13 Thread Andrea Del Bene
If you are using Wicket 6.x you can take a look at my project hosted at 
https://github.com/bitstorm/Wicket-tutorial-examples/tree/master/CustomAjaxListenerExample. 
There you can find a custom Ajax listener that displays a custom 
activity indicator for the whole duration of an Ajax request

There are some pages in my app that load slowly due to the amount of data the
customer needs to have (we have already optimized the retrieval part as much
as possible). So I thought it would be nice to have a "Loading ..." dialog
or something that disappears as soon as the data on the page have finished
loading.
What would you recommend for a Wicket app ? Any examples I could look at ?
Thank you !



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/a-loading-something-tp4656323.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



AjaxEventBehavior called twice because of javascript onchange

2013-02-13 Thread divad91
Hi,

I using wicket 1.4.21 and developing an application that needs to work in
IE7 and +., firefox, chrome etc.

I have a problem with IE. Ajax "listener" are called twice because I have
javascript that remove the dropdown default empty option "Choose One".

My ajax listener is called on first time and then the javascript is removing
the default option causing my Ajax listener being called again.

This problems occurs only in IE.
This is not really related to wicket but I was wondering if anyone had this
problems before.

 ** My clients want the "Choose One" option so I can't just put a default
value to the drop down.

Thanks for help.
David

Java code


Javacript code :





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxEventBehavior-called-twice-because-of-javascript-onchange-tp4656329.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



Re: AjaxEventBehavior called twice because of javascript onchange

2013-02-13 Thread Sven Meier

How do you remove the option? Show us some code.

Sven


On 02/13/2013 08:22 PM, divad91 wrote:

More precisely, removing an option of a dropdown list with Internet Explorer
(IE7 - IE8) triggers the Wicket Onchange Behavior.

Any workaround too avoid this ?



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxEventBehavior-called-twice-because-of-javascript-onchange-tp4656329p4656330.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



How to change style of td which contain a selection field

2013-02-13 Thread Delange
I my table I use selections. My problem is that the selection field is
aligned to the left while it should be aligned to the right

How can I have the input selections field aligned to the right?


Example
Quantity in Storage 
___ <--- this selection field must be
aligned to the right
 8.700
 5.400





--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-change-style-of-td-which-contain-a-selection-field-tp4656333.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



Re: AjaxEventBehavior called twice because of javascript onchange

2013-02-13 Thread Sven Meier

Hi,

your code didn't come through with you initial post.

Regretfully I don't have an idea what's going wrong here: Removing an 
option via Javascript shouldn't trigger any change event handler.


Sven

On 02/13/2013 08:56 PM, divad91 wrote:

The code is in my first post at the end.

With jQuery 1.6.1
 enhanceComboBoxes : function enhanceComboBoxes() {
var comboboxes = $("select:not(.emptyOptionEnhanced,
.noRemoveEmptyChoice)");
 comboboxes.each(function() {
 var combo = $(this);
 var emptyOptions = combo.find("option[value='']");

 if (emptyOptions.length) {
 combo.debug("Enhancing combo box with empty option");
 combo.change(function(e) {
 emptyOptions.debug("Removing empty option").remove();
 });
 ).addClass("emptyOptionEnhanced");
},

The enhanceComboBoxes function is called after each ajax call.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/AjaxEventBehavior-called-twice-because-of-javascript-onchange-tp4656329p4656334.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: HttpsMapper with Apache Virtual Host Appending the Wrong Path

2013-02-13 Thread Tim Urberg
I found a solution and it's not bad at all.  This works specifically 
with WebLogic and the HTTP WebLogic Plugin, so anyone using that setup 
should benefit from this:


1. I created a subclass of 
org.apache.wicket.protocol.http.servlet.ServletWebRequest to override 
getContextPath():


@Override
public String getContextPath()
{
String webLogicPrepend = getHeader("WL-PATH-PREPEND");
String contextPath = super.getContextPath();

if (StringUtils.equals(webLogicPrepend, contextPath))
return StringUtils.EMPTY;
else
return contextPath;
}

The WebLogic HTTP plugin sends a header called WL-PATH-PREPEND which is 
part of the Apache configuration (see 
http://docs.oracle.com/cd/E13222_01/wls/docs81/plugins/apache.html). I 
simply check to see if this header was sent and if it matches the one 
from the servlet.  If that's the case, I send an empty string back so it 
doesn't get added.


2. Override newWebRequest in the WebApplication to use the 
ServletWebRequest subclass:


@Override
public WebRequest newWebRequest(HttpServletRequest servletRequest, 
String filterPath)

{
return new ApiServletWebRequest(servletRequest, filterPath);
}

So far in my testing, I haven't had any of the problems I had before.  
This solution may also work with mod_proxy, but I'm not sure if there 
are headers sent in that situation.


I created a bug (https://issues.apache.org/jira/browse/WICKET-5000) 
which could possibly be closed now that I've found this work around.


Tim

On 1/22/13 12:32 PM, Tim Urberg wrote:
First the good news, I was able to get it to work by deploying the 
application in the root context.  Once I did that, everything worked 
the way it should, paged switched from http to https with no problem.  
The bad news is that deploying it as / not an option.  I've tried 
overriding createRedirectUrl to strip out the context in the url in 
HttpsMapper, but that only works part of the time.  For example, when 
I put the @RequireHttps annotation on a page, and have logged in, when 
I click a link to it /documentation is added to the URL, which tells 
me it's more of a problem than just HttpsMapper. Perhaps it's a 
problem with the delegate mapper as well.  The fact that it works 
correctly when deployed as the root context tells me there's got to be 
a better way to fix it. Anyway, I was wondering if anyone had any 
ideas as to where to start looking.  It would be nice if there was a 
way to tell the wicket application that "even though I'm deployed at 
'/myapp', I'm actually behind a proxy and my context is '/'"  That 
would really solve the problem.


I was thinking of creating a JIRA ticket or feature request for this.

Any thoughts?

Tim

On 1/17/13 3:04 PM, Tim Urberg wrote:
Ok, I'm making *some* progress (if you can call it that).  First of 
all, here's more about my setup.  I'm using wicket-auth-roles for 
authentication and I have this set up in my WebApplication.class 
based on an example I found in wicket examples:


1) the authorization strategy
getSecuritySettings().setAuthorizationStrategy(new 
IAuthorizationStrategy()

{

@Override
public  boolean 
isInstantiationAuthorized(Class componentClass)

{
if (AuthenticatedWebPage.class.isAssignableFrom(componentClass))
{
if (ApiAuthenticatedWebSession.get().isSignedIn())
return true;

throw new RestartResponseAtInterceptPageException(new 
LoginPage());

}
return true;
}

@Override
public boolean isActionAuthorized(Component component, Action 
action)

{
return true;
}
});

2) I have every page needing login.
3) I've got the login page mounted as /login and @RequireHttps on it.
4) In the onsubmit of the the login form I'm calling 
continueToOriginalDestination();


That's my setup, My attempt was to override createRedirectUrl in 
HttpsMapper so that it looks like this:


@Override
protected String createRedirectUrl(IRequestHandler handler, Request 
request, Scheme scheme)

{
return StringUtils.remove(super.createRedirectUrl(handler, 
request, scheme), "/documentation");

}

This works as long as I go to http://myserver.com/login and it will 
correctly redirect to https://myserver.com/login rather than 
https://myserver.com/documentation/login like it did before. However, 
if I go to http://myserver.com/ (the home page which redirects to the 
login page as part of the authorization strategy) it goes to 
https://myserver.com/documentation/login. Also if I go straight to 
the login page, login successfully, it will redirect to 
http://myserver.com/documentation what it thinks is the home page.


I looked at the code in RestartResponseAtInterceptPageException and 
I'm thinking this code could be the culprit:


static void continueToOriginalDestination()
{
InterceptData data = InterceptData.get();
if (data != null)
{
data.continueOk = tr

Multipart ajax form submit channel

2013-02-13 Thread Ashley Reed
I just wanted to ask this question before figuring out how to file a 
bug. I'm using Wicket 1.5.6, and it seems like multipart ajax form 
submits don't block the ajax channel. I'm doing an ajax submit that 
causes the form to go away, and other ajax links on the form don't wait 
until the form submission is complete. The result is that other ajax 
links cause an exception if they're clicked before the form submission 
is complete because the objects no longer exist in the page. I would 
think the precondition on the links shouldn't be tested until the 
channel is available. Is this a bug?


Thanks,
Ashley

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



Re: Expire page in Wicket 1.5/6.x

2013-02-13 Thread Francois Meillet

getSession().clear();



François Meillet
Formation Wicket - Développement Wicket





Le 13 févr. 2013 à 22:25, Nick Pratt  a écrit :

> Is it possible to forcibly expire all versions of a Page in Wicket 1.5/6 -
> if so, how?
> 
> N



Re: Migration issue: code using MarkupStream.findCOmponentINdex

2013-02-13 Thread Francois Meillet
private boolean hasFragment(final String id, final Markup markup) {
return markup.find(id) != null;
}

hope this help


François Meillet
Formation Wicket - Développement Wicket





Le 13 févr. 2013 à 15:08, Martin Dietze  a écrit :

> I am currently migrating a project based on Wicket 1.4 to 6.60. 
> At some point in that project we have this code:
> 
> | class Foo extends Panel {
> | // ...
> | private boolean hasFragment( final String fragmentId, final MarkupStream 
> markupStream ) {
> | final boolean found = markupStream.findComponentIndex( null, fragmentId 
> ) >= 0;
> | return found;
> | }
> 
> This code is used to find if the markup stream for this component
> contains the markup for a fragment with the given id. If found,
> this markup is used for initialising an inner fragment class
> with this markup.
> 
> Using a self-defined scheme for defining the Wicket markup ids,
> this is used for allowing our HTML authors to define specialised
> views for a group of model objects (e.g. a creature has a
> generic view while cats and dogs have their own ones).
> 
> Now the findComponentIndex method has disappeared from
> MarkupStream.
> 
> How can I do what I used to do in Wicket 6.60?
> 
> Cheers,
> 
> M'bert
> 
> -- 
> --- / http://herbert.the-little-red-haired-girl.org / -
> =+= 
> while (!asleep)
>  ++sheep;
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 



Re: Migration issue: code using MarkupStream.findCOmponentINdex

2013-02-13 Thread Francois Meillet
have a look at the migration page 1.5 $ component rendering

https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-Componentrendering



François Meillet
Formation Wicket - Développement Wicket





Le 13 févr. 2013 à 15:08, Martin Dietze  a écrit :

> I am currently migrating a project based on Wicket 1.4 to 6.60. 
> At some point in that project we have this code:
> 
> | class Foo extends Panel {
> | // ...
> | private boolean hasFragment( final String fragmentId, final MarkupStream 
> markupStream ) {
> | final boolean found = markupStream.findComponentIndex( null, fragmentId 
> ) >= 0;
> | return found;
> | }
> 
> This code is used to find if the markup stream for this component
> contains the markup for a fragment with the given id. If found,
> this markup is used for initialising an inner fragment class
> with this markup.
> 
> Using a self-defined scheme for defining the Wicket markup ids,
> this is used for allowing our HTML authors to define specialised
> views for a group of model objects (e.g. a creature has a
> generic view while cats and dogs have their own ones).
> 
> Now the findComponentIndex method has disappeared from
> MarkupStream.
> 
> How can I do what I used to do in Wicket 6.60?
> 
> Cheers,
> 
> M'bert
> 
> -- 
> --- / http://herbert.the-little-red-haired-girl.org / -
> =+= 
> while (!asleep)
>  ++sheep;
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 



changing pdf content in Iframe , on "item select" event

2013-02-13 Thread mayanksahai
hi all,

i am new to wicket and trying to build a page that contains a "drop down",
listing all the documents associated to a user. i have a "div"on the same
page that encapsulates an "Iframe" , where document content is displayed.

a user can change "document" in dropdown and once item is selected , that
should get displayed in underlying "iframe". i do not know the appropriate
way of doing this.

since document can be anything image/excel/pdf , i need a holistic approach
to render any kind of content in iframe.

i tried intercepting the "On selected" event of dropdown choice and
manipulate the "src" attribute of iframe but it is not working.

can someone point me to any example etc.

thanks

mayank sahai
 



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/changing-pdf-content-in-Iframe-on-item-select-event-tp4656313.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



How to null-check manually converted TextField values?

2013-02-13 Thread Sebastian Gaul
I have a TextField which overrides it's getConverter method to add a
Joda time converter instead:

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

The converter returns null if input was invalid. However, I want to be
able to flag this field as required, and I don't know how to do that:

 - textField.isRequired(true) does not work, because required checks
are done before conversion. This doesn't work for non-empty but
invalid inputs.

 - textField.add(.. some validator ..) does not work because no
validator is called if the converter returned null.

I really don't see an approach to flag my date fields as required. Do
you know how to do that? Probably my approach is not suited at all?

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



how to modify internal JavascriptResourceReference packaged with component

2013-02-13 Thread Evan Sable
Hi,

I'm working on a project that's on wicket 1.4.  It's using
the MultiFileUploadField class.  I see in the code for that class that in
renderHead, it calls:
response.renderJavascriptReference(JS);
and earlier it defines:
private static final ResourceReference JS = new JavascriptResourceReference(
MultiFileUploadField.class, "MultiFileUploadField.js");

But, I'd like to make a minor modification to the actual javascript in
MultiFileUploadField.js.  Specifically, I want to modify that code to
remove the "c:/fakepath" prefix that appears in the box with the list of
selected files below the field (in chrome and safari - not a problem in
firefox and ie).  If I could just over-ride the javascript contents of that
file, it would be an easy fix.  But, more generally, I'd like to know not
just for this specific issue, is there a "wicket way" to override the
packaged javascript resource that comes with a component?  Perhaps is there
a simple way to extend the MultiFileUploadField class with my own class,
and somehow keep the rest of the code as is, but specify an alternate
resource?  It's private in that class, so I don't see how I'd do this, but
maybe I'm missing something obvious.  Or maybe is there some way to keep
using the same class but to tell the application that I want to replace the
corresponding javascript file with my own?  Or is there some other approach
I should be taking when this type of issue comes up?

Thanks very much for any advice,
-Evan


Re: How to null-check manually converted TextField values?

2013-02-13 Thread Sebastien
Hi,

Well, the required flag ensures that the input is not empty, not that it is
of the correct type...

If the conversion fails, is it supposed (I guessed) to throw a
ConversionException.
As it seems to not be the case, I would have overridden convert input as
follow (not tested):

class MyJodaDateTextField
{
   protected void convertInput()
   {
super.convertInput();

Date value = this.getConvertedInput();

if (value == null)
{
//handles the error message
ValidationError error = new ValidationError();
error.addKey("MyJodaDateTextField.ConversionError"); //wicket6
//error.addMessageKey("MyJodaDateTextField.ConversionError");
//wicket1.5
error.setVariable("date", value);
this.error(error);
 }
}
}

MyJodaDateTextField.properties will contain:
MyJodaDateTextField.ConversionError='${date}' is not a valid Joda datetime

Also pay attention to check the type in getConverter

{
if (Date.class.isAssignableFrom(type))
{
return (IConverter)new JodaDateTimeConverter();
}

return super.getConverter(type);
}


Hope this helps,
Sebastien.

On Wed, Feb 13, 2013 at 4:46 PM, Sebastian Gaul wrote:

> I have a TextField which overrides it's getConverter method to add a
> Joda time converter instead:
>
> new TextField(id) {
> @Override
> public  IConverter getConverter(Class type) {
> return (IConverter) new JodaDateTimeConverter();
> }
> };
>
> The converter returns null if input was invalid. However, I want to be
> able to flag this field as required, and I don't know how to do that:
>
>  - textField.isRequired(true) does not work, because required checks
> are done before conversion. This doesn't work for non-empty but
> invalid inputs.
>
>  - textField.add(.. some validator ..) does not work because no
> validator is called if the converter returned null.
>
> I really don't see an approach to flag my date fields as required. Do
> you know how to do that? Probably my approach is not suited at all?
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: HttpsMapper with Apache Virtual Host Appending the Wrong Path

2013-02-13 Thread Tim Urberg
One more thing, I needed to override createRedirectUrl in HttpsMapper to 
look like this:


@Override
protected String createRedirectUrl(IRequestHandler handler, Request 
request, Scheme scheme)

{
HttpServletRequest req = (HttpServletRequest) ((WebRequest) 
request).getContainerRequest();

String url = scheme.urlName() + "://";
url += req.getServerName();
if (!scheme.usesStandardPort(getConfig()))
{
url += ":" + scheme.getPort(getConfig());
}

if (req.getQueryString() != null)
{
url += "?" + req.getQueryString();
}
return url;
}

It does the same thing, checks the context path.  It would be nice if 
createRedirectUrl had separate methods for each part of the URL so those 
could be overridden individually since I basically copied and pasted the 
code from the original method only changing the request URI part.


On 2/13/13 2:38 PM, Tim Urberg wrote:
I found a solution and it's not bad at all.  This works specifically 
with WebLogic and the HTTP WebLogic Plugin, so anyone using that setup 
should benefit from this:


1. I created a subclass of 
org.apache.wicket.protocol.http.servlet.ServletWebRequest to override 
getContextPath():


@Override
public String getContextPath()
{
String webLogicPrepend = getHeader("WL-PATH-PREPEND");
String contextPath = super.getContextPath();

if (StringUtils.equals(webLogicPrepend, contextPath))
return StringUtils.EMPTY;
else
return contextPath;
}

The WebLogic HTTP plugin sends a header called WL-PATH-PREPEND which 
is part of the Apache configuration (see 
http://docs.oracle.com/cd/E13222_01/wls/docs81/plugins/apache.html). I 
simply check to see if this header was sent and if it matches the one 
from the servlet.  If that's the case, I send an empty string back so 
it doesn't get added.


2. Override newWebRequest in the WebApplication to use the 
ServletWebRequest subclass:


@Override
public WebRequest newWebRequest(HttpServletRequest servletRequest, 
String filterPath)

{
return new ApiServletWebRequest(servletRequest, filterPath);
}

So far in my testing, I haven't had any of the problems I had before.  
This solution may also work with mod_proxy, but I'm not sure if there 
are headers sent in that situation.


I created a bug (https://issues.apache.org/jira/browse/WICKET-5000) 
which could possibly be closed now that I've found this work around.


Tim

On 1/22/13 12:32 PM, Tim Urberg wrote:
First the good news, I was able to get it to work by deploying the 
application in the root context.  Once I did that, everything worked 
the way it should, paged switched from http to https with no 
problem.  The bad news is that deploying it as / not an option.  I've 
tried overriding createRedirectUrl to strip out the context in the 
url in HttpsMapper, but that only works part of the time.  For 
example, when I put the @RequireHttps annotation on a page, and have 
logged in, when I click a link to it /documentation is added to the 
URL, which tells me it's more of a problem than just HttpsMapper. 
Perhaps it's a problem with the delegate mapper as well.  The fact 
that it works correctly when deployed as the root context tells me 
there's got to be a better way to fix it. Anyway, I was wondering if 
anyone had any ideas as to where to start looking.  It would be nice 
if there was a way to tell the wicket application that "even though 
I'm deployed at '/myapp', I'm actually behind a proxy and my context 
is '/'"  That would really solve the problem.


I was thinking of creating a JIRA ticket or feature request for this.

Any thoughts?

Tim

On 1/17/13 3:04 PM, Tim Urberg wrote:
Ok, I'm making *some* progress (if you can call it that).  First of 
all, here's more about my setup. I'm using wicket-auth-roles for 
authentication and I have this set up in my WebApplication.class 
based on an example I found in wicket examples:


1) the authorization strategy
getSecuritySettings().setAuthorizationStrategy(new 
IAuthorizationStrategy()

{

@Override
public  boolean 
isInstantiationAuthorized(Class componentClass)

{
if 
(AuthenticatedWebPage.class.isAssignableFrom(componentClass))

{
if (ApiAuthenticatedWebSession.get().isSignedIn())
return true;

throw new RestartResponseAtInterceptPageException(new 
LoginPage());

}
return true;
}

@Override
public boolean isActionAuthorized(Component component, Action 
action)

{
return true;
}
});

2) I have every page needing login.
3) I've got the login page mounted as /login and @RequireHttps on it.
4) In the onsubmit of the the login form I'm calling 
continueToOriginalDestination();


That's my setup, My attempt was to override createRedirectUrl in 
HttpsMapper so that it looks like this:


@Override
protected String createRedirect

Re: changing pdf content in Iframe , on "item select" event

2013-02-13 Thread Ernesto Reinaldo Barreiro
Hi,

Maybe you can adapt

https://cwiki.apache.org/WICKET/displaying-content-eg-pdf-excel-word-in-an-iframe.html

to your needs?

On Wed, Feb 13, 2013 at 3:28 PM, mayanksahai  wrote:

> hi all,
>
> i am new to wicket and trying to build a page that contains a "drop down",
> listing all the documents associated to a user. i have a "div"on the same
> page that encapsulates an "Iframe" , where document content is displayed.
>
> a user can change "document" in dropdown and once item is selected , that
> should get displayed in underlying "iframe". i do not know the appropriate
> way of doing this.
>
> since document can be anything image/excel/pdf , i need a holistic approach
> to render any kind of content in iframe.
>
> i tried intercepting the "On selected" event of dropdown choice and
> manipulate the "src" attribute of iframe but it is not working.
>
> can someone point me to any example etc.
>
> thanks
>
> mayank sahai
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/changing-pdf-content-in-Iframe-on-item-select-event-tp4656313.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
>
>


-- 
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/