diff --git a/visualization/ParameterArea.class b/visualization/ParameterArea.class new file mode 100644 index 0000000..9e87f33 Binary files /dev/null and b/visualization/ParameterArea.class differ diff --git a/visualization/ParameterArea.java b/visualization/ParameterArea.java new file mode 100644 index 0000000..768f27a --- /dev/null +++ b/visualization/ParameterArea.java @@ -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
+ * University of Cooperative Education Stuttgart, + * Campus Horb
+ * Department of Information Technology
+ * it2003
+ */ +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; + } +} diff --git a/visualization/TextArea.class b/visualization/TextArea.class new file mode 100644 index 0000000..c1298f8 Binary files /dev/null and b/visualization/TextArea.class differ diff --git a/visualization/TextArea.java b/visualization/TextArea.java new file mode 100644 index 0000000..ee0a5c8 --- /dev/null +++ b/visualization/TextArea.java @@ -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
+ * University of Cooperative Education Stuttgart, + * Campus Horb
+ * Department of Information Technology
+ * it2003
+ */ +public abstract class TextAreaextends JTextArea{ + + /** The text area's scroll pane. */ + protected JScrollPane scrollPane; + /** The log element list where the text area gets the log elements. */ + protected LogElementListlogList; + + /** + * 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(LogElementListlogList){ + 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(LogElementListlogList){ + 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(""); + } +} diff --git a/visualization/package.html b/visualization/package.html new file mode 100644 index 0000000..266e37d --- /dev/null +++ b/visualization/package.html @@ -0,0 +1 @@ +Provides the classes necessary to create a visualization of a logged algorithm. \ No newline at end of file