All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class Heatmap extends JPanel
A colored interactive heatmap table
See Also:
  • Field Details

  • Constructor Details

    • Heatmap

      public Heatmap(ProjectPanel projectPanel, double panelHeight, double panelWidth, Task task, List<FaceNodeInfo> faceNodeInfoList, TaskService taskService, BatchDistanceHeatmapPanel distanceHeatmapPanel)
      Constructor
      Parameters:
      panelHeight - height of the panel for the heatmap table
      panelWidth - width of the panel for the heatmap table
      task - Task with faces across multiple batch tabs
      faceNodeInfoList - list of faceNodeInfo to give to headers
      distanceHeatmapPanel - control panel for heatmap
  • Method Details

    • getLongestNameLengthInPx

      public int getLongestNameLengthInPx()
      Gets number of pixels the longest cluster short nam takes
      Returns:
      number of pixels the longest cluster short nam takes
    • areHeadersVisible

      public boolean areHeadersVisible()
      Checks if heatmap headers are visible
      Returns:
      headers are visible
    • getCellSize

      public int getCellSize()
    • getMouseColumnHandler

      public MouseColumnHandler getMouseColumnHandler()
      Gets mouse column handler
      Returns:
      mouse column handler
    • removeDendrogram

      public void removeDendrogram()
      Removes dendrogram
    • addDendrogram

      public void addDendrogram()
      Adds dendrogram
    • getDendrogram

      public Dendrogram getDendrogram()
      Gets dendrogram
      Returns:
      dendrogram
    • setRootNode

      public void setRootNode(ClusterNode rootNode)
      Sets root
      Parameters:
      rootNode - node that will become root node
    • setClickedRowColToMinusOne

      public void setClickedRowColToMinusOne()
      Resets the clicked row and column index to -1
    • setClickedHeaderToMinusOne

      public void setClickedHeaderToMinusOne()
      Resets the clicked column header index to -1
    • getRowHeaderTable

      public JTable getRowHeaderTable()
      Gets row header table
      Returns:
      row header table
    • getColumnModel

      public TableColumnModel getColumnModel()
      Gets column model
      Returns:
      column model
    • getPopupMenu

      public PopupMenu getPopupMenu()
      Gets pop up menu
      Returns:
      pop up menu
    • getRowHeader

      public RowHeader getRowHeader()
      Gets row header
      Returns:
      row header
    • getTable

      public JTable getTable()
      Gets table
      Returns:
      table
    • getScrollPane

      public JScrollPane getScrollPane()
      Gets heatmap scroll panel
      Returns:
      scroll panel
    • setDistances

      public void setDistances(double[][] distances)
      Sets distances
      Parameters:
      distances - values to set
    • setTextInHeadersVisible

      public void setTextInHeadersVisible()
      Sets text in headers visible
    • setTextInHeadersInvisible

      public void setTextInHeadersInvisible()
      Sets text in headers invisible
    • setNodeData

      public void setNodeData(List<FaceNodeInfo> faceNodeInfoList)
      Sets node data
      Parameters:
      faceNodeInfoList - data to be set
    • setPanelHeightWidth

      public void setPanelHeightWidth(int height, int width)
      Sets height and width to local values
      Parameters:
      height - height of the heatmap table
      width - width of the heatmap table
    • setHeatmapVisible

      public void setHeatmapVisible()
      Sets heatmap table visible
    • setHeatmapVisibleIfNonVisible

      public void setHeatmapVisibleIfNonVisible()
      Sets heatmap table visible
    • setHeatmapNotVisible

      public void setHeatmapNotVisible()
      Sets heatmap table not visible
    • setBiggestDistance

      public void setBiggestDistance(double biggestDistance)
      Sets biggest distance value of the whole heatmap table
      Parameters:
      biggestDistance - the biggest distance between two faces
    • setOriginalNodeData

      public void setOriginalNodeData(List<FaceNodeInfo> faceNodeInfoList)
      Sets original node data to the same value as node data when created
      Parameters:
      faceNodeInfoList - list of faces names invalid input: '&' indexes
    • setTableSize

      public void setTableSize()
      Sets the table size according to its values - if values are overflowing the heatmap table, the scroll panes activate
    • getCorrespondingColIndex

      public int getCorrespondingColIndex(int row)
      Get a column index of the corresponding row from the table
      Parameters:
      row - index of row that we are working with
      Returns:
      index of column that is same as the row
    • getCorrespondingRowIndex

      public int getCorrespondingRowIndex(int col)
      Get a row index of the corresponding column from the table
      Parameters:
      col - index of column that we are working with
      Returns:
      index of row that is same as the row
    • getStrippedDistances

      public double[][] getStrippedDistances()
      Gets distances of faces that are left (were not hidden) in the heatmap
      Returns:
      2D array of distances of kept faces
    • getLeftNames

      public List<String> getLeftNames()
      Gets names of faces that were left (were not hidden) in the heatmap
      Returns:
      list of kept face names
    • initializeTable

      public void initializeTable(boolean createRowHeader)
      Initialise the table to default settings as after loading the data
    • removeColumn

      public void removeColumn(TableColumnModel columnModel, TableColumn removedColumn, FaceNodeInfo colHeaderData)
      Removes clicked column, adds it to a list of removed rows/columns and resets the table size
      Parameters:
      columnModel - heatmap column model
      removedColumn - clicked colum for removal
      colHeaderData - row header data of removed row
    • removeRow

      public void removeRow(int removedRow, FaceNodeInfo rowHeaderData)
      Removes clicked row, adds it to a list of removed rows/columns and resets the table size
      Parameters:
      removedRow - clicked row for removal
      rowHeaderData - row header data of removed row
    • isHeatmapVisible

      public boolean isHeatmapVisible()
      Gets an info if the heatmap table is visible
      Returns:
      True if the heatmap is visible, false otherwise
    • returnColumnToTable

      public void returnColumnToTable(String returningData)
      Returns wanted column to the heatmap table
      Parameters:
      returningData - the column name that is returned
    • resetRemoved

      public void resetRemoved()
      Clears datasets about removed faces
    • saveValuesToCells

      public void saveValuesToCells()
      Saves values of their cells to corresponding cell
    • resort

      public void resort()
      Resorts rows and columns as they were sorted by clustering algorithm
    • returnRowToTable

      public void returnRowToTable(String returningData)
      Returns wanted row to the heatmap table
      Parameters:
      returningData - the row name that is returned
    • openNewTask

      protected void openNewTask(int clickedRow, int clickedCol, boolean openFirstFace, boolean openSecondFace)