From 9aaa5b43cfed72495c90e1a6b1743bfef430346e Mon Sep 17 00:00:00 2001 From: Jonathan-Kalmbach Date: Wed, 10 Jul 2024 05:53:45 +0000 Subject: [PATCH] Dateien nach "testApplication" hochladen --- testApplication/TestHybridWindow.java | 34 ++++++++++++++++ testApplication/TestLegendArea.java | 39 ++++++++++++++++++ testApplication/TestLogElement.java | 56 ++++++++++++++++++++++++++ testApplication/TestParameterArea.java | 32 +++++++++++++++ testApplication/TestTextArea.java | 41 +++++++++++++++++++ 5 files changed, 202 insertions(+) create mode 100644 testApplication/TestHybridWindow.java create mode 100644 testApplication/TestLegendArea.java create mode 100644 testApplication/TestLogElement.java create mode 100644 testApplication/TestParameterArea.java create mode 100644 testApplication/TestTextArea.java diff --git a/testApplication/TestHybridWindow.java b/testApplication/TestHybridWindow.java new file mode 100644 index 0000000..f82f4fd --- /dev/null +++ b/testApplication/TestHybridWindow.java @@ -0,0 +1,34 @@ +package testApplication; + +import logging.LogElementList; +import logging.NewLogElement; +import visualization.HybridWindow; + +/** + * This class provides an example for using visualization.HybridWindow. + * Overwriting the constructor is necessary to run as an applet. + * For running as an application overwriting the constructor is not necessary + * @see visualization.HybridWindow + * @see testApplication.TestApplication + * @author MSch�fer + * DHBW Stuttgart/Campus Horb AI2008
+ *
+ */ +public class TestHybridWindow extends HybridWindow{ + + /** + * Overwritten standard constructor. + * Creates a TestUpHybridWindow with + * TestParameterArea,SumUpLegendArea, TestDrawArea, TestTextArea, + * TestAlgorithm and a LogElementList of TestLogElements. + */ + public TestHybridWindow() { + super(); + logList=new LogElementList(); + parameterArea=new TestParameterArea(); + drawArea=new TestDrawArea(logList,"visualization"); + textArea=new TestTextArea(logList); + legendArea=new TestLegendArea(); + algorithm=new TestAlgorithm((TestParameterArea)parameterArea); + } +} diff --git a/testApplication/TestLegendArea.java b/testApplication/TestLegendArea.java new file mode 100644 index 0000000..e98c3b3 --- /dev/null +++ b/testApplication/TestLegendArea.java @@ -0,0 +1,39 @@ +package testApplication; + +import java.awt.Dimension; +import java.awt.Graphics; +import javax.swing.BorderFactory; +import visualization.LegendArea; + +/** + * This class represents a visualization.LegendArea implementation and has been created for demonstration purposes only. + * Method initialize(Graphics) is overridden and now implements logic for drawing parameters on the legend area. + * @author MSchäfer + * DHBW Stuttgart/Campus Horb AI2008
+ *
+ */ +public class TestLegendArea extends LegendArea{ + + private static final long serialVersionUID = 1L; + + /** + * Standard constructor + */ + public TestLegendArea(){ + super(); + + //set the legend area's preferred size manually for best visualization + setPreferredSize(new Dimension(150, 170)); + } + + /** + * Overridden method from super class. + * Draws all elements and descriptions on the LegendArea + * @param g the Graphics object of the corresponding panel + */ + public void initialize(Graphics g){ + + //Create a new TitledBorder for the LegendArea + setBorder(BorderFactory.createTitledBorder("LegendArea")); + } +} \ No newline at end of file diff --git a/testApplication/TestLogElement.java b/testApplication/TestLogElement.java new file mode 100644 index 0000000..7679fd0 --- /dev/null +++ b/testApplication/TestLogElement.java @@ -0,0 +1,56 @@ +package testApplication; + +import logging.LogElement; +import visualizationElements.Graph; + +/** + * This class provides an example for using logging.LogElement. + * The super class has been extended by member value and corresponding get method. + * The standard constructor has been overwritten and a new one has been introduced. + * @see LogElement + * @author MSch�fer + * DHBW Stuttgart/Campus Horb AI2008
+ *
+ */ +public class TestLogElement extends LogElement{ + + /** The log elements sum up value. */ + protected long value; + private visualizationElements.Graph g; // Zusätzliches Element graph zur Protokollierung der aktuellen Zustände + + + public visualizationElements.Graph getGraph(){ + return this.g; + } + /** + * Standard constructor. + * Calls the constructor of super class and sets value 0. + */ + public TestLogElement() { + super(); + value=0; + } + + /** + * Extended constructor. + * Sets specified step number, description and sum up value. + * @param step the log element's step number + * @param description the log element's step description + * @param value the log element's sum up value + */ + public TestLogElement(int step,String description,long value, Graph graph){ + this.step=step; + this.description=description; + this.value=value; + this.g = graph; + } + + /** + * Returns the log element's sum up value. + * @return the log element's sum up value + */ + public long getValue(){ + return value; + } + +} diff --git a/testApplication/TestParameterArea.java b/testApplication/TestParameterArea.java new file mode 100644 index 0000000..51b7e73 --- /dev/null +++ b/testApplication/TestParameterArea.java @@ -0,0 +1,32 @@ +package testApplication; + +import javax.swing.BorderFactory; +import javax.swing.JTextField; +import visualization.ParameterArea; + +/** + * This class provides an example for using visualization.ParameterArea. + * @see visualization.ParameterArea + * @author MSchäfer + * DHBW Stuttgart/Campus Horb AI2008
+ *
+ */ +public class TestParameterArea extends ParameterArea{ + + private static final long serialVersionUID = 1L; + + /** TextField containing maximum sum up value. */ + protected JTextField maxValue; + + /** + * Standard constructor. + * Creates SumUpParameterArea with an empty JTextField. + */ + public TestParameterArea() { + super(); + setBorder(BorderFactory.createTitledBorder("ParameterArea")); + } + + + +} diff --git a/testApplication/TestTextArea.java b/testApplication/TestTextArea.java new file mode 100644 index 0000000..87aa16b --- /dev/null +++ b/testApplication/TestTextArea.java @@ -0,0 +1,41 @@ +package testApplication; + +import logging.LogElementList; +import visualization.TextArea; + +/** + * This class provides an example for using visualization.TextArea. + * Constructors and print() method have been overwritten. + * @see visualization.TextArea + * @author MSchäfer + * DHBW Stuttgart/Campus Horb AI2008
+ *
+ */ +public class TestTextArea extends TextArea{ + + private static final long serialVersionUID = 1L; + + /** + * Standard constructor. + */ + public TestTextArea() { + super(); + } + + /** + * Extended constructor. + * Sets LogElementList of TestLogElements as log list. + * @param logList the text area's log element list. + */ + public TestTextArea(LogElementListlogList){ + super(logList); + } + + /** + * Textual output of a log element. + * No output. + */ + public boolean print(){ + return true; + } +}