1 19 20 package org.netbeans.modules.form; 21 22 import java.beans.*; 23 24 48 49 public interface FormPropertyContext { 50 51 public boolean useMultipleEditors(); 52 53 public void initPropertyEditor(PropertyEditor prEd); 54 55 public FormModel getFormModel(); 56 57 61 public static abstract class DefaultSupport implements FormPropertyContext { 62 63 public boolean useMultipleEditors() { 64 FormModel formModel = getFormModel(); 65 return formModel != null; 66 } 67 68 public void initPropertyEditor(PropertyEditor prEd) { 69 FormModel formModel = getFormModel(); 70 71 if (formModel != null && prEd instanceof FormAwareEditor) 72 ((FormAwareEditor)prEd).setFormModel(formModel); 73 } 74 } 75 76 77 public static class DefaultImpl extends DefaultSupport { 78 79 FormModel formModel; 80 81 public DefaultImpl(FormModel form) { 82 formModel = form; 83 } 84 85 public FormModel getFormModel() { 86 return formModel; 87 } 88 } 89 90 91 public static class EmptyImpl implements FormPropertyContext { 92 93 public boolean useMultipleEditors() { 94 return false; 95 } 96 97 public void initPropertyEditor(PropertyEditor prEd) { 98 } 99 100 public FormModel getFormModel() { 101 return null; 102 } 103 104 106 public static EmptyImpl getInstance() { 107 if (theInstance == null) 108 theInstance = new EmptyImpl(); 109 return theInstance; 110 } 111 112 static private EmptyImpl theInstance = null; 113 } 114 } 115 | Popular Tags |