Re: wicket and flow

2013-07-01 Thread Martin Grigorov
Hi,

You can do all this with a custom root request mapper.


On Sat, Jun 29, 2013 at 2:50 PM, Piratenvisier
hansheinrichbr...@yahoo.dewrote:

 Hello Martin,
 a  central class in Webflow is  PageFlowRequestCycleProcessor:


 public class PageFlowRequestCycleProcessor extends WebRequestCycleProcessor
 {

 /** {@inheritDoc} */
 @Override
 public IRequestTarget_*resolve*_(**RequestCycle requestCycle,
 RequestParameters requestParameters)
 {
 //If Key in URL use it
 if(requestParameters.**getParameters().containsKey(**
 PageFlowConstants.FLOW_**EXECUTION_KEY))
 {
 String[] flowExecutionKeyParms = (String[])requestParameters.*
 *getParameters().get(**PageFlowConstants.FLOW_**EXECUTION_KEY);
 if(flowExecutionKeyParms.**length  0){
 return 
 RequestTargetFactory.**buildFromState(**flowExecutionKeyParms[0],
 requestCycle, requestParameters);
 }
 }

 IRequestTarget target = super.resolve(requestCycle,
 requestParameters);

 // If the target is bookmarkable but mounted it needs to go back
 and check pageflow
 if (target instanceof BookmarkablePageRequestTarget)
 {
 //BookmarkablePageRequestTarget bookmarkableTarget = (**
 BookmarkablePageRequestTarget)**target;

 //if (PAGE_FLOW_PAGE_CLASS.**isAssignableFrom(**
 bookmarkableTarget.**getPageClass()) ||
 //PANEL_FLOW_PAGE_CLASS.**isAssignableFrom(**
 bookmarkableTarget.**getPageClass()))
 //{
 String currentStateFromSession = PageFlowSession.get().**
 getFlowState().**getCurrentViewState();
 return 
 RequestTargetFactory.**buildFromState(**currentStateFromSession,
 requestCycle, requestParameters);
 //}
 }

 return target;
 }

 /** {@inheritDoc} */
 @Override
 protected IRequestTarget _*resolveHomePageTarget*_(**RequestCycle
 requestCycle, RequestParameters requestParameters)
 {

 //Grab the target as Wicket would normally calculate it
 BookmarkablePageRequestTarget classicTarget 
 =(**BookmarkablePageRequestTarget)
 super.resolveHomePageTarget(**requestCycle, requestParameters);
 BookmarkablePageRequestTarget newTarget =  resolvePageFlowTargets(
 **classicTarget,requestCycle,**requestParameters);

 //If the target that PageFlow is returning isn't the real home
 page we need to redirect to it.
 if(!classicTarget.**getPageClass().equals(**
 newTarget.getPageClass())){

 //Redirect to the homepage if session is trying to go to the
 end of the flow since we are restarting it
 String currentStateFromSession = PageFlowSession.get().**
 getFlowState().**getCurrentViewState();
 if(PageFlowConstants.PAGE_**FLOW_FINAL_STATE_DONE.equals(**
 currentStateFromSession)){
 //Reset the whole flow state in preparation for a new flow
 PageFlowSession.get().**resetFlowState();

 // This line is to reset the target because the flowstate
 was just reset so the url needs to be regenerated
 classicTarget =(**BookmarkablePageRequestTarget)
 super.resolveHomePageTarget(**requestCycle, requestParameters);

 return classicTarget;
 }

 throw new RestartResponseException(**newTarget.getPageClass(),
 newTarget.getPageParameters())**;
 }

 return resolvePageFlowTargets(**classicTarget,requestCycle,**
 requestParameters);
 }

 /** {@inheritDoc} */
 @Override
 protected IRequestTarget _*resolveBookmarkablePage*_(**RequestCycle
 requestCycle, RequestParameters requestParameters)
 {
 //Grab the target as Wicket would normally calculate it
 BookmarkablePageRequestTarget classicTarget 
 =(**BookmarkablePageRequestTarget)
 super.resolveBookmarkablePage( requestCycle,  requestParameters);

 return resolvePageFlowTargets(**classicTarget,requestCycle,**
 requestParameters);
 }

 /**
  * presolvePageFlowTargets./p
  *
  * @param classicTarget a {@link org.apache.wicket.request.**
 target.component.**BookmarkablePageRequestTarget} object.
  * @param requestCycle a {@link org.apache.wicket.**RequestCycle}
 object.
  * @param requestParameters a {@link 
 org.apache.wicket.request.**RequestParameters}
 object.
  * @return a {@link 
 org.apache.wicket.request.**target.component.**BookmarkablePageRequestTarget}
 object.
  */
 protected BookmarkablePageRequestTarget 
 _resolvePageFlowTargets_(**BookmarkablePageRequestTarget
 classicTarget, RequestCycle requestCycle, RequestParameters
 requestParameters)
 {
 BookmarkablePageRequestTarget target = null;

 String currentStateFromSession = PageFlowSession.get().**
 getFlowState().**getCurrentViewState();
 //If the target still hasn't been set, target from the user's
 session data
 

Re: wicket and flow

2013-06-29 Thread Piratenvisier

Hello Martin,
a  central class in Webflow is  PageFlowRequestCycleProcessor:


public class PageFlowRequestCycleProcessor extends WebRequestCycleProcessor
{

/** {@inheritDoc} */
@Override
public IRequestTarget_*resolve*_(RequestCycle requestCycle, 
RequestParameters requestParameters)

{
//If Key in URL use it

if(requestParameters.getParameters().containsKey(PageFlowConstants.FLOW_EXECUTION_KEY))

{
String[] flowExecutionKeyParms = 
(String[])requestParameters.getParameters().get(PageFlowConstants.FLOW_EXECUTION_KEY);

if(flowExecutionKeyParms.length  0){
return 
RequestTargetFactory.buildFromState(flowExecutionKeyParms[0], 
requestCycle, requestParameters);

}
}

IRequestTarget target = super.resolve(requestCycle, 
requestParameters);


// If the target is bookmarkable but mounted it needs to go 
back and check pageflow

if (target instanceof BookmarkablePageRequestTarget)
{
//BookmarkablePageRequestTarget bookmarkableTarget = 
(BookmarkablePageRequestTarget)target;


//if 
(PAGE_FLOW_PAGE_CLASS.isAssignableFrom(bookmarkableTarget.getPageClass()) ||
//
PANEL_FLOW_PAGE_CLASS.isAssignableFrom(bookmarkableTarget.getPageClass()))

//{
String currentStateFromSession = 
PageFlowSession.get().getFlowState().getCurrentViewState();
return 
RequestTargetFactory.buildFromState(currentStateFromSession, 
requestCycle, requestParameters);

//}
}

return target;
}

/** {@inheritDoc} */
@Override
protected IRequestTarget _*resolveHomePageTarget*_(RequestCycle 
requestCycle, RequestParameters requestParameters)

{

//Grab the target as Wicket would normally calculate it
BookmarkablePageRequestTarget classicTarget 
=(BookmarkablePageRequestTarget) 
super.resolveHomePageTarget(requestCycle, requestParameters);
BookmarkablePageRequestTarget newTarget =  
resolvePageFlowTargets(classicTarget,requestCycle,requestParameters);


//If the target that PageFlow is returning isn't the real home 
page we need to redirect to it.

if(!classicTarget.getPageClass().equals(newTarget.getPageClass())){

//Redirect to the homepage if session is trying to go to 
the end of the flow since we are restarting it
String currentStateFromSession = 
PageFlowSession.get().getFlowState().getCurrentViewState();

if(PageFlowConstants.PAGE_FLOW_FINAL_STATE_DONE.equals(currentStateFromSession)){

//Reset the whole flow state in preparation for a new flow
PageFlowSession.get().resetFlowState();

// This line is to reset the target because the 
flowstate was just reset so the url needs to be regenerated
classicTarget =(BookmarkablePageRequestTarget) 
super.resolveHomePageTarget(requestCycle, requestParameters);


return classicTarget;
}

throw new 
RestartResponseException(newTarget.getPageClass(), 
newTarget.getPageParameters());

}

return 
resolvePageFlowTargets(classicTarget,requestCycle,requestParameters);

}

/** {@inheritDoc} */
@Override
protected IRequestTarget _*resolveBookmarkablePage*_(RequestCycle 
requestCycle, RequestParameters requestParameters)

{
//Grab the target as Wicket would normally calculate it
BookmarkablePageRequestTarget classicTarget 
=(BookmarkablePageRequestTarget) super.resolveBookmarkablePage( 
requestCycle,  requestParameters);


return 
resolvePageFlowTargets(classicTarget,requestCycle,requestParameters);

}

/**
 * presolvePageFlowTargets./p
 *
 * @param classicTarget a {@link 
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget} object.

 * @param requestCycle a {@link org.apache.wicket.RequestCycle} object.
 * @param requestParameters a {@link 
org.apache.wicket.request.RequestParameters} object.
 * @return a {@link 
org.apache.wicket.request.target.component.BookmarkablePageRequestTarget} object.

 */
protected BookmarkablePageRequestTarget 
_resolvePageFlowTargets_(BookmarkablePageRequestTarget classicTarget, 
RequestCycle requestCycle, RequestParameters requestParameters)

{
BookmarkablePageRequestTarget target = null;

String currentStateFromSession = 
PageFlowSession.get().getFlowState().getCurrentViewState();
//If the target still hasn't been set, target from the user's 
session data

if(currentStateFromSession != null)
{
target = 
RequestTargetFactory.buildFromState(currentStateFromSession, 
requestCycle, requestParameters);

}

//TODO if the target is null, redirect back to the last 
rendered page, or the homepage

if(target == null)
{
target = 

Re: wicket and flow

2013-06-18 Thread Piratenvisier

Thank you Martin.
Now I started another evaluation process after studying spring Webflow 
and Seam
an especially this discussion 
http://http://ptrthomas.wordpress.com/2007/03/02/wicket-impressions-moving-from-spring-mvc-webflow/ 
lets me think more profoundly about the subject.

In cocoon I tried the flow subject with spring apllicationXML files
After some time with growing XML-structures it was rather tedious to 
find out the reason
of a flow problem. In wicket I tried it with HashMap in the 
Wicketapplication.
But the maintenance became also tedious. After the above discussion I 
think I will try it more with special Components and

and Inheritance.
Best regards
Heiner

Am 16.06.2013 11:36, schrieb Martin Grigorov:

Hi,

Some guys created integration of Wicket 1.4 with Spring WebFlow (
https://github.com/wicketstuff/core/tree/core-1.4.x/jdk-1.5-parent/spring-webflow-parent
).
You may find it interesting and update it to newer versions of both Wicket
and Spring WebFlow.


On Sun, Jun 16, 2013 at 7:34 AM, Piratenvisier
hansheinrichbr...@yahoo.dewrote:


Is there any support to structure the flow of pages and forms.
I build for my realestate software structures, defining a state of a page,
the visibility of the links and tabs, the pages a link calls in this state,
  database action to be done and the pageparameters
the link tranfers to the new page.

But maybe there are more intelligent ways to organize this.


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






Re: wicket and flow

2013-06-16 Thread Martin Grigorov
Hi,

Some guys created integration of Wicket 1.4 with Spring WebFlow (
https://github.com/wicketstuff/core/tree/core-1.4.x/jdk-1.5-parent/spring-webflow-parent
).
You may find it interesting and update it to newer versions of both Wicket
and Spring WebFlow.


On Sun, Jun 16, 2013 at 7:34 AM, Piratenvisier
hansheinrichbr...@yahoo.dewrote:

 Is there any support to structure the flow of pages and forms.
 I build for my realestate software structures, defining a state of a page,
 the visibility of the links and tabs, the pages a link calls in this state,
  database action to be done and the pageparameters
 the link tranfers to the new page.

 But maybe there are more intelligent ways to organize this.


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