Class GDisplayDataTask

java.lang.Object
com.glitchybyte.glib.concurrent.GTask
com.glitchybyte.glib.terminal.display.GDisplayDataTask
All Implemented Interfaces:
Runnable

public final class GDisplayDataTask extends GTask
Task to handle data for panels in a generic way.
  • Constructor Details

    • GDisplayDataTask

      public GDisplayDataTask()
      Creates a display data object.
  • Method Details

    • run

      public void run()
    • registerPanel

      public void registerPanel(String key, GPanel panel)
      Registers a key to a panel.
      Parameters:
      key - Key for data.
      panel - Panel that will be refreshed when data is put on that key.
    • put

      public void put(String key, Object data)
      Puts data on key. Triggering the registered panel to refresh.
      Parameters:
      key - Key for data.
      data - Data.
    • getAs

      public <T> T getAs(String key, Class<T> tClass)
      Returns data as the given type.
      Type Parameters:
      T - Type of data.
      Parameters:
      key - Key for data.
      tClass - Class for data.
      Returns:
      Data as the given type.
    • getAsInt

      public int getAsInt(String key)
      Returns data as int.
      Parameters:
      key - Key for data.
      Returns:
      Data as int.
    • getAsLong

      public long getAsLong(String key)
      Returns data as long.
      Parameters:
      key - Key for data.
      Returns:
      Data as long.
    • getAsFloat

      public float getAsFloat(String key)
      Returns data as float.
      Parameters:
      key - Key for data.
      Returns:
      Data as float.
    • getAsDouble

      public double getAsDouble(String key)
      Returns data as double.
      Parameters:
      key - Key for data.
      Returns:
      Data as double.
    • getAsString

      public String getAsString(String key)
      Returns data as String.
      Parameters:
      key - Key for data.
      Returns:
      Data as String.