Class PropertiesParameterPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class PropertiesParameterPanel extends BasePanel
Displays all properties in a props file as parameters (alphabetically sorted if no custom order for properties provided).
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
  • Field Details

  • Constructor Details

    • PropertiesParameterPanel

      public PropertiesParameterPanel()
  • Method Details

    • initialize

      protected void initialize()
      Initializes the members.
      Overrides:
      initialize in class BasePanel
    • initGUI

      protected void initGUI()
      For initializing the GUI.
      Overrides:
      initGUI in class BasePanel
    • finishInit

      protected void finishInit()
      finishes the initialization.
      Overrides:
      finishInit in class BasePanel
    • clearPropertyTypes

      public void clearPropertyTypes()
      Removes all property/property type relations.
    • clearProperties

      protected void clearProperties()
      Removes all properties.
    • addProperty

      public void addProperty(String identifier, String label, Component comp)
      Adds a property.
      Parameters:
      identifier - the unique identifier of the property
      label - the label to add, the mnemonic to use is preceded by "_"
      comp - the component to add
      Throws:
      IllegalArgumentException - if the identifier already exists
    • addProperty

      public void addProperty(String identifier, String label, AbstractChooserPanel chooser)
      Adds the chooser panel at the end.
      Parameters:
      identifier - the unique identifier of the property
      label - the label to add, the mnemonic to use is preceded by "_"
      chooser - the chooser panel to add
      Throws:
      IllegalArgumentException - if the identifier already exists
    • getProperty

      public Component getProperty(int index)
      Returns the component at the specified location.
      Parameters:
      index - the index of the specified location
      Returns:
      the component at the position
    • getProperty

      public Component getProperty(String identifier)
      Returns the component associated with the identifier.
      Parameters:
      identifier - the identifier of the property to return
      Returns:
      the associated component, null if none found
    • getPropertyCount

      public int getPropertyCount()
      Returns the number of properties currently displayed.
      Returns:
      the number of properties
    • addPropertyType

      public void addPropertyType(String property, PropertiesParameterPanel.PropertyType type)
      Associates the property type with the specified property.
      Parameters:
      property - the property to associate a type with
      type - the property type
    • hasPropertyType

      public boolean hasPropertyType(String property)
      Checks whether a property type has been specified for a particular property.
      Parameters:
      property - the property to associate a type with
      Returns:
      true if a type has been specified
    • getPropertyType

      public PropertiesParameterPanel.PropertyType getPropertyType(String property)
      Checks whether a property type has been specified for a particular property.
      Parameters:
      property - the property to associate a type with
      Returns:
      true if a type has been specified
    • getActualPropertyType

      public PropertiesParameterPanel.PropertyType getActualPropertyType(String property)
      Checks whether a property type has been specified for a particular property.
      Parameters:
      property - the property to associate a type with
      Returns:
      true if a type has been specified
    • setPropertyOrder

      public void setPropertyOrder(String[] value)
      Sets the order for the properties.
      Parameters:
      value - the ordered property names
    • setPropertyOrder

      public void setPropertyOrder(List<String> value)
      Sets the order for the properties.
      Parameters:
      value - the ordered property names
    • getPropertyOrder

      public List<String> getPropertyOrder()
      Returns the order for the properties.
      Returns:
      the ordered property names
    • hasChooser

      public boolean hasChooser(String property)
      Checks whether a chooser has been specified for a particular property.
      Parameters:
      property - the property check
      Returns:
      true if a chooser has been specified
    • setChooser

      public void setChooser(String property, AbstractChooserPanel value)
      Associates the chooser with a particular property.
      Parameters:
      property - the property to associate the chooser with
      value - the chooser to use
    • getChooser

      public AbstractChooserPanel getChooser(String property)
      Returns the chooser associated with a particular property.
      Parameters:
      property - the property to get the chooser for
      Returns:
      the chooser, null if none available
    • hasComponent

      public boolean hasComponent(String property)
      Checks whether a custom component has been specified for a particular property.
      Parameters:
      property - the property check
      Returns:
      true if a custom component has been specified
    • setComponent

      public void setComponent(String property, Component value)
      Associates the custom component with a particular property.\ Must have setText(String) and getText() methods!
      Parameters:
      property - the property to associate the chooser with
      value - the custom component to use
    • getComponent

      public Component getComponent(String property)
      Returns the custom component associated with a particular property.
      Parameters:
      property - the property to get the chooser for
      Returns:
      the custom component, null if none available
    • hasList

      public boolean hasList(String property)
      Checks whether a list has been specified for a particular property.
      Parameters:
      property - the property check
      Returns:
      true if a list has been specified
    • setList

      public void setList(String property, String[] value)
      Associates the list with a particular property.
      Parameters:
      property - the property to associate the list with
      value - the list to use
    • getList

      public String[] getList(String property)
      Returns the list associated with a particular property.
      Parameters:
      property - the property to get the list for
      Returns:
      the list, null if none available
    • hasHelp

      public boolean hasHelp(String property)
      Checks whether a help has been specified for a particular property.
      Parameters:
      property - the property check
      Returns:
      true if a help has been specified
    • setHelp

      public void setHelp(String property, String value)
      Associates the help with a particular property.
      Parameters:
      property - the property to associate the help with
      value - the help to use
    • getHelp

      public String getHelp(String property)
      Returns the help associated with a particular property.
      Parameters:
      property - the property to get the help for
      Returns:
      the help, null if none available
    • hasLabel

      public boolean hasLabel(String property)
      Checks whether a label has been specified for a particular property.
      Parameters:
      property - the property check
      Returns:
      true if a label has been specified
    • setLabel

      public void setLabel(String property, String value)
      Associates the label with a particular property.
      Parameters:
      property - the property to associate the label with
      value - the label to use
    • getLabel

      public String getLabel(String property)
      Returns the label associated with a particular property.
      Parameters:
      property - the property to get the label for
      Returns:
      the label, null if none available
    • fixPropertyType

      Makes sure that the specified property type can be actually displayed.
      Parameters:
      key - the property
      type - the type
      Returns:
      the (potentially) fixed type
    • updateToolTipText

      protected void updateToolTipText(Component comp, String help)
      Updates the tool tip.
      Parameters:
      comp - the component to update
      help - the tip text to use
    • setText

      protected void setText(Component comp, String text)
      Updates the text of the component.
      Parameters:
      comp - the component to update
      text - the text to set
    • getText

      protected String getText(Component comp)
      Returns the text from the component.
      Parameters:
      comp - the component to get the text from
      Returns:
      the obtained text
    • setProperties

      public void setProperties(Properties value)
      Sets the properties to base the properties on.
      Parameters:
      value - the properties to use
    • getProperties

      public Properties getProperties()
      Returns the currently display properties as a properties object.
      Returns:
      the properties
    • getFileChooser

      protected BaseFileChooser getFileChooser()
      Returns the file chooser to use for loading/saving of props files.
      Returns:
      the file chooser
    • loadProperties

      protected void loadProperties()
      Loads properties from a file, prompts the user to select props file.
    • saveProperties

      protected void saveProperties()
      Saves properties to a file, prompts the user to select props file.
    • setButtonPanelVisible

      public void setButtonPanelVisible(boolean value)
      Sets the visibility state of the buttons panel (load/save).
      Parameters:
      value - true if to show buttons
    • isButtonPanelVisible

      public boolean isButtonPanelVisible()
      Returns the visibility state of the buttons panel (load/save).
      Returns:
      true if buttons displayed
    • addChangeListener

      public void addChangeListener(ChangeListener l)
      Adds the change listener.
      Parameters:
      l - the change listener
    • removeChangeListener

      public void removeChangeListener(ChangeListener l)
      Removes the change listener.
      Parameters:
      l - the change listener