Class StepVisual

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
NoteVisual

public class StepVisual extends JPanel
Class for managing the appearance of a step in the GUI Knowledge Flow environment.
Version:
$Revision: $
Author:
Mark Hall (mhall{[at]}pentaho{[dot]}com)
See Also:
  • Field Details

  • Method Details

    • createVisual

      public static StepVisual createVisual(StepManagerImpl stepManager)
      Create a visual for the step managed by the supplied step manager. Uses the icon specified by the step itself (via the KFStep annotation)
      Parameters:
      stepManager - the step manager for the step to create a visual wrapper for
      Returns:
      the StepVisual that wraps the step
    • createVisual

      public static StepVisual createVisual(StepManagerImpl stepManager, ImageIcon icon)
      Create a visual for the step managed by the supplied step manager using the supplied icon.
      Parameters:
      stepManager - the step manager for the step to create a visual wrapper for
      icon - the icon to use in the visual
      Returns:
      the StepVisual that wraps the step
    • iconForStep

      public static ImageIcon iconForStep(Step step)
      Gets the icon for the supplied Step.
      Parameters:
      step - the step to get the icon for
      Returns:
      the icon for the step
    • loadIcon

      public static ImageIcon loadIcon(String iconPath)
      Load an icon from the supplied path
      Parameters:
      iconPath - the path to load from
      Returns:
      an icon
    • loadIcon

      public static ImageIcon loadIcon(ClassLoader classLoader, String iconPath)
      Load an icon from the supplied path
      Parameters:
      classLoader - the classloader to use for finding the resource
      iconPath - the path to load from
      Returns:
      an icon
    • scaleIcon

      public static ImageIcon scaleIcon(ImageIcon icon, double factor)
      Scale the supplied icon by the given factor
      Parameters:
      icon - the icon to scale
      factor - the factor to scale by
      Returns:
      the scaled icon
    • getIcon

      public Image getIcon(double scale)
      Get the icon for this visual at the given scale factor
      Parameters:
      scale - the factor to scale the icon by
      Returns:
      the scaled icon
    • getStepName

      public String getStepName()
      Convenience method for getting the name of the step that this visual wraps
      Returns:
      the name of the step
    • setStepName

      public void setStepName(String name)
      Convenience method for setting the name of the step that this visual wraps
      Parameters:
      name - the name to set on the step
    • getX

      public int getX()
      Get the x coordinate of this step on the graphical layout
      Overrides:
      getX in class JComponent
      Returns:
      the x coordinate of this step
    • setX

      public void setX(int x)
      Set the x coordinate of this step on the graphical layout
      Parameters:
      x - the x coordinate of this step
    • getY

      public int getY()
      Get the y coordinate of this step on the graphical layout
      Overrides:
      getY in class JComponent
      Returns:
      the y coordinate of this step
    • setY

      public void setY(int y)
      Set the y coordinate of this step on the graphical layout
      Parameters:
      y - the y coordinate of this step
    • getStepManager

      public StepManagerImpl getStepManager()
      Get the step manager for this visual
      Returns:
      the step manager
    • setStepManager

      public void setStepManager(StepManagerImpl manager)
      Set the step manager for this visual
      Parameters:
      manager - the step manager to wrap
    • getCustomEditorForStep

      public String getCustomEditorForStep()
      Get the fully qualified name of the custom editor (if any) for the step wrapped in this visual
      Returns:
      the custom editor, or null if the step does not specify one
    • getStepInteractiveViewActionNames

      public Set<String> getStepInteractiveViewActionNames()
      Get a set of fully qualified names of interactive viewers that the wrapped step provides.
      Returns:
      a set of fully qualified interactive viewer names, or null if the step does not have any interactive viewers.
    • getStepInteractiveViewComponent

      public JComponent getStepInteractiveViewComponent(String viewActionName) throws WekaException
      Gets an instance of the named step interactive viewer component
      Parameters:
      viewActionName - the action/name for the viewer to get
      Returns:
      the instantiated viewer component
      Throws:
      WekaException - if the step does not have any interactive viewers, or does not provide a viewer with the given action/name
    • getClosestConnectorPoint

      public Point getClosestConnectorPoint(Point pt)
      Returns the coordinates of the closest "connector" point to the supplied point. Coordinates are in the parent containers coordinate space.
      Parameters:
      pt - the reference point
      Returns:
      the closest connector point
    • setDisplayConnectors

      public void setDisplayConnectors(boolean dc)
      Turn on/off the connector points
      Parameters:
      dc - a boolean value
    • setDisplayConnectors

      public void setDisplayConnectors(boolean dc, Color c)
      Turn on/off the connector points
      Parameters:
      dc - a boolean value
      c - the Color to use
    • getDisplayStepLabel

      public boolean getDisplayStepLabel()
      Returns true if the step label is to be displayed. Subclasses can override to change this.
      Returns:
      true (default) if the step label is to be displayed
    • paintComponent

      public void paintComponent(Graphics gx)