Package weka.gui.knowledgeflow
Class StepVisual
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
weka.gui.knowledgeflow.StepVisual
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
- Direct Known Subclasses:
NoteVisual
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
-
Field Summary
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
Modifier and TypeMethodDescriptionstatic StepVisual
createVisual
(StepManagerImpl stepManager) Create a visual for the step managed by the supplied step manager.static StepVisual
createVisual
(StepManagerImpl stepManager, ImageIcon icon) Create a visual for the step managed by the supplied step manager using the supplied icon.Returns the coordinates of the closest "connector" point to the supplied point.Get the fully qualified name of the custom editor (if any) for the step wrapped in this visualboolean
Returns true if the step label is to be displayed.getIcon
(double scale) Get the icon for this visual at the given scale factorGet a set of fully qualified names of interactive viewers that the wrapped step provides.getStepInteractiveViewComponent
(String viewActionName) Gets an instance of the named step interactive viewer componentGet the step manager for this visualConvenience method for getting the name of the step that this visual wrapsint
getX()
Get the x coordinate of this step on the graphical layoutint
getY()
Get the y coordinate of this step on the graphical layoutstatic ImageIcon
iconForStep
(Step step) Gets the icon for the suppliedStep
.static ImageIcon
loadIcon
(ClassLoader classLoader, String iconPath) Load an icon from the supplied pathstatic ImageIcon
Load an icon from the supplied pathvoid
static ImageIcon
Scale the supplied icon by the given factorvoid
setDisplayConnectors
(boolean dc) Turn on/off the connector pointsvoid
setDisplayConnectors
(boolean dc, Color c) Turn on/off the connector pointsvoid
setStepManager
(StepManagerImpl manager) Set the step manager for this visualvoid
setStepName
(String name) Convenience method for setting the name of the step that this visual wrapsvoid
setX
(int x) Set the x coordinate of this step on the graphical layoutvoid
setY
(int y) Set the y coordinate of this step on the graphical layoutMethods 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
-
Field Details
-
BASE_ICON_PATH
Standard base path for Step icons- See Also:
-
-
Method Details
-
createVisual
Create a visual for the step managed by the supplied step manager. Uses the icon specified by the step itself (via theKFStep
annotation)- Parameters:
stepManager
- the step manager for the step to create a visual wrapper for- Returns:
- the
StepVisual
that wraps the step
-
createVisual
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 foricon
- the icon to use in the visual- Returns:
- the
StepVisual
that wraps the step
-
iconForStep
Gets the icon for the suppliedStep
.- Parameters:
step
- the step to get the icon for- Returns:
- the icon for the step
-
loadIcon
Load an icon from the supplied path- Parameters:
iconPath
- the path to load from- Returns:
- an icon
-
loadIcon
Load an icon from the supplied path- Parameters:
classLoader
- the classloader to use for finding the resourceiconPath
- the path to load from- Returns:
- an icon
-
scaleIcon
Scale the supplied icon by the given factor- Parameters:
icon
- the icon to scalefactor
- the factor to scale by- Returns:
- the scaled icon
-
getIcon
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
Convenience method for getting the name of the step that this visual wraps- Returns:
- the name of the step
-
setStepName
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 classJComponent
- 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 classJComponent
- 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
Get the step manager for this visual- Returns:
- the step manager
-
setStepManager
Set the step manager for this visual- Parameters:
manager
- the step manager to wrap
-
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
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
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
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
- aboolean
value
-
setDisplayConnectors
Turn on/off the connector points- Parameters:
dc
- aboolean
valuec
- 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
-