Ejemplo n.º 1
0
  public void setValue(Object value) {
    if (value != null && (value instanceof Integer || value instanceof String)) {

      getComponent().setValue(value);
      if (!getComponent().isSelected(value)) {
        if (isReadWrite() && lookup != null) lookup.refresh();
        Object curValue = oldValue;
        oldValue = value;
        refreshList();

        // still not in list, reset to zero
        if (!getComponent().isSelected(value)) {
          if (value instanceof Integer && (Integer) value == 0) {
            getComponent().setValue(null);
            if (curValue == null) curValue = value;
            ValueChangeEvent changeEvent =
                new ValueChangeEvent(this, this.getColumnName(), curValue, null);
            super.fireValueChange(changeEvent);
            oldValue = null;
          }
        }
      } else {
        oldValue = value;
      }
    } else {
      getComponent().setValue(null);
      oldValue = value;
    }
  }
Ejemplo n.º 2
0
  private void init() {
    getComponent().setWidth("200px");
    getComponent().setAutocomplete(true);
    getComponent().setAutodrop(true);
    getComponent().addEventListener(Events.ON_BLUR, this);

    boolean zoom = false;
    if (lookup != null) {
      lookup.addListDataListener(this);
      // always need the empty item for zk to work correctly
      lookup.setMandatory(false);

      if ((lookup.getDisplayType() == DisplayType.List
              && Env.getContextAsInt(Env.getCtx(), "#AD_Role_ID") == 0)
          || lookup.getDisplayType() != DisplayType.List) {
        zoom = true;
      }

      // no need to refresh readonly lookup
      if (isReadWrite()) lookup.refresh();
      refreshList();
      actionRefresh();
    }

    if (mField != null) {
      popupMenu = new WEditorPopupMenu(zoom, true, true);
      if (mField != null && mField.getGridTab() != null) {
        WFieldRecordInfo.addMenu(popupMenu);
      }
      getComponent().setContext(popupMenu.getId());
    }
  }
Ejemplo n.º 3
0
  public void actionRefresh() {
    if (lookup != null) {
      Object curValue = getValue();

      if (isReadWrite()) {
        lookup.refresh();
        lookup.fillComboBox(isMandatory(), true, true, false, false);
      }
      refreshList();
      //            if (curValue != null)
      //            {
      setValue(curValue);
      //            }
    }
  }