Skip to content

Commit

Permalink
Merged in test (pull request #4)
Browse files Browse the repository at this point in the history
bugfix / test fully working
  • Loading branch information
ChriZ982 committed Nov 24, 2014
2 parents 79f4cd5 + f31a360 commit 3cd1f81
Show file tree
Hide file tree
Showing 19 changed files with 560 additions and 245 deletions.
16 changes: 12 additions & 4 deletions Data/settings.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
color1: "#ff00ff"
planSpeed: "10"
motdSpeed: "12"
destPath1: "C:\Users\Mirko\Documents"
sourcePath: "C:\Users\Christopher\Documents\Electronic Arts"
backupPath: "C:\Users\Christopher\Documents\Freemake"
destPath1: "C:\Users\Christopher\Documents\VirtualDJ"
destPath2: "C:\Users\Christopher\Documents\My Games"
destPath3: "C:\Users\Christopher\Documents\Visual Studio 2010"
colorframe: "#ff0000"
colortest: "#33ff00"
colormotd: "#3333ff"
colorMotd: "frame"
colorPlan: "test"
planSpeed: "20"
motdSpeed: "10"
3 changes: 2 additions & 1 deletion nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ excludes=
includes=**
jar.compress=false
javac.classpath=\
${libs.MySQLDriver.classpath}
${libs.MySQLDriver.classpath}:\
${libs.absolutelayout.classpath}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
Expand Down
16 changes: 11 additions & 5 deletions src/com/facharbeit/io/Reader.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package com.facharbeit.io;

import com.facharbeit.tools.Logger;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import com.facharbeit.tools.*;
import java.io.*;

/**
* Lies ganze Text-Dateien aus.
Expand All @@ -18,6 +15,7 @@ public class Reader

/**
* Erstellt einen neuen Reader.
*
* @param pFilename Name der Datei
*/
public Reader(String pFilename)
Expand All @@ -27,7 +25,9 @@ public Reader(String pFilename)

/**
* Liest eine Zeile der Datei.
*
* @param line Zeile, die gelesen werden soll
*
* @return Inhalt dieser Zeile
*/
public String read(int line)
Expand All @@ -47,6 +47,7 @@ public String read(int line)

/**
* Liest ganze Datei aus.
*
* @return Ganze Datei als String Array
*/
public String[] readAll()
Expand All @@ -71,6 +72,7 @@ public String[] readAll()

/**
* Konvertiert das Array in einen einzelnen String.
*
* @return Ganze Datei als String
*/
@Override
Expand All @@ -87,7 +89,9 @@ public String toString()

/**
* Liest eine Zeile als Zahl.
*
* @param line Zeile, die gelesen werden soll
*
* @return Zahl, die die angegebene Zeile repräsentiert
*/
public int readAsNumber(int line)
Expand All @@ -104,6 +108,7 @@ public int readAsNumber(int line)

/**
* Prüft ob die Datei existiert.
*
* @return Existiert die Datei?
*/
public boolean exists()
Expand All @@ -114,6 +119,7 @@ public boolean exists()

/**
* Gibt die Zeilenanzahl zurück.
*
* @return Anzahl der Zeilen
*/
public int getLines()
Expand Down
35 changes: 16 additions & 19 deletions src/com/facharbeit/io/SettingHandler.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
package com.facharbeit.io;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
import java.util.ArrayList;
import java.util.Arrays;
import javax.swing.JColorChooser;
import javax.swing.JComboBox;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;

public class SettingHandler
{
@SuppressWarnings("empty-statement")
public static void savePathBtnActionPerformed(JTextField sourceTxt, JTextField backupTxt, JTextArea destArea, ActionEvent evt)
public static void savePathBtnActionPerformed(JTextField sourceTxt, JTextField backupTxt, JTextArea destArea)
{
saveIfNotNull(sourceTxt, "sourcePath");
saveIfNotNull(backupTxt, "backupPath");
Expand All @@ -29,25 +23,28 @@ public static void savePathBtnActionPerformed(JTextField sourceTxt, JTextField b
Settings.save("destPath" + (i + 1), destPaths.get(i));
}

public static void setSpeedPlanBtnActionPerformed(JTextField speedPlanTxt, ActionEvent evt)
public static void setSpeedPlanBtnActionPerformed(JTextField speedPlanTxt)
{
Settings.save("planSpeed", speedPlanTxt.getText());
}

public static void setSpeedMotdBtnActionPerformed(JTextField speedMotdTxt, ActionEvent evt)
public static void setSpeedMotdBtnActionPerformed(JTextField speedMotdTxt)
{
Settings.save("motdSpeed", speedMotdTxt.getText());
}

public static void addColorBtnActionPerformed(JColorChooser colorChooser, JTextField colorNameTxt, JComboBox colorPlanCombo, JComboBox colorMotdCombo, ActionEvent evt)
public static void addColorBtnActionPerformed(JColorChooser colorChooser, JTextField colorNameTxt, JComboBox colorPlanCombo, JComboBox colorMotdCombo)
{
Color c = JColorChooser.showDialog(colorChooser, "Neue Farbe anlegen", Color.BLUE);
Settings.save("color" + colorNameTxt.getText(), "#" + Integer.toHexString(c.getRGB()).substring(2));

loadColors(colorPlanCombo, colorMotdCombo);
if(c != null)
{
Settings.save("color" + colorNameTxt.getText(), "#" + Integer.toHexString(c.getRGB()).substring(2));
loadColors(colorPlanCombo, colorMotdCombo);
}
}

public static void deleteColorBtnActionPerformed(JTextField colorNameTxt, JComboBox colorPlanCombo, JComboBox colorMotdCombo, ActionEvent evt)
public static void deleteColorBtnActionPerformed(JTextField colorNameTxt, JComboBox colorPlanCombo, JComboBox colorMotdCombo)
{
Settings.delete("color" + colorNameTxt.getText());

Expand All @@ -60,7 +57,7 @@ public static void colorPlanComboItemStateChanged(JPanel colorPlanPanel, JComboB
colorPlanPanel.setBackground(Color.decode(Settings.load("color" + colorPlanCombo.getSelectedItem().toString())));
}

public static void setColorPlanBtnActionPerformed(JComboBox colorPlanCombo, ActionEvent evt)
public static void setColorPlanBtnActionPerformed(JComboBox colorPlanCombo)
{
Settings.save("colorPlan", colorPlanCombo.getSelectedItem().toString());
}
Expand All @@ -71,7 +68,7 @@ public static void colorMotdComboItemStateChanged(JPanel colorMotdPanel, JComboB
colorMotdPanel.setBackground(Color.decode(Settings.load("color" + colorMotdCombo.getSelectedItem().toString())));
}

public static void setColorMotdBtnActionPerformed(JComboBox colorMotdCombo, ActionEvent evt)
public static void setColorMotdBtnActionPerformed(JComboBox colorMotdCombo)
{
Settings.save("colorMotd", colorMotdCombo.getSelectedItem().toString());
}
Expand Down
11 changes: 6 additions & 5 deletions src/com/facharbeit/io/Writer.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.facharbeit.io;

import com.facharbeit.tools.Logger;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import com.facharbeit.io.Reader;
import com.facharbeit.tools.*;
import java.io.*;

/**
* Klasse zum schreiben ganzer Text-Dateien.
Expand All @@ -19,6 +17,7 @@ public class Writer

/**
* Erstellt einen neuen Schreiber.
*
* @param pFilename Name der Datei
*/
public Writer(String pFilename)
Expand All @@ -28,6 +27,7 @@ public Writer(String pFilename)

/**
* Schreibt eine ganze Datei neu.
*
* @param data Daten, die in die Datei geschrieben werder sollen
*/
public void writeAll(String[] data)
Expand All @@ -47,6 +47,7 @@ public void writeAll(String[] data)

/**
* Schreibt nur eine Zeile einer Datei neu.
*
* @param line Zeile, die neu geschrieben werden soll
* @param content Text, der geschrieben werden soll
*/
Expand Down
2 changes: 1 addition & 1 deletion src/com/facharbeit/listener/TimeHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ public interface TimeHandler
}
*/
*/
2 changes: 1 addition & 1 deletion src/com/facharbeit/listener/TimeListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ else if(time > ONE)
app.lessonOne(time);
}
}
*/
*/
19 changes: 9 additions & 10 deletions src/com/facharbeit/main/Application.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package com.facharbeit.main;

import com.facharbeit.io.SettingHandler;
import com.facharbeit.io.Settings;
import com.facharbeit.tools.Logger;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Random;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import com.facharbeit.io.*;
import com.facharbeit.tools.*;
import java.lang.reflect.*;
import java.util.*;
import javax.swing.*;

/**
* Verwaltet alle Aktionen, die im Programm geschehen sollen.
Expand Down Expand Up @@ -55,6 +52,7 @@ public Application()

/**
* Ruft die "main-Methode" der Anwendung auf.
*
* @param args Parameter, die beim Aufruf des Programms übergeben wurden
*/
public static void main(String[] args)
Expand All @@ -74,7 +72,7 @@ public void run()

try
{
Thread.sleep(1000);
Thread.sleep(100);
} catch(InterruptedException ex)
{
System.out.println("MAIN-SCHLEIFE KONNTE NICHT PAUSIEREN!");
Expand Down Expand Up @@ -108,6 +106,7 @@ private void runOneElementOfQueue()

/**
* Generiert einen zufälligen "Satz".
*
* @deprecated
* @return "Zufalls-Satz"
*/
Expand All @@ -122,7 +121,7 @@ private String randomString()
if(rand.nextInt(5) == 0)
s += " ";

s += Character.toLowerCase((char) (rand.nextInt(26) + 65));
s += Character.toLowerCase((char)(rand.nextInt(26) + 65));
}

return s;
Expand Down
Loading

0 comments on commit 3cd1f81

Please sign in to comment.