guiVersion of project, rewriting code for maximum clarity

This commit is contained in:
Joshua-Ashton01
2022-11-08 16:30:25 -07:00
parent 609cc983cc
commit 823683e5c4
12 changed files with 251 additions and 208 deletions
+8
View File
@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="17" project-jdk-type="JavaSDK" />
</project>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/DndApplication.iml" filepath="$PROJECT_DIR$/.idea/DndApplication.iml" />
</modules>
</component>
</project>
Generated
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
+11
View File
@@ -0,0 +1,11 @@
public class DndCharacterBuilder {
public static void main(String[] args) {
PanelHolder guiPanels = new PanelHolder();
UImanager gui = new UImanager(guiPanels);
}
}
+129
View File
@@ -0,0 +1,129 @@
public static class PanelHolder {
private JPanel mainMenuPanel;
private JPanel racePanel;
private JPanel classPanel;
private JPanel abilityScorePanel;
private JPanel descriptionPanel;
private JPanel equipmentPanel;
private JPanel finalizePanel;
private JPanel loadMenuPanel;
public PanelHolder() {
this.mainMenuPanel = createMainMenuPanel();
this.racePanel = createRaceSelectPanel();
this.classPanel = createClassSelectPanel();
this.abilityScorePanel = createAbilityScoreSelectPanel();
this.descriptionPanel = createDescriptionPanel();
this.equipmentPanel = createEquipmentSelectPanel();
this.finalizePanel = createFinalizePanel();
this.loadMenuPanel = createLoadMenu();
}
public JPanel getMainMenuPanel() {
return mainMenuPanel;
}
public JPanel getRacePanel() {
return racePanel;
}
public JPanel getClassPanel() {
return classPanel;
}
public JPanel getAbilityScorePanel() {
return abilityScorePanel;
}
public JPanel getDescriptionPanel() {
return descriptionPanel;
}
public JPanel getEquipmentPanel() {
return equipmentPanel;
}
public JPanel getFinalizePanel() {
return finalizePanel;
}
public JPanel getLoadMenuPanel() {
return loadMenuPanel;
}
// TODO: Need to implement.
private JPanel createMainMenuPanel() {
}
// TODO: Need to implement.
private JPanel createRaceSelectPanel() {
}
// TODO: Need to implement.
private JPanel createClassSelectPanel() {
}
// TODO: Need to implement.
private JPanel createAbilityScoreSelectPanel() {
}
// TODO: Need to implement.
private JPanel createDescriptionPanel() {
}
// TODO: Need to implement.
private JPanel createEquipmentSelectPanel() {
}
// TODO: Need to implement.
private JPanel createFinalizePanel() {
}
// TODO: Need to implement.
private JPanel createLoadMenu() {
}
}
+76
View File
@@ -0,0 +1,76 @@
public class UImanager {
private JFrame gui;
private PanelHolder guiPanels;
private int currentPanel;
public UImanager (PanelHolder guiPanels) {
this.gui = new JFrame("D&D Character Builder");
this.guiPanels = guiPanels;
if (returningUser()) {
this.currentPanel = 0;
} else {
this.currentPanel = 1;
}
frameSetup();
}
// TODO: Need to implement.
private void frameSetup() {
}
// TODO: Need to implement.
private boolean returningUser() {
return false;
}
private JPanel getNextPanel() {
switch (currentPanel) {
case: 1
return guiPanels.getRacePanel();
case: 2
return guiPanels.getClassPanel();
case: 3
return guiPanels.getAbilityScorePanel();
case: 4
return guiPanels.getDescriptionPanel();
case: 5
return guiPanels.getEquipmentPanel();
case: 6
return guiPanels.getLoadMenuPanel();
case: 7
return guiPanels.getFinalizePanel();
default:
return guiPanels.getMainMenuPanel();
}
}
private void clearAndReset(JPanel nextPanel) {
gui.removeAll();
gui.addComponent(nextPanel);
gui.repaint();
gui.revalidate();
}
}
-17
View File
@@ -1,17 +0,0 @@
# Editor configuration, see http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 80
[*.sh]
end_of_line = lf
[*.java]
indent_size = 4
max_line_length = 120
-173
View File
@@ -1,173 +0,0 @@
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.builder</groupId>
<artifactId>dndcharacterbuilder</artifactId>
<version>10</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>5.6.0</junit.version>
<maven-enforcer-plugin.version>3.0.0-M3</maven-enforcer-plugin.version>
<maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
<checkstyle.version>8.45.1</checkstyle.version>
<maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
<jacoco-maven-plugin.version>0.8.4</jacoco-maven-plugin.version>
<maven-javadoc-plugin.version>3.0.0</maven-javadoc-plugin.version>
<!-- JaCoCo thresholds. Increase gradually as you add tests. -->
<jacoco.unit-tests.limit.instruction-ratio>0%</jacoco.unit-tests.limit.instruction-ratio>
<jacoco.unit-tests.limit.branch-ratio>0%</jacoco.unit-tests.limit.branch-ratio>
<jacoco.unit-tests.limit.class-complexity>20</jacoco.unit-tests.limit.class-complexity>
<jacoco.unit-tests.limit.method-complexity>5</jacoco.unit-tests.limit.method-complexity>
</properties>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${maven-enforcer-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.6.3</version>
</requireMavenVersion>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
</dependency>
<dependency>
<groupId>com.github.ngeor</groupId>
<artifactId>checkstyle-rules</artifactId>
<version>4.9.3</version>
</dependency>
</dependencies>
<configuration>
<configLocation>com/github/ngeor/checkstyle.xml</configLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
<skip>${skipTests}</skip>
</configuration>
<executions>
<execution>
<id>checkstyle</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
<executions>
<execution>
<id>pre-unit-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>check-unit-test</id>
<phase>test</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<dataFile>${project.build.directory}/jacoco.exec</dataFile>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.unit-tests.limit.instruction-ratio}</minimum>
</limit>
<limit>
<counter>BRANCH</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.unit-tests.limit.branch-ratio}</minimum>
</limit>
</limits>
</rule>
<rule>
<element>CLASS</element>
<limits>
<limit>
<counter>COMPLEXITY</counter>
<value>TOTALCOUNT</value>
<maximum>${jacoco.unit-tests.limit.class-complexity}</maximum>
</limit>
</limits>
</rule>
<rule>
<element>METHOD</element>
<limits>
<limit>
<counter>COMPLEXITY</counter>
<value>TOTALCOUNT</value>
<maximum>${jacoco.unit-tests.limit.method-complexity}</maximum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
</plugin>
</plugins>
</reporting>
</project>
@@ -1,18 +0,0 @@
package com.builder;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Unit test for simple App.
*/
class AppTest {
/**
* Rigorous Test.
*/
@Test
void testApp() {
assertEquals(1, 1);
}
}