1 14 package org.wings.plaf.css; 15 16 import org.apache.commons.logging.Log; 17 import org.apache.commons.logging.LogFactory; 18 import org.wings.SComponent; 19 import org.wings.SConstants; 20 import org.wings.io.Device; 21 import org.wings.plaf.ComponentCG; 22 import org.wings.session.SessionManager; 23 import org.wings.style.CSSSelector; 24 25 import java.io.IOException ; 26 import java.io.Serializable ; 27 28 34 public abstract class AbstractComponentCG implements ComponentCG, SConstants, Serializable { 35 private final static transient Log log = LogFactory.getLog(AbstractComponentCG.class); 36 37 protected AbstractComponentCG() { 38 } 39 40 45 public void installCG(SComponent component) { 46 Class clazz = component.getClass(); 47 while ("org.wings".equals(clazz.getPackage().getName()) == false) 48 clazz = clazz.getSuperclass(); 49 String style = clazz.getName(); 50 style = style.substring(style.lastIndexOf('.') + 1); 51 component.setStyle(style); } 53 54 59 public void uninstallCG(SComponent component) { 60 } 61 62 public void write(Device device, SComponent component) throws IOException { 63 if (!component.isVisible()) 64 return; 65 writePrefix(device, component); 66 writeContent(device, component); 67 writeSuffix(device, component); 68 } 69 70 71 protected void writePrefix(Device device, SComponent component) throws IOException { 72 SessionManager.getSession().getCGManager().getPrefixSuffixDelegate().writePrefix(device, component); 73 } 74 75 protected void writeSuffix(Device device, SComponent component) throws IOException { 76 SessionManager.getSession().getCGManager().getPrefixSuffixDelegate().writeSuffix(device, component); 77 } 78 79 public CSSSelector mapSelector(SComponent addressedComponent, CSSSelector selector) { 80 return selector; 82 } 83 84 protected void writeContent(Device device, SComponent component) throws IOException { 85 } 86 } 87 | Popular Tags |