Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
548 views
in Technique[技术] by (71.8m points)

selenium - Implementing static ID generator in java

I found this open source Static ID Generator java code in https://github.com/zkoss/zk/blob/master/zk/src/org/zkoss/zk/ui/impl/StaticIdGenerator.java

Mu question is, how do I try it? After having a static id generator and adding the configurations in the zk.xml, what's next? How will I be able to run it and get the generated ids?

Thank you so much.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You do not need to "run it". If you specify a custom ID generator in the configuration (zk.xml), the zk application you run will use it to automatically create a new ID for every widget on the client. Using a static ID generator just makes sure that the IDs are always created in the same sequence, the default one is somewhat random.

You can see the IDs in the browser (in the developer console, the html tree will show you the "id" attributes of certain elements). You can also access them by Component.getUuid().

By the way, there is also a built-in implementation of a static ID generator: org.zkoss.zk.ui.impl.StaticIdGenerator. Read zk's testing tipps, they mention it there and also explain why you would use it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...