Class SensorTableDataModel.ImageIconRenderer

  • All Implemented Interfaces:
    java.io.Serializable, javax.swing.CellEditor, javax.swing.table.TableCellEditor, javax.swing.table.TableCellRenderer
    Enclosing class:
    SensorTableDataModel

    static class SensorTableDataModel.ImageIconRenderer
    extends javax.swing.AbstractCellEditor
    implements javax.swing.table.TableCellEditor, javax.swing.table.TableCellRenderer
    Visualize state in table as a graphic, customized for Sensors (2 states). Renderer and Editor are identical, as the cell contents are not actually edited, only used to toggle state using SensorTableDataModel.clickOn(jmri.Sensor).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected char beanTypeChar  
      protected int iconHeight  
      protected javax.swing.JLabel label  
      protected javax.swing.ImageIcon offIcon  
      protected java.lang.String offIconPath  
      protected java.awt.image.BufferedImage offImage  
      protected javax.swing.ImageIcon onIcon  
      protected java.lang.String onIconPath  
      protected java.awt.image.BufferedImage onImage  
      protected java.lang.String rootPath  
      • Fields inherited from class javax.swing.AbstractCellEditor

        changeEvent, listenerList
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object getCellEditorValue()
      java.awt.Component getTableCellEditorComponent​(javax.swing.JTable table, java.lang.Object value, boolean isSelected, int row, int column)
      java.awt.Component getTableCellRendererComponent​(javax.swing.JTable table, java.lang.Object value, boolean isSelected, boolean hasFocus, int row, int column)
      protected void loadIcons()
      Read and buffer graphics.
      javax.swing.JLabel updateLabel​(java.lang.String value, int row, javax.swing.JTable table)  
      • Methods inherited from class javax.swing.AbstractCellEditor

        addCellEditorListener, cancelCellEditing, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, isCellEditable, removeCellEditorListener, shouldSelectCell, stopCellEditing
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface javax.swing.CellEditor

        addCellEditorListener, cancelCellEditing, isCellEditable, removeCellEditorListener, shouldSelectCell, stopCellEditing
    • Field Detail

      • label

        protected javax.swing.JLabel label
      • rootPath

        protected java.lang.String rootPath
      • onIconPath

        protected java.lang.String onIconPath
      • onImage

        protected java.awt.image.BufferedImage onImage
      • offImage

        protected java.awt.image.BufferedImage offImage
      • onIcon

        protected javax.swing.ImageIcon onIcon
      • offIcon

        protected javax.swing.ImageIcon offIcon
    • Method Detail

      • getTableCellRendererComponent

        public java.awt.Component getTableCellRendererComponent​(javax.swing.JTable table,
                                                                java.lang.Object value,
                                                                boolean isSelected,
                                                                boolean hasFocus,
                                                                int row,
                                                                int column)
        Specified by:
        getTableCellRendererComponent in interface javax.swing.table.TableCellRenderer
      • getTableCellEditorComponent

        public java.awt.Component getTableCellEditorComponent​(javax.swing.JTable table,
                                                              java.lang.Object value,
                                                              boolean isSelected,
                                                              int row,
                                                              int column)
        Specified by:
        getTableCellEditorComponent in interface javax.swing.table.TableCellEditor
      • updateLabel

        public javax.swing.JLabel updateLabel​(java.lang.String value,
                                              int row,
                                              javax.swing.JTable table)
      • getCellEditorValue

        public java.lang.Object getCellEditorValue()
        Specified by:
        getCellEditorValue in interface javax.swing.CellEditor