01: package com.xoetrope.svgscanner.model;
02:
03: import net.xoetrope.swing.XCheckbox;
04: import net.xoetrope.swing.XComboBox;
05: import net.xoetrope.swing.XEdit;
06: import net.xoetrope.xml.XmlElement;
07: import net.xoetrope.xui.XPage;
08:
09: /**
10: *
11: * <p> Copyright (c) Xoetrope Ltd., 2001-2007, This software is licensed under
12: * the GNU Public License (GPL), please see license.txt for more details. If
13: * you make commercial use of this software you must purchase a commercial
14: * license from Xoetrope.</p>
15: * <p>$Revision: 1.7 $</p>
16: */
17: public class ImagePainterElementHandler extends SynthElementHandler {
18:
19: /** Creates a new instance of ImagePainterElementHandler */
20: public ImagePainterElementHandler() {
21: }
22:
23: public String getName(XmlElement e) {
24: String name = "imagePainter";
25: String attr;
26: if ((attr = e.getAttribute("id")) != null)
27: name += "(" + attr + ")";
28:
29: return name;
30: }
31:
32: /**
33: * Update the panel showing details of this type of element
34: * @param page the page with the UI for this component
35: */
36: public void updateUI(XPage page) {
37: XEdit idEdit = (XEdit) page.findComponent("imagePainterIdEdit");
38: String value = objectElement.getAttribute("id");
39: idEdit.setText(value);
40:
41: XEdit methodEdit = (XEdit) page
42: .findComponent("imagePainterMethodEdit");
43: value = objectElement.getAttribute("method");
44: methodEdit.setText(value);
45:
46: XComboBox directionCombo = (XComboBox) page
47: .findComponent("imagePainterDirectionCombo");
48: value = objectElement.getAttribute("direction");
49: directionCombo.setSelectedItem(value);
50:
51: XEdit pathEdit = (XEdit) page
52: .findComponent("imagePainterPathEdit");
53: value = objectElement.getAttribute("path");
54: pathEdit.setText(value);
55:
56: XEdit srcInsetsEdit = (XEdit) page
57: .findComponent("imagePainterSourceInsetsEdit");
58: value = objectElement.getAttribute("sourceInsets");
59: srcInsetsEdit.setText(value);
60:
61: XEdit destInsetsEdit = (XEdit) page
62: .findComponent("imagePainterDestInsetsEdit");
63: value = objectElement.getAttribute("destinationInsets");
64: destInsetsEdit.setText(value);
65:
66: XCheckbox cbCenter = (XCheckbox) page
67: .findComponent("imagePainterCenterCheck");
68: value = objectElement.getAttribute("paintCenter");
69: cbCenter.setSelected("true".equals(value));
70:
71: XCheckbox cbStretch = (XCheckbox) page
72: .findComponent("imagePainterStretchCheck");
73: value = objectElement.getAttribute("stretch");
74: cbStretch.setSelected("true".equals(value));
75: }
76: }
|