Class Optionable

    • Field Detail

      • NOT_NULL_VALUE

        protected static String NOT_NULL_VALUE
        An instance for setAttr to check the default is not a null value.
    • Constructor Detail

      • Optionable

        public Optionable()
    • Method Detail

      • removeOptionDataListener

        public <T extends Optionable> T removeOptionDataListener​(OptionDataListener l)
        Removes the option data listener
      • clearOptonDataListener

        public <T extends Optionable> T clearOptonDataListener()
        Clear up all the option data listeners
      • getClientState

        public void getClientState​(String attr,
                                   org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event> listener)
        Returns a client state after a client callback in the event listener.
      • setAttr

        protected boolean setAttr​(PlotAttribute key,
                                  Object value)
        Sets the value of the attribute name.
        Parameters:
        key - the name of the attribute
        value - the value of the attribute
        Returns:
        boolean true if changed
      • setAttr

        protected <T> boolean setAttr​(PlotAttribute key,
                                      Object value,
                                      T defaultValue)
        Sets the value of the attribute name with the given default value, which is used for comparing the null value case when the default value is not null.
        Parameters:
        key - the name of the attribute
        value - the value of the attribute
        defaultValue - defaultValue for specifying the null value to check whether the value is not the same as T defaultValue
        Returns:
        boolean true if changed
      • setAttr

        protected <T> boolean setAttr​(String strKey,
                                      Object value,
                                      T defaultValue)
        Since:
        10.2.1.0
      • setAttr

        protected <T> boolean setAttr​(PlotAttribute key,
                                      Color value,
                                      T defaultValue)
        Sets the color value of the attribute name with the given default value, which is used for comparing the null value case when the default value is not null.
        Parameters:
        key - the name of the attribute
        value - the value of the color
        defaultValue - defaultValue for specifying the null value to check whether the value is not the same as T defaultValue
        Returns:
        boolean true if changed
      • getAttr

        protected <T> AnyVal<T> getAttr​(PlotAttribute key,
                                        T defaultValue)
        Returns the AnyVal object of the element according to the attribute name. If not found, sets with the given default value, if any.
        Parameters:
        key - the attribute name
        defaultValue - if the value is not found, the defaultValue will be returned.
      • containsKey

        protected boolean containsKey​(PlotAttribute key)
        Returns true if this options contains a mapping for the specified key.
      • removeKey

        protected Object removeKey​(PlotAttribute key,
                                   boolean triggerEvent)
        Removes the mapping for a key from this options if it is present.
      • merge

        protected Optionable merge​(Optionable other)
        Merges the all value from the given object, if the key is the same, the value will be overridden.
        Parameters:
        other -
      • getAttr

        protected Object getAttr​(PlotAttribute key)
        Returns the value of the element according to the attribute name.
        Parameters:
        key - the attribute name.
      • getExtraAttr

        public Object getExtraAttr​(String key)
        Get an attribute by key, if any.
        Returns:
        the value, if any.
      • addExtraAttr

        public Object addExtraAttr​(String key,
                                   org.zkoss.json.JSONAware value)
        Adds an extra attribute to client side, if any.
        Returns:
        the old value, if any.
      • removeExtraAttr

        public Object removeExtraAttr​(String key)
        Removes the extra attribute to client side from the given key, if any.

        Invoking this method won't trigger any event to notify the client side, please use Charts.invalidate() if you want to notify the client side to sync with the value.

        Returns:
        the old value, if any.
      • toJSONString

        public String toJSONString()
        Encodes this object to a JSON string. It is the same as toString().
        Specified by:
        toJSONString in interface org.zkoss.json.JSONAware