Skip to content

Commit

Permalink
Refactor to improve component re-usability and remove redundant parts (
Browse files Browse the repository at this point in the history
  • Loading branch information
jberclaz authored Jul 26, 2024
1 parent be6df23 commit fcc7966
Show file tree
Hide file tree
Showing 39 changed files with 610 additions and 1,015 deletions.
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<argLine>-XX:+EnableDynamicAgentLoading</argLine>
<argLine>@{argLine} -XX:+EnableDynamicAgentLoading</argLine>
</configuration>
</plugin>

Expand Down Expand Up @@ -106,6 +106,7 @@
<configuration>
<excludes>
<exclude>com/leflat/jass/test/**</exclude>
S <exclude>com/intellij/**</exclude>
</excludes>
</configuration>
<executions>
Expand Down
99 changes: 0 additions & 99 deletions src/main/java/com/leflat/jass/client/ArtificialClient.java

This file was deleted.

1 change: 1 addition & 0 deletions src/main/java/com/leflat/jass/client/ClientNetwork.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public String receiveRawMessage() throws ServerDisconnectedException {
LOGGER.log(Level.WARNING, "Error during reception", e);
}
if (message == null) {
os.close();
throw new ServerDisconnectedException("Server has left unexpectedly");
}
LOGGER.info("Received : " + message);
Expand Down
12 changes: 0 additions & 12 deletions src/main/java/com/leflat/jass/client/ClientNetworkFactory.java

This file was deleted.

28 changes: 28 additions & 0 deletions src/main/java/com/leflat/jass/client/ConnectionInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.leflat.jass.client;

public class ConnectionInfo {
public String name;
public String hostname;
public int nbrArtificialPlayers;
public int gameNumber;
public boolean joinExistingGame = true;
public boolean ok = true;
public boolean local = false;

public ConnectionInfo(boolean ok) {
this.ok = ok;
}

public ConnectionInfo(String name) {
this.name = name;
this.local = true;
}

public ConnectionInfo(String name, String hostname, boolean joinExistingGame, int gameNumber, int nbrArtificialPlayers) {
this.name = name;
this.hostname = hostname;
this.joinExistingGame = joinExistingGame;
this.gameNumber = gameNumber;
this.nbrArtificialPlayers = nbrArtificialPlayers;
}
}
119 changes: 68 additions & 51 deletions src/main/java/com/leflat/jass/client/DialogConnection.form
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.leflat.jass.client.DialogConnection">
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="6" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/>
<constraints>
<xy x="48" y="54" width="436" height="297"/>
<xy x="48" y="54" width="436" height="345"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="94766" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="5" column="0" row-span="1" col-span="2" vsize-policy="1" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="1" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
Expand Down Expand Up @@ -49,7 +49,7 @@
</grid>
</children>
</grid>
<grid id="e3588" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="e3588" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
Expand All @@ -67,13 +67,66 @@
</component>
<component id="66b82" class="javax.swing.JTextField" binding="textFieldName">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="66b9d" class="javax.swing.JLabel">
</children>
</grid>
<grid id="bc55f" layout-manager="GridLayoutManager" row-count="5" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<vspacer id="6d07b">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="3743f" class="javax.swing.JCheckBox" binding="networkGameCheckBox">
<constraints>
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Network game"/>
</properties>
</component>
<component id="d8893" class="javax.swing.JLabel" binding="labelGameId">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Game number"/>
</properties>
</component>
<component id="ff24d" class="javax.swing.JFormattedTextField" binding="textFieldGameNumber">
<constraints>
<grid row="2" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="5f25f" class="javax.swing.JLabel" binding="labelAiPlayer">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="AI players"/>
</properties>
</component>
<component id="a760d" class="javax.swing.JSpinner" binding="spinnerAiPlayers">
<constraints>
<grid row="3" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="66b9d" class="javax.swing.JLabel" binding="labelGameHost">
<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"/>
</constraints>
Expand All @@ -83,60 +136,24 @@
</component>
<component id="5edc9" class="javax.swing.JTextField" binding="textFieldHost">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="1" column="1" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<text value="localhost"/>
</properties>
</component>
<component id="6ad3d" class="javax.swing.JCheckBox" binding="joinExistingGameCheckBox">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Join existing game"/>
</properties>
</component>
</children>
</grid>
<component id="fb9e3" class="javax.swing.JSeparator">
<constraints>
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="6" hsize-policy="6" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="3743f" class="javax.swing.JCheckBox" binding="joinExistingGameCheckBox" default-binding="true">
<constraints>
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Join existing game"/>
</properties>
</component>
<component id="d8893" class="javax.swing.JLabel" binding="labelGameId">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Game number"/>
</properties>
</component>
<component id="5f25f" class="javax.swing.JLabel" binding="labelAiPlayer">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="AI players"/>
</properties>
</component>
<component id="a760d" class="javax.swing.JSpinner" binding="spinnerAiPlayers">
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="ff24d" class="javax.swing.JFormattedTextField" binding="textFieldGameNumber">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
</children>
</grid>
</form>
Loading

0 comments on commit fcc7966

Please sign in to comment.