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 org.wings.SAnchor;
16: import org.wings.SComponent;
17: import org.wings.io.Device;
18: import org.wings.script.JavaScriptEvent;
19:
20: import java.io.IOException;
21:
22: public final class AnchorCG extends AbstractComponentCG implements
23: org.wings.plaf.AnchorCG {
24: private static final long serialVersionUID = 1L;
25:
26: /* (non-Javadoc)
27: * @see org.wings.plaf.css.AbstractComponentCG#writeContent(org.wings.io.Device, org.wings.SComponent)
28: */
29: @Override
30: public void writeInternal(final Device device, final SComponent _c)
31: throws IOException {
32: final SAnchor component = (SAnchor) _c;
33: /*final boolean useTable = hasDimension(component);
34: if (useTable) {
35: writeTablePrefix(device, component);
36: // render javascript event handlers
37: Utils.writeEvents(device, component, null);
38: }
39: Utils.printButtonStart(device, component, null, true, component.getShowAsFormComponent());
40: if (!useTable) {
41: writeAllAttributes(device, component);
42: // render javascript event handlers
43: Utils.writeEvents(device, component, null);
44: }
45: */
46:
47: final String target = component.getTarget() != null ? "'"
48: + component.getTarget() + "'" : "null";
49: device.print("<table onclick=\"wingS.util.openLink("
50: + target
51: + ",'"
52: + component.getURL()
53: + "'"
54: + Utils.collectJavaScriptListenerCode(component,
55: JavaScriptEvent.ON_CLICK)
56: + "); return false;\"");
57: Utils.writeAllAttributes(device, component);
58: if (component.isFocusOwner())
59: Utils.optAttribute(device, "foc", component.getName());
60: //Utils.optAttribute(device, "target", component.getTarget());
61: Utils.optAttribute(device, "tabindex", component
62: .getFocusTraversalIndex());
63: device.print(">");
64: Utils.renderContainer(device, component);
65: device.print("</table>");
66: }
67: }
|