Class AdvancedLookupField

  • All Implemented Interfaces:
    EventChild, IntelligentField, LookupField, Localized, Identifiable, java.io.Serializable, java.lang.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:
    Serialized Form
    • Field Detail

      • POPUP_FIELD_ATTRIBUTE

        public static final java.lang.String POPUP_FIELD_ATTRIBUTE
        Name of the attribute of the form in the popup that contains this field.
        See Also:
        Constant Field Values
    • Constructor Detail

      • AdvancedLookupField

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

        public AdvancedLookupField​(java.lang.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 Detail

      • 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,
                                   java.lang.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 java.util.Set<org.zkoss.zk.ui.Component> getEventtarget​(java.lang.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
      • 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
      • 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
      • 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
      • 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
      • 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.
      • getLimit

        public java.lang.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​(java.lang.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​(java.lang.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
      • setFieldName

        public void setFieldName​(java.lang.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
      • updateAttribute

        public void updateAttribute​(java.lang.String attr,
                                    java.lang.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​(java.lang.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 java.lang.String generateUUID()
        Specified by:
        generateUUID in interface Identifiable
        Returns:
        the generated uuid for the DOM tree
      • 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
      • getPopupFormName

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

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