Skip to content
Snippets Groups Projects
Commit f312ae24 authored by Tiziano Munaro's avatar Tiziano Munaro
Browse files

Refactor KISS-related Java FX views

parent d9a71df5
No related branches found
No related tags found
1 merge request!123[4020] KISS View to JavaFX
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.BorderPane?>
<BorderPane fx:id="borderPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<center>
<TextArea fx:id="textArea" prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER" />
</center>
<bottom>
<TextField fx:id="textField" onAction="#onTextFieldAction" prefHeight="100.0" prefWidth="800.0" BorderPane.alignment="CENTER" />
</bottom>
</BorderPane>
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.VBox?>
<VBox fx:id="vBox" xmlns:fx="http://javafx.com/fxml/1" />
<BorderPane fx:id="borderPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
<bottom>
<VBox fx:id="vBox" prefHeight="100.0" prefWidth="800.0" BorderPane.alignment="CENTER">
<children>
<ScrollPane fitToWidth="true" hbarPolicy="NEVER" prefHeight="300.0" prefWidth="800.0">
<content>
<Label fx:id="label" style="-fx-padding: 5; -fx-border-style: solid inside; -fx-border-width: 2; -fx-border-insets: 5; -fx-border-radius: 5; -fx-border-color: lightblue;" text="Welcome to KISS!&#10;&#10;This is the kernel introspection system service." wrapText="true" />
</content>
</ScrollPane>
</children></VBox>
</bottom>
</BorderPane>
ClipboardCopyHelper.java 1d9a9891278ab84932857eaa978dda4391978047 YELLOW
KISSCompositeFXController.java a7f61f4dee41657c4b2b897b63d44482fb31bb64 RED
KISSConsoleFXController.java 0940c991532ff509c44a82672bb63875d2222ef4 RED
KISSCompositeFXController.java 39b92f1887ef936272ccaff70dfcdf52f6f96d2e YELLOW
KISSConsoleFXController.java dc8b80927cb9815deac822e2ff5a0260242f0b5f RED
KISSConsoleFXViewPart.java 5d9a2c355f52735cde8ba1ee0d7d4c12c43068b3 YELLOW
KISSFXController.java 32bb6c7457f85aafdb4a38247261ea79b0ff2c65 RED
KISSServicesFXController.java d9ea47e7112b623bda66851d954446647ad28319 RED
KISSServicesFXViewPart.java 1a8370028bf79a8071f616dae985df3831c7f8b6 RED
KISSFXController.java c38fc9efa826c68e74ac118e666088f407cb54fb YELLOW
KISSServicesFXController.java cb59024c94164cf187041634c38a6dee1107e3a2 YELLOW
KISSServicesFXViewPart.java 1a8370028bf79a8071f616dae985df3831c7f8b6 YELLOW
......@@ -15,15 +15,26 @@
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.kernel.ui.introspection;
import org.fortiss.tooling.common.ui.javafx.control.treetableview.DynamicTreeTableViewer;
import org.fortiss.tooling.common.ui.javafx.layout.CompositeFXControllerBase;
import org.fortiss.tooling.kernel.introspection.IIntrospectionItem;
import javafx.scene.Node;
import javafx.scene.layout.BorderPane;
/**
* Abstract class specifying the functionality to be provided by a controller to be contained in a
* {@link KISSFXController}-based view.
*
* @author munaro
*/
@SuppressWarnings("unchecked")
public abstract class KISSCompositeFXController<T extends Node>
extends CompositeFXControllerBase<T, Node> {
public abstract void changed(BorderPane borderPane, IIntrospectionItem selection);
/**
* This method is executed each time the {@link IIntrospectionItem} selected in the
* {@link KISSFXController}'s {@link DynamicTreeTableViewer} changes.
*/
public abstract void changed(IIntrospectionItem selection);
}
......@@ -18,40 +18,54 @@ package org.fortiss.tooling.kernel.ui.introspection;
import org.fortiss.tooling.common.ui.javafx.layout.CompositeFXControllerBase;
import org.fortiss.tooling.kernel.service.IKernelIntrospectionSystemService;
import javafx.fxml.FXML;
import javafx.scene.Node;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.BorderPane;
/**
* Controller for the KISS console view.
*
* @author munaro
*/
@SuppressWarnings("unchecked")
public class KISSConsoleFXController extends CompositeFXControllerBase<AnchorPane, Node> {
/** {@link BorderPane} containing both the {@link TextArea} and the {@link TextField}. */
@FXML
private BorderPane borderPane;
/** The displayed console content area. */
@FXML
private TextArea textArea;
/** The input text field. */
private TextField inputField;
@FXML
private TextField textField;
/** The introspection service. */
private IKernelIntrospectionSystemService kiss;
/** {@inheritDoc} */
@Override
public String getFXMLLocation() {
// TODO Auto-generated method stub
return null;
return "KISSConsole.fxml";
}
/** Executes the command entered in the text field. */
@FXML
private void onTextFieldAction() {
String cmd = textField.getText();
// kiss.executeConsoleCommand(cmd);
textField.setText("");
}
/** {@inheritDoc} */
@Override
public void initialize() {
// kiss = ikiss;
// textArea = new TextArea();
// parent.setCenter(textArea);
// inputField = new TextField();
// inputField.setOnAction(evt -> {
// String cmd = inputField.getText();
// ikiss.executeConsoleCommand(cmd);
// inputField.setText("");
// });
// parent.setBottom(inputField);
// eventBroker.subscribe(EVENT_TOPIC_CONSOLE_UPDATE, this);
kiss = IKernelIntrospectionSystemService.getInstance();
// textArea.setText(kiss.getConsoleContent());
}
}
......@@ -32,6 +32,12 @@ import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import javafx.scene.layout.BorderPane;
/**
* Controller for the Java FX-based UI common to all KISS-based views. The specific views to be
* displayed have extend the abstract {@link KISSCompositeFXController} class.
*
* @author munaro
*/
public class KISSFXController extends CompositeFXControllerBase<BorderPane, Node>
implements ChangeListener<TreeItem<IIntrospectionItem>> {
......@@ -43,7 +49,7 @@ public class KISSFXController extends CompositeFXControllerBase<BorderPane, Node
protected KernelIntrospectionSystemService kiss;
/** The tree viewer. */
private TreeView<IIntrospectionItem> treeview;
/** The {@link KISSCompositeFXController} of the specific KISS view to be displayed. */
private KISSCompositeFXController<? extends Node> composite;
/** Constructor. */
......@@ -100,14 +106,14 @@ public class KISSFXController extends CompositeFXControllerBase<BorderPane, Node
borderPane.setLeft(treeview);
Node bottom = getFirst(getContainments()).get().getLayout();
borderPane.setBottom(bottom);
Node center = getFirst(getContainments()).get().getLayout();
borderPane.setCenter(center);
}
/** {@inheritDoc} */
@Override
public void changed(ObservableValue<? extends TreeItem<IIntrospectionItem>> observable,
TreeItem<IIntrospectionItem> oldValue, TreeItem<IIntrospectionItem> newValue) {
composite.changed(borderPane, newValue.getValue());
composite.changed(newValue.getValue());
}
}
......@@ -27,13 +27,24 @@ import javafx.scene.control.Label;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.VBox;
/**
* Controller for the view for the detailed inspection of KISS services.
*
* @author munaro
*/
public class KISSServicesFXController extends KISSCompositeFXController<VBox> {
/** {@link BorderPane} displaying the description and the details of the selected service. */
@FXML
private BorderPane borderPane;
/** {@link VBox} displaying the description of the selected service. */
@FXML
private VBox vBox;
/** The description label at the bottom. */
private Label description;
@FXML
private Label label;
/** The greeting text. */
static final String GREETING =
......@@ -48,17 +59,12 @@ public class KISSServicesFXController extends KISSCompositeFXController<VBox> {
/** {@inheritDoc} */
@Override
public void initialize() {
description = new Label();
description.setText(GREETING);
vBox.setStyle("-fx-padding: 5;" + "-fx-border-style: solid inside;" +
"-fx-border-width: 2;" + "-fx-border-insets: 5;" + "-fx-border-radius: 5;" +
"-fx-border-color: lightblue;");
vBox.getChildren().add(description);
// nothing to do
}
/** {@inheritDoc} */
@Override
public void changed(BorderPane borderPane, IIntrospectionItem selection) {
public void changed(IIntrospectionItem selection) {
Node center = new Label("No details available!");
String descr = GREETING;
if(selection instanceof IIntrospectiveKernelService) {
......@@ -75,7 +81,7 @@ public class KISSServicesFXController extends KISSCompositeFXController<VBox> {
}
}
}
description.setText(descr);
label.setText(descr);
borderPane.setCenter(center);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment