Class InputTableHelper

java.lang.Object
com.illumon.iris.console.utils.input.InputTableHelper

public class InputTableHelper
extends Object
A Helper Class for performing UI Related Actions on a MutableInputTable.
  • Constructor Details

  • Method Details

    • newElement

      public static void newElement​(MutableInputTable it, @NotNull InputTableStatusListener listener)
      Create and add a new element to the input table. This method will open a dialog and therefore must be invoked on the UI thread,
      Parameters:
      it - The input table to use
      listener - A listener to handle the result of the write.
    • editKey

      public static void editKey​(MutableInputTable it, Table table, int index, @NotNull InputTableStatusListener listener)
      Edit the specified row of the input table, using the parameter table as the source of initial data. This method must be invoked on the UI thread.
      Parameters:
      it - The input table to use
      table - The table containing original data
      index - The row to edit.
      listener - A listener to handle the result of the asynchronous write.
    • copyKey

      public static void copyKey​(MutableInputTable it, Table table, int index, @NotNull InputTableStatusListener listener)
      Copy the specified row of the input table, using the parameter table as the source of initial data. This method must be invoked on the UI thread.
      Parameters:
      it - The input table to use
      table - The table containing original data
      index - The row to edit.
      listener - A listener to handle the result of the asynchronous write.
    • setField

      public static void setField​(MutableInputTable it, Table table, String columnName, int[] rows, @NotNull InputTableStatusListener listener)
      Edit the value of the specified column for all specified rows. This method must be invoked on the UI thread.
      Parameters:
      it - The input table to use
      table - The table containing original data
      columnName - The column to edit.
      rows - The rows to edit.
      listener - A listener to handle the result of the asynchronous write.
    • setField

      public static void setField​(MutableInputTable it, Table table, String columnName, int[] rows, Object newValue, @NotNull InputTableStatusListener listener)
      Set the value of the specified column for all specified rows. This method must be invoked on the UI thread.
      Parameters:
      it - The input table to use
      table - The table containing original data
      columnName - The column to edit.
      rows - The rows to edit.
      newValue - The value to set.
      listener - A listener to handle the result of the asynchronous write.
    • deleteKeysWithAbort

      public static void deleteKeysWithAbort​(com.fishlib.io.logger.Logger log, MutableInputTable it, Table table, Component parentComponent, int... positions)
      Delete the specified rows, after prompting the user. This method must be invoked on the UI thread.
      Parameters:
      log - A log to record results.
      it - The input table to use
      table - The source of data
      parentComponent - The component invoking
      positions - The rows to delete.
    • clipboardAwarePasteMenu

      @NotNull public static JMenuItem clipboardAwarePasteMenu​(Clipboard clipboard, MutableInputTable inputTable, GuiTable guiTable, com.fishlib.io.logger.Logger log)
      Builds a context-aware menu-item or sub-menu for paste based on the current contents of the clipboard
      Parameters:
      clipboard - the system clipboard
      inputTable - the table which is used to identify column-types and targeted for paste-operations
      guiTable - a component to identify error-dialog location
      log - a logger used for potential troubleshooting
      Returns:
      a JMenuItem, which may be a sub-menu providing valid paste-operations for the current clipboard contents
    • pasteRows

      public static void pasteRows​(MutableInputTable inputTable, com.fishlib.io.logger.Logger log, GuiTable guiTable)
      Attempts to paste the contents of the clipboard into an InputTable. If the contents of the clip board parse into rows a dialog will pop up asking the user to confirm the paste.
      Parameters:
      inputTable - the InputTable to paste into
      log - the logger
      guiTable - a component parent for dialogs and defining column-display order