1 14 package org.wings.plaf.css; 15 16 import org.wings.*; 17 import org.wings.io.Device; 18 19 import java.awt.*; 20 import java.io.IOException ; 21 22 public class ScrollPaneCG extends org.wings.plaf.css.AbstractComponentCG implements org.wings.plaf.ScrollPaneCG { 23 public void write(Device device, SComponent component) throws IOException { 24 SScrollPane scrollPane = (SScrollPane) component; 25 Scrollable scrollable = scrollPane.getScrollable(); 26 SScrollPaneLayout layout = (SScrollPaneLayout) scrollPane.getLayout(); 27 28 if (!layout.isPaging() && scrollable instanceof SComponent) { 29 SComponent center = (SComponent) scrollable; 30 Rectangle viewportSize = scrollable.getViewportSize(); 31 SDimension preferredSize = center.getPreferredSize(); 32 try { 33 scrollable.setViewportSize(scrollable.getScrollableViewportSize()); 34 center.setPreferredSize(component.getPreferredSize()); 35 component.setPreferredSize(null); 36 super.write(device, component); 37 } finally { 38 component.setPreferredSize(center.getPreferredSize()); 39 scrollable.setViewportSize(viewportSize); 40 center.setPreferredSize(preferredSize); 41 } 42 } else 43 super.write(device, component); 44 } 45 46 public void writeContent(Device d, SComponent c) 47 throws IOException { 48 SScrollPane scrollPane = (SScrollPane) c; 49 scrollPane.synchronizeAdjustables(); 50 Utils.renderContainer(d, scrollPane); 51 } 52 } 53 54 55 | Popular Tags |