Como utilizar os métodos fadeIn e fadeOut da biblioteca Jquery para mostrar mensagem em uma página Zk.
Segue o código:
teste.zul
<zk xmlns:w="client">
<button id="btn" label="Fade In" width="100px">
<vlayout apply="tmp.WndViewCtrl" id="vLayoutWinSucess">
</vlayout>
</button>
</zk>
WndViewCtrl.java
package tmp;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Button;
import org.zkoss.zul.Vlayout;
/**
* Classe WndViewCtrl
*
* @author Marcio Andre Ishida
* @since 26/11/2012
* @version 1.0
*
* @see
*
*/
public class WndViewCtrl extends GenericForwardComposer {
/**
*
*/
private static final long serialVersionUID = -8598269330170838439L;
private Vlayout vLayoutWinSucess;
private Button btn;
/**
*
*
*/
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
}
public void onClick$btn() throws Exception {
if(this.vLayoutWinSucess.getChildren().size() > 0)
this.vLayoutWinSucess.getChildren().clear();
Executions.createComponents("testeShow.zul", this.vLayoutWinSucess, null);
}
}
Agora a página que iremos mostrar a mensagem!
testeShow.zul
<window apply="test.WinUpdateSucessViewCtrl" border="normal" closable="false" height="100px" id="winUpdateSucess" mode="overlapped" position="center" style="display: none;" title=" " width="350px">
<label value="TESTE SALVO COM SUCESSO">
</window>
WinUpdateSucessViewCtrl.java
/**
* Pacote contendo as classes test do servicebot3_1_01
*/
package test;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Window;
/**
* Classe WinUpdateSucessViewCtrl
*
* @author Marcio Andre Ishida
* @since 26/11/2012
* @version 1.0
*
* @see
*
*/
public class WinUpdateSucessViewCtrl extends GenericForwardComposer {
/**
*
*/
private static final long serialVersionUID = -8599935583066009856L;
private Window winUpdateSucess;
/**
*
*
*/
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
fadeIn();
fadeOut();
}
public void fadeIn(){
String jqCommand = "jq(\"$winUpdateSucess\").fadeIn(500)";
Clients.evalJavaScript(jqCommand);
}
public void fadeOut(){
String jqCommand = "jq(\'$winUpdateSucess\').fadeOut(1500)";
Clients.evalJavaScript(jqCommand);
}
}