Interface DFItem

    • Method Detail

      • getId

        java.lang.String getId()
        Returns an ID for the item, something by which it can be identified. Potentially two different databases could contain information about the same entity. There should be always only one valid instance of the same ID. It is implementation's responsibility to generate ID big enough to be unique.

        Note that multiple items with the same ID may created, e.g. by replicating the Schema.

        Returns:
        The ID of this item
      • getName

        java.lang.String getName()
        Getter for property name. Name is the display name that is seen by the user. The name should be a single line String as most of UI present the name in single line visual components (tree items, lists, text fields...).
        Returns:
        Value of property name.
      • setName

        void setName​(java.lang.String name,
                     com.im.commons.progress.DFEnvironmentRW env)
        Setter for property name.
        Parameters:
        name - New value of property name.
      • getDescription

        java.lang.String getDescription()
        Provides a description of the DFItem. Initialy null (not set), may be an arbitrary string, usually a description set by the DFSchema creator for better understanding of the DFSChema contents by DIF users.
        Returns:
        The description, or null if none is set.
      • setDescription

        void setDescription​(java.lang.String description,
                            com.im.commons.progress.DFEnvironmentRW env)
        Sets the description. Passing null will clear the description. The DFItem must be locked, and the DFLock passed in the 'env'.
        Parameters:
        description - The new description or null
        env - The environment
      • getType

        java.lang.String getType()
        Getter for property type. This is code name (not human readable string), which represents the type of instance (usually main type implementation name with combination of capabilities). The value can change during lifetime of DFItem instance (e.g. when converting field to a different type). The well know values should be part of each implementations documentation.
        Returns:
        Value of property name.
      • getCapabilities

        java.util.List<DFCapability> getCapabilities()
        Get list of all capabilities of this DFItem. Check DIFUtilities to get convenience methods, for example method which find an appropriate DFCapability of the given class. The list of capabilities can change during DFItem lifetime and so you should listen to PROP_CAPABILITIES changes.
      • isValid

        boolean isValid()
        Return the validity of this item. The item becomes invalid when it's removed from it's parent or when it's parent become invalid. It's possible to listen to changes of this flag. It's impossible for invalid object to become valid again. When object become invalid, all changes are ignored (are not persistent) and DFItem's method calls can throw unpredictable exceptions.
      • addPropertyChangeListener

        void addPropertyChangeListener​(java.beans.PropertyChangeListener listener)
        Registers PropertyChangeListener to receive events. This registration method can be used also for property change events fired from all DFItem's capabilities. It's recommended to use weak listeners when listening to DFItems property changes.
        Parameters:
        listener - The listener to register.
      • removePropertyChangeListener

        void removePropertyChangeListener​(java.beans.PropertyChangeListener listener)
        Removes PropertyChangeListener from the list of listeners.
        Parameters:
        listener - The listener to remove.
      • getHandle

        DFItem.Handle<? extends DFItem> getHandle()
        Returns a handle to the Item. The handle uniquely identifies the Item, even though the schema data may be copied or otherwise replicated. Use the Handle instead of DFItem.getId() when registering an Item in collections that extend beyond the DFItem's parent Schema.
        Returns:
        The handle to the DFItem.