From 3f6d638963449a00abd74ddd7124bf8f66ef4765 Mon Sep 17 00:00:00 2001 From: Eddie Groh <groh@fortiss.org> Date: Tue, 20 Jun 2023 11:47:55 +0200 Subject: [PATCH] Added simple Metrics View Issue-Ref: 4310 Issue-Url: https://git.fortiss.org/af3/af3/-/issues/4310 Signed-off-by: Eddie Groh <groh@fortiss.org> --- org.fortiss.tooling.ext.quality.ui/.classpath | 1 + .../META-INF/MANIFEST.MF | 2 +- .../icons/library.png | Bin 0 -> 675 bytes org.fortiss.tooling.ext.quality.ui/plugin.xml | 10 +++ .../ext/quality/ui/view/fx/MetricsViewFx.fxml | 32 +++++++++ .../quality/ui/view/fx/IMetricsViewPart.java | 28 ++++++++ .../ui/view/fx/MetricsFXController.java | 67 ++++++++++++++++++ .../quality/ui/view/fx/MetricsFXViewPart.java | 50 +++++++++++++ 8 files changed, 189 insertions(+), 1 deletion(-) create mode 100644 org.fortiss.tooling.ext.quality.ui/icons/library.png create mode 100644 org.fortiss.tooling.ext.quality.ui/res/org/fortiss/tooling/ext/quality/ui/view/fx/MetricsViewFx.fxml create mode 100644 org.fortiss.tooling.ext.quality.ui/src/org/fortiss/tooling/ext/quality/ui/view/fx/IMetricsViewPart.java create mode 100644 org.fortiss.tooling.ext.quality.ui/src/org/fortiss/tooling/ext/quality/ui/view/fx/MetricsFXController.java create mode 100644 org.fortiss.tooling.ext.quality.ui/src/org/fortiss/tooling/ext/quality/ui/view/fx/MetricsFXViewPart.java diff --git a/org.fortiss.tooling.ext.quality.ui/.classpath b/org.fortiss.tooling.ext.quality.ui/.classpath index e801ebfb4..7da5e78bc 100644 --- a/org.fortiss.tooling.ext.quality.ui/.classpath +++ b/org.fortiss.tooling.ext.quality.ui/.classpath @@ -3,5 +3,6 @@ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> + <classpathentry kind="src" path="res"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/org.fortiss.tooling.ext.quality.ui/META-INF/MANIFEST.MF b/org.fortiss.tooling.ext.quality.ui/META-INF/MANIFEST.MF index 6aae7a77c..22a3e7f38 100644 --- a/org.fortiss.tooling.ext.quality.ui/META-INF/MANIFEST.MF +++ b/org.fortiss.tooling.ext.quality.ui/META-INF/MANIFEST.MF @@ -1,6 +1,6 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 -Bundle-Name: org.fortiss.tooling.ext.quality.ui +Bundle-Name: %pluginName Bundle-SymbolicName: org.fortiss.tooling.ext.quality.ui;singleton:=true Bundle-Version: 1.0.0 Automatic-Module-Name: org.fortiss.tooling.ext.quality.ui diff --git a/org.fortiss.tooling.ext.quality.ui/icons/library.png b/org.fortiss.tooling.ext.quality.ui/icons/library.png new file mode 100644 index 0000000000000000000000000000000000000000..3c63b714bc5d9b65e08f80b35ac8df1e1b5a7339 GIT binary patch literal 675 zcmV;U0$lxxP)<h;3K|Lk000e1NJLTq000mG000mO1^@s6AM^iV00009a7bBm000id z000id0mpBsWB>pHRY^oaR5*>Dlf6zGQ4oc{-Mh=$@-9D$EF@C7qo6U88&ZU4utc3S zlu+gk(nX?%E**s>I%*`~DIkC&rNUUSKX*O%uJ@*~Q4}mi%2cBnoimy_XFTT|p67i6 zCV*vegh0bN_x<liFi&1yUQVMZT8I`AR#sL%FY3(+qVw}}k|d$kYSC)7h@uD)p(qN{ zG-YdR>)j#(Z+m<Dt5WLY#>U1<yWL(}US3X`&1SRFXav6Rdv#sA$z)O$MNxJ-oga^n zk3aA3?jCM#Zl0#oX(LcdJ)fPOeMpjoMx%l6`)`KKZV)=>x^-Q5CzA<TmeKF`zXT%U z-`?KRZnsI2gr%h=f*_!(Do#&N0odEyLn(!|7Gn%qmN6cW5fMKS5tZjTaU2tdA<j95 z!y$vg0OuS4M@L8W`+e5e*AWrQvZN>qL_`JFTC~<=S%y-ItE(%nudi8KTO*ER0Maz& z<m7~%ogKQ}E?R5Kvcy`8UsV+%LZ0VjSw^qd!#T&n!2z94ht17R4i67;&e7}jD2f8D zH6lV)RRqQuPejmK69fU)TCyx-I2<w>jfkR%hldBW){I6Ys;YV=FvfU+wN{m7iBbyB z^9aKbYc1pPm^{xB5uTr)vDT93IrEigE2zL)8|HaVUDs4q#l^)1)>@8_k6(4Xyu8Hs zeFlR8ySuw+t<hRztqlWXOsKU+DMcK|?C<Zhy1GgfMMP2bDyfK&rYZOL_ZVZCPNx`S zLN5%%Z@}E97H|t6;;pd&p1j#NzMmEU1^$!7I_G|QbF=(!{08pwTb)pyzc2s*002ov JPDHLkV1iQTFd+Z{ literal 0 HcmV?d00001 diff --git a/org.fortiss.tooling.ext.quality.ui/plugin.xml b/org.fortiss.tooling.ext.quality.ui/plugin.xml index 29c7ad164..e8d5d353a 100644 --- a/org.fortiss.tooling.ext.quality.ui/plugin.xml +++ b/org.fortiss.tooling.ext.quality.ui/plugin.xml @@ -8,4 +8,14 @@ contributor="org.fortiss.tooling.ext.quality.ui.ModelQualityExtractionMenu"> </contextMenuContribution> </extension> + <extension + point="org.eclipse.ui.views"> + <view + class="org.fortiss.tooling.ext.quality.ui.view.fx.MetricsFXViewPart" + icon="icons/library.png" + id="org.fortiss.tooling.ext.quality.ui.metricsView" + name="Metrics" + restorable="true"> + </view> + </extension> </plugin> \ No newline at end of file diff --git a/org.fortiss.tooling.ext.quality.ui/res/org/fortiss/tooling/ext/quality/ui/view/fx/MetricsViewFx.fxml b/org.fortiss.tooling.ext.quality.ui/res/org/fortiss/tooling/ext/quality/ui/view/fx/MetricsViewFx.fxml new file mode 100644 index 000000000..f3d4a50e9 --- /dev/null +++ b/org.fortiss.tooling.ext.quality.ui/res/org/fortiss/tooling/ext/quality/ui/view/fx/MetricsViewFx.fxml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import javafx.scene.control.Button?> +<?import javafx.scene.control.Label?> +<?import javafx.scene.control.SplitPane?> +<?import javafx.scene.control.TextField?> +<?import javafx.scene.control.TreeTableView?> +<?import javafx.scene.layout.AnchorPane?> +<?import javafx.scene.layout.BorderPane?> + +<SplitPane fx:id="metricsSplitPane" + dividerPositions="0.5" maxHeight="1.7976931348623157E308" + maxWidth="1.7976931348623157E308" minHeight="-Infinity" + minWidth="-Infinity" orientation="VERTICAL" prefHeight="400.0" + prefWidth="1035.0" xmlns="http://javafx.com/javafx/13" + xmlns:fx="http://javafx.com/fxml/1"> + <items> + <BorderPane maxHeight="-Infinity" minHeight="-Infinity" + prefHeight="25.0" prefWidth="626.0"> + <center> + <Label fx:id="topLabel" alignment="CENTER" + contentDisplay="CENTER" prefHeight="51.0" prefWidth="247.0" + textAlignment="CENTER" BorderPane.alignment="CENTER" /> + </center> + <left> + <Button fx:id="refreshButton" mnemonicParsing="false" + onAction="#onRefreshMetricsSubmit" text="Refresh Metrics" + BorderPane.alignment="CENTER" /> + </left> + </BorderPane> + </items> +</SplitPane> diff --git a/org.fortiss.tooling.ext.quality.ui/src/org/fortiss/tooling/ext/quality/ui/view/fx/IMetricsViewPart.java b/org.fortiss.tooling.ext.quality.ui/src/org/fortiss/tooling/ext/quality/ui/view/fx/IMetricsViewPart.java new file mode 100644 index 000000000..058875fa6 --- /dev/null +++ b/org.fortiss.tooling.ext.quality.ui/src/org/fortiss/tooling/ext/quality/ui/view/fx/IMetricsViewPart.java @@ -0,0 +1,28 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2023 fortiss GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.tooling.ext.quality.ui.view.fx; + +/** + * Interface for views displaying the Metrics view + * + * @author groh + */ +public interface IMetricsViewPart { + + /** View ID for reuse library views. */ + // Keep in sync with plugin.xml + public static String REUSE_LIBRARY_VIEW_ID = "org.fortiss.tooling.ext.quality.ui.metricsView"; +} diff --git a/org.fortiss.tooling.ext.quality.ui/src/org/fortiss/tooling/ext/quality/ui/view/fx/MetricsFXController.java b/org.fortiss.tooling.ext.quality.ui/src/org/fortiss/tooling/ext/quality/ui/view/fx/MetricsFXController.java new file mode 100644 index 000000000..40f38516d --- /dev/null +++ b/org.fortiss.tooling.ext.quality.ui/src/org/fortiss/tooling/ext/quality/ui/view/fx/MetricsFXController.java @@ -0,0 +1,67 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2023 fortiss GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.tooling.ext.quality.ui.view.fx; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import org.fortiss.tooling.common.ui.javafx.layout.CompositeFXControllerBase; + +import javafx.fxml.FXML; +import javafx.scene.Node; +import javafx.scene.control.Button; +import javafx.scene.control.Label; +import javafx.scene.control.SplitPane; + +/** + * FX Controller for the Metrics view. + * + * @author groh + */ + +@SuppressWarnings("unchecked") +public class MetricsFXController extends CompositeFXControllerBase<SplitPane, Node> { + + /** The refresh {@link Button} to refresh the metrics. */ + @FXML + private Button refreshButton; + + /** The central top {@link Label} to display short messages. */ + @FXML + private Label topLabel; + + /** Time format when displaying updating time. */ + private final DateTimeFormatter timeFormat = DateTimeFormatter.ofPattern("HH:mm:ss"); + + /** {@inheritDoc} */ + @Override + public String getFXMLLocation() { + return "MetricsViewFx.fxml"; + } + + /** {@inheritDoc} */ + @Override + public void initialize() { + + } + + /** + * Is triggered when the refresh button is pressed. + */ + public void onRefreshMetricsSubmit() { + LocalDateTime currentTime = LocalDateTime.now(); + topLabel.setText("View was updated at " + timeFormat.format(currentTime)); + } +} diff --git a/org.fortiss.tooling.ext.quality.ui/src/org/fortiss/tooling/ext/quality/ui/view/fx/MetricsFXViewPart.java b/org.fortiss.tooling.ext.quality.ui/src/org/fortiss/tooling/ext/quality/ui/view/fx/MetricsFXViewPart.java new file mode 100644 index 000000000..d422973c6 --- /dev/null +++ b/org.fortiss.tooling.ext.quality.ui/src/org/fortiss/tooling/ext/quality/ui/view/fx/MetricsFXViewPart.java @@ -0,0 +1,50 @@ +/*-------------------------------------------------------------------------+ +| Copyright 2023 fortiss GmbH | +| | +| Licensed under the Apache License, Version 2.0 (the "License"); | +| you may not use this file except in compliance with the License. | +| You may obtain a copy of the License at | +| | +| http://www.apache.org/licenses/LICENSE-2.0 | +| | +| Unless required by applicable law or agreed to in writing, software | +| distributed under the License is distributed on an "AS IS" BASIS, | +| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | +| See the License for the specific language governing permissions and | +| limitations under the License. | ++--------------------------------------------------------------------------*/ +package org.fortiss.tooling.ext.quality.ui.view.fx; + +import org.eclipse.ui.part.ViewPart; +import org.fortiss.tooling.common.ui.javafx.AF3FXViewPart; + +/** + * {@link ViewPart} for the FX implementation of the metrics view. + * + * @author groh + */ +public class MetricsFXViewPart extends AF3FXViewPart implements IMetricsViewPart { + + /** The FX Controller for this view. */ + private static final MetricsFXController VIEW_CONTROLLER = new MetricsFXController(); + + /** + * Constructor. + * + * @throws Exception + */ + public MetricsFXViewPart() throws Exception { + super(VIEW_CONTROLLER, null); + } + + /** + * Returns the initialized {@link MetricsFXController} for the reuse + * version of the {@link AF3FXViewPart}. + * + * @return The view controller for the metrics view + */ + public static MetricsFXController getMetricsFXController() { + return VIEW_CONTROLLER; + } + +} -- GitLab