001: /*
002: * BackgroundPainterBeanInfo.java
003: *
004: * Created on March 21, 2006, 12:10 PM
005: *
006: * To change this template, choose Tools | Template Manager
007: * and open the template in the editor.
008: */
009:
010: package org.jdesktop.swingx.painter;
011:
012: import java.awt.AlphaComposite;
013: import java.awt.RenderingHints;
014: import org.jdesktop.swingx.BeanInfoSupport;
015: import org.jdesktop.swingx.EnumerationValue;
016: import org.jdesktop.swingx.editors.EnumerationValuePropertyEditor;
017: import org.jdesktop.swingx.util.Resize;
018:
019: /**
020: *
021: * @author Richard
022: */
023: public class AbstractPainterBeanInfo extends BeanInfoSupport {
024:
025: /** Creates a new instance of BackgroundPainterBeanInfo */
026: public AbstractPainterBeanInfo() {
027: super (AbstractPainter.class);
028: }
029:
030: public AbstractPainterBeanInfo(Class clazz) {
031: super (clazz);
032: }
033:
034: protected void initialize() {
035: setHidden(true, "class", "propertyChangeListeners",
036: "renderingHints");
037:
038: //set editor for the clip shape
039: //set editor for the effects (not sure how to do this one)
040: //TODO
041:
042: //set editor for resizeClip
043: setPropertyEditor(ResizeClipPropertyEditor.class, "resizeClip");
044: //set editor for composite (incl. Alpha composites by default)
045: setPropertyEditor(CompositePropertyEditor.class, "composite");
046: //set editors for the various rendering hints
047: setPropertyEditor(AlphaInterpolationPropertyEditor.class,
048: "alphaInterpolation");
049: setPropertyEditor(AntialiasingPropertyEditor.class,
050: "antialiasing");
051: setPropertyEditor(ColorRenderingPropertyEditor.class,
052: "colorRendering");
053: setPropertyEditor(DitheringPropertyEditor.class, "dithering");
054: setPropertyEditor(FractionalMetricsPropertyEditor.class,
055: "fractionalMetrics");
056: setPropertyEditor(InterpolationPropertyEditor.class,
057: "interpolation");
058: setPropertyEditor(RenderingPropertyEditor.class, "rendering");
059: setPropertyEditor(StrokeControlPropertyEditor.class,
060: "strokeControl");
061: setPropertyEditor(TextAntialiasingPropertyEditor.class,
062: "textAntialiasing");
063:
064: //move some items into "Appearance" and some into "Behavior"
065: setCategory("Rendering Hints", "alphaInterpolation",
066: "antialiasing", "colorRendering", "dithering",
067: "fractionalMetrics", "interpolation", "rendering",
068: "strokeControl", "textAntialiasing");
069: setCategory("Appearance", "clip", "composite", "effects");
070: setCategory("Behavior", "resizeClip", "useCache");
071: }
072:
073: public static final class ResizeClipPropertyEditor extends
074: EnumerationValuePropertyEditor {
075: public ResizeClipPropertyEditor() {
076: super (null, new EnumerationValue[] {
077: new EnumerationValue("None", Resize.NONE,
078: "Resize.NONE"),
079: new EnumerationValue("Horizontal",
080: Resize.HORIZONTAL, "Resize.HORIZONTAL"),
081: new EnumerationValue("Vertical", Resize.VERTICAL,
082: "Resize.VERTICAL"),
083: new EnumerationValue("Both", Resize.BOTH,
084: "Resize.BOTH") });
085: }
086: }
087:
088: public static final class CompositePropertyEditor extends
089: EnumerationValuePropertyEditor {
090: public CompositePropertyEditor() {
091: super (null, new EnumerationValue[] {
092: new EnumerationValue("", null, "null"),
093: new EnumerationValue("Clear", AlphaComposite.Clear,
094: "AlphaComposite.Clear"),
095: new EnumerationValue("Destination",
096: AlphaComposite.Dst, "AlphaComposite.Dst"),
097: new EnumerationValue("Destination Atop",
098: AlphaComposite.DstAtop,
099: "AlphaComposite.DstAtop"),
100: new EnumerationValue("Destination In",
101: AlphaComposite.DstIn,
102: "AlphaComposite.DstIn"),
103: new EnumerationValue("Destination Out",
104: AlphaComposite.DstOut,
105: "AlphaComposite.DstOut"),
106: new EnumerationValue("Destination Over",
107: AlphaComposite.DstOver,
108: "AlphaComposite.DstOver"),
109: new EnumerationValue("Source", AlphaComposite.Src,
110: "AlphaComposite.Src"),
111: new EnumerationValue("Source Atop",
112: AlphaComposite.SrcAtop,
113: "AlphaComposite.SrcAtop"),
114: new EnumerationValue("Source In",
115: AlphaComposite.SrcIn,
116: "AlphaComposite.SrcIn"),
117: new EnumerationValue("Source Out",
118: AlphaComposite.SrcOut,
119: "AlphaComposite.SrcOut"),
120: new EnumerationValue("Source Over",
121: AlphaComposite.SrcOver,
122: "AlphaComposite.SrcOver"),
123: new EnumerationValue("Xor", AlphaComposite.Xor,
124: "AlphaComposite.Xor") });
125: }
126: }
127:
128: public static final class AlphaInterpolationPropertyEditor extends
129: EnumerationValuePropertyEditor {
130: public AlphaInterpolationPropertyEditor() {
131: super (
132: null,
133: new EnumerationValue[] {
134: new EnumerationValue("", null, "null"),
135: new EnumerationValue(
136: "Default",
137: RenderingHints.VALUE_ALPHA_INTERPOLATION_DEFAULT,
138: "RenderingHints.VALUE_ALPHA_INTERPOLATION_DEFAULT"),
139: new EnumerationValue(
140: "Quality",
141: RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY,
142: "RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY"),
143: new EnumerationValue(
144: "Speed",
145: RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED,
146: "RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED") });
147: }
148: }
149:
150: public static final class AntialiasingPropertyEditor extends
151: EnumerationValuePropertyEditor {
152: public AntialiasingPropertyEditor() {
153: super (null, new EnumerationValue[] {
154: new EnumerationValue("", null, "null"),
155: new EnumerationValue("Default",
156: RenderingHints.VALUE_ANTIALIAS_DEFAULT,
157: "RenderingHints.VALUE_ANTIALIAS_DEFAULT"),
158: new EnumerationValue("On",
159: RenderingHints.VALUE_ANTIALIAS_ON,
160: "RenderingHints.VALUE_ANTIALIAS_ON"),
161: new EnumerationValue("Off",
162: RenderingHints.VALUE_ANTIALIAS_OFF,
163: "RenderingHints.VALUE_ANTIALIAS_OFF") });
164: }
165: }
166:
167: public static final class ColorRenderingPropertyEditor extends
168: EnumerationValuePropertyEditor {
169: public ColorRenderingPropertyEditor() {
170: super (
171: null,
172: new EnumerationValue[] {
173: new EnumerationValue("", null, "null"),
174: new EnumerationValue(
175: "Default",
176: RenderingHints.VALUE_COLOR_RENDER_DEFAULT,
177: "RenderingHints.VALUE_COLOR_RENDER_DEFAULT"),
178: new EnumerationValue(
179: "Quality",
180: RenderingHints.VALUE_COLOR_RENDER_QUALITY,
181: "RenderingHints.VALUE_COLOR_RENDER_QUALITY"),
182: new EnumerationValue(
183: "Speed",
184: RenderingHints.VALUE_COLOR_RENDER_SPEED,
185: "RenderingHints.VALUE_COLOR_RENDER_SPEED") });
186: }
187: }
188:
189: public static final class DitheringPropertyEditor extends
190: EnumerationValuePropertyEditor {
191: public DitheringPropertyEditor() {
192: super (null, new EnumerationValue[] {
193: new EnumerationValue("", null, "null"),
194: new EnumerationValue("Default",
195: RenderingHints.VALUE_DITHER_DEFAULT,
196: "RenderingHints.VALUE_DITHER_DEFAULT"),
197: new EnumerationValue("Enable",
198: RenderingHints.VALUE_DITHER_ENABLE,
199: "RenderingHints.VALUE_DITHER_ENABLE"),
200: new EnumerationValue("Disable",
201: RenderingHints.VALUE_DITHER_DISABLE,
202: "RenderingHints.VALUE_DITHER_DISABLE") });
203: }
204: }
205:
206: public static final class FractionalMetricsPropertyEditor extends
207: EnumerationValuePropertyEditor {
208: public FractionalMetricsPropertyEditor() {
209: super (
210: null,
211: new EnumerationValue[] {
212: new EnumerationValue("", null, "null"),
213: new EnumerationValue(
214: "Default",
215: RenderingHints.VALUE_FRACTIONALMETRICS_DEFAULT,
216: "RenderingHints.VALUE_FRACTIONALMETRICS_DEFAULT"),
217: new EnumerationValue(
218: "On",
219: RenderingHints.VALUE_FRACTIONALMETRICS_ON,
220: "RenderingHints.VALUE_FRACTIONALMETRICS_ON"),
221: new EnumerationValue(
222: "Off",
223: RenderingHints.VALUE_FRACTIONALMETRICS_OFF,
224: "RenderingHints.VALUE_FRACTIONALMETRICS_OFF") });
225: }
226: }
227:
228: public static final class InterpolationPropertyEditor extends
229: EnumerationValuePropertyEditor {
230: public InterpolationPropertyEditor() {
231: super (
232: null,
233: new EnumerationValue[] {
234: new EnumerationValue("", null, "null"),
235: new EnumerationValue(
236: "Bicubic",
237: RenderingHints.VALUE_INTERPOLATION_BICUBIC,
238: "RenderingHints.VALUE_INTERPOLATION_BICUBIC"),
239: new EnumerationValue(
240: "Bilinear",
241: RenderingHints.VALUE_INTERPOLATION_BILINEAR,
242: "RenderingHints.VALUE_INTERPOLATION_BILINEAR"),
243: new EnumerationValue(
244: "Nearest Neighbor",
245: RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR,
246: "RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR") });
247: }
248: }
249:
250: public static final class RenderingPropertyEditor extends
251: EnumerationValuePropertyEditor {
252: public RenderingPropertyEditor() {
253: super (null, new EnumerationValue[] {
254: new EnumerationValue("", null, "null"),
255: new EnumerationValue("Default",
256: RenderingHints.VALUE_RENDER_DEFAULT,
257: "RenderingHints.VALUE_RENDER_DEFAULT"),
258: new EnumerationValue("Quality",
259: RenderingHints.VALUE_RENDER_QUALITY,
260: "RenderingHints.VALUE_RENDER_QUALITY"),
261: new EnumerationValue("Speed",
262: RenderingHints.VALUE_RENDER_SPEED,
263: "RenderingHints.VALUE_RENDER_SPEED") });
264: }
265: }
266:
267: public static final class StrokeControlPropertyEditor extends
268: EnumerationValuePropertyEditor {
269: public StrokeControlPropertyEditor() {
270: super (null, new EnumerationValue[] {
271: new EnumerationValue("", null, "null"),
272: new EnumerationValue("Default",
273: RenderingHints.VALUE_STROKE_DEFAULT,
274: "RenderingHints.VALUE_STROKE_DEFAULT"),
275: new EnumerationValue("Normalize",
276: RenderingHints.VALUE_STROKE_NORMALIZE,
277: "RenderingHints.VALUE_STROKE_NORMALIZE"),
278: new EnumerationValue("Pure",
279: RenderingHints.VALUE_STROKE_PURE,
280: "RenderingHints.VALUE_STROKE_PURE") });
281: }
282: }
283:
284: public static final class TextAntialiasingPropertyEditor extends
285: EnumerationValuePropertyEditor {
286: public TextAntialiasingPropertyEditor() {
287: super (
288: null,
289: new EnumerationValue[] {
290: new EnumerationValue("", null, "null"),
291: new EnumerationValue(
292: "Default",
293: RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT,
294: "RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT"),
295: new EnumerationValue(
296: "On",
297: RenderingHints.VALUE_TEXT_ANTIALIAS_ON,
298: "RenderingHints.VALUE_TEXT_ANTIALIAS_ON"),
299: new EnumerationValue(
300: "Off",
301: RenderingHints.VALUE_TEXT_ANTIALIAS_OFF,
302: "RenderingHints.VALUE_TEXT_ANTIALIAS_OFF") });
303: }
304: }
305: }
|