Exemplo n.º 1
0
 @Override
 public void generateParameterCode(
     DesignComponent component, MultiGuardedSection section, int index) {
   PropertyValue value = component.readProperty(PROP_CONSTRAINTS);
   if (value.getKind() == PropertyValue.Kind.VALUE) {
     int constraint = MidpTypes.getInteger(value);
     int core = constraint & TextFieldCD.VALUE_CONSTRAINT_MASK;
     CodeWriter writer = section.getWriter();
     switch (core) {
       case TextFieldCD.VALUE_ANY:
         writer.write("TextField.ANY"); // NOI18N
         break;
       case TextFieldCD.VALUE_EMAILADDR:
         writer.write("TextField.EMAILADDR"); // NOI18N
         break;
       case TextFieldCD.VALUE_NUMERIC:
         writer.write("TextField.NUMERIC"); // NOI18N
         break;
       case TextFieldCD.VALUE_PHONENUMBER:
         writer.write("TextField.PHONENUMBER"); // NOI18N
         break;
       case TextFieldCD.VALUE_URL:
         writer.write("TextField.URL"); // NOI18N
         break;
       case TextFieldCD.VALUE_DECIMAL:
         writer.write("TextField.DECIMAL"); // NOI18N
         break;
       default:
         writer.write(Integer.toString(core));
     }
     if ((constraint & TextFieldCD.VALUE_PASSWORD) != 0) {
       writer.write(" | TextField.PASSWORD"); // NOI18N
     }
     if ((constraint & TextFieldCD.VALUE_UNEDITABLE) != 0) {
       writer.write(" | TextField.UNEDITABLE"); // NOI18N
     }
     if ((constraint & TextFieldCD.VALUE_SENSITIVE) != 0) {
       writer.write(" | TextField.SENSITIVE"); // NOI18N
     }
     if ((constraint & TextFieldCD.VALUE_NON_PREDICTIVE) != 0) {
       writer.write(" | TextField.NON_PREDICTIVE"); // NOI18N
     }
     if ((constraint & TextFieldCD.VALUE_INITIAL_CAPS_WORD) != 0) {
       writer.write(" | TextField.INITIAL_CAPS_WORD"); // NOI18N
     }
     if ((constraint & TextFieldCD.VALUE_INITIAL_CAPS_SENTENCE) != 0) {
       writer.write(" | TextField.INITIAL_CAPS_SENTENCE"); // NOI18N
     }
     return;
   }
   super.generateParameterCode(component, section, index);
 }