-
FEATURED COMPONENTS
First time here? Check out the FAQ!
hi all
i have my page loggin zul:
<?xml version="1.0" encoding="UTF-8"?>
<?page title="MyFirstZKProject" style="text-align:center;"?>
<p:zk xmlns:p="http://www.zkoss.org/2005/zul">
<!-- ROOT ELEMENT -->
<p:window title="Omnidata" width="100%" height="768px"
style=" background: #EDF7F2; border: 4px groove #003366; text-align: center;"
id="logWin" use="com.action.Login"
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:p="http://www.zkoss.org/2005/zul"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">
<!-- CSS -->
<p:style src="/css/main.css" dynamic="true"/>
<p:div align="center">
<p:vbox spacing="2em" width="500px" style="text-align: center;">
<!-- IMAGE -->
<p:div align="center">
<p:image style="border: 3px groove #000066;" src="/page/img/omnidata.JPG"/>
</p:div>
<!-- Window LOGIN -->
<p:window title="Login" width="500px" id="loginDlg" onOK="login()" sclass="windowStyle" context="ActionPopup">
<p:div align="center">
<!-- TIMER -->
<p:label id="lheure" style="text-align: right;font-size: small;font-weight: bold;color: #cc3333;"/>
<p:timer id="timer" delay="1000" repeats="true" onTimer="lheure.setValue(new Date().toGMTString())"/>
<!-- SEPARATOR -->
<p:separator/>
<p:separator/>
<p:separator/>
<!-- GRID -->
<p:grid width="350px">
<p:columns>
<p:column width="30px"/>
<p:column width="60px"/>
<p:column width="120px"/>
</p:columns>
<p:rows>
<p:row>
<p:image src="/page/img/login.JPG"/>
<p:label value="Login"/>
<p:textbox zclass="mydb" id="userName" width="120px" sclass="windowStyle"/>
</p:row>
<p:row >
<p:image src="/page/img/paswor.JPG"/>
<p:label value="Password"/>
<p:textbox id="password" type="password" width="120px" sclass="windowStyle"/>
</p:row>
</p:rows>
</p:grid>
<!-- SEPARATOR -->
<p:separator/>
<p:separator/>
<!-- BUTTON -->
<p:div style="text-align: center;">
<p:button label="Se connecter" onClick="login()"/>
</p:div>
<!-- SEPARATOR -->
<p:separator/>
<p:separator/>
<p:div align="center">
<p:image style="border: 1px groove #000066;" src="/page/img/itarone.jpg"/>
</p:div>
<!-- SEPARATOR -->
<p:separator/>
<p:separator/>
<p:zscript> <![CDATA[ userName.focus(); ]]></p:zscript>
</p:div>
</p:window>
<!-- MENU POPUP -->
<p:menupopup id="ActionPopup">
<p:menuitem label="Overlap" onClick="loginDlg.doOverlapped();"/>
<p:menuitem label="Release" onClick="loginDlg.doEmbedded();"/>
</p:menupopup>
</p:vbox>
</p:div>
<!-- ZSCRIPT -->
<p:zscript>
<![CDATA[
void login()
{
/* parameter */
password = logWin.getFellow("loginDlg").getFellow("password");
userName = logWin.getFellow("loginDlg").getFellow("userName");
emptyConstraint = SimpleConstraint.getInstance("no empty");
password.setConstraint(emptyConstraint);
userName.setConstraint(emptyConstraint);
/* we run getValue to validate */
password.getValue();
userName.getValue();
/* we run function from com.action.Login.java */
logWin.login(userName, password);
Executions.sendRedirect("/page/role.zul");
}
/* we remove "user" from session */
sessionScope.remove("user");
]]>
</p:zscript>
</p:window>
</p:zk>
and i want reduce the code by facotorizing it
please can you suggeste me way so i can minimize the nombre of lines of codes
so my zul can be light on lines of code
thx for help
I can't suggest anything because it's unreadable...if you surround code fragments with [ c o d e ] and [ / c o d e] without the spaces, it will show your code formatted...
You can use include component to separate them.
Asked: 2010-03-29 09:15:27 +0800
Seen: 599 times
Last updated: Mar 31 '10