public abstract class ControlPanel extends Object implements ActionListener
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_NAME |
Constructor and Description |
---|
ControlPanel(String name,
boolean showGui) |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent e) |
protected void |
addToMenu(String[] actions,
JMenu jm) |
protected JMenuItem |
addToMenuWithShortcut(String action,
JMenu jm,
int key,
int modifier) |
protected void |
clearAll() |
protected void |
clearCurrentSimulation() |
protected void |
createToolbar()
The toolbar for the control panel - open, layer and run
The buttons have matching menu items performing the same actions
|
protected abstract Sim |
importFile(File sourceFile) |
Sim |
initialise(File file) |
protected void |
loadRunConfigsFromSimulation()
load the runConfigs from the simulation into the runConfigs map.
|
protected void |
positionViewers()
Lay out the StandaloneViewer windows in a
|
protected void |
registerSimulation(Sim sim,
File simFile)
The control panel handles one simulation at a time, this should be "registered" using this method.
|
protected void |
restoreViewerWindows() |
protected void |
runSimulationInNewThread()
When simulation.run() is called from the actionPerformed method below, it holds up the
Java Swing display thread and we don't get the nice animation, so call run() in its own thread here.
|
protected void |
setNewWorkingFile(File newfile) |
protected void |
setPrevWorkingFile() |
protected void |
setRunSimulationEnabled(boolean enabled) |
void |
setTitle(String title) |
void |
show() |
public static final String DEFAULT_NAME
public ControlPanel(String name, boolean showGui)
public void setTitle(String title)
public Sim initialise(File file) throws LEMSException
LEMSException
protected void registerSimulation(Sim sim, File simFile)
sim
- - simulation objectsimFile
- - new file to load (can be null)ConnectionError
ContentError
RuntimeError
ParseError
protected abstract Sim importFile(File sourceFile) throws LEMSException
LEMSException
protected final void createToolbar()
protected void loadRunConfigsFromSimulation()
protected void positionViewers()
protected final void setRunSimulationEnabled(boolean enabled)
protected final JMenuItem addToMenuWithShortcut(String action, JMenu jm, int key, int modifier)
action
- - The name of the action itemjm
- - the menu for this item to be added tokey
- - int representing the ID of KeyEvent (eg KeyEvent.VK_F6)modifier
- - int representing the ID of ActionEvent (eg ActionEvent.ALT_MASK , 0 for no modifier)public final void show()
protected void runSimulationInNewThread()
public void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener
protected void clearCurrentSimulation()
protected void restoreViewerWindows()
protected void clearAll()
protected void setNewWorkingFile(File newfile)
protected void setPrevWorkingFile()
Copyright © 2019. All rights reserved.