Index course:
A final de cuentas las imágenes lo cuentan mejor. Al final está el código para que puedan copiar y pegar.
Objetivos:
- Crear una caja de texto en la vista.
- Asignarle un valor desde la clase controladora.
- Ver como interactuan los componentes.
------------------------- CÓDIGO PARA LA CLASE CONTROLADORA ---------------------------
package prueba.controladores;
import org.zkoss.zk.ui.Components;
import org.zkoss.zk.ui.ext.AfterCompose;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Window;
/**
* HASTA AQUÍ LLEGO
* @since Jueves 01/12/2011 11:08 PM.
* @author Gerardo José Montilla Virgüez, Way Technologies Consulting Group C.A.
* @see http://www.waytech.com.ve
* Clase creada para el software SGI
*/
public class ControladorInicio extends Window implements AfterCompose {
protected Textbox txtHolaMundo;
//ESTE METODO SIEMPRE SE EJECUTA POR DEFECTO
//THIS METHOD ALWAYS EXECUTE BY DEFAULT WHEN THIS CLASS IS CALLED
public void afterCompose() {
Components.wireVariables(this, this);
Components.addForwards(this, this);
txtHolaMundo.setText("Hola mundo !");
}
}
-------------- CÓDIGO PARA EL INDEX --------------------
<?page id="testZul" title="Compras - Archivo de texto" cacheable="false"
language="xul/html" zscriptLanguage="Java" contentType="text/html;charset=UTF-8" title="Compras"?>
<zk xmlns="http://www.zkoss.org/2005/zul"
xmlns:h="http://www.w3.org/1999/xhtml"
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">
<div align="center">
<window id="vtnVenta" use="prueba.controladores.ControladorInicio" >
<textbox id="txtHolaMundo">
</textbox>
</window>
</div>
</zk>