/* * TileMemoryContainer.java * * Created on June 9, 2006, 4:31 PM */ package Current.popups.Memory; import java.awt.*; import java.awt.event.*; import Current.*; import Current.manage.*; /** * */ public class TileMemoryContainer extends Container implements HierarchyListener { public Manager M; protected TileTitleCanvas menu; protected Component center; public TilePlotQueue queue; public static Color fgColor=Color.black, //new Color(68,77,97), buttonBg=new Color(231,206,143); /** Creates a new instance of TileMemoryContainer */ public TileMemoryContainer(Manager M) { this.M=M; queue=new TilePlotQueue(M); setBackground(new Color(222,144,60)); this.setLayout(new BorderLayout(0,0)); menu=new TileTitleCanvas(this); this.add(menu,BorderLayout.NORTH); if (M.canWrite()) center=new TileMemorySaveCanvas(this); else center=new TileMemoryLoadCanvas(this); this.add(center,BorderLayout.CENTER); this.addHierarchyListener(this); } public void setCenter(Component new_center) { remove(center); M.cleanupObject(center); center=new_center; if (center instanceof TileMemorySaveCanvas) { menu.setSelected(1); } else if (center instanceof TileMemoryLoadCanvas) { menu.setSelected(2); } else if (center instanceof TilePlotQueueCanvas) { menu.setSelected(3); } else { menu.setSelected(-1); } this.add(center,BorderLayout.CENTER); validate(); menu.repaint(); } public void mcbCleanup() { M.cleanupObject(center); if (queue.running()) { queue.stop(); } } public void hierarchyChanged(java.awt.event.HierarchyEvent hierarchyEvent) { //System.out.println("shown"); if (this.getParent()!=null) this.getParent().setBackground(new Color(222,144,60)); } }