Class GeometryRulesModel

    • Constructor Detail

      • GeometryRulesModel

        public GeometryRulesModel()
    • Method Detail

      • add

        public void add(GeometryRule rule)
        Parameters:
        rule - ad this rule to the list
      • setRules

        public void setRules(List<GeometryRule> rules)
        Set the rules of the model to the denoted list.
        Parameters:
        rules - the rules to use.
      • removeByIndices

        public void removeByIndices(ArrayList<Integer> indexList)
        Remove the rules denoted by the given list of indices.
        Parameters:
        indexList - a list of list indices. Indices MUST be sorted descending.
      • removeRule

        public void removeRule(GeometryRule rule)
        Remove the denoted rule.
        Parameters:
        rule - the rule to remove.
      • swap

        public void swap(int a,
                         int b)
        Swap the to list items denoted by a and b
        Parameters:
        a - the first item to swap
        b - the seconds item to swap
      • getRules

        public List<GeometryRule> getRules()
        Returns:
        the list of rules in this model
      • getSize

        public int getSize()
      • getElementAt

        public GeometryRule getElementAt(int index)
      • removeListDataListener

        public void removeListDataListener(ListDataListener l)
      • getRuleByName

        public GeometryRule getRuleByName(String name)
        Get the rule denoted by the given name.
        Parameters:
        name - the name to search for.
        Returns:
        the found rule or null.
      • addChangeListener

        public void addChangeListener(GeometryRuleModelListener l)
        Add a listener to be informed about changes to the model.
        Parameters:
        l - the listener to add.
      • removeChangeListener

        public void removeChangeListener(GeometryRuleModelListener l)
        Remove a listener from the list of listeners.
        Parameters:
        l - the listener to remove.
      • refresh

        public void refresh()
        Call this to trigger an event that proclaims a complex change possibly affecting all rules.
      • refresh

        public void refresh(GeometryRule rule)
        Call this to trigger an event that proclaims a change in the denoted rule.
        Parameters:
        rule - the rule that changed.
      • serialize

        public void serialize(TransformerHandler handler)
                       throws SAXException
        Serialize the model to a XML output.
        Parameters:
        handler - the handler to output to.
        Throws:
        SAXException - if a xml error occurs.
      • deserialize

        public static List<GeometryRule> deserialize(SAXParser sax,
                                                     FileInputStream inputStream)
                                              throws SAXException,
                                                     IOException
        Read a GeometryRulesModel from the given Inputstream and SAXParser
        Parameters:
        sax - the parser to use.
        inputStream - the input stream to read from.
        Returns:
        the new list of GeometryRules.
        Throws:
        SAXException - if an error occurred while reading.
        IOException - if an error occurred while reading.