Class XMLTable

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, CellEditorListener, ListSelectionListener, RowSorterListener, TableColumnModelListener, TableModelListener, Scrollable
Direct Known Subclasses:
OSPControlTable

public class XMLTable extends JTable
This is a table view of an XML control and its property contents.
Author:
Douglas Brown
See Also:
  • Constructor Details

    • XMLTable

      public XMLTable(XMLControl control)
      Constructor for XMLControl.
      Parameters:
      control - the XMLcontrol
    • XMLTable

      public XMLTable(XMLTableModel model)
      Constructor for XMLTableModel.
      Parameters:
      model - the XMLTableModel
  • Method Details

    • getControl

      public XMLControl getControl()
      Gets the currently displayed XMLControl.
      Returns:
      the XML control
    • setEditable

      public void setEditable(boolean editable)
      Enables/disables editing for the entire table. Overrides the editable property of individual parameters.
      Parameters:
      editable - true to enable editing
    • isEditable

      public boolean isEditable()
      Returns true if editing is enabled for the entire table. If table is editiable, editing can still be disabled for individual parameters.
      Returns:
      true if editable
      See Also:
    • setEditable

      public void setEditable(String propName, boolean editable)
      Enables/disables editing for a specified property name. Properties are editable by default.
      Parameters:
      propName - the property name
      editable - true to enable editing
    • isEditable

      public boolean isEditable(String propName)
      Returns true if editing is enabled for the specified property.
      Parameters:
      propName - the name of the property
      Returns:
      true if editable
    • isCellEditable

      public boolean isCellEditable(int row, int col)
      Determines whether the given cell is editable.
      Overrides:
      isCellEditable in class JTable
      Parameters:
      row - the row index
      col - the column index
      Returns:
      true if editable
    • setFont

      public void setFont(Font font)
      Sets the font. Overrides JTable method
      Overrides:
      setFont in class JComponent
      Parameters:
      font - the font
    • setSelectedColor

      public void setSelectedColor(String propName, Color color)
      Sets the color of a selected cell for a specified property name. May be set to null.
      Parameters:
      propName - the property name
      color - the color of the cell when selected
    • getSelectedColor

      public Color getSelectedColor(String propName)
      Gets the color of a selected cell for a specified property name.
      Parameters:
      propName - the property name
      Returns:
      the color
    • setBackgroundColor

      public void setBackgroundColor(String propName, Color color)
      Sets the background color of the value field for a specified property name. May be set to null.
      Parameters:
      propName - the property name
      color - the color
    • getBackgroundColor

      public Color getBackgroundColor(String propName)
      Gets the background color for a specified property name.
      Parameters:
      propName - the property name
      Returns:
      the color
    • setEditingColor

      public void setEditingColor(String propName, Color color)
      Sets the default color of the editor for a specified property name. May be set to null.
      Parameters:
      propName - the property name
      color - the color of the cell when being edited
    • getEditingColor

      public Color getEditingColor(String propName)
      Sets the color of the editor for a specified property name.
      Parameters:
      propName - the property name
      Returns:
      the color
    • getCellRenderer

      public TableCellRenderer getCellRenderer(int row, int column)
      Returns the renderer for a cell specified by row and column.
      Overrides:
      getCellRenderer in class JTable
      Parameters:
      row - the row number
      column - the column number
      Returns:
      the cell renderer
    • getCellEditor

      public TableCellEditor getCellEditor(int row, int column)
      Returns the editor for a cell specified by row and column.
      Overrides:
      getCellEditor in class JTable
      Parameters:
      row - the row number
      column - the column number
      Returns:
      the cell editor
    • refresh

      public void refresh()
    • tableChanged

      public void tableChanged(TableModelEvent e)
      Specified by:
      tableChanged in interface TableModelListener
      Overrides:
      tableChanged in class JTable
    • addControlListener

      public void addControlListener(String methodName, Object target)
      Adds a listener that invokes the given method in the given object when the xml data changes. The method in the target is invoked with the table's variable name passed as a parameter. The method will be invoked for all parameter changes.
      Parameters:
      methodName - the name of the method
      target - the target for the method
    • addControlListener

      public void addControlListener(String parameterName, String methodName, Object target)
      Adds a listener that invokes the given method in the given object when the xml data changes. The method in the target is invoked with the table's variable name passed as a parameter. The method will be invoked for all parameter changes if the parameter name is null.
      Parameters:
      parameterName - the name of the parameter that will invoke the method
      methodName - the name of the method that will be invoked
      target - the target class for the method