Commit 12f1f7c5 authored by Alexander Diewald's avatar Alexander Diewald
Browse files

DSE.UI Dash: Disable view buttons if no project is loaded

Issue-Ref: 4064
Issue-Url: https://af3-developer.fortiss.org/issues/4064

Signed-off-by: Alexander Diewald's avatarAlexander Diewald <diewald@fortiss.org>
parent 84d61f8b
......@@ -62,12 +62,12 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Button fx:id="constraintsButton" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#onConstaintsButton" text="Constraints">
<Button fx:id="constraintsButton" disable="true" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#onConstaintsButton" text="Constraints">
<GridPane.margin>
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
</GridPane.margin>
</Button>
<Button fx:id="objectiveButton" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#onObjectivesButton" text="Objectives" GridPane.rowIndex="1">
<Button fx:id="objectiveButton" disable="true" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#onObjectivesButton" text="Objectives" GridPane.rowIndex="1">
<GridPane.margin>
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
</GridPane.margin>
......@@ -82,7 +82,7 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Button fx:id="synthesisButton" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#onSynthesisButton" text="Synthesis">
<Button fx:id="synthesisButton" disable="true" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#onSynthesisButton" text="Synthesis">
<GridPane.margin>
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
</GridPane.margin>
......@@ -97,7 +97,7 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Button fx:id="visualizationButton" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#onVisualizationButton" text="Visualization">
<Button fx:id="visualizationButton" disable="true" maxHeight="1.7976931348623157E308" maxWidth="1.7976931348623157E308" mnemonicParsing="false" onAction="#onVisualizationButton" text="Visualization">
<GridPane.margin>
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
</GridPane.margin>
......
DashboardFXController.java ade3bb868548fdc58c58cbe9648b3ff3cc281dad GREEN
DashboardFXController.java cf5f533579f593589358a7175b7b941709b1a717 YELLOW
DashboardFXViewPart.java 2ff7e676b3ac9053b713d6412c92466af7fff2e7 GREEN
......@@ -58,17 +58,9 @@ public class DashboardFXController extends CompositeFXControllerBase<AnchorPane,
@FXML
private Button objectivesButton;
/** Launches the platform synthesis page. */
@FXML
private Button platformButton;
/** Launches the deployment synthesis page. */
@FXML
private Button deploymentButton;
/** Launches the scheduling synthesis page. */
/** Launches the synthesis page. */
@FXML
private Button scheduleButton;
private Button synthesisButton;
/** Launches the visualization page. */
@FXML
......@@ -123,13 +115,33 @@ public class DashboardFXController extends CompositeFXControllerBase<AnchorPane,
wizard.dispose();
}
/** {@inheritDoc} */
@Override
public String getFXMLLocation() {
return "DashboardLayout.fxml";
}
/** {@inheritDoc} */
@Override
public void initialize() {
EventBroker.getInstance().addListener(this);
DSE activeDSE = IDSEPerspectiveManager.INSTANCE.getCurrentlySelectedDSE();
updatePrjLabel(activeDSE);
if(activeDSE != null) {
enableViewButtons(true);
}
}
/** {@inheritDoc} */
@Override
public void propertyChanged(Object source, DSE_EVENT propId) {
if(propId == DSE_SELECTED_EVENT && source instanceof DSE) {
updatePrjLabel((DSE)source);
enableViewButtons(true);
} else if(propId == DSE_REMOVED_EVENT) {
updatePrjLabel(null);
enableViewButtons(false);
}
}
......@@ -144,16 +156,11 @@ public class DashboardFXController extends CompositeFXControllerBase<AnchorPane,
}
}
/** {@inheritDoc} */
@Override
public String getFXMLLocation() {
return "DashboardLayout.fxml";
}
/** {@inheritDoc} */
@Override
public void initialize() {
EventBroker.getInstance().addListener(this);
updatePrjLabel(IDSEPerspectiveManager.INSTANCE.getCurrentlySelectedDSE());
/** Enables/Disables the buttons for opening views for specific DSE tasks. */
private void enableViewButtons(boolean enable) {
objectivesButton.setDisable(!enable);
constaintsButton.setDisable(!enable);
synthesisButton.setDisable(!enable);
visualizationButton.setDisable(!enable);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment