Class AdvancedLookupField

java.lang.Object
org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.impl.XulElement
org.zkoss.zul.Box
org.zkoss.zul.Hbox
com.saperion.ngc.iform.field.lookup.AdvancedLookupField
All Implemented Interfaces:
EventChild, IntelligentField, LookupField, Localized, Identifiable, Serializable, Cloneable, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.ext.Scope, org.zkoss.zk.ui.sys.ComponentCtrl

public class AdvancedLookupField extends org.zkoss.zul.Hbox implements IntelligentField, Identifiable, LookupField
A field for lookup-tables that uses a popup to show a query-form for advanced functionality. A AdvancedLookupField contains an internal field that is used to handle entering and displaying of the actual value(s).
Server-scripts on the query-form can obtain a reference to the current instance of this field by retrieving the attribute POPUP_FIELD_ATTRIBUTE from the form.
See Also:
  • Field Details

  • Constructor Details

    • AdvancedLookupField

      public AdvancedLookupField()
      Constructor to be used when the field is not part of a form.
    • AdvancedLookupField

      public AdvancedLookupField(String formName)
      Constructor to be used when the field is not part of a form.
      Parameters:
      formName - name of the form to open in the popup
    • AdvancedLookupField

      public AdvancedLookupField(com.saperion.ngc.iform.xml.EditFieldType field, com.saperion.ngc.iform.xml.PosType panePosition)
      Constructor to be used when the field is part of a form.
      Parameters:
      field - field definition from the form
      panePosition - position in the form
  • Method Details

    • getInternalField

      public InternalField getInternalField()
      Returns:
      the internal field that is used to enter and display the value(s).
    • setEventtarget

      public void setEventtarget(org.zkoss.zk.ui.Component comp, String eventName)
      Description copied from interface: EventChild
      Set the event target.
      Specified by:
      setEventtarget in interface EventChild
      Parameters:
      comp - Event target
      eventName - Event name or null for main target
    • getEventtarget

      public Set<org.zkoss.zk.ui.Component> getEventtarget(String eventName)
      Description copied from interface: EventChild
      Reads the event target for the given event name, if set or the root element.
      Specified by:
      getEventtarget in interface EventChild
      Parameters:
      eventName - Event name or null for main target
      Returns:
      Set of event targets
    • isNoLocalize

      public boolean isNoLocalize()
      Description copied from interface: Localized
      Returns the noLocalize parameter.
      Specified by:
      isNoLocalize in interface Localized
      Returns:
      noLocalize
    • setNoLocalize

      public void setNoLocalize(boolean noLocalize)
      Description copied from interface: Localized
      Sets the noLocalize parameter that can be used to disable localization of this component.
      Specified by:
      setNoLocalize in interface Localized
      Parameters:
      noLocalize - value
    • doChangeValue

      public void doChangeValue(org.zkoss.zk.ui.event.Event event)
      Specified by:
      doChangeValue in interface IntelligentField
      Parameters:
      event - Event
    • getElementType

      public IntelligentField.ElementType getElementType()
      Description copied from interface: IntelligentField
      Returns the type of this element. The type defines the kind of data and control used for this IntelligentField. See IntelligentField.ElementType for a list of types.
      Specified by:
      getElementType in interface IntelligentField
      Returns:
      Element type
    • getResultBean

      public FieldResultBean getResultBean()
      Description copied from interface: IntelligentField
      Returns a bean containing the current value, type, name and limit of this field.
      Specified by:
      getResultBean in interface IntelligentField
      Returns:
      Result bean
    • onIndexChange

      public void onIndexChange(org.zkoss.zk.ui.event.Event event)
      Description copied from interface: IntelligentField
      Event handler for index changes.
      Specified by:
      onIndexChange in interface IntelligentField
      Parameters:
      event - Event
    • onVariablesAvailable

      public void onVariablesAvailable(org.zkoss.zk.ui.event.Event event)
      Description copied from interface: IntelligentField
      Event handler for variablesAvailableEvent. The event-object sent does not contain data. To retrieve variables, use IntelligentFormView.getIndexMaskDocument().
      Specified by:
      onVariablesAvailable in interface IntelligentField
      Parameters:
      event - Event
    • onCancelEdit

      public void onCancelEdit(org.zkoss.zk.ui.event.Event event)
      Description copied from interface: IntelligentField
      Event handler for cancel edit event.
      Specified by:
      onCancelEdit in interface IntelligentField
      Parameters:
      event - event
    • onCreate

      public void onCreate(org.zkoss.zk.ui.event.Event event)
      Event handler for EventChild.ON_FORM_CREATED event.
      Parameters:
      event - Create event.
    • onPageAttached

      public void onPageAttached(org.zkoss.zk.ui.Page newpage, org.zkoss.zk.ui.Page oldpage)
      Specified by:
      onPageAttached in interface org.zkoss.zk.ui.sys.ComponentCtrl
      Overrides:
      onPageAttached in class org.zkoss.zk.ui.AbstractComponent
    • onPageDetached

      public void onPageDetached(org.zkoss.zk.ui.Page page)
      Specified by:
      onPageDetached in interface org.zkoss.zk.ui.sys.ComponentCtrl
      Overrides:
      onPageDetached in class org.zkoss.zk.ui.AbstractComponent
      See Also:
      • AbstractComponent.onPageDetached(org.zkoss.zk.ui.Page)
    • onOK

      public void onOK(org.zkoss.zk.ui.event.Event event)
      Event handler for Events.ON_OK events.
      Parameters:
      event - OK event.
    • onCtrlKey

      public void onCtrlKey(org.zkoss.zk.ui.event.Event event)
      Event handler for Events.ON_CTRL_KEY events.
      Parameters:
      event - key event
    • setValue

      public void setValue(com.saperion.intf.SaPropertyValue value)
      (@inheritDoc)
      Specified by:
      setValue in interface IntelligentField
      Parameters:
      value - value
      See Also:
    • getPropertyValue

      public com.saperion.intf.SaPropertyValue getPropertyValue()
      Description copied from interface: IntelligentField
      Returns the current value of the field as SaPropertyValue.
      Specified by:
      getPropertyValue in interface IntelligentField
      Returns:
      the field's current value
    • setValueImplicitly

      public void setValueImplicitly(com.saperion.intf.SaPropertyValue value)
      Description copied from interface: IntelligentField
      Sets the value of this field and sets the changed-property of this field to true.
      Specified by:
      setValueImplicitly in interface IntelligentField
      Parameters:
      value - value
    • setChangedImplicitly

      public void setChangedImplicitly()
      Description copied from interface: IntelligentField
      Sets the changed-property of this field to true.
      Specified by:
      setChangedImplicitly in interface IntelligentField
    • setValueImplicitly

      public void setValueImplicitly(com.saperion.intf.SaPropertyValue value, boolean fireChangedEvent)
      Description copied from interface: IntelligentField
      Sets the value of this field and sets the changed-property of this field to true.
      Specified by:
      setValueImplicitly in interface IntelligentField
      Parameters:
      value - value
      fireChangedEvent - if true, a Events.ON_CHANGE event will be fired after the value was set
    • setChangedImplicitly

      public void setChangedImplicitly(boolean fireChangedEvent)
      Description copied from interface: IntelligentField
      Sets the changed-property of this field to true.
      Specified by:
      setChangedImplicitly in interface IntelligentField
      Parameters:
      fireChangedEvent - if true, a Events.ON_CHANGE event will be fired
    • onIndexClear

      public void onIndexClear(org.zkoss.zk.ui.event.Event event)
      Description copied from interface: IntelligentField
      Event handler for index clear.
      Specified by:
      onIndexClear in interface IntelligentField
      Parameters:
      event - Event
    • setEventOnOk

      public void setEventOnOk(ButtonInfo.EventType type)
      Description copied from interface: IntelligentField
      Starts event handling on enter key.
      Specified by:
      setEventOnOk in interface IntelligentField
      Parameters:
      type - Event type
    • isChanged

      public boolean isChanged()
      Description copied from interface: IntelligentField
      Returns true if the value of this field was changed.
      Specified by:
      isChanged in interface IntelligentField
      Returns:
      Value is changed.
    • setDisabled

      public void setDisabled(boolean disabled)
      Description copied from interface: IntelligentField
      Sets the disabled state of this field.
      Specified by:
      setDisabled in interface IntelligentField
      Parameters:
      disabled - Disabled
    • setReadonly

      public void setReadonly(boolean readonly)
      Description copied from interface: IntelligentField
      Sets the readonle state of this field.
      Specified by:
      setReadonly in interface IntelligentField
      Parameters:
      readonly - readonly
    • isReadonly

      public boolean isReadonly()
      gets the readonly state of this field.
      Specified by:
      isReadonly in interface IntelligentField
      See Also:
      • InputElement.setReadonly(boolean)
    • isContentValid

      public boolean isContentValid()
      Description copied from interface: IntelligentField
      Performs a validation and returns true, if the content is valid.
      Specified by:
      isContentValid in interface IntelligentField
      Returns:
      Field content is valid.
    • getFieldName

      public String getFieldName()
      Description copied from interface: IntelligentField
      Returns the name of the field.
      Specified by:
      getFieldName in interface IntelligentField
      Returns:
      Field name
    • getLimit

      public String getLimit()
      Description copied from interface: IntelligentField
      Returns the limit of this field (upper, lower or both).
      Specified by:
      getLimit in interface IntelligentField
      Returns:
      limit
    • setLimit

      public void setLimit(String limit)
      Description copied from interface: IntelligentField
      Sets the limit type. Possible values are: 'lower', 'upper', 'both'.
      Specified by:
      setLimit in interface IntelligentField
      Parameters:
      limit - Limit type
    • getEditField

      public com.saperion.ngc.iform.xml.EditFieldType getEditField()
      Description copied from interface: IntelligentField
      Returns the EditFieldType defining the properties of this field.
      Specified by:
      getEditField in interface IntelligentField
      Returns:
      the edit field
    • setDefaultValue

      public void setDefaultValue(String valueAsString)
      Description copied from interface: IntelligentField
      Sets the default value.
      Specified by:
      setDefaultValue in interface IntelligentField
      Parameters:
      valueAsString - string representation of value
    • setFieldInactive

      public void setFieldInactive(boolean inactive)
      Description copied from interface: IntelligentField
      Sets the fieldInactive parameter. Same as setReadonly(inactive).
      Specified by:
      setFieldInactive in interface IntelligentField
      Parameters:
      inactive - value
    • isFieldInactive

      public boolean isFieldInactive()
      Description copied from interface: IntelligentField
      Returns the fieldInactive parameter.
      Specified by:
      isFieldInactive in interface IntelligentField
      Returns:
      fieldInactive
    • setFieldName

      public void setFieldName(String name)
      Description copied from interface: IntelligentField
      Sets the name of the field. The name is required to be the same as in the database table representing the DDC used.
      Specified by:
      setFieldName in interface IntelligentField
      Parameters:
      name - field name
    • validate

      public void validate()
      Description copied from interface: IntelligentField
      Starts validation of the field.
      Specified by:
      validate in interface IntelligentField
    • clearErrorMessage

      public void clearErrorMessage()
      Description copied from interface: IntelligentField
      Removes the validation error message if present.
      Specified by:
      clearErrorMessage in interface IntelligentField
    • getParentForm

      public IntelligentFormView getParentForm()
      Description copied from interface: IntelligentField
      Returns the parent form or null if this field is not part of a form.
      Specified by:
      getParentForm in interface IntelligentField
      Returns:
      parent form or null
    • updateAttribute

      public void updateAttribute(String attr, Object value)
      Description copied from interface: IntelligentField
      Performs a smartUpdate on the specified attribute.
      Specified by:
      updateAttribute in interface IntelligentField
      Parameters:
      attr - attribute name
      value - attribute value
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface IntelligentField
      Returns:
      true if the field's value is empty.
    • getTypedValue

      public <T> T getTypedValue()
      Returns the typed value of this AdvancedLookupField. This method throws a ClassCastException when the field's value cannot be converted to the specified type. If the field contains no value, this method returns null.
      If this is a non-empty multivalue-field, this method will return a List<T>.
      To get the type of values stored in this field, use the utility-methods in FieldUtil.
      Type Parameters:
      T - generic type parameter
      Returns:
      the field's value as instance of type
    • setTypedValue

      public void setTypedValue(Object value)
      Sets the value of this AdvancedLookupField. If the specified value parameter's type cannot be used by this field, an IllegalArgumentException is thrown. If the specified value is null, the field is cleared.
      Multivalue-fields accept a Collection of typed values.
      Parameters:
      value - value to set
    • setTabindex

      public void setTabindex(int index)
      Description copied from interface: IntelligentField
      Sets the tabindex of this field.
      Specified by:
      setTabindex in interface IntelligentField
      Overrides:
      setTabindex in class org.zkoss.zk.ui.HtmlBasedComponent
      Parameters:
      index - tab index
    • getTabindex

      public int getTabindex()
      Specified by:
      getTabindex in interface IntelligentField
      Overrides:
      getTabindex in class org.zkoss.zk.ui.HtmlBasedComponent
      Returns:
      the tabindex of this field.
    • generateUUID

      public String generateUUID()
      Specified by:
      generateUUID in interface Identifiable
      Returns:
      the generated uuid for the DOM tree
    • getSelectedRow

      public ResultProperties getSelectedRow()
      Description copied from interface: LookupField
      Returns the selected row in the lookup table belonging to this lookup field.
      Specified by:
      getSelectedRow in interface LookupField
      Returns:
      ResultProperties containing the selected row or null, if no row was selected so far
    • clearSelectedRow

      public void clearSelectedRow()
      Description copied from interface: LookupField
      Clears the selected row from the field. The lookup table will not be changed.
      Specified by:
      clearSelectedRow in interface LookupField
    • clear

      public void clear()
      Description copied from interface: IntelligentField
      Clears the value(s) of this field.
      Specified by:
      clear in interface IntelligentField
    • getPopupFormName

      public String getPopupFormName()
      Returns:
      the name of the form that will be displayed in the popup
    • setPopupFormName

      public void setPopupFormName(String popupFormName)
      Sets the name of the form to display in the popup.
      Parameters:
      popupFormName - name of the form to display