0

helpme please textbox and event intercomunication page

asked 2011-03-07 19:09:39 +0800

xcom gravatar image xcom
564 3

hello:

I have my zul main.page and call other page, i am need value de textbox in other page my zul controller main

public void onClickOpcionActivo(){
		Executions.createComponents(
				"menu/page_activoDialog.zul", null,null);
		Textbox text=(Textbox) Path.getComponent("//activoMenuPage/mainWin").getFellow("txtb_nuevaRaiz");//is null ??
                //i am need varible raiz
	   
	}

my code zul page_activoDialog.zul

<?xml version="1.0" encoding="UTF-8"?>
<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"
	xmlns:a="http://www.zkoss.org/2005/zk/annotation"
	xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">
<?page id="activoMenuPage" ?>
	<window id="mainWin" mode="modal" title="Ventana Activo"
		 border="normal" sizable="true" position="left,top"
		closable="true">
		<hbox style="border-style: none;">
			<button id="btn_crearRaiz_dispositivo" label="Crear Raiz"
				context="asignacionPopup" visible="true" />
			<textbox id="txtb_nuevaRaiz_dispositivo" constraint="no empty"
				height="12px" width="124px"  visible="true" />
		</hbox>
		
	</window>
</zk>


my controller page_activoDialog.zul


private String raiz;
...
              public void onClick$"btn_crearRaiz_dispositivo(){
                   if((buscarRaiz(btn_crearRaiz_dispositivo.getValue()){
                        raiz=value;
                   } 
               }
..........

so need variable raiz, when you run the button's onclick action and pass it to main

delete flag offensive retag edit

10 Replies

Sort by ยป oldest newest

answered 2011-03-07 19:41:11 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Hi xcom,

Executions.createComponents("menu/page_activoDialog.zul", null,null);

The second argument was null,
the zul didn't attach to any page, so you cannot retrieve it from path.

link publish delete flag offensive edit

answered 2011-03-07 19:53:50 +0800

xcom gravatar image xcom
564 3

the second argument is my page main o not

link publish delete flag offensive edit

answered 2011-03-07 20:11:02 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

So it still cannot retrieve the component when the zul attach to the main page?

link publish delete flag offensive edit

answered 2011-03-07 20:56:34 +0800

xcom gravatar image xcom
564 3

how do I wait until you run onclick button

in zul page main

             Map<String, Object> map = new HashMap<String, Object>();
		String raiz ="";
		map.put("raiz",raiz);
		 Executions.createComponents(
		 "menu/page_activoDialog.zul",null,null);
		  raiz = Executions.getCurrent().getParameter("raiz");
		alert(raiz);	

in zul controller ohter modal windows

<?xml version="1.0" encoding="UTF-8"?>
<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"
	xmlns:a="http://www.zkoss.org/2005/zk/annotation"
	xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">
<?page id="activoMenuPage" ?>
	<window id="mainWin" mode="modal" title="Ventana Activo"
		 border="normal" sizable="true" position="left,top"
		closable="true">
		<hbox style="border-style: none;">
			<button id="btn_crearRaiz_dispositivo" label="Crear Raiz"
				context="asignacionPopup" visible="true" />
			<textbox id="txtb_nuevaRaiz_dispositivo" constraint="no empty"
				height="12px" width="124px"  visible="true" />
		</hbox>
		
	</window>
</zk>


in controller

@Override
	public void doAfterCompose(Component comp) throws Exception {
		super.doAfterCompose(comp);
		// TODO Auto-generated method stub
		map = Executions.getCurrent().getArg();
		raiz=(String)map.get("raiz");
	}

      public void btn_crearRaiz_dispositivo$onClick(Event event){
          raiz=txtb_nuevaRaiz_dispositivo.getValue()
       } 

raiz is null in page main zul

link publish delete flag offensive edit

answered 2011-03-07 21:08:34 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

updated 2011-03-07 21:10:01 +0800

Sorry xcom,
I forgot the zul with page (<?page id="activoMenuPage" ?>) attach to component by Executions.createComponents will not create the page
I have created a sample

<zk>
	<window id="outterWin">
		<div id="content"/>
		<button label="add content">
			<attribute name="onClick"><![CDATA[
				Executions.createComponentsDirectly(
						"<?page id=\"activoMenuPage\"?>"+
						"<window id=\"mainWin\">"+
							"<textbox id=\"txtb_nuevaRaiz_dispositivo\"/>"+
						"</window>", "zul", content, null);
				
				alert(Path.getComponent("/outterWin/mainWin/txtb_nuevaRaiz_dispositivo"));
			]]></attribute>
		</button>
	</window>
</zk>

link publish delete flag offensive edit

answered 2011-03-07 21:40:45 +0800

xcom gravatar image xcom
564 3

updated 2011-03-07 21:44:06 +0800

master as1225

Executions.createComponents(
				"menu/page_activoDialog.zul", toolbar_menu_activo,null);

		Textbox text=(Textbox)Path.getComponent("/main/mainWin/txtb_nuevaRaiz_dispositivo"); 
		String  raiz=text.getValue();
                System.out.print("is value in page modal"+raiz);
	       

is toolbar button call page modal windows, in page modal windows;

<textbox id="txtb_nuevaRaiz_dispositivo" constraint="no empty" value="testRaiz"
				height="12px" width="124px"  visible="true" />

is ok String raiz="testRaiz", is ok vert nice BUT

I AM NEED VARIABLE RAIZ AFTER ON CLICK BUTON ,HOW CAN I EXPECT THE EVENT ONCLICK MODAL WINDOW?????? PLEASE HELPME

<textbox id="txtb_nuevaRaiz_dispositivo" constraint="no empty" 
				height="12px" width="124px"  visible="true" />

so

Executions.createComponents(
				"menu/page_activoDialog.zul", toolbar_menu_activo,null);

		Textbox text=(Textbox)Path.getComponent("/main/mainWin/txtb_nuevaRaiz_dispositivo"); 
		String  raiz=text.getValue();
                System.out.print("is value in page modal"+raiz);

PRINT :Is value in page moda:

SO
,HOW CAN I EXPECT THE EVENT ONCLICK MODAL WINDOW?????? PLEASE HELPME AS1225

link publish delete flag offensive edit

answered 2011-03-07 22:31:06 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Sorry I don't understand your point,
do you mean the "main" window how to know a button in "mainWin" be clicked?

link publish delete flag offensive edit

answered 2011-03-08 02:13:53 +0800

xcom gravatar image xcom
564 3

updated 2011-03-08 02:15:08 +0800

no is point, is point

page_activoDialog.zul is page is modal , have textbox

<?xml version="1.0" encoding="UTF-8"?>
<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"
	xmlns:a="http://www.zkoss.org/2005/zk/annotation"
	xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">
<?page id="activoMenuPage" ?>
	<window id="mainWin" mode="modal" title="Ventana Activo"
		 border="normal" sizable="true" position="left,top"
		closable="true">
		<hbox style="border-style: none;">
			<button id="btn_crearRaiz_dispositivo" label="Crear Raiz"
				context="asignacionPopup" visible="true" />
			<textbox id="txtb_nuevaRaiz_dispositivo" constraint="no empty"
				height="12px" width="124px"  visible="true" />
		</hbox>
		
	</window>
</zk>


so,page_activoDialog.zul is call my main page zul

public void  onClick$btn_option_menu(){

Executions.createComponents(
				"menu/page_activoDialog.zul", toolbar_menu_activo,null);

		Textbox text=(Textbox)Path.getComponent("/main/mainWin/txtb_nuevaRaiz_dispositivo"); 
		String  raiz=text.getValue();
                System.out.print("is value in page modal"+raiz);
}

in raiz variable will not be nothing, because I need to wait until the button is clicked btn_crearRaiz_dispositivo, when you click on the button to be newly stored in the content textbox.getValue() of variable raiz

onClick$btn_option_menu(), s the function that calls modal page, as I get when I call modal page wait until you load the data into the textbox once loaded the variable in the textbox recently returned to evaluate


eg

1 - Function A calls a modal page
2.-function A must wait for it to load something in textbox
3.-In modal page, the user writes in textbox, and you click on accept data
4. When the user did click on accept data, then the main
gets data from the textbox.

that's my point, helpme

link publish delete flag offensive edit

answered 2011-03-08 03:35:28 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Is it you want ?

main.zul

<zk>
	<window id="win" onRecieve="alert(event.getData());">
		<button label="open"
			onClick='Executions.createComponents("page_activoDialog.zul", win,null);'/>
	</window>
</zk>

page_activoDialog.zul

<zk>
	<window title="please input" border="normal" mode="modal">
		<attribute name="onClose"><![CDATA[
			Events.postEvent(new Event("onRecieve",self.getParent(), tb.getValue()));
		]]></attribute>
		<textbox id="tb" />
		<button label="accept" onClick='Events.postEvent(new Event("onClose",self.getParent()));'/>
	</window>
</zk>

onRecieve: you can define your event name, start with "on".
onClose: tell a window to close.

link publish delete flag offensive edit

answered 2011-03-08 13:36:28 +0800

xcom gravatar image xcom
564 3

this solution not work for me, but I found another way to thank you very much anyway and this was my solution

in zul main page

Map<String, Object> mapaParametros = new HashMap<String, Object>();
mapaParametros.put("indexController",this.getController()); //in controller this page zul main
Executions.createComponents(
				"menu/page_activoDialog.zul",null,mapaParametros);

in zul page call

     IndexController indexController= mag.get("indexController")
     .............
                  ..............indexController.functionA(txtbox.getValue());

revisare when I have more time, for the moment it's going pretty well

GRACIAS AS,UN SALUDO DESDE CHILE
THANKS, my friends greeting from chile

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2011-03-07 19:09:39 +0800

Seen: 818 times

Last updated: Mar 08 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More