In an acquired RESTful Spring Boot Web application, there are some restrictions I currently cannot change. The code partly uses Java 1.6, the rest is Java 17. And the ZK Studio has the version 5.0 and cannot be upgraded without encountering problems. This was at least the statement from my predecessor. The server is running on a VM with Linux.
What I want to do is to augment the calendar widget of the ZK Studio with a week-of-year column. This updated widget is already built in from version 6.5 on, but I am bound to v5.0. 🙁
To implement it by myself, I made the following changes:
..workflowzk-components.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<zk>
<component>
<component-name>customCalendar</component-name>
<component-class>at.cps.oflow.utils.CustomCalendar</component-class>
</component>
</zk>
..workflow240la_erfassung.zul:
<zk>
<import src="../zk-components.xml"/>
<component>
<component-name>customCalendar</component-name>
<component-class>at.cps.oflow.utils.CustomCalendar</component-class>
</component>
<window border="none" id="ls_erfassung">
<grid>
<row>
<cell>
<label>Date:</label>
</cell>
<cell>
<customCalendar id="datum" value="@{actcontroller.actVars.datum}" constraint="no empty"/>
</cell>
</row>
…
</grid>
</window>
</zk>
CustomCalendar.java:
package at.cps.oflow.utils;
import java.io.IOException;
import java.util.Calendar;
import java.util.GregorianCalendar;
import org.zkoss.zk.ui.sys.*;
public class CustomCalendar extends org.zkoss.zul.Calendar {
@Override
protected void renderProperties(final ContentRenderer renderer) throws IOException {
super.renderProperties(renderer);
// Add code for the week of year
final Calendar cal = new GregorianCalendar();
final int week = cal.get(Calendar.WEEK_OF_YEAR);
renderer.render("weekNumber", week);
}
}
Obviously, I have forgotten something. Actually, it is the first try to work with the MVVM paradigm and with ZK Studio. When I run the application, an error showed that it couldn’t find the file ..zk-components.xml
:
So I decided to add the code directly into the ZUL file:
..workflow240la_erfassung.zul:
<zk>
<!--import src="../zk-components.xml"/-->
<component>
<component-name>customCalendar</component-name>
<component-class>at.cps.oflow.utils.CustomCalendar</component-class>
</component>
<window border="none" id="ls_erfassung">
<grid>
<row>
<cell>
<label>Date:</label>
</cell>
<cell>
<customCalendar id="datum" value="@{actcontroller.actVars.datum}" constraint="no empty"/>
</cell>
</row>
…
</grid>
</window>
</zk>
But still, I get an error:
Column 3 line 16 in the ZUL file is the end of the tag <component>
. Can you tell me what I have forgotten to add?