Skip to content
Snippets Groups Projects
Commit b0d488eb authored by ginquin's avatar ginquin
Browse files
parents 197255e3 ed29857d
Branches
No related tags found
No related merge requests found
......@@ -6,7 +6,7 @@
<artifactId>smellswisdom</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<zk.version>8.5.0</zk.version>
<zk.version>8.6.0.1</zk.version>
<commons-io>2.4</commons-io>
<maven.build.timestamp.format>yyyy-MM-dd</maven.build.timestamp.format>
<packname>-${project.version}-FL-${maven.build.timestamp}</packname>
......
package es.uva.inf.tfg.ginquin.smellswisdom.controller;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.ClientInfoEvent;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.select.SelectorComposer;
import org.zkoss.zk.ui.select.annotation.VariableResolver;
import org.zkoss.zk.ui.select.annotation.Wire;
import org.zkoss.zkplus.spring.DelegatingVariableResolver;
import org.zkoss.zul.Center;
import org.zkoss.zul.Window;
@VariableResolver(DelegatingVariableResolver.class)
public class LoginResponsiveController extends SelectorComposer<Component> {
private boolean bigLayout;
/**
*
*/
private static final long serialVersionUID = 7899013790271118418L;
@Wire
Center content;
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
handleBigLayout();
comp.addEventListener(Events.ON_CLIENT_INFO, new EventListener<ClientInfoEvent>() {
public void onEvent(ClientInfoEvent event) throws Exception {
System.out.println(event.getDesktopWidth());
if(event.getDesktopWidth()>=577){
handleBigLayout();
}else{
handleSmallLayout();
}
}
});
}
private void handleBigLayout(){
//check the bigLayout flag to avoid re-rendering if the window is resized while already in big layout
if(bigLayout)
return;
bigLayout = true;
if(content.getFirstChild()!=null) {
Window win = (Window) content.getFirstChild();
win.getFirstChild().setVisible(true);
win.getLastChild().setVisible(false);
}
}
private void handleSmallLayout(){
//check the bigLayout flag to avoid re-rendering if the window is resized while already in small layout
if(!bigLayout)
return;
bigLayout = false;
if(content.getFirstChild()!=null) {
Window win = (Window) content.getFirstChild();
win.getLastChild().setVisible(true);
win.getFirstChild().setVisible(false);
}
}
}
......@@ -18,6 +18,8 @@
<!-- resources for anonymous access in an application -->
<intercept-url pattern="/css/style.css" access="IS_AUTHENTICATED_ANONYMOUSLY" />
<intercept-url pattern="/css/demo.css.dsp" access="IS_AUTHENTICATED_ANONYMOUSLY" />
<intercept-url pattern="/imgs/zklogo.png" access="IS_AUTHENTICATED_ANONYMOUSLY" />
<!-- secure pages -->
<intercept-url pattern="/**" access="ROLE_USER" />
......
<div hflex="1" vflex="1" sclass="banner">
<hbox hflex="1" vflex="1" align="center">
<a href="https://www.zkoss.org">
<image src="/imgs/zklogo.png" width="50px"/>
</a>
<div width="200px">
<div width="100%">
<label value="SMELLSWISDOM" sclass="banner-head" />
</div>
<hbox hflex="min" pack="end" >
......
<div hflex="1" sclass="footer">
<vbox hflex="1" align="center">
<div hflex="1" vflex="1" sclass="footer">
<vbox hflex="1" vflex="1" align="center">
ZK Essentials, you are using ZK ${desktop.webApp.version}
<a href="http://www.zkoss.org">http://www.zkoss.org</a>
</vbox>
......
<?taglib uri="/WEB-INF/security.tld" prefix="sec"?>
<zk>
<borderlayout hflex="1" vflex="1">
<north height="15%" border="none">
<borderlayout hflex="1" vflex="1">
<north height="65%">
<north border="none">
<include src="/css/banner.zul" />
</north>
<south height="35%" if="${sec:isAllGranted('ROLE_USER')}">
<panel>
<panelchildren>
<menubar id="menubar" autodrop="true">
<menuitem id="busq_elementos"
label="Búsqueda de elementos"
if="${sec:isAllGranted('ROLE_USER')}">
</menuitem>
<menuitem id="adm_elementos"
label="Administración"
if="${sec:isAllGranted('ROLE_ADMIN')}"/>
</menubar>
</panelchildren>
</panel>
</south>
</borderlayout>
</north>
<center id="mainContent" autoscroll="true" border="none"
self="@insert(content)">
<center id="mainContent" autoscroll="true"
border="none" self="@insert(content)">
<!-- the main content will be insert to here -->
</center>
<south border="none">
<include src="/css/footer.zul" />
</south>
</borderlayout>
</zk>
<?init class="org.zkoss.zk.ui.util.Composition" arg0="/css/template.zul"?>
<?taglib uri="http://www.zkoss.org/dsp/web/theme" prefix="t"?>
<?taglib uri="/WEB-INF/security.tld" prefix="sec"?>
<zk>
<div self="@define(content)" height="100%">
<borderlayout hflex="1" vflex="1" apply="es.uva.inf.tfg.ginquin.smellswisdom.controller.LoginResponsiveController">
<north border="none">
<div hflex="1" vflex="1" sclass="banner">
<hbox hflex="1" vflex="1" align="center">
<div width="100%">
<label value="SMELLSWISDOM"
sclass="banner-head" />
</div>
<hbox hflex="min" pack="end">
<label
value="${sessionScope.userCredential.name}"
if="${sec:isAllGranted('ROLE_USER')}" />
<label id="logout" value="Logout"
if="${sec:isAllGranted('ROLE_USER')}" sclass="logout" />
</hbox>
</hbox>
</div>
</north>
<center id="content" autoscroll="true" border="none" >
<window vflex="1" hflex="1" >
<div id="layout1" vflex="1" hflex="1" visible="false">
<hlayout hflex="1" vflex="1">
<vbox hflex="1" vflex="1" align="center" pack="center">
<vbox hflex="1" vflex="1" align="center"
pack="center">
<label sclass="head1" value="${labels.s1}" />
<label sclass="head2" value="${labels.s2}" />
<label sclass="head2" value="${labels.s3}" />
<label sclass="head2" value="${labels.s4}" />
</vbox>
<hbox vflex="1" hflex="1" align="center" pack="center"
spacing="20px">
<hbox hflex="1" vflex="1" align="center"
pack="center">
<vlayout>
<window id="loginWin" title="${labels.login.title}"
border="normal" hflex="min">
<window title="${labels.login.title}"
border="normal" hflex="min" vflex="min">
<vbox hflex="min" align="center">
<grid hflex="min">
<columns>
<column hflex="min" align="right" />
<column hflex="min"
align="right" />
<column />
</columns>
<rows>
<row>
${labels.user} :
<textbox id="account"
width="200px" />
<textbox
id="account" width="100%" />
</row>
<row>
${labels.password} :
<textbox id="password"
type="password" width="200px" />
<textbox
id="password" type="password" width="100%" />
</row>
</rows>
</grid>
<label id="message" sclass="warn"
value="&#160;" />
<button id="login" label="${labels.login.button}" />
<label id="message"
sclass="warn" value="&#160;" />
<button id="login"
label="${labels.login.button}" />
</vbox>
</window>
(use account='zkoss' and password='1234' to login)
(use account='zkoss' and password='1234'
to login)
</vlayout>
</hbox>
</hlayout>
</div>
<div id="layout2" hflex="1" vflex="1" visible="false">
<vlayout hflex="1" vflex="1">
<vbox hflex="1" vflex="1" align="center"
pack="center">
<label sclass="head1" value="${labels.s1}" />
<label sclass="head2" value="${labels.s2}" />
<label sclass="head2" value="${labels.s3}" />
<label sclass="head2" value="${labels.s4}" />
</vbox>
<hbox hflex="1" vflex="1" align="center"
pack="center">
<vlayout>
<window id="loginWin"
title="${labels.login.title}" border="normal" hflex="min"
vflex="min">
<vbox hflex="min" align="center">
<grid hflex="min">
<columns>
<column hflex="min"
align="right" />
<column />
</columns>
<rows>
<row>
${labels.user} :
<textbox
id="account" width="100%" />
</row>
<row>
${labels.password} :
<textbox
id="password" type="password" width="100%" />
</row>
</rows>
</grid>
<label id="message"
sclass="warn" value="&#160;" />
<button id="login"
label="${labels.login.button}" />
</vbox>
</window>
(use account='zkoss' and password='1234'
to login)
</vlayout>
</hbox>
</vlayout>
</div>
</window>
</center>
<south border="none">
<include src="/css/footer.zul" />
</south>
</borderlayout>
</zk>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment