Mapping image src and href in production

2009-11-23 Thread Alec Swan
I am relatively new to Wicket and currently using Wicket 1.4.2 with Tomcat
6.0.

I would like to understand the recommended way of handling static images
with Wicket in production. Suppose I have the following image:



This image is static and do not want to create a wicket:id for it and change
the Java code to set up.

What are my options here? Should I configure Wicket to map /images folder to
WEB-INF/images? Or should I configure a filter in web.xml to do that? Or
should I run a web server which handles /images URL?

What is the recommended option for production or development? Is there any
tutorial that explains how to organize Wicket source code and image resource
directories and tie them together?

Thanks,

Alec

P.S. I read Wicket FAQ and other online resources, but no central place that
describes best practices. Even in Wicket In Action almost all images have
wicket:id which puts a lot of burden on the Java developer.


How to render raw HTML

2009-12-01 Thread Alec Swan
I am using Wicket 1.4.2 and would like to be able to render raw HTML pages
which are stored in an existing database. I saw that other people attempted
doing 
thisand
am wondering if there is a way to do this without creating a lot of
custom code?

Thanks,

Alec


Converter for AjaxEditableMultiLineLabel

2009-12-25 Thread Alec Swan
I am using AjaxEditableMultiLineLabel to allow the user to enter a Velocity
template in the editor and then preview the bound template content in the
label.

I created a TemplateConverter class and overrode
AjaxEditableMultiLineLabel#getConverter() method to return an instance of
TemplateConverter. However, the AjaxEditableMultiLineLabel#getConverter() is
never called.

What am I doing wring and what is the recommended way to do this?

Thanks,

Alec


Re: Converter for AjaxEditableMultiLineLabel

2009-12-25 Thread Alec Swan
Thanks, I followed your suggestion and overrode
AjaxEditableMultiLineLabel#newLabel() method.

Now I am trying to unit-test the content of the displayed label using
WicketTester. However, I cannot use WicketTester#assertLabel() because
AjaxEditableMultiLineLabel is a Panel and not a Label.

Does anybody know how to access the display value of
AjaxEditableMultiLineLabel?

Thanks,

Alec

On Fri, Dec 25, 2009 at 2:10 PM, vineet semwal
wrote:

> it doesn't use converter even for the multilinelabel..
> some months ago i needed converter for multilinelabel inside
> ajaxeditablemultilinelabel,
>  i  subclassed ajaxeditablemultilinelabel and provided converter logic for
> multilinelabel there,
> it didn't take much time ;)
>
>
> On Sat, Dec 26, 2009 at 2:02 AM, Sven Meier  wrote:
>
> > AjaxEditableMultiLineLabel doesn't use its converter for the wrapped
> editor
> > as AjaxEditableLabel does - see #newEditor().
> >
> > You should create a RFE in JIRA.
> >
> > Sven
> >
> > Alec Swan wrote:
> >
> >> I am using  to allow the user to enter a Velocity
> >>
> >> template in the editor and then preview the bound template content in
> the
> >> label.
> >>
> >> I created a TemplateConverter class and overrode
> >> AjaxEditableMultiLineLabel#getConverter() method to return an instance
> of
> >> TemplateConverter. However, the
> AjaxEditableMultiLineLabel#getConverter()
> >> is
> >> never called.
> >>
> >> What am I doing wring and what is the recommended way to do this?
> >>
> >> Thanks,
> >>
> >> Alec
> >>
> >>
> >>
> >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>
>
> --
> regards,
> Vineet Semwal
>


Testing AjaxSubmitLink#onSubmit() with WicketTester

2009-12-27 Thread Alec Swan
I have a page with a form and AjaxSubmitLink in the form.

I call WicketTester#clickLink(pathToLink, true) to test the code in
AjaxSubmitLink#onSubmit(). The call returns with no errors, but
AjaxSubmitLink#onSubmit() is never called.

Here is a code sample:

tester.startPanel(MyPanel.class);
final FormTester formTester = tester.newFormTester(FORM_PATH);

// Test: Submit form with valid inputs
formTester.setValue("company", "company");
formTester.setValue("phone", "phone");
*tester.clickLink(SUBMIT_LINK_PATH, true);*

Thanks,

Alec


Is AnnotApplicationContextMock() broken in Wicket 1.4.5?

2009-12-28 Thread Alec Swan
I just upgraded from Wicket 1.4.2 to Wicket 1.4.5 and started receiving the
following exceptions from my Unit test.

Is this a known issue or do I need to change my test?

Thanks.

org.apache.wicket.WicketRuntimeException: *There is no application attached
to current thread main*
at org.apache.wicket.Application.get(Application.java:179)
at
org.apache.wicket.injection.web.InjectorHolder.setInjector(InjectorHolder.java:88)
at
org.apache.wicket.spring.injection.annot.test.AnnotApplicationContextMock.(AnnotApplicationContextMock.java:61)
at
com.galecsy.lrm.wicket.referral.ReferralFormTest.beforeTest(ReferralFormTest.java:43)
at
org.springframework.test.context.junit4.SpringMethodRoadie.runBefores(SpringMethodRoadie.java:273)
at
org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThenTestThenAfters.run(SpringMethodRoadie.java:332)
at
org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:217)
at
org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:197)
at
org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:143)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:160)
at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)


SOLVED: Is AnnotApplicationContextMock() broken in Wicket 1.4.5? @l

2009-12-28 Thread Alec Swan
The problem was that the test case was creating AnnotApplicationContextMock
before creating the WebApplication itself. The following code worked for me:

MyApplication webApp = new MyApplication()
{
@Override
public void init() {
addComponentInstantiationListener(new
SpringComponentInjector(this, new AnnotApplicationContextMock(), false));
}
};

Alec


On Mon, Dec 28, 2009 at 11:01 AM, Alec Swan  wrote:

> I just upgraded from Wicket 1.4.2 to Wicket 1.4.5 and started receiving the
> following exceptions from my Unit test.
>
> Is this a known issue or do I need to change my test?
>
> Thanks.
>
> org.apache.wicket.WicketRuntimeException: *There is no application
> attached to current thread main*
> at org.apache.wicket.Application.get(Application.java:179)
> at
> org.apache.wicket.injection.web.InjectorHolder.setInjector(InjectorHolder.java:88)
> at
> org.apache.wicket.spring.injection.annot.test.AnnotApplicationContextMock.(AnnotApplicationContextMock.java:61)
> at
> com.galecsy.lrm.wicket.referral.ReferralFormTest.beforeTest(ReferralFormTest.java:43)
> at
> org.springframework.test.context.junit4.SpringMethodRoadie.runBefores(SpringMethodRoadie.java:273)
> at
> org.springframework.test.context.junit4.SpringMethodRoadie$RunBeforesThenTestThenAfters.run(SpringMethodRoadie.java:332)
> at
> org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:217)
> at
> org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:197)
> at
> org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:143)
> at
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:160)
> at
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
>
>
>


Re: Testing AjaxSubmitLink#onSubmit() with WicketTester @L

2009-12-28 Thread Alec Swan
I unsuccessfully tried several different ways to invoke the AjaxSubmitLink
from my test method.

   1. formTester.submit("submitButton") does not call
   AjaxSubmitLink#onSubmit(AjaxRequestTarget target, Form form)
   2. formTester.submitLink("submitButton", false) fails with
   *org.apache.wicket.WicketRuntimeException: Link
   panel:referralForm:submitButtonis an AjaxSubmitLink and will not be invoked
   when AJAX (javascript) is disabled.*
   3. tester.clickLink("referralForm:submitButton, true) does not call
   AjaxSubmitLink#onSubmit(AjaxRequestTarget target, Form form)
   4. EnhancedWicketTester.clickAjaxLink("referralForm:submitButton") fails
   with
   *junit.framework.AssertionFailedError: component
   'ReferralPanel$ReferralForm$2' is not type:Link*
   This makes sense because AjaxSubmitLink class is not a subclass of Link.

So, how do I test AjaxSubmitLink#onSubmit(AjaxRequestTarget target, Form
form) method?

Thanks,

Alec

@L

On Sun, Dec 27, 2009 at 9:44 AM, Alec Swan  wrote:

> I have a page with a form and AjaxSubmitLink in the form.
>
> I call WicketTester#clickLink(pathToLink, true) to test the code in
> AjaxSubmitLink#onSubmit(). The call returns with no errors, but
> AjaxSubmitLink#onSubmit() is never called.
>
> Here is a code sample:
>
> tester.startPanel(MyPanel.class);
> final FormTester formTester = tester.newFormTester(FORM_PATH);
>
> // Test: Submit form with valid inputs
> formTester.setValue("company", "company");
> formTester.setValue("phone", "phone");
> *tester.clickLink(SUBMIT_LINK_PATH, true);*
>
> Thanks,
>
> Alec
>
>
>
>
>


FormTester.submit(buttonId) unchecks CheckBoxes @L

2009-12-31 Thread Alec Swan
I have a form which contains a DataView where each row has a checkbox.
The form also contains a submit link which deletes the rows with
selected checkboxes from the database.

The following code uses WicketTester to test the form behavior. The
checkboxes are selected correctly before FormTester.submit(buttonId)
is called. However, FormTester.submit(buttonId) method calls
CheckBox#unselect() on each checkbox before submitting the form. Why
is that?

Thanks,

public void selectAndDeleteRecipients() {
final FormTester formTester = tester.newFormTester("myForm");
final Form form = formTester.getForm();
form.visitChildren(CheckBox.class, new IVisitor()
{
@Override
public Object component(CheckBox component) {
final IdCheckBoxModel checkBoxModel =
(IdCheckBoxModel) component.getDefaultModel();
checkBoxModel.select();
return CONTINUE_TRAVERSAL;
}
});

formTester.submit("deleteButton"); // this call unselects all
check boxes
}


/**
 * A checkbox containing an object id.
 */
public class IdCheckBoxModel extends AbstractCheckBoxModel
{
private final long objectId;

private final Set selectedIds;

public IdCheckBoxModel(Long objectId, Set selectedIds) {
Verify.argumentsNotNull(objectId, selectedIds);
this.objectId = objectId;
this.selectedIds = selectedIds;
}

public long getObjectId() {
return objectId;
}

@Override
public boolean isSelected() {
return selectedIds.contains(objectId);
}

@Override
public void select() {
selectedIds.add(objectId);
}

@Override
public void unselect() {
selectedIds.remove(objectId);
}
}

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



Re: FormTester.submit(buttonId) unchecks CheckBoxes @L

2009-12-31 Thread Alec Swan
Note that the code works on the live system. In other words, records
selected by the user get deleted from the database when the user
submits the form.

I'd appreciate any thoughts on why formTester.submit("deleteButton")
deselects each checkbox before submitting the form.

Thanks

On Thu, Dec 31, 2009 at 11:30 AM, Alec Swan  wrote:
> I have a form which contains a DataView where each row has a checkbox.
> The form also contains a submit link which deletes the rows with
> selected checkboxes from the database.
>
> The following code uses WicketTester to test the form behavior. The
> checkboxes are selected correctly before FormTester.submit(buttonId)
> is called. However, FormTester.submit(buttonId) method calls
> CheckBox#unselect() on each checkbox before submitting the form. Why
> is that?
>
> Thanks,
>
> public void selectAndDeleteRecipients() {
>        final FormTester formTester = tester.newFormTester("myForm");
>        final Form form = formTester.getForm();
>        form.visitChildren(CheckBox.class, new IVisitor()
>        {
>           �...@override
>            public Object component(CheckBox component) {
>                final IdCheckBoxModel checkBoxModel =
> (IdCheckBoxModel) component.getDefaultModel();
>                checkBoxModel.select();
>                return CONTINUE_TRAVERSAL;
>            }
>        });
>
>        formTester.submit("deleteButton"); // this call unselects all
> check boxes
>    }
>
>
> /**
>  * A checkbox containing an object id.
>  */
> public class IdCheckBoxModel extends AbstractCheckBoxModel
> {
>    private final long objectId;
>
>    private final Set selectedIds;
>
>    public IdCheckBoxModel(Long objectId, Set selectedIds) {
>        Verify.argumentsNotNull(objectId, selectedIds);
>        this.objectId = objectId;
>        this.selectedIds = selectedIds;
>    }
>
>    public long getObjectId() {
>        return objectId;
>    }
>
>   �...@override
>    public boolean isSelected() {
>        return selectedIds.contains(objectId);
>    }
>
>   �...@override
>    public void select() {
>        selectedIds.add(objectId);
>    }
>
>   �...@override
>    public void unselect() {
>        selectedIds.remove(objectId);
>    }
> }
>

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



SOLVED: FormTester.submit(buttonId) unchecks CheckBoxes @L

2009-12-31 Thread Alec Swan
formTester.submit("deleteButton") failed because component with
"deleteButton" id was a SubmitLink.

The following code works:
formTester.submitLink("deleteButton", false);

On Thu, Dec 31, 2009 at 2:38 PM, Alec Swan  wrote:
> Note that the code works on the live system. In other words, records
> selected by the user get deleted from the database when the user
> submits the form.
>
> I'd appreciate any thoughts on why formTester.submit("deleteButton")
> deselects each checkbox before submitting the form.
>
> Thanks
>
> On Thu, Dec 31, 2009 at 11:30 AM, Alec Swan  wrote:
>> I have a form which contains a DataView where each row has a checkbox.
>> The form also contains a submit link which deletes the rows with
>> selected checkboxes from the database.
>>
>> The following code uses WicketTester to test the form behavior. The
>> checkboxes are selected correctly before FormTester.submit(buttonId)
>> is called. However, FormTester.submit(buttonId) method calls
>> CheckBox#unselect() on each checkbox before submitting the form. Why
>> is that?
>>
>> Thanks,
>>
>> public void selectAndDeleteRecipients() {
>>        final FormTester formTester = tester.newFormTester("myForm");
>>        final Form form = formTester.getForm();
>>        form.visitChildren(CheckBox.class, new IVisitor()
>>        {
>>           �...@override
>>            public Object component(CheckBox component) {
>>                final IdCheckBoxModel checkBoxModel =
>> (IdCheckBoxModel) component.getDefaultModel();
>>                checkBoxModel.select();
>>                return CONTINUE_TRAVERSAL;
>>            }
>>        });
>>
>>        formTester.submit("deleteButton"); // this call unselects all
>> check boxes
>>    }
>>
>>
>> /**
>>  * A checkbox containing an object id.
>>  */
>> public class IdCheckBoxModel extends AbstractCheckBoxModel
>> {
>>    private final long objectId;
>>
>>    private final Set selectedIds;
>>
>>    public IdCheckBoxModel(Long objectId, Set selectedIds) {
>>        Verify.argumentsNotNull(objectId, selectedIds);
>>        this.objectId = objectId;
>>        this.selectedIds = selectedIds;
>>    }
>>
>>    public long getObjectId() {
>>        return objectId;
>>    }
>>
>>   �...@override
>>    public boolean isSelected() {
>>        return selectedIds.contains(objectId);
>>    }
>>
>>   �...@override
>>    public void select() {
>>        selectedIds.add(objectId);
>>    }
>>
>>   �...@override
>>    public void unselect() {
>>        selectedIds.remove(objectId);
>>    }
>> }
>>
>

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



Ajax editable image @L

2010-01-08 Thread Alec Swan
I am using Wicket to implement an image component which behaves
similarly to AjaxEditableLabel.

When the component is rendered it should look like a regular image
. When the user clicks on the image, it should display
a file upload component which will allow the user to replace the
image.

What is the easiest way to implement this behavior? Is there a
component that already does this? If not, which Wicket class should I
extend?

Thanks,

Alec

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



Re: Ajax editable image @L

2010-01-10 Thread Alec Swan
Thanks Juan, I will give this a try.

On Fri, Jan 8, 2010 at 8:39 PM, Juan Carlos Garcia M.
 wrote:
>
> There isn't such component in wicket to achieve that, but it should be fairly
> easy to build i.e:
>
> 1-Having a Panel with the FileUpload that you want
> 2-Having a Panel with the image tag   that you want
> 3-Having a WebMarkup Container that act as a placeHolder for either 1 or 2
> at a given time.
>
> on you onClick behavior of the image panel you could call something like
> [ImagePanel.this.replaceWith(referenceOfFileUploadPanel)]
>
> To just Swap between panels, take a look at this
> http://pawelzubkiewicz.blogspot.com/2009/06/wicket-swapping-replacing-fragments.html
> example
>
> Hope you get the Idea
>
>
>
> alecswan1 wrote:
>>
>> I am using Wicket to implement an image component which behaves
>> similarly to AjaxEditableLabel.
>>
>> When the component is rendered it should look like a regular image
>>  .. . When the user clicks on the image, it should display
>> a file upload component which will allow the user to replace the
>> image.
>>
>> What is the easiest way to implement this behavior? Is there a
>> component that already does this? If not, which Wicket class should I
>> extend?
>>
>> Thanks,
>>
>> Alec
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>>
>
> --
> View this message in context: 
> http://old.nabble.com/Ajax-editable-image-%40L-tp27084451p27085401.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



Re: Ajax editable image @L

2010-02-06 Thread Alec Swan
Juan's approach works, but I found myself reimplementing some of
AxajEditableLabel event-handling code.

So, I tried another approach where I create a panel with two fragments
"pictureFragment" and "uploadFragment". I then add an
AxajEditableLabel to the panel which would ideally override
newLabel(..) to return PictureFragment and override newEditor(..) to
return UploadFragment.

However, the problem is that the return types of these two methods are
not compatible with the Fragment class.

Is it possible to swap an image with an upload form using
AxajEditableLabel and Fragments?

Thanks,

Alec

On Fri, Jan 8, 2010 at 8:39 PM, Juan Carlos Garcia M.
 wrote:
>
> There isn't such component in wicket to achieve that, but it should be fairly
> easy to build i.e:
>
> 1-Having a Panel with the FileUpload that you want
> 2-Having a Panel with the image tag   that you want
> 3-Having a WebMarkup Container that act as a placeHolder for either 1 or 2
> at a given time.
>
> on you onClick behavior of the image panel you could call something like
> [ImagePanel.this.replaceWith(referenceOfFileUploadPanel)]
>
> To just Swap between panels, take a look at this
> http://pawelzubkiewicz.blogspot.com/2009/06/wicket-swapping-replacing-fragments.html
> example
>
> Hope you get the Idea
>
>
>
> alecswan1 wrote:
>>
>> I am using Wicket to implement an image component which behaves
>> similarly to AjaxEditableLabel.
>>
>> When the component is rendered it should look like a regular image
>>  .. . When the user clicks on the image, it should display
>> a file upload component which will allow the user to replace the
>> image.
>>
>> What is the easiest way to implement this behavior? Is there a
>> component that already does this? If not, which Wicket class should I
>> extend?
>>
>> Thanks,
>>
>> Alec
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>>
>
> --
> View this message in context: 
> http://old.nabble.com/Ajax-editable-image-%40L-tp27084451p27085401.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



Loading properties file while using Spring @L

2010-02-07 Thread Alec Swan
I use Wicket, Spring and wicket-spring extensions. Spring
configuration loads properties from config/env.properties file using
PropertyPlaceholderConfigurer. I would like to add more properties to
this file and read them from my Wicket application class. I tried to
inject a Spring Resource using @SpringBean annotation, but it doesn't
work in the my Wicket application class.

I am looking for recommendations on how to read properties files from
wicket application class. Ideally I would like to use a single
properties file read by Wicket and Spring.

Thanks,

Alec

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



Re: Loading properties file while using Spring @L

2010-02-08 Thread Alec Swan
Igor, were you suggesting the same approach as James did?

If so, I am already using @SpringBean annotations and I am wondering
if they will continue to work with the
http://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectApproach
approach?

Thanks.

On Mon, Feb 8, 2010 at 4:41 AM, James Carman
 wrote:
> You can use the Spring integration to actually create your application
> object for you:
>
> http://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectApproach
>
> Then, you can wire in anything into it that you want, just like any
> other Spring bean (because it *is* just another Spring bean)
>
> On Sun, Feb 7, 2010 at 11:29 PM, Alec Swan  wrote:
>> I use Wicket, Spring and wicket-spring extensions. Spring
>> configuration loads properties from config/env.properties file using
>> PropertyPlaceholderConfigurer. I would like to add more properties to
>> this file and read them from my Wicket application class. I tried to
>> inject a Spring Resource using @SpringBean annotation, but it doesn't
>> work in the my Wicket application class.
>>
>> I am looking for recommendations on how to read properties files from
>> wicket application class. Ideally I would like to use a single
>> properties file read by Wicket and Spring.
>>
>> Thanks,
>>
>> Alec
>>
>> -
>> 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: Loading properties file while using Spring @L

2010-02-08 Thread Alec Swan
Igor, how do you inject the configuration bean in the Wicket
application? Do you use
http://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectApproach
approach?

Thanks,

Alec

On Mon, Feb 8, 2010 at 10:33 AM, Igor Vaynberg  wrote:
> i usually create a seperate bean that represents the properties and
> let spring fill those in via the property configurer. then inject the
> bean and you are done.
>
> -igor
>
> On Mon, Feb 8, 2010 at 8:18 AM, Alec Swan  wrote:
>> Igor, were you suggesting the same approach as James did?
>>
>> If so, I am already using @SpringBean annotations and I am wondering
>> if they will continue to work with the
>> http://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectApproach
>> approach?
>>
>> Thanks.
>>
>> On Mon, Feb 8, 2010 at 4:41 AM, James Carman
>>  wrote:
>>> You can use the Spring integration to actually create your application
>>> object for you:
>>>
>>> http://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectApproach
>>>
>>> Then, you can wire in anything into it that you want, just like any
>>> other Spring bean (because it *is* just another Spring bean)
>>>
>>> On Sun, Feb 7, 2010 at 11:29 PM, Alec Swan  wrote:
>>>> I use Wicket, Spring and wicket-spring extensions. Spring
>>>> configuration loads properties from config/env.properties file using
>>>> PropertyPlaceholderConfigurer. I would like to add more properties to
>>>> this file and read them from my Wicket application class. I tried to
>>>> inject a Spring Resource using @SpringBean annotation, but it doesn't
>>>> work in the my Wicket application class.
>>>>
>>>> I am looking for recommendations on how to read properties files from
>>>> wicket application class. Ideally I would like to use a single
>>>> properties file read by Wicket and Spring.
>>>>
>>>> Thanks,
>>>>
>>>> Alec
>>>>
>>>> -
>>>> 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



Re: Loading properties file while using Spring @L

2010-02-08 Thread Alec Swan
Andrew, I use @SpringBean annotations in Wicket components. How do you
use annotation-based approach to inject dependencies in the Wicket
application object?

On Mon, Feb 8, 2010 at 6:30 PM, Andrew Lombardi  wrote:
> the annotation-based approach is the most often used on that page.
>
> On Feb 8, 2010, at 5:28 PM, Alec Swan wrote:
>
>> Igor, how do you inject the configuration bean in the Wicket
>> application? Do you use
>> http://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectApproach
>> approach?
>>
>> Thanks,
>>
>> Alec
>>
>> On Mon, Feb 8, 2010 at 10:33 AM, Igor Vaynberg  
>> wrote:
>>> i usually create a seperate bean that represents the properties and
>>> let spring fill those in via the property configurer. then inject the
>>> bean and you are done.
>>>
>>> -igor
>>>
>>> On Mon, Feb 8, 2010 at 8:18 AM, Alec Swan  wrote:
>>>> Igor, were you suggesting the same approach as James did?
>>>>
>>>> If so, I am already using @SpringBean annotations and I am wondering
>>>> if they will continue to work with the
>>>> http://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectApproach
>>>> approach?
>>>>
>>>> Thanks.
>>>>
>>>> On Mon, Feb 8, 2010 at 4:41 AM, James Carman
>>>>  wrote:
>>>>> You can use the Spring integration to actually create your application
>>>>> object for you:
>>>>>
>>>>> http://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectApproach
>>>>>
>>>>> Then, you can wire in anything into it that you want, just like any
>>>>> other Spring bean (because it *is* just another Spring bean)
>>>>>
>>>>> On Sun, Feb 7, 2010 at 11:29 PM, Alec Swan  wrote:
>>>>>> I use Wicket, Spring and wicket-spring extensions. Spring
>>>>>> configuration loads properties from config/env.properties file using
>>>>>> PropertyPlaceholderConfigurer. I would like to add more properties to
>>>>>> this file and read them from my Wicket application class. I tried to
>>>>>> inject a Spring Resource using @SpringBean annotation, but it doesn't
>>>>>> work in the my Wicket application class.
>>>>>>
>>>>>> I am looking for recommendations on how to read properties files from
>>>>>> wicket application class. Ideally I would like to use a single
>>>>>> properties file read by Wicket and Spring.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Alec
>>>>>>
>>>>>> -
>>>>>> 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
>>
>
>
> To our success!
>
> Mystic Coders, LLC | Code Magic | www.mysticcoders.com
>
> ANDREW LOMBARDI | and...@mysticcoders.com
> 2321 E 4th St. Ste C-128, Santa Ana CA 92705
> ofc: 714-816-4488
> fax: 714-782-6024
> cell: 714-697-8046
> linked-in: http://www.linkedin.com/in/andrewlombardi
> twitter: http://www.twitter.com/kinabalu
>
> Eco-Tip: Printing e-mails is usually a waste.
>
> 
> This message is for the named person's use only. You must not, directly or 
> indirectly, use,
>  disclose, distribute, print, or copy any part of this message if you are not 
> the intended recipient.
> 
>
>

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



Re: Loading properties file while using Spring @L

2010-02-08 Thread Alec Swan
Thanks James, this is awesome! This is what I ended up doing in my
Wicket WebApplication object:

@SpringBean(name = "myConfiguration")
private MyConfiguration myConfiguration;

protected void init() {
super.init();

// integrate with Spring
addComponentInstantiationListener(new SpringComponentInjector(this));
InjectorHolder.getInjector().inject(this); // injects
@SpringBean dependencies of this object
}


On Mon, Feb 8, 2010 at 6:52 PM, James Carman
 wrote:
> You can inject anything you like that's annotated with the @SpringBean
> annotations:
>
> InjectorHolder.getInjector().inject(someNonComponentObject);
>
> On Mon, Feb 8, 2010 at 8:46 PM, Alec Swan  wrote:
>> Andrew, I use @SpringBean annotations in Wicket components. How do you
>> use annotation-based approach to inject dependencies in the Wicket
>> application object?
>>
>> On Mon, Feb 8, 2010 at 6:30 PM, Andrew Lombardi  
>> wrote:
>>> the annotation-based approach is the most often used on that page.
>>>
>>> On Feb 8, 2010, at 5:28 PM, Alec Swan wrote:
>>>
>>>> Igor, how do you inject the configuration bean in the Wicket
>>>> application? Do you use
>>>> http://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectApproach
>>>> approach?
>>>>
>>>> Thanks,
>>>>
>>>> Alec
>>>>
>>>> On Mon, Feb 8, 2010 at 10:33 AM, Igor Vaynberg  
>>>> wrote:
>>>>> i usually create a seperate bean that represents the properties and
>>>>> let spring fill those in via the property configurer. then inject the
>>>>> bean and you are done.
>>>>>
>>>>> -igor
>>>>>
>>>>> On Mon, Feb 8, 2010 at 8:18 AM, Alec Swan  wrote:
>>>>>> Igor, were you suggesting the same approach as James did?
>>>>>>
>>>>>> If so, I am already using @SpringBean annotations and I am wondering
>>>>>> if they will continue to work with the
>>>>>> http://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectApproach
>>>>>> approach?
>>>>>>
>>>>>> Thanks.
>>>>>>
>>>>>> On Mon, Feb 8, 2010 at 4:41 AM, James Carman
>>>>>>  wrote:
>>>>>>> You can use the Spring integration to actually create your application
>>>>>>> object for you:
>>>>>>>
>>>>>>> http://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectApproach
>>>>>>>
>>>>>>> Then, you can wire in anything into it that you want, just like any
>>>>>>> other Spring bean (because it *is* just another Spring bean)
>>>>>>>
>>>>>>> On Sun, Feb 7, 2010 at 11:29 PM, Alec Swan  wrote:
>>>>>>>> I use Wicket, Spring and wicket-spring extensions. Spring
>>>>>>>> configuration loads properties from config/env.properties file using
>>>>>>>> PropertyPlaceholderConfigurer. I would like to add more properties to
>>>>>>>> this file and read them from my Wicket application class. I tried to
>>>>>>>> inject a Spring Resource using @SpringBean annotation, but it doesn't
>>>>>>>> work in the my Wicket application class.
>>>>>>>>
>>>>>>>> I am looking for recommendations on how to read properties files from
>>>>>>>> wicket application class. Ideally I would like to use a single
>>>>>>>> properties file read by Wicket and Spring.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>> Alec
>>>>>>>>
>>>>>>>> -
>>>>>>>> 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
>>>>>>>
>>>>>>>
>>>>>>
&g

Re: Loading properties file while using Spring @L

2010-02-08 Thread Alec Swan
Igor, I looked at Salve even though James suggestion will work for my
small project.

If I understood correctly Salve is an IoC container which can
serialize objects with complex dependencies. I think this can be very
useful when serializing Wicket components that depend on DAO or other
types of services.

Thanks!

Alec

On Mon, Feb 8, 2010 at 7:08 PM, Alec Swan  wrote:
> Thanks James, this is awesome! This is what I ended up doing in my
> Wicket WebApplication object:
>
> @SpringBean(name = "myConfiguration")
> private MyConfiguration myConfiguration;
>
> protected void init() {
>        super.init();
>
>        // integrate with Spring
>        addComponentInstantiationListener(new SpringComponentInjector(this));
>        InjectorHolder.getInjector().inject(this); // injects
> @SpringBean dependencies of this object
> }
>
>
> On Mon, Feb 8, 2010 at 6:52 PM, James Carman
>  wrote:
>> You can inject anything you like that's annotated with the @SpringBean
>> annotations:
>>
>> InjectorHolder.getInjector().inject(someNonComponentObject);
>>
>> On Mon, Feb 8, 2010 at 8:46 PM, Alec Swan  wrote:
>>> Andrew, I use @SpringBean annotations in Wicket components. How do you
>>> use annotation-based approach to inject dependencies in the Wicket
>>> application object?
>>>
>>> On Mon, Feb 8, 2010 at 6:30 PM, Andrew Lombardi  
>>> wrote:
>>>> the annotation-based approach is the most often used on that page.
>>>>
>>>> On Feb 8, 2010, at 5:28 PM, Alec Swan wrote:
>>>>
>>>>> Igor, how do you inject the configuration bean in the Wicket
>>>>> application? Do you use
>>>>> http://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectApproach
>>>>> approach?
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Alec
>>>>>
>>>>> On Mon, Feb 8, 2010 at 10:33 AM, Igor Vaynberg  
>>>>> wrote:
>>>>>> i usually create a seperate bean that represents the properties and
>>>>>> let spring fill those in via the property configurer. then inject the
>>>>>> bean and you are done.
>>>>>>
>>>>>> -igor
>>>>>>
>>>>>> On Mon, Feb 8, 2010 at 8:18 AM, Alec Swan  wrote:
>>>>>>> Igor, were you suggesting the same approach as James did?
>>>>>>>
>>>>>>> If so, I am already using @SpringBean annotations and I am wondering
>>>>>>> if they will continue to work with the
>>>>>>> http://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectApproach
>>>>>>> approach?
>>>>>>>
>>>>>>> Thanks.
>>>>>>>
>>>>>>> On Mon, Feb 8, 2010 at 4:41 AM, James Carman
>>>>>>>  wrote:
>>>>>>>> You can use the Spring integration to actually create your application
>>>>>>>> object for you:
>>>>>>>>
>>>>>>>> http://cwiki.apache.org/WICKET/spring.html#Spring-ApplicationObjectApproach
>>>>>>>>
>>>>>>>> Then, you can wire in anything into it that you want, just like any
>>>>>>>> other Spring bean (because it *is* just another Spring bean)
>>>>>>>>
>>>>>>>> On Sun, Feb 7, 2010 at 11:29 PM, Alec Swan  wrote:
>>>>>>>>> I use Wicket, Spring and wicket-spring extensions. Spring
>>>>>>>>> configuration loads properties from config/env.properties file using
>>>>>>>>> PropertyPlaceholderConfigurer. I would like to add more properties to
>>>>>>>>> this file and read them from my Wicket application class. I tried to
>>>>>>>>> inject a Spring Resource using @SpringBean annotation, but it doesn't
>>>>>>>>> work in the my Wicket application class.
>>>>>>>>>
>>>>>>>>> I am looking for recommendations on how to read properties files from
>>>>>>>>> wicket application class. Ideally I would like to use a single
>>>>>>>>> properties file read by Wicket and Spring.
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>>
>>>>>>>>> Alec
>>>>>>>>>
>>>>>>>>> 

How to increase the width of the AjaxEditableLabel editor? @L

2010-02-23 Thread Alec Swan
I noticed that when the user clicks on AjaxEditableLabel to edit the text
the width of the edited area is reduced to 30 or so characters.

How can I change the width of AjaxEditableLabel editor?

Thanks.


Re: How to increase the width of the AjaxEditableLabel editor? @L

2010-03-07 Thread Alec Swan
Just to follow up on my previous post.

Does anybody know if it's possible to increase the number of characters
displayed in the AjaxEditableLabel editor input text field?

Thanks.

On Tue, Feb 23, 2010 at 11:36 AM, Alec Swan  wrote:

> I noticed that when the user clicks on AjaxEditableLabel to edit the text
> the width of the edited area is reduced to 30 or so characters.
>
> How can I change the width of AjaxEditableLabel editor?
>
> Thanks.
>


Spring @Autowire not working

2010-03-10 Thread Alec Swan
I use @SpringBean to wire service classes in my Wicket pages and it works great.

My service classes have dependencies on DAO classes. I am currently
wiring DAO classes into service classes adding setters for them and
adding them in the service classes and also specifying DAOs as
 elements in the Spring application context XML. This
approach works, but is verbose.

I would like to just annotate the DAO dependency with @Autowired
annotation in my service class and have it automatically injected by
Spring. This doesn't work and the DAO is never injected.

How can I fix this?

Thanks.

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



Re: Spring @Autowire not working

2010-03-10 Thread Alec Swan
Hi Martin, thank you for sharing your setup. I will try it it out in
my application.

Igor, you are probably right and maybe this post doesn't belong on the
Wicket forum. The reason why I posted it is that @Autowired annotation
works when I call it from my tests, but doesn't work when I call it
from my Wicket pages. So, this is more of a "configuration" rather
than a "bug" question.  Keep up the good work!

Thanks.

On Wed, Mar 10, 2010 at 12:58 PM, Igor Vaynberg  wrote:
> this is purely a spring question no? why dont you ask on their forums...
>
> -igor
>
> On Wed, Mar 10, 2010 at 11:38 AM, Alec Swan  wrote:
>> I use @SpringBean to wire service classes in my Wicket pages and it works 
>> great.
>>
>> My service classes have dependencies on DAO classes. I am currently
>> wiring DAO classes into service classes adding setters for them and
>> adding them in the service classes and also specifying DAOs as
>>  elements in the Spring application context XML. This
>> approach works, but is verbose.
>>
>> I would like to just annotate the DAO dependency with @Autowired
>> annotation in my service class and have it automatically injected by
>> Spring. This doesn't work and the DAO is never injected.
>>
>> How can I fix this?
>>
>> 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



How to specify different log4j.properties for production and WicketTester servlet container?

2010-03-19 Thread Alec Swan
We have WEB-INF/classes/log4j.properties file which instructs log4j to log
to ${catalina.home}/logs/${logFileName}.log file. This works great when I
deploy the web app in Tomcat.

However, I would like the logs to be written to a different file when I run
my tests that use WicketTester and start their own servlet containers. How
can I instruct my tests to log to a different location or even use a
different log4j.properties file altogether?

Thanks.


Re: How to specify different log4j.properties for production and WicketTester servlet container?

2010-03-19 Thread Alec Swan
Hi,

It looks like the link you provided is temporarily down, but I am assuming
that your idea was to replace log4j.properties file with the one specific to
each maven profile.

This is definitely an option, but I am have limited control over the build
file because it is generated by my NetBeans IDE.

I wonder if there is a way to specify log4j.properties location
programmatically in the test code. Maybe somehow override the classpath of
Wicket Tester's servlet container?

Thanks.

Alec

On Fri, Mar 19, 2010 at 1:17 PM, James Carman
wrote:

> You can look at how I set up configuration stuff in my Advanced Wicket
> example code:
>
> http://svn.carmanconsulting.com/public/wicket-advanced/trunk
>
> Basically, I use maven profiles to point to different configuration
> directories for each environment (dev, test, prod).  Perhaps that
> would help.
>
> On Fri, Mar 19, 2010 at 3:01 PM, Alec Swan  wrote:
> > We have WEB-INF/classes/log4j.properties file which instructs log4j to
> log
> > to ${catalina.home}/logs/${logFileName}.log file. This works great when I
> > deploy the web app in Tomcat.
> >
> > However, I would like the logs to be written to a different file when I
> run
> > my tests that use WicketTester and start their own servlet containers.
> How
> > can I instruct my tests to log to a different location or even use a
> > different log4j.properties file altogether?
> >
> > Thanks.
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: How to specify different log4j.properties for production and WicketTester servlet container?

2010-03-19 Thread Alec Swan
Changes to the test classpath suggested by Igor worked. I was under the
wrong impression that Wicket Tester was deploying my web app the same way it
is deployed in Tomcat in production and hence was always reading
WEB-INF/classes/log4j.properties.

On Fri, Mar 19, 2010 at 2:11 PM, Igor Vaynberg wrote:

> put another log4j.properties into your src/test/resources or
> src/test/java. since the test dirs are before the main dirs when tests
> run they will override log4j.properties in your src/main/resources or
> src/main/java
>
> -igor
>
> On Fri, Mar 19, 2010 at 12:59 PM, Alec Swan  wrote:
> > Hi,
> >
> > It looks like the link you provided is temporarily down, but I am
> assuming
> > that your idea was to replace log4j.properties file with the one specific
> to
> > each maven profile.
> >
> > This is definitely an option, but I am have limited control over the
> build
> > file because it is generated by my NetBeans IDE.
> >
> > I wonder if there is a way to specify log4j.properties location
> > programmatically in the test code. Maybe somehow override the classpath
> of
> > Wicket Tester's servlet container?
> >
> > Thanks.
> >
> > Alec
> >
> > On Fri, Mar 19, 2010 at 1:17 PM, James Carman
> > wrote:
> >
> >> You can look at how I set up configuration stuff in my Advanced Wicket
> >> example code:
> >>
> >> http://svn.carmanconsulting.com/public/wicket-advanced/trunk
> >>
> >> Basically, I use maven profiles to point to different configuration
> >> directories for each environment (dev, test, prod).  Perhaps that
> >> would help.
> >>
> >> On Fri, Mar 19, 2010 at 3:01 PM, Alec Swan  wrote:
> >> > We have WEB-INF/classes/log4j.properties file which instructs log4j to
> >> log
> >> > to ${catalina.home}/logs/${logFileName}.log file. This works great
> when I
> >> > deploy the web app in Tomcat.
> >> >
> >> > However, I would like the logs to be written to a different file when
> I
> >> run
> >> > my tests that use WicketTester and start their own servlet containers.
> >> How
> >> > can I instruct my tests to log to a different location or even use a
> >> > different log4j.properties file altogether?
> >> >
> >> > 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
>
>


Re: Re-Captcha with WiQuery ButtonBehavior causes "Channel busy - postponing"

2011-07-22 Thread Alec Swan
I didn't get any feedback on this and was thinking about posting this
on WiQuery forum but it didn't look very active. Does anybody have any
thoughts on why we are getting "Channel busy - postponing" message?

Thanks

On Tue, Jul 19, 2011 at 3:42 PM, Alec Swan  wrote:
> Hello,
>
> We have a re-captcha button which refreshes captcha password image. It
> works fine until we add WiQuery ButtonBehavior to the button. With
> this behavior the captcha image is no longer refreshed and Wicked Ajax
> Debugger displays "INFO: "Channel busy - postponing". The following is
> a code snippet which describes the problem. Uncommenting add(new
> ButtonBehavior()) breaks re-captcha functionality.
>
> Please help,
>
> Thanks
>
> new AjaxLink("reCaptcha")
>            {
>                @Override
>                public void onClick(AjaxRequestTarget target) {
>                    password = newPassword();
>                    CaptchaImageResource captchaImageResource = new
> CaptchaImageResource(password);
>                    NonCachingImage imgCaptcha = new
> NonCachingImage("captchaImage", captchaImageResource);
>                    imgCaptcha.setOutputMarkupId(true);
>                    SignUpForm.this.addOrReplace(imgCaptcha);
>                    if (target != null) {
>                        target.addComponent(imgCaptcha);
>                    }
>                }
>            }//.add(new ButtonBehavior())
>

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



Re: Issues with HeaderResponseContainerFilteringHeaderResponse

2011-07-22 Thread Alec Swan
I had a similar case where I wanted to contribute header sections that
are written with renderString() last. I was not able to figure out all
that resource aggregation and bucketing stuff, so I wrote something
simpler. I would appreciate if somebody could review and comment on
this:

setHeaderResponseDecorator(new IHeaderResponseDecorator()
{
@Override
public IHeaderResponse decorate(IHeaderResponse response) {
return new DecoratingHeaderResponse(response)
{
private CharSequence stringToRender;

@Override
public void renderString(CharSequence string) {
stringToRender = stringToRender == null ?
string : stringToRender.toString() + string;
}

@Override
public void close() {
renderStringIfNeeded();
super.close();
}

private void renderStringIfNeeded() {
if (stringToRender != null &&
!wasRendered(stringToRender)) {
super.renderString(stringToRender);
markRendered(stringToRender);
}
}
};
}
});

On Fri, Jul 22, 2011 at 12:28 AM, Martin Grigorov  wrote:
> Hi,
>
> It is not documented by  contributes before
> #renderHead(). This may change in the future so don't rely on it.
> Better take a look at
> http://wicketstuff.org/wicket/resourceaggregation application. There
> you can see how resources are scored. This way you can setup
> org.apache.wicket.resource.filtering.HeaderResponseContainerFilteringHeaderResponse.IHeaderResponseFilter
> which renders your specific contribution after all other.
> To render CSS text use
> org.apache.wicket.markup.html.IHeaderResponse.renderCSS(CharSequence
> css, String id). Use the id in the filter to recognize it.
>
> On Fri, Jul 22, 2011 at 1:00 AM, Loren Cole  wrote:
>> Under normal circumstances I would, but I don't have my css in a file.  It
>> gets pulled from a database and stashed in the session.  All the header
>> contributer classes and resource references assume there's a file somewhere
>> with this info.  But in my case there is not.
>>
>> And, even id I did stuff this data into a file it still wouldn't fix my
>> problem, because the customer defined css needs to override everything else
>> with the same css selector. If another component added a header contributor
>> afterwards that would not be the case.
>>
>> -
>> Loren
>>
>> On Tue, Jul 19, 2011 at 11:35 PM, Jeremy Thomerson <
>> jer...@wickettraining.com> wrote:
>>
>>> To start, don't use a Label to contribute css.  Use a header contributor.
>>> That's what they're made for.
>>> On 2011 7 19 13:22, "Loren Cole"  wrote:
>>> > We're making our application skinable, but I'm having some trouble
>>> getting
>>> > user specified css into the right place in the header. We're working in a
>>> > distributed environment, so instead of saving their css in the file
>>> system
>>> > we're putting it in our database, and in order to get the cascade to work
>>> > properly we need to add this css after all the others. Here's how I'm
>>> > adding it:
>>> >
>>> > StandardPage.java
>>> >
>>> > onInitialize()
>>> > //Add any override style
>>> > Tenant tenant = MyWebSession.get().getTenant();
>>> > Css css = cssRepository.GetStyleByTenant(tenant);
>>> > if(tenant.getBranding() && css != null) {
>>> > add(new Label("style", css.getStyle()));
>>> > }
>>> > }
>>> >
>>> > StandardPage.html
>>> >
>>> > 
>>> > 
>>> > 
>>> >
>>> > -
>>> > So the issue is that thet style tag comes before all my header
>>> > contributions. I've tried specifying a header response decorator like so:
>>> >
>>> > Application.java
>>> >
>>> > public static final String HEADER_FILTER_NAME = "myHeaderBucket";
>>> >
>>> > init() {
>>> > super.init();
>>> > setHeaderResponseDecorator(new IHeaderResponseDecorator() {
>>> >
>>> > HeaderResponseContainerFilteringHeaderResponse.IHeaderResponseFilter[]
>>> > filters = {new CssAcceptingHeaderResponseFilter(HEADER_FILTER_NAME)};
>>> > @Override
>>> > public IHeaderResponse decorate(IHeaderResponse response) {
>>> > return new
>>> > HeaderResponseContainerFilteringHeaderResponse(response,
>>> HEADER_FILTER_NAME,
>>> > filters);
>>> > }
>>> > });
>>> > }
>>> >
>>> > StandardPage.html
>>> >
>>> > 
>>> > 
>>> > 
>>> > 
>>> >
>>> > --
>>> >
>>> > Unfortunately I'm getting this exception when I instantiate a page:
>>> >
>>> > 12:28:04,097 INFO [STDOUT] 2011-07-19 12:28:04.096
>>> [http-127.0.0.1-8080-1]
>>> > [127.0.0.1] [T:2] [U:3 - joe_sharp]
>>> > [com.transverse.bleep.wicket.desktop.DesktopPage] ERROR
>>> > org.apache.wicket.RequestCycle 1529 - Exception in rendering component:
>>> > [MarkupContainer [Component id

Re: Re-Captcha with WiQuery ButtonBehavior causes "Channel busy - postponing"

2011-07-23 Thread Alec Swan
Dan,

Thanks for the pointer. It turned out that our webapp is using jQuery
already and adding WiQuery behavior caused a duplicate WiQuery's
jQuery reference possibly causing problems with handling Ajax
requests.

Thanks,

Alec

On Fri, Jul 22, 2011 at 6:16 PM, Dan Retzlaff  wrote:
> Alec,
>
> Have you checked that no JavaScript errors are being encountered on the
> client? We're not using WiQuery, but we encountered your channel busy
> symptom dealing with https://issues.apache.org/jira/browse/WICKET-3820. The
> client-side AJAX processing was choking before the channel was marked
> available.
>
> Dan
>
> On Fri, Jul 22, 2011 at 4:04 PM, Alec Swan  wrote:
>
>> I didn't get any feedback on this and was thinking about posting this
>> on WiQuery forum but it didn't look very active. Does anybody have any
>> thoughts on why we are getting "Channel busy - postponing" message?
>>
>> Thanks
>>
>> On Tue, Jul 19, 2011 at 3:42 PM, Alec Swan  wrote:
>> > Hello,
>> >
>> > We have a re-captcha button which refreshes captcha password image. It
>> > works fine until we add WiQuery ButtonBehavior to the button. With
>> > this behavior the captcha image is no longer refreshed and Wicked Ajax
>> > Debugger displays "INFO: "Channel busy - postponing". The following is
>> > a code snippet which describes the problem. Uncommenting add(new
>> > ButtonBehavior()) breaks re-captcha functionality.
>> >
>> > Please help,
>> >
>> > Thanks
>> >
>> > new AjaxLink("reCaptcha")
>> >            {
>> >                @Override
>> >                public void onClick(AjaxRequestTarget target) {
>> >                    password = newPassword();
>> >                    CaptchaImageResource captchaImageResource = new
>> > CaptchaImageResource(password);
>> >                    NonCachingImage imgCaptcha = new
>> > NonCachingImage("captchaImage", captchaImageResource);
>> >                    imgCaptcha.setOutputMarkupId(true);
>> >                    SignUpForm.this.addOrReplace(imgCaptcha);
>> >                    if (target != null) {
>> >                        target.addComponent(imgCaptcha);
>> >                    }
>> >                }
>> >            }//.add(new ButtonBehavior())
>> >
>>
>> -
>> 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



IE 8: FileUpload#getClientFileName() returns full file path

2011-07-24 Thread Alec Swan
Hello,

I have an upload form in Wicket 1.4.17 and noticed that
FileUpload#getClientFileName() returns just the file name in Firefox 4.0 and
the entire absolute path in IE 8.0.

My code is almost identical to the one in upload file Wicket example, which
works in IE 8.0.

Any ideas on what could cause this? Could it have anything to do with the
servlet container on which the app is deployed?

Thanks,

Alec


Re: IE 8: FileUpload#getClientFileName() returns full file path

2011-07-24 Thread Alec Swan
Looks like other people experienced the same problem with file upload
in IE. Is there a JIRA issue for this?

Here are some related threads:
http://apache-wicket.1842946.n4.nabble.com/upload-in-IE-tp3045562p3045562.html
http://apache-wicket.1842946.n4.nabble.com/FileUpload-getClientFileName-1-4-9-vs-1-4-8-tp2306372p2306372.html

Alec


On Sun, Jul 24, 2011 at 9:58 AM, Alec Swan  wrote:
> Hello,
>
> I have an upload form in Wicket 1.4.17 and noticed that
> FileUpload#getClientFileName() returns just the file name in Firefox 4.0 and
> the entire absolute path in IE 8.0.
> My code is almost identical to the one in upload file Wicket example, which
> works in IE 8.0.
> Any ideas on what could cause this? Could it have anything to do with the
> servlet container on which the app is deployed?
>
> Thanks,
>
> Alec

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



Re: IE 8: FileUpload#getClientFileName() returns full file path

2011-07-24 Thread Alec Swan
What still baffles me is why IE upload works in 1.4.17 Wicket examples
http://wicketstuff.org/wicket14/upload/single?


On Sun, Jul 24, 2011 at 10:22 AM, Alec Swan  wrote:
> Looks like other people experienced the same problem with file upload
> in IE. Is there a JIRA issue for this?
>
> Here are some related threads:
> http://apache-wicket.1842946.n4.nabble.com/upload-in-IE-tp3045562p3045562.html
> http://apache-wicket.1842946.n4.nabble.com/FileUpload-getClientFileName-1-4-9-vs-1-4-8-tp2306372p2306372.html
>
> Alec
>
>
> On Sun, Jul 24, 2011 at 9:58 AM, Alec Swan  wrote:
>> Hello,
>>
>> I have an upload form in Wicket 1.4.17 and noticed that
>> FileUpload#getClientFileName() returns just the file name in Firefox 4.0 and
>> the entire absolute path in IE 8.0.
>> My code is almost identical to the one in upload file Wicket example, which
>> works in IE 8.0.
>> Any ideas on what could cause this? Could it have anything to do with the
>> servlet container on which the app is deployed?
>>
>> Thanks,
>>
>> Alec
>

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



How to handle exceptions caused by ?

2011-08-01 Thread Alec Swan
Hello,

Our app has a basic HTML editor where users can enter some HTML code.
Sometimes users enter something like . When the
browser displays renders the page with this HTML it treats GARBAGE as
a relative URL. So, the browser tacks GARBAGE on to the current page
URL causing the application to throw an error. In fact, if the current
page URL is http://xxx/yyy/oid/1 the browser will send and HTTP
request to http://xxx/yyy/oid/GARBAGE making it look like oid
parameter is invalid.

Is there a way to distinguish between this scenario and a scenario
where the user did enter an invalid oid value?

Thanks,

Alec

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



I am having trouble mounting shared resources

2011-08-04 Thread Alec Swan
Hello,

I am having troubles figuring out how to organize my static resources.

I would like to map a static URL alias, e.g. /js/fancybox, to a file
such as /js/fancybox/version123/fancybox-123.js. I also want to be
able to update the file version and after that have it served under
the same alias. This assumes that I will modify my Java code to
reference the new file name.

I think I need to create a resource reference class that points to
/js/fancybox/version123/fancybox-123.js and mount it in my Wicket
Application. But I can only mount a resource, not a
JavaScriptResourceReference in Application.init().

Can anybody please explain how to do this right?

Thanks

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



Re: I am having trouble mounting shared resources

2011-08-05 Thread Alec Swan
We are using Wicket 1.4.17 but we would like to do something like this
mountResource("/mount/path", new SomeResourceReference()) as described
in http://wicketinaction.com/ for Wicket 1.5.

On Fri, Aug 5, 2011 at 12:41 AM, Alec Swan  wrote:
> Hello,
>
> I am having troubles figuring out how to organize my static resources.
>
> I would like to map a static URL alias, e.g. /js/fancybox, to a file
> such as /js/fancybox/version123/fancybox-123.js. I also want to be
> able to update the file version and after that have it served under
> the same alias. This assumes that I will modify my Java code to
> reference the new file name.
>
> I think I need to create a resource reference class that points to
> /js/fancybox/version123/fancybox-123.js and mount it in my Wicket
> Application. But I can only mount a resource, not a
> JavaScriptResourceReference in Application.init().
>
> Can anybody please explain how to do this right?
>
> Thanks
>

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



Re: I am having trouble mounting shared resources

2011-08-05 Thread Alec Swan
Thanks, mounting JS worked perfectly.

However, mounting CSS was problematic because it references quite a
few images and they don't get loaded/mounted correctly. How do I mount
the folder that contains all images so that they can be loaded from
the CSS?

Thanks,

Alec


On Fri, Aug 5, 2011 at 11:51 AM, Miroslav F.  wrote:
> Project dirs:
>
> . com.myapp
> .      MyStartAppPoint.java
> . com.myapp.resources
> .      MyResources.java
> .      fancybox-123.js
>
> In MyStartAppPoint.init() do:
>
> mountSharedResource("/js/fancybox.js", new
> ResourceReference(MyResources.class,
> "fancybox-123.js").getSharedResourceKey());
>
> MyResources.java is just empty class (for classloader to find your
> resource):
> package com.myapp.resources;
> public class MyResources
> {
> }
>
> and then in html markup you can write:
> 
>
> Hope helps,
>
> Miro
>
>
>
>
>> -Original Message-
>> From: Alec Swan [mailto:alecs...@gmail.com]
>> Sent: Friday, 05. August 2011 08:42
>> To: users@wicket.apache.org
>> Subject: I am having trouble mounting shared resources
>>
>> Hello,
>>
>> I am having troubles figuring out how to organize my static resources.
>>
>> I would like to map a static URL alias, e.g. /js/fancybox, to
>> a file such as /js/fancybox/version123/fancybox-123.js. I
>> also want to be able to update the file version and after
>> that have it served under the same alias. This assumes that I
>> will modify my Java code to reference the new file name.
>>
>> I think I need to create a resource reference class that
>> points to /js/fancybox/version123/fancybox-123.js and mount
>> it in my Wicket Application. But I can only mount a resource,
>> not a JavaScriptResourceReference in Application.init().
>>
>> Can anybody please explain how to do this right?
>>
>> 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: I am having trouble mounting shared resources

2011-08-05 Thread Alec Swan
I will have to track down each individual image use from css and mount
it. Is there a way to mount the entire folder?

Thanks!

2011/8/5 Miroslav F. :
> Same way as is mounted .js and .css mount images and then in .css you can
> just use this path.
>
>
>> -Original Message-----
>> From: Alec Swan [mailto:alecs...@gmail.com]
>> Sent: Friday, 05. August 2011 19:30
>> To: users@wicket.apache.org
>> Subject: Re: I am having trouble mounting shared resources
>>
>> Thanks, mounting JS worked perfectly.
>>
>> However, mounting CSS was problematic because it references
>> quite a few images and they don't get loaded/mounted
>> correctly. How do I mount the folder that contains all images
>> so that they can be loaded from the CSS?
>>
>> Thanks,
>>
>> Alec
>>
>>
>> On Fri, Aug 5, 2011 at 11:51 AM, Miroslav F.  wrote:
>> > Project dirs:
>> >
>> > . com.myapp
>> > .      MyStartAppPoint.java
>> > . com.myapp.resources
>> > .      MyResources.java
>> > .      fancybox-123.js
>> >
>> > In MyStartAppPoint.init() do:
>> >
>> > mountSharedResource("/js/fancybox.js", new
>> > ResourceReference(MyResources.class,
>> > "fancybox-123.js").getSharedResourceKey());
>> >
>> > MyResources.java is just empty class (for classloader to find your
>> > resource):
>> > package com.myapp.resources;
>> > public class MyResources
>> > {
>> > }
>> >
>> > and then in html markup you can write:
>> > 
>> >
>> > Hope helps,
>> >
>> > Miro
>> >
>> >
>> >
>> >
>> >> -Original Message-
>> >> From: Alec Swan [mailto:alecs...@gmail.com]
>> >> Sent: Friday, 05. August 2011 08:42
>> >> To: users@wicket.apache.org
>> >> Subject: I am having trouble mounting shared resources
>> >>
>> >> Hello,
>> >>
>> >> I am having troubles figuring out how to organize my
>> static resources.
>> >>
>> >> I would like to map a static URL alias, e.g. /js/fancybox,
>> to a file
>> >> such as /js/fancybox/version123/fancybox-123.js. I also want to be
>> >> able to update the file version and after that have it
>> served under
>> >> the same alias. This assumes that I will modify my Java code to
>> >> reference the new file name.
>> >>
>> >> I think I need to create a resource reference class that points to
>> >> /js/fancybox/version123/fancybox-123.js and mount it in my Wicket
>> >> Application. But I can only mount a resource, not a
>> >> JavaScriptResourceReference in Application.init().
>> >>
>> >> Can anybody please explain how to do this right?
>> >>
>> >> 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



Resource references vs serving resources through web server

2011-09-01 Thread Alec Swan
Hello,

I am wondering if there is a significant performance overhead of using
resource references vs serving those resources through a web server,
e.g. Apache, which is fronting the servlet container running Wicket
app?

What advantages do resource references have over just hard-coding
resource paths?

Thanks,

Alec

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



Create a stand-alone link and get its URL

2011-09-12 Thread Alec Swan
Hello,

We use a templating engine which generates parts of our pages.
Templates can be included on any page. We need the engine to be able
to generate a link which will display a report when clicked. I tried
using the following code, but it returns null from
RequestTarget.urlFor(..):

public String getReportLink() {
return "" + RequestCycle.get().urlFor(new
DownloadCsvRequestTarget(fileName, reportData));
}

Where DownloadCsvRequestTarget implements respond() method to write
reportData our in CSV format.

Thanks,

Alec

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



Re: Create a stand-alone link and get its URL

2011-09-12 Thread Alec Swan
I don't really need a stable URL. In fact, I would prefer if the link
URL was session or page-specific so that it cannot be accessed by
anybody unless they first accessed the page that contains the link.

I would like to do something along the lines of the code in my
original post. In other words, I would like to create a new
RequestTarget and get its URL and display that URL to the user.

Thanks,

Alec


On Mon, Sep 12, 2011 at 4:14 PM, Igor Vaynberg  wrote:
> create a resource and register it in shared resources, this will allow
> you to create a stable url. the filename and reportdata you will have
> to pass on the url.
>
> -igor
>
> On Mon, Sep 12, 2011 at 2:25 PM, Alec Swan  wrote:
>> Hello,
>>
>> We use a templating engine which generates parts of our pages.
>> Templates can be included on any page. We need the engine to be able
>> to generate a link which will display a report when clicked. I tried
>> using the following code, but it returns null from
>> RequestTarget.urlFor(..):
>>
>> public String getReportLink() {
>>        return "" + RequestCycle.get().urlFor(new
>> DownloadCsvRequestTarget(fileName, reportData));
>> }
>>
>> Where DownloadCsvRequestTarget implements respond() method to write
>> reportData our in CSV format.
>>
>> Thanks,
>>
>> Alec
>>
>> -
>> 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: Create a stand-alone link and get its URL

2011-09-12 Thread Alec Swan
Our templating engine is the one that needs to generate the link by
evaluating a template similar to "Download". The engine does not have
access to any Wicket components but can access Thread local
properties, such as RequestCycle.get(). I guess we could add a
behavior to RequestCycle.get().getResponsePage().

Is this what you are suggesting or there is a more elegant way to
implement this in Wicket?

Thanks,

Alec

On Mon, Sep 12, 2011 at 5:27 PM, Igor Vaynberg  wrote:
> the problem is when you say "build a url to an instance of this
> request target" wicket doesnt hold on to the instance, nor does it
> have any way to recreate it.
>
> what you can do is add a behavior to the page and construct a url to
> that behavior.
>
> -igor
>
>
> On Mon, Sep 12, 2011 at 4:16 PM, Alec Swan  wrote:
>> I don't really need a stable URL. In fact, I would prefer if the link
>> URL was session or page-specific so that it cannot be accessed by
>> anybody unless they first accessed the page that contains the link.
>>
>> I would like to do something along the lines of the code in my
>> original post. In other words, I would like to create a new
>> RequestTarget and get its URL and display that URL to the user.
>>
>> Thanks,
>>
>> Alec
>>
>>
>> On Mon, Sep 12, 2011 at 4:14 PM, Igor Vaynberg  
>> wrote:
>>> create a resource and register it in shared resources, this will allow
>>> you to create a stable url. the filename and reportdata you will have
>>> to pass on the url.
>>>
>>> -igor
>>>
>>> On Mon, Sep 12, 2011 at 2:25 PM, Alec Swan  wrote:
>>>> Hello,
>>>>
>>>> We use a templating engine which generates parts of our pages.
>>>> Templates can be included on any page. We need the engine to be able
>>>> to generate a link which will display a report when clicked. I tried
>>>> using the following code, but it returns null from
>>>> RequestTarget.urlFor(..):
>>>>
>>>> public String getReportLink() {
>>>>        return "" + RequestCycle.get().urlFor(new
>>>> DownloadCsvRequestTarget(fileName, reportData));
>>>> }
>>>>
>>>> Where DownloadCsvRequestTarget implements respond() method to write
>>>> reportData our in CSV format.
>>>>
>>>> Thanks,
>>>>
>>>> Alec
>>>>
>>>> -
>>>> 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



Re: Create a stand-alone link and get its URL

2011-09-13 Thread Alec Swan
I don't think this will work because the template could be a method
invocation, e.g.

Download

Template-evaluation approach works great for generating HTML reports,
i.e. the template evaluates to a string that contains raw HTML
".." and can be included on any page. So, here is what
a page containing HTML report looks like:


  ${var.studentReportWithColumnsHTML('First Name', 'Last Name')}


My code runs templating engine on the content of the editableLabel
before rendering it.

However, the new requirement is to expose the same reports for
download as CSV files and I would like to continue using the
templating mechanism and be able to support something like:


  Download


Thoughts?

Thanks,

Alec

On Tue, Sep 13, 2011 at 1:00 AM, Sven Meier  wrote:
> Why don't you just use a component for this, e.g. DownloadLink?
>
> Download
>
> No stable url involved.
>
> Sven
>
> On 09/13/2011 04:45 AM, Alec Swan wrote:
>> Our templating engine is the one that needs to generate the link by
>> evaluating a template similar to "> href='${var.reportLink}'>Download". The engine does not have
>> access to any Wicket components but can access Thread local
>> properties, such as RequestCycle.get(). I guess we could add a
>> behavior to RequestCycle.get().getResponsePage().
>>
>> Is this what you are suggesting or there is a more elegant way to
>> implement this in Wicket?
>>
>> Thanks,
>>
>> Alec
>>
>> On Mon, Sep 12, 2011 at 5:27 PM, Igor Vaynberg  
>> wrote:
>>> the problem is when you say "build a url to an instance of this
>>> request target" wicket doesnt hold on to the instance, nor does it
>>> have any way to recreate it.
>>>
>>> what you can do is add a behavior to the page and construct a url to
>>> that behavior.
>>>
>>> -igor
>>>
>>>
>>> On Mon, Sep 12, 2011 at 4:16 PM, Alec Swan  wrote:
>>>> I don't really need a stable URL. In fact, I would prefer if the link
>>>> URL was session or page-specific so that it cannot be accessed by
>>>> anybody unless they first accessed the page that contains the link.
>>>>
>>>> I would like to do something along the lines of the code in my
>>>> original post. In other words, I would like to create a new
>>>> RequestTarget and get its URL and display that URL to the user.
>>>>
>>>> Thanks,
>>>>
>>>> Alec
>>>>
>>>>
>>>> On Mon, Sep 12, 2011 at 4:14 PM, Igor Vaynberg  
>>>> wrote:
>>>>> create a resource and register it in shared resources, this will allow
>>>>> you to create a stable url. the filename and reportdata you will have
>>>>> to pass on the url.
>>>>>
>>>>> -igor
>>>>>
>>>>> On Mon, Sep 12, 2011 at 2:25 PM, Alec Swan  wrote:
>>>>>> Hello,
>>>>>>
>>>>>> We use a templating engine which generates parts of our pages.
>>>>>> Templates can be included on any page. We need the engine to be able
>>>>>> to generate a link which will display a report when clicked. I tried
>>>>>> using the following code, but it returns null from
>>>>>> RequestTarget.urlFor(..):
>>>>>>
>>>>>> public String getReportLink() {
>>>>>>        return "" + RequestCycle.get().urlFor(new
>>>>>> DownloadCsvRequestTarget(fileName, reportData));
>>>>>> }
>>>>>>
>>>>>> Where DownloadCsvRequestTarget implements respond() method to write
>>>>>> reportData our in CSV format.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Alec
>>>>>>
>>>>>> -
>>>>>> 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
>>
>
>
> -
> 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: Create a stand-alone link and get its URL

2011-09-13 Thread Alec Swan
Great idea, thanks.

As I was working on passing template information as a part of the link
URL I started thinking that it would be nice if I could store this
information in session metadata and pass the metadata key as a part of
the link URL. However, I am not sure if I can pass metadata key in the
URL somehow.

Thoughts?

Thanks,

Alec

On Tue, Sep 13, 2011 at 10:44 AM, Igor Vaynberg  wrote:
> add a single link to your page. expose its url as a variable to the
> templating engine and append some sort of id to the url to
> differentiate which template should be used. since you have to put the
> link into markup put it inside an invisible div.
>
> -igor
>
> On Tue, Sep 13, 2011 at 8:37 AM, Alec Swan  wrote:
>> I don't think this will work because the template could be a method
>> invocation, e.g.
>>
>> Download
>>
>> Template-evaluation approach works great for generating HTML reports,
>> i.e. the template evaluates to a string that contains raw HTML
>> ".." and can be included on any page. So, here is what
>> a page containing HTML report looks like:
>>
>> 
>>  ${var.studentReportWithColumnsHTML('First Name', 'Last Name')}
>> 
>>
>> My code runs templating engine on the content of the editableLabel
>> before rendering it.
>>
>> However, the new requirement is to expose the same reports for
>> download as CSV files and I would like to continue using the
>> templating mechanism and be able to support something like:
>>
>> 
>>  Download
>> 
>>
>> Thoughts?
>>
>> Thanks,
>>
>> Alec
>>
>> On Tue, Sep 13, 2011 at 1:00 AM, Sven Meier  wrote:
>>> Why don't you just use a component for this, e.g. DownloadLink?
>>>
>>> Download
>>>
>>> No stable url involved.
>>>
>>> Sven
>>>
>>> On 09/13/2011 04:45 AM, Alec Swan wrote:
>>>> Our templating engine is the one that needs to generate the link by
>>>> evaluating a template similar to ">>> href='${var.reportLink}'>Download". The engine does not have
>>>> access to any Wicket components but can access Thread local
>>>> properties, such as RequestCycle.get(). I guess we could add a
>>>> behavior to RequestCycle.get().getResponsePage().
>>>>
>>>> Is this what you are suggesting or there is a more elegant way to
>>>> implement this in Wicket?
>>>>
>>>> Thanks,
>>>>
>>>> Alec
>>>>
>>>> On Mon, Sep 12, 2011 at 5:27 PM, Igor Vaynberg  
>>>> wrote:
>>>>> the problem is when you say "build a url to an instance of this
>>>>> request target" wicket doesnt hold on to the instance, nor does it
>>>>> have any way to recreate it.
>>>>>
>>>>> what you can do is add a behavior to the page and construct a url to
>>>>> that behavior.
>>>>>
>>>>> -igor
>>>>>
>>>>>
>>>>> On Mon, Sep 12, 2011 at 4:16 PM, Alec Swan  wrote:
>>>>>> I don't really need a stable URL. In fact, I would prefer if the link
>>>>>> URL was session or page-specific so that it cannot be accessed by
>>>>>> anybody unless they first accessed the page that contains the link.
>>>>>>
>>>>>> I would like to do something along the lines of the code in my
>>>>>> original post. In other words, I would like to create a new
>>>>>> RequestTarget and get its URL and display that URL to the user.
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Alec
>>>>>>
>>>>>>
>>>>>> On Mon, Sep 12, 2011 at 4:14 PM, Igor Vaynberg  
>>>>>> wrote:
>>>>>>> create a resource and register it in shared resources, this will allow
>>>>>>> you to create a stable url. the filename and reportdata you will have
>>>>>>> to pass on the url.
>>>>>>>
>>>>>>> -igor
>>>>>>>
>>>>>>> On Mon, Sep 12, 2011 at 2:25 PM, Alec Swan  wrote:
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> We use a templating engine which generates parts of our pages.
>>>>>>>> Templates can be included on any page. We need the engin

Re: Create a stand-alone link and get its URL

2011-09-15 Thread Alec Swan
Great idea, worked like a charm.

Thanks!

On Tue, Sep 13, 2011 at 8:19 PM, Igor Vaynberg  wrote:
> create a single metadata key that holds a map where
> string is a uuid.
>
> -igor
>
> On Tue, Sep 13, 2011 at 5:40 PM, Alec Swan  wrote:
>> Great idea, thanks.
>>
>> As I was working on passing template information as a part of the link
>> URL I started thinking that it would be nice if I could store this
>> information in session metadata and pass the metadata key as a part of
>> the link URL. However, I am not sure if I can pass metadata key in the
>> URL somehow.
>>
>> Thoughts?
>>
>> Thanks,
>>
>> Alec
>>
>> On Tue, Sep 13, 2011 at 10:44 AM, Igor Vaynberg  
>> wrote:
>>> add a single link to your page. expose its url as a variable to the
>>> templating engine and append some sort of id to the url to
>>> differentiate which template should be used. since you have to put the
>>> link into markup put it inside an invisible div.
>>>
>>> -igor
>>>
>>> On Tue, Sep 13, 2011 at 8:37 AM, Alec Swan  wrote:
>>>> I don't think this will work because the template could be a method
>>>> invocation, e.g.
>>>>
>>>> Download
>>>>
>>>> Template-evaluation approach works great for generating HTML reports,
>>>> i.e. the template evaluates to a string that contains raw HTML
>>>> ".." and can be included on any page. So, here is what
>>>> a page containing HTML report looks like:
>>>>
>>>> 
>>>>  ${var.studentReportWithColumnsHTML('First Name', 'Last Name')}
>>>> 
>>>>
>>>> My code runs templating engine on the content of the editableLabel
>>>> before rendering it.
>>>>
>>>> However, the new requirement is to expose the same reports for
>>>> download as CSV files and I would like to continue using the
>>>> templating mechanism and be able to support something like:
>>>>
>>>> 
>>>>  Download
>>>> 
>>>>
>>>> Thoughts?
>>>>
>>>> Thanks,
>>>>
>>>> Alec
>>>>
>>>> On Tue, Sep 13, 2011 at 1:00 AM, Sven Meier  wrote:
>>>>> Why don't you just use a component for this, e.g. DownloadLink?
>>>>>
>>>>> Download
>>>>>
>>>>> No stable url involved.
>>>>>
>>>>> Sven
>>>>>
>>>>> On 09/13/2011 04:45 AM, Alec Swan wrote:
>>>>>> Our templating engine is the one that needs to generate the link by
>>>>>> evaluating a template similar to ">>>>> href='${var.reportLink}'>Download". The engine does not have
>>>>>> access to any Wicket components but can access Thread local
>>>>>> properties, such as RequestCycle.get(). I guess we could add a
>>>>>> behavior to RequestCycle.get().getResponsePage().
>>>>>>
>>>>>> Is this what you are suggesting or there is a more elegant way to
>>>>>> implement this in Wicket?
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Alec
>>>>>>
>>>>>> On Mon, Sep 12, 2011 at 5:27 PM, Igor Vaynberg  
>>>>>> wrote:
>>>>>>> the problem is when you say "build a url to an instance of this
>>>>>>> request target" wicket doesnt hold on to the instance, nor does it
>>>>>>> have any way to recreate it.
>>>>>>>
>>>>>>> what you can do is add a behavior to the page and construct a url to
>>>>>>> that behavior.
>>>>>>>
>>>>>>> -igor
>>>>>>>
>>>>>>>
>>>>>>> On Mon, Sep 12, 2011 at 4:16 PM, Alec Swan  wrote:
>>>>>>>> I don't really need a stable URL. In fact, I would prefer if the link
>>>>>>>> URL was session or page-specific so that it cannot be accessed by
>>>>>>>> anybody unless they first accessed the page that contains the link.
>>>>>>>>
>>>>>>>> I would like to do something along the lines of the code in my
>>>>>>>> original post. In other words, I would like to create a new
>>>>>>>>

IHeaderContributor#renderHead does not inject CSS on panel swap

2011-09-15 Thread Alec Swan
Hello,

Our app uses panel swapping as a tabbing implementation.

I noticed that if I inject CSS using
component.add(CSSPackageResource.getHeaderContribution(resourceRef,
media)) during panel construction, then the CSS is included correctly
and takes effect after the panel swap. However, if I inject the same
CSS in IHeaderContributor#renderHead() using
response.renderCSSReference(resourceRef, media) then CSS is not
included after the panel swap and hence does not take effect.

How can I get CSS injection to work in IHeaderContributor#renderHead()?

Thanks,

Alec

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



Re: IHeaderContributor#renderHead does not inject CSS on panel swap

2011-09-21 Thread Alec Swan
I was not able to reproduce this with CSS and realized that the
problem might be with injecting JavaScript on swapping.  i also
noticed the following errors in the log files:

org.apache.wicket.protocol.http.PageExpiredException: No behaviors
attached to component [MarkupContainer [Component id =
mainMenuItemLink]]
at 
org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:105)

What could have caused these?

I also inspected the page that has this problem in production with
Firebug and noticed this in the  section:


$(document).ready(function() {
$("a.fancy").fancybox({
'width' : '75%',
'height' : '90%',
'autoScale' : false,
'transitionIn' : 'elastic',
'transitionOut' : 'fade',
'type' : 'iframe'
});
});
; Wicket.functionExecuterCallbacks['script1'](); delete
Wicket.functionExecuterCallbacks['script1'];


The top of the file was written by us, but the last line was appended
by Wicket. Could you explain what this is doing?

Thanks,

Alec

On Thu, Sep 15, 2011 at 9:21 PM, Igor Vaynberg  wrote:
> that should work, please create a quickstart.
>
> -igor
>
> On Thu, Sep 15, 2011 at 8:06 PM, Alec Swan  wrote:
>> Hello,
>>
>> Our app uses panel swapping as a tabbing implementation.
>>
>> I noticed that if I inject CSS using
>> component.add(CSSPackageResource.getHeaderContribution(resourceRef,
>> media)) during panel construction, then the CSS is included correctly
>> and takes effect after the panel swap. However, if I inject the same
>> CSS in IHeaderContributor#renderHead() using
>> response.renderCSSReference(resourceRef, media) then CSS is not
>> included after the panel swap and hence does not take effect.
>>
>> How can I get CSS injection to work in IHeaderContributor#renderHead()?
>>
>> Thanks,
>>
>> Alec
>>
>> -
>> 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



Firing JavaScript handler on AJAX panel swap

2011-09-24 Thread Alec Swan
Hello,

We use panel swapping to implement tabbing. The code contributes
javascript the head when the panels are swapped using AJAX. Some of
our JS scripts register $(document).ready() handlers. However, these
handler never fire during panel swap.

How can we register our JS handlers so that they fire on AJAX-based panel swap?

Thanks,

Alec

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



Re: Firing JavaScript handler on AJAX panel swap

2011-09-24 Thread Alec Swan
Thanks. Is there a way to do this using JavaScript only? Maybe
register for some JavaScript event that Wicket fires when DOM is
ready?

On Sat, Sep 24, 2011 at 12:42 PM, Igor Vaynberg  wrote:
> use ajaxrequesttarget.renderondomreadyjavascript() instead of jquery's ready()
>
> -igor
>
> On Sat, Sep 24, 2011 at 10:58 AM, Alec Swan  wrote:
>> Hello,
>>
>> We use panel swapping to implement tabbing. The code contributes
>> javascript the head when the panels are swapped using AJAX. Some of
>> our JS scripts register $(document).ready() handlers. However, these
>> handler never fire during panel swap.
>>
>> How can we register our JS handlers so that they fire on AJAX-based panel 
>> swap?
>>
>> Thanks,
>>
>> Alec
>>
>> -
>> 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: Firing JavaScript handler on AJAX panel swap

2011-09-24 Thread Alec Swan
I found this thread
http://apache-wicket.1842946.n4.nabble.com/correct-way-to-call-necessary-javascript-initialization-when-a-component-is-added-via-ajax-td1875918.html
where there was a recommendation to use
Wicket.Event.addDomReadyEvent(), but I can't get handlers registered
this way to fire on panel swap. Any ideas why?

On Sat, Sep 24, 2011 at 12:52 PM, Igor Vaynberg  wrote:
> we dont do that yet, but makes sense. you are welcome to attach a patch...
>
> -igor
>
>
> On Sat, Sep 24, 2011 at 11:51 AM, Alec Swan  wrote:
>> Thanks. Is there a way to do this using JavaScript only? Maybe
>> register for some JavaScript event that Wicket fires when DOM is
>> ready?
>>
>> On Sat, Sep 24, 2011 at 12:42 PM, Igor Vaynberg  
>> wrote:
>>> use ajaxrequesttarget.renderondomreadyjavascript() instead of jquery's 
>>> ready()
>>>
>>> -igor
>>>
>>> On Sat, Sep 24, 2011 at 10:58 AM, Alec Swan  wrote:
>>>> Hello,
>>>>
>>>> We use panel swapping to implement tabbing. The code contributes
>>>> javascript the head when the panels are swapped using AJAX. Some of
>>>> our JS scripts register $(document).ready() handlers. However, these
>>>> handler never fire during panel swap.
>>>>
>>>> How can we register our JS handlers so that they fire on AJAX-based panel 
>>>> swap?
>>>>
>>>> Thanks,
>>>>
>>>> Alec
>>>>
>>>> -
>>>> 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



Re: Firing JavaScript handler on AJAX panel swap

2011-09-24 Thread Alec Swan
My problem was that I was trying to call
Wicket.Event.addDomReadyEvent() from the script that was loaded by
response.renderJavascriptReference(). And for some reason the
registration code was never getting called.

If I have a JS script which contains function declarations and inline
function calls, does Wicket handle them differently? In other words,
does Wicket inject function declarations differently than inline
method calls?

Thanks,

Alec

On Sat, Sep 24, 2011 at 1:05 PM, Igor Vaynberg  wrote:
> maybe you are registering them too late..
>
> -igor
>
> On Sat, Sep 24, 2011 at 12:04 PM, Alec Swan  wrote:
>> I found this thread
>> http://apache-wicket.1842946.n4.nabble.com/correct-way-to-call-necessary-javascript-initialization-when-a-component-is-added-via-ajax-td1875918.html
>> where there was a recommendation to use
>> Wicket.Event.addDomReadyEvent(), but I can't get handlers registered
>> this way to fire on panel swap. Any ideas why?
>>
>> On Sat, Sep 24, 2011 at 12:52 PM, Igor Vaynberg  
>> wrote:
>>> we dont do that yet, but makes sense. you are welcome to attach a patch...
>>>
>>> -igor
>>>
>>>
>>> On Sat, Sep 24, 2011 at 11:51 AM, Alec Swan  wrote:
>>>> Thanks. Is there a way to do this using JavaScript only? Maybe
>>>> register for some JavaScript event that Wicket fires when DOM is
>>>> ready?
>>>>
>>>> On Sat, Sep 24, 2011 at 12:42 PM, Igor Vaynberg  
>>>> wrote:
>>>>> use ajaxrequesttarget.renderondomreadyjavascript() instead of jquery's 
>>>>> ready()
>>>>>
>>>>> -igor
>>>>>
>>>>> On Sat, Sep 24, 2011 at 10:58 AM, Alec Swan  wrote:
>>>>>> Hello,
>>>>>>
>>>>>> We use panel swapping to implement tabbing. The code contributes
>>>>>> javascript the head when the panels are swapped using AJAX. Some of
>>>>>> our JS scripts register $(document).ready() handlers. However, these
>>>>>> handler never fire during panel swap.
>>>>>>
>>>>>> How can we register our JS handlers so that they fire on AJAX-based 
>>>>>> panel swap?
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>> Alec
>>>>>>
>>>>>> -
>>>>>> 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
>>
>>
>
> -
> 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: Firing JavaScript handler on AJAX panel swap

2011-09-24 Thread Alec Swan
Hello,

Our JavaScript code shows a busy sign/progress bar from a handler
registered with Wicket.Ajax.registerPreCallHandler(showBusysign).

However, now that we contribute JavaScript during panel swap the busy
sign flickers twice - once when the panels are swapped using AJAX and
the second time when JavaScript is contributed. Is there a way to
distinguish between these two scenarios on the client side so that we
can avoid displaying busy sign when JS is being contributed?

Thanks,

Alec

On Sat, Sep 24, 2011 at 1:52 PM, Alec Swan  wrote:
> My problem was that I was trying to call
> Wicket.Event.addDomReadyEvent() from the script that was loaded by
> response.renderJavascriptReference(). And for some reason the
> registration code was never getting called.
>
> If I have a JS script which contains function declarations and inline
> function calls, does Wicket handle them differently? In other words,
> does Wicket inject function declarations differently than inline
> method calls?
>
> Thanks,
>
> Alec
>
> On Sat, Sep 24, 2011 at 1:05 PM, Igor Vaynberg  
> wrote:
>> maybe you are registering them too late..
>>
>> -igor
>>
>> On Sat, Sep 24, 2011 at 12:04 PM, Alec Swan  wrote:
>>> I found this thread
>>> http://apache-wicket.1842946.n4.nabble.com/correct-way-to-call-necessary-javascript-initialization-when-a-component-is-added-via-ajax-td1875918.html
>>> where there was a recommendation to use
>>> Wicket.Event.addDomReadyEvent(), but I can't get handlers registered
>>> this way to fire on panel swap. Any ideas why?
>>>
>>> On Sat, Sep 24, 2011 at 12:52 PM, Igor Vaynberg  
>>> wrote:
>>>> we dont do that yet, but makes sense. you are welcome to attach a patch...
>>>>
>>>> -igor
>>>>
>>>>
>>>> On Sat, Sep 24, 2011 at 11:51 AM, Alec Swan  wrote:
>>>>> Thanks. Is there a way to do this using JavaScript only? Maybe
>>>>> register for some JavaScript event that Wicket fires when DOM is
>>>>> ready?
>>>>>
>>>>> On Sat, Sep 24, 2011 at 12:42 PM, Igor Vaynberg  
>>>>> wrote:
>>>>>> use ajaxrequesttarget.renderondomreadyjavascript() instead of jquery's 
>>>>>> ready()
>>>>>>
>>>>>> -igor
>>>>>>
>>>>>> On Sat, Sep 24, 2011 at 10:58 AM, Alec Swan  wrote:
>>>>>>> Hello,
>>>>>>>
>>>>>>> We use panel swapping to implement tabbing. The code contributes
>>>>>>> javascript the head when the panels are swapped using AJAX. Some of
>>>>>>> our JS scripts register $(document).ready() handlers. However, these
>>>>>>> handler never fire during panel swap.
>>>>>>>
>>>>>>> How can we register our JS handlers so that they fire on AJAX-based 
>>>>>>> panel swap?
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Alec
>>>>>>>
>>>>>>> -
>>>>>>> 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
>>>
>>>
>>
>> -
>> 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: Firing JavaScript handler on AJAX panel swap

2011-09-25 Thread Alec Swan
It would be nice if Wicket JavaScript API supported registration of
handlers for user-initiated AJAX events, such as clicking on a link,
separately from code-initiated AJAX events, such as contributing a
JavaScript script to head. The current
Wicket.Ajax.registerPreCallHandler does not support this distinction.

Thoughts?

Thanks,

Alec

On Sat, Sep 24, 2011 at 9:04 PM, Alec Swan  wrote:
> Hello,
>
> Our JavaScript code shows a busy sign/progress bar from a handler
> registered with Wicket.Ajax.registerPreCallHandler(showBusysign).
>
> However, now that we contribute JavaScript during panel swap the busy
> sign flickers twice - once when the panels are swapped using AJAX and
> the second time when JavaScript is contributed. Is there a way to
> distinguish between these two scenarios on the client side so that we
> can avoid displaying busy sign when JS is being contributed?
>
> Thanks,
>
> Alec
>
> On Sat, Sep 24, 2011 at 1:52 PM, Alec Swan  wrote:
>> My problem was that I was trying to call
>> Wicket.Event.addDomReadyEvent() from the script that was loaded by
>> response.renderJavascriptReference(). And for some reason the
>> registration code was never getting called.
>>
>> If I have a JS script which contains function declarations and inline
>> function calls, does Wicket handle them differently? In other words,
>> does Wicket inject function declarations differently than inline
>> method calls?
>>
>> Thanks,
>>
>> Alec
>>
>> On Sat, Sep 24, 2011 at 1:05 PM, Igor Vaynberg  
>> wrote:
>>> maybe you are registering them too late..
>>>
>>> -igor
>>>
>>> On Sat, Sep 24, 2011 at 12:04 PM, Alec Swan  wrote:
>>>> I found this thread
>>>> http://apache-wicket.1842946.n4.nabble.com/correct-way-to-call-necessary-javascript-initialization-when-a-component-is-added-via-ajax-td1875918.html
>>>> where there was a recommendation to use
>>>> Wicket.Event.addDomReadyEvent(), but I can't get handlers registered
>>>> this way to fire on panel swap. Any ideas why?
>>>>
>>>> On Sat, Sep 24, 2011 at 12:52 PM, Igor Vaynberg  
>>>> wrote:
>>>>> we dont do that yet, but makes sense. you are welcome to attach a patch...
>>>>>
>>>>> -igor
>>>>>
>>>>>
>>>>> On Sat, Sep 24, 2011 at 11:51 AM, Alec Swan  wrote:
>>>>>> Thanks. Is there a way to do this using JavaScript only? Maybe
>>>>>> register for some JavaScript event that Wicket fires when DOM is
>>>>>> ready?
>>>>>>
>>>>>> On Sat, Sep 24, 2011 at 12:42 PM, Igor Vaynberg 
>>>>>>  wrote:
>>>>>>> use ajaxrequesttarget.renderondomreadyjavascript() instead of jquery's 
>>>>>>> ready()
>>>>>>>
>>>>>>> -igor
>>>>>>>
>>>>>>> On Sat, Sep 24, 2011 at 10:58 AM, Alec Swan  wrote:
>>>>>>>> Hello,
>>>>>>>>
>>>>>>>> We use panel swapping to implement tabbing. The code contributes
>>>>>>>> javascript the head when the panels are swapped using AJAX. Some of
>>>>>>>> our JS scripts register $(document).ready() handlers. However, these
>>>>>>>> handler never fire during panel swap.
>>>>>>>>
>>>>>>>> How can we register our JS handlers so that they fire on AJAX-based 
>>>>>>>> panel swap?
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>> Alec
>>>>>>>>
>>>>>>>> -
>>>>>>>> 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
>>>>
>>>>
>>>
>>> -
>>> 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: Firing JavaScript handler on AJAX panel swap

2011-09-26 Thread Alec Swan
Martin, Wicket.Ajax.doGet() is called when JavaScript is contributed
with response.renderJavascriptReference(script). So, there is no way
for preCallHandlers to distinguish between JavaScript contribution and
user-initiated click.

I would also like to mention that this is not a jQuery issue.

Thanks!

Alec

On Mon, Sep 26, 2011 at 4:02 AM, Emond Papegaaij
 wrote:
> Hi Alec,
>
> If you use WiQuery for your javascript-enabled panels, this is done
> automatically. WiQuery will add the javascript calls in the right places for
> you.
>
> Best regards,
> Emond
>
> On Saturday 24 September 2011 19:58:05 Alec Swan wrote:
>> Hello,
>>
>> We use panel swapping to implement tabbing. The code contributes
>> javascript the head when the panels are swapped using AJAX. Some of
>> our JS scripts register $(document).ready() handlers. However, these
>> handler never fire during panel swap.
>>
>> How can we register our JS handlers so that they fire on AJAX-based panel
>> swap?
>>
>> Thanks,
>>
>> Alec
>>
>> -
>> 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



Yet another PageExpiredException question

2011-09-30 Thread Alec Swan
Hello,

I have recently reviewed our application log files and noticed a lot
of PageExpiredException error logs. Here are some of them:

1. PageExpiredException: Cannot find the rendered page in session
[pagemap=null,componentPath=1,versionNumber=0]
2. PageExpiredException: No behaviors attached to component
[MarkupContainer [Component id = mainMenuItemLink]]

We use approach described in this article
http://web.mac.com/jonathan.locke/iWeb/JonathanLocke/Blog/C68818AE-E983-4D7A-B6BF-E95CD886BFF2.html
to return the previous response page if it's not null and not equal to
the current page that threw exception. We do this for every exception
that goes throuh WebRequestCycle#onRuntimeException(). Is this a bad
idea?

The page that typically throws these exceptions has no-arg constructor
and constructor that takes PageParameters, which I assume qualifies it
as stateless. When I breakpoint in onAfterRender()
WebPage#isStateless() returns true. But the page has a lot of AJAX
components. Could this be causing PageExpiredExceptions?

Some people on this list recommended creating and returning a new
instance of the page that caused the error. Others, like the article
above, recommend returning the last rendered page.

What's the recommended way to handle PageExpiredExceptions?

Thanks,

Alec

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



Re: Yet another PageExpiredException question

2011-10-01 Thread Alec Swan
Hello and thank you for a good JIRA resource.

I am using Wicket 1.4.18 and my page is mounted with HybridUrlCodingStrategy.

What can I do to recover from PageExpiredException?

Thanks,

Alec

On Sat, Oct 1, 2011 at 12:43 PM,   wrote:
> Hi Alec,
>
> Wicket 1.5.1 includes an improvement that deals with expired pages
> gracefully if they are mapped.
>
> See https://issues.apache.org/jira/browse/WICKET-4014
>
> Regards,
>
> Bernard
>
>
> On Fri, 30 Sep 2011 15:26:15 -0600, you wrote:
>
>>Hello,
>>
>>I have recently reviewed our application log files and noticed a lot
>>of PageExpiredException error logs. Here are some of them:
>>
>>1. PageExpiredException: Cannot find the rendered page in session
>>[pagemap=null,componentPath=1,versionNumber=0]
>>2. PageExpiredException: No behaviors attached to component
>>[MarkupContainer [Component id = mainMenuItemLink]]
>>
>>We use approach described in this article
>>http://web.mac.com/jonathan.locke/iWeb/JonathanLocke/Blog/C68818AE-E983-4D7A-B6BF-E95CD886BFF2.html
>>to return the previous response page if it's not null and not equal to
>>the current page that threw exception. We do this for every exception
>>that goes throuh WebRequestCycle#onRuntimeException(). Is this a bad
>>idea?
>>
>>The page that typically throws these exceptions has no-arg constructor
>>and constructor that takes PageParameters, which I assume qualifies it
>>as stateless. When I breakpoint in onAfterRender()
>>WebPage#isStateless() returns true. But the page has a lot of AJAX
>>components. Could this be causing PageExpiredExceptions?
>>
>>Some people on this list recommended creating and returning a new
>>instance of the page that caused the error. Others, like the article
>>above, recommend returning the last rendered page.
>>
>>What's the recommended way to handle PageExpiredExceptions?
>>
>>Thanks,
>>
>>Alec
>>
>>-
>>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



AJAX-update on ajaxButton click

2011-10-30 Thread Alec Swan
Hello,

I have a page which implements IHeaderContributor and injects CSS in
#renderHead(response). I would like to be able to update the CSS
injected when the user clicks an ajaxButton on the page. How can I add
page header to AjaxRequestTarget?

Thanks,

Alec

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



Re: AJAX-update on ajaxButton click

2011-10-30 Thread Alec Swan
I am still having a problem after doing the following.

I created a small panel on the page which contributes JavaScript that
I want to be updated when AjaxButton is clicked. However, when
AjaxButton is clicked I get the following error in Firefox:
"attempt to run compile-and-go script on a cleared scope"

Ajax-updating panel's JavaScript, e.g. jQuery UI, which depend on
JavaScript scripts loaded by the parent page, e.g. jQuery Core, causes
this problem. If I ajax-update the entire top page - everything works
fine.

I'd appreciate any thoughts on this.

Thanks,

Alec



On Sun, Oct 30, 2011 at 7:19 PM, Alec Swan  wrote:
> Hello,
>
> I have a page which implements IHeaderContributor and injects CSS in
> #renderHead(response). I would like to be able to update the CSS
> injected when the user clicks an ajaxButton on the page. How can I add
> page header to AjaxRequestTarget?
>
> Thanks,
>
> Alec
>

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



AjaxEditableLabel inside of AjaxEditableLabel

2011-11-17 Thread Alec Swan
Hello,

I have two AjaxEditableLabel components. I use jQuery to place one
component inside of another when the user views the page. The problem
is that when the user clicks inside of the inner AjaxEditableLabel it
goes into edit mode but right after that the outer AjaxEditableLabel
goes into edit mode.

How can I prevent the outer AjaxEditableLabel from going into edit mode?

Thanks,

Alec

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



Re: AjaxEditableLabel inside of AjaxEditableLabel

2011-11-18 Thread Alec Swan
I am not sure how to stop propagating the event. Could you please
provide any pointers?

Here is the relevant code:

final String keypress = "var kc=wicketKeyCode(event); if (kc==27) " +
cancelCall +
" else if (kc!=13) { return true; } else " + 
saveCall;

tag.put("onblur", saveCall);
tag.put("onkeypress", "if (Wicket.Browser.isSafari()) { return; }; " +
keypress);
tag.put("onkeydown", "if (!Wicket.Browser.isSafari()) { return; }; " +
keypress);


On Fri, Nov 18, 2011 at 12:32 AM, Martin Grigorov  wrote:
> Hi,
>
> You'll need to stop the propagation of the event.
> To do that you'll have to override
> org.apache.wicket.extensions.ajax.markup.html.AjaxEditableLabel.EditorAjaxBehavior.onComponentTag(ComponentTag)
>
> On Fri, Nov 18, 2011 at 7:48 AM, Alec Swan  wrote:
>> Hello,
>>
>> I have two AjaxEditableLabel components. I use jQuery to place one
>> component inside of another when the user views the page. The problem
>> is that when the user clicks inside of the inner AjaxEditableLabel it
>> goes into edit mode but right after that the outer AjaxEditableLabel
>> goes into edit mode.
>>
>> How can I prevent the outer AjaxEditableLabel from going into edit mode?
>>
>> Thanks,
>>
>> Alec
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.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



Adding Wicket components inside editable labels @L

2011-11-19 Thread Alec Swan
Hello,

We use AjaxEditableMultilineLabels to allow users to edit the content
on the web site. I would also like to allow users to add new Wicket
components inside editable labels. For example, the user enters  in the editable label and when label switches in
preview mode the Logo component is rendered inside the label.

What Wicket mechanism can I use to implement this? Is component
resolvers the right way to do this?

Thanks,

Alec

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



Re: Adding Wicket components inside editable labels @L

2011-11-20 Thread Alec Swan
Thanks, I'll give it a try.

On Sat, Nov 19, 2011 at 11:24 AM, Igor Vaynberg  wrote:
> this is going to be tricky because the markup entered into the label
> is not parsed by wicket so resolvers wont be called on it. i wonder if
> you can override label's getmarkup() and return the markup parsed from
> user's input...give that a go and then use the resolvers to find the
> components.
>
> -igor
>
> On Sat, Nov 19, 2011 at 9:01 AM, Alec Swan  wrote:
>> Hello,
>>
>> We use AjaxEditableMultilineLabels to allow users to edit the content
>> on the web site. I would also like to allow users to add new Wicket
>> components inside editable labels. For example, the user enters > wicket:id="logo"/> in the editable label and when label switches in
>> preview mode the Logo component is rendered inside the label.
>>
>> What Wicket mechanism can I use to implement this? Is component
>> resolvers the right way to do this?
>>
>> Thanks,
>>
>> Alec
>>
>> -
>> 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: AjaxEditableLabel inside of AjaxEditableLabel

2011-11-20 Thread Alec Swan
Anybody can help with stopping propagation of events from inner
editable label to the outer editable label?

Thanks

On Fri, Nov 18, 2011 at 3:45 PM, Alec Swan  wrote:
> I am not sure how to stop propagating the event. Could you please
> provide any pointers?
>
> Here is the relevant code:
>
> final String keypress = "var kc=wicketKeyCode(event); if (kc==27) " +
> cancelCall +
>                                " else if (kc!=13) { return true; } else " + 
> saveCall;
>
> tag.put("onblur", saveCall);
> tag.put("onkeypress", "if (Wicket.Browser.isSafari()) { return; }; " +
> keypress);
> tag.put("onkeydown", "if (!Wicket.Browser.isSafari()) { return; }; " +
> keypress);
>
>
> On Fri, Nov 18, 2011 at 12:32 AM, Martin Grigorov  
> wrote:
>> Hi,
>>
>> You'll need to stop the propagation of the event.
>> To do that you'll have to override
>> org.apache.wicket.extensions.ajax.markup.html.AjaxEditableLabel.EditorAjaxBehavior.onComponentTag(ComponentTag)
>>
>> On Fri, Nov 18, 2011 at 7:48 AM, Alec Swan  wrote:
>>> Hello,
>>>
>>> I have two AjaxEditableLabel components. I use jQuery to place one
>>> component inside of another when the user views the page. The problem
>>> is that when the user clicks inside of the inner AjaxEditableLabel it
>>> goes into edit mode but right after that the outer AjaxEditableLabel
>>> goes into edit mode.
>>>
>>> How can I prevent the outer AjaxEditableLabel from going into edit mode?
>>>
>>> Thanks,
>>>
>>> Alec
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>>
>>
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.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



Update FeedbackPanel from AbstractAjaxBehavior

2011-12-15 Thread Alec Swan
Hello,

I have an AbstractAjaxBehavior which is invoked by clicking on a link.
The behavior needs to write a message to FeedbackPanel upon
completion. I wasn't able to access AjaxRequestTarget from
AbstractAjaxBehavior so I switched to using
AbstractDefaultAjaxBehavior. I implemented
AbstractDefaultAjaxBehavior#respond(AjaxRequestTarget target) but now
when the user clicks on a link the browser displays raw ajax response
(shown below) instead of just updating the feedback panel.

The behavior is used as follows:

getPage().add(ajaxBehaviour);
ExternalLink ajaxLink = new ExternalLink("ajaxLink",
ajaxBehaviour.getCallbackUrl(true).toString());

Is there anything special I need to do in
AbstractDefaultAjaxBehavior#respond method?

Thanks,

Alec







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



Re: Update FeedbackPanel from AbstractAjaxBehavior

2011-12-15 Thread Alec Swan
The click on the link is intercepted and a prompt is shown using
jQuery. The user fills in the prompt and clicks OK which redirects to
the original link href. So, I need to have a stable URL that I can
invoke from jQuery and have the behavior execute.

Maybe it's possible to do this with AjaxLink, but I would like to
understand how to use AbstractDefaultAjaxBehavior correctly.

Thanks,

Alec

On Thu, Dec 15, 2011 at 4:33 PM, Dan Retzlaff  wrote:
> Is there a reason you're avoiding AjaxLink? Its onClick gives you the
> AjaxRequestTarget which you can use to render the feedback panel.
>
> On Thu, Dec 15, 2011 at 3:24 PM, Alec Swan  wrote:
>
>> Hello,
>>
>> I have an AbstractAjaxBehavior which is invoked by clicking on a link.
>> The behavior needs to write a message to FeedbackPanel upon
>> completion. I wasn't able to access AjaxRequestTarget from
>> AbstractAjaxBehavior so I switched to using
>> AbstractDefaultAjaxBehavior. I implemented
>> AbstractDefaultAjaxBehavior#respond(AjaxRequestTarget target) but now
>> when the user clicks on a link the browser displays raw ajax response
>> (shown below) instead of just updating the feedback panel.
>>
>> The behavior is used as follows:
>>
>> getPage().add(ajaxBehaviour);
>> ExternalLink ajaxLink = new ExternalLink("ajaxLink",
>> ajaxBehaviour.getCallbackUrl(true).toString());
>>
>> Is there anything special I need to do in
>> AbstractDefaultAjaxBehavior#respond method?
>>
>> Thanks,
>>
>> Alec
>>
>> > wicket:id="infoFeedback" class="feedbackPanel"
>> id="infoFeedbackd">
>>
>> > wicket:id="debugFeedback" class="feedbackPanel"
>> id="debugFeedback63">
>>
>> 
>>
>> -
>> 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: Update FeedbackPanel from AbstractAjaxBehavior

2011-12-15 Thread Alec Swan
I'll give it a try. Thanks!

On Thu, Dec 15, 2011 at 5:06 PM, Dan Retzlaff  wrote:
> Gotcha. Sorry for not answering your actual question. :)
>
> The ExternalLink navigates the browser to the given URL which is why you're
> seeing the response. AJAX behaviors are designed to be invoked from
> JavaScript. For example, AjaxEventBehavior renders Javascript into
> "onclick" attributes or whatever, which makes the request
> using wicketAjaxGet() in wicket-ajax.js.
>
> For your particular case, if you create a Link instead of ExternalLink,
> then you can use its href in your redirect. The redirect will trigger its
> onClick(), you can add feedback messages, then the whole page will be
> rendered. If you need to avoid rerendering the whole page, then I think
> you'll need to get jQuery to invoke wicketAjaxGet() instead of redirecting
> on completion.
>
> On Thu, Dec 15, 2011 at 3:46 PM, Alec Swan  wrote:
>
>> The click on the link is intercepted and a prompt is shown using
>> jQuery. The user fills in the prompt and clicks OK which redirects to
>> the original link href. So, I need to have a stable URL that I can
>> invoke from jQuery and have the behavior execute.
>>
>> Maybe it's possible to do this with AjaxLink, but I would like to
>> understand how to use AbstractDefaultAjaxBehavior correctly.
>>
>> Thanks,
>>
>> Alec
>>
>> On Thu, Dec 15, 2011 at 4:33 PM, Dan Retzlaff  wrote:
>> > Is there a reason you're avoiding AjaxLink? Its onClick gives you the
>> > AjaxRequestTarget which you can use to render the feedback panel.
>> >
>> > On Thu, Dec 15, 2011 at 3:24 PM, Alec Swan  wrote:
>> >
>> >> Hello,
>> >>
>> >> I have an AbstractAjaxBehavior which is invoked by clicking on a link.
>> >> The behavior needs to write a message to FeedbackPanel upon
>> >> completion. I wasn't able to access AjaxRequestTarget from
>> >> AbstractAjaxBehavior so I switched to using
>> >> AbstractDefaultAjaxBehavior. I implemented
>> >> AbstractDefaultAjaxBehavior#respond(AjaxRequestTarget target) but now
>> >> when the user clicks on a link the browser displays raw ajax response
>> >> (shown below) instead of just updating the feedback panel.
>> >>
>> >> The behavior is used as follows:
>> >>
>> >> getPage().add(ajaxBehaviour);
>> >> ExternalLink ajaxLink = new ExternalLink("ajaxLink",
>> >> ajaxBehaviour.getCallbackUrl(true).toString());
>> >>
>> >> Is there anything special I need to do in
>> >> AbstractDefaultAjaxBehavior#respond method?
>> >>
>> >> Thanks,
>> >>
>> >> Alec
>> >>
>> >> > >> wicket:id="infoFeedback" class="feedbackPanel"
>> >> id="infoFeedbackd">
>> >>
>> >> > >> wicket:id="debugFeedback" class="feedbackPanel"
>> >> id="debugFeedback63">
>> >>
>> >> 
>> >>
>> >> -
>> >> 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



TextField OnChangeAjaxBehavior oddness @L

2011-12-18 Thread Alec Swan
Hello,

I have an HTML markup page which has 
element. When the value in this field is set programmatically with
jQuery, e.g. $("input").val("new value") the "input.onchange called"
alert message pops up correctly.

However, when I add new TextField("dateValue").add(new
OnChangeAjaxBehavior() {..}) in Java the ONCHANGE handler is never
called when the value of the field changes. (I did decorate the ajax
call of the behavior to show the alert message.)

Is it possible that Wicket changes the behavior of "change" event when
input field value is changed programmatically, e.g.
$("input").val("new value")?

Thanks,

Alec

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



(SOLVED) TextField OnChangeAjaxBehavior oddness @L

2011-12-18 Thread Alec Swan
I was able to get this to work after hours of suffering. I think the
problem was in my code that was triggering/handling "change" event.

Thanks

On Sun, Dec 18, 2011 at 12:28 PM, Alec Swan  wrote:
> Hello,
>
> I have an HTML markup page which has  wicket:id="dateValue" ONCHANGE="alert('input.onchange called')"/>
> element. When the value in this field is set programmatically with
> jQuery, e.g. $("input").val("new value") the "input.onchange called"
> alert message pops up correctly.
>
> However, when I add new TextField("dateValue").add(new
> OnChangeAjaxBehavior() {..}) in Java the ONCHANGE handler is never
> called when the value of the field changes. (I did decorate the ajax
> call of the behavior to show the alert message.)
>
> Is it possible that Wicket changes the behavior of "change" event when
> input field value is changed programmatically, e.g.
> $("input").val("new value")?
>
> Thanks,
>
> Alec

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



AJAX upload in modal window hangs when file size is too large @L

2012-01-08 Thread Alec Swan
Hello,

I have an upload form which uploads files using AJAX.

When the file size is less than maxUploadSize the form work correctly
on the page and modal window.

When file size is greater than maxUploadSize then form works correctly
and displays an error on the page, but hangs in modal window after
"INFO: Invoking pre-call handler(s)..." and before "INFO: Response
parsed. Now invoking steps...".

What could be the reason for AJAX upload request to hang in modal
window when the file uploaded is too large?

Thanks,

Alec

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



Re: AJAX upload in modal window hangs when file size is too large @L

2012-01-10 Thread Alec Swan
Commenting out the first line in the code below fixes the problem but
I don't understand why the fix works.

Note that get("infoFeedback") returns feedback panel of the modal
window page - and not of the upload form. The filter of the feedback
panel uses 
http://www.jeremythomerson.com/blog/2011/01/catching-all-feedback-messages-that-arent-rendered-by-other-feedback-panels/
approach to filter out messages of child feedback panels that have
already been rendered.

Button uploadButton = new AjaxButton("uploadButton")
{
@Override
protected void onSubmit(AjaxRequestTarget target, Form form) {
//target.addComponent(get("infoFeedback")); // this
causes AJAX upload to hang duing upload of file exceeding max upload
size
uploadForm.onSubmit();
}
};

Thoughts?

Thanks,

Alec

On Sun, Jan 8, 2012 at 12:29 PM, Alec Swan  wrote:
> Hello,
>
> I have an upload form which uploads files using AJAX.
>
> When the file size is less than maxUploadSize the form work correctly
> on the page and modal window.
>
> When file size is greater than maxUploadSize then form works correctly
> and displays an error on the page, but hangs in modal window after
> "INFO: Invoking pre-call handler(s)..." and before "INFO: Response
> parsed. Now invoking steps...".
>
> What could be the reason for AJAX upload request to hang in modal
> window when the file uploaded is too large?
>
> Thanks,
>
> Alec

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



Re: AJAX upload in modal window hangs when file size is too large @L

2012-01-10 Thread Alec Swan
Correct, the client does not complete even though my server code
execution finishes.

There are no Javascript errors. It is possible that the info window is
not a part of the DOM but I don't know how to verify that.

The problem is caused by adding a component from the parent page to
ART during AJAX upload. And it's only broken in a modal window during
very large uploads!

I enabled Wicket debug logging and noticed different messages logged
during upload from modal window and regular page. Here is the first
line that is different:
Modal: org.apache.wicket.MarkupContainer - Add _header_ to [Page class
= MyPage, id = 3, version = 0, ajax = 2]
Page: org.apache.wicket.MarkupContainer - Add _header_ to [Page class
= MyPage, id = 4, version = 0]

Does "ajax = 2" have any significance here?

Thanks,

Alec

On Tue, Jan 10, 2012 at 10:49 AM, Doug Leeper  wrote:
> I am assuming what you mean by hanging is that the call on the client browser
> doesn't complete or is interrupted for some reason.  The hanging is not
> occurring on the server side...correct?
>
> Are there any javascript errors?  I ask b/c you indicated:
>
> "INFO: Invoking pre-call handler(s)..." and before "INFO: Response  parsed.
> Now invoking steps...".
>
> Could be that the info window is not there in the DOM any more?
>
> Not that these are answers but steps I would like to solving this problem.
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/AJAX-upload-in-modal-window-hangs-when-file-size-is-too-large-L-tp4276504p4282736.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: AJAX upload in modal window hangs when file size is too large @L

2012-01-10 Thread Alec Swan
I just compared HTTP traces between AJAX-uploading a small file and
large file and noticed that in both cases the same POST call is made
from the client. However, with small file upload POST result returns
quickly with status 200 and with large file the POST call never
returns.

When I pause my debugging session I can see that the code is blocking
in WebResponse#write(AppendingStringBuffer asb).

Why would the AJAX-upload POST hang?

Thanks,

Alec

On Tue, Jan 10, 2012 at 11:55 AM, Alec Swan  wrote:
> Correct, the client does not complete even though my server code
> execution finishes.
>
> There are no Javascript errors. It is possible that the info window is
> not a part of the DOM but I don't know how to verify that.
>
> The problem is caused by adding a component from the parent page to
> ART during AJAX upload. And it's only broken in a modal window during
> very large uploads!
>
> I enabled Wicket debug logging and noticed different messages logged
> during upload from modal window and regular page. Here is the first
> line that is different:
> Modal: org.apache.wicket.MarkupContainer - Add _header_ to [Page class
> = MyPage, id = 3, version = 0, ajax = 2]
> Page: org.apache.wicket.MarkupContainer - Add _header_ to [Page class
> = MyPage, id = 4, version = 0]
>
> Does "ajax = 2" have any significance here?
>
> Thanks,
>
> Alec
>
> On Tue, Jan 10, 2012 at 10:49 AM, Doug Leeper  wrote:
>> I am assuming what you mean by hanging is that the call on the client browser
>> doesn't complete or is interrupted for some reason.  The hanging is not
>> occurring on the server side...correct?
>>
>> Are there any javascript errors?  I ask b/c you indicated:
>>
>> "INFO: Invoking pre-call handler(s)..." and before "INFO: Response  parsed.
>> Now invoking steps...".
>>
>> Could be that the info window is not there in the DOM any more?
>>
>> Not that these are answers but steps I would like to solving this problem.
>>
>> --
>> View this message in context: 
>> http://apache-wicket.1842946.n4.nabble.com/AJAX-upload-in-modal-window-hangs-when-file-size-is-too-large-L-tp4276504p4282736.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



AJAX Error in parsing: XML Parsing Error: not well-formed @L

2012-01-21 Thread Alec Swan
Hello,

I am using Wicket 1.4.17 and have a panel which implements
IHeaderContributor as follows:

public void renderHead(IHeaderResponse response) {
  response.renderString("if (1 == 1 && true) alert('Hello!')");
}

When the panel is updated as a part of AJAX request (by adding to ART)
the following error is shown in Debugger:

ERROR: Error in parsing: XML Parsing Error: not well-formed
Location: http://localhost:8080/...
Line Number 1, Column 67:http://wicket.apache.org";>if (1 == 1 && true)
alert('Hello!')

Shouldn't ART's header contributor properly escape special XML
characters such as &? How can I fix this?

Thanks,

Alec

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



Re: AJAX Error in parsing: XML Parsing Error: not well-formed @L

2012-01-22 Thread Alec Swan
The following workaround works but violates encapsulation. Why doesn't
AjaxRequestTarget.AjaxHeaderResponse class escape special XML
characters?

public void renderHead(IHeaderResponse response) {
String scriptToRender = "if (1 == 1 && true)
alert('Hello!')";
if (scriptToRender != null) {
if (AjaxRequestTarget.get() != null) {
scriptToRender = scriptToRender.replace("&", "&");
// todo: escape other XML special characters
}
response.renderString(scriptToRender);
    }
}

Thanks,

Alec

On Sun, Jan 22, 2012 at 12:14 AM, Alec Swan  wrote:
> Hello,
>
> I am using Wicket 1.4.17 and have a panel which implements
> IHeaderContributor as follows:
>
> public void renderHead(IHeaderResponse response) {
>  response.renderString("if (1 == 1 && true) 
> alert('Hello!')");
> }
>
> When the panel is updated as a part of AJAX request (by adding to ART)
> the following error is shown in Debugger:
>
> ERROR: Error in parsing: XML Parsing Error: not well-formed
> Location: http://localhost:8080/...
> Line Number 1, Column 67: xmlns:wicket="http://wicket.apache.org";>if (1 == 1 && true)
> alert('Hello!')
>
> Shouldn't ART's header contributor properly escape special XML
> characters such as &? How can I fix this?
>
> Thanks,
>
> Alec

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



Execute Javascript after components of a certain type render

2012-01-22 Thread Alec Swan
Hello,

What is the best way to execute some Javascript code when components
of type IMyPanel render?

I was hoping that I could use
Application#addPostComponentOnBeforeRenderListener(..) and add a
listener that would add a behavior to each component of IMyPanel type.
The behavior would then execute append some Javascript in
onComponentTag() method. However, I can't seem to find the right type
of behavior to attach or maybe I should use a different
Application#addXXXListener(..) method.

Please help.

Thanks,

Alec

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



Re: Execute Javascript after components of a certain type render

2012-01-23 Thread Alec Swan
That's a a good idea but unfortunately my panels extend disjoint class
hierarchies and I can only group them using interfaces.

Any thoughts on how I can use Application listeners to accomplish this?

Thanks,

Alec

On Mon, Jan 23, 2012 at 3:41 AM, Andrea Del Bene  wrote:
> Why not make an abstract MyPanel and provide an implementation of renderHead
> method (from IHeaderContributor)?
> I mean something like:
>
> public abstract class MyPanel extends Panel{
>
>    public void renderHead(Component component, IHeaderResponse response)
>        {
>                response.renderOnLoadJavaScript("<...your JavaScript...>");
>        }
> }
>
>
>> Hello,
>>
>> What is the best way to execute some Javascript code when components
>> of type IMyPanel render?
>>
>> I was hoping that I could use
>> Application#addPostComponentOnBeforeRenderListener(..) and add a
>> listener that would add a behavior to each component of IMyPanel type.
>> The behavior would then execute append some Javascript in
>> onComponentTag() method. However, I can't seem to find the right type
>> of behavior to attach or maybe I should use a different
>> Application#addXXXListener(..) method.
>>
>> Please help.
>>
>> Thanks,
>>
>> Alec
>>
>> -
>> 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: Execute Javascript after components of a certain type render

2012-01-23 Thread Alec Swan
It looks like your code will add an IHeaderContributor to EVERY
component once IComponentOnBeforeRenderListener finds an instance of
IMyPanel component. Which is not what I need.

I was hoping to do something like this:

addPostComponentOnBeforeRenderListener(new IComponentOnBeforeRenderListener() {
@Override
public void onBeforeRender(Component component) {
if (component instanceof MicroSitePanel) {
component.add(new XXXBehavior() {
  // somehow fire Javascript when component
renders, e.g. onComponentTag???
});
}
}
});

So, my question is what XXXBehavior should I use and how to fire
Javascript when component renders?

Thanks,

Alec

On Mon, Jan 23, 2012 at 10:09 AM, Andrea Del Bene  wrote:
> Your idea of using PostComponentOnBeforeRenderListener sounds good to me,
> but I didn't understand exactly what you do with this kind of listener.
>
> Once you have checked if component implements IMyPanel, I would call
> Application.getHeaderContributorListenerCollection()  and I would add a
> header contributor which renders your JavaScript as I suggested in the
> previous mail.
> The code of you IComponentOnBeforeRenderListener should be something like:
>
>  implements IComponentOnBeforeRenderListener{
>
>    onBeforeRender(Component component) {
>        if(component instanceof IMyPanel)
>
>  Application.get().getHeaderContributorListenerCollection().add(new
> IHeaderContributor(){
>                                public void renderHead( IHeaderResponse
> response)
>                                    {
>
>  response.renderOnLoadJavaScript("<...your JavaScript...>");
>                                    }
>            });
>
>    }
> }
>>
>> That's a a good idea but unfortunately my panels extend disjoint class
>> hierarchies and I can only group them using interfaces.
>>
>> Any thoughts on how I can use Application listeners to accomplish this?
>>
>> Thanks,
>>
>> Alec
>>
>> On Mon, Jan 23, 2012 at 3:41 AM, Andrea Del Bene
>>  wrote:
>>
>
>
> -
> 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: Execute Javascript after components of a certain type render

2012-01-23 Thread Alec Swan
Sorry "component instanceof MicroSitePanel" should have read
"component instanceof IMyPanel"

On Mon, Jan 23, 2012 at 11:26 AM, Alec Swan  wrote:
> It looks like your code will add an IHeaderContributor to EVERY
> component once IComponentOnBeforeRenderListener finds an instance of
> IMyPanel component. Which is not what I need.
>
> I was hoping to do something like this:
>
> addPostComponentOnBeforeRenderListener(new IComponentOnBeforeRenderListener() 
> {
>            @Override
>            public void onBeforeRender(Component component) {
>                if (component instanceof MicroSitePanel) {
>                    component.add(new XXXBehavior() {
>                      // somehow fire Javascript when component
> renders, e.g. onComponentTag???
>                    });
>                }
>            }
>        });
>
> So, my question is what XXXBehavior should I use and how to fire
> Javascript when component renders?
>
> Thanks,
>
> Alec
>
> On Mon, Jan 23, 2012 at 10:09 AM, Andrea Del Bene  
> wrote:
>> Your idea of using PostComponentOnBeforeRenderListener sounds good to me,
>> but I didn't understand exactly what you do with this kind of listener.
>>
>> Once you have checked if component implements IMyPanel, I would call
>> Application.getHeaderContributorListenerCollection()  and I would add a
>> header contributor which renders your JavaScript as I suggested in the
>> previous mail.
>> The code of you IComponentOnBeforeRenderListener should be something like:
>>
>>  implements IComponentOnBeforeRenderListener{
>>
>>    onBeforeRender(Component component) {
>>        if(component instanceof IMyPanel)
>>
>>  Application.get().getHeaderContributorListenerCollection().add(new
>> IHeaderContributor(){
>>                                public void renderHead( IHeaderResponse
>> response)
>>                                    {
>>
>>  response.renderOnLoadJavaScript("<...your JavaScript...>");
>>                                    }
>>            });
>>
>>    }
>> }
>>>
>>> That's a a good idea but unfortunately my panels extend disjoint class
>>> hierarchies and I can only group them using interfaces.
>>>
>>> Any thoughts on how I can use Application listeners to accomplish this?
>>>
>>> Thanks,
>>>
>>> Alec
>>>
>>> On Mon, Jan 23, 2012 at 3:41 AM, Andrea Del Bene
>>>  wrote:
>>>
>>
>>
>> -
>> 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: Execute Javascript after components of a certain type render

2012-01-23 Thread Alec Swan
What about AbstractTransformerBehavior? Can I use it to execute Javascript?

On Mon, Jan 23, 2012 at 12:08 PM, Igor Vaynberg  wrote:
> There is no baked behavior for this. Create your own and override
> renderhead method to output js. If this is a one time thing override
> istemporary method to return true.
>
> -igor
>
> -igor
> On Jan 23, 2012 10:26 AM, "Alec Swan"  wrote:
>
>> It looks like your code will add an IHeaderContributor to EVERY
>> component once IComponentOnBeforeRenderListener finds an instance of
>> IMyPanel component. Which is not what I need.
>>
>> I was hoping to do something like this:
>>
>> addPostComponentOnBeforeRenderListener(new
>> IComponentOnBeforeRenderListener() {
>>            @Override
>>            public void onBeforeRender(Component component) {
>>                if (component instanceof MicroSitePanel) {
>>                    component.add(new XXXBehavior() {
>>                      // somehow fire Javascript when component
>> renders, e.g. onComponentTag???
>>                    });
>>                }
>>            }
>>        });
>>
>> So, my question is what XXXBehavior should I use and how to fire
>> Javascript when component renders?
>>
>> Thanks,
>>
>> Alec
>>
>> On Mon, Jan 23, 2012 at 10:09 AM, Andrea Del Bene 
>> wrote:
>> > Your idea of using PostComponentOnBeforeRenderListener sounds good to me,
>> > but I didn't understand exactly what you do with this kind of listener.
>> >
>> > Once you have checked if component implements IMyPanel, I would call
>> > Application.getHeaderContributorListenerCollection()  and I would add a
>> > header contributor which renders your JavaScript as I suggested in the
>> > previous mail.
>> > The code of you IComponentOnBeforeRenderListener should be something
>> like:
>> >
>> >  implements IComponentOnBeforeRenderListener{
>> >
>> >    onBeforeRender(Component component) {
>> >        if(component instanceof IMyPanel)
>> >
>> >  Application.get().getHeaderContributorListenerCollection().add(new
>> > IHeaderContributor(){
>> >                                public void renderHead( IHeaderResponse
>> > response)
>> >                                    {
>> >
>> >  response.renderOnLoadJavaScript("<...your JavaScript...>");
>> >                                    }
>> >            });
>> >
>> >    }
>> > }
>> >>
>> >> That's a a good idea but unfortunately my panels extend disjoint class
>> >> hierarchies and I can only group them using interfaces.
>> >>
>> >> Any thoughts on how I can use Application listeners to accomplish this?
>> >>
>> >> Thanks,
>> >>
>> >> Alec
>> >>
>> >> On Mon, Jan 23, 2012 at 3:41 AM, Andrea Del Bene
>> >>  wrote:
>> >>
>> >
>> >
>> > -
>> > 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: Execute Javascript after components of a certain type render

2012-01-24 Thread Alec Swan
Your suggestions worked. Thank you both!

On Mon, Jan 23, 2012 at 1:50 PM, Alec Swan  wrote:
> What about AbstractTransformerBehavior? Can I use it to execute Javascript?
>
> On Mon, Jan 23, 2012 at 12:08 PM, Igor Vaynberg  
> wrote:
>> There is no baked behavior for this. Create your own and override
>> renderhead method to output js. If this is a one time thing override
>> istemporary method to return true.
>>
>> -igor
>>
>> -igor
>> On Jan 23, 2012 10:26 AM, "Alec Swan"  wrote:
>>
>>> It looks like your code will add an IHeaderContributor to EVERY
>>> component once IComponentOnBeforeRenderListener finds an instance of
>>> IMyPanel component. Which is not what I need.
>>>
>>> I was hoping to do something like this:
>>>
>>> addPostComponentOnBeforeRenderListener(new
>>> IComponentOnBeforeRenderListener() {
>>>            @Override
>>>            public void onBeforeRender(Component component) {
>>>                if (component instanceof MicroSitePanel) {
>>>                    component.add(new XXXBehavior() {
>>>                      // somehow fire Javascript when component
>>> renders, e.g. onComponentTag???
>>>                    });
>>>                }
>>>            }
>>>        });
>>>
>>> So, my question is what XXXBehavior should I use and how to fire
>>> Javascript when component renders?
>>>
>>> Thanks,
>>>
>>> Alec
>>>
>>> On Mon, Jan 23, 2012 at 10:09 AM, Andrea Del Bene 
>>> wrote:
>>> > Your idea of using PostComponentOnBeforeRenderListener sounds good to me,
>>> > but I didn't understand exactly what you do with this kind of listener.
>>> >
>>> > Once you have checked if component implements IMyPanel, I would call
>>> > Application.getHeaderContributorListenerCollection()  and I would add a
>>> > header contributor which renders your JavaScript as I suggested in the
>>> > previous mail.
>>> > The code of you IComponentOnBeforeRenderListener should be something
>>> like:
>>> >
>>> >  implements IComponentOnBeforeRenderListener{
>>> >
>>> >    onBeforeRender(Component component) {
>>> >        if(component instanceof IMyPanel)
>>> >
>>> >  Application.get().getHeaderContributorListenerCollection().add(new
>>> > IHeaderContributor(){
>>> >                                public void renderHead( IHeaderResponse
>>> > response)
>>> >                                    {
>>> >
>>> >  response.renderOnLoadJavaScript("<...your JavaScript...>");
>>> >                                    }
>>> >            });
>>> >
>>> >    }
>>> > }
>>> >>
>>> >> That's a a good idea but unfortunately my panels extend disjoint class
>>> >> hierarchies and I can only group them using interfaces.
>>> >>
>>> >> Any thoughts on how I can use Application listeners to accomplish this?
>>> >>
>>> >> Thanks,
>>> >>
>>> >> Alec
>>> >>
>>> >> On Mon, Jan 23, 2012 at 3:41 AM, Andrea Del Bene
>>> >>  wrote:
>>> >>
>>> >
>>> >
>>> > -
>>> > 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: AJAX Error in parsing: XML Parsing Error: not well-formed @L

2012-01-24 Thread Alec Swan
Can anybody comment on this? Is this a bug?

Thanks,

Alec

On Sun, Jan 22, 2012 at 11:50 AM, Alec Swan  wrote:
> The following workaround works but violates encapsulation. Why doesn't
> AjaxRequestTarget.AjaxHeaderResponse class escape special XML
> characters?
>
> public void renderHead(IHeaderResponse response) {
>        String scriptToRender = "if (1 == 1 && true)
> alert('Hello!')";
>        if (scriptToRender != null) {
>            if (AjaxRequestTarget.get() != null) {
>                scriptToRender = scriptToRender.replace("&", "&");
> // todo: escape other XML special characters
>            }
>            response.renderString(scriptToRender);
>        }
>    }
>
> Thanks,
>
> Alec
>
> On Sun, Jan 22, 2012 at 12:14 AM, Alec Swan  wrote:
>> Hello,
>>
>> I am using Wicket 1.4.17 and have a panel which implements
>> IHeaderContributor as follows:
>>
>> public void renderHead(IHeaderResponse response) {
>>  response.renderString("if (1 == 1 && true) 
>> alert('Hello!')");
>> }
>>
>> When the panel is updated as a part of AJAX request (by adding to ART)
>> the following error is shown in Debugger:
>>
>> ERROR: Error in parsing: XML Parsing Error: not well-formed
>> Location: http://localhost:8080/...
>> Line Number 1, Column 67:> xmlns:wicket="http://wicket.apache.org";>if (1 == 1 && true)
>> alert('Hello!')
>>
>> Shouldn't ART's header contributor properly escape special XML
>> characters such as &? How can I fix this?
>>
>> Thanks,
>>
>> Alec

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



Best practices for using CSS resource references

2012-02-06 Thread Alec Swan
Hello,

I have a LocalResourceScope class (aliased as "local" shared resource)
and style.css in the same package. I can access
resources/local/style.css directly from the browser and track the size
of HTTP request/response to retrieve CSS.

I also tried to do bind the CSS file as follows
  new CompressedResourceReference(LocalResourceScope.class,
"style.css").bind(Application.get())
expecting it to reduce the amount of traffic, but it actually
increased request size by about 10%.

So, why would anybody use CompressedResourceReference when
contributing CSS? Is there a resource reference that would strip out
spaces and comments from CSS?

Thanks,

Alec

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



Re: Best practices for using CSS resource references

2012-02-07 Thread Alec Swan
3 responses in one day, awesome!

Serban and Jordi, our app allows users to upload custom CSS so
compile-time solutions will not work for us here.

Martin, if I understood you correctly there is no special support,
such as removing comments, in Wicket for CSS resources, right? If
CompressedResourceReference is removed in 1.5 what should be used
instead? (In migration guide
https://cwiki.apache.org/WICKET/migration-to-wicket-15.html it says
"See above")

Thanks,

Alec

On Tue, Feb 7, 2012 at 1:19 AM, Jordi Deu-Pons  wrote:
> Hi Alec,
>
>  I'm using this maven plugin on production releases:
> http://alchim.sourceforge.net/yuicompressor-maven-plugin/ that
> compress the CSS and the JS before packaging it into the WAR.
>
>
>
> On Tue, Feb 7, 2012 at 9:06 AM, Martin Grigorov  wrote:
>> Hi,
>>
>> On Mon, Feb 6, 2012 at 11:03 PM, Alec Swan  wrote:
>>> Hello,
>>>
>>> I have a LocalResourceScope class (aliased as "local" shared resource)
>>> and style.css in the same package. I can access
>>> resources/local/style.css directly from the browser and track the size
>>> of HTTP request/response to retrieve CSS.
>>>
>>> I also tried to do bind the CSS file as follows
>>>  new CompressedResourceReference(LocalResourceScope.class,
>>> "style.css").bind(Application.get())
>>> expecting it to reduce the amount of traffic, but it actually
>>> increased request size by about 10%.
>>
>> Compressing the *response* cannot affect anyhow the *request* size ;-)
>>
>>>
>>> So, why would anybody use CompressedResourceReference when
>>> contributing CSS? Is there a resource reference that would strip out
>>> spaces and comments from CSS?
>>
>> CompressedResourceReference uses GZip to squash the text content, so
>> all the rules in zip compression are valid here:
>> - more text content => better compression
>> - compressing binary content => negative effect
>>
>> For CSS (text content) the result size should be less than the original.
>>
>> CompressedResourceReference is removed in Wicket 1.5 because all Web
>> servers support it for all responses by switching a setting in their
>> config. No need Wicket to duplicate this support.
>>
>>>
>>> Thanks,
>>>
>>> Alec
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>
>>
>>
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.com
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>
>
>
> --
> a10! i fins aviat.
> J:-Deu
>
> -
> 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: Best practices for using CSS resource references

2012-02-07 Thread Alec Swan
Martin, removing CompressResRef in 1.5 makes perfect sense. Thanks for
pointing me to CssCompressor and JavaScriptCompressor.

Serban, thanks for a good link. I can see how I can use wro4j
Reader/Writer code to implement CssCompressor Martin pointed out.

Thanks again, guys!

Alec

On Tue, Feb 7, 2012 at 10:02 AM, Serban.Balamaci  wrote:
> Hi Alec,
> With wro4j you can do the minification at runtime also by using the
> processors like:
> http://code.google.com/p/wro4j/wiki/ReusingProcessors
> you get to work with Reader and Writer. You could apply the processor after
> the resource has been uploaded or even when requested(though probably it's
> more efficient to do the first).
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/Best-practices-for-using-CSS-resource-references-tp4362796p4365408.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: how to test the wicket panel

2012-02-13 Thread Alec Swan
I do something like:

wicketTester.startPanel(new ITestPanelSource() {
  public Panel getTestPanel(String panelId) { return MyPanel(); }
});
tester.getComponentFromLastRenderedPage(DummyPanelPage.TEST_PANEL_ID);

If this doesn't work for you send us your code.

Thanks,

Alec

On Mon, Feb 13, 2012 at 5:05 AM, akiindia01  wrote:
> i am getting the follwing error :eachtime i tried to start the panel please
> help me. tell me how to start the panel.
>
>
> org.apache.wicket.WicketRuntimeException: path: 'panel' does not exist for
> page: UnexpectedExceptionPage
>        at
> org.apache.wicket.util.tester.BaseWicketTester.fail(BaseWicketTester.java:1449)
>        at
> org.apache.wicket.util.tester.BaseWicketTester.getComponentFromLastRenderedPage(BaseWicketTester.java:487)
>        at
> org.apache.wicket.util.tester.BaseWicketTester.isComponent(BaseWicketTester.java:570)
>        at
> org.apache.wicket.util.tester.WicketTester.assertComponent(WicketTester.java:355)
>        at
> com.fifththird.retail.fna.pages.components.PoaPodCustomerSearchPanelTest.testDefaultPanelRender(PoaPodCustomerSearchPanelTest.java:51)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>        at java.lang.reflect.Method.invoke(Method.java:615)
>        at junit.framework.TestCase.runTest(TestCase.java:168)
>        at org.jmock.core.VerifyingTestCase.runBare(VerifyingTestCase.java:39)
>        at junit.framework.TestResult$1.protect(TestResult.java:110)
>        at junit.framework.TestResult.runProtected(TestResult.java:128)
>        at junit.framework.TestResult.run(TestResult.java:113)
>        at junit.framework.TestCase.run(TestCase.java:124)
>        at junit.framework.TestSuite.runTest(TestSuite.java:232)
>        at junit.framework.TestSuite.run(TestSuite.java:227)
>        at
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
>        at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>        at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>        at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>        at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>        at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>        at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/how-to-test-the-wicket-panel-tp4368407p4383536.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: jQuery form validation with wicket ajax

2012-02-13 Thread Alec Swan
This thread describes a purely client-side solution to your problem:
http://stackoverflow.com/questions/1506729/how-to-intercept-the-onclick-event.
You can solve this problem for all you AJAX links by assigning them a
special class, e.g. class="ajaxLink", and then apply the technique to
$("form .ajaxLink").

On Mon, Feb 13, 2012 at 3:55 AM, Paul Jackson  wrote:
> We use an OnBeforeRenderListener to add onClick events to the buttons and 
> ajax buttons on a form that we want to be validated. We have to handle the 
> normal buttons and ajax buttons slightly differently.
>
> Ajax button:
>
>            button.add(new AttributeModifier("onclick", new Model("if 
> (! $('#" + formMarkupId
>                    + "').validate().form()) {return false};")) {
>
> Normal Button:
>
>            button.add(new WiQueryEventBehavior(new Event(MouseEvent.CLICK) {
>                @Override
>                public JsScope callback() {
>                    return JsScope.quickScope("return $('#" + formMarkupId + 
> "').validate().form();");
>                }
>            }));
>
> Hope that helps.
>
> Paul
>
> -Original Message-
> From: Gerrit Scholz | QUERPLEX.de [mailto:gerrit.sch...@querplex.de]
> Sent: 13 February 2012 10:18
> To: users@wicket.apache.org
> Subject: jQuery form validation with wicket ajax
>
> Hello there,
> I try to use jQuery validaton (http://docs.jquery.com/Plugins/Validation) 
> with a wicket AJAX button. I register the jQuery validator on the form. If I 
> use a normal wicket submit button or link, the jQuery form validation works. 
> But if I use an AJAX button or link, the jQuery form validation is not 
> called. How can I call the jQuery validation before AJAX update.
> Thanks,
> Gerrit
>
>
>
> ---
> QUERPLEX GmbH Nürnberg | www.querplex.de Kornmarkt 2
> D-90402 Nürnberg
> ---
> Tel +49 (0)911 94 11 98 - 0
> Fax +49 (0)911 94 11 98 - 59
> ---
> Registergericht Nürnberg HRB 20 123
> Geschäftsführerin: Angelika Benkert
> ---
> **
> Please consider the environment - do you really need to print this email?
>
> This email is intended only for the person(s) named above and may contain 
> private and confidential information. If it has come to you in error, please 
> destroy and permanently delete any copy in your possession and contact us on 
> +44 (0) 161 480 4420. The information in this email is copyright © CDL Group 
> Holdings Limited. We cannot accept any liability for any loss or damage 
> sustained as a result of software viruses. It is your responsibility to carry 
> out such virus checking as is necessary before opening any attachment.
>
> Cheshire Datasystems Limited uses software which automatically screens 
> incoming emails for inappropriate content and attachments. If the software 
> identifies such content or attachment, the email will be forwarded to our 
> Technology Department for checking. You should be aware that any email which 
> you send to Cheshire Datasystems Limited is subject to this procedure.
>
> Cheshire Datasystems Limited, Strata House, Kings Reach Road, Stockport SK4 
> 2HD
> Registered in England and Wales with Company Number 3991057
> VAT registration: 727 1188 33

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



Re: jQuery form validation with wicket ajax

2012-02-14 Thread Alec Swan
Are you saying that AjaxRequestTarget is not null without your onclick
attribute changes and is null with your changes? If so, please post
the changes you made to onclick attribute.

On Tue, Feb 14, 2012 at 7:06 AM, Gerrit Scholz | QUERPLEX.de
 wrote:
> If I intercept the onclick event my function is called but the processing not 
> stop. Mean that the wicket (onclick) javascript is running parallel.
> So I write a AttributeModifier that prepends my function to the onclick 
> attribute. Now the validation works fine, but on the onSubmit method of the 
> wicket ajax button the AjaxRequestTarget is null so the component to refresh 
> cannot be added.
>
> Gerrit
>
> -Ursprüngliche Nachricht-
> Von: Paul Jackson [mailto:paul.jack...@cdl.co.uk]
> Gesendet: Dienstag, 14. Februar 2012 10:38
> An: users@wicket.apache.org
> Betreff: RE: jQuery form validation with wicket ajax
>
> Thanks for that link! I never managed to work out how to get jquery events to 
> override the buttons onClick attribute. This should simplify our validation 
> code a lot.
>
> Paul
>
> -Original Message-
> From: Alec Swan [mailto:alecs...@gmail.com]
> Sent: 13 February 2012 16:38
> To: users@wicket.apache.org
> Subject: Re: jQuery form validation with wicket ajax
>
> This thread describes a purely client-side solution to your problem:
> http://stackoverflow.com/questions/1506729/how-to-intercept-the-onclick-event.
> You can solve this problem for all you AJAX links by assigning them a special 
> class, e.g. class="ajaxLink", and then apply the technique to $("form 
> .ajaxLink").
>
> On Mon, Feb 13, 2012 at 3:55 AM, Paul Jackson  wrote:
>> We use an OnBeforeRenderListener to add onClick events to the buttons and 
>> ajax buttons on a form that we want to be validated. We have to handle the 
>> normal buttons and ajax buttons slightly differently.
>>
>> Ajax button:
>>
>>            button.add(new AttributeModifier("onclick", new
>> Model("if (! $('#" + formMarkupId
>>                    + "').validate().form()) {return false};")) {
>>
>> Normal Button:
>>
>>            button.add(new WiQueryEventBehavior(new
>> Event(MouseEvent.CLICK) {
>>                @Override
>>                public JsScope callback() {
>>                    return JsScope.quickScope("return $('#" +
>> formMarkupId + "').validate().form();");
>>                }
>>            }));
>>
>> Hope that helps.
>>
>> Paul
>>
>> -Original Message-
>> From: Gerrit Scholz | QUERPLEX.de [mailto:gerrit.sch...@querplex.de]
>> Sent: 13 February 2012 10:18
>> To: users@wicket.apache.org
>> Subject: jQuery form validation with wicket ajax
>>
>> Hello there,
>> I try to use jQuery validaton (http://docs.jquery.com/Plugins/Validation) 
>> with a wicket AJAX button. I register the jQuery validator on the form. If I 
>> use a normal wicket submit button or link, the jQuery form validation works. 
>> But if I use an AJAX button or link, the jQuery form validation is not 
>> called. How can I call the jQuery validation before AJAX update.
>> Thanks,
>> Gerrit
>>
>>
>>
>> --
>> - QUERPLEX GmbH Nürnberg | www.querplex.de Kornmarkt 2
>> D-90402 Nürnberg
>> --
>> -
>> Tel +49 (0)911 94 11 98 - 0
>> Fax +49 (0)911 94 11 98 - 59
>> --
>> -
>> Registergericht Nürnberg HRB 20 123
>> Geschäftsführerin: Angelika Benkert
>> --
>> -
>> **
>> Please consider the environment - do you really need to print this email?
>>
>> This email is intended only for the person(s) named above and may contain 
>> private and confidential information. If it has come to you in error, please 
>> destroy and permanently delete any copy in your possession and contact us on 
>> +44 (0) 161 480 4420. The information in this email is copyright © CDL Group 
>> Holdings Limited. We cannot accept any liability for any loss or damage 
>> sustained as a result of software viruses. It is your responsibility to 
>> carry out such virus checking as is necessary before opening any attachment.
>>
>> Cheshire Datasystems Limited uses software which automatically screens 
>&

Re: jQuery form validation with wicket ajax

2012-02-15 Thread Alec Swan
Gerrit, You need to call .valid().form(), not just .valid(). Also, you
should probably use the form id "#contactForm8" instead of '.register'
jQuery selector. In other words, use Paul's code snippet:
button.add(new AttributeModifier("onclick", new Model("if (!
$('#" + formMarkupId + "').validate().form()) {return false};"))

On Wed, Feb 15, 2012 at 2:18 AM, Paul Jackson  wrote:
>
> This works for us:
>
> onclick="if (! $('#id45').validate().form()) {return false};if 
> (function(){return Wicket.$$(this)&&Wicket.$$('id45')}.bind(this)()) { 
> Wicket.showIncrementally('busyIndicator');}var 
> wcall=wicketSubmitFormById('id45', 
> '?x=cu02w6454cTq5HSn4Av8ZXGRwfcS*bDlrHDXn8GklQ6Sh3RC2Dgwz8XwqsEQE*Jo7KvmsA5Uh0NowPRWPoKW7z8clW5Md9oNtKs9d1v0BgjqKNKS-oluEmHYF0Tjrkqq8T76MXi*zlTAtfj5YLHG3gKsV2tb4R*z',
>  'address:pafForm:pafSearch' ,function() { 
> ;Wicket.hideIncrementally('busyIndicator');}.bind(this),function() { 
> ;Wicket.hideIncrementally('busyIndicator');}.bind(this), function() {return 
> Wicket.$$(this)&&Wicket.$$('id45')}.bind(this));;; return false;"
>
> It's basically the same, with some extras bits for busy indicators and such.
>
> Paul
>
> -Original Message-
> From: Gerrit Scholz | QUERPLEX.de [mailto:gerrit.sch...@querplex.de]
> Sent: 15 February 2012 09:09
> To: users@wicket.apache.org
> Subject: AW: jQuery form validation with wicket ajax
>
> I prepend "if(!$('.register').valid()) { return false;};" to the onclick 
> attribute.
> This statement call the jQuery validator for the form.
>
> The onclick attribute without my changes (AjaxRequestTarget not null):
>
> onclick="var wcall=wicketSubmitFormById('contactForm8', 
> '../kemner/?wicket:interface=:4:contactForm:sendContact::IActivePageBehaviorListener:0:1&wicket:ignoreIfNotActive=true',
>  'sendContact' ,function() { }.bind(this),function() { }.bind(this), 
> function() {return Wicket.$$(this)&&Wicket.$$('contactForm8')}.bind(this));;; 
> return false;"
>
> onclick with my changes (AjaxRequestTarget null):
>
> onclick=" if(!$('.register').valid()) { return false;}; var 
> wcall=wicketSubmitFormById('contactForm8', 
> '../kemner/?wicket:interface=:4:contactForm:sendContact::IActivePageBehaviorListener:0:1&wicket:ignoreIfNotActive=true',
>  'sendContact' ,function() { }.bind(this),function() { }.bind(this), 
> function() {return Wicket.$$(this)&&Wicket.$$('contactForm8')}.bind(this));;; 
> return false;"
>
> Gerrit
>
> -Ursprüngliche Nachricht-
> Von: Alec Swan [mailto:alecs...@gmail.com]
> Gesendet: Dienstag, 14. Februar 2012 18:50
> An: users@wicket.apache.org
> Betreff: Re: jQuery form validation with wicket ajax
>
> Are you saying that AjaxRequestTarget is not null without your onclick 
> attribute changes and is null with your changes? If so, please post the 
> changes you made to onclick attribute.
>
> On Tue, Feb 14, 2012 at 7:06 AM, Gerrit Scholz | QUERPLEX.de 
>  wrote:
>> If I intercept the onclick event my function is called but the processing 
>> not stop. Mean that the wicket (onclick) javascript is running parallel.
>> So I write a AttributeModifier that prepends my function to the onclick 
>> attribute. Now the validation works fine, but on the onSubmit method of the 
>> wicket ajax button the AjaxRequestTarget is null so the component to refresh 
>> cannot be added.
>>
>> Gerrit
>>
>> -Ursprüngliche Nachricht-
>> Von: Paul Jackson [mailto:paul.jack...@cdl.co.uk]
>> Gesendet: Dienstag, 14. Februar 2012 10:38
>> An: users@wicket.apache.org
>> Betreff: RE: jQuery form validation with wicket ajax
>>
>> Thanks for that link! I never managed to work out how to get jquery events 
>> to override the buttons onClick attribute. This should simplify our 
>> validation code a lot.
>>
>> Paul
>>
>> -Original Message-
>> From: Alec Swan [mailto:alecs...@gmail.com]
>> Sent: 13 February 2012 16:38
>> To: users@wicket.apache.org
>> Subject: Re: jQuery form validation with wicket ajax
>>
>> This thread describes a purely client-side solution to your problem:
>> http://stackoverflow.com/questions/1506729/how-to-intercept-the-onclick-event.
>> You can solve this problem for all you AJAX links by assigning them a 
>> special class, e.g. class="ajaxLink", and then apply the technique to 
>> $("form .ajaxLin

Re: Wicket jQuery Validator integration

2012-02-23 Thread Alec Swan
Zachary, I will definitely find your code that does client-side
validation useful. I don't know if this helps but Jeremy Thomerson had
a presentation on custom JavaScript integration with Wicket
(http://stuq.nl/weblog/2009-11-27/london-wicket-meetup-wicket-1-5-wiquery-brix-and-more).

On Mon, Feb 20, 2012 at 2:06 PM, Maarten Bosteels
 wrote:
> On Wed, Feb 15, 2012 at 5:41 PM, Paul Jackson wrote:
>
>> We do something very similar to this, and agree that it works really
>> well. We also use JSR303 annotations on our domain models and use them
>> to drive adding both wicket and jquery validators.
>>
>> We have a bunch of ValdiationConfiguration classes that know what to add
>> to the markup and javascript to get the client side validation to work,
>> so we don't need an extension to IValidator.
>>
>> Cheers,
>> Paul
>>
>> -Original Message-
>> From: Zachary Bedell [mailto:zacl...@thebedells.org]
>> Sent: 15 February 2012 15:52
>> To: users@wicket.apache.org
>> Subject: Wicket jQuery Validator integration
>>
>> Good morning,
>>
>> Reading a recent thread about accessing jQuery Validation from Wicket
>> reminded me that I've developed some code that might be of use.  I'm not
>> sure if this is something anyone else would be interested in or if it's
>> something that might eventually be integrated into Wicket core or if it
>> would be more appropriate for one of the existing jQuery/Wicket
>> integration libraries.  I wanted to describe what I've cooked up so far.
>> If this is anything that would be useful, I'd be willing to clean the
>> code up a bit to extract a few bits that are specific to our environment
>> and post the code somewhere.
>>
>> My intent was to get client-side validation using Wicket's existing
>> validation classes without requiring AJAX calls to make them work and
>> preferably without requiring Page's to include lots of unsightly
>> JavaScript.  Also, not duplicating validation logic on the client &
>> server tiers was desirable.  The code was originally developed for a
>> site that was expected to receive a high amount of traffic in a short
>> period of time, and avoiding unnecessary server calls was a priority.
>>
>> I created a subclass of Form (ClientSideValidatingForm) which examines
>> each FormComponent (and sub-Form) added to it and extracts information
>> about the standard Wicket validations.  It generates JavaScript which
>> uses jQuery's Validator library to apply client-side checks equivalent
>> to the Wicket server side checks.  The nice thing about this is that you
>> get client-side validation for "free" just by adding the normal Wicket
>> validations plus you still get all your validations backed up in the
>> server side in case JavaScript is unavailable or disabled.
>>
>> The implementation of the class does lack a bit in terms of elegance
>> unfortunately.  As the Wicket validation interface doesn't currently
>> know anything about JavaScript, it was necessary to run a chain of
>> instanceof checks against all the known Wicket validations and emit
>> JavaScript to mirror their logic.  I also created an extension of the
>> Wicket IValidator interface which can provide JavaScript functions to
>> perform validation equivalent to the server-side Java code.  The
>> extraction code in ClientSideValidatingForm preferentially checks for
>> this interface and uses provided JavaScript if available.  Otherwise,
>> it's a bunch of instanceof's to check for known validations or log an
>> error if an unknown instance of IValidator is found.
>>
>> Long term, it would be helpful if the stock Wicket IValidator interface
>> could include a method to get JavaScript validations for all of the
>> stock validations.
>>
>> The code is pretty tightly bound to jQuery Validator at this point, but
>> it's likely the methodology could be abstracted to other validation
>> frameworks.  It's also built using WiQuery, though that's mostly as a
>> convenience to get the same version of jQuery that we use elsewhere.
>> The same could easily be implemented without WiQuery provided a version
>> of jQuery was contributed to the response via some other mechanism.
>>
>> Is this something anyone would be interested in?
>>
>
>
> yes ;-)
>
>
>>
>> Best regards,
>> Zac Bedell
>>
>> (Apologies if this is a dupe. I had some email client config issues this
>> morning...)
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>> **
>> Please consider the environment - do you really need to print this email?
>>
>> This email is intended only for the person(s) named above and may contain
>> private and confidential information. If it has come to you in error,
>> please destroy and permanently delete any copy in your possession and
>> contact us on +44 (0) 161 480 4420. The information in this 

Re: Wicket authentication: how to store user?

2012-03-12 Thread Alec Swan
So, is this the recommended way to authenticate a user?

// verify user password and store user id in the session
if (user.getPasswordHash().equals(password)) {
  final MyWebSession webSession = MyWebSession.get();
  webSession.setUserName(user.getUserName());
  webSession.replaceSession();
}

Thanks,

Alec

On Mon, Mar 12, 2012 at 10:48 AM, Dan Retzlaff  wrote:
> Yes, I agree. Thanks for clarifying. :)
>
> On Mon, Mar 12, 2012 at 7:40 AM, Hielke Hoeve wrote:
>
>> Dan,
>>
>> JSESSIONIDs are not inherently secure. Users can be so dumb as to
>> copy/paste an url with an JSESSIONID as query parameter and send it to
>> someone else via email/msn/etc. When that other person clicks the url,
>> while the first person is logged in, he is logged in as well.
>> Webapplications should always invalidate the wicket session before
>> authenticating. (use Session.get().replaceSession() )
>>
>> See also: http://www.owasp.org/index.php/Session_Fixation
>>
>> Hielke
>>
>> -Original Message-
>> From: Dan Retzlaff [mailto:dretzl...@gmail.com]
>> Sent: maandag 5 maart 2012 3:53
>> To: users@wicket.apache.org
>> Subject: Re: Wicket authentication: how to store user?
>>
>> Paolo, sessions are accessed with a JSESSIONID cookie or query parameter
>> supplied with each request. It's not possible for one user to guess another
>> user's session ID, so the approach Martin describes is inherently secure.
>> (Just be careful with your authentication code and form/query parameter
>> validation elsewhere in your app!)
>>
>> Dan
>>
>> On Sat, Mar 3, 2012 at 4:40 AM, Paolo  wrote:
>>
>> > Alle sabato 03 marzo 2012, Martin Grigorov ha scritto:
>> > > Hi,
>> > >
>> > > Save the logged in user id in the Session.
>> > >
>> > > MySession.java:
>> > >
>> > > private long userId;
>> > >
>> > > public User getUser() {
>> > >   return userService.getUserById(userId); }
>> > >
>> > >
>> > > AnyPage.java:
>> > > user = MySession.get().getUser();
>> > >
>> > Thank you, for support and explanation code, very useful because I am a
>> > newbie.
>> > Just one another answer: Is it secure?
>> > Can someone alter session data and change user data, so an hacher could
>> > log with own account but operate with other accounts?
>> > Do I need some random code like this "hdfds6yh6yhgtruifh4hf4frh9ruehfe"
>> to
>> > store temporanealy in session and database and associate it to a specific
>> > user?
>> >
>> > > > I added registration and user/password sign-in and checking with
>> > database, instead of simple "wicket" as user and password.
>> > > > All works ok, but now I need in AdminPage to known which user is
>> > logged in.
>> >
>> > -
>> > 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: Testing AjaxSubmitLink#onSubmit() with WicketTester @L

2010-05-19 Thread Alec Swan
I'd like to resurrect this old tread because I ran into this issue again.
Last time I changed my code to use a regular link to submit the form, but
this time the form is on a modal window and has to be submitted with
AjaxSubmitLink.

My current findings are identical to the ones describes in my previous post
(the 4 items).

The problem seems to be that the new values that the formTester sets on the
form fields do not get bound to the form model and therefore are not visible
in onSubmit(). Instead, onSubmit() sees the values from the form model used
when the page was rendered.

How can I trigger binding of the new values in form fields to the model?

Thanks

On Mon, Dec 28, 2009 at 2:17 PM, Alec Swan  wrote:

> I unsuccessfully tried several different ways to invoke the AjaxSubmitLink
> from my test method.
>
>1. formTester.submit("submitButton") does not call
>AjaxSubmitLink#onSubmit(AjaxRequestTarget target, Form form)
>2. formTester.submitLink("submitButton", false) fails with
>*org.apache.wicket.WicketRuntimeException: Link
>panel:referralForm:submitButtonis an AjaxSubmitLink and will not be invoked
>when AJAX (javascript) is disabled.*
>3. tester.clickLink("referralForm:submitButton, true) does not call
>AjaxSubmitLink#onSubmit(AjaxRequestTarget target, Form form)
>4. EnhancedWicketTester.clickAjaxLink("referralForm:submitButton")
>fails with
>*junit.framework.AssertionFailedError: component
>'ReferralPanel$ReferralForm$2' is not type:Link*
>This makes sense because AjaxSubmitLink class is not a subclass of
>Link.
>
> So, how do I test AjaxSubmitLink#onSubmit(AjaxRequestTarget target, Form
> form) method?
>
> Thanks,
>
> Alec
>
> @L
>
>
> On Sun, Dec 27, 2009 at 9:44 AM, Alec Swan  wrote:
>
>> I have a page with a form and AjaxSubmitLink in the form.
>>
>> I call WicketTester#clickLink(pathToLink, true) to test the code in
>> AjaxSubmitLink#onSubmit(). The call returns with no errors, but
>> AjaxSubmitLink#onSubmit() is never called.
>>
>> Here is a code sample:
>>
>> tester.startPanel(MyPanel.class);
>> final FormTester formTester = tester.newFormTester(FORM_PATH);
>>
>> // Test: Submit form with valid inputs
>> formTester.setValue("company", "company");
>> formTester.setValue("phone", "phone");
>> *tester.clickLink(SUBMIT_LINK_PATH, true);*
>>
>> Thanks,
>>
>> Alec
>>
>>
>>
>>
>>
>


Re: Testing AjaxSubmitLink#onSubmit() with WicketTester @L

2010-05-19 Thread Alec Swan
I found a way to submit a form with Ajax link in a file attached to Wicket
bug #2783:
tester.executeAjaxEvent("path:to:ajax:link", onclick")

I hope there is a more graceful way to do this.

On Wed, May 19, 2010 at 10:38 AM, Alec Swan  wrote:

> I'd like to resurrect this old tread because I ran into this issue again.
> Last time I changed my code to use a regular link to submit the form, but
> this time the form is on a modal window and has to be submitted with
> AjaxSubmitLink.
>
> My current findings are identical to the ones describes in my previous post
> (the 4 items).
>
> The problem seems to be that the new values that the formTester sets on the
> form fields do not get bound to the form model and therefore are not visible
> in onSubmit(). Instead, onSubmit() sees the values from the form model used
> when the page was rendered.
>
> How can I trigger binding of the new values in form fields to the model?
>
> Thanks
>
>
> On Mon, Dec 28, 2009 at 2:17 PM, Alec Swan  wrote:
>
>> I unsuccessfully tried several different ways to invoke the AjaxSubmitLink
>> from my test method.
>>
>>1. formTester.submit("submitButton") does not call
>>AjaxSubmitLink#onSubmit(AjaxRequestTarget target, Form form)
>>2. formTester.submitLink("submitButton", false) fails with
>>*org.apache.wicket.WicketRuntimeException: Link
>>panel:referralForm:submitButtonis an AjaxSubmitLink and will not be 
>> invoked
>>when AJAX (javascript) is disabled.*
>>3. tester.clickLink("referralForm:submitButton, true) does not call
>>AjaxSubmitLink#onSubmit(AjaxRequestTarget target, Form form)
>>4. EnhancedWicketTester.clickAjaxLink("referralForm:submitButton")
>>fails with
>>*junit.framework.AssertionFailedError: component
>>'ReferralPanel$ReferralForm$2' is not type:Link*
>>This makes sense because AjaxSubmitLink class is not a subclass of
>>Link.
>>
>> So, how do I test AjaxSubmitLink#onSubmit(AjaxRequestTarget target, Form
>> form) method?
>>
>> Thanks,
>>
>> Alec
>>
>> @L
>>
>>
>> On Sun, Dec 27, 2009 at 9:44 AM, Alec Swan  wrote:
>>
>>> I have a page with a form and AjaxSubmitLink in the form.
>>>
>>> I call WicketTester#clickLink(pathToLink, true) to test the code in
>>> AjaxSubmitLink#onSubmit(). The call returns with no errors, but
>>> AjaxSubmitLink#onSubmit() is never called.
>>>
>>> Here is a code sample:
>>>
>>> tester.startPanel(MyPanel.class);
>>> final FormTester formTester = tester.newFormTester(FORM_PATH);
>>>
>>> // Test: Submit form with valid inputs
>>> formTester.setValue("company", "company");
>>> formTester.setValue("phone", "phone");
>>> *tester.clickLink(SUBMIT_LINK_PATH, true);*
>>>
>>> Thanks,
>>>
>>> Alec
>>>
>>>
>>>
>>>
>>>
>>
>


How to implement tabs without using panels?

2010-06-13 Thread Alec Swan
Hello,

I am working with a web designer who delivers a single HTML page which
should display a panel with arbitrary number of tabs. In the HTML the
tabbed panel consists of a  list of links and the content of the
first tab. The content for the remaining tabs is loaded from the
database at runtime.

I know how to implement tabbing using tab swapping or TabbedPanel.
However, both of these approaches require a separate panel object and
markup for the tabs. Instead, I would like to be able to use the HTML
page I received from the designer unmodified.

Is there a way to create a WebMarkupContainerWithAssociatedMarkup
object which is mapped to a specific element on the page markup? If
so, can I implement tabbing by swapping such objects when tabs are
clicked?

Any ideas would be appreciated.

Thanks

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



Re: How to implement tabs without using panels?

2010-06-13 Thread Alec Swan
Hello,

If I understood your suggestion correctly it involves to markup files:
one - for the content area and another one - for the tab content.
However, I would like to use a single markup file for the entire page.

Did I understand your solution correctly?

Thanks

On Sun, Jun 13, 2010 at 8:04 PM, Jeremy Thomerson
 wrote:
> On Sun, Jun 13, 2010 at 8:54 PM, Alec Swan  wrote:
>
>> Hello,
>>
>> I am working with a web designer who delivers a single HTML page which
>> should display a panel with arbitrary number of tabs. In the HTML the
>> tabbed panel consists of a  list of links and the content of the
>> first tab. The content for the remaining tabs is loaded from the
>> database at runtime.
>>
>> I know how to implement tabbing using tab swapping or TabbedPanel.
>> However, both of these approaches require a separate panel object and
>> markup for the tabs. Instead, I would like to be able to use the HTML
>> page I received from the designer unmodified.
>>
>> Is there a way to create a WebMarkupContainerWithAssociatedMarkup
>> object which is mapped to a specific element on the page markup? If
>> so, can I implement tabbing by swapping such objects when tabs are
>> clicked?
>>
>> Any ideas would be appreciated.
>>
>> Thanks
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
> Just make the content area a panel, add links to each of the tabs, and in
> the onClick, call replace(...) with the panel that contains the content for
> that tab.  This will make each content area (for each tab) into a panel, but
> you will not have to modify the markup of the tabs themselves.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>

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



Re: How to implement tabs without using panels?

2010-06-13 Thread Alec Swan
I wonder if I can use Wicket fragments for this. My page markup will
contain a single fragment for the tab content. At runtime I will
create multiple Fragment objects - one for each tab, each of which
will be mapped to the same fragment section in the markup file. After
this I can just swap tab fragments when tabs are selected.

I am not sure if it's legal to create multiple Fragment objects that
use the same fragment markup. Any thoughts?

Thanks

On Sun, Jun 13, 2010 at 11:02 PM, Alec Swan  wrote:
> Hello,
>
> If I understood your suggestion correctly it involves to markup files:
> one - for the content area and another one - for the tab content.
> However, I would like to use a single markup file for the entire page.
>
> Did I understand your solution correctly?
>
> Thanks
>
> On Sun, Jun 13, 2010 at 8:04 PM, Jeremy Thomerson
>  wrote:
>> On Sun, Jun 13, 2010 at 8:54 PM, Alec Swan  wrote:
>>
>>> Hello,
>>>
>>> I am working with a web designer who delivers a single HTML page which
>>> should display a panel with arbitrary number of tabs. In the HTML the
>>> tabbed panel consists of a  list of links and the content of the
>>> first tab. The content for the remaining tabs is loaded from the
>>> database at runtime.
>>>
>>> I know how to implement tabbing using tab swapping or TabbedPanel.
>>> However, both of these approaches require a separate panel object and
>>> markup for the tabs. Instead, I would like to be able to use the HTML
>>> page I received from the designer unmodified.
>>>
>>> Is there a way to create a WebMarkupContainerWithAssociatedMarkup
>>> object which is mapped to a specific element on the page markup? If
>>> so, can I implement tabbing by swapping such objects when tabs are
>>> clicked?
>>>
>>> Any ideas would be appreciated.
>>>
>>> Thanks
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>> Just make the content area a panel, add links to each of the tabs, and in
>> the onClick, call replace(...) with the panel that contains the content for
>> that tab.  This will make each content area (for each tab) into a panel, but
>> you will not have to modify the markup of the tabs themselves.
>>
>> --
>> Jeremy Thomerson
>> http://www.wickettraining.com
>>
>

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



Re: How to implement tabs without using panels?

2010-06-14 Thread Alec Swan
Pedro, I agree that ITab.getPanel() could just return Component type.

Jeremy and Igor, the goal of the project is to automatically generate
tabs given tab markup template and a database which provides content
for all tabs. Note that the number of tabs can vary depending on the
database state.

It seems to me that automating this by switching tab components in
Wicket is easier than using JavaScript because in Wicket we have
direct access to the database and can decide right then how many tabs
need to be created.

I am planning to try creating and swapping multiple Fragment objects
mapped to the same fragment markup (wicket:id="tabTemplateFragment").
Please let me know if there is a reason not to do this.

Thanks

On Mon, Jun 14, 2010 at 8:26 AM, Pedro Santos  wrote:
> Hi Alec, you can create an wrapper panel, that receive as parameter an
> component, in your case an fragment, to use in your tabbed panel. Actually I
> think that will to be more natural if the ITab interface had an getTab
> method, that return an Component object instead of the getPanel one, since
> there is no good reason to force users to have the tab content implemented
> as an Panel. If some one else think this way, I can open on request for.
> I know that the component name is TabbedPANEL, which implies that it work
> with panels... So it can to be an reason to create another component?
> TabbedContents?
>
> Ex:
> public WrapperPanel extends Panel{
>  public static String WICKET_ID_FOR_WRAPPED_COM ="component";
>  public WrapperPanel (wrappedComponent){
>     add(wrappedComponent);
>  }
> }
>
> On Mon, Jun 14, 2010 at 2:14 AM, Alec Swan  wrote:
>
>> I wonder if I can use Wicket fragments for this. My page markup will
>> contain a single fragment for the tab content. At runtime I will
>> create multiple Fragment objects - one for each tab, each of which
>> will be mapped to the same fragment section in the markup file. After
>> this I can just swap tab fragments when tabs are selected.
>>
>> I am not sure if it's legal to create multiple Fragment objects that
>> use the same fragment markup. Any thoughts?
>>
>> Thanks
>>
>> On Sun, Jun 13, 2010 at 11:02 PM, Alec Swan  wrote:
>> > Hello,
>> >
>> > If I understood your suggestion correctly it involves to markup files:
>> > one - for the content area and another one - for the tab content.
>> > However, I would like to use a single markup file for the entire page.
>> >
>> > Did I understand your solution correctly?
>> >
>> > Thanks
>> >
>> > On Sun, Jun 13, 2010 at 8:04 PM, Jeremy Thomerson
>> >  wrote:
>> >> On Sun, Jun 13, 2010 at 8:54 PM, Alec Swan  wrote:
>> >>
>> >>> Hello,
>> >>>
>> >>> I am working with a web designer who delivers a single HTML page which
>> >>> should display a panel with arbitrary number of tabs. In the HTML the
>> >>> tabbed panel consists of a  list of links and the content of the
>> >>> first tab. The content for the remaining tabs is loaded from the
>> >>> database at runtime.
>> >>>
>> >>> I know how to implement tabbing using tab swapping or TabbedPanel.
>> >>> However, both of these approaches require a separate panel object and
>> >>> markup for the tabs. Instead, I would like to be able to use the HTML
>> >>> page I received from the designer unmodified.
>> >>>
>> >>> Is there a way to create a WebMarkupContainerWithAssociatedMarkup
>> >>> object which is mapped to a specific element on the page markup? If
>> >>> so, can I implement tabbing by swapping such objects when tabs are
>> >>> clicked?
>> >>>
>> >>> Any ideas would be appreciated.
>> >>>
>> >>> Thanks
>> >>>
>> >>> -
>> >>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> >>> For additional commands, e-mail: users-h...@wicket.apache.org
>> >>>
>> >>>
>> >> Just make the content area a panel, add links to each of the tabs, and
>> in
>> >> the onClick, call replace(...) with the panel that contains the content
>> for
>> >> that tab.  This will make each content area (for each tab) into a panel,
>> but
>> >> you will not have to modify the markup of the tabs themselves.
>> >>
>> >> --
>> >> Jeremy Thomerson
>> >> http://www.wickettraining.com
>> >>
>> >
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>

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



Re: How to implement tabs without using panels?

2010-06-14 Thread Alec Swan
Pedro, could you clarify your last message?

I also came across wicket:container. I don't think it is possible to
swap container components at runtime because they don't have HTML ids
and hence cannot be reference via AJAX. Is that right?

Thanks

On Mon, Jun 14, 2010 at 10:11 AM, Pedro Santos  wrote:
> "I am working with a web designer who delivers a single HTML page which
> should display a panel with  tabs."
> Simply use javascript
>
> With "arbitrary number of", " loaded from the database at runtime"
> Is preferable to implement an component at server side with the tabs
> assemble and presentation rules.
>
> On Mon, Jun 14, 2010 at 12:16 PM, Igor Vaynberg 
> wrote:
>
>> you can simply use javascript tabs. all js frameworks provide them.
>>
>> -igor
>>
>> On Sun, Jun 13, 2010 at 6:54 PM, Alec Swan  wrote:
>> > Hello,
>> >
>> > I am working with a web designer who delivers a single HTML page which
>> > should display a panel with arbitrary number of tabs. In the HTML the
>> > tabbed panel consists of a  list of links and the content of the
>> > first tab. The content for the remaining tabs is loaded from the
>> > database at runtime.
>> >
>> > I know how to implement tabbing using tab swapping or TabbedPanel.
>> > However, both of these approaches require a separate panel object and
>> > markup for the tabs. Instead, I would like to be able to use the HTML
>> > page I received from the designer unmodified.
>> >
>> > Is there a way to create a WebMarkupContainerWithAssociatedMarkup
>> > object which is mapped to a specific element on the page markup? If
>> > so, can I implement tabbing by swapping such objects when tabs are
>> > clicked?
>> >
>> > Any ideas would be appreciated.
>> >
>> > 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
>>
>>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>

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



Re: How to implement tabs without using panels?

2010-06-14 Thread Alec Swan
Hello Pedro,

I am not sure what you mean by "wrapped panels", but I am planning to
have a l list and single fragment with wicket:id="tabTemplate"
on my page.

When the user accesses the page the first time, the Page code will
populate the list and display the first tab with the content pulled
from the database. The code will also keep a reference to that
fragment object.

When the user selects a different tab, the code will create a new
fragment and will swap it with the one from the previous step.

The two issues that I am concerned about are:
1. Is it OK to create multiple Fragment objects for the same markup fragment?
2. Is it possible to nest Fragments so that I can support multiple
levels of tabs?

Thanks,

Alec

On Mon, Jun 14, 2010 at 11:17 AM, Pedro Santos  wrote:
> wicket:container are meant to don't output invalid markup when using
> repeaters. You can use AjaxTabbedPanel to implement your tabbed panel, and
> ITab for the complexity of swap your tabs contents...
> In my last mail I said that is preferably to have you logic that use
> database info to assemble your tabbed panel in an Wicket component, rather
> than in javascript.
>
> About create an new component TabbedContents, I exaggerated. There is no
> good reason to create an new type and api for that. If the component initial
> component design don't solve all user cases, we can always write
> customizations. Do you considered to use an wrapper panels for your
> fragments, your write panels for them?
>
> On Mon, Jun 14, 2010 at 1:39 PM, Alec Swan  wrote:
>
>> Pedro, could you clarify your last message?
>>
>> I also came across wicket:container. I don't think it is possible to
>> swap container components at runtime because they don't have HTML ids
>> and hence cannot be reference via AJAX. Is that right?
>>
>> Thanks
>>
>> On Mon, Jun 14, 2010 at 10:11 AM, Pedro Santos 
>> wrote:
>> > "I am working with a web designer who delivers a single HTML page which
>> > should display a panel with  tabs."
>> > Simply use javascript
>> >
>> > With "arbitrary number of", " loaded from the database at runtime"
>> > Is preferable to implement an component at server side with the tabs
>> > assemble and presentation rules.
>> >
>> > On Mon, Jun 14, 2010 at 12:16 PM, Igor Vaynberg > >wrote:
>> >
>> >> you can simply use javascript tabs. all js frameworks provide them.
>> >>
>> >> -igor
>> >>
>> >> On Sun, Jun 13, 2010 at 6:54 PM, Alec Swan  wrote:
>> >> > Hello,
>> >> >
>> >> > I am working with a web designer who delivers a single HTML page which
>> >> > should display a panel with arbitrary number of tabs. In the HTML the
>> >> > tabbed panel consists of a  list of links and the content of the
>> >> > first tab. The content for the remaining tabs is loaded from the
>> >> > database at runtime.
>> >> >
>> >> > I know how to implement tabbing using tab swapping or TabbedPanel.
>> >> > However, both of these approaches require a separate panel object and
>> >> > markup for the tabs. Instead, I would like to be able to use the HTML
>> >> > page I received from the designer unmodified.
>> >> >
>> >> > Is there a way to create a WebMarkupContainerWithAssociatedMarkup
>> >> > object which is mapped to a specific element on the page markup? If
>> >> > so, can I implement tabbing by swapping such objects when tabs are
>> >> > clicked?
>> >> >
>> >> > Any ideas would be appreciated.
>> >> >
>> >> > 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
>> >>
>> >>
>> >
>> >
>> > --
>> > Pedro Henrique Oliveira dos Santos
>> >
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>

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



Confirmation dialog during file upload

2010-06-17 Thread Alec Swan
Hello,

I have a form which allows a user to upload a file. The form is
patterned after upload Wicket example.

If the file being uploaded will overwrite an existing file I need to
prompt the user if they want to replace the existing file or not.
What's the best way to implement this functionality?

Thanks

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



Re: Confirmation dialog during file upload

2010-06-18 Thread Alec Swan
Hello,

If I understand your approach correctly, then the user would have to
click Upload button again after being redirected MyPage to
ConfirmSavePage, which is not desirable.

I would like to implement the following interaction:

1. User clicks Upload button and form submission request is sent to the server
2. The code on the server detect the file name collision and causes a
ModalWindow to display
3.1 If the user clicks Confirm button then upload form submission is resumed.
3.2 If the user clicks Cancel button then upload form submission is canceled.

What's the best way to implement this interaction? Can I use a request
intercepting page to display the ModalWindow?

Thanks

On Fri, Jun 18, 2010 at 3:42 AM, Kent Tong  wrote:
> Sorry, there is a bug in the code: You should never keep a FileUpload
> object across requests. So, you need to copy the data into somewhere else.
>
>
> -
> 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



  1   2   3   4   >