Package weka.gui.knowledgeflow
Class MainKFPerspective
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
weka.gui.AbstractPerspective
weka.gui.knowledgeflow.MainKFPerspective
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
,Perspective
@PerspectiveInfo(ID="knowledgeflow.main",
title="Data mining processes",
toolTipText="Data mining processes",
iconPath="weka/gui/weka_icon_new_small.png")
public class MainKFPerspective
extends AbstractPerspective
Main perspective for the Knowledge flow application
- Author:
- Mark Hall
- 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
Modifier and TypeFieldDescriptionstatic final String
File extension for undo point filesstatic final String
Key for the environment variable that holds the parent directory of a loaded flowFields 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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns true if this perspective can do something meaningful with a set of instancesvoid
Add a new titled tab to the UIvoid
Add a new untitled tab to the UIvoid
Clear the current selection in the design palettevoid
Close all the open tabsvoid
copyFlowToClipboard
(Flow flow) void
copyStepsToClipboard
(List<StepVisual> steps) Copy the supplied steps to the clipboardboolean
Returns true if the perspective is allowing multiple tabs to be openGet the flow layout for the current (visible) tabint
Get the index of the current (visible) tabboolean
getDebug()
Get the default settings for this perspective (or null if there are none)getLayoutAt
(int index) Get the flow layout at the supplied indexGet the main toolbargetMenus()
Get an ordered list of menus to appear in the main menu bar.int
Get the number of open tabsReturn the currently selected step in the design paletteGet the contents of the paste buffer<T> T
getSetting
(Settings.SettingKey propKey, T defaultVal) Get the value of a setting for the main perspectiveboolean
Return true if the snap-to-grid button is selectedgetTabTitle
(int index) Get the title of the tab at the supplied indexGet the template managerboolean
Return true if memory is running lowvoid
Load a flow layout.void
loadLayout
(File fFile, boolean newTab) Load a flow layout.void
boolean
Returns true if this perspective is OK with being an active perspective - i.e.void
removeTab
(int tabIndex) Remove/close a tabvoid
setActive
(boolean active) Set active status of this perspective.void
setActiveTab
(int tabIndex) Set the active (visible) tabvoid
setAllowMultipleTabs
(boolean allow) Set whether multiple tabs are allowedvoid
setCurrentTabTitleEditedStatus
(boolean edited) Set the edited status for the current (visible) tabvoid
setFlowLayoutOperation
(weka.gui.knowledgeflow.VisibleLayout.LayoutOperation opp) Set the current flow layout operationvoid
setInstances
(Instances instances) Set instances (if this perspective can use them)void
Called when the user alters settings.void
showErrorDialog
(Exception cause) Popup an error dialogvoid
showInfoDialog
(Object information, String title, boolean isWarning) Popup an information dialogboolean
Print a warning if memory is low (and show a GUI dialog if running in a graphical environment)Methods inherited from class weka.gui.AbstractPerspective
getMainApplication, getPerspectiveIcon, getPerspectiveID, getPerspectiveTipText, getPerspectiveTitle, instantiationComplete, requiresLog, setLoaded, setLog, setMainApplication, terminate, toString
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, getX, getY, 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, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
FLOW_PARENT_DIRECTORY_VARIABLE_KEY
Key for the environment variable that holds the parent directory of a loaded flow- See Also:
-
FILE_EXTENSION_JSON
File extension for undo point files- See Also:
-
-
Constructor Details
-
MainKFPerspective
public MainKFPerspective()Construct a new MainKFPerspective
-
-
Method Details
-
getPalleteSelectedStep
Return the currently selected step in the design palette- Returns:
- the step selected in the design palette, or null if no step is selected
-
showErrorDialog
Popup an error dialog- Parameters:
cause
- the exception associated with the error
-
showInfoDialog
Popup an information dialog- Parameters:
information
- the information to displaytitle
- the title for the dialogisWarning
- true if the dialog should be a warning dialog
-
setFlowLayoutOperation
public void setFlowLayoutOperation(weka.gui.knowledgeflow.VisibleLayout.LayoutOperation opp) Set the current flow layout operation- Parameters:
opp
- the operation to use
-
getSnapToGrid
public boolean getSnapToGrid()Return true if the snap-to-grid button is selected- Returns:
- true if snap-to-grid is turned on
-
clearDesignPaletteSelection
public void clearDesignPaletteSelection()Clear the current selection in the design palette -
getPasteBuffer
Get the contents of the paste buffer- Returns:
- the contents of the paste buffer (in JSON)
-
copyStepsToClipboard
Copy the supplied steps to the clipboard- Parameters:
steps
- a list of steps to copy- Throws:
WekaException
- if a problem occurs
-
copyFlowToClipboard
- Throws:
WekaException
-
getTemplateManager
Get the template manager- Returns:
- the template manager
-
addUntitledTab
public void addUntitledTab()Add a new untitled tab to the UI -
addTab
Add a new titled tab to the UI- Parameters:
tabTitle
- the title for the tab
-
setCurrentTabTitleEditedStatus
public void setCurrentTabTitleEditedStatus(boolean edited) Set the edited status for the current (visible) tab- Parameters:
edited
- true if the flow in the tab has been edited (but not saved)
-
getCurrentTabIndex
public int getCurrentTabIndex()Get the index of the current (visible) tab- Returns:
- the index of the visible tab
-
getNumTabs
public int getNumTabs()Get the number of open tabs- Returns:
- the number of open tabs
-
getTabTitle
Get the title of the tab at the supplied index- Parameters:
index
- the index of the tab to get the title for- Returns:
- the title of the tab
- Throws:
IndexOutOfBoundsException
- if the index is out of range
-
setActiveTab
public void setActiveTab(int tabIndex) Set the active (visible) tab- Parameters:
tabIndex
- the index of the tab to make active
-
closeAllTabs
public void closeAllTabs()Close all the open tabs -
removeTab
public void removeTab(int tabIndex) Remove/close a tab- Parameters:
tabIndex
- the index of the tab to close
-
getCurrentLayout
Get the flow layout for the current (visible) tab- Returns:
- the current flow layout
-
getLayoutAt
Get the flow layout at the supplied index- Parameters:
index
- the index of the flow layout to get- Returns:
- the flow layout at the index
- Throws:
IndexOutOfBoundsException
- if the index is out of range
-
getAllowMultipleTabs
public boolean getAllowMultipleTabs()Returns true if the perspective is allowing multiple tabs to be open- Returns:
- true if multiple tabs are allowed
-
setAllowMultipleTabs
public void setAllowMultipleTabs(boolean allow) Set whether multiple tabs are allowed- Parameters:
allow
- true if multiple tabs are allowed
-
getSetting
Get the value of a setting for the main perspective- Type Parameters:
T
- the type of the setting- Parameters:
propKey
- the key of the setting to getdefaultVal
- the default value to use if nothing is set yet- Returns:
- the value (or default value) for the setting
-
notifyIsDirty
public void notifyIsDirty() -
loadLayout
public void loadLayout()Load a flow layout. Prompts via a filechooser -
loadLayout
Load a flow layout.- Parameters:
fFile
- the file to loadnewTab
- true if the flow should be loaded into a new tab
-
isMemoryLow
public boolean isMemoryLow()Return true if memory is running low- Returns:
- true if memory is running low
-
showMemoryIsLow
public boolean showMemoryIsLow()Print a warning if memory is low (and show a GUI dialog if running in a graphical environment)- Returns:
- true if user opts to continue (in the GUI case)
-
getDebug
public boolean getDebug() -
getMainToolBar
Get the main toolbar- Returns:
- the main toolbar
-
setActive
public void setActive(boolean active) Set active status of this perspective. True indicates that this perspective is the visible active perspective in the application- Specified by:
setActive
in interfacePerspective
- Overrides:
setActive
in classAbstractPerspective
- Parameters:
active
- true if this perspective is the active one
-
getMenus
Get an ordered list of menus to appear in the main menu bar. Return null for no menus- Specified by:
getMenus
in interfacePerspective
- Overrides:
getMenus
in classAbstractPerspective
- Returns:
- a list of menus to appear in the main menu bar or null for no menus
-
getDefaultSettings
Get the default settings for this perspective (or null if there are none)- Specified by:
getDefaultSettings
in interfacePerspective
- Overrides:
getDefaultSettings
in classAbstractPerspective
- Returns:
- the default settings for this perspective, or null if the perspective does not have any settings
-
okToBeActive
public boolean okToBeActive()Returns true if this perspective is OK with being an active perspective - i.e. the user can click on this perspective at this time in the perspective toolbar. For example, a Perspective might return false from this method if it needs a set of instances to operate but none have been supplied yet.- Specified by:
okToBeActive
in interfacePerspective
- Overrides:
okToBeActive
in classAbstractPerspective
- Returns:
- true if this perspective can be active at the current time
-
settingsChanged
public void settingsChanged()Called when the user alters settings. The settings altered by the user are not necessarily ones related to this perspective- Specified by:
settingsChanged
in interfacePerspective
- Overrides:
settingsChanged
in classAbstractPerspective
-
acceptsInstances
public boolean acceptsInstances()Returns true if this perspective can do something meaningful with a set of instances- Specified by:
acceptsInstances
in interfacePerspective
- Overrides:
acceptsInstances
in classAbstractPerspective
- Returns:
- true if this perspective accepts instances
-
setInstances
Set instances (if this perspective can use them)- Specified by:
setInstances
in interfacePerspective
- Overrides:
setInstances
in classAbstractPerspective
- Parameters:
instances
- the instances
-