OurApplication test
This commit is contained in:
parent
cf63dddf51
commit
6b0caa1a5e
100
.idea/workspace.xml
generated
100
.idea/workspace.xml
generated
@ -5,64 +5,16 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="70f8ea87-9ffc-471a-8059-ebbfc323adcc" name="Changes" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/HTMLTest.html" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/Main.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/ProjektGraph.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/ProjektGraph.iml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/OurApplication/OurAlgorithm.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/OurApplication/OurApplication.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/OurApplication/OurDrawArea.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/OurApplication/OurHybridWindow.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/OurApplication/OurLegendArea.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/OurApplication/OurLogElement.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/OurApplication/OurParameterArea.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/OurApplication/OurTextArea.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/logging/Algorithm.class" beforeDir="false" afterPath="$PROJECT_DIR$/logging/Algorithm.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/logging/Algorithm.java" beforeDir="false" afterPath="$PROJECT_DIR$/logging/Algorithm.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/logging/LogElement.class" beforeDir="false" afterPath="$PROJECT_DIR$/logging/LogElement.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/logging/LogElement.java" beforeDir="false" afterPath="$PROJECT_DIR$/logging/LogElement.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/logging/LogElementList.class" beforeDir="false" afterPath="$PROJECT_DIR$/logging/LogElementList.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/logging/LogElementList.java" beforeDir="false" afterPath="$PROJECT_DIR$/logging/LogElementList.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/logging/package.html" beforeDir="false" afterPath="$PROJECT_DIR$/logging/package.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/testApplication/TestAlgorithm.java" beforeDir="false" afterPath="$PROJECT_DIR$/testApplication/TestAlgorithm.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/testApplication/TestApplication.java" beforeDir="false" afterPath="$PROJECT_DIR$/testApplication/TestApplication.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/testApplication/TestDrawArea.java" beforeDir="false" afterPath="$PROJECT_DIR$/testApplication/TestDrawArea.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/testApplication/TestHybridWindow.java" beforeDir="false" afterPath="$PROJECT_DIR$/testApplication/TestHybridWindow.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/testApplication/TestLegendArea.java" beforeDir="false" afterPath="$PROJECT_DIR$/testApplication/TestLegendArea.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/testApplication/TestLogElement.java" beforeDir="false" afterPath="$PROJECT_DIR$/testApplication/TestLogElement.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/testApplication/TestParameterArea.java" beforeDir="false" afterPath="$PROJECT_DIR$/testApplication/TestParameterArea.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/testApplication/TestTextArea.java" beforeDir="false" afterPath="$PROJECT_DIR$/testApplication/TestTextArea.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/testApplication/package.html" beforeDir="false" afterPath="$PROJECT_DIR$/testApplication/package.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualization/DrawArea.class" beforeDir="false" afterPath="$PROJECT_DIR$/visualisation/DrawArea.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualization/DrawArea.java" beforeDir="false" afterPath="$PROJECT_DIR$/visualisation/DrawArea.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualization/HybridWindow$AutoBackwardListener.class" beforeDir="false" afterPath="$PROJECT_DIR$/visualisation/HybridWindow$AutoBackwardListener.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualization/HybridWindow$AutoButtonListener.class" beforeDir="false" afterPath="$PROJECT_DIR$/visualisation/HybridWindow$AutoButtonListener.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualization/HybridWindow$AutoForwardListener.class" beforeDir="false" afterPath="$PROJECT_DIR$/visualisation/HybridWindow$AutoForwardListener.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualization/HybridWindow$AutoSliderListener.class" beforeDir="false" afterPath="$PROJECT_DIR$/visualisation/HybridWindow$AutoSliderListener.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualization/HybridWindow$FirstListener.class" beforeDir="false" afterPath="$PROJECT_DIR$/visualisation/HybridWindow$FirstListener.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualization/HybridWindow$LastListener.class" beforeDir="false" afterPath="$PROJECT_DIR$/visualisation/HybridWindow$LastListener.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualization/HybridWindow$NextListener.class" beforeDir="false" afterPath="$PROJECT_DIR$/visualisation/HybridWindow$NextListener.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualization/HybridWindow$PrevListener.class" beforeDir="false" afterPath="$PROJECT_DIR$/visualisation/HybridWindow$PrevListener.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualization/HybridWindow$StartListener.class" beforeDir="false" afterPath="$PROJECT_DIR$/visualisation/HybridWindow$StartListener.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualization/HybridWindow$StopListener.class" beforeDir="false" afterPath="$PROJECT_DIR$/visualisation/HybridWindow$StopListener.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualization/HybridWindow.class" beforeDir="false" afterPath="$PROJECT_DIR$/visualisation/HybridWindow.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualization/HybridWindow.java" beforeDir="false" afterPath="$PROJECT_DIR$/visualisation/HybridWindow.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualization/LegendArea.java" beforeDir="false" afterPath="$PROJECT_DIR$/visualisation/LegendArea.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualization/ParameterArea.class" beforeDir="false" afterPath="$PROJECT_DIR$/visualisation/ParameterArea.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualization/ParameterArea.java" beforeDir="false" afterPath="$PROJECT_DIR$/visualisation/ParameterArea.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualization/TextArea.class" beforeDir="false" afterPath="$PROJECT_DIR$/visualisation/TextArea.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualization/TextArea.java" beforeDir="false" afterPath="$PROJECT_DIR$/visualisation/TextArea.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualization/package.html" beforeDir="false" afterPath="$PROJECT_DIR$/visualisation/package.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualizationElements/BarChart.java" beforeDir="false" afterPath="$PROJECT_DIR$/visualizationElements/BarChart.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualizationElements/BarChartElement.java" beforeDir="false" afterPath="$PROJECT_DIR$/visualizationElements/BarChartElement.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualizationElements/Cell.java" beforeDir="false" afterPath="$PROJECT_DIR$/visualizationElements/Cell.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualizationElements/ChessBoard.java" beforeDir="false" afterPath="$PROJECT_DIR$/visualizationElements/ChessBoard.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualizationElements/DotChart.java" beforeDir="false" afterPath="$PROJECT_DIR$/visualizationElements/DotChart.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualizationElements/Edge.java" beforeDir="false" afterPath="$PROJECT_DIR$/visualizationElements/Edge.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualizationElements/EdgeStyle.java" beforeDir="false" afterPath="$PROJECT_DIR$/visualizationElements/EdgeStyle.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualizationElements/Graph.java" beforeDir="false" afterPath="$PROJECT_DIR$/visualizationElements/Graph.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualizationElements/Hashtable.java" beforeDir="false" afterPath="$PROJECT_DIR$/visualizationElements/Hashtable.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualizationElements/List.java" beforeDir="false" afterPath="$PROJECT_DIR$/visualizationElements/List.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualizationElements/Maze.java" beforeDir="false" afterPath="$PROJECT_DIR$/visualizationElements/Maze.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualizationElements/Queue.java" beforeDir="false" afterPath="$PROJECT_DIR$/visualizationElements/Queue.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualizationElements/Stack.java" beforeDir="false" afterPath="$PROJECT_DIR$/visualizationElements/Stack.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualizationElements/Table.java" beforeDir="false" afterPath="$PROJECT_DIR$/visualizationElements/Table.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualizationElements/Vertex.java" beforeDir="false" afterPath="$PROJECT_DIR$/visualizationElements/Vertex.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualizationElements/VisualizationElement.java" beforeDir="false" afterPath="$PROJECT_DIR$/visualizationElements/VisualizationElement.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Neuer Ordner/workspace/visualizationFramework/src/visualizationElements/package.html" beforeDir="false" afterPath="$PROJECT_DIR$/visualizationElements/package.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/Main.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -77,6 +29,9 @@
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Merge.Settings">
|
||||
<option name="BRANCH" value="VisualisationTests" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||
<map>
|
||||
@ -99,13 +54,16 @@
|
||||
"DefaultHtmlFileTemplate": "HTML File",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "VisualisationTests",
|
||||
"git-widget-placeholder": "main",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"last_opened_file_path": "C:/Git/ProjektGraph",
|
||||
"last_opened_file_path": "C:/Users/jonas/DHBW Dateien/Semester 2/Programmieren 2/Projekt/ProjektGraph/OurApplication",
|
||||
"settings.editor.selected.configurable": "vcs.Git"
|
||||
}
|
||||
}]]></component>
|
||||
<component name="RecentsManager">
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
<recent name="C:\Users\jonas\DHBW Dateien\Semester 2\Programmieren 2\Projekt\ProjektGraph\OurApplication" />
|
||||
</key>
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="C:\Users\jonas\DHBW Dateien\Semester 2\Programmieren 2\Projekt\ProjektGraph\visualizationElements" />
|
||||
<recent name="C:\Users\jonas\DHBW Dateien\Semester 2\Programmieren 2\Projekt\ProjektGraph\testApplication" />
|
||||
@ -122,6 +80,15 @@
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1718547365327</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="Visualisation tests">
|
||||
<option name="closed" value="true" />
|
||||
<created>1719479266810</created>
|
||||
<option name="number" value="00001" />
|
||||
<option name="presentableId" value="LOCAL-00001" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1719479266810</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="2" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
@ -135,4 +102,19 @@
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="Visualisation tests" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Visualisation tests" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
<breakpoints>
|
||||
<line-breakpoint enabled="true" type="java-line">
|
||||
<url>file://$PROJECT_DIR$/OurApplication/OurApplication.java</url>
|
||||
<line>56</line>
|
||||
<option name="timeStamp" value="3" />
|
||||
</line-breakpoint>
|
||||
</breakpoints>
|
||||
</breakpoint-manager>
|
||||
</component>
|
||||
</project>
|
28
Main.java
28
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);
|
||||
LogElementList<OurLogElement>logList=new LogElementList<OurLogElement>();
|
||||
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<OurDrawArea, OurTextArea, OurParameterArea, OurAlgorithm, OurLogElement, OurLegendArea> test = new HybridWindow<OurDrawArea, OurTextArea, OurParameterArea, OurAlgorithm, OurLogElement, OurLegendArea>(drawArea,textArea,parameterArea,algorithm,logList,legendArea);
|
||||
test.init();
|
||||
test.setVisible(true);
|
||||
|
||||
contentPane.add(test);
|
||||
t.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
48
OurApplication/OurAlgorithm.java
Normal file
48
OurApplication/OurAlgorithm.java
Normal file
@ -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<EFBFBD>fer
|
||||
* DHBW Stuttgart/Campus Horb AI2008<br>
|
||||
* <br>
|
||||
*/
|
||||
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(){
|
||||
LogElementList<OurLogElement>logList = new LogElementList<OurLogElement>();
|
||||
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;
|
||||
}
|
||||
}
|
76
OurApplication/OurApplication.java
Normal file
76
OurApplication/OurApplication.java
Normal file
@ -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<EFBFBD>fer
|
||||
* DHBW Stuttgart/Campus Horb AI2008<br>
|
||||
* <br>
|
||||
*/
|
||||
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<VertexMarking, EdgeMarking> myGraph = new DirectedGraph<>();
|
||||
|
||||
for (int i = 0; i < 10; i++) {
|
||||
myGraph.addVertex(new MarkedVertex<>(String.valueOf(i), null));
|
||||
}
|
||||
Random random = new Random();
|
||||
|
||||
for (MarkedVertex<VertexMarking> i: myGraph.getAllVertexes()) {
|
||||
myGraph.addEdge(new MarkedEdge<>("a", i, myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size())), null, random.nextInt(1, 10)));
|
||||
}
|
||||
|
||||
for (MarkedVertex<VertexMarking> i: myGraph.getAllVertexes()) {
|
||||
myGraph.addEdge(new MarkedEdge<>("a", i, myGraph.getAllVertexes().get(random.nextInt(myGraph.getAllVertexes().size())), null, random.nextInt(1, 10)));
|
||||
}
|
||||
|
||||
LogElementList<OurLogElement>logList=new LogElementList<OurLogElement>();
|
||||
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<OurDrawArea, OurTextArea, OurParameterArea, OurAlgorithm, OurLogElement, OurLegendArea> applet=new HybridWindow<OurDrawArea, OurTextArea, OurParameterArea, OurAlgorithm, OurLogElement, OurLegendArea>(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);
|
||||
}
|
||||
|
||||
}
|
80
OurApplication/OurDrawArea.java
Normal file
80
OurApplication/OurDrawArea.java
Normal file
@ -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<EFBFBD>fer
|
||||
* DHBW Stuttgart/Campus Horb AI2008<br>
|
||||
* <br>
|
||||
*/
|
||||
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<OurLogElement> 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<Vertex> vertexes = new Vector<Vertex>();
|
||||
|
||||
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<Edge> edges = new Vector<Edge>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
33
OurApplication/OurHybridWindow.java
Normal file
33
OurApplication/OurHybridWindow.java
Normal file
@ -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<EFBFBD>fer
|
||||
* DHBW Stuttgart/Campus Horb AI2008<br>
|
||||
* <br>
|
||||
*/
|
||||
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<OurLogElement>();
|
||||
parameterArea=new OurParameterArea();
|
||||
drawArea=new OurDrawArea(logList,"visualization");
|
||||
textArea=new OurTextArea(logList);
|
||||
legendArea=new OurLegendArea();
|
||||
algorithm=new OurAlgorithm((OurParameterArea)parameterArea);
|
||||
}
|
||||
}
|
39
OurApplication/OurLegendArea.java
Normal file
39
OurApplication/OurLegendArea.java
Normal file
@ -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<EFBFBD>fer
|
||||
* DHBW Stuttgart/Campus Horb AI2008<br>
|
||||
* <br>
|
||||
*/
|
||||
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"));
|
||||
}
|
||||
}
|
49
OurApplication/OurLogElement.java
Normal file
49
OurApplication/OurLogElement.java
Normal file
@ -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<EFBFBD>fer
|
||||
* DHBW Stuttgart/Campus Horb AI2008<br>
|
||||
* <br>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
32
OurApplication/OurParameterArea.java
Normal file
32
OurApplication/OurParameterArea.java
Normal file
@ -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<EFBFBD>fer
|
||||
* DHBW Stuttgart/Campus Horb AI2008<br>
|
||||
* <br>
|
||||
*/
|
||||
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"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
41
OurApplication/OurTextArea.java
Normal file
41
OurApplication/OurTextArea.java
Normal file
@ -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<EFBFBD>fer
|
||||
* DHBW Stuttgart/Campus Horb AI2008<br>
|
||||
* <br>
|
||||
*/
|
||||
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(LogElementList<OurLogElement>logList){
|
||||
super(logList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Textual output of a log element.
|
||||
* No output.
|
||||
*/
|
||||
public boolean print(){
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user