Dateien nach "testApplication" hochladen
This commit is contained in:
parent
dec65166d2
commit
9aaa5b43cf
34
testApplication/TestHybridWindow.java
Normal file
34
testApplication/TestHybridWindow.java
Normal file
@ -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<EFBFBD>fer
|
||||||
|
* DHBW Stuttgart/Campus Horb AI2008<br>
|
||||||
|
* <br>
|
||||||
|
*/
|
||||||
|
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<TestLogElement>();
|
||||||
|
parameterArea=new TestParameterArea();
|
||||||
|
drawArea=new TestDrawArea(logList,"visualization");
|
||||||
|
textArea=new TestTextArea(logList);
|
||||||
|
legendArea=new TestLegendArea();
|
||||||
|
algorithm=new TestAlgorithm((TestParameterArea)parameterArea);
|
||||||
|
}
|
||||||
|
}
|
39
testApplication/TestLegendArea.java
Normal file
39
testApplication/TestLegendArea.java
Normal file
@ -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<br>
|
||||||
|
* <br>
|
||||||
|
*/
|
||||||
|
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"));
|
||||||
|
}
|
||||||
|
}
|
56
testApplication/TestLogElement.java
Normal file
56
testApplication/TestLogElement.java
Normal file
@ -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<EFBFBD>fer
|
||||||
|
* DHBW Stuttgart/Campus Horb AI2008<br>
|
||||||
|
* <br>
|
||||||
|
*/
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
32
testApplication/TestParameterArea.java
Normal file
32
testApplication/TestParameterArea.java
Normal file
@ -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<br>
|
||||||
|
* <br>
|
||||||
|
*/
|
||||||
|
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"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
41
testApplication/TestTextArea.java
Normal file
41
testApplication/TestTextArea.java
Normal file
@ -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<br>
|
||||||
|
* <br>
|
||||||
|
*/
|
||||||
|
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(LogElementList<TestLogElement>logList){
|
||||||
|
super(logList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Textual output of a log element.
|
||||||
|
* No output.
|
||||||
|
*/
|
||||||
|
public boolean print(){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user