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