1 19 20 package org.netbeans.modules.junit.wizards; 21 22 import java.awt.Component ; 23 import javax.swing.Box ; 24 import javax.swing.BoxLayout ; 25 import javax.swing.JCheckBox ; 26 import javax.swing.JComponent ; 27 import javax.swing.event.ChangeListener ; 28 import org.netbeans.modules.junit.GuiUtils; 29 import org.netbeans.modules.junit.SelfResizingPanel; 30 import org.openide.WizardDescriptor; 31 import org.openide.loaders.TemplateWizard; 32 import org.openide.util.HelpCtx; 33 import org.openide.util.NbBundle; 34 35 39 class EmptyTestStepLocation implements WizardDescriptor.Panel { 40 41 private Component visualComp; 42 private JCheckBox chkSetUp; 43 private JCheckBox chkTearDown; 44 private JCheckBox chkCodeHints; 45 46 EmptyTestStepLocation() { 47 super(); 48 visualComp = createVisualComp(); 49 } 50 51 private Component createVisualComp() { 52 JCheckBox [] chkBoxes; 53 54 JComponent optCode = GuiUtils.createChkBoxGroup( 55 NbBundle.getMessage( 56 GuiUtils.class, 57 "JUnitCfgOfCreate.groupOptCode"), chkBoxes = GuiUtils.createCheckBoxes(new String [] { 59 GuiUtils.CHK_SETUP, 60 GuiUtils.CHK_TEARDOWN})); 61 chkSetUp = chkBoxes[0]; 62 chkTearDown = chkBoxes[1]; 63 64 JComponent optComments = GuiUtils.createChkBoxGroup( 65 NbBundle.getMessage( 66 GuiUtils.class, 67 "JUnitCfgOfCreate.groupOptComments"), chkBoxes = GuiUtils.createCheckBoxes(new String [] { 69 GuiUtils.CHK_HINTS})); 70 chkCodeHints = chkBoxes[0]; 71 72 JComponent box = new SelfResizingPanel(); 73 box.setLayout(new BoxLayout (box, BoxLayout.Y_AXIS)); 74 box.add(optCode); 75 box.add(Box.createVerticalStrut(11)); 76 box.add(optComments); 77 78 79 optCode.setAlignmentX(0.0f); 80 optComments.setAlignmentX(0.0f); 81 82 return box; 83 } 84 85 public void addChangeListener(ChangeListener l) { 86 } 88 89 public void removeChangeListener(ChangeListener l) { 90 } 92 93 public Component getComponent() { 94 return visualComp; 95 } 96 97 public HelpCtx getHelp() { 98 return null; 100 } 101 102 public boolean isValid() { 103 return true; 104 } 105 106 public void readSettings(Object settings) { 107 TemplateWizard wizard = (TemplateWizard) settings; 108 109 chkSetUp.setSelected( 110 Boolean.TRUE.equals(wizard.getProperty(GuiUtils.CHK_SETUP))); 111 chkTearDown.setSelected( 112 Boolean.TRUE.equals(wizard.getProperty(GuiUtils.CHK_TEARDOWN))); 113 chkCodeHints.setSelected( 114 Boolean.TRUE.equals(wizard.getProperty(GuiUtils.CHK_HINTS))); 115 } 116 117 public void storeSettings(Object settings) { 118 TemplateWizard wizard = (TemplateWizard) settings; 119 120 wizard.putProperty(GuiUtils.CHK_SETUP, 121 Boolean.valueOf(chkSetUp.isSelected())); 122 wizard.putProperty(GuiUtils.CHK_TEARDOWN, 123 Boolean.valueOf(chkTearDown.isSelected())); 124 wizard.putProperty(GuiUtils.CHK_HINTS, 125 Boolean.valueOf(chkCodeHints.isSelected())); 126 } 127 128 } 129 | Popular Tags |