/* * TilePlotQueueCanvas.java * * Created on June 12, 2006, 12:14 PM */ package Current.popups.Memory; import java.awt.*; import java.awt.event.*; import java.awt.geom.Line2D; import org.pat.graphics.boxed.ListenString; import Current.gui.*; /** * * @author pat */ public class TilePlotQueueCanvas extends DBCanvas implements MouseListener { TileMemoryContainer cont; ListenString[] LS; ListenString start,stop,clear; /** Creates a new instance of TilePlotQueueCanvas */ public TilePlotQueueCanvas(TileMemoryContainer cont) { this.cont=cont; this.cont.M.addListener(this); this.setBackground(cont.getBackground()); setFont(new Font("sanserif", Font.PLAIN, 12)); double y=4; LS=new ListenString[4]; LS[0]=new ListenString("",this); LS[0].showBorder=false; LS[0].setColors(Color.black,getBackground()); LS[0].setLeft(4); LS[0].setTop(y); y=LS[0].getBottom()+4; LS[1]=new ListenString("",this); LS[1].showBorder=false; LS[1].setColors(Color.black,getBackground()); LS[1].setLeft(4); LS[1].setTop(y); y=LS[1].getBottom()+4; LS[2]=new ListenString("",this); LS[2].setColors(Color.black,cont.buttonBg); LS[2].setLeft(4); LS[2].setTop(y); y=LS[2].getBottom()+4; LS[3]=new ListenString("",this); LS[3].setColors(Color.black,cont.buttonBg); LS[3].setLeft(4); LS[3].setTop(y); y=LS[3].getBottom()+4; addMouseListener(this); } public void paint(Graphics gfx) { Graphics2D g=(Graphics2D) gfx; g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); int size=cont.queue.getSize(); start=stop=clear=null; if (size==0) { LS[0].str="No tiles in plot queue"; LS[0].render(g); } else { LS[0].str=""+size+" tiles in plot queue"; LS[0].render(g); if (cont.queue.running()) { LS[1].str="currently plotting"; LS[1].render(g); LS[2].str="stop plotting"; LS[2].size(); stop=LS[2]; LS[2].render(g); } else { LS[1].str="not plotting"; LS[1].render(g); LS[2].str="start plotting"; LS[2].size(); start=LS[2]; LS[2].render(g); LS[3].str="clear plot queue"; LS[3].size(); clear=LS[3]; LS[3].render(g); } } } public void mcbCleanup() { cont.M.remove(this); } public void mcbReceive(TilePlotQueue tpq) { repaint(); } public void mouseClicked(MouseEvent e) { if ((start!=null) && (start.contains(e))) { cont.queue.start(); } if ((stop!=null) && (stop.contains(e))) { cont.queue.stop(); } if ((clear!=null) && (clear.contains(e))) { cont.queue.clear(); } } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } }