@PerspectiveInfo(ID="simplecli", title="Simple CLI", toolTipText="Simple CLI for Weka", iconPath="weka/gui/weka_icon_new_small.png") public class SimpleCLIPanel extends ScriptingPanel implements java.awt.event.ActionListener, Perspective
Modifier and Type | Class and Description |
---|---|
static class |
SimpleCLIPanel.ClassRunner
A class that handles running the main method of the class in a separate
thread.
|
static class |
SimpleCLIPanel.CommandlineCompletion
A class for commandline completion of classnames.
|
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
SimpleCLIPanel() |
Modifier and Type | Method and Description |
---|---|
boolean |
acceptsInstances()
Returns true if this perspective can do something meaningful with a set of
instances
|
void |
actionPerformed(java.awt.event.ActionEvent e)
Only gets called when return is pressed in the input area, which starts the
command running.
|
void |
doCommandlineCompletion(java.awt.event.KeyEvent e)
performs commandline completion on packages and classnames.
|
void |
doHistory(java.awt.event.KeyEvent e)
Changes the currently displayed command line when certain keys are pressed.
|
java.util.List<java.lang.String> |
getCommandHistory()
Returns the command history.
|
Defaults |
getDefaultSettings()
Get the default settings for this perspective (or null if there are none)
|
javax.swing.ImageIcon |
getIcon()
Returns an icon to be used in a frame.
|
GUIApplication |
getMainApplication()
Get the main application that this perspective belongs to
|
javax.swing.JMenuBar |
getMenuBar()
Not supported.
|
java.util.List<javax.swing.JMenu> |
getMenus()
Get an ordered list of menus to appear in the main menu bar.
|
javax.swing.JTextPane |
getOutput()
Returns the text area that is used for displaying output on stdout and
stderr.
|
javax.swing.JTextPane |
getOutputArea()
The output area.
|
javax.swing.Icon |
getPerspectiveIcon()
Get the icon for this perspective
|
java.lang.String |
getPerspectiveID()
Get the ID of this perspective
|
java.lang.String |
getPerspectiveTipText()
Get the tool tip text for this perspective
|
java.lang.String |
getPerspectiveTitle()
Get the title of this perspective
|
java.lang.String |
getTitle()
Returns the current title for the frame/dialog.
|
java.util.Map<java.lang.String,java.lang.Object> |
getVariables()
Returns the variables.
|
void |
instantiationComplete()
Gets called when startup of the application has completed.
|
boolean |
isBusy()
Checks whether a thread is currently running.
|
static void |
main(java.lang.String[] args)
Displays the panel in a frame.
|
boolean |
okToBeActive()
Returns true if this perspective is OK with being an active perspective -
i.e.
|
boolean |
requiresLog()
Whether this perspective requires a graphical log to write to
|
void |
runCommand(java.lang.String command)
Executes a simple cli command.
|
void |
setActive(boolean active)
Set active status of this perspective.
|
void |
setInstances(Instances instances)
Set instances (if this perspective can use them)
|
void |
setLoaded(boolean loaded)
Set whether this perspective is "loaded" - i.e.
|
void |
setLog(Logger log)
Set a log to use (if required by the perspective)
|
void |
setMainApplication(GUIApplication main)
Set the main application.
|
void |
settingsChanged()
Called when the user alters settings.
|
void |
startThread(SimpleCLIPanel.ClassRunner runner)
Starts the thread.
|
void |
stopThread()
Stops the currently running thread, if any.
|
addTitleUpdatedListener, getDebug, removeTitleUpdatedListener, setDebug, showPanel, showPanel, terminate, titleUpdated
getAccessibleContext, getUI, getUIClassID, setUI, updateUI
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
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
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, getPeer, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public void instantiationComplete()
Perspective
instantiationComplete
in interface Perspective
public boolean okToBeActive()
Perspective
okToBeActive
in interface Perspective
public void setActive(boolean active)
Perspective
setActive
in interface Perspective
active
- true if this perspective is the active onepublic void setLoaded(boolean loaded)
Perspective
setLoaded
in interface Perspective
loaded
- true if the perspective is available in the perspective
toolbar of the KnowledgeFlowpublic void setMainApplication(GUIApplication main)
Perspective
setMainApplication
in interface Perspective
main
- the main applicationpublic GUIApplication getMainApplication()
Perspective
getMainApplication
in interface Perspective
public java.lang.String getPerspectiveID()
Perspective
getPerspectiveID
in interface Perspective
public java.lang.String getPerspectiveTitle()
Perspective
getPerspectiveTitle
in interface Perspective
public javax.swing.Icon getPerspectiveIcon()
Perspective
getPerspectiveIcon
in interface Perspective
public java.lang.String getPerspectiveTipText()
Perspective
getPerspectiveTipText
in interface Perspective
public java.util.List<javax.swing.JMenu> getMenus()
Perspective
getMenus
in interface Perspective
public Defaults getDefaultSettings()
Perspective
getDefaultSettings
in interface Perspective
public void settingsChanged()
Perspective
settingsChanged
in interface Perspective
public boolean acceptsInstances()
Perspective
acceptsInstances
in interface Perspective
public void setInstances(Instances instances)
Perspective
setInstances
in interface Perspective
instances
- the instancespublic boolean requiresLog()
Perspective
requiresLog
in interface Perspective
public void setLog(Logger log)
Perspective
setLog
in interface Perspective
log
- the graphical log to usepublic javax.swing.ImageIcon getIcon()
getIcon
in class ScriptingPanel
public java.lang.String getTitle()
getTitle
in class ScriptingPanel
public javax.swing.JTextPane getOutput()
getOutput
in class ScriptingPanel
public javax.swing.JMenuBar getMenuBar()
getMenuBar
in class ScriptingPanel
public boolean isBusy()
public void startThread(SimpleCLIPanel.ClassRunner runner)
runner
- the thread to startpublic void stopThread()
public java.util.Map<java.lang.String,java.lang.Object> getVariables()
public javax.swing.JTextPane getOutputArea()
public java.util.List<java.lang.String> getCommandHistory()
public void runCommand(java.lang.String command) throws java.lang.Exception
command
- the command stringjava.lang.Exception
- if an error occurspublic void doHistory(java.awt.event.KeyEvent e)
e
- a value of type 'KeyEvent'public void doCommandlineCompletion(java.awt.event.KeyEvent e)
e
- a value of type 'KeyEvent'public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
e
- a value of type 'ActionEvent'public static void main(java.lang.String[] args)
args
- ignored