1

Zk Any Interface with setModel method

asked 2016-03-28 20:36:33 +0800

javiut gravatar image javiut flag of Venezuela, Bolivarian Republic of
90 1 5

updated 2016-03-28 20:37:15 +0800

I have a method with a lot of bussiness logic and the first parameter is a Combobox i need the exact same logic but now with a chosen box i think if combobox and chosenbox would share a interface with setModel method would solve my problem something like

public interface ModelAble 
{
    public void setModel(ListModel<?> model);
}

Would solve my problem using ModelAble in my model and Combobox and Chosenbox would work very easy but any interface works for both? i need setModel method because is the way i put the data into both Components any workaround.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-04-11 08:01:39 +0800

chillworld gravatar image chillworld flag of Belgium
5367 4 9
https://github.com/chillw...

updated 2016-04-11 08:01:58 +0800

Oke,

You can solve this problem really easy.
First of all, make your interface.

Second, make a class who extends Combobox and implements your interface.
Of course same for the Chosenbox.

The next is overriding ZK default class behind this components (in lang-addon.xml) :

<component>
    <component-name>button</component-name>
    <extends>button</extends>
    <component-class>my.path.MyCombobox</component-class>
</component>

Nothing in your application changes, just the implementation will be referring to your own class, with the extra interface.

Greetz chill.

link publish delete flag offensive edit
Your answer
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
1 follower

RSS

Stats

Asked: 2016-03-28 20:36:33 +0800

Seen: 25 times

Last updated: Apr 11 '16

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