public class GuiController extends java.lang.Object implements SelectComponentsDialog.SelectComponentsDialogActionsListener
限定符和类型 | 类和说明 |
---|---|
protected static class |
GuiController.GuiState
Represents the state the GUI is in.
|
限定符和类型 | 字段和说明 |
---|---|
protected FileStatus |
fileStatus |
protected ConnectionsGlassPane |
glassPane |
protected CouplingGui |
gui |
private static GuiController |
instance
Singleton instance of GuiController
|
protected Model |
model |
protected java.io.File |
saveDestination |
private SelectComponentsDialog |
selectComponentDialog |
private java.util.List<Connection> |
selectedConnections
List of selected components.
|
protected GuiController.GuiState |
state |
限定符 | 构造器和说明 |
---|---|
protected |
GuiController() |
限定符和类型 | 方法和说明 |
---|---|
private boolean |
checkIdenticalComponents(Component component)
Checks if the selected component's name is already available in already loaded set
|
private void |
checkTransientCheckBox(Model.Align align,
int index)
Set checkbox at given align and index enabled.
|
private void |
clearSelectedTransients() |
private void |
disableAllCheckBoxesBut(Model.Align align,
int index)
Disables all CheckBoxes on side align but the one at index.
|
private void |
disableAllCheckBoxesBut(Model.Align align,
java.lang.String transientStandardName,
int collectionSize)
Disables all CheckBoxes on side align but the ones that have the given
transient standard name and collectionSize
|
private void |
enableAllCheckBoxes() |
TransientCouple |
getDefaultCouplingParams() |
static GuiController |
getInstance() |
private void |
goToStateEmpty() |
private void |
goToStateFullyLoaded() |
private void |
goToStateLeftLoaded() |
private void |
goToStateRightLoaded() |
boolean |
hasDefaultCouplingParams() |
boolean |
isStateFullyLoaded() |
void |
onComponentsSelected(int leftCompId,
int rightCompId)
Callback method when an user selected two components in SelectComponentsDialog
|
boolean |
onNotCompatibleTimestepUnitTypeSelected()
Callback to be called when user changed the timestep unit type
|
void |
onSelectComponentsDialogClosed() |
void |
onTransientCheckBoxCheck(Model.Align align,
int index)
Callback to be called when the user checks any of checkboxes of transient panels.
|
void |
onTransientCheckBoxUncheck(Model.Align align,
int index)
Callback to be called when the user unchecks any of checkboxes of transient panels.
|
void |
onTransientPanelDoubleClick(TransientPanel transPanel)
Callback to be called when the user made a double click on transient panel.
|
void |
onTransientPanelSingleClick(TransientPanel transPanel,
boolean controlDown)
Makes the selected transient panel selected
|
void |
openComponent(Model.Align align,
java.io.File componentFile)
Lets the user choose a component XML file and loads it into the GUI at
the side given by align.
|
void |
openCoupling(java.io.File couplingFile)
Loads a coupling XML file into the GUI.
|
private void |
pairTransientPanels(Connection c)
Pairs a transient panel with another one if they were coupled.
|
void |
registerCouplingGui(CouplingGui gui)
Registers CouplingGui if not already present.
|
void |
removeComponent(Model.Align align)
Removes a component in specific aligh from model
|
void |
repaintGlassPane() |
private void |
reset()
Resets the model and gui to empty state
|
private void |
resetLastSelectedTransientPanelIndices()
Resets last selected transient panel.
|
void |
saveCoupling(boolean saveAs)
Saves coupling to known file location.
|
private void |
saveFileInfo(java.io.File file) |
void |
setDefaultCouplingParams(TransientCouple donor) |
void |
setTimestepUnit(TimestepUnit unit) |
void |
setTransientCoupleData(TransientCouple transientCouple)
Method is called by CouplingDialog inner logic to save the Transient Couple info specified
by user in the dialog.
|
private void |
setTransientsSelectedState(boolean selected,
Model.Align align,
int index)
Updates a state of TransientPanel
|
private void |
showCouplingDialog(Connection clickedConnection) |
void |
showSelectComponentsDialog() |
private void |
uncheckTransientCheckBox(Model.Align align,
int index)
Set checkbox at given align and index disabled.
|
private void |
uncheckUnconnectedTransientCheckBoxes(Model.Align align)
Uncheck all checkboxes that do not have connections.
|
private void |
unpairTransientPanels(Model.Align align,
int index)
Unpairs a pair of transient panels,
pairTransientPanels(Connection) |
private void |
updateGlassPaneWithConnections() |
private void |
updateGuiWithComponent(Model.Align align) |
private void |
updateGuiWithCoupling() |
private void |
updateSelectComponentDialogIfExist() |
private static GuiController instance
protected Model model
protected GuiController.GuiState state
protected CouplingGui gui
protected ConnectionsGlassPane glassPane
protected java.io.File saveDestination
protected FileStatus fileStatus
private java.util.List<Connection> selectedConnections
private SelectComponentsDialog selectComponentDialog
public static GuiController getInstance()
public void registerCouplingGui(CouplingGui gui)
gui
- CouplingGui to registerpublic void openCoupling(java.io.File couplingFile)
If couplingFile is null, a JFileChooser dialog will guide the user to select a coupling XML file.
couplingFile
- coupling XML file, can be nullprivate void updateSelectComponentDialogIfExist()
public void openComponent(Model.Align align, java.io.File componentFile)
If componentFile is null, JFileChooser dialog will guide user to select a file.
align
- the side that should be loadedcomponentFile
- component XML file, can be nullprivate boolean checkIdenticalComponents(Component component)
component
- to be loadedpublic void removeComponent(Model.Align align)
align
- where component should be removedpublic void saveCoupling(boolean saveAs)
public void setTimestepUnit(TimestepUnit unit)
public boolean isStateFullyLoaded()
public void onTransientCheckBoxCheck(Model.Align align, int index)
align
- - left of rightindex
- - the index of transient panelprivate void pairTransientPanels(Connection c)
c
- - a connection to specify two transient panelsprivate void unpairTransientPanels(Model.Align align, int index)
pairTransientPanels(Connection)
align
- index
- public void onTransientCheckBoxUncheck(Model.Align align, int index)
align
- - left or rightindex
- - the index of transient panelpublic void onTransientPanelDoubleClick(TransientPanel transPanel)
transPanel
- private void showCouplingDialog(Connection clickedConnection)
private void clearSelectedTransients()
public void onTransientPanelSingleClick(TransientPanel transPanel, boolean controlDown)
transPanel
- - transient panel that was clickedcontrolDown
- - whether the control button was pressedprivate void setTransientsSelectedState(boolean selected, Model.Align align, int index)
selected
- align
- index
- public void setTransientCoupleData(TransientCouple transientCouple)
transientCouple
- private void reset()
private void goToStateEmpty()
private void goToStateLeftLoaded()
private void goToStateRightLoaded()
private void goToStateFullyLoaded()
private void saveFileInfo(java.io.File file)
private void updateGuiWithComponent(Model.Align align)
private void updateGuiWithCoupling()
private void updateGlassPaneWithConnections()
private void resetLastSelectedTransientPanelIndices()
private void checkTransientCheckBox(Model.Align align, int index)
align
- LEFT or RIGHTindex
- of transient panelprivate void uncheckTransientCheckBox(Model.Align align, int index)
align
- LEFT or RIGHTindex
- of transient panelprivate void uncheckUnconnectedTransientCheckBoxes(Model.Align align)
align
- LEFT or RIGHTprivate void disableAllCheckBoxesBut(Model.Align align, java.lang.String transientStandardName, int collectionSize)
align
- LEFT or RIGHTtransientStandardName
- private void disableAllCheckBoxesBut(Model.Align align, int index)
align
- index
- private void enableAllCheckBoxes()
public void repaintGlassPane()
public void showSelectComponentsDialog()
public boolean hasDefaultCouplingParams()
public void setDefaultCouplingParams(TransientCouple donor)
public TransientCouple getDefaultCouplingParams()
public void onComponentsSelected(int leftCompId, int rightCompId)
onComponentsSelected
在接口中 SelectComponentsDialog.SelectComponentsDialogActionsListener
leftCompId
- rightCompId
- public void onSelectComponentsDialogClosed()
public boolean onNotCompatibleTimestepUnitTypeSelected()