Class CacheComponent

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener, CacheListener

public class CacheComponent extends JPanel implements ActionListener, CacheListener, ChangeListener
GUI component for managing a cache.
See Also:
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • SOURCES

      protected static final String[] SOURCES
    • SOURCE_VALUES

      protected static final Class[] SOURCE_VALUES
    • SOURCE_PARAMS

      protected static final Class[] SOURCE_PARAMS
    • STRATEGIES

      protected static final String[] STRATEGIES
    • STRATEGY_VALUES

      protected static final Class[] STRATEGY_VALUES
    • STRATEGY_PARAMS

      protected static final Class[] STRATEGY_PARAMS
    • PRIORITIES

      protected static final String[] PRIORITIES
    • PRIORITY_VALUES

      protected static final int[] PRIORITY_VALUES
    • ORDERS

      protected static final String[] ORDERS
    • ORDER_VALUES

      protected static final int[] ORDER_VALUES
    • cache

      private Cache cache
      The cache that this component controls.
    • sourceChooser

      private JComboBox sourceChooser
      Combo box for choosing cache source.
    • strategyChooser

      private JComboBox strategyChooser
      Combo box for choosing cache strategy.
    • range

      private JSpinner[] range
      Spinners for choosing range of slices to cache.
    • priority

      private JComboBox[] priority
      Combo boxes for choosing axis priority.
    • order

      private JComboBox[] order
      Combo boxes for choosing planar ordering.
    • id

      private String id
      File name that the cache is working with (debugging only).
    • lengths

      private int[] lengths
      Length of each dimensional axis, obtained from cache strategy.
  • Constructor Details

    • CacheComponent

      public CacheComponent(Cache cache, String[] axisLabels)
      Creates a cache GUI component.
    • CacheComponent

      public CacheComponent(Cache cache, String[] axisLabels, String id)
      Creates a cache GUI component with the ability to change between the various source types (mainly for debugging purposes).
  • Method Details

    • getCache

      public Cache getCache()
    • dispose

      public void dispose()
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Handles combo box changes.
      Specified by:
      actionPerformed in interface ActionListener
    • cacheUpdated

      public void cacheUpdated(CacheEvent e)
      Updates GUI to match latest cache state.
      Specified by:
      cacheUpdated in interface CacheListener
    • stateChanged

      public void stateChanged(ChangeEvent e)
      Handles range spinner changes.
      Specified by:
      stateChanged in interface ChangeListener
    • updateSource

      private void updateSource()
      Updates cache source to match the state of the GUI.
    • updateStrategy

      private void updateStrategy()
      Updates cache strategy to match the state of the GUI.
    • updateRange

      private void updateRange(int index)
      Updates cache range to match the state of the GUI.
    • updatePriority

      private void updatePriority(int index)
      Updates cache priority to match the state of the GUI.
    • updateOrder

      private void updateOrder(int index)
      Updates cache order to match the state of the GUI.
    • sourceIndex

      private int sourceIndex(ICacheSource s)
      Converts cache source to source chooser index.
    • sourceValue

      private ICacheSource sourceValue(int index)
      Generates a new cache source matching the source chooser index.
    • strategyIndex

      private int strategyIndex(ICacheStrategy s)
      Converts cache strategy to strategy chooser index.
    • strategyValue

      private ICacheStrategy strategyValue(int index)
      Generates a new cache strategy matching the strategy chooser index.
    • priorityIndex

      private int priorityIndex(int prio)
      Converts enumerated priority value to priority chooser index.
    • priorityValue

      private int priorityValue(int index)
      Converts priority chooser index to enumerated priority value.
    • orderIndex

      private int orderIndex(int ord)
      Converts enumerated order value to order chooser index.
    • orderValue

      private int orderValue(int index)
      Converts order chooser index to enumerated order value.