public class GUIPanel extends java.lang.Object implements IRepetitionCounter
Modifier and Type | Field and Description |
---|---|
protected NamedGUIAction |
enterPressAction |
static java.lang.String |
UNNAMED_REGISTER |
Constructor and Description |
---|
GUIPanel() |
Modifier and Type | Method and Description |
---|---|
void |
addCmdLineListener(javafx.beans.value.ChangeListener<java.lang.String> listener)
Add a
ChangeListener to the list of listeners, events of which
get fired, once the enter is pressed. |
int |
addGUITab(GUITab gt)
Add another tab to this panel.
|
void |
editElement(GUIelement ge)
Switch to edit mode and start editing the provided GUI element.
|
void |
executeMacro(java.lang.String sequenceOfKeys)
Execute a macro, simulating the subsequent presses of the key sequence
provided.
|
javafx.scene.canvas.Canvas |
getCanvas()
Deprecated.
|
InstrumentationPlatformGUI.Elements.GUIPanel.CanvasPane |
getCanvasPane()
Returns the
CanvasPane , which the GUI elements are drawn to. |
javafx.scene.control.TextArea |
getCmdLine()
Returns the
TextArea , representing the commandLine |
GUITab |
getCurrentGUITab()
Returns the GUITab object, representing the tab the user is currently
viewing.
|
GUIelement |
getCurrentlyEditedGUIelement()
Return the currently edited GUI element if any, null otherwise.
|
Position |
getCurrentPosition()
Return the Position object, representing which tab the user is currently
on, and which component is currently focused.
|
java.lang.String |
getCurrentRegisterContentAndReset()
Returns the content on the current register (unnamed register, or a named
register if specified by the user); then resets the "current register" to
default (unnamed register).
|
java.lang.String |
getCurrentRegisterLetter()
Return the letter of the currently selected register.
|
java.lang.String |
getCurrentRegisterLetterAndReset()
Return the letter of the currently selected register.
|
MappingManager |
getGlobalMappingManager()
Return the global mapping manager object, responsible for managing
mappings, that are active when no components are being edited.
|
GUICompiler |
getGUICompiler()
Get the compiler object, used by this panel to run user code and also
compile the callbacks of the individual component.
|
int |
getGUIElementIDByName(java.lang.String name)
Returns the ID of the GUI element with the UNIQUENAME provided
|
java.util.HashMap<GUIelement,java.lang.Integer> |
getGUIIDMap() |
java.util.HashMap<java.lang.String,GUIelement> |
getGUINameMap() |
GUIVirtualMachine |
GetGUIVirtualMachine()
Get the virtual machine, used to executed the user code and the code from
the commandLine.
|
java.util.HashMap<java.lang.Integer,GUIelement> |
getID2GUIMap() |
boolean |
getLFlag()
Return, whether the LFlag is currently on.
|
Menu |
getMenu() |
javafx.scene.control.Label |
getModeStatusBlimp() |
boolean |
getNFlag()
Return, whether the NFlag is currently on.
|
java.lang.String |
getRegisterContent(java.lang.String registerName)
Get the content of the register, determined by the letter, provided as a
string.
|
java.util.HashMap<java.lang.String,java.lang.String> |
getRegisterMap() |
int |
getRepeatCount()
Return the repeat count, which should be used for the next action.
|
int |
getRepeatCount(boolean reset)
Return the repeat count, which should be used for the next action.
|
java.util.ArrayList<GUIelement> |
getSelectedGUIelementsList()
Get the ArrayList, containing all the currently selected GUIelements.
|
java.util.ArrayList<GUIelement> |
getSelectedGUIelementsList(boolean respectVFlag)
Get the ArrayList, containing all the currently selected GUIelements.
|
SerialCommunicator |
getSerialCommunicator()
Return the serial communicator object, used to communicate with the child
modules.
|
javafx.scene.layout.VBox |
getVbox() |
boolean |
getVFlag()
Return, whether the VFlag is currently on.
|
void |
handle(java.lang.String s)
Parse the provided string as a sequence of key presses and perform
actions accordingly.
|
float |
handleCallBack(java.util.ArrayList<shuntingyard.Token> program)
Run a program, defined by the provided bytecode (an ArrayList of Tokens).
|
void |
recompileEventsForAll()
Instruct all components to recompile the bytecode of their callbacks.
|
void |
recompileUserCode()
Recompile the user code into a bytecode using the GUICompiler.
|
void |
registerGUIelement(GUIelement ge)
Inform this GUIPanel about a new GUIelement.
|
void |
resetCurrentCommandText()
Reset the string, which stores all the keypresses that occured before a
command was run to an empty string.
|
void |
resetRepeatCount()
Resets the repeat count
|
void |
setCurrentGUITab(GUITab gt)
Set the current GUI tab to the one specified.
|
void |
setCurrentlyEditedGUIelement(GUIelement ge)
Set the currently edited GUI element to be the one provided.
|
void |
setCurrentPosition(Position p)
Set the Position object, representing which tab the user is currently on,
and which component is currently focused.
|
protected void |
setCurrentRegister(java.lang.String register)
Set the letter of the currently selected register to be the one provided.
|
void |
setCurrentRegisterContentAndReset(java.lang.String content)
Sets the content on the current register (unnamed register, or a named
register if specified by the user); then resets the "current register" to
default (unnamed register).
|
void |
setEnterPressAction(NamedGUIAction ga)
Set the
NamedGUIAction to be executed when ENTER is pressed. |
void |
setMenu(Menu m)
Set the currently active menu to the one provided.
|
void |
setRegisterContent(java.lang.String registerName,
java.lang.String content)
Sets the content of register registerName to the String content provided.
|
protected void |
setRepeatCount(int repeatCount)
Set the repeat count to the value provided
|
void |
setSerialCommunicator(SerialCommunicator sc)
Set the serial communicator object, used to communicate with the child
modules.
|
void |
setUniqueNames(boolean set)
Set, whether UniqueNames of components are shown (true) or if the human
readable names are shown (false).
|
void |
showEditor()
Open the internal user code editor window, if not already open; otherwise,
brings it to front.
|
void |
showError(java.lang.String text)
Show given text at the statusWindow, at the bottom.
|
void |
showText(java.lang.String text)
Show given text at the statusWindow, at the bottom.
|
boolean |
showUniqueNames()
Returns, whether UniqueNames of components are shown (true) or if the
human readable names are shown (false).
|
void |
startRecordingMacro(java.lang.String register)
Start recording the keypresses that are about to follow as a string
inside a register, letter of which is determined by the argument
provided.
|
void |
stopEditing()
Return to normal mode, halting the ongoing edits of a component.
|
void |
stopRecordingMacro()
Stop recording the current macro if any is being recorded.
|
protected void |
traverseTabs(boolean forward)
Switch the currently selected tab to be the next one in the list (if the
boolean provided is true) or to be the previous one (if the boolean
provided is false).
|
void |
traverseTabs(int count)
Switch the currently selected tab to be the nth next in the list, where n
is the number provided.
|
protected NamedGUIAction enterPressAction
public static final java.lang.String UNNAMED_REGISTER
public void handle(java.lang.String s)
s
- public MappingManager getGlobalMappingManager()
public SerialCommunicator getSerialCommunicator()
public void setSerialCommunicator(SerialCommunicator sc)
public GUIelement getCurrentlyEditedGUIelement()
public void setCurrentlyEditedGUIelement(GUIelement ge)
public void editElement(GUIelement ge)
public void stopEditing()
public java.lang.String getCurrentRegisterLetter()
public java.lang.String getCurrentRegisterLetterAndReset()
protected void setCurrentRegister(java.lang.String register)
public Position getCurrentPosition()
public void setCurrentPosition(Position p)
public void setCurrentGUITab(GUITab gt)
public GUITab getCurrentGUITab()
public void recompileEventsForAll()
public int getGUIElementIDByName(java.lang.String name)
name
- GUITab.addGUIelement(InstrumentationPlatformGUI.Elements.GUIelement)
public GUICompiler getGUICompiler()
public float handleCallBack(java.util.ArrayList<shuntingyard.Token> program)
program
- the program to run, defined by its bytecode as ArrayList
of Tokens.public void registerGUIelement(GUIelement ge)
ge
- the GUIelement to addpublic int getRepeatCount() throws java.lang.RuntimeException
getRepeatCount
in interface IRepetitionCounter
java.lang.RuntimeException
public int getRepeatCount(boolean reset)
reset
- whether or not should the repeat count be reset after it's
returned.java.lang.RuntimeException
public GUIVirtualMachine GetGUIVirtualMachine()
public java.lang.String getRegisterContent(java.lang.String registerName)
registerName
- the letter (or character) of the register in
question.public void setCurrentRegisterContentAndReset(java.lang.String content)
content
- public java.lang.String getCurrentRegisterContentAndReset()
public void setRegisterContent(java.lang.String registerName, java.lang.String content)
registerName
- the letter of register, content of which should be
setcontent
- the new contentprotected void setRepeatCount(int repeatCount)
repeatCount
- the value to set the repeat count togetRepeatCount()
public void resetRepeatCount()
resetRepeatCount
in interface IRepetitionCounter
getRepeatCount()
public void showText(java.lang.String text)
text
- the text to showpublic void showError(java.lang.String text)
text
- the text to showpublic InstrumentationPlatformGUI.Elements.GUIPanel.CanvasPane getCanvasPane()
CanvasPane
, which the GUI elements are drawn to.
//@treatAsPrivateCanvasPane
, which the GUI elements are drawn to.public void showEditor()
public void recompileUserCode()
getGUICompiler()
@Deprecated public javafx.scene.canvas.Canvas getCanvas()
public javafx.scene.layout.VBox getVbox()
public void traverseTabs(int count)
count
- protected void traverseTabs(boolean forward)
forward
- whether to switch to the next (true) or previous (false)public void addCmdLineListener(javafx.beans.value.ChangeListener<java.lang.String> listener)
ChangeListener
to the list of listeners, events of which
get fired, once the enter is pressed.listener
- public javafx.scene.control.TextArea getCmdLine()
TextArea
, representing the commandLinepublic boolean showUniqueNames()
public void setUniqueNames(boolean set)
public java.util.HashMap<java.lang.String,GUIelement> getGUINameMap()
HashMap
, mapping the unique names of the GUIelement
s to them.public java.util.ArrayList<GUIelement> getSelectedGUIelementsList()
#getSelectedGUIelementsList(true)
getSelectedGUIelementsList(boolean)
public java.util.ArrayList<GUIelement> getSelectedGUIelementsList(boolean respectVFlag)
GUITab.getSelectedGUIelementsList()
.
When respectVFlag is off, return an arrayList with only one element,
representing the currently focused GUIelement instead. If there are no
GUIelement
s on the current tab, and thus none is selected,
returns an empty ArrayList
.respectVFlag
- When respectVFlag is off, return an arrayList with
only one element, representing the currently focused GUIelement instead.public boolean getVFlag()
public boolean getNFlag()
public boolean getLFlag()
getCurrentRegisterLetter()
public void startRecordingMacro(java.lang.String register)
register
- the register to record the macro intopublic void stopRecordingMacro()
public void executeMacro(java.lang.String sequenceOfKeys)
#handle(Java.lang.String)
, but also resets the
current menu to the main menu.sequenceOfKeys
- PanelKeyEventHandler#getMainMenu()
,
handle(java.lang.String)
public int addGUITab(GUITab gt)
gt
- the tab to add.public javafx.scene.control.Label getModeStatusBlimp()
public void resetCurrentCommandText()
public void setMenu(Menu m)
Object.equals(Object)
) with the main menu of this class, also reset the
current mode to normal (which reflects in the statusLine).m
- public java.util.HashMap<java.lang.Integer,GUIelement> getID2GUIMap()
HashMap
, used to map the IDs of individual GUIelement
s to these elements.public java.util.HashMap<java.lang.String,java.lang.String> getRegisterMap()
HashMap
, which maps the letters of the individual registers to their content.public java.util.HashMap<GUIelement,java.lang.Integer> getGUIIDMap()
HashMap
, which maps the letters of the individual GUIelement
s to their respective IDs.public void setEnterPressAction(NamedGUIAction ga)
NamedGUIAction
to be executed when ENTER is pressed.ga
- the new NamedGUIAction