1 19 20 package org.netbeans.modules.projectimport.j2seimport.ui; 21 22 import javax.swing.JPanel ; 23 import org.openide.WizardDescriptor; 24 import org.openide.util.NbBundle; 25 26 29 public abstract class BasicVisualPanel extends JPanel { 30 31 private WizardDescriptor settings; 32 33 protected BasicVisualPanel(final WizardDescriptor setting) { 34 this.settings = setting; 35 } 36 37 public final WizardDescriptor getSettings() { 38 return settings; 39 } 40 41 44 protected final void setError(String message) { 45 if (message == null) { 46 throw new NullPointerException (); 47 } 48 setMessage(message); 49 setValid(false); 50 } 51 52 55 protected final void setWarning(String message) { 56 if (message == null) { 57 throw new NullPointerException (); 58 } 59 setMessage(message); 60 setValid(true); 61 } 62 63 67 protected final void markInvalid() { 68 setMessage(null); 69 setValid(false); 70 } 71 72 75 protected final void markValid() { 76 setMessage(null); 77 setValid(true); 78 } 79 80 private final void setMessage(String message) { 81 settings.putProperty("WizardPanel_errorMessage", message); } 83 84 88 private final void setValid(boolean valid) { 89 firePropertyChange("valid", null, Boolean.valueOf(valid)); } 91 } 92 | Popular Tags |