Skip to content

Commit

Permalink
Initial public version
Browse files Browse the repository at this point in the history
  • Loading branch information
davetcc committed Nov 9, 2024
1 parent a766b57 commit 5043f4a
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 17 deletions.
10 changes: 6 additions & 4 deletions java/embedControlJavaFx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ Contained in this package is the source code for the complete user interface tha

It is likely before any public release that you'll want to customize the application. This can easily be acheived by editing the images and forms stored in the `src/main/resources` folder. A few of the most common ones are provided here:

* `fximg/large_icon.png` is the icon drawn by the application forms.
* `fximg/embedCONTROL.ico` is the start up application icon, only used by the packager on Windows
* `fximg/MyIcons.icns` is the start up application icon, only used by the packager on macOS
* `version.properties` this contains the name of the application, and the build version and timestamp (the later are set during a maven build).
* `aboutPage.fxml` is the JavaFX form definition for the about window.
* `generalSettings.fxml` is the JavaFX settings form definition, only change this if you also modify the controller accordingly.
* `mainWindow.fxml` is the main window when the app starts
* `version.properties` is automatically set by maven during the build
* `fximg/large_icon.png` is the icon drawn by the application forms.
* `fximg/embedCONTROL.ico` is the start up application icon, only used by the packager on Windows
* `fximg/MyIcons.icns` is the start up application icon, only used by the packager on macOS

You can use the EmbedControl icon or logo to show compatibility with TagVal protocol.

You can also provide your own custom pages, each page must extend from `PanelPresentable` and can be added to the navigation manager, in this case the `JfxNavigationHeader` in `RemoteConnectionPanel` using `navigationManager.addCustomMenuPanel(subMenuCustom, myPanelPresentable)`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void start(Stage primaryStage) throws Exception {
// At this point we build a JavaFX stage and load up our main window
primaryStage.getIcons().add(new Image(
Objects.requireNonNull(getClass().getResourceAsStream("/fximg/large_icon.png"))));
primaryStage.setTitle("embedCONTROL desktop");
primaryStage.setTitle(applicationContext.getHelper().getTitle());
FXMLLoader loader = new FXMLLoader(getClass().getResource("/mainWindow.fxml"));
Pane myPane = loader.load();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void initialize(MainWindowController controller) {
allPresentableViews.addAll(defaultViews);
allPresentableViews.addAll(loadedPanels);

controller.initialise(getSettings(), allPresentableViews, versionHelper);
controller.initialise(allPresentableViews, versionHelper);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,12 @@ public VersionInfo getVersion() {
public String getBuildTimestamp() {
return props.getProperty("build.timestamp", "");
}

public String getShortTitle() {
return props.getProperty("build.shortTitle");
}

public String getTitle() {
return props.getProperty("build.title");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@

public class AboutController {
public Label versionLabel;
public Label titleLabel;

public void initialise(VersionHelper versionHelper) {
versionLabel.setText("Version " + versionHelper.getVersion() + " built on " + versionHelper.getBuildTimestamp());
titleLabel.setText(versionHelper.getTitle());
}

public void onVisitDocs(ActionEvent actionEvent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package com.thecoderscorner.embedcontrol.jfxapp.dialog;

import com.thecoderscorner.embedcontrol.core.controlmgr.PanelPresentable;
import com.thecoderscorner.embedcontrol.core.service.GlobalSettings;
import com.thecoderscorner.embedcontrol.jfxapp.VersionHelper;
import javafx.collections.ObservableList;
import javafx.scene.Node;
Expand Down Expand Up @@ -42,17 +41,16 @@ public class MainWindowController {
public Label versionField;
public ListView<PanelPresentable<Node>> connectionList;
public BorderPane detailPane;
private GlobalSettings settings;
public Label titleBranding;
private PanelPresentable currentlyDisplayed;

public void initialise(GlobalSettings settings, ObservableList<PanelPresentable<Node>> initialPanels, VersionHelper versionHelper) {
this.settings = settings;

public void initialise(ObservableList<PanelPresentable<Node>> initialPanels, VersionHelper versionHelper) {
titleBranding.setText(versionHelper.getShortTitle());
versionField.setText("Version " + versionHelper.getVersion());

connectionList.setCellFactory(list -> new PanelPresentableListCell());
connectionList.setCellFactory(_ -> new PanelPresentableListCell());
connectionList.setItems(initialPanels);
connectionList.getSelectionModel().selectedItemProperty().addListener((observableValue, oldVal, newVal) -> {
connectionList.getSelectionModel().selectedItemProperty().addListener((_, _, newVal) -> {
if(newVal != null) {
try {
logger.log(INFO, "Change panel to ", newVal.getPanelName());
Expand Down
2 changes: 1 addition & 1 deletion java/embedControlJavaFx/src/main/resources/aboutPage.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<Image url="@fximg/large_icon.png" />
</image>
</ImageView>
<Label text="embedCONTROL">
<Label text="TBD" fx:id="titleLabel">
<font>
<Font size="24.0" />
</font>
Expand Down
4 changes: 2 additions & 2 deletions java/embedControlJavaFx/src/main/resources/mainWindow.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
<top>
<VBox prefHeight="178.0" prefWidth="200.0" style="-fx-background-color: #4bf;" BorderPane.alignment="CENTER">
<children>
<Label contentDisplay="TOP" text="embedCONTROL">
<Label contentDisplay="TOP" text="branding" fx:id="titleBranding">
<font>
<Font name="Arial" size="24.0" />
<Font name="Arial" size="20.0" />
</font>
<graphic>
<ImageView fitHeight="111.0" fitWidth="117.0" pickOnBounds="true" preserveRatio="true">
Expand Down
3 changes: 3 additions & 0 deletions java/embedControlJavaFx/src/main/resources/version.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#
#

build.title=EmbedControl desktop
build.shortTitle=EmbedControl

build.version=${project.version}
build.groupId=${project.groupId}
build.artifactId=${project.artifactId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<Image url="@fximg/ethernet-connection.jpg" />
</image>
</ImageView>
<Label text="embedCONTROL">
<Label text="Connecting With Device">
<font>
<Font size="24.0" />
</font>
Expand Down

0 comments on commit 5043f4a

Please sign in to comment.