Class ArrayPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, PropertyChangeListener, Serializable, EventListener, Accessible, Data

public class ArrayPanel extends JPanel implements PropertyChangeListener, Data
A panel that displays an ArrayTable.
Version:
1.0
Author:
Douglas Brown, Wolfgang Christian
See Also:
  • Constructor Details

    • ArrayPanel

      public ArrayPanel()
      Constructor ArrayPanel
  • Method Details

    • getArrayPanel

      public static ArrayPanel getArrayPanel(Object arrayObj)
    • setArray

      public void setArray(Object arrayObj)
      Gets an array panel for the specified array.
      Parameters:
      arrayObj - the array
      name - the display name for the array
    • canDisplay

      public static boolean canDisplay(Object obj)
      Determines if an object is an array that can be displayed.
      Parameters:
      obj - the object
      Returns:
      true if it can be inspected
    • getArray

      public Object getArray()
      Gets the object being displayed.
      Returns:
    • propertyChange

      public void propertyChange(PropertyChangeEvent e)
      Listens for cell events (data changes) from ArrayTable.
      Specified by:
      propertyChange in interface PropertyChangeListener
      Parameters:
      e - the property change event
    • setNumericFormat

      public void setNumericFormat(String _format)
      Sets the same numeric display format for all columns
      Parameters:
      _format - String
    • setNumericFormat

      public void setNumericFormat(String[] _format)
      Sets the numeric display format for each column
      Parameters:
      _format - String[]
    • setRowNumberVisible

      public void setRowNumberVisible(boolean vis)
      Sets the display row number flag. Table displays row number.
      Parameters:
      vis - true<\code> if table display row number
    • setColumnNames

      public void setColumnNames(String[] names)
      Sets the column names in the table models.
      Parameters:
      names -
    • setColumnNames

      public void setColumnNames(String[][] names)
      Sets the column names in each table model separately.
      Parameters:
      names -
    • setPreferredColumnWidth

      public void setPreferredColumnWidth(int ncol, int nwidth)
      Sets this column's preferred width of the given column. The minimum width is set to zero and the maximum width is set to 300.
      Parameters:
      ncol - the column
      nwidth - the preferred width
    • setPreferredColumnWidth

      public void setPreferredColumnWidth(int nwidth)
      Sets this column's preferred width of the entire table. The minimum width is set to zero and the maximum width is set to 300.
      Parameters:
      nwidth - the preferred width
    • setColumnAlignment

      public void setColumnAlignment(int ncol, int align)
      Sets the alignment of the contents of the given column along the X axis. The alignment constants are defined in the SwingConstants class.
      Parameters:
      ncol - the column
      align - One of the following constants defined in SwingConstants: LEFT, CENTER (the default for image-only labels), RIGHT, LEADING (the default for text-only labels) or TRAILING.
    • setColumnAlignment

      public void setColumnAlignment(int align)
      Sets the alignment of the contents of all table columns along the X axis. The alignment constants are defined in the SwingConstants class.
      Parameters:
      align - One of the following constants defined in SwingConstants: LEFT, CENTER (the default for image-only labels), RIGHT, LEADING (the default for text-only labels) or TRAILING.
    • getFirstRowIndex

      public int getFirstRowIndex()
    • setFirstRowIndex

      public void setFirstRowIndex(int index)
      Sets the first row's index.
      Parameters:
      index -
    • setFirstColIndex

      public void setFirstColIndex(int index)
      Sets the first column's index.
      Parameters:
      index -
    • setColumnLock

      public void setColumnLock(int columnIndex, boolean locked)
      Sets the column's lock flag.
      Parameters:
      column - int
      locked - boolean
    • setColumnLocks

      public void setColumnLocks(boolean[] locked)
      Sets the lock flag for multiple columns. Previously set locks are cleared.
      Parameters:
      locked - boolean array
    • setEditable

      public void setEditable(boolean _editable)
      Sets the editable property for the entire panel.
      Parameters:
      editable - true to allow editing of the cell values
    • setTransposed

      public void setTransposed(boolean transposed)
      Sets the transposed property for the array. A transposed array switches its row and column values in the display.
      Parameters:
      transposed -
    • setFont

      public void setFont(Font font)
      Sets the font for this component.
      Overrides:
      setFont in class JComponent
      Parameters:
      font - the desired Font for this component
      See Also:
    • setForeground

      public void setForeground(Color color)
      Sets the foreground color of this component. It is up to the look and feel to honor this property, some may choose to ignore it.
      Overrides:
      setForeground in class JComponent
      Parameters:
      fg - the desired foreground Color
      See Also:
    • setBackground

      public void setBackground(Color color)
      Sets the background color of this component. It is up to the look and feel to honor this property, some may choose to ignore it.
      Overrides:
      setBackground in class JComponent
      Parameters:
      fg - the desired background Color
      See Also:
    • setDataForeground

      public void setDataForeground(Color color)
      Sets the data foreground color of this component. It is up to the look and feel to honor this property, some may choose to ignore it.
      Parameters:
      fg - the desired foreground Color
    • setDataBackground

      public void setDataBackground(Color color)
      Sets the data background color of this component. It is up to the look and feel to honor this property, some may choose to ignore it.
      Parameters:
      fg - the desired background Color
      See Also:
    • setAutoResizeMode

      public void setAutoResizeMode(int mode)
      Sets the table's auto resize mode when the table is resized.
      Parameters:
      mode - One of 5 legal values: AUTO_RESIZE_OFF, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_SUBSEQUENT_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_ALL_COLUMNS
    • getNumColumns

      public int getNumColumns()
    • refreshTable

      public void refreshTable()
      Refresh the data in all the tables.
    • setRefreshDelay

      public void setRefreshDelay(int delay)
      Sets the Timer's initial time delay (in milliseconds) to wait after the timer is started before firing the first event.
      Parameters:
      delay -
    • createGUI

      protected void createGUI()
      Creates the GUI.
    • getColumnNames

      public String[] getColumnNames()
      Gets column names from Table Model. Implementation of Data interface.
      Specified by:
      getColumnNames in interface Data
      Returns:
      an array of names
    • getData2D

      public double[][] getData2D()
      Gets double[][] data from the Table Model and transposes this array if necessary. Implementation of Data interface.
      Specified by:
      getData2D in interface Data
      Returns:
      double[][]
    • getData3D

      public double[][][] getData3D()
      Not used because double[][][] is not used in any OSP Tools. Implementation of Data interface method.
      Specified by:
      getData3D in interface Data
      Returns:
      double[][][]
    • getDataList

      public List<Data> getDataList()
      Not used because Data is stored in this object, not in a list of Data objects. Implementation of Data interface.
      Specified by:
      getDataList in interface Data
      Returns:
      a list of Data objects, or null if this object contains data
    • getDatasets

      public ArrayList<Dataset> getDatasets()
      Not used Data because is stored in 2D arrays. Implementation of Data interface.
      Specified by:
      getDatasets in interface Data
      Returns:
      list of Datasets
    • getFillColors

      public Color[] getFillColors()
      Fill colors for columns are not specified. Client should assign colors. Implementation of Data interface.
      Specified by:
      getFillColors in interface Data
      Returns:
      a color
    • getLineColors

      public Color[] getLineColors()
      Lines colors for columns are not specified. Client should assign colors. Implementation of Data interface.
      Specified by:
      getLineColors in interface Data
      Returns:
      a color
    • getID

      public int getID()
      Gets the Data ID.
      Specified by:
      getID in interface Data
      Returns:
      the ID number
    • setID

      public void setID(int id)
      Sets the Data ID.
      Specified by:
      setID in interface Data
      Parameters:
      id - the ID number