diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 6166ebc..f3e011e 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,64 +5,16 @@
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -77,6 +29,9 @@
+
+
+
+
+
+
@@ -122,6 +80,15 @@
1718547365327
+
+
+ 1719479266810
+
+
+
+ 1719479266810
+
+
@@ -135,4 +102,19 @@
+
+
+
+
+
+
+
+
+ file://$PROJECT_DIR$/OurApplication/OurApplication.java
+ 56
+
+
+
+
+
\ No newline at end of file
diff --git a/Main.java b/Main.java
index 1f8219a..9e0b29a 100644
--- a/Main.java
+++ b/Main.java
@@ -1,11 +1,31 @@
-import testApplication.TestHybridWindow;
+import OurApplication.*;
+import graph.EdgeMarking;
+import graph.MarkedEdge;
+import graph.MarkedVertex;
+import graph.VertexMarking;
import visualisation.*;
import logging.*;
-import visualizationElements.*;
+import visualisation.TextArea;
+
+import javax.swing.*;
+import java.awt.*;
+
public class Main {
public static void main(String[] args){
- TestHybridWindow test = new TestHybridWindow();
+ JFrame t = new JFrame("Hallo");
+ JPanel contentPane = new JPanel(new GridLayout());
+ t.setSize(900, 900);
+ t.setContentPane(contentPane);
+ LogElementListlogList=new LogElementList();
+ OurParameterArea parameterArea=new OurParameterArea();
+ OurDrawArea drawArea=new OurDrawArea(logList,"visualizationTest");
+ OurTextArea textArea=new OurTextArea(logList);
+ OurAlgorithm algorithm=new OurAlgorithm(parameterArea);
+ OurLegendArea legendArea=new OurLegendArea();
+ HybridWindow test = new HybridWindow(drawArea,textArea,parameterArea,algorithm,logList,legendArea);
test.init();
- test.setVisible(true);
+
+ contentPane.add(test);
+ t.setVisible(true);
}
}
diff --git a/OurApplication/OurAlgorithm.java b/OurApplication/OurAlgorithm.java
new file mode 100644
index 0000000..4dc83ac
--- /dev/null
+++ b/OurApplication/OurAlgorithm.java
@@ -0,0 +1,48 @@
+package OurApplication;
+
+import logging.Algorithm;
+import logging.LogElementList;
+
+/**
+ * This class provides an example for using logging.Algorithm.
+ * It sums up integer number starting with 0 up to the maximum value specified in the parameter area.
+ * @see Algorithm
+ * @author MSch�fer
+ * DHBW Stuttgart/Campus Horb AI2008
+ *
+ */
+public class OurAlgorithm extends Algorithm{
+
+ public OurAlgorithm() {
+ super();
+ }
+ /**
+ * Creates a sum up algorithm.
+ * @param parameterArea the sum up parameter area the algorithm gets its parameters from
+ */
+ public OurAlgorithm(OurParameterArea parameterArea){
+ super(parameterArea,"GraphAlgorithm");
+ }
+
+ /**
+ * Overwritten from super class.
+ * Runs the algorithm..
+ * Returns the LogElementList produced by the algorithm processing.
+ * Adds integer number starting with 0 up to the maximum value.
+ * @return a LogElementList containing the algorithm processing single steps
+ */
+ public LogElementList run(){
+ LogElementListlogList = new LogElementList();
+ for(int i=1;i<=10;i++){
+ try{
+
+ logList.add(new OurLogElement(i, "Value", i));
+ }
+ catch(OutOfMemoryError e){
+
+ System.err.println("Out of memory");
+ }
+ }
+ return logList;
+ }
+}
diff --git a/OurApplication/OurApplication.java b/OurApplication/OurApplication.java
new file mode 100644
index 0000000..eb3c5d8
--- /dev/null
+++ b/OurApplication/OurApplication.java
@@ -0,0 +1,76 @@
+package OurApplication;
+
+import graph.*;
+import logging.LogElementList;
+import visualisation.HybridWindow;
+
+import javax.swing.*;
+import java.util.Random;
+
+/**
+ * This application provides an example for using logging and visualization packages.
+ * It uses extended classes from logging and visualization.
+ * @see OurAlgorithm
+ * @see OurApplication
+ * @see OurDrawArea
+ * @see OurHybridWindow
+ * @see OurLogElement
+ * @see OurParameterArea
+ * @see OurTextArea
+ * @see OurLegendArea
+ * @see javax.swing.JPanel
+ * @author MSch�fer
+ * DHBW Stuttgart/Campus Horb AI2008
+ *
+ */
+public class OurApplication {
+
+ /**
+ * Standard constructor.
+ */
+ public OurApplication() {
+ super();
+ }
+
+ /**
+ * The applications main method.
+ * Creates a HybridWindow with TestParameterArea, TestLegendArea ,TestDrawArea, TestTextArea and TestAlgorithm and starts it.
+ * @param args
+ */
+ public static void main(String[]args){
+
+ DirectedGraph myGraph = new DirectedGraph<>();
+
+ for (int i = 0; i < 10; i++) {
+ myGraph.addVertex(new MarkedVertex<>(String.valueOf(i), null));
+ }
+ Random random = new Random();
+
+ for (MarkedVertex i: myGraph.getAllVertexes()) {
+ myGraph.addEdge(new MarkedEdge<>("a", i, myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size())), null, random.nextInt(1, 10)));
+ }
+
+ for (MarkedVertex i: myGraph.getAllVertexes()) {
+ myGraph.addEdge(new MarkedEdge<>("a", i, myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size())), null, random.nextInt(1, 10)));
+ }
+
+ LogElementListlogList=new LogElementList();
+ OurParameterArea parameterArea=new OurParameterArea();
+ OurDrawArea drawArea=new OurDrawArea(logList,"GraphVisualization");
+ OurTextArea textArea=new OurTextArea(logList);
+ OurAlgorithm algorithm=new OurAlgorithm(parameterArea);
+ OurLegendArea legendArea=new OurLegendArea();
+ HybridWindow applet=new HybridWindow(drawArea,textArea,parameterArea,algorithm,logList,legendArea);
+
+
+ JFrame frame=new JFrame("Visualise");
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.getContentPane().add(applet);
+ frame.pack();
+ applet.init();
+ applet.start();
+ frame.setSize(800,600);
+ frame.setVisible(true);
+ }
+
+}
diff --git a/OurApplication/OurDrawArea.java b/OurApplication/OurDrawArea.java
new file mode 100644
index 0000000..341d059
--- /dev/null
+++ b/OurApplication/OurDrawArea.java
@@ -0,0 +1,80 @@
+package OurApplication;
+
+import logging.LogElementList;
+import visualisation.DrawArea;
+import visualizationElements.List;
+import visualizationElements.Queue;
+import visualizationElements.*;
+
+import java.awt.*;
+import java.util.Vector;
+
+/**
+ * This class provides an example for using visualization.DrawArea.
+ * @see logging.Algorithm
+ @author MSch�fer
+ * DHBW Stuttgart/Campus Horb AI2008
+ *
+ */
+public class OurDrawArea extends DrawArea{
+
+ private static final long serialVersionUID = 1L;
+
+
+ /**
+ * Standard constructor.
+ */
+ public OurDrawArea() {
+ super();
+ }
+
+ /**
+ * Creates a test draw area and sets the specified log list.
+ * @param logList the draw area's log list test log elements.
+ * @param drawAreaName The display name over the draw area.
+ */
+ public OurDrawArea(LogElementList logList, String drawAreaName){
+ super(logList, drawAreaName);
+ }
+
+ /**
+ * Draws a visualization element.
+ */
+
+ public void draw(Graphics g){
+
+ drawGraph(g);
+ }
+
+ private void drawGraph(Graphics g) {
+
+ // create/add vertexes
+ Vector vertexes = new Vector();
+
+ vertexes.add(new Vertex(20, 20, "1", Color.BLACK));
+ vertexes.add(new Vertex(80, 20, "2", Color.BLACK));
+ vertexes.add(new Vertex(100, 80, "3", Color.BLACK));
+ vertexes.add(new Vertex(180, 60, "4", Color.BLUE));
+ vertexes.add(new Vertex(20, 80, "5", Color.BLACK));
+ vertexes.add(new Vertex(120, 140, "6", Color.BLACK));
+ vertexes.add(new Vertex(20, 180, "7", Color.BLACK));
+
+
+ // create/add edges
+ Vector edges = new Vector();
+
+ edges.add(new Edge(vertexes.get(0), vertexes.get(1), "1", Color.WHITE));
+ edges.add(new Edge(vertexes.get(1), vertexes.get(4), "1", Color.BLACK));
+ edges.add(new Edge(vertexes.get(0), vertexes.get(4), "1", Color.BLACK));
+ edges.add(new Edge(vertexes.get(2), vertexes.get(3), "1", Color.BLACK));
+ edges.add(new Edge(vertexes.get(3), vertexes.get(2), "1", Color.BLACK));
+ edges.add(new Edge(vertexes.get(4), vertexes.get(6), "1", Color.BLACK));
+ edges.add(new Edge(vertexes.get(6), vertexes.get(6), "1", Color.BLACK));
+
+
+ // create graph
+ Graph graph = new Graph(vertexes, edges, false, EdgeStyle.Direct);
+
+ graph.draw(g);
+ }
+}
diff --git a/OurApplication/OurHybridWindow.java b/OurApplication/OurHybridWindow.java
new file mode 100644
index 0000000..05c5759
--- /dev/null
+++ b/OurApplication/OurHybridWindow.java
@@ -0,0 +1,33 @@
+package OurApplication;
+
+import logging.LogElementList;
+import visualisation.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 HybridWindow
+ * @see OurApplication
+ * @author MSch�fer
+ * DHBW Stuttgart/Campus Horb AI2008
+ *
+ */
+public class OurHybridWindow extends HybridWindow{
+
+ /**
+ * Overwritten standard constructor.
+ * Creates a TestUpHybridWindow with
+ * TestParameterArea,SumUpLegendArea, TestDrawArea, TestTextArea,
+ * TestAlgorithm and a LogElementList of TestLogElements.
+ */
+ public OurHybridWindow() {
+ super();
+ logList=new LogElementList();
+ parameterArea=new OurParameterArea();
+ drawArea=new OurDrawArea(logList,"visualization");
+ textArea=new OurTextArea(logList);
+ legendArea=new OurLegendArea();
+ algorithm=new OurAlgorithm((OurParameterArea)parameterArea);
+ }
+}
diff --git a/OurApplication/OurLegendArea.java b/OurApplication/OurLegendArea.java
new file mode 100644
index 0000000..65fe640
--- /dev/null
+++ b/OurApplication/OurLegendArea.java
@@ -0,0 +1,39 @@
+package OurApplication;
+
+import visualisation.LegendArea;
+
+import javax.swing.*;
+import java.awt.*;
+
+/**
+ * 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 OurLegendArea extends LegendArea{
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Standard constructor
+ */
+ public OurLegendArea(){
+ 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/OurApplication/OurLogElement.java b/OurApplication/OurLogElement.java
new file mode 100644
index 0000000..0f9936d
--- /dev/null
+++ b/OurApplication/OurLogElement.java
@@ -0,0 +1,49 @@
+package OurApplication;
+
+import logging.LogElement;
+
+/**
+ * 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 OurLogElement extends LogElement{
+
+ /** The log elements sum up value. */
+ protected long value;
+
+ /**
+ * Standard constructor.
+ * Calls the constructor of super class and sets value 0.
+ */
+ public OurLogElement() {
+ 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 OurLogElement(int step, String description, long value){
+ this.step=step;
+ this.description=description;
+ this.value=value;
+ }
+
+ /**
+ * Returns the log element's sum up value.
+ * @return the log element's sum up value
+ */
+ public long getValue(){
+ return value;
+ }
+
+}
diff --git a/OurApplication/OurParameterArea.java b/OurApplication/OurParameterArea.java
new file mode 100644
index 0000000..7c4a4a3
--- /dev/null
+++ b/OurApplication/OurParameterArea.java
@@ -0,0 +1,32 @@
+package OurApplication;
+
+import visualisation.ParameterArea;
+
+import javax.swing.*;
+
+/**
+ * This class provides an example for using visualization.ParameterArea.
+ * @see ParameterArea
+ * @author MSch�fer
+ * DHBW Stuttgart/Campus Horb AI2008
+ *
+ */
+public class OurParameterArea 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 OurParameterArea() {
+ super();
+ setBorder(BorderFactory.createTitledBorder("ParameterArea"));
+ }
+
+
+
+}
diff --git a/OurApplication/OurTextArea.java b/OurApplication/OurTextArea.java
new file mode 100644
index 0000000..1e1e077
--- /dev/null
+++ b/OurApplication/OurTextArea.java
@@ -0,0 +1,41 @@
+package OurApplication;
+
+import logging.LogElementList;
+import visualisation.TextArea;
+
+/**
+ * This class provides an example for using visualization.TextArea.
+ * Constructors and print() method have been overwritten.
+ * @see TextArea
+ * @author MSch�fer
+ * DHBW Stuttgart/Campus Horb AI2008
+ *
+ */
+public class OurTextArea extends TextArea{
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Standard constructor.
+ */
+ public OurTextArea() {
+ super();
+ }
+
+ /**
+ * Extended constructor.
+ * Sets LogElementList of TestLogElements as log list.
+ * @param logList the text area's log element list.
+ */
+ public OurTextArea(LogElementListlogList){
+ super(logList);
+ }
+
+ /**
+ * Textual output of a log element.
+ * No output.
+ */
+ public boolean print(){
+ return true;
+ }
+}