01: /*
02: * Copyright 2000,2005 wingS development team.
03: *
04: * This file is part of wingS (http://wingsframework.org).
05: *
06: * wingS is free software; you can redistribute it and/or modify
07: * it under the terms of the GNU Lesser General Public License
08: * as published by the Free Software Foundation; either version 2.1
09: * of the License, or (at your option) any later version.
10: *
11: * Please see COPYING for the complete licence.
12: */
13: package org.wings.plaf.css;
14:
15: import java.io.IOException;
16:
17: import org.wings.SSpinner;
18: import org.wings.SComponent;
19: import org.wings.SResourceIcon;
20: import org.wings.SIcon;
21: import org.wings.io.Device;
22:
23: public class SpinnerCG extends AbstractComponentCG implements
24: org.wings.plaf.SpinnerCG {
25:
26: private static final SResourceIcon DEFAULT_ICON_NEXT = new SResourceIcon(
27: "org/wings/icons/SpinnerNext.gif");
28: private static final SResourceIcon DEFAULT_ICON_PREV = new SResourceIcon(
29: "org/wings/icons/SpinnerPrev.gif");
30:
31: private static final long serialVersionUID = 1L;
32:
33: private SIcon nextIcon = DEFAULT_ICON_NEXT;
34: private SIcon prevIcon = DEFAULT_ICON_PREV;
35:
36: public void installCG(SComponent component) {
37: super .installCG(component);
38: }
39:
40: public void uninstallCG(SComponent component) {
41: }
42:
43: public void writeInternal(final Device device,
44: final SComponent component) throws IOException {
45: final SSpinner spinner = (SSpinner) component;
46:
47: device.print("\n<table");
48: Utils.writeAllAttributes(device, component);
49: device.print("><tr><td>\n");
50: spinner.getEditor().write(device);
51: device
52: .print("\n</td><td style=\"width:0px; font-size: 0px; line-height: 0\">\n");
53:
54: device.print("<img src=\"" + getNextIcon().getURL()
55: + "\" style=\"display:block;vertical-align:bottom;\"");
56: Utils.printClickability(device, spinner, "0", true, false);
57: device.print(">\n");
58:
59: device.print("<img src=\"" + getPrevIcon().getURL()
60: + "\" style=\"display:block;vertical-align:bottom;\"");
61: Utils.printClickability(device, spinner, "1", true, false);
62: device.print(">\n");
63:
64: device.print("</td></tr></table>\n");
65: }
66:
67: public SIcon getNextIcon() {
68: return nextIcon;
69: }
70:
71: public void setNextIcon(SIcon nextIcon) {
72: this .nextIcon = nextIcon;
73: }
74:
75: public SIcon getPrevIcon() {
76: return prevIcon;
77: }
78:
79: public void setPrevIcon(SIcon prevIcon) {
80: this.prevIcon = prevIcon;
81: }
82: }
|