Class StepVisual

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible
    Direct Known Subclasses:
    NoteVisual

    public class StepVisual
    extends javax.swing.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:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class javax.swing.JComponent

        javax.swing.JComponent.AccessibleJComponent
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.BaselineResizeBehavior
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String BASE_ICON_PATH
      Standard base path for Step icons
      • Fields inherited from class javax.swing.JComponent

        TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
      • Fields inherited from class java.awt.Component

        BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static StepVisual createVisual​(StepManagerImpl stepManager)
      Create a visual for the step managed by the supplied step manager.
      static StepVisual createVisual​(StepManagerImpl stepManager, javax.swing.ImageIcon icon)
      Create a visual for the step managed by the supplied step manager using the supplied icon.
      java.awt.Point getClosestConnectorPoint​(java.awt.Point pt)
      Returns the coordinates of the closest "connector" point to the supplied point.
      java.lang.String getCustomEditorForStep()
      Get the fully qualified name of the custom editor (if any) for the step wrapped in this visual
      boolean getDisplayStepLabel()
      Returns true if the step label is to be displayed.
      java.awt.Image getIcon​(double scale)
      Get the icon for this visual at the given scale factor
      java.util.Set<java.lang.String> getStepInteractiveViewActionNames()
      Get a set of fully qualified names of interactive viewers that the wrapped step provides.
      javax.swing.JComponent getStepInteractiveViewComponent​(java.lang.String viewActionName)
      Gets an instance of the named step interactive viewer component
      StepManagerImpl getStepManager()
      Get the step manager for this visual
      java.lang.String getStepName()
      Convenience method for getting the name of the step that this visual wraps
      int getX()
      Get the x coordinate of this step on the graphical layout
      int getY()
      Get the y coordinate of this step on the graphical layout
      static javax.swing.ImageIcon iconForStep​(Step step)
      Gets the icon for the supplied Step.
      static javax.swing.ImageIcon loadIcon​(java.lang.ClassLoader classLoader, java.lang.String iconPath)
      Load an icon from the supplied path
      static javax.swing.ImageIcon loadIcon​(java.lang.String iconPath)
      Load an icon from the supplied path
      void paintComponent​(java.awt.Graphics gx)  
      static javax.swing.ImageIcon scaleIcon​(javax.swing.ImageIcon icon, double factor)
      Scale the supplied icon by the given factor
      void setDisplayConnectors​(boolean dc)
      Turn on/off the connector points
      void setDisplayConnectors​(boolean dc, java.awt.Color c)
      Turn on/off the connector points
      void setStepManager​(StepManagerImpl manager)
      Set the step manager for this visual
      void setStepName​(java.lang.String name)
      Convenience method for setting the name of the step that this visual wraps
      void setX​(int x)
      Set the x coordinate of this step on the graphical layout
      void setY​(int y)
      Set the y coordinate of this step on the graphical layout
      • Methods inherited from class javax.swing.JPanel

        getAccessibleContext, getUI, getUIClassID, setUI, updateUI
      • Methods inherited from class javax.swing.JComponent

        addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • BASE_ICON_PATH

        public static final java.lang.String BASE_ICON_PATH
        Standard base path for Step icons
        See Also:
        Constant Field Values
    • Method Detail

      • 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,
                                              javax.swing.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 javax.swing.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 javax.swing.ImageIcon loadIcon​(java.lang.String iconPath)
        Load an icon from the supplied path
        Parameters:
        iconPath - the path to load from
        Returns:
        an icon
      • loadIcon

        public static javax.swing.ImageIcon loadIcon​(java.lang.ClassLoader classLoader,
                                                     java.lang.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 javax.swing.ImageIcon scaleIcon​(javax.swing.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 java.awt.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 java.lang.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​(java.lang.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 javax.swing.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 javax.swing.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 java.lang.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 java.util.Set<java.lang.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 javax.swing.JComponent getStepInteractiveViewComponent​(java.lang.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 java.awt.Point getClosestConnectorPoint​(java.awt.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,
                                         java.awt.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​(java.awt.Graphics gx)