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:
java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,javax.accessibility.Accessible
- Direct Known Subclasses:
NoteVisual
public class StepVisual extends javax.swing.JPanelClass 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
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringBASE_ICON_PATHStandard 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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StepVisualcreateVisual(StepManagerImpl stepManager)Create a visual for the step managed by the supplied step manager.static StepVisualcreateVisual(StepManagerImpl stepManager, javax.swing.ImageIcon icon)Create a visual for the step managed by the supplied step manager using the supplied icon.java.awt.PointgetClosestConnectorPoint(java.awt.Point pt)Returns the coordinates of the closest "connector" point to the supplied point.java.lang.StringgetCustomEditorForStep()Get the fully qualified name of the custom editor (if any) for the step wrapped in this visualbooleangetDisplayStepLabel()Returns true if the step label is to be displayed.java.awt.ImagegetIcon(double scale)Get the icon for this visual at the given scale factorjava.util.Set<java.lang.String>getStepInteractiveViewActionNames()Get a set of fully qualified names of interactive viewers that the wrapped step provides.javax.swing.JComponentgetStepInteractiveViewComponent(java.lang.String viewActionName)Gets an instance of the named step interactive viewer componentStepManagerImplgetStepManager()Get the step manager for this visualjava.lang.StringgetStepName()Convenience method for getting the name of the step that this visual wrapsintgetX()Get the x coordinate of this step on the graphical layoutintgetY()Get the y coordinate of this step on the graphical layoutstatic javax.swing.ImageIconiconForStep(Step step)Gets the icon for the suppliedStep.static javax.swing.ImageIconloadIcon(java.lang.ClassLoader classLoader, java.lang.String iconPath)Load an icon from the supplied pathstatic javax.swing.ImageIconloadIcon(java.lang.String iconPath)Load an icon from the supplied pathvoidpaintComponent(java.awt.Graphics gx)static javax.swing.ImageIconscaleIcon(javax.swing.ImageIcon icon, double factor)Scale the supplied icon by the given factorvoidsetDisplayConnectors(boolean dc)Turn on/off the connector pointsvoidsetDisplayConnectors(boolean dc, java.awt.Color c)Turn on/off the connector pointsvoidsetStepManager(StepManagerImpl manager)Set the step manager for this visualvoidsetStepName(java.lang.String name)Convenience method for setting the name of the step that this visual wrapsvoidsetX(int x)Set the x coordinate of this step on the graphical layoutvoidsetY(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
-
-
-
-
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 theKFStepannotation)- Parameters:
stepManager- the step manager for the step to create a visual wrapper for- Returns:
- the
StepVisualthat 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 foricon- the icon to use in the visual- Returns:
- the
StepVisualthat wraps the step
-
iconForStep
public static javax.swing.ImageIcon iconForStep(Step step)
Gets the icon for the suppliedStep.- 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 resourceiconPath- 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 scalefactor- 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:
getXin classjavax.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:
getYin classjavax.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 WekaExceptionGets 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- abooleanvalue
-
setDisplayConnectors
public void setDisplayConnectors(boolean dc, java.awt.Color c)Turn on/off the connector points- Parameters:
dc- abooleanvaluec- 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)
-
-