Class ConfigDescriptionModel

  • All Implemented Interfaces:
    Serializable, ListModel

    public class ConfigDescriptionModel
    extends AbstractListModel
    This list model implementation collects all config description entries defined in JFreeReport. This model is used to create a configuration key definition; it directly manipulates the metadata for the keys as stored in the config-description.xml file.
    Author:
    Thomas Morgner
    See Also:
    Serialized Form
    • Constructor Detail

      • ConfigDescriptionModel

        public ConfigDescriptionModel()
        Creates a new, initially empty ConfigDescriptionModel.
    • Method Detail

      • add

        public void add​(ConfigDescriptionEntry entry)
        Adds the given entry to the end of the list.
        Parameters:
        entry - the new entry.
      • remove

        public void remove​(ConfigDescriptionEntry entry)
        Removes the given entry from the list.
        Parameters:
        entry - the entry that should be removed.
      • removeAll

        public void removeAll​(int[] indices)
      • updated

        public void updated()
        Fires an contents changed event for all elements in the list.
      • indexOf

        public int indexOf​(ConfigDescriptionEntry entry)
        Returns the index of the given entry or -1, if the entry is not in the list.
        Parameters:
        entry - the entry whose position should be searched.
        Returns:
        the position of the entry
      • contains

        public boolean contains​(ConfigDescriptionEntry entry)
        Checks whether the given entry is already contained in this list.
        Parameters:
        entry - the entry that should be checked.
        Returns:
        true, if the entry is already added, false otherwise.
      • sort

        public void sort()
        Sorts the entries of the list. Be aware that calling this method does not fire an updat event; you have to do this manually.
      • toArray

        public ConfigDescriptionEntry[] toArray()
        Returns the contents of this model as object array.
        Returns:
        the contents of the model as array.
      • getSize

        public int getSize()
        Returns the length of the list.
        Returns:
        the length of the list
      • getElementAt

        public Object getElementAt​(int index)
        Returns the value at the specified index.
        Parameters:
        index - the requested index
        Returns:
        the value at index
      • importFromConfig

        public void importFromConfig​(org.pentaho.reporting.libraries.base.config.Configuration config)
        Imports all entries from the given report configuration. Only new entries will be added to the list. This does not add report properties supplied via the System.properties.
        Parameters:
        config - the report configuration from where to add the entries.
      • save

        public void save​(OutputStream out,
                         String encoding)
                  throws IOException
        Saves the model into an xml file.
        Parameters:
        out - the target output stream.
        encoding - the encoding of the content.
        Throws:
        IOException - if an error occurs.