Class 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:
  • Field Details

    • FLOW_PARENT_DIRECTORY_VARIABLE_KEY

      public static final String FLOW_PARENT_DIRECTORY_VARIABLE_KEY
      Key for the environment variable that holds the parent directory of a loaded flow
      See Also:
    • FILE_EXTENSION_JSON

      public static final String FILE_EXTENSION_JSON
      File extension for undo point files
      See Also:
  • Constructor Details

    • MainKFPerspective

      public MainKFPerspective()
      Construct a new MainKFPerspective
  • Method Details

    • 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(Exception cause)
      Popup an error dialog
      Parameters:
      cause - the exception associated with the error
    • showInfoDialog

      public void showInfoDialog(Object information, String title, boolean isWarning)
      Popup an information dialog
      Parameters:
      information - the information to display
      title - the title for the dialog
      isWarning - 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 String getPasteBuffer()
      Get the contents of the paste buffer
      Returns:
      the contents of the paste buffer (in JSON)
    • copyStepsToClipboard

      public void copyStepsToClipboard(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(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 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:
      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:
      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 get
      defaultVal - 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(File fFile, boolean newTab)
      Load a flow layout.
      Parameters:
      fFile - the file to load
      newTab - 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:
      setActive in interface Perspective
      Overrides:
      setActive in class AbstractPerspective
      Parameters:
      active - true if this perspective is the active one
    • getMenus

      public List<JMenu> getMenus()
      Get an ordered list of menus to appear in the main menu bar. Return null for no menus
      Specified by:
      getMenus in interface Perspective
      Overrides:
      getMenus in class AbstractPerspective
      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:
      getDefaultSettings in interface Perspective
      Overrides:
      getDefaultSettings in class AbstractPerspective
      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 interface Perspective
      Overrides:
      okToBeActive in class AbstractPerspective
      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 interface Perspective
      Overrides:
      settingsChanged in class AbstractPerspective
    • acceptsInstances

      public boolean acceptsInstances()
      Returns true if this perspective can do something meaningful with a set of instances
      Specified by:
      acceptsInstances in interface Perspective
      Overrides:
      acceptsInstances in class AbstractPerspective
      Returns:
      true if this perspective accepts instances
    • setInstances

      public void setInstances(Instances instances)
      Set instances (if this perspective can use them)
      Specified by:
      setInstances in interface Perspective
      Overrides:
      setInstances in class AbstractPerspective
      Parameters:
      instances - the instances