-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3900424
By: korsdal
hey,
i just wondered how to register some csa from java to a component.
can i access the component on the client by its id?
i.e.:
-----------
component.getDesktop().registerClientSideAction("function focus() .... ");
component.setAction("mouseover: focus();");
or event better without any javascript:
component.setAction("mouseover: self.focus();");
------------
i don't know how to focus a component in javascript. probably i need to chnage the z-index.
could anybody help me with that ?
thanks
tim
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3903200
By: henrichen
<zk xmlns:h="http://www.w3.org/1999/xhtml">
<h:script type="text/javascript" src="..."></h:script>
<h:script type="text/javascript">
...
</h:script>
</zk>
Note the src must be full path (include the webapp directory).
The above code would be generated directly into the html page.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3904139
By: korsdal
thanks,
maybe i didn't expressed myself clearly enough, sorry.
where do i have to set the code ?
i don't use any zul, apart from initilising my root-window.
#1. so how can i access a zk-component
in a javascript-function ?
like comp.setAction("mouseover: myFunct('self')"); something like this ?
#2. so probably i should add
<h:script type="text/javascript">
function myFunc(var component) ...
</h:script>
to my initilising and only zul-file ?
thanks
tim
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3904438
By: henrichen
Ok. I see. You want to do it by java program. Here is the way.
import com.potix.zhtml.*;
...
Script script = new Script()
script.setParent(rootwindow); //attach to your rootwindow or to your page by
setPage(mypage)
Text text = new Text();
text.setValue("function myFunc(var component) ..."); text.setParent(script);
...
/henri
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=3904530
By: korsdal
that looks great. i can't remember reading it in the devguide.
thanks for your help.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4328516
By: hklammer
Hi
i am trying to copy something to the (client) clipboard from within a component that is for example derived from a Groupbox. First, is there another way beside JavaScript? I have tried it with JS but was not even luky enough to "find" the JS Method :(
Here is what i tried:
The ZUL file:
<zk>
<script type="text/javascript">
function copyJS(text) {
window.clipboardData.setData('Text', text);
}
</script>
<window title="Testing Window" border="normal">
<groupbox use="LittleTestBox" id="totalbox" open="true" style="border:0px" />
</window>
</zk>
and this is the Groupbox Component "LittleTestBox":
public class LittleTestBox extends Groupbox {
public LittleTestBox() {
Button findButton = new Button("find Method");
findButton.addEventListener(Events.ON_CLICK, new EventListener() {
public boolean isAsap() {
return true;
}
public void onEvent(Event evt) {
findMethod();
}
});
this.appendChild(findButton);
}
private void findMethod() {
String methodName = "copyJS";
java.lang.Class[] argTypes = new java.lang.Class[1];
argTypes[0] = String.class;
Method m1 = this.getPage().getInterpreter("JavaScript").getMethod(methodName,
argTypes);
Method m2 = this.getPage().getZScriptMethod(methodName, argTypes);
System.out.println("M1: "+m1+" M2: "+m2); } }
If i define a method using the zscript-tag then m2 has a value != null (is working) but i don't get any value for m1.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4329686
By: robbiecheng
No, this.getPage().getInterpreter("JavaScript").getMethod(methodName, argTypes); could only retrive those methods defined within zscript. If you want to pass data from javascript to server, please refer to this following how/to.
/Robbie
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4329714
By: robbiecheng
sorry, here is the URL
http://en.wikibooks.org/wiki/ZK/How-Tos#Pass_JavaScript_variable_value_to_ZK_Ser
ver
/Robbie
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4329964
By: hklammer
hmm - i dont want pass data to the server - i just want to run a js function on the client browser from within an java-method of an extended component.
refering to the wiki-example above, how could i invoke the test method in the "runMethod" funcion given below?
<groupbox use="LittleTestBox" id="totalbox" open="true" style="border:0px" />
Implementation of the use groubbox:
public class LittleTestBox extends Groupbox { public LittleTestBox() { Button runButton = new Button("run Method"); runButton.addEventListener(Events.ON_CLICK, new EventListener() { public boolean isAsap() { return true; } public void onEvent(Event evt) { runMethod(); } }); this.appendChild(runButton); }
private void runMethod() {
this.setAction(?????????);
}
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4330100
By: robbiecheng
use Clients.evalJavaScript(runMethod)
/Robbie
Asked: 2006-09-05 17:34:18 +0800
Seen: 1,633 times
Last updated: May 25 '07