Ejemplo n.º 1
0
 public List<PropertyDescriptor> getDeclaredPropertyDescriptors() {
   return Arrays.asList(
       new PropertyDescriptor(
           PROP_TEXT,
           MidpTypes.TYPEID_JAVA_LANG_STRING,
           PropertyValue.createNull(),
           true,
           true,
           MidpVersionable.MIDP),
       new PropertyDescriptor(
           PROP_MAX_SIZE,
           MidpTypes.TYPEID_INT,
           PropertyValue.createNull(),
           false,
           true,
           MidpVersionable.MIDP),
       new PropertyDescriptor(
           PROP_CONSTRAINTS,
           MidpTypes.TYPEID_INT,
           PropertyValue.createNull(),
           false,
           true,
           MidpVersionable.MIDP),
       new PropertyDescriptor(
           PROP_INITIAL_INPUT_MODE,
           MidpTypes.TYPEID_JAVA_LANG_STRING,
           PropertyValue.createNull(),
           true,
           true,
           MidpVersionable.MIDP_2));
 }
Ejemplo n.º 2
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);
 }