コード例 #1
0
 public void onEvent(Event event) {
   if (Events.ON_SELECT.equalsIgnoreCase(event.getName())) {
     Object newValue = getValue();
     if (isValueChange(newValue)) {
       ValueChangeEvent changeEvent =
           new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
       super.fireValueChange(changeEvent);
       oldValue = newValue;
     }
   } else if (Events.ON_BLUR.equalsIgnoreCase(event.getName())) {
     Comboitem item = getComponent().getSelectedItem();
     if (item == null) {
       setValue(oldValue);
     } else {
       // on select not fire for empty label item
       if (item.getLabel().equals("")) {
         Object newValue = getValue();
         if (isValueChange(newValue)) {
           ValueChangeEvent changeEvent =
               new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
           super.fireValueChange(changeEvent);
           oldValue = newValue;
         }
       }
     }
   }
 }
コード例 #2
0
ファイル: WWFActivity.java プロジェクト: makezjdq/adempiere-1
  public void onEvent(Event event) throws Exception {
    Component comp = event.getTarget();
    String eventName = event.getName();

    if (eventName.equals(Events.ON_CLICK)) {
      if (comp == bZoom) cmd_zoom();
      else if (comp == bOK) {
        Clients.showBusy(Msg.getMsg(Env.getCtx(), "Processing"), true);
        Events.echoEvent("onOK", this, null);
      } else if (comp == fAnswerButton) cmd_button();
    } else if (Events.ON_SELECT.equals(eventName) && comp == listbox) {
      m_index = listbox.getSelectedIndex();
      if (m_index >= 0) display(m_index);
    }
  }