Monday, May 27, 2013

ZK Textbox color change

Here i am putting a scenario let us suppose we have a zk textbox and some condition i want the inner color of zk textbox would be differ than the default one(White).How can i create a textbox with some new color inside it? As we know we can extend the ZK components very easily ,to extend any component in Zk what we have to do?
1-Add this entry in lang-addon.xml file...Here we are using textbox so we have to extend ZK textbox.

Here you can see we have component-class so we have to create this class in our project and the contain of this class would be

Here you can see we have all logic inside set method of mandatory variable where i am set the style class for some condition like if mandatory varaible is true then style class would be textbox-color otherwise it would be textbox-non-mandatory-color and these style class would contain ...

Now one question in your mind where we have to put these classes so that out java class file will able o read these files .We can put all our style classes into zk.xml file, let us suppose we have myStyle.css file you have to below entry in the zk.xml file

Now how can we use it in zul

Now it will change the zk textbox color according to mandatory field value.

No comments:

Post a Comment