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:
java.awt.image.ImageObserver,java.awt.MenuContainer,java.io.Serializable,javax.accessibility.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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringFILE_EXTENSION_JSONFile extension for undo point filesstatic java.lang.StringFLOW_PARENT_DIRECTORY_VARIABLE_KEYKey for the environment variable that holds the parent directory of a loaded flow-
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description MainKFPerspective()Construct a new MainKFPerspective
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanacceptsInstances()Returns true if this perspective can do something meaningful with a set of instancesvoidaddTab(java.lang.String tabTitle)Add a new titled tab to the UIvoidaddUntitledTab()Add a new untitled tab to the UIvoidclearDesignPaletteSelection()Clear the current selection in the design palettevoidcloseAllTabs()Close all the open tabsvoidcopyFlowToClipboard(Flow flow)voidcopyStepsToClipboard(java.util.List<StepVisual> steps)Copy the supplied steps to the clipboardbooleangetAllowMultipleTabs()Returns true if the perspective is allowing multiple tabs to be openVisibleLayoutgetCurrentLayout()Get the flow layout for the current (visible) tabintgetCurrentTabIndex()Get the index of the current (visible) tabbooleangetDebug()DefaultsgetDefaultSettings()Get the default settings for this perspective (or null if there are none)VisibleLayoutgetLayoutAt(int index)Get the flow layout at the supplied indexMainKFPerspectiveToolBargetMainToolBar()Get the main toolbarjava.util.List<javax.swing.JMenu>getMenus()Get an ordered list of menus to appear in the main menu bar.intgetNumTabs()Get the number of open tabsStepManagerImplgetPalleteSelectedStep()Return the currently selected step in the design palettejava.lang.StringgetPasteBuffer()Get the contents of the paste buffer<T> TgetSetting(Settings.SettingKey propKey, T defaultVal)Get the value of a setting for the main perspectivebooleangetSnapToGrid()Return true if the snap-to-grid button is selectedjava.lang.StringgetTabTitle(int index)Get the title of the tab at the supplied indexTemplateManagergetTemplateManager()Get the template managerbooleanisMemoryLow()Return true if memory is running lowvoidloadLayout()Load a flow layout.voidloadLayout(java.io.File fFile, boolean newTab)Load a flow layout.voidnotifyIsDirty()booleanokToBeActive()Returns true if this perspective is OK with being an active perspective - i.e.voidremoveTab(int tabIndex)Remove/close a tabvoidsetActive(boolean active)Set active status of this perspective.voidsetActiveTab(int tabIndex)Set the active (visible) tabvoidsetAllowMultipleTabs(boolean allow)Set whether multiple tabs are allowedvoidsetCurrentTabTitleEditedStatus(boolean edited)Set the edited status for the current (visible) tabvoidsetFlowLayoutOperation(weka.gui.knowledgeflow.VisibleLayout.LayoutOperation opp)Set the current flow layout operationvoidsetInstances(Instances instances)Set instances (if this perspective can use them)voidsettingsChanged()Called when the user alters settings.voidshowErrorDialog(java.lang.Exception cause)Popup an error dialogvoidshowInfoDialog(java.lang.Object information, java.lang.String title, boolean isWarning)Popup an information dialogbooleanshowMemoryIsLow()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 Detail
-
FLOW_PARENT_DIRECTORY_VARIABLE_KEY
public static final java.lang.String FLOW_PARENT_DIRECTORY_VARIABLE_KEY
Key for the environment variable that holds the parent directory of a loaded flow- See Also:
- Constant Field Values
-
FILE_EXTENSION_JSON
public static final java.lang.String FILE_EXTENSION_JSON
File extension for undo point files- See Also:
- Constant Field Values
-
-
Method Detail
-
getPalleteSelectedStep
public StepManagerImpl 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
public void showErrorDialog(java.lang.Exception cause)
Popup an error dialog- Parameters:
cause- the exception associated with the error
-
showInfoDialog
public void showInfoDialog(java.lang.Object information, java.lang.String title, boolean isWarning)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
public java.lang.String getPasteBuffer()
Get the contents of the paste buffer- Returns:
- the contents of the paste buffer (in JSON)
-
copyStepsToClipboard
public void copyStepsToClipboard(java.util.List<StepVisual> steps) throws WekaException
Copy the supplied steps to the clipboard- Parameters:
steps- a list of steps to copy- Throws:
WekaException- if a problem occurs
-
copyFlowToClipboard
public void copyFlowToClipboard(Flow flow) throws WekaException
- Throws:
WekaException
-
getTemplateManager
public TemplateManager getTemplateManager()
Get the template manager- Returns:
- the template manager
-
addUntitledTab
public void addUntitledTab()
Add a new untitled tab to the UI
-
addTab
public void addTab(java.lang.String tabTitle)
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
public java.lang.String getTabTitle(int index)
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:
java.lang.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
public VisibleLayout getCurrentLayout()
Get the flow layout for the current (visible) tab- Returns:
- the current flow layout
-
getLayoutAt
public VisibleLayout getLayoutAt(int index)
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:
java.lang.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
public <T> T getSetting(Settings.SettingKey propKey, T defaultVal)
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
public void loadLayout(java.io.File fFile, boolean newTab)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
public MainKFPerspectiveToolBar 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:
setActivein interfacePerspective- Overrides:
setActivein classAbstractPerspective- Parameters:
active- true if this perspective is the active one
-
getMenus
public java.util.List<javax.swing.JMenu> getMenus()
Get an ordered list of menus to appear in the main menu bar. Return null for no menus- Specified by:
getMenusin interfacePerspective- Overrides:
getMenusin classAbstractPerspective- Returns:
- a list of menus to appear in the main menu bar or null for no menus
-
getDefaultSettings
public Defaults getDefaultSettings()
Get the default settings for this perspective (or null if there are none)- Specified by:
getDefaultSettingsin interfacePerspective- Overrides:
getDefaultSettingsin 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:
okToBeActivein interfacePerspective- Overrides:
okToBeActivein 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:
settingsChangedin interfacePerspective- Overrides:
settingsChangedin classAbstractPerspective
-
acceptsInstances
public boolean acceptsInstances()
Returns true if this perspective can do something meaningful with a set of instances- Specified by:
acceptsInstancesin interfacePerspective- Overrides:
acceptsInstancesin classAbstractPerspective- Returns:
- true if this perspective accepts instances
-
setInstances
public void setInstances(Instances instances)
Set instances (if this perspective can use them)- Specified by:
setInstancesin interfacePerspective- Overrides:
setInstancesin classAbstractPerspective- Parameters:
instances- the instances
-
-