Class WebDerivedElementsEditorObject

  • All Implemented Interfaces:
    EnumWebPersistableState, Persistable, WebDerivedElements, EnumDSSXMLReportManipulationMethod

    public class WebDerivedElementsEditorObject
    extends AbstractPersistable
    This class represents derived elements inside derived elements editor. All changes performed by a user inside the editor are kept there until user clicks OK button. Then all accumulated changes are applied to the target template attribute derived elements. To support this we accumulated all generated deltas in a local buffer.
    Since:
    MicroStrategy Web 9.0.0
    • Field Detail

      • allElements

        protected KeyedList allElements
      • isLocal

        protected boolean isLocal
      • linkedObjectName

        protected java.lang.String linkedObjectName
      • domainExpression

        protected com.microstrategy.web.objects.WebExpressionImpl domainExpression
    • Constructor Detail

      • WebDerivedElementsEditorObject

        public WebDerivedElementsEditorObject​(WebAttribute _att)
    • Method Detail

      • hasVisibleList

        public boolean hasVisibleList()
        Indicates whether the template attribute has a list of visible derived elements. If it doesn't then all active derived elements are visible. In this case when the first derived element becomes invisible we must add all other dervied elements to the visible list.
        Specified by:
        hasVisibleList in interface WebDerivedElements
      • populate

        public void populate​(WebDerivedElements src)
        Copies information from the template attribute derived elements
        Parameters:
        src -
      • add

        public void add​(WebDerivedElement de,
                        int position)
        Adds new derived element to a collection
        Specified by:
        add in interface WebDerivedElements
        Parameters:
        de - element
        position - position
      • acceptChanges

        public WebDerivedElement acceptChanges​(WebDerivedElement de)
                                        throws java.lang.IllegalArgumentException
        Generates deltas for changes made to a given element
        Parameters:
        de - WebDerivedElement
        Throws:
        java.lang.IllegalArgumentException - Thrown if element does not exist in the collection
      • saveXMLState

        public void saveXMLState​(XMLStateSerializer stateBuilder,
                                 int howMuchState)
        Saves current state
      • restoreState

        public boolean restoreState​(SAXSupport parser,
                                    java.lang.String uri,
                                    java.lang.String localName,
                                    java.lang.String qName,
                                    org.xml.sax.Attributes attrs)
        Restores current state
        Specified by:
        restoreState in interface Persistable
        Parameters:
        parser - a SAX parser processing the XML representation of a state
        uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed
        localName - The local name (without prefix), or the empty string if Namespace processing is not being performed
        qName - The qualified name (with prefix), or the empty string if qualified names are not available
        attrs - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object
        Returns:
        true to indicate a successful restoration. Otherwise, false will be returned.
      • getAllElements

        public KeyedList getAllElements()
        Returns all elements including "dormant" elements, which were deleted by a user but remaind in the all elements collection because other elements have references to them.
      • newDerivedElement

        public WebDerivedElement newDerivedElement​(int type)
        Creates new derived element
        Parameters:
        type -
      • hasChanges

        public boolean hasChanges()
        Returns true if anything changed
      • applyChanges

        public void applyChanges​(WebDerivedElements target)
        Applies accumulated changes to the target template derived elements
        Parameters:
        target -
      • commitChanges

        public void commitChanges()
        Clears deltas. (We can do this only after we are sure that applying changes on the report or document succeeded).
        Since:
        MicroStrategy Web 9.0.1
      • toKeyedList

        public KeyedList toKeyedList()
        Returns KeyedList of active derived elements
      • importDerivedElement

        public void importDerivedElement​(java.lang.String deId)
        Import standalone derived element. The imported element replaces all existing derived elements.
        Parameters:
        deId -
      • convertToLocalDerivedElement

        public void convertToLocalDerivedElement()
        Converts stand-alone derived elements to local derived elements.
      • acceptVisibleChanges

        public void acceptVisibleChanges()
        Generates deltas for visibility changes made to derived element
      • getDisplayString

        public static java.lang.String getDisplayString​(WebDerivedElement de)
      • setName

        public void setName​(java.lang.String value)
      • setIsLinked

        public void setIsLinked​(boolean isLinked)
      • setIsEditable

        public void setIsEditable​(boolean editable)
        Deprecated.
        Parameters:
        editable -
      • get

        public WebDerivedElement get​(int index)
                              throws java.lang.IndexOutOfBoundsException
        Description copied from interface: WebDerivedElements
        Returns the Derived Element object with the given index.
        Specified by:
        get in interface WebDerivedElements
        Parameters:
        index - The index of the element in the collection.
        Returns:
        The Derived Element object corresponding to the given index in the collection.
        Throws:
        java.lang.IndexOutOfBoundsException - Thrown if the given index is out of the bounds of the collection.
      • get

        public WebDerivedElement get​(java.lang.String id)
                              throws java.lang.IllegalArgumentException
        Description copied from interface: WebDerivedElements
        Returns a Derived Element object with the given id, if it exists.
        Specified by:
        get in interface WebDerivedElements
        Parameters:
        id - The key of the element to search for in the collection.
        Returns:
        A Derived Element object in the collection corresponding to the given key.
        Throws:
        java.lang.IllegalArgumentException - Thrown if the element with the given id does not exist in the collection.
      • indexOf

        public int indexOf​(java.lang.String id)
        Description copied from interface: WebDerivedElements
        Finds the index of Derived Element with the given id.
        Specified by:
        indexOf in interface WebDerivedElements
        Parameters:
        id - String
        Returns:
        index or -1 if element not found.
      • getCreateAllElements

        protected KeyedList getCreateAllElements()
      • remove

        public WebDerivedElement remove​(int index)
                                 throws java.lang.UnsupportedOperationException,
                                        java.lang.IndexOutOfBoundsException
        Description copied from interface: WebDerivedElements
        Removes a derived element located in the index position.
        Specified by:
        remove in interface WebDerivedElements
        Parameters:
        index - position
        Returns:
        Removed derived element
        Throws:
        java.lang.IndexOutOfBoundsException - if index is out of bounds
        java.lang.UnsupportedOperationException
      • moveTo

        public void moveTo​(java.lang.String id,
                           int position)
        Description copied from interface: WebDerivedElements
        Moves spesified Derived Element to specify position
        Specified by:
        moveTo in interface WebDerivedElements
        Parameters:
        id - element ID
        position - new position
      • remove

        public WebDerivedElement remove​(java.lang.String id)
                                 throws java.lang.UnsupportedOperationException
        Description copied from interface: WebDerivedElements
        Removes the Derived Element object with the given id from the collection;
        Specified by:
        remove in interface WebDerivedElements
        Parameters:
        id - The element id.
        Throws:
        java.lang.UnsupportedOperationException
      • clear

        public void clear()
                   throws java.lang.UnsupportedOperationException
        Description copied from interface: WebDerivedElements
        Removes all Derived Elements from the collection.
        Specified by:
        clear in interface WebDerivedElements
        Throws:
        java.lang.UnsupportedOperationException
      • size

        public int size()
        Description copied from interface: WebDerivedElements
        Returns the number of elements currently in the collection.
        Specified by:
        size in interface WebDerivedElements
        Returns:
        The current number of elements in the collection.
      • contains

        public boolean contains​(java.lang.String id)
        Description copied from interface: WebDerivedElements
        Returns true if the Derived Element with the given id exists in the collection.
        Specified by:
        contains in interface WebDerivedElements
        Parameters:
        id - The Derived Element ID.
        Returns:
        Whether the element with the given id exists in the collection.
      • elements

        public java.util.Enumeration elements()
        Description copied from interface: WebDerivedElements
        Returns a java.util.Enumeration which can be used to iterate through the list of elements in the collection.
        Specified by:
        elements in interface WebDerivedElements
        Returns:
        An Enumeration which allows iteration through the collection.
      • saveXMLState

        protected void saveXMLState​(WebXMLBuilder builder,
                                    int howMuchState)