Package jfix.zk

Source Code of jfix.zk.Combobox

package jfix.zk;

import java.util.List;

import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.ListModelList;

import jfix.util.Validations;

public class Combobox extends org.zkoss.zul.Combobox {

  public Combobox() {
    setHflex("1");
  }

  public void setSelection(List values, String selected) {
    setModel(new ListModelList(values));
    if (selected != null) {
      setValue(selected);
    }
  }

  public boolean isEmpty() {
    return Validations.isEmpty(getValue());
  }

  public void addSelectListener(final ActionListener actionListener) {
    addEventListener(Events.ON_SELECT, new EventListener() {
      public void onEvent(Event e) throws Exception {
        actionListener.actionPerformed(e);
      }
    });
  }

}
TOP

Related Classes of jfix.zk.Combobox

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.