01: package com.xoetrope.svgscanner.wizard;
02:
03: import net.xoetrope.swing.XEdit;
04: import net.xoetrope.swing.XList;
05: import net.xoetrope.swing.XRadioButton;
06:
07: import net.xoetrope.optional.annotation.Find;
08:
09: import com.xoetrope.swing.wizard.XWizard;
10:
11: /**
12: * An implementation class for the specific details of the binding wizard's new
13: * binding key setup
14: *
15: * <p> Copyright (c) Xoetrope Ltd., 2001-2007, This software is licensed under
16: * the GNU Public License (GPL), please see license.txt for more details. If
17: * you make commercial use of this software you must purchase a commercial
18: * license from Xoetrope.</p>
19: * <p>$Revision: 1.7 $</p>
20: */
21:
22: public class BindingWizardKeys extends BindingWizardPage {
23: @Find
24: private XList keyList;
25:
26: @Find
27: private XEdit bindingNameEdit;
28:
29: @Find
30: private XRadioButton existingRb;
31:
32: /**
33: * Creates a new instance of BindingWizardKeys
34: */
35: public BindingWizardKeys() {
36: }
37:
38: public boolean canAdvance() {
39: return ((keyList.getSelectedIndex() >= 0) || (!existingRb
40: .isSelected() && (bindingNameEdit.getText().trim()
41: .length() > 0)));
42: }
43:
44: public void useExisting() {
45: keyList.setEnabled(true);
46: bindingNameEdit.setEnabled(false);
47: }
48:
49: public void useNew() {
50: keyList.setEnabled(false);
51: bindingNameEdit.setEnabled(true);
52: }
53:
54: public void saveSettings() {
55: /** @todo use data bindings for the properties */
56: if (!existingRb.isSelected()) {
57: wizard.setProperty("NewBindingKey", "true");
58: wizard.setProperty("BindingKey", bindingNameEdit.getText());
59: } else
60: wizard.setProperty("BindingKey", keyList
61: .getSelectedObject().toString());
62: }
63: }
|