Dateien nach "visualization" hochladen
This commit is contained in:
parent
87fb98e308
commit
7dbde48298
BIN
visualization/ParameterArea.class
Normal file
BIN
visualization/ParameterArea.class
Normal file
Binary file not shown.
41
visualization/ParameterArea.java
Normal file
41
visualization/ParameterArea.java
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package visualization;
|
||||||
|
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class provides the basic parameter input area for an algorithm visualization.
|
||||||
|
* Add the components and corresponding methods you need and use them in your algorithm.
|
||||||
|
* @see logging.Algorithm
|
||||||
|
* @see visualization.HybridWindow
|
||||||
|
* @see javax.swing.JPanel
|
||||||
|
* @author Björn Strobel<br><small>
|
||||||
|
* University of Cooperative Education Stuttgart,
|
||||||
|
* Campus Horb<br>
|
||||||
|
* Department of Information Technology<br>
|
||||||
|
* it2003<br></small>
|
||||||
|
*/
|
||||||
|
public abstract class ParameterArea extends JPanel{
|
||||||
|
|
||||||
|
/** The parameter area's scroll pane. */
|
||||||
|
protected JScrollPane scrollPane;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Standard constructor.
|
||||||
|
* Creates an empty parameter area with scroll pane.
|
||||||
|
*/
|
||||||
|
public ParameterArea() {
|
||||||
|
scrollPane=new JScrollPane(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the parameter area's scroll pane.
|
||||||
|
* @return the parameter area's scroll pane
|
||||||
|
*/
|
||||||
|
public JScrollPane getScrollPane(){
|
||||||
|
return scrollPane;
|
||||||
|
}
|
||||||
|
}
|
BIN
visualization/TextArea.class
Normal file
BIN
visualization/TextArea.class
Normal file
Binary file not shown.
124
visualization/TextArea.java
Normal file
124
visualization/TextArea.java
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package visualization;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Font;
|
||||||
|
|
||||||
|
import javax.swing.JScrollPane;
|
||||||
|
import javax.swing.JTextArea;
|
||||||
|
|
||||||
|
import logging.LogElement;
|
||||||
|
import logging.LogElementList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class provides the basic text output area for a HybridWindow.
|
||||||
|
* Use it in assoziation with packages logging and visualization.
|
||||||
|
* Just overwrite the print method to get a textual output of a log list element.
|
||||||
|
* Parameters for algorithm processing are read from member parameterArea that ist part of the user interface.
|
||||||
|
* @see logging.Algorithm
|
||||||
|
* @see LogElement
|
||||||
|
* @see LogElementList
|
||||||
|
* @see visualization.DrawArea
|
||||||
|
* @see visualization.HybridWindow
|
||||||
|
* @see visualization.ParameterArea
|
||||||
|
* @see visualization.TextArea
|
||||||
|
* @see javax.swing.JTextArea
|
||||||
|
* @author Björn Strobel<br><small>
|
||||||
|
* University of Cooperative Education Stuttgart,
|
||||||
|
* Campus Horb<br>
|
||||||
|
* Department of Information Technology<br>
|
||||||
|
* it2003<br></small>
|
||||||
|
*/
|
||||||
|
public abstract class TextArea<LOG extends LogElement>extends JTextArea{
|
||||||
|
|
||||||
|
/** The text area's scroll pane. */
|
||||||
|
protected JScrollPane scrollPane;
|
||||||
|
/** The log element list where the text area gets the log elements. */
|
||||||
|
protected LogElementList<LOG>logList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Standard constructor.
|
||||||
|
* Creates an empty text area with scroll pane.
|
||||||
|
*/
|
||||||
|
public TextArea() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
scrollPane=new JScrollPane(this);
|
||||||
|
|
||||||
|
setBackground(Color.black);
|
||||||
|
setForeground(Color.green);
|
||||||
|
setEditable(false);
|
||||||
|
setColumns(25);
|
||||||
|
setRows(5);
|
||||||
|
setFont(new Font("Monospaced",Font.PLAIN,12));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an empty text area with scroll pane and sets the specified log list.
|
||||||
|
* @param logList the text area's log list
|
||||||
|
*/
|
||||||
|
public TextArea(LogElementList<LOG>logList){
|
||||||
|
super();
|
||||||
|
|
||||||
|
scrollPane=new JScrollPane(this);
|
||||||
|
|
||||||
|
setBackground(Color.black);
|
||||||
|
setForeground(Color.green);
|
||||||
|
setEditable(false);
|
||||||
|
setColumns(25);
|
||||||
|
setRows(5);
|
||||||
|
setFont(new Font("Monospaced",Font.PLAIN,12));
|
||||||
|
|
||||||
|
this.logList=logList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the text area's scroll pane.
|
||||||
|
* @return the text area's scroll pane
|
||||||
|
*/
|
||||||
|
public JScrollPane getScrollPane(){
|
||||||
|
return scrollPane;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the text area's logList.
|
||||||
|
* @param logList the text area's logList
|
||||||
|
*/
|
||||||
|
public void setLogList(LogElementList<LOG>logList){
|
||||||
|
this.logList=logList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provided for convenience. Calls print();
|
||||||
|
*/
|
||||||
|
public void printStep(){
|
||||||
|
print();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prints the actual algorithm step's description.
|
||||||
|
* It is suggested to overwrite this method.
|
||||||
|
*/
|
||||||
|
//public void print(){
|
||||||
|
public boolean print(){
|
||||||
|
LogElement logElement=(LogElement)logList.get();
|
||||||
|
if(getText().equals("")){
|
||||||
|
//setText(logElement.getDescription());
|
||||||
|
append(logElement.getDescription());
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
setText(getText()+"\n"+logElement.getDescription());
|
||||||
|
append("\n"+logElement.getDescription());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the text area
|
||||||
|
*/
|
||||||
|
public void clear(){
|
||||||
|
setText("");
|
||||||
|
}
|
||||||
|
}
|
1
visualization/package.html
Normal file
1
visualization/package.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<body>Provides the classes necessary to create a visualization of a logged algorithm.</body>
|
Loading…
Reference in New Issue
Block a user