01: package com.xoetrope.svgscanner.wizard;
02:
03: import com.xoetrope.svgscanner.model.SynthModel;
04: import com.xoetrope.swing.wizard.XWizard;
05: import net.xoetrope.xml.XmlElement;
06: import net.xoetrope.xui.XProject;
07: import net.xoetrope.xui.data.XBaseModel;
08: import net.xoetrope.xui.data.XModel;
09:
10: /**
11: *
12: * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
13: * the GNU Public License (GPL), please see license.txt for more details. If
14: * you make commercial use of this software you must purchase a commercial
15: * license from Xoetrope.</p>
16: * <p> $Revision: 1.2 $</p>
17: */
18: public class BindingWizard extends XWizard {
19: protected SynthModel synthModel;
20:
21: /**
22: * Creates a new instance of XWizard
23: * @param project the owner project
24: * @param pages an array of page names
25: * @param showHelp true to show help texts for each page
26: */
27: public BindingWizard(XProject project, String[] pages,
28: boolean showHelp) {
29: super (project, pages, showHelp);
30: synthModel = (SynthModel) ((XModel) rootModel.get("SynthModel"))
31: .get();
32: }
33:
34: /**
35: * The wizard is complete, do any post creation action now
36: */
37: public int processResources() {
38: boolean isNewStyle = "true".equals(settings.get("NewStyleKey")
39: .toString());
40: String styleName = settings.get("StyleName").toString();
41: String regionName = settings.get("BindingKey").toString();
42:
43: if (isNewStyle)
44: synthModel.addStyle(styleName);
45:
46: XmlElement bindingElement = synthModel.addBinding("region",
47: regionName, styleName);
48:
49: XBaseModel regions = (XBaseModel) rootModel.get("regions");
50: regions.set(regionName, regionName);
51:
52: return 0;
53: }
54: }
|