01: /*
02: * StringColumnRenderer.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.gui.renderer;
13:
14: /**
15: * This is basically a ToolTipRenderer, but for performance
16: * reasons we are assuming the values are all of type string.
17: * So we can use a type cast in the getDisplay() method
18: * instead of toString() which is much faster when no exceptions
19: * are thrown.
20: *
21: * @author support@sql-workbench.net
22: */
23: public class StringColumnRenderer extends ToolTipRenderer {
24: public StringColumnRenderer() {
25: super ();
26: }
27:
28: public void prepareDisplay(Object aValue) {
29: try {
30: this .displayValue = (String) aValue;
31: } catch (Throwable e) {
32: displayValue = (aValue == null ? null : aValue.toString());
33: }
34: setTooltip(displayValue);
35: }
36:
37: }
|