Re: Issue with AjaxLinks in ListView

2009-07-31 Thread Kuga

Hi,
Thank you for your response,
here is the ListView code:
private final class SubMenuListView extends ListView {
private static final long serialVersionUID = 0L;

private int selectedIndex = 0;

private SubMenuListView(final String id, final IModel model) {
super(id, model);
}

private SubMenuListView(final String id, final List list)
{
super(id, list);
}

/* (non-Javadoc)
 * @see org.apache.wicket.markup.html.list.ListView#newItem(int)
 */
@Override
protected ListItem newItem(int index) {
// TODO Auto-generated method stub
return new ListItem(index, getListItemModel(getModel(), 
index)){

/* (non-Javadoc)
 * @see
org.apache.wicket.Component#onComponentTag(org.apache.wicket.markup.ComponentTag)
 */
@Override
protected void onComponentTag(ComponentTag tag) 
{   
String cssClass = 
(String)tag.getString("class"); //$NON-NLS-1$
if (cssClass == null)
{
cssClass = " "; //$NON-NLS-1$
}   
if 
(((MenuItem)getModelObject()).isSelected())
{
cssClass = 
"menu2-selected-long"; //$NON-NLS-1$
} else{
cssClass = " "; //$NON-NLS-1$
}
tag.put("class", cssClass.trim()); 
//$NON-NLS-1$
super.onComponentTag(tag);
}

};
}

@Override
protected void populateItem(final ListItem item) {
final MenuItem menuItem = (MenuItem) item.getModelObject();
if (menuItem.isSelected()) {
if(menuLevel.equals(MenuLevel.TOP)) {
item.add(menuIsSelected); //set CSS class if the
top-level menu item is selected
}
else if(menuLevel.equals(MenuLevel.SECOND)) {
item.add(menuIsSelectedLong); //set CSS class if the
second-level menu item is selected
}
}
item.add(new MenuItemFragment(menuItem));
}

/**
 * @param selectedIndex the selectedIndex to set
 */
public void setSelectedIndex(int selectedIndex) {
this.selectedIndex = selectedIndex;
}

/**
 * @return the selectedIndex
 */
public int getSelectedIndex() {
return selectedIndex;
}
}
-- 
View this message in context: 
http://www.nabble.com/Issue-with-AjaxLinks-in-ListView-tp24765587p24766483.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



Re: Issue with AjaxLinks in ListView

2009-07-31 Thread Mischa

Can you post the listview piece of code so i can have a better look.

Verstuurd vanaf mijn iPhone

Op 1 aug 2009 om 04:56 heeft "Kugaprakash Visagamani" > het volgende geschreven:\



Hi,

I have a page that has a panel with ListView (Listview
contains AjaxLink's).



I go to that page, click on a links - does an ajax update of one  
section
in a page, and then I do a target.addComponent(listViewPanel) to  
update

the link selection background. This works fine so far.



Now I click on the second link in that listview, I am getting the  
below

exception:



org.apache.wicket.WicketRuntimeException: component
heading:menu:subMenuBar:topmenuitems: 
2:menuitemfragment:linkfragment:lin

kid not found on page
com.infoblox.nios.ui.page.datamgt.DataManagePage[id = 3], listener
interface = [RequestListenerInterface name=IBehaviorListener,
method=public abstract void
org.apache.wicket.behavior.IBehaviorListener.onRequest()]

 at
org.apache.wicket.request.AbstractRequestCycleProcessor.resolveListenerI




nterfaceTarget(AbstractRequestCycleProcessor.java:416)

 at
org.apache.wicket.request.AbstractRequestCycleProcessor.resolveRenderedP




age(AbstractRequestCycleProcessor.java:461)

 at
org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve 
(WebRequ

estCycleProcessor.java:139)

 at
com.infoblox.nios.app.NiosApplication 
$RedirectRequestCycleProcess.resolv

e(MYApplication.java:232)

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

 at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1353)

 at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)

 at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java: 
355

)



NOTE: THIS PROBLEM IS VERY INTERMITTENT, I am unable to determine the
main cause for this. However, if I re-login, everything is fine  
(atleast

was able to click on the links multiple times, and did not see any
issues).



I am using Wicket 1.3.5



Please let me know if you have any ideas, any pointers would be highly
appreciated.



Best Regards & Thanks in Advance,

Kuga



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



Issue with AjaxLinks in ListView

2009-07-31 Thread Kugaprakash Visagamani
Hi,

I have a page that has a panel with ListView (Listview
contains AjaxLink's).

 

I go to that page, click on a links - does an ajax update of one section
in a page, and then I do a target.addComponent(listViewPanel) to update
the link selection background. This works fine so far. 

 

Now I click on the second link in that listview, I am getting the below
exception:

 

org.apache.wicket.WicketRuntimeException: component
heading:menu:subMenuBar:topmenuitems:2:menuitemfragment:linkfragment:lin
kid not found on page
com.infoblox.nios.ui.page.datamgt.DataManagePage[id = 3], listener
interface = [RequestListenerInterface name=IBehaviorListener,
method=public abstract void
org.apache.wicket.behavior.IBehaviorListener.onRequest()]

  at
org.apache.wicket.request.AbstractRequestCycleProcessor.resolveListenerI
nterfaceTarget(AbstractRequestCycleProcessor.java:416)

  at
org.apache.wicket.request.AbstractRequestCycleProcessor.resolveRenderedP
age(AbstractRequestCycleProcessor.java:461)

  at
org.apache.wicket.protocol.http.WebRequestCycleProcessor.resolve(WebRequ
estCycleProcessor.java:139)

  at
com.infoblox.nios.app.NiosApplication$RedirectRequestCycleProcess.resolv
e(MYApplication.java:232)

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

  at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1353)

  at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)

  at
org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:355
)

 

NOTE: THIS PROBLEM IS VERY INTERMITTENT, I am unable to determine the
main cause for this. However, if I re-login, everything is fine (atleast
was able to click on the links multiple times, and did not see any
issues).

 

I am using Wicket 1.3.5

 

Please let me know if you have any ideas, any pointers would be highly
appreciated.

 

Best Regards & Thanks in Advance,

Kuga



Re: Apache Wicket 1.4 takes type safety to the next level

2009-07-31 Thread Jeremy Thomerson
Thanks - they were updated - but the link wasn't updated.  I will move
them to that folder to match the link since that is more appropriate
than having both anyway.  It will take an hour or two to sync.

--
Jeremy Thomerson
http://www.wickettraining.com




On Fri, Jul 31, 2009 at 4:17 PM, Eric Gulatee wrote:
> Congrats to all that contributed.
>
> A comment:  The 1.4 Javadocs on the wicket site should probably be
> updated from Wicket Parent 1.4-rc2 API .
> http://wicket.apache.org/docs/1.4
>
>
> On Fri, Jul 31, 2009 at 11:09 AM, Jeremy
> Thomerson wrote:
>> Trying to write all of the announcements and make sure all the
>> documentation on the site is reasonably up-to-date is also a critical
>> part of any release.  And it takes a long time.  We were all
>> scrambling to try to get it done.
>>
>> --
>> Jeremy Thomerson
>> http://www.wickettraining.com
>>
>>
>>
>>
>> On Fri, Jul 31, 2009 at 8:55 AM, Craig
>> McIlwee wrote:
>>> I heard someone saying here a few weeks ago that the 1.4.0 build had been 
>>> finalized and that the official release was waiting on some PR stuff.  Just 
>>> curious what that was?
>>>
>>> -Original Message-
>>> From: martijn.dasho...@gmail.com [mailto:martijn.dasho...@gmail.com] On 
>>> Behalf Of Martijn Dashorst
>>> Sent: Thursday, July 30, 2009 6:54 AM
>>> To: 
>>> annou...@wicket.apache.org;annou...@apache.org;users@wicket.apache.org;d...@wicket.apache.org
>>> Subject: Apache Wicket 1.4 takes type safety to the next level
>>>
>>> The Apache Wicket project is proud to announce the release of Apache
>>> Wicket 1.4. Apache Wicket is an open source, component oriented Java
>>> web application framework. With overwhelming support from the user
>>> community, this release marks a departure from the past where we leave
>>> Java 1.4 behind and we require Java 5 as the minimum JDK version. By
>>> moving to Java 5 as the required minimum platform, we were able to
>>> utilize Java 5 idioms and increase the type safety of our APIs. Using
>>> Java generics you can now write typesafe web applications and create
>>> typesafe, self documenting, reusable custom components.
>>>
>>> The full announcement for this release can be found here:
>>> http://wicket.apache.org/apache-wicket-14-takes-type-safety-to-the-next-level.html
>>>
>>> Download Apache Wicket 1.4
>>>
>>> You can download the release here:
>>> http://www.apache.org/dyn/closer.cgi/wicket/1.4.0
>>>
>>> Or use this in your Maven pom's to upgrade to the new version:
>>>
>>> 
>>>    org.apache.wicket
>>>    wicket
>>>    1.4.0
>>> 
>>>
>>> You will need to upgrade all modules (i.e. wicket, wicket-extensions)
>>> to their 1.4 counterparts. It is not possible to mix Wicket 1.3
>>> libraries with 1.4 libraries due to API changes.
>>>
>>> Most notable changes
>>>
>>> From all the changes that went into this release, the following are
>>> the most important ones:
>>>
>>>  * Generified IModel interface and implementations increases type
>>> safety in your Wicket applications
>>>  * Component#getModel() and Component#setModel() have been renamed to
>>> getDefaultModel() and setDefaultModel() to better support generified
>>> models
>>>  * The Spring modules have been merged (wicket-spring-annot is now
>>> obsolete, all you need is wicket-spring)
>>>  * Many API's have been altered to better work with Java 5's idioms
>>>  * Wicket jars are now packaged with metadata that makes them OSGI bundles
>>>
>>> Apart from these changes, the release is mostly compatible with Wicket
>>> 1.3 and upgrading shouldn't take too long. Early adopters report about
>>> a days work to upgrade medium to large applications to Wicket 1.4.
>>> Read the migration guide to learn more about the changes in our APIs.
>>> To learn more about all the improvements and new features that went
>>> into this release, check the solved issue list in our JIRA instance.
>>>
>>> If you want to learn more about this release, please refer to the full
>>> release announcement:
>>> http://wicket.apache.org/apache-wicket-14-takes-type-safety-to-the-next-level.html
>>>
>>> -
>>> To unsubscribe, e-mail: announce-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: announce-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 unsubscrib

Re: Apache Wicket 1.4 takes type safety to the next level

2009-07-31 Thread Eric Gulatee
Congrats to all that contributed.

A comment:  The 1.4 Javadocs on the wicket site should probably be
updated from Wicket Parent 1.4-rc2 API .
http://wicket.apache.org/docs/1.4


On Fri, Jul 31, 2009 at 11:09 AM, Jeremy
Thomerson wrote:
> Trying to write all of the announcements and make sure all the
> documentation on the site is reasonably up-to-date is also a critical
> part of any release.  And it takes a long time.  We were all
> scrambling to try to get it done.
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
>
> On Fri, Jul 31, 2009 at 8:55 AM, Craig
> McIlwee wrote:
>> I heard someone saying here a few weeks ago that the 1.4.0 build had been 
>> finalized and that the official release was waiting on some PR stuff.  Just 
>> curious what that was?
>>
>> -Original Message-
>> From: martijn.dasho...@gmail.com [mailto:martijn.dasho...@gmail.com] On 
>> Behalf Of Martijn Dashorst
>> Sent: Thursday, July 30, 2009 6:54 AM
>> To: 
>> annou...@wicket.apache.org;annou...@apache.org;users@wicket.apache.org;d...@wicket.apache.org
>> Subject: Apache Wicket 1.4 takes type safety to the next level
>>
>> The Apache Wicket project is proud to announce the release of Apache
>> Wicket 1.4. Apache Wicket is an open source, component oriented Java
>> web application framework. With overwhelming support from the user
>> community, this release marks a departure from the past where we leave
>> Java 1.4 behind and we require Java 5 as the minimum JDK version. By
>> moving to Java 5 as the required minimum platform, we were able to
>> utilize Java 5 idioms and increase the type safety of our APIs. Using
>> Java generics you can now write typesafe web applications and create
>> typesafe, self documenting, reusable custom components.
>>
>> The full announcement for this release can be found here:
>> http://wicket.apache.org/apache-wicket-14-takes-type-safety-to-the-next-level.html
>>
>> Download Apache Wicket 1.4
>>
>> You can download the release here:
>> http://www.apache.org/dyn/closer.cgi/wicket/1.4.0
>>
>> Or use this in your Maven pom's to upgrade to the new version:
>>
>> 
>>    org.apache.wicket
>>    wicket
>>    1.4.0
>> 
>>
>> You will need to upgrade all modules (i.e. wicket, wicket-extensions)
>> to their 1.4 counterparts. It is not possible to mix Wicket 1.3
>> libraries with 1.4 libraries due to API changes.
>>
>> Most notable changes
>>
>> From all the changes that went into this release, the following are
>> the most important ones:
>>
>>  * Generified IModel interface and implementations increases type
>> safety in your Wicket applications
>>  * Component#getModel() and Component#setModel() have been renamed to
>> getDefaultModel() and setDefaultModel() to better support generified
>> models
>>  * The Spring modules have been merged (wicket-spring-annot is now
>> obsolete, all you need is wicket-spring)
>>  * Many API's have been altered to better work with Java 5's idioms
>>  * Wicket jars are now packaged with metadata that makes them OSGI bundles
>>
>> Apart from these changes, the release is mostly compatible with Wicket
>> 1.3 and upgrading shouldn't take too long. Early adopters report about
>> a days work to upgrade medium to large applications to Wicket 1.4.
>> Read the migration guide to learn more about the changes in our APIs.
>> To learn more about all the improvements and new features that went
>> into this release, check the solved issue list in our JIRA instance.
>>
>> If you want to learn more about this release, please refer to the full
>> release announcement:
>> http://wicket.apache.org/apache-wicket-14-takes-type-safety-to-the-next-level.html
>>
>> -
>> To unsubscribe, e-mail: announce-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: announce-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



Testing RadioChoice with AjaxFormComponentUpdatingBehavior

2009-07-31 Thread development
Hi all,

I am trying to test the ajax behaviour on a RadioChoice.

The RadioChoice has an AjaxFormComponentUpdatingBehavior which show/hide a
panel depending on its model value.


final Label label = new Label("label", "label");
label.setOutputMarkupId(true);
label.setVisible(false);

RadioChoice choice = new RadioChoice("choice",
Arrays.asList(Boolean.TRUE, Boolean.FALSE));
choice.add(new AjaxFormChoiceComponentUpdatingBehavior() {
@Override
protected void onUpdate(AjaxRequestTarget target) {
RadioChoice choice = (RadioChoice)
getComponent();
choice.updateModel();
if(choice.getModelObject() == Boolean.TRUE) {
label.setVisible(true);
} else {
label.setVisible(false);
}
target.addComponent(label);
}
});

Now I can trigger the ajax behaviour by doing this:


tester.executeBehavior((AbstractAjaxBehavior)
getComponent("choice").getBehaviors().get(0));

now if I wanna check if the label component is visible I can do the
following:

tester.assertVisible("choice");

The problem is that the label isn't visible because the
respond(AjaxRequestTarget) method on
AjaxFormChoiceComponentUpdatingBehavior 
calls the getConvertedInput() method which sets the model to null.

I cannot use the formtester because I just need to check the visibility.

Does anybody know how to handle this?

Kind regards,

Mischa

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



Re: Wicket, Ajax and JSON

2009-07-31 Thread serban . balamaci
Thanks guys, loved the AbstractAjaxBehavior solution, and by the way
jqgrid seems to be more active and the way to go(thanks for pointing it
Richard). Keeping fingers crossed for wiQuery and if they even bring the
flexi or jqgrid to wicket it's gonna prove you can have awesome visual
components in Wicket too.


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



launching a modal page from a Panel

2009-07-31 Thread Elad Katz
Hi all,
I need to launch a modal from a panel.
I saw the examples
http://www.wicket-library.com/wicket-examples/ajax/modal-window but they
were very complicated for what I need and didn't show how I can launch it
from within a panel.
Let me try to explain:
I have a datatable where one of the columns is defines like this:

columns.add(new AbstractColumn(new
> Model("Edit")) {
>
> public void populateItem(Item>
> cellItem, String componentId,
> IModel model) {
> cellItem.add(new EditActionPanel(componentId, model));
> }
> });

Now the EditActionPanel is a panel that basically shows a link, and is
defined like this:

> class EditActionPanel extends Panel {
>
> /**
>  * @param id
>  *component id
>  * @param model
>  *model for contact
>  */
> public EditActionPanel(String id, IModel model) {
> super(id, model);
> add(new Link("edit") {
>
> @Override
> public void onClick() {
> selected = (LocationsEntity)
> getParent().getDefaultModelObject();
> *HERE IS WHERE I NEED TO CALL A VERY SIMPLE
> YEN/NO/CANCEL MODAL *(are you sure you want to edit? y\n\c)
> }
> });
> }
> }


Can you guys please tell me what is the line I'm missing?
I know it sounds trivial, but I've been battling this all day and i could
really use some help on this
Thanks allot in advance,
E.


Re: Stateless login form?

2009-07-31 Thread Martin Makundi
Seems funny if wicket does not have robust login page capability
out-of-the-box ;)

> If I understood correctly, you might find this interesting:
> http://day-to-day-stuff.blogspot.com/2008/10/wicket-extreme-consistent-urls.html

Does appear to make stateless-looking urls AFTER you CLICK/REDIRECT
(looking at the example page referred on the site). Not BEFORE you
CLICK...

Some other trick?

**
Martin

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



Re: Stateless login form?

2009-07-31 Thread francisco treacy
If I understood correctly, you might find this interesting:
http://day-to-day-stuff.blogspot.com/2008/10/wicket-extreme-consistent-urls.html

Francisco

2009/7/31 Martin Makundi :
>> 1 - override isStateless and return true
>
> Will the form work ok? What about retry: if there are validation
> errors, will such a stateless page work?
>
>> 2 - make it submit to a bookmarkable page and process the input from
>> the PageParameters
>
> q1: Will I have to manually hack the submit target?
> q2: Will I have to manually hack this pageparameters processing?
>
>
> **
> Martin
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: Wicket, Ajax and JSON

2009-07-31 Thread John Armstrong
Maybe someone can document a workable solution in the Wiki for future
generations?
Tx
J

On Fri, Jul 31, 2009 at 10:22 AM, francisco treacy <
francisco.tre...@gmail.com> wrote:

> That's cool.
>
> I'm still surprised to see that whenever something remotely
> ressembling stateless/REST comes up in the mailing list, the gut
> reaction is: servlets. It might be simpler for a few usecases, but
> normally you also want to take advantage of other Wicket features -
> precisely the reason why Serban insists with the Ajax behaviour.
>
> If it is feasible already, what I really would like is to have better
> support for doing REST. Of course you don't want to "drive screw into
> a board with a hammer" but for many cases simple stateless suffices,
> where Jersey would be an overkill and servlets out of the picture.
> Those usecases include sites where you want to expose some
> functionality as stateless (including Ajax) and the rest are heavily
> interactive pages (like an admin or wizards) where Wicket excels.
>
> I just recall the interest there was when the creator of
> http://www.fitcomplex.sk/ mentioned what he was doing with jQuery.
>
> Just a general feeling I'm expressing here.
>
> Thanks,
>
> Francisco
>
>
>
> 2009/7/31 richardwilko :
> >
> > Hi,
> >
> > Instead of using AbstractDefaultAjaxBehavior you can use its superclass
> > AbstractAjaxBehavior as follows:
> >
> >AbstractAjaxBehavior behaviour = new AbstractAjaxBehavior()
> >{
> >private static final long serialVersionUID = 1L;
> >
> >@SuppressWarnings("unchecked")
> >public void onRequest()
> >{
> >//get parameters
> >final RequestCycle requestCycle = RequestCycle.get();
> >
> >final PageParameters pageParameters = new
> > PageParameters(requestCycle.getRequest().getParameterMap());
> >
> >//do something using nice json library to produce a string
> > of json
> >String json = ...
> >
> >
> >requestCycle.setRequestTarget(new
> > StringRequestTarget("application/json", "utf-8", data));
> >}
> >
> >};
> >add(behaviour);
> >
> > I can't see anything wrong with the servlet example, but this has the
> > advantage of being in a Wicket component, so you can easily access your
> > Wicket session, and the user wont have to remember to map extra servlets.
> >
> > I have also tried making a component out of flexigrid, but ran into
> issues
> > (which they may have fixed now), for example, I was getting rendering
> issues
> > in the grid when trying to resize the columns.
> >
> > I then moved onto another jQuery grid called jqGrid
> > (http://www.trirand.com/blog/) which I felt had more features and was
> more
> > robust.
> >
> > At jWeekend (http://www.jweekend.com) have almost completed the Wicket
> > mapping of this grid and we hope to release this in the future when we
> are
> > satisfied with our testing and API.  This will be released as a plugin to
> > the wiQuery project (http://code.google.com/p/wiquery/), which basically
> > means it will depend on wiQuery.
> >
> >
> > Regards - Richard Wilkinson
> > Developer
> > jWeekend: OO & Java Technologies - Development and Training
> > http://jWeekend.com
> >
> >
> >
> >
> >
> >
> > Serban Balamaci wrote:
> >>
> >> Hello. I'm trying to create a wicket component out of FlexiGrid
> >> http://www.flexigrid.info/ .
> >>
> >> The javascript for the component requires an address from which it will
> >> receive data in the form of a JSON response.
> >>
> >>
> >>
> >> I'm not sure what is the best way to go about it. Simple and most ugly
> >> approach would be to have something of a "Controller Page"
> >>
> >> a page that takes parameters such as the entity that is being retrieved
> >> and
> >> also paging info, sort order, etc and returns the JSON response.
> >>
> >> I do not like this aproach as, most obvious reason is that it would not
> be
> >> obvious from the component what you need to do in order to get it to
> work.
> >>
> >>
> >>
> >> I would much more preffer to having a callback method that returns the
> >> json.
> >> So I have created a
> >>
> >>
> >>
> >> AbstractDefaultAjaxBehavior clientConnectBehavior = new
> >> AbstractDefaultAjaxBehavior() {
> >>
> >>
> >>
> >> protected void respond(AjaxRequestTarget ajaxRequestTarget)
> {
> >>
> >>ajaxRequestTarget.prependJavascript("{page: 1, total:
> >> 239
> >> }");
> >>
> >>
> >>
> >> }
> >>
> >> and used clientConnectBehavior.getCallbackUrl() as the url passed to the
> >> flexigrid.
> >>
> >>
> >>
> >> Unfortunately the problem is the response when invoked is wrapped in a
> >> 
> >>
> >> 
> >>
> >> 
> >>
> >>
> >>
> >> So my question is how to get only the JSON part without the  >> version.>,
> >>  . and  decoration. Can it be bypassed? Shoul I
> >> override something in AbstractDefaultAjaxBehavior?
> >>
> >> Or any other ideea to g

Re: Wicket, Ajax and JSON

2009-07-31 Thread francisco treacy
That's cool.

I'm still surprised to see that whenever something remotely
ressembling stateless/REST comes up in the mailing list, the gut
reaction is: servlets. It might be simpler for a few usecases, but
normally you also want to take advantage of other Wicket features -
precisely the reason why Serban insists with the Ajax behaviour.

If it is feasible already, what I really would like is to have better
support for doing REST. Of course you don't want to "drive screw into
a board with a hammer" but for many cases simple stateless suffices,
where Jersey would be an overkill and servlets out of the picture.
Those usecases include sites where you want to expose some
functionality as stateless (including Ajax) and the rest are heavily
interactive pages (like an admin or wizards) where Wicket excels.

I just recall the interest there was when the creator of
http://www.fitcomplex.sk/ mentioned what he was doing with jQuery.

Just a general feeling I'm expressing here.

Thanks,

Francisco



2009/7/31 richardwilko :
>
> Hi,
>
> Instead of using AbstractDefaultAjaxBehavior you can use its superclass
> AbstractAjaxBehavior as follows:
>
>        AbstractAjaxBehavior behaviour = new AbstractAjaxBehavior()
>        {
>            private static final long serialVersionUID = 1L;
>
>           �...@suppresswarnings("unchecked")
>            public void onRequest()
>            {
>                //get parameters
>                final RequestCycle requestCycle = RequestCycle.get();
>
>                final PageParameters pageParameters = new
> PageParameters(requestCycle.getRequest().getParameterMap());
>
>                //do something using nice json library to produce a string
> of json
>                String json = ...
>
>
>                requestCycle.setRequestTarget(new
> StringRequestTarget("application/json", "utf-8", data));
>            }
>
>        };
>        add(behaviour);
>
> I can't see anything wrong with the servlet example, but this has the
> advantage of being in a Wicket component, so you can easily access your
> Wicket session, and the user wont have to remember to map extra servlets.
>
> I have also tried making a component out of flexigrid, but ran into issues
> (which they may have fixed now), for example, I was getting rendering issues
> in the grid when trying to resize the columns.
>
> I then moved onto another jQuery grid called jqGrid
> (http://www.trirand.com/blog/) which I felt had more features and was more
> robust.
>
> At jWeekend (http://www.jweekend.com) have almost completed the Wicket
> mapping of this grid and we hope to release this in the future when we are
> satisfied with our testing and API.  This will be released as a plugin to
> the wiQuery project (http://code.google.com/p/wiquery/), which basically
> means it will depend on wiQuery.
>
>
> Regards - Richard Wilkinson
> Developer
> jWeekend: OO & Java Technologies - Development and Training
> http://jWeekend.com
>
>
>
>
>
>
> Serban Balamaci wrote:
>>
>> Hello. I'm trying to create a wicket component out of FlexiGrid
>> http://www.flexigrid.info/ .
>>
>> The javascript for the component requires an address from which it will
>> receive data in the form of a JSON response.
>>
>>
>>
>> I'm not sure what is the best way to go about it. Simple and most ugly
>> approach would be to have something of a "Controller Page"
>>
>> a page that takes parameters such as the entity that is being retrieved
>> and
>> also paging info, sort order, etc and returns the JSON response.
>>
>> I do not like this aproach as, most obvious reason is that it would not be
>> obvious from the component what you need to do in order to get it to work.
>>
>>
>>
>> I would much more preffer to having a callback method that returns the
>> json.
>> So I have created a
>>
>>
>>
>> AbstractDefaultAjaxBehavior clientConnectBehavior = new
>> AbstractDefaultAjaxBehavior() {
>>
>>
>>
>>             protected void respond(AjaxRequestTarget ajaxRequestTarget) {
>>
>>                    ajaxRequestTarget.prependJavascript("{page: 1, total:
>> 239
>> }");
>>
>>
>>
>>             }
>>
>> and used clientConnectBehavior.getCallbackUrl() as the url passed to the
>> flexigrid.
>>
>>
>>
>> Unfortunately the problem is the response when invoked is wrapped in a
>> 
>>
>> 
>>
>> 
>>
>>
>>
>> So my question is how to get only the JSON part without the > version.>,
>>  . and  decoration. Can it be bypassed? Shoul I
>> override something in AbstractDefaultAjaxBehavior?
>>
>> Or any other ideea to go about the problem.
>>
>>
>>
>> Thank you,
>>
>>
>>
>> Serban
>>
>>
>>
>
>
> -
> http://richard-wilkinson.co.uk My blog: http://richard-wilkinson.co.uk
> --
> View this message in context: 
> http://www.nabble.com/Wicket%2C-Ajax-and-JSON-tp24756591p24757846.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For addi

Job Oportunity

2009-07-31 Thread Ryan McKinley
I am building a search engine for geographic data -- see http://voyagergis.com/ 
  -- and would love some help from a good wicketeer.


If interested, please contact me directly ryan...@gmail.com or skype:  
ryantxu


Ideally someone who could get to/from Washington DC without much  
hassle, but we are flexible.


Thanks!
Ryan

(ps, is there a more appropriate place to post job opportunities?)

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



Re: Components and nullable data

2009-07-31 Thread Igor Vaynberg
instead of creating a lot of subclasses you can use the
iauthorizationstrategy to do this:

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

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

-igor

On Fri, Jul 31, 2009 at 6:39 AM, Iain
Reddick wrote:
> Thanks for the reply - I think I'm perhaps trying to bend the framework
> rather than work with it.
>
> I suppose I'm really wondering about the following kind of thing, and
> whether it's worth trying to build similar re-usable components:
>
> public class NullableLabel extends Label {
>  private boolean visibleWhenNull = true;
>  ...
>  public boolean isVisible() {
>   if ( getModelObject() != null ) {
>     return true;
>   } else {
>     return visibleWhenNull;
>   }
>  }
>
>  public void setVisibleWhenNull(...) {
>   ...
>  }
> }
> This adds simple, configurable null-aware behaviour to a label.
>
> Is this kind of thinking worth pursuing?
>
>>
>> add(new Link("editgroup", user) {
>>  onclick() {
>>  ...
>>  }
>>
>>  isvisible() {
>>  return user.getgroup()!=null;
>>  }
>> }
>>
>> ?
>>
>> -igor
>>
>> 2009/7/30 Iain Reddick :
>
>> > Hi all,
>> >
>> > One of the difficulties I am finding with wicket is the best practice
>> > when
>> > displaying/using data that is potentially null.
>> >
>> > Example:
>> >
>> > I have a "user" object which has a nullable "group" property. I want to
>> > show
>> > a link to the group details page when the "group" property is not null,
>> > but
>> > show nothing otherwise (let's keep this simple).
>> >
>> > My issue is that either way, I have to construct the link component and
>> > add
>> > it to the page, whether I want it is visible or not. This is tricky at
>> > the
>> > best of times, as I must always carry out a lot of  "is null" logic.
>> >
>> > The construction issue becomes multiplied if I want the same behaviour
>> > on a
>> > stateful page (i.e. the link, etc. can be appropriate for linking to the
>> > group, or be null and not visible and can switch between the two
>> > states).
>> >
>> > My question is - am I missing something, or do I just need to have a
>> > better
>> > strategy for this type of situation?
>> >
>> > If the answer is the latter, does anyone have any tips and/or components
>> > that would cut down on the extra coding?
>> >
>> > Thanks
>> >
>> > -
>> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> > For additional commands, e-mail: users-h...@wicket.apache.org
>> >
>> >
>>
>
> -
> 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: Custom URL mapping (wild cards)

2009-07-31 Thread Igor Vaynberg
see org.apache.wicket.request.target.coding.IndexedParamUrlCodingStrategy,
its exactly what you want.

-igor

On Fri, Jul 31, 2009 at 2:21 AM, Andrew Easter wrote:
> Hi everyone,
>
> I've got a interesting requirement and, being only a complete newbie to
> Wicket, I'm not 100% sure I can achieve it. Basically, assume you have the
> following URL to display a product:
>
> app/products/1234
>
> I know I can use bookmarkable links and URL mounting in Wicket to allow such
> "pretty" URLs. However, something that is extremely common on the Web these
> days is including additional path information in a URL that further
> identifies the contents of the page - mainly for search engine
> optimization/marketing reasons.
>
> For example, the product with code 1234 might be the book "Wicket in
> Action". So what I'd really want is for the following URL to work:
>
> app/products/1234/Wicket-in-Action.html
>
> Now, what you'll find in most cases is that the web application completely
> ignores the URL after the product code so, even if I navigated to
> app/products/1234/blah-blah-blah.html, it would still be the correct product
> page for the Wicket in Action book.
>
> So, my question is, does this requirement sound like something that would be
> easily possible in Wicket (maybe with some custom URL mounting strategy)?
>
> I can easily do something like this with the REST support in Spring MVC 3.0
> because I can simply map a Spring MVC Controller to a URL using wildcarding.
> With the annotation support in Spring MVC, I can do something like this:
>
> @RequestMapping( value = "/products/{productId}/*", method =
> RequestMethod.GET )
> public ModelAndView getProduct( @PathVariable( value = "productId" ) String
> productId) { ... }
>
> What this example shows is that the0 method getProduct() will be invoked
> with any URL that starts with /products/[productId]. So it doesn't matter if
> the invoker has added additional path information, it will just be ignored.
>
> I'd be keen to understand a bit more about URL mounting and whether I could
> achieve something similar to this with Wicket. Maybe if there was some kind
> of wildcarding strategy? It is also important that I can build bookmarkable
> links in Wicket pages that could include the additional path information.
>
> Thanks for any help you can give me,
>
> Andrew
>

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



Re: Stateless login form?

2009-07-31 Thread Martin Makundi
> 1 - override isStateless and return true

Will the form work ok? What about retry: if there are validation
errors, will such a stateless page work?

> 2 - make it submit to a bookmarkable page and process the input from
> the PageParameters

q1: Will I have to manually hack the submit target?
q2: Will I have to manually hack this pageparameters processing?


**
Martin

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



Re: Wicket, Ajax and JSON

2009-07-31 Thread richardwilko

Hi,

Instead of using AbstractDefaultAjaxBehavior you can use its superclass
AbstractAjaxBehavior as follows:

AbstractAjaxBehavior behaviour = new AbstractAjaxBehavior()
{
private static final long serialVersionUID = 1L;

@SuppressWarnings("unchecked")
public void onRequest()
{
//get parameters
final RequestCycle requestCycle = RequestCycle.get();

final PageParameters pageParameters = new
PageParameters(requestCycle.getRequest().getParameterMap());
   
//do something using nice json library to produce a string
of json
String json = ...
   
   
requestCycle.setRequestTarget(new
StringRequestTarget("application/json", "utf-8", data));
}

};
add(behaviour);

I can't see anything wrong with the servlet example, but this has the
advantage of being in a Wicket component, so you can easily access your
Wicket session, and the user wont have to remember to map extra servlets.

I have also tried making a component out of flexigrid, but ran into issues
(which they may have fixed now), for example, I was getting rendering issues
in the grid when trying to resize the columns.

I then moved onto another jQuery grid called jqGrid
(http://www.trirand.com/blog/) which I felt had more features and was more
robust.

At jWeekend (http://www.jweekend.com) have almost completed the Wicket
mapping of this grid and we hope to release this in the future when we are
satisfied with our testing and API.  This will be released as a plugin to
the wiQuery project (http://code.google.com/p/wiquery/), which basically
means it will depend on wiQuery.


Regards - Richard Wilkinson
Developer
jWeekend: OO & Java Technologies - Development and Training
http://jWeekend.com






Serban Balamaci wrote:
> 
> Hello. I'm trying to create a wicket component out of FlexiGrid
> http://www.flexigrid.info/ .
> 
> The javascript for the component requires an address from which it will
> receive data in the form of a JSON response.
> 
>  
> 
> I'm not sure what is the best way to go about it. Simple and most ugly
> approach would be to have something of a "Controller Page"
> 
> a page that takes parameters such as the entity that is being retrieved
> and
> also paging info, sort order, etc and returns the JSON response.
> 
> I do not like this aproach as, most obvious reason is that it would not be
> obvious from the component what you need to do in order to get it to work.
> 
>  
> 
> I would much more preffer to having a callback method that returns the
> json.
> So I have created a
> 
>  
> 
> AbstractDefaultAjaxBehavior clientConnectBehavior = new
> AbstractDefaultAjaxBehavior() {
> 
>  
> 
> protected void respond(AjaxRequestTarget ajaxRequestTarget) {
> 
>ajaxRequestTarget.prependJavascript("{page: 1, total:
> 239
> }");
> 
>  
> 
> }
> 
> and used clientConnectBehavior.getCallbackUrl() as the url passed to the
> flexigrid.
> 
>  
> 
> Unfortunately the problem is the response when invoked is wrapped in a
> 
> 
> 
> 
> 
> 
>  
> 
> So my question is how to get only the JSON part without the  version.>,
>  . and  decoration. Can it be bypassed? Shoul I
> override something in AbstractDefaultAjaxBehavior? 
> 
> Or any other ideea to go about the problem.
> 
>  
> 
> Thank you,
> 
>  
> 
> Serban
> 
> 
> 


-
http://richard-wilkinson.co.uk My blog: http://richard-wilkinson.co.uk 
-- 
View this message in context: 
http://www.nabble.com/Wicket%2C-Ajax-and-JSON-tp24756591p24757846.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



Re: update quickstart page

2009-07-31 Thread Jeremy Thomerson
If it ain't baroque, don't fix it?

I think it just comes down to the fact that we haven't had time to
switch and test that everything still works.  I think there's a JIRA
issue for this that mentions the warning that you copied here.  You
could test out switching to generate and make sure the app still works
like it does currently, then comment on the JIRA with your results.
That would help us make the switch quicker.

--
Jeremy Thomerson
http://www.wickettraining.com




On Fri, Jul 31, 2009 at 10:08 AM, Maarten
Bosteels wrote:
> I see that the page is updated. Thanks.
>
> But it still uses mvn archetype:create which generates the follwoing
> warning:
>
> [WARNING] This goal is deprecated. Please use mvn archetype:generate instead
>
> Is there a reason to stick to the deprecated goal ?
>
> Maarten
>
> On Wed, Jul 29, 2009 at 12:36 PM, Martijn Dashorst <
> martijn.dasho...@gmail.com> wrote:
>
>> 1.4.0 is not yet officially released. We take care of that once we
>> have everything in place. And yes, the official documentation site is
>> committers only.
>>
>> Martijn
>>
>> On Wed, Jul 29, 2009 at 12:16 PM, Maarten
>> Bosteels wrote:
>> > Hello,
>> >
>> > Could someone update  http://wicket.apache.org/quickstart.html and add
>> > "1.4.0" to the dropdown box ?
>> > The 1.4-RC1  and milestones can probably be removed from the list.
>> >
>> > I would also suggest to use mvn archetype:generate instead of
>> > archetype:create
>> >
>> > Thanks
>> > Maarten
>> >
>> >
>> > PS: I tried to do the update myself but apparently I don't have the
>> > permission.
>> > Could it be that some pages on the cwiki can be edited by anyone with an
>> > Apache Confluence account and other pages only by wicket committers ?
>> >
>>
>>
>>
>> --
>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>> Apache Wicket 1.3.5 is released
>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>>
>> -
>> 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: Apache Wicket 1.4 takes type safety to the next level

2009-07-31 Thread Jeremy Thomerson
Trying to write all of the announcements and make sure all the
documentation on the site is reasonably up-to-date is also a critical
part of any release.  And it takes a long time.  We were all
scrambling to try to get it done.

--
Jeremy Thomerson
http://www.wickettraining.com




On Fri, Jul 31, 2009 at 8:55 AM, Craig
McIlwee wrote:
> I heard someone saying here a few weeks ago that the 1.4.0 build had been 
> finalized and that the official release was waiting on some PR stuff.  Just 
> curious what that was?
>
> -Original Message-
> From: martijn.dasho...@gmail.com [mailto:martijn.dasho...@gmail.com] On 
> Behalf Of Martijn Dashorst
> Sent: Thursday, July 30, 2009 6:54 AM
> To: 
> annou...@wicket.apache.org;annou...@apache.org;users@wicket.apache.org;d...@wicket.apache.org
> Subject: Apache Wicket 1.4 takes type safety to the next level
>
> The Apache Wicket project is proud to announce the release of Apache
> Wicket 1.4. Apache Wicket is an open source, component oriented Java
> web application framework. With overwhelming support from the user
> community, this release marks a departure from the past where we leave
> Java 1.4 behind and we require Java 5 as the minimum JDK version. By
> moving to Java 5 as the required minimum platform, we were able to
> utilize Java 5 idioms and increase the type safety of our APIs. Using
> Java generics you can now write typesafe web applications and create
> typesafe, self documenting, reusable custom components.
>
> The full announcement for this release can be found here:
> http://wicket.apache.org/apache-wicket-14-takes-type-safety-to-the-next-level.html
>
> Download Apache Wicket 1.4
>
> You can download the release here:
> http://www.apache.org/dyn/closer.cgi/wicket/1.4.0
>
> Or use this in your Maven pom's to upgrade to the new version:
>
> 
>    org.apache.wicket
>    wicket
>    1.4.0
> 
>
> You will need to upgrade all modules (i.e. wicket, wicket-extensions)
> to their 1.4 counterparts. It is not possible to mix Wicket 1.3
> libraries with 1.4 libraries due to API changes.
>
> Most notable changes
>
> From all the changes that went into this release, the following are
> the most important ones:
>
>  * Generified IModel interface and implementations increases type
> safety in your Wicket applications
>  * Component#getModel() and Component#setModel() have been renamed to
> getDefaultModel() and setDefaultModel() to better support generified
> models
>  * The Spring modules have been merged (wicket-spring-annot is now
> obsolete, all you need is wicket-spring)
>  * Many API's have been altered to better work with Java 5's idioms
>  * Wicket jars are now packaged with metadata that makes them OSGI bundles
>
> Apart from these changes, the release is mostly compatible with Wicket
> 1.3 and upgrading shouldn't take too long. Early adopters report about
> a days work to upgrade medium to large applications to Wicket 1.4.
> Read the migration guide to learn more about the changes in our APIs.
> To learn more about all the improvements and new features that went
> into this release, check the solved issue list in our JIRA instance.
>
> If you want to learn more about this release, please refer to the full
> release announcement:
> http://wicket.apache.org/apache-wicket-14-takes-type-safety-to-the-next-level.html
>
> -
> To unsubscribe, e-mail: announce-unsubscr...@wicket.apache.org
> For additional commands, e-mail: announce-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: update quickstart page

2009-07-31 Thread Maarten Bosteels
I see that the page is updated. Thanks.

But it still uses mvn archetype:create which generates the follwoing
warning:

[WARNING] This goal is deprecated. Please use mvn archetype:generate instead

Is there a reason to stick to the deprecated goal ?

Maarten

On Wed, Jul 29, 2009 at 12:36 PM, Martijn Dashorst <
martijn.dasho...@gmail.com> wrote:

> 1.4.0 is not yet officially released. We take care of that once we
> have everything in place. And yes, the official documentation site is
> committers only.
>
> Martijn
>
> On Wed, Jul 29, 2009 at 12:16 PM, Maarten
> Bosteels wrote:
> > Hello,
> >
> > Could someone update  http://wicket.apache.org/quickstart.html and add
> > "1.4.0" to the dropdown box ?
> > The 1.4-RC1  and milestones can probably be removed from the list.
> >
> > I would also suggest to use mvn archetype:generate instead of
> > archetype:create
> >
> > Thanks
> > Maarten
> >
> >
> > PS: I tried to do the update myself but apparently I don't have the
> > permission.
> > Could it be that some pages on the cwiki can be edited by anyone with an
> > Apache Confluence account and other pages only by wicket committers ?
> >
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.3.5 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Stateless login form?

2009-07-31 Thread Jeremy Thomerson
You could either:

1 - override isStateless and return true
or
2 - make it submit to a bookmarkable page and process the input from
the PageParameters


--
Jeremy Thomerson
http://www.wickettraining.com




On Fri, Jul 31, 2009 at 9:07 AM, Martin
Makundi wrote:
> Hi!
>
> My login page html looks like this:
>  action="https://www.mydomain.com/?wicket:interface=:0:loginForm::IFormSubmitListener::";>
>
> Can set some switch to make it more "stateless"? I would like the form
> submit target to be a stateless url. Why? I assume that currently if
> the user does not have a session but attempts to login, he will get an
> error message. This often happens when the login page itself is cached
> or the session has died while being unused.
>
> In principle there should not be any problem to process the form
> statelessly, because the user is identified using the form so in
> general no previous informatin is needed. Ofcourse I could do this by
> building my own pageParameter parser I am curious if such
> functionality is available out-of-the-box in Wicket.
>
> **
> Martin
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



RE: Wicket, Ajax and JSON

2009-07-31 Thread Serban Balamaci
Hello John.

This I would put in the same category as the "Controller Page" solution. And
well, that kind of separation will not make a nice reusable component. I
want in the end to get maybe even with something of a model behind it and
not have such a separation, although I guess the model of the component
would know to pass the parameters to the JSON servlet. And to get over the
problem of authentication and injection of other beans that can even be
coded as a Wicket Page.

Curently I'm looking in the direction of not extending
AbstractDefaultAjaxBehavior but looking more at the base classes in
AbstractDefaultAjaxBehavior and implement something like

public final void respond(final RequestCycle requestCycle)
{
final Application app = Application.get();

// Determine encoding
final String encoding =
app.getRequestCycleSettings().getResponseRequestEncoding();

// Set content type based on markup type for page
final WebResponse response =
(WebResponse)requestCycle.getResponse();
response.setCharacterEncoding(encoding);
response.setContentType("text/xml; charset=" + encoding);

response.write(json data);
 }



-Original Message-
From: John Armstrong [mailto:siber...@siberian.org] 
Sent: 31 iulie 2009 17:33
To: users@wicket.apache.org
Subject: Re: Wicket, Ajax and JSON

Maybe you are trying to drive screw into a board with a hammer?
I recommend just creating servlet to serve up these json style responses and
then use the excellent json.org libraries(instead of hand constructing json
transform your data structures into json automatically). The only issue
you'll have here is authentication so if you need a unified auth system you
will need to get that up and running in your json responder (wicket would do
it automatically).

 

WebApplication

/*

  



 

This is the JSON Gatewayn

JSON Gateway

JsonGateway

your.package.json.JsonGateway

  



getSomeData

/json/getSomeData

  


John-

On Fri, Jul 31, 2009 at 6:34 AM, Serban Balamaci
wrote:

> Hello. I'm trying to create a wicket component out of FlexiGrid
> http://www.flexigrid.info/ .
>
> The javascript for the component requires an address from which it will
> receive data in the form of a JSON response.
>
>
>
> I'm not sure what is the best way to go about it. Simple and most ugly
> approach would be to have something of a "Controller Page"
>
> a page that takes parameters such as the entity that is being retrieved
and
> also paging info, sort order, etc and returns the JSON response.
>
> I do not like this aproach as, most obvious reason is that it would not be
> obvious from the component what you need to do in order to get it to work.
>
>
>
> I would much more preffer to having a callback method that returns the
> json.
> So I have created a
>
>
>
> AbstractDefaultAjaxBehavior clientConnectBehavior = new
> AbstractDefaultAjaxBehavior() {
>
>
>
>protected void respond(AjaxRequestTarget ajaxRequestTarget) {
>
>   ajaxRequestTarget.prependJavascript("{page: 1, total:
239
> }");
>
>
>
>}
>
> and used clientConnectBehavior.getCallbackUrl() as the url passed to the
> flexigrid.
>
>
>
> Unfortunately the problem is the response when invoked is wrapped in a
> 
>
> 
>
> 
>
>
>
> So my question is how to get only the JSON part without the  version.>,
>  . and  decoration. Can it be bypassed? Shoul I
> override something in AbstractDefaultAjaxBehavior?
>
> Or any other ideea to go about the problem.
>
>
>
> Thank you,
>
>
>
> Serban
>
>


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



Re: Wicket, Ajax and JSON

2009-07-31 Thread John Armstrong
Maybe you are trying to drive screw into a board with a hammer?
I recommend just creating servlet to serve up these json style responses and
then use the excellent json.org libraries(instead of hand constructing json
transform your data structures into json automatically). The only issue
you'll have here is authentication so if you need a unified auth system you
will need to get that up and running in your json responder (wicket would do
it automatically).

 

WebApplication

/*

  



 

This is the JSON Gatewayn

JSON Gateway

JsonGateway

your.package.json.JsonGateway

  



getSomeData

/json/getSomeData

  


John-

On Fri, Jul 31, 2009 at 6:34 AM, Serban Balamaci wrote:

> Hello. I'm trying to create a wicket component out of FlexiGrid
> http://www.flexigrid.info/ .
>
> The javascript for the component requires an address from which it will
> receive data in the form of a JSON response.
>
>
>
> I'm not sure what is the best way to go about it. Simple and most ugly
> approach would be to have something of a "Controller Page"
>
> a page that takes parameters such as the entity that is being retrieved and
> also paging info, sort order, etc and returns the JSON response.
>
> I do not like this aproach as, most obvious reason is that it would not be
> obvious from the component what you need to do in order to get it to work.
>
>
>
> I would much more preffer to having a callback method that returns the
> json.
> So I have created a
>
>
>
> AbstractDefaultAjaxBehavior clientConnectBehavior = new
> AbstractDefaultAjaxBehavior() {
>
>
>
>protected void respond(AjaxRequestTarget ajaxRequestTarget) {
>
>   ajaxRequestTarget.prependJavascript("{page: 1, total: 239
> }");
>
>
>
>}
>
> and used clientConnectBehavior.getCallbackUrl() as the url passed to the
> flexigrid.
>
>
>
> Unfortunately the problem is the response when invoked is wrapped in a
> 
>
> 
>
> 
>
>
>
> So my question is how to get only the JSON part without the  version.>,
>  . and  decoration. Can it be bypassed? Shoul I
> override something in AbstractDefaultAjaxBehavior?
>
> Or any other ideea to go about the problem.
>
>
>
> Thank you,
>
>
>
> Serban
>
>


Stateless login form?

2009-07-31 Thread Martin Makundi
Hi!

My login page html looks like this:
https://www.mydomain.com/?wicket:interface=:0:loginForm::IFormSubmitListener::";>

Can set some switch to make it more "stateless"? I would like the form
submit target to be a stateless url. Why? I assume that currently if
the user does not have a session but attempts to login, he will get an
error message. This often happens when the login page itself is cached
or the session has died while being unused.

In principle there should not be any problem to process the form
statelessly, because the user is identified using the form so in
general no previous informatin is needed. Ofcourse I could do this by
building my own pageParameter parser I am curious if such
functionality is available out-of-the-box in Wicket.

**
Martin

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



RE: Apache Wicket 1.4 takes type safety to the next level

2009-07-31 Thread Craig McIlwee
I heard someone saying here a few weeks ago that the 1.4.0 build had been 
finalized and that the official release was waiting on some PR stuff.  Just 
curious what that was?

-Original Message-
From: martijn.dasho...@gmail.com [mailto:martijn.dasho...@gmail.com] On Behalf 
Of Martijn Dashorst
Sent: Thursday, July 30, 2009 6:54 AM
To: 
annou...@wicket.apache.org;annou...@apache.org;users@wicket.apache.org;d...@wicket.apache.org
Subject: Apache Wicket 1.4 takes type safety to the next level

The Apache Wicket project is proud to announce the release of Apache
Wicket 1.4. Apache Wicket is an open source, component oriented Java
web application framework. With overwhelming support from the user
community, this release marks a departure from the past where we leave
Java 1.4 behind and we require Java 5 as the minimum JDK version. By
moving to Java 5 as the required minimum platform, we were able to
utilize Java 5 idioms and increase the type safety of our APIs. Using
Java generics you can now write typesafe web applications and create
typesafe, self documenting, reusable custom components.

The full announcement for this release can be found here:
http://wicket.apache.org/apache-wicket-14-takes-type-safety-to-the-next-level.html

Download Apache Wicket 1.4

You can download the release here:
http://www.apache.org/dyn/closer.cgi/wicket/1.4.0

Or use this in your Maven pom's to upgrade to the new version:


org.apache.wicket
wicket
1.4.0


You will need to upgrade all modules (i.e. wicket, wicket-extensions)
to their 1.4 counterparts. It is not possible to mix Wicket 1.3
libraries with 1.4 libraries due to API changes.

Most notable changes

>From all the changes that went into this release, the following are
the most important ones:

 * Generified IModel interface and implementations increases type
safety in your Wicket applications
 * Component#getModel() and Component#setModel() have been renamed to
getDefaultModel() and setDefaultModel() to better support generified
models
 * The Spring modules have been merged (wicket-spring-annot is now
obsolete, all you need is wicket-spring)
 * Many API's have been altered to better work with Java 5's idioms
 * Wicket jars are now packaged with metadata that makes them OSGI bundles

Apart from these changes, the release is mostly compatible with Wicket
1.3 and upgrading shouldn't take too long. Early adopters report about
a days work to upgrade medium to large applications to Wicket 1.4.
Read the migration guide to learn more about the changes in our APIs.
To learn more about all the improvements and new features that went
into this release, check the solved issue list in our JIRA instance.

If you want to learn more about this release, please refer to the full
release announcement:
http://wicket.apache.org/apache-wicket-14-takes-type-safety-to-the-next-level.html

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




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



Re: Components and nullable data

2009-07-31 Thread Antony Stubbs

Absolutely. It's one of wickets many strong points.

Regards,
Antony Stubbs

website: sharca.com

On 1/08/2009, at 1:39 AM, Iain Reddick   
wrote:


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


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


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

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

Is this kind of thinking worth pursuing?



add(new Link("editgroup", user) {
onclick() {
 ...
}

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

?

-igor

2009/7/30 Iain Reddick :



> Hi all,
>
> One of the difficulties I am finding with wicket is the best  
practice when

> displaying/using data that is potentially null.
>
> Example:
>
> I have a "user" object which has a nullable "group" property. I  
want to show
> a link to the group details page when the "group" property is not  
null, but

> show nothing otherwise (let's keep this simple).
>
> My issue is that either way, I have to construct the link  
component and add
> it to the page, whether I want it is visible or not. This is  
tricky at the
> best of times, as I must always carry out a lot of  "is null"  
logic.

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

>
> My question is - am I missing something, or do I just need to  
have a better

> strategy for this type of situation?
>
> If the answer is the latter, does anyone have any tips and/or  
components

> that would cut down on the extra coding?
>
> Thanks
>
>  
-

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



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


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



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



Components and nullable data

2009-07-31 Thread Iain Reddick

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

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

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

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

Is this kind of thinking worth pursuing?



add(new Link("editgroup", user) {
 onclick() {
  ...
 }

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

?

-igor

2009/7/30 Iain Reddick :



> Hi all,
>
> One of the difficulties I am finding with wicket is the best practice when
> displaying/using data that is potentially null.
>
> Example:
>
> I have a "user" object which has a nullable "group" property. I want to show
> a link to the group details page when the "group" property is not null, but
> show nothing otherwise (let's keep this simple).
>
> My issue is that either way, I have to construct the link component and add
> it to the page, whether I want it is visible or not. This is tricky at the
> best of times, as I must always carry out a lot of  "is null" logic.
>
> The construction issue becomes multiplied if I want the same behaviour on a
> stateful page (i.e. the link, etc. can be appropriate for linking to the
> group, or be null and not visible and can switch between the two states).
>
> My question is - am I missing something, or do I just need to have a better
> strategy for this type of situation?
>
> If the answer is the latter, does anyone have any tips and/or components
> that would cut down on the extra coding?
>
> Thanks
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>
  


-
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



Wicket, Ajax and JSON

2009-07-31 Thread Serban Balamaci
Hello. I'm trying to create a wicket component out of FlexiGrid
http://www.flexigrid.info/ .

The javascript for the component requires an address from which it will
receive data in the form of a JSON response.

 

I'm not sure what is the best way to go about it. Simple and most ugly
approach would be to have something of a "Controller Page"

a page that takes parameters such as the entity that is being retrieved and
also paging info, sort order, etc and returns the JSON response.

I do not like this aproach as, most obvious reason is that it would not be
obvious from the component what you need to do in order to get it to work.

 

I would much more preffer to having a callback method that returns the json.
So I have created a

 

AbstractDefaultAjaxBehavior clientConnectBehavior = new
AbstractDefaultAjaxBehavior() {

 

protected void respond(AjaxRequestTarget ajaxRequestTarget) {

   ajaxRequestTarget.prependJavascript("{page: 1, total: 239
}");

 

}

and used clientConnectBehavior.getCallbackUrl() as the url passed to the
flexigrid.

 

Unfortunately the problem is the response when invoked is wrapped in a






 

So my question is how to get only the JSON part without the ,
 . and  decoration. Can it be bypassed? Shoul I
override something in AbstractDefaultAjaxBehavior? 

Or any other ideea to go about the problem.

 

Thank you,

 

Serban



Custom URL mapping (wild cards)

2009-07-31 Thread Andrew Easter
Hi everyone,

I've got a interesting requirement and, being only a complete newbie to
Wicket, I'm not 100% sure I can achieve it. Basically, assume you have the
following URL to display a product:

app/products/1234

I know I can use bookmarkable links and URL mounting in Wicket to allow such
"pretty" URLs. However, something that is extremely common on the Web these
days is including additional path information in a URL that further
identifies the contents of the page - mainly for search engine
optimization/marketing reasons.

For example, the product with code 1234 might be the book "Wicket in
Action". So what I'd really want is for the following URL to work:

app/products/1234/Wicket-in-Action.html

Now, what you'll find in most cases is that the web application completely
ignores the URL after the product code so, even if I navigated to
app/products/1234/blah-blah-blah.html, it would still be the correct product
page for the Wicket in Action book.

So, my question is, does this requirement sound like something that would be
easily possible in Wicket (maybe with some custom URL mounting strategy)?

I can easily do something like this with the REST support in Spring MVC 3.0
because I can simply map a Spring MVC Controller to a URL using wildcarding.
With the annotation support in Spring MVC, I can do something like this:

@RequestMapping( value = "/products/{productId}/*", method =
RequestMethod.GET )
public ModelAndView getProduct( @PathVariable( value = "productId" ) String
productId) { ... }

What this example shows is that the0 method getProduct() will be invoked
with any URL that starts with /products/[productId]. So it doesn't matter if
the invoker has added additional path information, it will just be ignored.

I'd be keen to understand a bit more about URL mounting and whether I could
achieve something similar to this with Wicket. Maybe if there was some kind
of wildcarding strategy? It is also important that I can build bookmarkable
links in Wicket pages that could include the additional path information.

Thanks for any help you can give me,

Andrew


Re: Modal dialog's components get disabled after closing

2009-07-31 Thread Gajo Csaba
I've found the error, looks like our abstract class which extends the 
ModalWindow had

contentPanel.setEnabled(false);
written in its close callback method...


Gajo Csaba wrote:

Hi,

I have a class which extends ModalWindow and has just one content 
panel inside. I've added several radio buttons and ajaxfallbackbuttons 
to it. When I display it with dialog.show(target) it shows without 
problem.


I also have a "Cancel" button in it, which is supposed to close the 
dialog. It's code is: dialog.close(target). This also works, it closes 
the dialog.


The problem is, when I open the same dialog again, all components 
inside are disabled! Why is this so? How can I close the dialog 
without getting all of its components disabled?


Regards,
Csaba



-
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



Modal dialog's components get disabled after closing

2009-07-31 Thread Gajo Csaba

Hi,

I have a class which extends ModalWindow and has just one content panel 
inside. I've added several radio buttons and ajaxfallbackbuttons to it. 
When I display it with dialog.show(target) it shows without problem.


I also have a "Cancel" button in it, which is supposed to close the 
dialog. It's code is: dialog.close(target). This also works, it closes 
the dialog.


The problem is, when I open the same dialog again, all components inside 
are disabled! Why is this so? How can I close the dialog without getting 
all of its components disabled?


Regards,
Csaba



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