johnny |
|
2009-06-08 |
|
Hi,
great job!!!!
But why isn't the full source code in archive?
Greets |
|
cnpww |
|
2009-06-16 |
|
zwf-1.0.0.RC.jar
source code? where? |
|
Cary |
|
2009-06-16 |
|
GOOD JOB! |
|
Horst |
|
2009-06-17 |
|
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" ? |
|
Simon |
|
2009-06-19 |
|
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. |
|
henrichen |
|
2009-06-19 |
|
@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. |
|
simon |
|
2009-06-22 |
|
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 |
|
simon |
|
2009-06-22 |
|
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? |
|
simon |
|
2009-06-22 |
|
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? |
|
simon |
|
2009-06-22 |
|
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>
|
|
simon |
|
2009-06-22 |
|
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? |
|
simon |
|
2009-06-22 |
|
A
general question. Where is the expected place to put logic to make a
branch decision on the flow? I am currently setting disabled=true on
the button that pumps the given transition: <button label="Save" mold="os" sclass="mzkprimary mzkbold" self="@{action(save)}" disabled="true" id="save"/> and am them putting a GenericForwardController on my input form which will do: save.setDisabled(!this.isValid());
within each of the onChange or onSelect of the input forms. Is this the expected approach? |
|
henrichen |
|
2009-06-23 |
|
Q1. java.lang.ClassCastException: class java.util.ArrayList cannot be converted to interface org.zkoss.zul.GroupsModel. <listbox sclass="mzk-listbox" model="${stateScope.policies}"> The ${stateScope.policies} EL eval to an ArrayList and ZK engine try to assign it into listbox's model and throw the exception. Have to prepare the policies to be a ListModel first. (In @{}, the data binder will do the type conversion from ArrayList to ListModel for you automatically) Q2. The issue regarding the AnnotateDataBinderInit. Current version of DataBinder is not able to handle "dynamically changed" view. That is, the data binder in a zul file cannot "manage" those components "added afterward". A proper way (aka workaround) in such case is to prepare a new data binder for each new added page (instead prepare one in the main layout page). That data binder will handle only that specific "tree of components". It would be something looks like following in your viewUser.zul: <?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="./mygrid"?> <zk> <grid id="mygrid"> <rows> <row> <label value="ID" sclass="firstColumn"/> <textbox value="@{user.id}" /> </row> ... </grid> <button label="Save" mold="os" sclass="mzkprimary mzkbold" self="@{action(save)}"/> </zk> Note the arg0="./mygrid" in AnnotateDataBinderInit, it tells the data binder to take care the tree of components rooted with the grid "mygrid". Q3. ... expected place to put logic to make a branch decision on the flow... In
the flow, there is an <action-state test="..."/> to do the
"switch.. case" type of branch. However, if come to the disable/enable
of a button in "view", I have no better idea than something like data binding disabled="@{mygrid$composer.disabled}". Do you have other suggestions? |
|
Qatari |
|
2009-06-23 |
|
I am new to this, can somebody tell me about the FlowController class please? and if it is in the downloadable files? |
|
Qatari |
|
2009-06-23 |
|
I meant the FlowHandler class?
class="org.zkoss.zwf.FlowHandler????????? |
|
Simon |
|
2009-06-23 |
|
Henri, Doh!
I am so used to using AnnotateDataBinderInit I had forgotten that...
Perhaps a 'fail fast' exception might be a good hint to slow memories
like mine? Using AnnotateDataBinderInit on the view fragment
makes perfect sense. The factory will bind an init to each sub-section
at the appropriate time. Doing the button disable with a binding
"@{mygrid$composer.disabled}" is certainly a good ZK AJAX way of doing
things. Another way that might fit the approach is to put the
validation in the flow with a <action-state test="..."/> that
tests the complex validations and stays at the current view state with
an error message if necessary. A 'best of both worlds' approach
might be to have a composer that only knows how to validate the current
view then have the flow test the isValid() of the composer and stay at
the current view state if necessary. In that manner the complex
validation of the view can be encapsulated and re-used between
alternate flows that have slightly variations. Is the code going to appear on sf.net? Simon |
|
Edudant |
|
2009-06-29 |
|
Hi, this library looks very promising. It might be usefull if you can provide us with source code of the library. What
is the recommanded solution to put more logic into transition /
validation / variable setup? Even in your simple example, there is
quite a lot of java code in the XML definition file. I would like to
have some clear place where to put java code and make reference from
XML (like composer and ZUL files vs. zscript). Thanks, Edudant |
|