Przeglądaj źródła

Initial commit

- GUI ready
master
gituser 10 miesięcy temu
commit
0c8d0aa11d
34 zmienionych plików z 2142 dodań i 0 usunięć
  1. 40
    0
      .gitignore
  2. 70
    0
      pom.xml
  3. 15
    0
      src/main/assembly/zip.xml
  4. 158
    0
      src/main/java/ch/spherICIT/components/statusbar/FSStatusBar.form
  5. 270
    0
      src/main/java/ch/spherICIT/components/statusbar/FSStatusBar.java
  6. 6
    0
      src/main/java/ch/spherICIT/components/switchbtn/EventSwitchSelected.java
  7. 140
    0
      src/main/java/ch/spherICIT/components/switchbtn/SwitchButton.java
  8. 5
    0
      src/main/java/ch/spherICIT/main/ConnectionState.java
  9. 5
    0
      src/main/java/ch/spherICIT/main/ConnectionStateInfo.java
  10. 7
    0
      src/main/java/ch/spherICIT/main/IConnectionState.java
  11. 54
    0
      src/main/java/ch/spherICIT/main/LogWindow.form
  12. 180
    0
      src/main/java/ch/spherICIT/main/LogWindow.java
  13. 26
    0
      src/main/java/ch/spherICIT/main/MainApp.java
  14. 32
    0
      src/main/java/ch/spherICIT/main/MainFrame.java
  15. 369
    0
      src/main/java/ch/spherICIT/main/MainPanel.form
  16. 508
    0
      src/main/java/ch/spherICIT/main/MainPanel.java
  17. 58
    0
      src/main/java/ch/spherICIT/main/Message.java
  18. BIN
      src/main/resources/Application_Logo.ico
  19. BIN
      src/main/resources/Application_Logo.jpg
  20. BIN
      src/main/resources/Application_Logo.png
  21. 42
    0
      src/main/resources/Application_Logo.svg
  22. BIN
      src/main/resources/Application_Logo_BG.png
  23. BIN
      src/main/resources/Arduino_Logo.png
  24. BIN
      src/main/resources/Arduino_Logo_small.png
  25. BIN
      src/main/resources/blue_led_off.png
  26. BIN
      src/main/resources/blue_led_on.png
  27. 157
    0
      src/main/resources/blue_led_on.svg
  28. BIN
      src/main/resources/cable_reconnect.png
  29. BIN
      src/main/resources/cable_reconnect_pr.png
  30. BIN
      src/main/resources/log.jpg
  31. BIN
      src/main/resources/log24.png
  32. BIN
      src/main/resources/log32.png
  33. BIN
      src/main/resources/status_offline_1.png
  34. BIN
      src/main/resources/status_online_1.png

+ 40
- 0
.gitignore Wyświetl plik

@@ -0,0 +1,40 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
/.metadata
/.idea

+ 70
- 0
pom.xml Wyświetl plik

@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>ch.spherICIT</groupId>
<artifactId>FSRemoteControl</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<flatlafVersion>3.5.4</flatlafVersion>
</properties>

<dependencies>
<dependency>
<groupId>com.formdev</groupId>
<artifactId>flatlaf</artifactId>
<version>${flatlafVersion}</version>
</dependency>
<dependency>
<groupId>com.formdev</groupId>
<artifactId>flatlaf</artifactId>
<version>${flatlafVersion}</version>
<classifier>windows-x86_64</classifier>
<type>dll</type>
</dependency>
<dependency>
<groupId>org.swinglabs</groupId>
<artifactId>swingx</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>net.sf.flexjson</groupId>
<artifactId>flexjson</artifactId>
<version>3.3</version>
</dependency>
<dependency>
<groupId>com.fazecast</groupId>
<artifactId>jSerialComm</artifactId>
<version>2.11.0</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/zip.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>

+ 15
- 0
src/main/assembly/zip.xml Wyświetl plik

@@ -0,0 +1,15 @@
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.1 https://maven.apache.org/xsd/assembly-2.1.1.xsd">
<id>zip</id>
<includeBaseDirectory>true</includeBaseDirectory>
<formats>
<format>zip</format>
<format>dir</format>
</formats>
<dependencySets>
<dependencySet>
<outputDirectory>lib</outputDirectory>
</dependencySet>
</dependencySets>
</assembly>

+ 158
- 0
src/main/java/ch/spherICIT/components/statusbar/FSStatusBar.form Wyświetl plik

@@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="ch.spherICIT.components.statusbar.FSStatusBar">
<grid id="27dc6" binding="statusBarPnl" custom-create="true" layout-manager="GridBagLayout">
<constraints>
<xy x="20" y="20" width="500" height="33"/>
</constraints>
<properties/>
<border type="none">
<color color="-4605511"/>
</border>
<children>
<hspacer id="824c0">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<gridbag weightx="1.0" weighty="0.0"/>
</constraints>
</hspacer>
<grid id="ce429" binding="connectionStatePnl" layout-manager="GridBagLayout">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="1.0"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="47c4d" class="javax.swing.JLabel" binding="connectionStateLbl">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
<gridbag top="5" left="0" bottom="0" right="10" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="12" style="0"/>
<horizontalAlignment value="11"/>
<text value="Am Verbinden..."/>
</properties>
</component>
<component id="e88e3" class="javax.swing.JProgressBar" binding="connectionStatePrgBar">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<gridbag top="0" left="0" bottom="0" right="10" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<foreground color="-16738404"/>
<indeterminate value="true"/>
<minimumSize width="80" height="20"/>
<preferredSize width="80" height="20"/>
<requestFocusEnabled value="false"/>
<string value="Aufbau..."/>
<stringPainted value="true"/>
</properties>
</component>
<component id="29d1b" class="javax.swing.JSeparator">
<constraints>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="1.0"/>
</constraints>
<properties>
<minimumSize width="5" height="1"/>
<orientation value="1"/>
<preferredSize width="5" height="0"/>
</properties>
</component>
<component id="e2139" class="javax.swing.JButton" binding="reconnectBtn">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
<gridbag top="0" left="0" bottom="0" right="10" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<borderPainted value="false"/>
<contentAreaFilled value="false"/>
<icon value="cable_reconnect.png"/>
<label value=""/>
<maximumSize width="32" height="32"/>
<minimumSize width="32" height="32"/>
<preferredSize width="32" height="32"/>
<pressedIcon value="cable_reconnect_pr.png"/>
<text value=""/>
<visible value="false"/>
</properties>
</component>
</children>
</grid>
<grid id="4d5d5" binding="portPnl" layout-manager="GridBagLayout">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="11418" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<gridbag top="5" left="0" bottom="0" right="10" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="12" style="0"/>
<horizontalAlignment value="11"/>
<text value="Port:"/>
</properties>
</component>
<component id="9f91b" class="javax.swing.JLabel" binding="portValueLbl">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<gridbag top="5" left="0" bottom="0" right="10" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="12" style="0"/>
<text value=" "/>
</properties>
</component>
<component id="ad8df" class="javax.swing.JSeparator">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="1.0"/>
</constraints>
<properties>
<minimumSize width="5" height="1"/>
<orientation value="1"/>
<preferredSize width="5" height="0"/>
</properties>
</component>
</children>
</grid>
<grid id="af4ec" binding="versionPnl" layout-manager="GridBagLayout">
<constraints>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="60f7e" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<gridbag top="5" left="0" bottom="0" right="10" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="12" style="0"/>
<horizontalAlignment value="11"/>
<text value="Ver:"/>
</properties>
</component>
<component id="fc757" class="javax.swing.JLabel" binding="versionValueLbl">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<gridbag top="5" left="0" bottom="0" right="10" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="12" style="0"/>
<text value=" "/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
</form>

+ 270
- 0
src/main/java/ch/spherICIT/components/statusbar/FSStatusBar.java Wyświetl plik

@@ -0,0 +1,270 @@
package ch.spherICIT.components.statusbar;

import ch.spherICIT.main.ConnectionState;
import ch.spherICIT.main.IConnectionState;
import ch.spherICIT.main.ConnectionStateInfo;
import com.formdev.flatlaf.ui.FlatLineBorder;
import com.formdev.flatlaf.util.StringUtils;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JSeparator;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;
import javax.swing.plaf.FontUIResource;
import javax.swing.text.StyleContext;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Locale;

public class FSStatusBar implements IConnectionState {


private JPanel statusBarPnl;
private JPanel connectionStatePnl;
private JProgressBar connectionStatePrgBar;
private JPanel portPnl;
private JLabel connectionStateLbl;
private JLabel portValueLbl;
private JPanel versionPnl;
private JLabel versionValueLbl;
private JButton reconnectBtn;

private ActionListener reconnectActionListener;


public FSStatusBar() {
$$$setupUI$$$();
this.reconnectBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (FSStatusBar.this.reconnectActionListener != null) {
FSStatusBar.this.reconnectActionListener.actionPerformed(e);
}
}
});
}

public void setReconnectActionListener(ActionListener reconnectActionListener) {
this.reconnectActionListener = reconnectActionListener;
}

@Override
public void connectionStateChanged(ConnectionStateInfo connectionStateInfo) {
this.reconnectBtn.setVisible(false);
this.portValueLbl.setText(" ");
this.versionValueLbl.setText(" ");
if (connectionStateInfo.connectionState().equals(ConnectionState.CONNECTING)) {
this.connectionStateLbl.setText("Am Verbinden...");
this.connectionStatePrgBar.setString("Aufbau...");
this.connectionStatePrgBar.setIndeterminate(true);
} else if (connectionStateInfo.connectionState().equals(ConnectionState.CONNECTED)) {
this.connectionStateLbl.setText("Verbunden!");
this.connectionStatePrgBar.setString("OK!");
this.connectionStatePrgBar.setIndeterminate(false);
this.connectionStatePrgBar.setValue(100);
this.portValueLbl.setText(StringUtils.isEmpty(connectionStateInfo.port()) ? " " : connectionStateInfo.port());
this.versionValueLbl.setText(StringUtils.isEmpty(connectionStateInfo.version()) ? " " : connectionStateInfo.version());
} else {
this.connectionStateLbl.setText("Zeitüberschreitung!");
this.connectionStatePrgBar.setString("Nicht verbunden");
this.connectionStatePrgBar.setIndeterminate(false);
this.connectionStatePrgBar.setValue(0);
this.reconnectBtn.setVisible(true);
}
}

/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
* @noinspection ALL
*/
private void $$$setupUI$$$() {
createUIComponents();
statusBarPnl.setLayout(new GridBagLayout());
final JPanel spacer1 = new JPanel();
GridBagConstraints gbc;
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 1.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
statusBarPnl.add(spacer1, gbc);
connectionStatePnl = new JPanel();
connectionStatePnl.setLayout(new GridBagLayout());
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 0;
gbc.weighty = 1.0;
gbc.fill = GridBagConstraints.BOTH;
statusBarPnl.add(connectionStatePnl, gbc);
connectionStateLbl = new JLabel();
Font connectionStateLblFont = this.$$$getFont$$$("Bahnschrift", Font.PLAIN, 12, connectionStateLbl.getFont());
if (connectionStateLblFont != null) connectionStateLbl.setFont(connectionStateLblFont);
connectionStateLbl.setHorizontalAlignment(11);
connectionStateLbl.setText("Am Verbinden...");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.EAST;
gbc.insets = new Insets(5, 0, 0, 10);
connectionStatePnl.add(connectionStateLbl, gbc);
connectionStatePrgBar = new JProgressBar();
connectionStatePrgBar.setForeground(new Color(-16738404));
connectionStatePrgBar.setIndeterminate(true);
connectionStatePrgBar.setMinimumSize(new Dimension(80, 20));
connectionStatePrgBar.setPreferredSize(new Dimension(80, 20));
connectionStatePrgBar.setRequestFocusEnabled(false);
connectionStatePrgBar.setString("Aufbau...");
connectionStatePrgBar.setStringPainted(true);
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.BOTH;
gbc.insets = new Insets(0, 0, 0, 10);
connectionStatePnl.add(connectionStatePrgBar, gbc);
final JSeparator separator1 = new JSeparator();
separator1.setMinimumSize(new Dimension(5, 1));
separator1.setOrientation(1);
separator1.setPreferredSize(new Dimension(5, 0));
gbc = new GridBagConstraints();
gbc.gridx = 3;
gbc.gridy = 0;
gbc.weighty = 1.0;
gbc.fill = GridBagConstraints.BOTH;
connectionStatePnl.add(separator1, gbc);
reconnectBtn = new JButton();
reconnectBtn.setBorderPainted(false);
reconnectBtn.setContentAreaFilled(false);
reconnectBtn.setIcon(new ImageIcon(getClass().getResource("/cable_reconnect.png")));
reconnectBtn.setLabel("");
reconnectBtn.setMaximumSize(new Dimension(32, 32));
reconnectBtn.setMinimumSize(new Dimension(32, 32));
reconnectBtn.setPreferredSize(new Dimension(32, 32));
reconnectBtn.setPressedIcon(new ImageIcon(getClass().getResource("/cable_reconnect_pr.png")));
reconnectBtn.setText("");
reconnectBtn.setVisible(false);
gbc = new GridBagConstraints();
gbc.gridx = 2;
gbc.gridy = 0;
gbc.insets = new Insets(0, 0, 0, 10);
connectionStatePnl.add(reconnectBtn, gbc);
portPnl = new JPanel();
portPnl.setLayout(new GridBagLayout());
gbc = new GridBagConstraints();
gbc.gridx = 2;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.BOTH;
statusBarPnl.add(portPnl, gbc);
final JLabel label1 = new JLabel();
Font label1Font = this.$$$getFont$$$("Bahnschrift", Font.PLAIN, 12, label1.getFont());
if (label1Font != null) label1.setFont(label1Font);
label1.setHorizontalAlignment(11);
label1.setText("Port:");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(5, 0, 0, 10);
portPnl.add(label1, gbc);
portValueLbl = new JLabel();
Font portValueLblFont = this.$$$getFont$$$("Bahnschrift", Font.PLAIN, 12, portValueLbl.getFont());
if (portValueLblFont != null) portValueLbl.setFont(portValueLblFont);
portValueLbl.setText(" ");
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(5, 0, 0, 10);
portPnl.add(portValueLbl, gbc);
final JSeparator separator2 = new JSeparator();
separator2.setMinimumSize(new Dimension(5, 1));
separator2.setOrientation(1);
separator2.setPreferredSize(new Dimension(5, 0));
gbc = new GridBagConstraints();
gbc.gridx = 2;
gbc.gridy = 0;
gbc.weighty = 1.0;
gbc.fill = GridBagConstraints.BOTH;
portPnl.add(separator2, gbc);
versionPnl = new JPanel();
versionPnl.setLayout(new GridBagLayout());
gbc = new GridBagConstraints();
gbc.gridx = 3;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.BOTH;
statusBarPnl.add(versionPnl, gbc);
final JLabel label2 = new JLabel();
Font label2Font = this.$$$getFont$$$("Bahnschrift", Font.PLAIN, 12, label2.getFont());
if (label2Font != null) label2.setFont(label2Font);
label2.setHorizontalAlignment(11);
label2.setText("Ver:");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(5, 0, 0, 10);
versionPnl.add(label2, gbc);
versionValueLbl = new JLabel();
Font versionValueLblFont = this.$$$getFont$$$("Bahnschrift", Font.PLAIN, 12, versionValueLbl.getFont());
if (versionValueLblFont != null) versionValueLbl.setFont(versionValueLblFont);
versionValueLbl.setText(" ");
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(5, 0, 0, 10);
versionPnl.add(versionValueLbl, gbc);
}

/**
* @noinspection ALL
*/
private Font $$$getFont$$$(String fontName, int style, int size, Font currentFont) {
if (currentFont == null) return null;
String resultName;
if (fontName == null) {
resultName = currentFont.getName();
} else {
Font testFont = new Font(fontName, Font.PLAIN, 10);
if (testFont.canDisplay('a') && testFont.canDisplay('1')) {
resultName = fontName;
} else {
resultName = currentFont.getName();
}
}
Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
}

/**
* @noinspection ALL
*/
public JComponent $$$getRootComponent$$$() {
return statusBarPnl;
}

private void createUIComponents() {
this.statusBarPnl = new JPanel();
this.statusBarPnl.setMinimumSize(new Dimension(2, 36));
this.statusBarPnl.setPreferredSize(new Dimension(2, 36));
this.statusBarPnl.setBorder(new CompoundBorder(new EmptyBorder(3, 3, 3, 3),
new FlatLineBorder(new Insets(3, 3, 3, 3), Color.LIGHT_GRAY, 1, 10)));


}
}

+ 6
- 0
src/main/java/ch/spherICIT/components/switchbtn/EventSwitchSelected.java Wyświetl plik

@@ -0,0 +1,6 @@
package ch.spherICIT.components.switchbtn;

public interface EventSwitchSelected {

public void onSelected(boolean selected);
}

+ 140
- 0
src/main/java/ch/spherICIT/components/switchbtn/SwitchButton.java Wyświetl plik

@@ -0,0 +1,140 @@
package ch.spherICIT.components.switchbtn;

import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import javax.swing.Timer;
import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;

public class SwitchButton extends JComponent {

public boolean isSelected() {
return selected;
}

public void setSelected(boolean selected) {
this.selected = selected;
timer.start();
runEvent();
}

private Timer timer;
private float location;
private boolean selected;
private boolean mouseOver;
private float speed = 3f;
private List<EventSwitchSelected> events;

public SwitchButton() {
setBackground(new Color(0, 174, 255));
setPreferredSize(new Dimension(50, 25));
setForeground(Color.WHITE);
setCursor(new Cursor(Cursor.HAND_CURSOR));
events = new ArrayList<>();
location = 2;
timer = new Timer(0, new ActionListener() {
@Override
public void actionPerformed(ActionEvent ae) {
if (isSelected()) {
int endLocation = getWidth() - getHeight() + 2;
if (location < endLocation) {
location += speed;
repaint();
} else {
timer.stop();
location = endLocation;
repaint();
}
} else {
int endLocation = 2;
if (location > endLocation) {
location -= speed;
repaint();
} else {
timer.stop();
location = endLocation;
repaint();
}
}
}
});
addMouseListener(new MouseAdapter() {
@Override
public void mouseEntered(MouseEvent me) {
mouseOver = true;
}

@Override
public void mouseExited(MouseEvent me) {
mouseOver = false;
}

@Override
public void mouseReleased(MouseEvent me) {
if (SwingUtilities.isLeftMouseButton(me)) {
if (mouseOver) {
selected = !selected;
timer.start();
runEvent();
}
}
}
});
}

@Override
public void paint(Graphics grphcs) {
Graphics2D g2 = (Graphics2D) grphcs;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
int width = getWidth();
int height = getHeight();
float alpha = getAlpha();
if (alpha < 1) {
g2.setColor(Color.GRAY);
g2.fillRoundRect(0, 0, width, height, height, height);
}
g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
g2.setColor(getBackground());
g2.fillRoundRect(0, 0, width, height, height, height);
g2.setColor(getForeground());
g2.setComposite(AlphaComposite.SrcOver);
g2.fillOval((int) location, 2, height - 4, height - 4);
super.paint(grphcs);
}

private float getAlpha() {
float width = getPreferredSize().width - getPreferredSize().height;
if (width > 0) {
float alpha = (location - 2) / width;
if (alpha < 0) {
alpha = 0;
}
if (alpha > 1) {
alpha = 1;
}
return alpha;
}
return 1f;
}

private void runEvent() {
for (EventSwitchSelected event : events) {
event.onSelected(selected);
}
}

public void addEventSelected(EventSwitchSelected event) {
events.add(event);
}
}

+ 5
- 0
src/main/java/ch/spherICIT/main/ConnectionState.java Wyświetl plik

@@ -0,0 +1,5 @@
package ch.spherICIT.main;

public enum ConnectionState {
CONNECTING, CONNECTED, TIMEOUT
}

+ 5
- 0
src/main/java/ch/spherICIT/main/ConnectionStateInfo.java Wyświetl plik

@@ -0,0 +1,5 @@
package ch.spherICIT.main;

public record ConnectionStateInfo(ConnectionState connectionState, String port, String version) {

}

+ 7
- 0
src/main/java/ch/spherICIT/main/IConnectionState.java Wyświetl plik

@@ -0,0 +1,7 @@
package ch.spherICIT.main;

public interface IConnectionState {

public void connectionStateChanged(ConnectionStateInfo connectionStateInfo);

}

+ 54
- 0
src/main/java/ch/spherICIT/main/LogWindow.form Wyświetl plik

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="ch.spherICIT.main.LogWindow">
<grid id="27dc6" binding="mainLogPnl" layout-manager="GridBagLayout">
<constraints>
<xy x="20" y="20" width="500" height="415"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="e673e" class="javax.swing.JSeparator">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<gridbag top="0" left="0" bottom="0" right="10" weightx="1.0" weighty="0.0"/>
</constraints>
<properties/>
</component>
<component id="5bcb5" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<gridbag top="0" left="10" bottom="0" right="5" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="12" style="0"/>
<text value="Serial Port Logs"/>
</properties>
</component>
<scrollpane id="9d34d">
<constraints>
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<gridbag top="10" left="10" bottom="10" right="10" weightx="1.0" weighty="1.0"/>
</constraints>
<properties/>
<border type="line">
<color color="-4605511"/>
</border>
<children>
<component id="3b48" class="javax.swing.JTextArea" binding="logsTxtArea">
<constraints/>
<properties>
<background color="-328966"/>
<editable value="false"/>
</properties>
</component>
</children>
</scrollpane>
<vspacer id="39ef2">
<constraints>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0" ipady="10"/>
</constraints>
</vspacer>
</children>
</grid>
</form>

+ 180
- 0
src/main/java/ch/spherICIT/main/LogWindow.java Wyświetl plik

@@ -0,0 +1,180 @@
package ch.spherICIT.main;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTextArea;
import javax.swing.SwingConstants;
import javax.swing.border.TitledBorder;
import javax.swing.plaf.FontUIResource;
import javax.swing.text.StyleContext;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.HeadlessException;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

public class LogWindow extends JFrame {

public enum SendDirection {
OUT, IN
}

private JTextArea logsTxtArea;
private JPanel mainLogPnl;

private List<String> logs;
private DateTimeFormatter dateTimeFormatter;
private JButton closeBtn;

public LogWindow() throws HeadlessException {
this.dateTimeFormatter = DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm:ss");
this.logs = new ArrayList<>();
createCloseBtn();
final JPanel btnPanel = new JPanel(new GridBagLayout());
btnPanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 10, 10));
btnPanel.add(this.closeBtn);
setTitle("FS Remote Control Logs");
setIconImage(new ImageIcon(ClassLoader.getSystemResource("Application_Logo_BG.png"), "").getImage());
setSize(new Dimension(600, 400));
setLayout(new BorderLayout());
setLocationRelativeTo(null);
setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
setResizable(false);
add(this.mainLogPnl, BorderLayout.CENTER);
add(btnPanel, BorderLayout.SOUTH);

addLogEntry("{\"Sender\": \"FSRemoteControl_AN\", \"Cmd\": \"Relais_Power\", \"Val\": \"On\"}", SendDirection.IN);
addLogEntry("{\"Sender\": \"FSRemoteControl_AN\", \"Cmd\": \"Relais_Power\", \"Val\": \"Off\"}", SendDirection.OUT);
addLogEntry("{\"Sender\": \"FSRemoteControl_AN\", \"Cmd\": \"Relais_Power\", \"Val\": \"On\"}", SendDirection.IN);
addLogEntry("{\"Sender\": \"FSRemoteControl_AN\", \"Cmd\": \"Relais_Power\", \"Val\": \"Off\"}", SendDirection.OUT);
addLogEntry("{\"Sender\": \"FSRemoteControl_AN\", \"Cmd\": \"Relais_Power\", \"Val\": \"On\"}", SendDirection.IN);
addLogEntry("{\"Sender\": \"FSRemoteControl_AN\", \"Cmd\": \"Relais_Power\", \"Val\": \"Off\"}", SendDirection.OUT);
}

private void createCloseBtn() {
this.closeBtn = new JButton("Schliessen");
this.closeBtn.setFont(this.$$$getFont$$$("Bahnschrift", Font.PLAIN, 14, this.closeBtn.getFont()));
this.closeBtn.setVerticalAlignment(SwingConstants.BOTTOM);
this.closeBtn.setPreferredSize(new Dimension(120, 32));
this.closeBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
setVisible(false);
}
});
}

public void addLogEntry(String logEntry, SendDirection sd) {
this.logs.add(this.dateTimeFormatter.format(LocalDateTime.now()) + " :" + (sd.equals(SendDirection.IN) ? " << " : " >> ") + logEntry);
this.logsTxtArea.append(this.logs.getLast());
this.logsTxtArea.append("\r\n");
}

{
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE!
$$$setupUI$$$();
}

/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
* @noinspection ALL
*/
private void $$$setupUI$$$() {
mainLogPnl = new JPanel();
mainLogPnl.setLayout(new GridBagLayout());
final JSeparator separator1 = new JSeparator();
GridBagConstraints gbc;
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 1;
gbc.weightx = 1.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(0, 0, 0, 10);
mainLogPnl.add(separator1, gbc);
final JLabel label1 = new JLabel();
Font label1Font = this.$$$getFont$$$("Bahnschrift", Font.PLAIN, 12, label1.getFont());
if (label1Font != null) label1.setFont(label1Font);
label1.setText("Serial Port Logs");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 1;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(0, 10, 0, 5);
mainLogPnl.add(label1, gbc);
final JScrollPane scrollPane1 = new JScrollPane();
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 2;
gbc.gridwidth = 2;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
gbc.fill = GridBagConstraints.BOTH;
gbc.insets = new Insets(10, 10, 10, 10);
mainLogPnl.add(scrollPane1, gbc);
scrollPane1.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(new Color(-4605511)), null, TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, null, null));
logsTxtArea = new JTextArea();
logsTxtArea.setBackground(new Color(-328966));
logsTxtArea.setEditable(false);
scrollPane1.setViewportView(logsTxtArea);
final JPanel spacer1 = new JPanel();
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 2;
gbc.fill = GridBagConstraints.VERTICAL;
gbc.ipady = 10;
mainLogPnl.add(spacer1, gbc);
}

/**
* @noinspection ALL
*/
private Font $$$getFont$$$(String fontName, int style, int size, Font currentFont) {
if (currentFont == null) return null;
String resultName;
if (fontName == null) {
resultName = currentFont.getName();
} else {
Font testFont = new Font(fontName, Font.PLAIN, 10);
if (testFont.canDisplay('a') && testFont.canDisplay('1')) {
resultName = fontName;
} else {
resultName = currentFont.getName();
}
}
Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
}

/**
* @noinspection ALL
*/
public JComponent $$$getRootComponent$$$() {
return mainLogPnl;
}

}

+ 26
- 0
src/main/java/ch/spherICIT/main/MainApp.java Wyświetl plik

@@ -0,0 +1,26 @@
package ch.spherICIT.main;

import com.formdev.flatlaf.FlatIntelliJLaf;

import javax.swing.UIManager;
import java.awt.Color;

public class MainApp {

public static void main(String[] args) {
try {
FlatIntelliJLaf.setup();
Color titlePnBgColor = new Color(135, 176, 230);
Color titlePnInactiveBgColor = new Color(119, 155, 202);
UIManager.put("RootPane.background", titlePnBgColor);
UIManager.put("TitlePane.background", titlePnBgColor);
UIManager.put("TitlePane.inactiveBackground", titlePnInactiveBgColor);
UIManager.put("TitlePane.centerTitle", true);
MainFrame mainFrame = new MainFrame();
mainFrame.setVisible(true);
} catch (Exception ex) {
System.err.println("Failed to initialize LaF");
ex.printStackTrace();
}
}
}

+ 32
- 0
src/main/java/ch/spherICIT/main/MainFrame.java Wyświetl plik

@@ -0,0 +1,32 @@
package ch.spherICIT.main;

import ch.spherICIT.components.statusbar.FSStatusBar;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import java.awt.BorderLayout;

public class MainFrame extends JFrame {

public MainFrame() {
init();
}

private void init() {
setTitle("FS Remote Control");
setIconImage(new ImageIcon(ClassLoader.getSystemResource("Application_Logo_BG.png"),"").getImage());
setSize(new java.awt.Dimension(800, 480));
setLayout(new BorderLayout());
setLocationRelativeTo(null);
setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
MainPanel mainPanel = new MainPanel();
FSStatusBar fsStatusBar = new FSStatusBar();
mainPanel.registerConnectionStateListener(fsStatusBar);
fsStatusBar.setReconnectActionListener(mainPanel.getReconnectActionListener());
add(mainPanel.$$$getRootComponent$$$(), BorderLayout.CENTER);
add(fsStatusBar.$$$getRootComponent$$$(), BorderLayout.SOUTH);
setResizable(false);
}

}


+ 369
- 0
src/main/java/ch/spherICIT/main/MainPanel.form Wyświetl plik

@@ -0,0 +1,369 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="ch.spherICIT.main.MainPanel">
<grid id="27dc6" binding="mainPanel" layout-manager="GridBagLayout">
<constraints>
<xy x="20" y="20" width="814" height="542"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<hspacer id="6aa04">
<constraints>
<grid row="1" column="7" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<gridbag weightx="1.0" weighty="0.0"/>
</constraints>
</hspacer>
<component id="e5600" class="javax.swing.JLabel" binding="serPortLbl">
<constraints>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
<gridbag top="18" left="10" bottom="10" right="10" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="14" style="0"/>
<text value="Serieller Port:"/>
</properties>
</component>
<vspacer id="cb4a9">
<constraints>
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="1.0"/>
</constraints>
</vspacer>
<component id="196b9" class="javax.swing.JComboBox" binding="serPortCboBox">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="9" fill="1" indent="0" use-parent-layout="false"/>
<gridbag top="10" left="0" bottom="10" right="10" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="14" style="0"/>
<minimumSize width="120" height="32"/>
<model>
<item value="COM4"/>
</model>
<preferredSize width="120" height="32"/>
</properties>
</component>
<component id="3a8ec" class="javax.swing.JButton" binding="serPortOpenBtn">
<constraints>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
<gridbag top="10" left="10" bottom="10" right="10" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<contentAreaFilled value="true"/>
<font name="Bahnschrift" size="14" style="0"/>
<hideActionText value="false"/>
<horizontalTextPosition value="0"/>
<label value="Öffnen"/>
<minimumSize width="130" height="32"/>
<preferredSize width="130" height="32"/>
<selected value="false"/>
<text value="Öffnen"/>
<verticalAlignment value="3"/>
</properties>
</component>
<component id="d6057" class="javax.swing.JButton" binding="serPortCloseBtn">
<constraints>
<grid row="0" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="1" fill="1" indent="0" use-parent-layout="false"/>
<gridbag top="10" left="10" bottom="10" right="10" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="14" style="0"/>
<label value="Schliessen"/>
<minimumSize width="130" height="32"/>
<preferredSize width="130" height="32"/>
<text value="Schliessen"/>
<verticalAlignment value="3"/>
</properties>
</component>
<component id="d3573" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<gridbag top="10" left="10" bottom="10" right="10" weightx="1.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="16" style="1"/>
<foreground color="-15834670"/>
<horizontalAlignment value="0"/>
<text value="Relais Power Schalter"/>
</properties>
</component>
<component id="8d93c" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="3" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<gridbag top="10" left="10" bottom="10" right="10" weightx="1.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="16" style="1"/>
<foreground color="-15834670"/>
<horizontalAlignment value="0"/>
<text value="Drehwinkel WebCam"/>
</properties>
</component>
<component id="ac8d1" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="5" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<gridbag top="10" left="0" bottom="10" right="10" weightx="1.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="16" style="1"/>
<foreground color="-15834670"/>
<horizontalAlignment value="0"/>
<text value="WebCam 0° Azimut"/>
</properties>
</component>
<grid id="68002" layout-manager="GridBagLayout">
<constraints>
<grid row="2" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="96fd8" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<gridbag top="0" left="0" bottom="0" right="10" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="20" style="1"/>
<foreground color="-65536"/>
<text value="AUS"/>
</properties>
</component>
<component id="c30d9" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<gridbag top="0" left="10" bottom="0" right="0" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="20" style="1"/>
<foreground color="-16738404"/>
<text value="EIN"/>
</properties>
</component>
<component id="70113" class="ch.spherICIT.components.switchbtn.SwitchButton" binding="relaisPwrBtn">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<background color="-16738404"/>
<preferredSize width="80" height="40"/>
</properties>
</component>
</children>
</grid>
<component id="100a0" class="javax.swing.JLabel">
<constraints>
<grid row="4" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<gridbag top="10" left="10" bottom="10" right="10" weightx="1.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="16" style="1"/>
<foreground color="-15834670"/>
<horizontalAlignment value="0"/>
<text value="Relais Power Status"/>
</properties>
</component>
<vspacer id="39cf7">
<constraints>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0" ipady="80"/>
</constraints>
</vspacer>
<component id="28a8c" class="javax.swing.JLabel" binding="relaisPwrLed">
<constraints>
<grid row="5" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<horizontalAlignment value="0"/>
<icon value="blue_led_off.png"/>
<text value=""/>
</properties>
</component>
<component id="81669" class="javax.swing.JButton" binding="setZeroAzBtn">
<constraints>
<grid row="2" column="5" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="14" style="0"/>
<maximumSize width="130" height="32"/>
<minimumSize width="130" height="32"/>
<preferredSize width="130" height="32"/>
<text value="0° setzen"/>
<verticalAlignment value="3"/>
</properties>
</component>
<grid id="cf489" layout-manager="GridBagLayout">
<constraints>
<grid row="3" column="5" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="7da5c" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<gridbag top="0" left="0" bottom="0" right="10" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="16" style="1"/>
<foreground color="-65536"/>
<text value="SLOW"/>
</properties>
</component>
<component id="30249" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="4" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<gridbag top="10" left="0" bottom="10" right="10" weightx="1.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="16" style="1"/>
<foreground color="-15834670"/>
<horizontalAlignment value="0"/>
<text value="WebCam Geschwindigkeit"/>
</properties>
</component>
<component id="ea938" class="ch.spherICIT.components.switchbtn.SwitchButton" binding="camVelocityModeBtn">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<background color="-16738404"/>
</properties>
</component>
<component id="5163d" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<gridbag top="0" left="10" bottom="0" right="0" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="16" style="1"/>
<foreground color="-16738404"/>
<text value="FAST"/>
</properties>
</component>
<vspacer id="6d54b">
<constraints>
<grid row="2" column="0" row-span="1" col-span="4" vsize-policy="6" hsize-policy="1" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="1.0"/>
</constraints>
</vspacer>
</children>
</grid>
<grid id="883dc" layout-manager="GridBagLayout">
<constraints>
<grid row="4" column="5" row-span="2" col-span="2" vsize-policy="3" hsize-policy="3" anchor="8" fill="2" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="ee24f" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="10" fill="0" indent="0" use-parent-layout="false"/>
<gridbag top="0" left="0" bottom="12" right="10" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="16" style="1"/>
<foreground color="-65536"/>
<text value="AUS"/>
</properties>
</component>
<component id="9a7c4" class="javax.swing.JLabel">
<constraints>
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="2" fill="1" indent="0" use-parent-layout="false"/>
<gridbag top="0" left="10" bottom="12" right="0" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="16" style="1"/>
<foreground color="-16738404"/>
<text value="Ein"/>
</properties>
</component>
<component id="97dc" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="4" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<gridbag top="10" left="0" bottom="10" right="10" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="16" style="1"/>
<foreground color="-15834670"/>
<horizontalAlignment value="0"/>
<text value="WebCam Stepper Power"/>
</properties>
</component>
<grid id="64aa9" layout-manager="GridBagLayout">
<constraints>
<grid row="1" column="3" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="4" fill="2" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="bf550" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<gridbag top="0" left="10" bottom="5" right="10" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<font name="Bahnschrift" size="14" style="1"/>
<foreground color="-15834670"/>
<horizontalAlignment value="0"/>
<text value="Status"/>
</properties>
</component>
<component id="b1d8f" class="javax.swing.JLabel" binding="camStepperPwrLed">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<gridbag weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<horizontalAlignment value="0"/>
<icon value="blue_led_off.png"/>
<text value=""/>
</properties>
</component>
</children>
</grid>
<component id="ba630" class="ch.spherICIT.components.switchbtn.SwitchButton" binding="camStepperPwrBtn">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="2" fill="0" indent="0" use-parent-layout="false"/>
<gridbag top="0" left="0" bottom="10" right="0" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<background color="-16738404"/>
</properties>
</component>
</children>
</grid>
<component id="b9645" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="5" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
<gridbag top="10" left="80" bottom="20" right="10" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<icon value="Arduino_Logo_small.png"/>
<text value=""/>
</properties>
</component>
<component id="5199d" class="javax.swing.JButton" binding="logWindowBtn">
<constraints>
<grid row="0" column="5" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
<gridbag top="10" left="10" bottom="10" right="10" weightx="0.0" weighty="0.0"/>
</constraints>
<properties>
<icon value="log24.png"/>
<maximumSize width="32" height="32"/>
<minimumSize width="32" height="32"/>
<preferredSize width="32" height="32"/>
<text value=""/>
</properties>
</component>
</children>
</grid>
</form>

+ 508
- 0
src/main/java/ch/spherICIT/main/MainPanel.java Wyświetl plik

@@ -0,0 +1,508 @@
package ch.spherICIT.main;

import ch.spherICIT.components.switchbtn.SwitchButton;

import javax.swing.DefaultComboBoxModel;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.plaf.FontUIResource;
import javax.swing.text.StyleContext;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.HashSet;
import java.util.Locale;
import java.util.Set;

public class MainPanel {

private JPanel mainPanel;
private JLabel serPortLbl;
private JComboBox serPortCboBox;
private JButton serPortOpenBtn;
private JButton serPortCloseBtn;
private JButton setZeroAzBtn;
private SwitchButton relaisPwrBtn;
private SwitchButton camVelocityModeBtn;
private SwitchButton camStepperPwrBtn;
private JLabel relaisPwrLed;
private JLabel camStepperPwrLed;
private JButton logWindowBtn;
private final LogWindow logWindow;

private Set<IConnectionState> connectionStateListeners;
private ActionListener reconnectActionListener;

/**
* Konstruktor.
*/
public MainPanel() {
this.logWindow = new LogWindow();
this.connectionStateListeners = new HashSet<>();
this.reconnectActionListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(mainPanel, "Test", "Title", JOptionPane.INFORMATION_MESSAGE);
}
};
this.serPortOpenBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
connectionStateListeners.iterator().next().connectionStateChanged(new ConnectionStateInfo(ConnectionState.CONNECTING, "", ""));
}
});
serPortCloseBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
connectionStateListeners.iterator().next().connectionStateChanged(new ConnectionStateInfo(ConnectionState.CONNECTED, "COM4", "v1.2.0"));
}
});
setZeroAzBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
connectionStateListeners.iterator().next().connectionStateChanged(new ConnectionStateInfo(ConnectionState.TIMEOUT, "", ""));
}
});
logWindowBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
logWindow.setVisible(true);
}
});
}

public void registerConnectionStateListener(IConnectionState connectionStateListener) {
this.connectionStateListeners.add(connectionStateListener);
}

public void removeConnectionStateListener(IConnectionState connectionStateListener) {
this.connectionStateListeners.remove(connectionStateListener);
}

public ActionListener getReconnectActionListener() {
return reconnectActionListener;
}


{
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE!
$$$setupUI$$$();
}

/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
* @noinspection ALL
*/
private void $$$setupUI$$$() {
mainPanel = new JPanel();
mainPanel.setLayout(new GridBagLayout());
final JPanel spacer1 = new JPanel();
GridBagConstraints gbc;
gbc = new GridBagConstraints();
gbc.gridx = 7;
gbc.gridy = 1;
gbc.weightx = 1.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
mainPanel.add(spacer1, gbc);
serPortLbl = new JLabel();
Font serPortLblFont = this.$$$getFont$$$("Bahnschrift", Font.PLAIN, 14, serPortLbl.getFont());
if (serPortLblFont != null) serPortLbl.setFont(serPortLblFont);
serPortLbl.setText("Serieller Port:");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 2;
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.insets = new Insets(18, 10, 10, 10);
mainPanel.add(serPortLbl, gbc);
final JPanel spacer2 = new JPanel();
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 6;
gbc.weighty = 1.0;
gbc.fill = GridBagConstraints.VERTICAL;
mainPanel.add(spacer2, gbc);
serPortCboBox = new JComboBox();
Font serPortCboBoxFont = this.$$$getFont$$$("Bahnschrift", Font.PLAIN, 14, serPortCboBox.getFont());
if (serPortCboBoxFont != null) serPortCboBox.setFont(serPortCboBoxFont);
serPortCboBox.setMinimumSize(new Dimension(120, 32));
final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel();
defaultComboBoxModel1.addElement("COM4");
serPortCboBox.setModel(defaultComboBoxModel1);
serPortCboBox.setPreferredSize(new Dimension(120, 32));
gbc = new GridBagConstraints();
gbc.gridx = 2;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(10, 0, 10, 10);
mainPanel.add(serPortCboBox, gbc);
serPortOpenBtn = new JButton();
serPortOpenBtn.setContentAreaFilled(true);
Font serPortOpenBtnFont = this.$$$getFont$$$("Bahnschrift", Font.PLAIN, 14, serPortOpenBtn.getFont());
if (serPortOpenBtnFont != null) serPortOpenBtn.setFont(serPortOpenBtnFont);
serPortOpenBtn.setHideActionText(false);
serPortOpenBtn.setHorizontalTextPosition(0);
serPortOpenBtn.setLabel("Öffnen");
serPortOpenBtn.setMinimumSize(new Dimension(130, 32));
serPortOpenBtn.setPreferredSize(new Dimension(130, 32));
serPortOpenBtn.setSelected(false);
serPortOpenBtn.setText("Öffnen");
serPortOpenBtn.setVerticalAlignment(3);
gbc = new GridBagConstraints();
gbc.gridx = 3;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.NORTH;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(10, 10, 10, 10);
mainPanel.add(serPortOpenBtn, gbc);
serPortCloseBtn = new JButton();
Font serPortCloseBtnFont = this.$$$getFont$$$("Bahnschrift", Font.PLAIN, 14, serPortCloseBtn.getFont());
if (serPortCloseBtnFont != null) serPortCloseBtn.setFont(serPortCloseBtnFont);
serPortCloseBtn.setLabel("Schliessen");
serPortCloseBtn.setMinimumSize(new Dimension(130, 32));
serPortCloseBtn.setPreferredSize(new Dimension(130, 32));
serPortCloseBtn.setText("Schliessen");
serPortCloseBtn.setVerticalAlignment(3);
gbc = new GridBagConstraints();
gbc.gridx = 4;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.NORTH;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(10, 10, 10, 10);
mainPanel.add(serPortCloseBtn, gbc);
final JLabel label1 = new JLabel();
Font label1Font = this.$$$getFont$$$("Bahnschrift", Font.BOLD, 16, label1.getFont());
if (label1Font != null) label1.setFont(label1Font);
label1.setForeground(new Color(-15834670));
label1.setHorizontalAlignment(0);
label1.setText("Relais Power Schalter");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 1;
gbc.gridwidth = 3;
gbc.weightx = 1.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(10, 10, 10, 10);
mainPanel.add(label1, gbc);
final JLabel label2 = new JLabel();
Font label2Font = this.$$$getFont$$$("Bahnschrift", Font.BOLD, 16, label2.getFont());
if (label2Font != null) label2.setFont(label2Font);
label2.setForeground(new Color(-15834670));
label2.setHorizontalAlignment(0);
label2.setText("Drehwinkel WebCam");
gbc = new GridBagConstraints();
gbc.gridx = 3;
gbc.gridy = 1;
gbc.gridwidth = 2;
gbc.weightx = 1.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(10, 10, 10, 10);
mainPanel.add(label2, gbc);
final JLabel label3 = new JLabel();
Font label3Font = this.$$$getFont$$$("Bahnschrift", Font.BOLD, 16, label3.getFont());
if (label3Font != null) label3.setFont(label3Font);
label3.setForeground(new Color(-15834670));
label3.setHorizontalAlignment(0);
label3.setText("WebCam 0° Azimut");
gbc = new GridBagConstraints();
gbc.gridx = 5;
gbc.gridy = 1;
gbc.gridwidth = 2;
gbc.weightx = 1.0;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(10, 0, 10, 10);
mainPanel.add(label3, gbc);
final JPanel panel1 = new JPanel();
panel1.setLayout(new GridBagLayout());
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 2;
gbc.gridwidth = 3;
gbc.fill = GridBagConstraints.BOTH;
mainPanel.add(panel1, gbc);
final JLabel label4 = new JLabel();
Font label4Font = this.$$$getFont$$$("Bahnschrift", Font.BOLD, 20, label4.getFont());
if (label4Font != null) label4.setFont(label4Font);
label4.setForeground(new Color(-65536));
label4.setText("AUS");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(0, 0, 0, 10);
panel1.add(label4, gbc);
final JLabel label5 = new JLabel();
Font label5Font = this.$$$getFont$$$("Bahnschrift", Font.BOLD, 20, label5.getFont());
if (label5Font != null) label5.setFont(label5Font);
label5.setForeground(new Color(-16738404));
label5.setText("EIN");
gbc = new GridBagConstraints();
gbc.gridx = 2;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(0, 10, 0, 0);
panel1.add(label5, gbc);
relaisPwrBtn = new SwitchButton();
relaisPwrBtn.setBackground(new Color(-16738404));
relaisPwrBtn.setPreferredSize(new Dimension(80, 40));
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 0;
panel1.add(relaisPwrBtn, gbc);
final JLabel label6 = new JLabel();
Font label6Font = this.$$$getFont$$$("Bahnschrift", Font.BOLD, 16, label6.getFont());
if (label6Font != null) label6.setFont(label6Font);
label6.setForeground(new Color(-15834670));
label6.setHorizontalAlignment(0);
label6.setText("Relais Power Status");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 4;
gbc.gridwidth = 3;
gbc.weightx = 1.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(10, 10, 10, 10);
mainPanel.add(label6, gbc);
final JPanel spacer3 = new JPanel();
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 3;
gbc.gridwidth = 2;
gbc.fill = GridBagConstraints.VERTICAL;
gbc.ipady = 80;
mainPanel.add(spacer3, gbc);
relaisPwrLed = new JLabel();
relaisPwrLed.setHorizontalAlignment(0);
relaisPwrLed.setIcon(new ImageIcon(getClass().getResource("/blue_led_off.png")));
relaisPwrLed.setText("");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 5;
gbc.gridwidth = 3;
gbc.fill = GridBagConstraints.HORIZONTAL;
mainPanel.add(relaisPwrLed, gbc);
setZeroAzBtn = new JButton();
Font setZeroAzBtnFont = this.$$$getFont$$$("Bahnschrift", Font.PLAIN, 14, setZeroAzBtn.getFont());
if (setZeroAzBtnFont != null) setZeroAzBtn.setFont(setZeroAzBtnFont);
setZeroAzBtn.setMaximumSize(new Dimension(130, 32));
setZeroAzBtn.setMinimumSize(new Dimension(130, 32));
setZeroAzBtn.setPreferredSize(new Dimension(130, 32));
setZeroAzBtn.setText("0° setzen");
setZeroAzBtn.setVerticalAlignment(3);
gbc = new GridBagConstraints();
gbc.gridx = 5;
gbc.gridy = 2;
gbc.gridwidth = 2;
gbc.anchor = GridBagConstraints.NORTHWEST;
mainPanel.add(setZeroAzBtn, gbc);
final JPanel panel2 = new JPanel();
panel2.setLayout(new GridBagLayout());
gbc = new GridBagConstraints();
gbc.gridx = 5;
gbc.gridy = 3;
gbc.gridwidth = 2;
gbc.anchor = GridBagConstraints.WEST;
gbc.fill = GridBagConstraints.VERTICAL;
mainPanel.add(panel2, gbc);
final JLabel label7 = new JLabel();
Font label7Font = this.$$$getFont$$$("Bahnschrift", Font.BOLD, 16, label7.getFont());
if (label7Font != null) label7.setFont(label7Font);
label7.setForeground(new Color(-65536));
label7.setText("SLOW");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 1;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(0, 0, 0, 10);
panel2.add(label7, gbc);
final JLabel label8 = new JLabel();
Font label8Font = this.$$$getFont$$$("Bahnschrift", Font.BOLD, 16, label8.getFont());
if (label8Font != null) label8.setFont(label8Font);
label8.setForeground(new Color(-15834670));
label8.setHorizontalAlignment(0);
label8.setText("WebCam Geschwindigkeit");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 4;
gbc.weightx = 1.0;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(10, 0, 10, 10);
panel2.add(label8, gbc);
camVelocityModeBtn = new SwitchButton();
camVelocityModeBtn.setBackground(new Color(-16738404));
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 1;
panel2.add(camVelocityModeBtn, gbc);
final JLabel label9 = new JLabel();
Font label9Font = this.$$$getFont$$$("Bahnschrift", Font.BOLD, 16, label9.getFont());
if (label9Font != null) label9.setFont(label9Font);
label9.setForeground(new Color(-16738404));
label9.setText("FAST");
gbc = new GridBagConstraints();
gbc.gridx = 2;
gbc.gridy = 1;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(0, 10, 0, 0);
panel2.add(label9, gbc);
final JPanel spacer4 = new JPanel();
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 2;
gbc.gridwidth = 4;
gbc.weighty = 1.0;
gbc.fill = GridBagConstraints.BOTH;
panel2.add(spacer4, gbc);
final JPanel panel3 = new JPanel();
panel3.setLayout(new GridBagLayout());
gbc = new GridBagConstraints();
gbc.gridx = 5;
gbc.gridy = 4;
gbc.gridwidth = 2;
gbc.gridheight = 2;
gbc.anchor = GridBagConstraints.WEST;
gbc.fill = GridBagConstraints.VERTICAL;
mainPanel.add(panel3, gbc);
final JLabel label10 = new JLabel();
Font label10Font = this.$$$getFont$$$("Bahnschrift", Font.BOLD, 16, label10.getFont());
if (label10Font != null) label10.setFont(label10Font);
label10.setForeground(new Color(-65536));
label10.setText("AUS");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 1;
gbc.anchor = GridBagConstraints.SOUTHWEST;
gbc.insets = new Insets(0, 0, 12, 10);
panel3.add(label10, gbc);
final JLabel label11 = new JLabel();
Font label11Font = this.$$$getFont$$$("Bahnschrift", Font.BOLD, 16, label11.getFont());
if (label11Font != null) label11.setFont(label11Font);
label11.setForeground(new Color(-16738404));
label11.setText("Ein");
gbc = new GridBagConstraints();
gbc.gridx = 2;
gbc.gridy = 1;
gbc.anchor = GridBagConstraints.SOUTH;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(0, 10, 12, 0);
panel3.add(label11, gbc);
final JLabel label12 = new JLabel();
Font label12Font = this.$$$getFont$$$("Bahnschrift", Font.BOLD, 16, label12.getFont());
if (label12Font != null) label12.setFont(label12Font);
label12.setForeground(new Color(-15834670));
label12.setHorizontalAlignment(0);
label12.setText("WebCam Stepper Power");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 4;
gbc.anchor = GridBagConstraints.WEST;
gbc.insets = new Insets(10, 0, 10, 10);
panel3.add(label12, gbc);
final JPanel panel4 = new JPanel();
panel4.setLayout(new GridBagLayout());
gbc = new GridBagConstraints();
gbc.gridx = 3;
gbc.gridy = 1;
gbc.anchor = GridBagConstraints.EAST;
gbc.fill = GridBagConstraints.VERTICAL;
panel3.add(panel4, gbc);
final JLabel label13 = new JLabel();
Font label13Font = this.$$$getFont$$$("Bahnschrift", Font.BOLD, 14, label13.getFont());
if (label13Font != null) label13.setFont(label13Font);
label13.setForeground(new Color(-15834670));
label13.setHorizontalAlignment(0);
label13.setText("Status");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.insets = new Insets(0, 10, 5, 10);
panel4.add(label13, gbc);
camStepperPwrLed = new JLabel();
camStepperPwrLed.setHorizontalAlignment(0);
camStepperPwrLed.setIcon(new ImageIcon(getClass().getResource("/blue_led_off.png")));
camStepperPwrLed.setText("");
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel4.add(camStepperPwrLed, gbc);
camStepperPwrBtn = new SwitchButton();
camStepperPwrBtn.setBackground(new Color(-16738404));
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 1;
gbc.anchor = GridBagConstraints.SOUTH;
gbc.insets = new Insets(0, 0, 10, 0);
panel3.add(camStepperPwrBtn, gbc);
final JLabel label14 = new JLabel();
label14.setIcon(new ImageIcon(getClass().getResource("/Arduino_Logo_small.png")));
label14.setText("");
gbc = new GridBagConstraints();
gbc.gridx = 5;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.EAST;
gbc.insets = new Insets(10, 80, 20, 10);
mainPanel.add(label14, gbc);
logWindowBtn = new JButton();
logWindowBtn.setIcon(new ImageIcon(getClass().getResource("/log24.png")));
logWindowBtn.setMaximumSize(new Dimension(32, 32));
logWindowBtn.setMinimumSize(new Dimension(32, 32));
logWindowBtn.setPreferredSize(new Dimension(32, 32));
logWindowBtn.setText("");
gbc = new GridBagConstraints();
gbc.gridx = 5;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.insets = new Insets(10, 10, 10, 10);
mainPanel.add(logWindowBtn, gbc);
}

/**
* @noinspection ALL
*/
private Font $$$getFont$$$(String fontName, int style, int size, Font currentFont) {
if (currentFont == null) return null;
String resultName;
if (fontName == null) {
resultName = currentFont.getName();
} else {
Font testFont = new Font(fontName, Font.PLAIN, 10);
if (testFont.canDisplay('a') && testFont.canDisplay('1')) {
resultName = fontName;
} else {
resultName = currentFont.getName();
}
}
Font font = new Font(resultName, style >= 0 ? style : currentFont.getStyle(), size >= 0 ? size : currentFont.getSize());
boolean isMac = System.getProperty("os.name", "").toLowerCase(Locale.ENGLISH).startsWith("mac");
Font fontWithFallback = isMac ? new Font(font.getFamily(), font.getStyle(), font.getSize()) : new StyleContext().getFont(font.getFamily(), font.getStyle(), font.getSize());
return fontWithFallback instanceof FontUIResource ? fontWithFallback : new FontUIResource(fontWithFallback);
}

/**
* @noinspection ALL
*/
public JComponent $$$getRootComponent$$$() {
return mainPanel;
}

}

+ 58
- 0
src/main/java/ch/spherICIT/main/Message.java Wyświetl plik

@@ -0,0 +1,58 @@
package ch.spherICIT.main;

public class Message {

public static String CMD_SENDER_PC = "FSRemotePowerSwitch_PC";
public static String CMD_SENDER_AN = "FSRemotePowerSwitch_AN";
public static String CMD_VER = "Version";
public static String CMD_STATUS_RELAY = "Status_Relay";
public static String CMD_POWER_RELAY = "Power_Relay";
public static String CMD_STATUS_CAM = "Status_Cam";
public static String CMD_POWER_CAM = "Power_Cam";
public static String CMD_AZIMUT_CAM = "Azimut_Cam";
public static String CMD_ACT_AZIMUT_CAM = "Actual_Azimut_Cam";
public static String CMD_VELOCITY_CAM = "Velocity_Cam";
public static String CMD_ZERO_CAM = "Zero_Cam";
public static String CMD_VAL_ON = "On";
public static String CMD_VAL_OFF = "Off";
public static String CMD_VELOCITY_SLOW = "Slow";
public static String CMD_VELOCITY_FAST = "Fast";

private String sender;
private String cmd;
private String val;

public Message() {
this("", "", "");
}

public Message(String sender, String cmd, String val) {
this.sender = sender;
this.cmd = cmd;
this.val = val;
}

public String getSender() {
return sender;
}

public void setSender(String sender) {
this.sender = sender;
}

public String getCmd() {
return cmd;
}

public void setCmd(String cmd) {
this.cmd = cmd;
}

public String getVal() {
return val;
}

public void setVal(String val) {
this.val = val;
}
}

BIN
src/main/resources/Application_Logo.ico Wyświetl plik


BIN
src/main/resources/Application_Logo.jpg Wyświetl plik


BIN
src/main/resources/Application_Logo.png Wyświetl plik


+ 42
- 0
src/main/resources/Application_Logo.svg Wyświetl plik

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
height="32"
viewBox="0 -960 1280 1280"
width="32"
version="1.1"
id="svg4"
sodipodi:docname="Application_Logo.svg"
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
inkscape:export-filename="Application_Logo.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs8" />
<sodipodi:namedview
id="namedview6"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showgrid="false"
inkscape:zoom="9.8333333"
inkscape:cx="3.9661017"
inkscape:cy="28.169492"
inkscape:window-width="1920"
inkscape:window-height="1009"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg4" />
<path
d="m 301.33283,-712 -74.66643,-74.66667 q 78.66642,-82.66666 184.66607,-128 Q 517.33213,-960 639.99843,-960 q 122.66622,0 228.66586,45.33333 105.9996,45.33334 184.66611,128 L 978.66398,-712 q -63.99981,-66.66667 -151.33283,-104 -87.33305,-37.33334 -187.33272,-37.33334 -99.99971,0 -187.33276,37.33334 -87.33304,37.33333 -151.33284,104 z m 149.33285,149.33333 -74.66643,-74.66667 Q 426.66576,-688 493.99887,-717.33333 q 67.33312,-29.33334 145.99956,-29.33334 78.66638,0 145.99946,29.33334 67.33314,29.33333 117.99973,79.99999 l -74.66652,74.66667 q -35.9998,-36 -84.66635,-56.66667 -48.66655,-20.66667 -104.66632,-20.66667 -55.99984,0 -104.66636,20.66667 -48.66651,20.66667 -84.66639,56.66667 z m 189.33275,882.66666 q -75.99978,0 -131.33293,-55.33334 -55.33317,-55.33333 -55.33317,-131.33333 v -429.33333 q 0,-76 55.33317,-131.33333 55.33315,-55.33334 131.33293,-55.33334 75.99974,0 131.33282,55.33334 55.33327,55.33333 55.33327,131.33333 v 429.33333 q 0,76 -55.33327,131.33333 -55.33308,55.33334 -131.33282,55.33334 z m 0,-506.66667 q 43.99984,0 75.33305,-31.33333 31.33322,-31.33333 31.33322,-75.33333 0,-44 -31.33322,-75.33334 -31.33321,-31.33333 -75.33305,-31.33333 -43.99989,0 -75.33311,31.33333 -31.33324,31.33334 -31.33324,75.33334 0,44 31.33324,75.33333 31.33322,31.33333 75.33311,31.33333 z"
id="path2"
style="fill:#00979c;fill-opacity:1;stroke-width:1.33334" />
</svg>

BIN
src/main/resources/Application_Logo_BG.png Wyświetl plik


BIN
src/main/resources/Arduino_Logo.png Wyświetl plik


BIN
src/main/resources/Arduino_Logo_small.png Wyświetl plik


BIN
src/main/resources/blue_led_off.png Wyświetl plik


BIN
src/main/resources/blue_led_on.png Wyświetl plik


+ 157
- 0
src/main/resources/blue_led_on.svg Wyświetl plik

@@ -0,0 +1,157 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="50.000019"
height="49.999962"
version="1.1"
id="svg33"
sodipodi:docname="blue_led_on.svg"
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview35"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showgrid="false"
inkscape:zoom="2.32"
inkscape:cx="150.21552"
inkscape:cy="43.534483"
inkscape:window-width="1920"
inkscape:window-height="1009"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg33" />
<title
id="title2">blue LED on</title>
<defs
id="defs21">
<linearGradient
y2="12.376289"
y1="22.301244"
xlink:href="#linearGradient6506"
x2="16.491376"
x1="16.598271"
id="linearGradient6650"
gradientTransform="matrix(1.0871068,0,0,0.91987283,-1.1e-4,0.26091)"
gradientUnits="userSpaceOnUse" />
<linearGradient
y2="38.709305"
y1="6.8783388"
xlink:href="#linearGradient5756"
x2="29.401097"
x1="26.323115"
id="linearGradient6646"
gradientTransform="matrix(1.0000045,0,0,1.0000045,-1.1e-4,0.26091)"
gradientUnits="userSpaceOnUse" />
<linearGradient
y2="49.739081"
y1="0.70058971"
xlink:href="#linearGradient5742"
x2="25.024606"
x1="24.809105"
id="linearGradient6644"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-1.1e-4,0.26091)" />
<linearGradient
id="linearGradient6506">
<stop
stop-color="#ffffff"
stop-opacity="0"
offset="0"
id="stop6508" />
<stop
stop-color="#ffffff"
stop-opacity="0.87451"
offset="1"
id="stop6510" />
</linearGradient>
<linearGradient
id="linearGradient5756">
<stop
stop-color="#828282"
offset="0"
id="stop5758" />
<stop
stop-color="#929292"
stop-opacity="0.35294"
offset="1"
id="stop5760" />
</linearGradient>
<linearGradient
id="linearGradient5742">
<stop
stop-color="#adadad"
offset="0"
id="stop5744" />
<stop
stop-color="#f0f0f0"
offset="1"
id="stop5746" />
</linearGradient>
<linearGradient
y2="26.681922"
x2="29.802152"
y1="42.801127"
x1="43.061791"
id="svg_1"
gradientTransform="matrix(1.0000042,0,0,1.0000042,-1.1e-4,0.26091)"
gradientUnits="userSpaceOnUse">
<stop
offset="0"
stop-opacity="0.98438"
stop-color="#1608A0"
id="stop16" />
<stop
offset="0.98449999"
stop-opacity="0.98047"
stop-color="#1A03FF"
id="stop18"
style="stop-color:#048bff;stop-opacity:0.98046994;" />
</linearGradient>
</defs>
<path
fill="url(#linearGradient6644)"
stroke-width="0.8"
stroke-linecap="round"
stroke-linejoin="round"
stroke-miterlimit="4"
id="path6596"
d="m 50.00002,24.999981 c 0,13.80003 -11.200008,24.999981 -25.00004,24.999981 C 11.200021,49.999962 0,38.800011 0,24.999981 0,11.19996 11.20001,0 24.99998,0 38.800012,0 50.00002,11.19995 50.00002,24.999981 Z"
style="fill:url(#linearGradient6644)" />
<path
fill="url(#linearGradient6646)"
stroke-width="0.8"
stroke-linecap="round"
stroke-linejoin="round"
stroke-miterlimit="4"
id="path6598"
d="m 45.172822,24.994381 c 0,11.13689 -9.038754,20.175579 -20.175642,20.175579 -11.136889,0 -20.17564,-9.038689 -20.17564,-20.175579 0,-11.136891 9.03875,-20.175341 20.17564,-20.175341 11.136889,0 20.175642,9.03845 20.175642,20.175341 z"
style="fill:url(#linearGradient6646)" />
<path
fill="url(#svg_1)"
stroke-width="0.8"
stroke-linecap="round"
stroke-linejoin="round"
stroke-miterlimit="4"
id="path6600"
d="m 43.06186,24.99963 c 0,9.97031 -8.091568,18.062229 -18.06188,18.062229 -9.970309,0 -18.06217,-8.09193 -18.06217,-18.062229 0,-9.96995 8.09187,-18.06152 18.06217,-18.06152 9.970312,0 18.06188,8.09157 18.06188,18.06152 z"
style="fill:url(#svg_1)" />
<path
fill="url(#linearGradient6650)"
stroke-width="0.8"
stroke-linecap="round"
stroke-linejoin="round"
stroke-miterlimit="4"
id="path6602"
d="m 22.228989,11.40021 c 1.161501,1.7006 -0.1481,4.6185 -2.923199,6.513999 -2.774801,1.895201 -5.969501,2.053701 -7.131001,0.353201 -1.161201,-1.7001 0.148499,-4.618401 2.9234,-6.5136 2.7751,-1.89548 5.969701,-2.05364 7.130799,-0.3536 v 0 z"
style="fill:url(#linearGradient6650)" />
</svg>

BIN
src/main/resources/cable_reconnect.png Wyświetl plik


BIN
src/main/resources/cable_reconnect_pr.png Wyświetl plik


BIN
src/main/resources/log.jpg Wyświetl plik


BIN
src/main/resources/log24.png Wyświetl plik


BIN
src/main/resources/log32.png Wyświetl plik


BIN
src/main/resources/status_offline_1.png Wyświetl plik


BIN
src/main/resources/status_online_1.png Wyświetl plik


Ładowanie…
Anuluj
Zapisz