Dateien nach "visualization" hochladen
This commit is contained in:
parent
88e47b1b4b
commit
2b19178529
BIN
visualization/DrawArea.class
Normal file
BIN
visualization/DrawArea.class
Normal file
Binary file not shown.
134
visualization/DrawArea.java
Normal file
134
visualization/DrawArea.java
Normal file
@ -0,0 +1,134 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package visualization;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
|
||||
import logging.LogElement;
|
||||
import logging.LogElementList;
|
||||
|
||||
/**
|
||||
* This class provides the basic draw area for a HybridWindow.
|
||||
* Use it in assoziation with packages logging and visualization.
|
||||
* Just overwrite the draw(Graphics) method to get a graphic output from a log list element.
|
||||
* Parameters for algorithm processing are read from member parameterArea that ist part of the user interface.
|
||||
* @see LogElement
|
||||
* @see LogElementList
|
||||
* @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 DrawArea<LOG extends LogElement>extends JPanel{
|
||||
|
||||
/** The draw area's scroll pane. */
|
||||
protected JScrollPane scrollPane;
|
||||
/** The log element list where the draw area gets the log elements to draw. */
|
||||
protected LogElementList<LOG>logList;
|
||||
/** The name to be displayed on the draw area's tab in the hybrid window. */
|
||||
protected String drawAreaName;
|
||||
|
||||
/**
|
||||
* Standard constructor.
|
||||
* Creates an empty draw area with scroll pane.
|
||||
*/
|
||||
public DrawArea() {
|
||||
super();
|
||||
|
||||
scrollPane=new JScrollPane(this);
|
||||
|
||||
setBackground(new Color(194,177,255));
|
||||
setForeground(new Color(0,0,0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an empty draw area with scroll pane and sets the specified log list and tab name.
|
||||
* @param logList the draw area's log list
|
||||
* @param drawAreaName the name for the draw area to be displayed on the hybrid window's tab
|
||||
*/
|
||||
public DrawArea(LogElementList<LOG>logList,String drawAreaName){
|
||||
super();
|
||||
|
||||
scrollPane=new JScrollPane(this);
|
||||
|
||||
setBackground(new Color(194,177,255));
|
||||
setForeground(new Color(0,0,0));
|
||||
|
||||
this.logList=logList;
|
||||
this.drawAreaName=drawAreaName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the draw area'a scroll pane.
|
||||
* @return the draw area'a scroll pane
|
||||
*/
|
||||
public JScrollPane getScrollPane(){
|
||||
return scrollPane;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the draw area's log list.
|
||||
* @param logList the draw area's log list
|
||||
*/
|
||||
public void setLogList(LogElementList<LOG>logList){
|
||||
this.logList=logList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the draw area's name
|
||||
* @return the name to be returned
|
||||
*/
|
||||
public String getDrawAreaName() {
|
||||
return drawAreaName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the draw area's name
|
||||
* @param drawAreaName the name to be set
|
||||
*/
|
||||
public void setDrawAreaName(String drawAreaName) {
|
||||
this.drawAreaName = drawAreaName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls repaint().
|
||||
*/
|
||||
public void drawStep(){
|
||||
repaint();
|
||||
}
|
||||
|
||||
/**
|
||||
* Paints the draw area background and calls draw(Graphics).
|
||||
*/
|
||||
public void paint(Graphics g){
|
||||
super.paint(g);
|
||||
if(logList.isInitialized()){
|
||||
draw(g);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the actual log element's graphical output.
|
||||
* @param g Graphics object given by paint(Graphics);
|
||||
*/
|
||||
public void draw(Graphics g){
|
||||
LogElement logElement=(LogElement)logList.get();
|
||||
g.drawString(logElement.getDescription(),20,20);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provided for convenience. Does the same as drawStep.
|
||||
* Use it with logElementList.clear().
|
||||
*/
|
||||
public void clear(){
|
||||
repaint();
|
||||
}
|
||||
}
|
BIN
visualization/HybridWindow$AutoBackwardListener.class
Normal file
BIN
visualization/HybridWindow$AutoBackwardListener.class
Normal file
Binary file not shown.
BIN
visualization/HybridWindow$AutoButtonListener.class
Normal file
BIN
visualization/HybridWindow$AutoButtonListener.class
Normal file
Binary file not shown.
BIN
visualization/HybridWindow$AutoForwardListener.class
Normal file
BIN
visualization/HybridWindow$AutoForwardListener.class
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user