0

12:http://docs.zkoss.org/wiki/Ajax_Based_ZK_Web_Flow_System

asked 2009-06-08 16:52:57 +0800

anonymous gravatar image anonymous
1

Hi,
great job!!!!

But why isn't the full source code in archive?

Greets

delete flag offensive retag edit

32 Replies

Sort by ยป oldest newest

answered 2009-06-16 08:08:50 +0800

anonymous gravatar image anonymous
1

zwf-1.0.0.RC.jar

source code? where?

link publish delete flag offensive edit

answered 2009-06-16 10:00:23 +0800

anonymous gravatar image anonymous
1

GOOD JOB!

link publish delete flag offensive edit

answered 2009-06-17 10:53:04 +0800

anonymous gravatar image anonymous
1

Great job ! Excellent !

I just tested and played around for a while modifying main.xml and booking.xml
and did some stupid modifications -- and -- it worked !

Can you add the sources of the sample booking app to learn more about your way to combine spring, JPA and zwf?

Do you plan something like a "visual zflow designer" ?

link publish delete flag offensive edit

answered 2009-06-19 05:53:29 +0800

anonymous gravatar image anonymous
1

I think that this is a major achievement.

> Then why not just write own flow controller but bother to use a web flow system?

Why write your own controller that would not have a flowScope, bookmark history, sub-flow capability, clear separation of view from flow if you don't need to? :-)

As someone who champions Composer oriented MVC I feel that it is perfect for encapsulating the logic of a complex desktop e.g. 'home inbox' of my corporate system. Where ZK Web Flow is creating new capability is in being able to very quickly write "web wizards" to implement data capture that model the user activity of the system. The 'home inbox' of my corporate system will probably remain a complex, bespoke Initiator or Composer based complied controller. If I can quickly add a new variation of the "user wants to add new X to system" use case with a webflow controller that is isolated in a new /WEB-INF/flow/x_v2.xml then why would I choose to hand-code it? The very fact that I can choose where to transition to based on flowScope means that the wizard can skip pages based on user answers to questions, and can show/hide or make mandatory fields based on previous answers held in the flowScope. It seems like it would be tiresome to had write and maintain such logic by hand coding it over time if I can put it into ZK Web Flow where it will be easy for other members of my team to quickly fine and understand its data capture flow.

Well done.

link publish delete flag offensive edit

answered 2009-06-19 10:01:47 +0800

anonymous gravatar image anonymous
1

@Horst,

> Can you add the sources of the sample booking app to learn more about your way to combine > spring, JPA and zwf?

The source link is added.

> Do you plan something like a "visual zflow designer"

Might be there in the future ZK Studio release.

@Simon,

Thanks for the encouragement. Please do give us more feed backs.

link publish delete flag offensive edit

answered 2009-06-22 08:29:33 +0800

anonymous gravatar image anonymous
1

I notice that the download has a version name of "1.0.0-RC" but the pom in the file names it as "1.0.0" which is what it becomes when I upload it into our local Artifactory maven server. To fix that I am editing the pom.xml to make it 1.0.0-RC1. Is the code actually an RC or a first release? thx

link publish delete flag offensive edit

answered 2009-06-22 08:41:11 +0800

anonymous gravatar image anonymous
1

The pom also has a dependency on

    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-entitymanager</artifactId>
      <version>${hibernate.version}</version>
      <exclusions>
        <exclusion>
          <artifactId>jta</artifactId>
          <groupId>javax.transaction</groupId>
        </exclusion>
      </exclusions>
    </dependency>

where hibernate.version is not defined.

I find that the best way to see what the POM is doing is to add m2eclipse plug-in into eclipse then open the pom.xml and switch to the Dependency Graph and Dependency Hierarchy views which show whats going on.

The project also depends on spring. Is that correct?

link publish delete flag offensive edit

answered 2009-06-22 13:00:57 +0800

anonymous gravatar image anonymous
1

If I have a simple flow:


<?xml version="1.0" encoding="UTF-8"?>
<flow id="main">
<view-state id="viewUsers">
<attribute name="onEntry">
stateScope.put("policies", policyService.getPolicies(null));
</attribute>
<transition id="select" to="finish"/>
</view-state>

<end-state id="finish" />
</flow>

and a simple flow view:

<?page title="Users" contentType="text/html;charset=UTF-8"?>
<?init class="org.zkoss.zwf.FlowHandler" arg0="/WEB-INF/zwf/users.xml"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver" ?>
<zk xmlns="http://www.zkoss.org/2005/zul">
	<div id="working" self="@{view(content)}" /> 
</zk>

with the view state that simply tries to render the collection in the stateScope:

<zk>
	<listbox sclass="mzk-listbox" model="${stateScope.policies}">
		<listhead sizable="true">
			<listheader label="Creation Date" sort="auto" />
			<listheader label="Policy" />
		</listhead>
		<listitem self="@{each=policy}">
			<listcell label="@{policy.creationDate}" />
			<listcell label="@{policy.reference}" />
		</listitem>
	</listbox>
</zk>

then I get a class cast exception

SEVERE: >>java.lang.ClassCastException: class java.util.ArrayList cannot be converted to interface org.zkoss.zul.GroupsModel.
>>java.lang.InstantiationException: org.zkoss.zul.GroupsModel
>>	at java.lang.Class.newInstance0(Class.java:340)
>>	at java.lang.Class.newInstance(Class.java:308)
>>	at org.zkoss.lang.Classes.coerce(Classes.java:1285)
>>	at org.zkoss.zk.ui.metainfo.Property.assign0(Property.java:250)
>>	at org.zkoss.zk.ui.metainfo.Property.assign(Property.java:175)
>>	at org.zkoss.zk.ui.metainfo.ComponentInfo.applyProperties(ComponentInfo.java:769)
>>	at org.zkoss.zk.ui.impl.AbstractUiFactory.newComponent(AbstractUiFactory.java:95)
>>	at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:616)
>>...

Any ideas?

link publish delete flag offensive edit

answered 2009-06-22 13:11:21 +0800

anonymous gravatar image anonymous
1

Just a note to day that if I changed the view to be the following (same grid code per the demo code) then it works. That listbox binding however works elsewhere in my project with a Composer as the source of the model.

<zk>
			<grid unless="${empty policies}">
				<columns height="27px">
					<column label="Name"/>
					<column label="Address"/>
					<column label="City, State"/>
					<column label="Zip"/>
					<column label="Action"/>
				</columns>
				<rows>
					<row forEach="${policies}" value="${each}">
						<label value="${each.id}"/>
						<label value="${each.reference}"/>
						<toolbarbutton label="View Hotel" self="@{action(select)}">
							<custom-attributes policy="${each}"/>
						</toolbarbutton>
					</row>
				</rows>
			</grid>
</zk>

link publish delete flag offensive edit

answered 2009-06-22 16:00:44 +0800

anonymous gravatar image anonymous
1

I can see that I left off the AnnotateDataBinderInit on that last posting. I am still having a problems with data binding. Here is the flow:

<?xml version="1.0" encoding="UTF-8"?>
<flow id="main">
	<view-state id="viewUsers">
		<attribute name="onEntry">
			stateScope.put("users", rhaHibernateTemplate.loadAll(com.x.y.rha.User.class) ); 
		</attribute>
		<transition id="add" to="addUser"/>
	</view-state>
	
	<view-state id="addUser">
		<attribute name="onEntry">
			stateScope.put("user", new com.x.rha.ui.UserBuilder() ); 
		</attribute>
		<transition id="cancel" to="finish"/>
		<transition id="save" to="viewUsers">
			<attribute name="onTransit">
				java.lang.System.out.println(stateScope.get("user"));	
			</attribute>
		</transition>
	</view-state>
	
	<end-state id="finish" />
</flow>

the main page that includes the flow states is:

<?page title="Users" contentType="text/html;charset=UTF-8"?>
<?init class="org.zkoss.zwf.FlowHandler" arg0="/WEB-INF/zwf/users.xml"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver" ?>
<zk xmlns="http://www.zkoss.org/2005/zul">
	<div id="working" self="@{view(content)}" /> 
</zk>

where this time I have the AnnotateDataBinderInit :-) ignoring the viewUsers.zul which works as per my last post I am trying to get the addUser.zul working using annotations:

<zk>
	<grid>
		<rows>
			<row>
				<label value="ID"  sclass="firstColumn"/>
				<textbox value="@{user.id}"  />
			</row>
			<row>
				<label value="First Name"  sclass="firstColumn"/>
				<textbox value="@{user.firstName}"  />
			</row>
			<row>
				<label value="Second Name"  sclass="firstColumn"/>
				<textbox value="@{user.secondName}"  />
			</row>
			<row>
				<label value="Text Input"  sclass="firstColumn"/>
				<textbox value="${user}"  />
			</row>
			
		</rows>
	</grid>
	<button label="Save" mold="os" sclass="mzkprimary mzkbold" self="@{action(save)}"/>
</zk>

My problem is that the ${user} is working find but the @{user} annotations don't seem to be happy at all. The System.out.println() in the flow shows null for all of the databound elements. Typically that happens when I my annotations are not binding to anything. How can I expose the ${user} set in the flow scope to the databinder or is that not supported yet?

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-06-08 16:52:57 +0800

Seen: 33 times

Last updated: Mar 28 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More