Coder la lentille de trace appartenant à un flot Drawer.
import broad.gfx.draw.Drawer;
import java.awt.Graphics2D;
import broad.util.CannotBeNullException;
import broad.string.output.StringOutput;
public class TraceDrawer implements Drawer {
private StringOutput output;
private Drawer lensee;
public TraceDrawer(StringOutput output, Drawer lensee) {
if(output == null) throw new CannotBeNullException(this, "output");
if(lensee == null) throw new CannotBeNullException(this, "lensee");
this.output = output;
this.lensee = lensee;
}
public void draw(Graphics2D g) {
output.setString("Trace: lensee called: " + lensee);
lensee.draw(g);
}
}
new TraceDrawer t1
new TraceDrawer t2
new TraceDrawer t3
new broad.string.output.util.ConsoleStringOutput consoleOut
tie t1 0 consoleOut 0
tie t2 0 consoleOut 0
tie t3 0 consoleOut 0
group trace t1 t2 t3 consoleOut