Class ALcdBusyLayerTreeNodeCellRenderer

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
com.luciad.view.gxy.swing.ALcdBusyLayerTreeNodeCellRenderer
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, TreeCellRenderer
Direct Known Subclasses:
TLcdGXYBusyLayerTreeNodeCellRenderer, TLspBusyLayerCellRenderer

public abstract class ALcdBusyLayerTreeNodeCellRenderer extends JComponent implements TreeCellRenderer

This class is a wrapper around a TLcdLayerTreeNodeCellRenderer, adding support for displaying a busy icon to the renderer.

A possible use case is to show another icon in the renderer when a GXY layer is being asynchronously painted. This can be achieved by implementing the abstract methods and using the TLcdGXYAsynchronousLayerMonitor. When the abstract methods indicate the layer is being painted, the icon used in the renderer will be replaced by the painting icon of this renderer. When the layer is not being painted, it will use the delegate renderer.

It extends from JComponent for the sole purpose of satisfying an instanceof check in javax.swing.JTree#updateUI(). Do not rely on this.

Since:
11.0
See Also:
  • Constructor Details

    • ALcdBusyLayerTreeNodeCellRenderer

      public ALcdBusyLayerTreeNodeCellRenderer(TLcdLayerTreeNodeCellRenderer aDelegateRenderer, ILcdIcon aPaintingIcon, ILcdIcon aBusyIcon)

      Wrap a new ALcdBusyLayerTreeNodeCellRenderer around aDelegateRenderer, where the painting icon is aPaintingIcon and the busyicon aBusyIcon. This renderer can only be used on one TLcdLayerTree at the same time. The wrapped TLcdLayerTreeNodeCellRenderer must not be set on another tree.

      Parameters:
      aDelegateRenderer - the renderer which is wrapped
      aPaintingIcon - the icon used to indicate the layer is being painted. The icon is automatically rotated, and assumed to not change its content (e.g. an image icon).
      aBusyIcon - the icon used to indicate the layer is busy. The icon is automatically rotated, and assumed to not change its content (e.g. an image icon).
    • ALcdBusyLayerTreeNodeCellRenderer

      public ALcdBusyLayerTreeNodeCellRenderer(TLcdLayerTreeNodeCellRenderer aDelegateRenderer)

      Wrap a new ALcdBusyLayerTreeNodeCellRenderer around aDelegateRenderer. This renderer can only be used on one TLcdLayerTree at the same time. The wrapped TLcdLayerTreeNodeCellRenderer must not be set on another tree.

      Parameters:
      aDelegateRenderer - the renderer which is wrapped
  • Method Details

    • updateUI

      public void updateUI()
      Overrides:
      updateUI in class JComponent
    • getTreeCellRendererComponent

      public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)
      Specified by:
      getTreeCellRendererComponent in interface TreeCellRenderer
    • updateRendererFromLayer

      protected void updateRendererFromLayer(JTree aTree, ILcdLayer aLayer, boolean aSelected, boolean aExpanded, boolean aLeaf, int aRow, boolean aHasFocus, TLcdLayerTreeNodeCellRenderer aRenderer)

      Update the state of the renderer to match the state of layer aLayer

      Custom overrides of this method should call this method to ensure animations are updated correctly.

      Parameters:
      aTree - the tree which is currently renderer
      aLayer - the layer which state the renderer should match
      aSelected - if true, the cell must be drawn as if selected
      aExpanded - if true, the node is currently expanded
      aLeaf - if true, the node represents a leaf
      aRow - the row number
      aHasFocus - if true, the node currently has focus
      aRenderer - the wrapped renderer
    • layerStateChanged

      protected void layerStateChanged(ILcdLayer aLayer)
      Method which should be called by the implementing class when the result of isLayerOrDescendantBusy(com.luciad.view.ILcdLayer) or isLayerOrDescendantPainting(com.luciad.view.ILcdLayer) changes for aLayer.
      Parameters:
      aLayer - The layer for which the state has changed
    • isLayerOrDescendantBusy

      protected abstract boolean isLayerOrDescendantBusy(ILcdLayer aLayer)
      This method indicates whether or not the passed layer or one of its descendants is busy. The definition of busy can depend on the specific implementation.
      Parameters:
      aLayer - a layer for which the busy state needs to be retrieved.
      Returns:
      true if the layer is busy, false otherwise.
      See Also:
    • isLayerOrDescendantPainting

      protected abstract boolean isLayerOrDescendantPainting(ILcdLayer aLayer)
      This method indicates whether or not the passed layer or one of its descendants is painting. When exactly a layer is painting can depend on the specific implementation.
      Parameters:
      aLayer - a layer for which the painting state needs to be retrieved.
      Returns:
      true if the layer is busy, false otherwise.
      See Also:
    • getDelegateRenderer

      public TLcdLayerTreeNodeCellRenderer getDelegateRenderer()
      Returns the delegate TLcdLayerTreeNodeCellRenderer.
      Returns:
      the delegate TLcdLayerTreeNodeCellRenderer.