Skip to content

Commit

Permalink
Merge pull request #1 from knighthat/development
Browse files Browse the repository at this point in the history
Update version 0.0.3 | Big update with many new features and changes
  • Loading branch information
knighthat authored Sep 21, 2023
2 parents b992d48 + 8fd76aa commit 4817a50
Show file tree
Hide file tree
Showing 113 changed files with 3,562 additions and 4,230 deletions.
14 changes: 12 additions & 2 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,18 @@ Real-time update, you'll see the result as soon as you press Enter (or Apply)
- Executing BASH Script
- Switch Profile on Mobile Device

🗔 User Interface

- Friendly & easy-to-use UI
- Font can be changed to any installed font
- Most buttons are showed as icon
- Interactive, responsive to changes

# Installation

## Manual

> These steps require [JRE](https://jdk.java.net/20/) and [MAVEN](https://maven.apache.org/download.cgi) to be installed
> These steps require [JDK](https://jdk.java.net/20/) and [MAVEN](https://maven.apache.org/download.cgi) to be installed
> prior.
1. Clone project `git clone --depth 1 https://github.com/knighthat/InteractiveDeck-Desktop`
Expand Down
10 changes: 0 additions & 10 deletions nb-configuration.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2023. Knight Hat
~ All rights reserved.
~ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use,copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
~
~ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
~
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->

<project-shared-configuration>
<!--
This file contains additional configuration written by modules in the NetBeans IDE.
Expand Down
35 changes: 18 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2023. Knight Hat
~ All rights reserved.
~ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use,copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
~
~ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
~
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->

<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
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>me.knighthat</groupId>
<artifactId>InteractiveDeckDesktop</artifactId>
<version>0.0.2</version>
<version>0.0.3</version>

<name>Interactive Deck</name>

Expand All @@ -31,6 +21,18 @@
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.ttf</exclude>
<exclude>**/*.svg</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>**/*.ttf</include>
<include>**/*.svg</include>
</includes>
</resource>
</resources>
<plugins>
Expand Down Expand Up @@ -79,12 +81,6 @@
<version>24.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.7</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
Expand All @@ -95,6 +91,11 @@
<artifactId>gson</artifactId>
<version>2.8.9</version>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>batik-all</artifactId>
<version>1.17</version>
</dependency>
</dependencies>

</project>
10 changes: 6 additions & 4 deletions src/main/java/me/knighthat/interactivedeck/InteractiveDeck.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
*/
package me.knighthat.interactivedeck;

import me.knighthat.interactivedeck.component.icon.Icons;
import me.knighthat.interactivedeck.connection.wireless.WirelessController;
import me.knighthat.interactivedeck.file.Settings;
import me.knighthat.interactivedeck.font.FontFactory;
import me.knighthat.interactivedeck.logging.Log;
import me.knighthat.interactivedeck.menus.MainMenu;
import org.jetbrains.annotations.NotNull;
Expand All @@ -30,6 +32,8 @@ public class InteractiveDeck {

public static void main( String[] args ) {
WorkingDirectory.init();
FontFactory.init();
Icons.loadIcons();
WorkingDirectory.loadProfiles();
Settings.init();

Expand All @@ -38,7 +42,7 @@ public static void main( String[] args ) {
new WirelessController().start();

/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
//<editor-fold default-state="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
Expand All @@ -50,9 +54,7 @@ public static void main( String[] args ) {
}
}
} catch (Exception e) {
Log.err( "Error occurs while loading graphical interface - Look&Feel" );
Log.err( "Reason: " + e.getMessage() );
e.printStackTrace();
Log.exc( "Error occurs while loading Look&Feel", e, true );
}
//</editor-fold>

Expand Down
12 changes: 3 additions & 9 deletions src/main/java/me/knighthat/interactivedeck/WorkingDirectory.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,11 @@ public static void init() {
sub = "./";
}
FILE = new File( home + sub, "InteractiveDeck" );

if (!FILE.exists()) {
Log.info( "Working folder is not exist! Making one.." );

if (!FILE.mkdirs())
Log.err( "Couldn't create working directory at " + FILE.getAbsolutePath() );
}

PATH = FILE.getAbsolutePath();

System.setProperty( "log.dir", PATH.concat( "/logs" ) );

if (!FILE.exists() && !FILE.mkdirs())
Log.err( "Couldn't create working directory at " + FILE.getAbsolutePath() );
}

public static void loadProfiles() {
Expand Down
30 changes: 30 additions & 0 deletions src/main/java/me/knighthat/interactivedeck/component/Flexible.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2023. Knight Hat
* All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use,copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished
* to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

package me.knighthat.interactivedeck.component;

import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import java.awt.*;

public interface Flexible {

default void setDimension( @NotNull JComponent component, int width, int height ) {
Dimension dimension = new Dimension( width, height );
component.setMinimumSize( dimension );
component.setMaximumSize( dimension );
component.setPreferredSize( dimension );
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* Copyright (c) 2023. Knight Hat
* All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use,copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished
* to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

package me.knighthat.interactivedeck.component;

import org.jetbrains.annotations.NotNull;

import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
import javax.swing.text.DocumentFilter;

public abstract class InputFilter extends DocumentFilter {

protected abstract boolean test( @NotNull CharSequence chars );

private StringBuilder getStringBuilder( @NotNull FilterBypass fb ) throws BadLocationException {
Document document = fb.getDocument();
StringBuilder builder = new StringBuilder();
builder.append( document.getText( 0, document.getLength() ) );
return builder;
}

@Override
public void insertString( FilterBypass fb, int offset, String string, AttributeSet attr ) throws BadLocationException {
StringBuilder builder = getStringBuilder( fb );
builder.insert( offset, string );
if (test( builder ))
super.insertString( fb, offset, string, attr );
}

@Override
public void replace( FilterBypass fb, int offset, int length, String text, AttributeSet attrs ) throws BadLocationException {
StringBuilder builder = getStringBuilder( fb );
builder.replace( offset, offset + length, text );
if (test( builder ))
super.replace( fb, offset, length, text, attrs );
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright (c) 2023. Knight Hat
* All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use,copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished
* to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

package me.knighthat.interactivedeck.component;

import org.jetbrains.annotations.NotNull;

public class IntegerFilter extends InputFilter {

private final int min;
private final int max;

public IntegerFilter( int min, int max ) {
this.min = min;
this.max = max;
}

public IntegerFilter() {
this( Integer.MIN_VALUE, Integer.MAX_VALUE );
}

@Override
protected boolean test( @NotNull CharSequence chars ) {
try {
int value = Integer.parseInt( chars.toString() );
return value >= min & value <= max;
} catch (NumberFormatException e) {
return false;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2023. Knight Hat
* All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use,copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished
* to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

package me.knighthat.interactivedeck.component;

/**
* Only accepts value from 0 to 255.<br>
* Denies input if value is outside of this range.
*/
public class IpAddressFilter extends IntegerFilter {

public IpAddressFilter() {
super( 0x0, 0xff );
}
}
Loading

0 comments on commit 4817a50

Please sign in to comment.