Revision history [back]

click to hide/show revision 1
initial version

answered 2013-12-04 01:07:24 +0800

dennis gravatar image dennis

http://www.javaworld.com....

if you are using MVC pattern, then you have to do that manually one by one. but if you are using MVVM, then binder could help you to reload them by sending a notify-change. for example. <label value="@load(myMsgPool.message_key)"/>

After local change, you just post notify change by BindUtils.postNotifyChange(null,null,myMsgPool,"*");

about MVVM, read this http://books.zkoss.org/wiki/ZKDeveloper'sReference/MVVM

if you are using MVC pattern, then you have to do that manually one by one. but if you are using MVVM, then binder could help you to reload them by sending a notify-change. for example. <label value="@load(myMsgPool.message_key)"/>

After local change, you just post notify change by BindUtils.postNotifyChange(null,null,myMsgPool,"*");

myMsgPool is a simple object instance that wrap the static Labels in the viewModel

about MVVM, read this http://books.zkoss.org/wiki/ZKDeveloper'sReference/MVVM

if you are using MVC pattern, then you have to do that manually one by one. but if you are using MVVM, then binder could help you to reload them by sending a notify-change. for example. <label value="@load(myMsgPool.message_key)"/>

After local change, you just post notify change by BindUtils.postNotifyChange(null,null,myMsgPool,"*");

myMsgPool is a simple object instance that wrap the static Labels in the viewModel

about MVVM, read this http://books.zkoss.org/wiki/ZKDeveloper'sReference/MVVM

For the myMsgPool, you can just use a delegater that implement get api for Map. for example

public class LabelsWrap implements Map<String, String>{


    @Override
    public String get(Object key) {
        return Labels.getLabel(key.toString());
    }

    @Override
    public int size() {
        return 0;
    }

    @Override
    public boolean isEmpty() {
        return false;
    }

    @Override
    public boolean containsKey(Object key) {
        return get(key)!=null;
    }

    @Override
    public boolean containsValue(Object value) {
        return false;
    }


    @Override
    public String put(String key, String value) {
        throw new UnsupportedOperationException();
    }

    @Override
    public String remove(Object key) {
        throw new UnsupportedOperationException();
    }

    @Override
    public void putAll(Map<? extends String, ? extends String> m) {
        throw new UnsupportedOperationException();
    }

    @Override
    public void clear() {
        throw new UnsupportedOperationException();
    }

    @Override
    public Set<String> keySet() {
        throw new UnsupportedOperationException();
    }

    @Override
    public Collection<String> values() {
        throw new UnsupportedOperationException();
    }

    @Override
    public Set<java.util.Map.Entry<String, String>> entrySet() {
        throw new UnsupportedOperationException();
    }

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