//(c):Benja Fallenstein package gzz.view; import gzz.*; import gzz.client.*; import gzz.vob.*; import java.awt.Font; /** A scene decorator showing the current mark set. */ public class MarkDecorator implements FallbackSceneDecorator { static Object KEY = new Object(), TEXT_KEY = new Object(); static final int PAD = 10; static CellView cv = new CellVobFactory(); static TextStyle style = GraphicsAPI.getInstance().getTextStyle("SansSerif", Font.PLAIN, 12); static String str = "Marked cells:"; public void render(VobScene sc, int into, Fallback fallback, Fallback.Win win) { java.awt.Dimension box = new java.awt.Dimension(); cv.getDefaultSize(1, box); int n = fallback.binder.marks.size(); if(n == 0) return; float w = box.width, h = n * box.height; java.awt.Dimension outer = sc.getSize(); float x = outer.width - w - PAD, y = outer.height - h - PAD; int cs_list = sc.coordsys(into, KEY, 0, x, y, w, h); for(int i=0; i box.width) x += box.width - w; int cs = sc.coordsys(into, TEXT_KEY, 0, x, y, w, h); sc.map.put(new TextVob(style, 1, str), cs); } }