Class TableWidget


  • public class TableWidget
    extends VisibleWidget
    Widget that displays a string table

    The 'value' can be either a VTable or a List<List<String>>. The latter includes 2-D string arrays written by Jython scripts. Note: this class cannot inherit from PVWidget because of the peculiar usage of "runtime value".

    • Field Detail

      • WIDGET_DESCRIPTOR

        public static final org.csstudio.display.builder.model.WidgetDescriptor WIDGET_DESCRIPTOR
        Widget descriptor
      • propColumns

        public static final org.csstudio.display.builder.model.ArrayWidgetProperty.Descriptor<TableWidget.ColumnProperty> propColumns
        'columns' array
    • Constructor Detail

      • TableWidget

        public TableWidget()
    • Method Detail

      • getConfigurator

        public org.csstudio.display.builder.model.WidgetConfigurator getConfigurator​(org.csstudio.display.builder.model.Version persisted_version)
                                                                              throws java.lang.Exception
        Description copied from class: Widget
        Obtain configurator.

        While typically using the default WidgetConfigurator, widget may provide a different configurator for reading older persisted date.

        Overrides:
        getConfigurator in class Widget
        Parameters:
        persisted_version - Version of the persisted data.
        Returns:
        Widget configurator for that version
        Throws:
        java.lang.Exception - if persisted version cannot be handled
      • propBackgroundColor

        public WidgetProperty<org.csstudio.display.builder.model.properties.WidgetColor> propBackgroundColor()
        Returns:
        'background_color' property
      • propForegroundColor

        public WidgetProperty<org.csstudio.display.builder.model.properties.WidgetColor> propForegroundColor()
        Returns:
        'foreground_color' property
      • propFont

        public WidgetProperty<org.csstudio.display.builder.model.properties.WidgetFont> propFont()
        Returns:
        'font' property
      • propToolbar

        public WidgetProperty<java.lang.Boolean> propToolbar()
        Returns:
        'show_toolbar' property
      • propColumns

        public org.csstudio.display.builder.model.ArrayWidgetProperty<TableWidget.ColumnProperty> propColumns()
        Returns:
        'columns' property
      • getHeaders

        public java.util.List<java.lang.String> getHeaders()
        Returns:
        Column headers
      • setHeaders

        public void setHeaders​(java.util.List<java.lang.String> headers)
        Define columns based on column names

        Clears the table, i.e. sets value to empty data.

        Parameters:
        headers - Names of the columns
      • setEditable

        public void setEditable​(int column,
                                boolean editable)
        Set column to be editable (default) or not

        Convenience routine for propColumns()

        Parameters:
        column - Column index, must be 0 .. propColumns().size()-1
        editable - Should column be editable?
      • setColumnWidth

        public void setColumnWidth​(int column,
                                   int width)
        Set width of a column

        Convenience routine for propColumns()

        Parameters:
        column - Column index, must be 0 .. propColumns().size()-1
        width - Column width
      • getColumnOptions

        public java.util.List<java.lang.String> getColumnOptions​(int column)
        Get options for a column's values

        Convenience routine for propColumns()

        Parameters:
        column - Column index, must be 0 .. propColumns().size()-1
        Returns:
        Options that combo editor will present for the cells in that column
      • setColumnOptions

        public void setColumnOptions​(int column,
                                     java.util.List<java.lang.String> options)
        Set options for a column's values

        Convenience routine for propColumns()

        Parameters:
        column - Column index, must be 0 .. propColumns().size()-1
        options - Options to present in combo editor for the cells in that column
      • propPVName

        public WidgetProperty<java.lang.String> propPVName()
        Returns:
        'pv_name' property
      • runtimeValue

        public WidgetProperty<java.lang.Object> runtimeValue()
        Returns:
        Runtime 'value'
      • setValue

        public void setValue​(java.lang.Object data)
        Set value, i.e. content of cells in table

        Convenience routine for runtimeValue(). and converting the data to a 2D list of strings.

        Accepts either a List of rows, where each row is a List of column Strings, or a VTable

        Parameters:
        data - List of rows, or VTable
      • setCellValue

        public void setCellValue​(int row,
                                 int column,
                                 java.lang.String cell_text)
        Set the text of a specific cell

        Convenience routine for updating the value property

        Parameters:
        row - Table row
        column - Table column
        cell_text - Text for that cell.
      • getValue

        public java.util.List<java.util.List<java.lang.String>> getValue()
        Fetch value, i.e. content of cells in table

        Convenience routine for runtimeValue() and converting the data to a 2D list of strings.

        Returns:
        List of rows, where each row is a List of column Strings
      • runtimeCellColors

        public WidgetProperty<java.util.List<java.util.List<org.csstudio.display.builder.model.properties.WidgetColor>>> runtimeCellColors()
        Returns:
        Runtime 'cell_colors'
      • setCellColor

        public void setCellColor​(int row,
                                 int column,
                                 org.csstudio.display.builder.model.properties.WidgetColor color)
        Set the color of a specific cell

        Convenience routine for updating the 'cell_colors' property

        Parameters:
        row - Table row
        column - Table column
        color - Color to use for that cell. null for default.
      • setSelection

        public void setSelection​(java.util.List<java.lang.Integer> rows_cols)
        Select specific cells

        Selects based on a flattened list of (row, col) pairs. Even in "row selection mode" where completed rows are selected instead of individual cells, the list must contain (row, col) data, and col may always be 0.

        Parameters:
        rows_cols - List of row, col, row, col, ..
      • propEditable

        public WidgetProperty<java.lang.Boolean> propEditable()
        Returns:
        'editable' property
      • propRowSelectionMode

        public WidgetProperty<java.lang.Boolean> propRowSelectionMode()
        Returns:
        Misc. 'row_selection_mode'
      • propSelectionPV

        public WidgetProperty<java.lang.String> propSelectionPV()
        Returns:
        Misc. 'selection_pv'
      • runtimePropSelection

        public WidgetProperty<org.epics.vtype.VType> runtimePropSelection()
        Returns:
        Runtime 'selection' property
      • runtimePropSetSelection

        public WidgetProperty<java.util.List<java.lang.Integer>> runtimePropSetSelection()
        Returns:
        Runtime 'set_selection' property