Examples of CTabFolderElement


Examples of com.onpositive.commons.elements.CTabFolderElement

        ComboEnumeratedValueSelector<Boolean> t = new ComboEnumeratedValueSelector<Boolean>();
        t.setBinding(binding);
        editor.add(t);
      } else if (type == Text.class) {
        if (text == null) {
          text = new CTabFolderElement();
          text.setBordered(true);
          editor.setData("text", text);
          editor.add(text);
        }
        createText(editor, text, binding, false);
      } else if (type == Link.class) {
        createLink(editor, binding);
      } else if (type == Category.class) {
        createCategory(editor, binding);
      } else if (type == Email.class) {
        createEmail(editor, binding);
      } else if (type == PostalAddress.class) {
        createPostalAddress(editor, binding);
      } else if (type == PhoneNumber.class) {
        createPhoneNumber(editor, binding);
      } else if (type == Date.class) {
        createDate(editor, binding);
      } else if (type == IMHandle.class) {
        createIMHandle(editor, binding);
      } else if (type == GeoPt.class) {
        createGeoPt(editor, binding);
      } else if (type == User.class) {
        createUser(editor, binding);
      } else if (type == Blob.class || type == ShortBlob.class) {
        createBlob(editor, type, binding, project);
      } else if (type == Rating.class) {
        createRating(editor, binding);
      } else if (type == Key.class) {
        OneLineTextElement<String> t = new OneLineTextElement<String>();
        t.setBinding(binding);
        editor.add(t);
        // GAEField ff = f.new GAEField(chId, false);
        // createKey(editor, binding, ff);
      } else {
        if (!binding.allowsMultiValues()) {
          OneLineTextElement<String> t = new OneLineTextElement<String>();
          t.setBinding(binding);
          binding.allowsMultiValues();
          binding.setReadOnly(true);
          editor.add(t);
        } else {
          if (text == null) {
            text = new CTabFolderElement();
            text.setBordered(true);
            editor.setData("text", text);
            editor.add(text);
          }
          Container m = new Container();
View Full Code Here

Examples of com.onpositive.commons.elements.CTabFolderElement

    Container text = (Container) editor.getData("text");
    for (final Field f : fields) {
      final GAEField fm = (GAEField) f;
      if (fm.multiplicity) {
        if (text == null) {
          text = new CTabFolderElement();
          text.setBordered(true);
          editor.setData("text", text);
          editor.add(text);
        }
        createMultiEdit(e, bnd, facade, text, f, fm);
        continue;
      }
      if (f.isKey()) {
        continue;
      } else {
        Class<?> type = f.getType();
        if (type != null) {
          final Binding binding = bnd.getBinding(f.name);
          binding.setValue(e.getProperty(f.name), null);
          Object adapter = new ClassAdapterFactory().getAdapter(type,
              IValidator.class);
          if (adapter != null) {
            binding.setAdapter(IValidator.class,
                (IValidator) adapter);
          }
          adapter = new ClassAdapterFactory().getAdapter(type,
              ILabelLookup.class);
          if (adapter != null) {
            binding.setAdapter(ILabelLookup.class,
                (ILabelLookup) adapter);
          }
          adapter = new ClassAdapterFactory().getAdapter(type,
              IRealmProvider.class);
          if (adapter != null) {

            binding.setAdapter(IRealmProvider.class,
                (IRealmProvider) adapter);
          } else {
            IRealm<?> c = facade.getRealm(f);
            if (c != null) {
              binding.setRealm(c);
            }
          }
          binding.setReadOnly(false);
          binding.setName(f.getTitle());

          if (type == String.class) {
            OneLineTextElement<String> t = new OneLineTextElement<String>();
            t.setBinding(binding);
            editor.add(t);
          } else if (Number.class.isAssignableFrom(type)) {
            OneLineTextElement<String> t = new OneLineTextElement<String>();
            t.setBinding(binding);
            editor.add(t);

          } else if (type == Boolean.class) {
            ComboEnumeratedValueSelector<Boolean> t = new ComboEnumeratedValueSelector<Boolean>();
            t.setBinding(binding);
            editor.add(t);
          } else if (type == Text.class) {
            if (text == null) {
              text = new CTabFolderElement();
              text.setBordered(true);
              editor.setData("text", text);
              editor.add(text);
            }
            createText(editor, text, binding, false);
View Full Code Here

Examples of com.onpositive.commons.elements.CTabFolderElement

    for (Field f : ownFields) {
      text = createAppropriateControl(e, editor, bnd, facade, text, f,
          needIndexable);
    }
    if (sorted.keySet().size() > 1) {
      Container ctab = new CTabFolderElement();
      ctab.setText("Embedded");
      ctab.setBordered(true);

      text = null;
      for (String group : sorted.keySet()) {
        if (group.equals(facade.getKind())) {
          continue;
        }
        CompositeEditor container = new CompositeEditor();
        container.setText(group);
        Collection<Field> fs = sorted.get(group);
        for (final Field f : fs) {
          text = createAppropriateControl(e, container, bnd, facade,
              text, f, needIndexable);
        }
        ctab.add(container);
      }
      editor.add(ctab);
    }
    if (text != null) {
      text.getLayoutHints().setHint(new Point(400, 200));
View Full Code Here

Examples of com.onpositive.commons.elements.CTabFolderElement

    final CompositeEditor ed = new CompositeEditor();
    ed.setLayout(new GridLayout());
    ed.setLayoutManager(new HorizontalLayouter());
    if (fm.multiplicity) {
      if (text == null) {
        text = new CTabFolderElement();
        text.setBordered(true);
        ed.setData("text", text);
        ed.add(text);
      }
      IBinding bb = createSpecialMultiEdit(e, bnd, facade, text, f, fm,
          needIndexable);
      // addButtonSelector(bb, ed,null);
      ed.setId(bnd.getId());
      editor.add(ed);
      return text;
    }
    if (f.isKey()) {
      return text;
    } else {
      final Class<?> type = f.getType();
      if (type != null) {
        final Binding binding = bnd.getBinding(f.name);
        binding.setValue(e.getProperty(f.name), null);
        Object adapter = new ClassAdapterFactory().getAdapter(type,
            IValidator.class);
        if (adapter != null) {
          binding.setAdapter(IValidator.class, (IValidator) adapter);
        }
        adapter = new ClassAdapterFactory().getAdapter(type,
            ILabelLookup.class);
        if (adapter != null) {
          binding.setAdapter(ILabelLookup.class,
              (ILabelLookup) adapter);
        }
        adapter = new ClassAdapterFactory().getAdapter(type,
            IRealmProvider.class);
        if (adapter != null) {

          binding.setAdapter(IRealmProvider.class,
              (IRealmProvider) adapter);
        } else {
          IRealm<?> c = facade.getRealm(f);
          if (c != null) {
            binding.setRealm(c);
          }
        }
        binding.setReadOnly(false);
        binding.setName(f.getTitle());

        if (type == String.class) {
          OneLineTextElement<String> t = new OneLineTextElement<String>();
          t.setBinding(binding);
          ed.add(t);

          addIsNullButtonSelector(binding, ed, null);
          if (needIndexable) {
            addNotIndexableButton(binding, ed, f);
          }
        } else if (Number.class.isAssignableFrom(type)
            || type.isPrimitive()) {
         
          binding.setSubjectClass(type);
          OneLineTextElement<Number> t = new OneLineTextElement<Number>();
          binding.addValidator(new ValidatorAdapter() {

            public CodeAndMessage isValid(IBinding context,
                Object object) {
              if (object == null) {
                return CodeAndMessage.OK_MESSAGE;
              }
              try {
                if (object instanceof String) {
                  if (type == Double.class) {
                    Double.parseDouble((String) object);
                  } else if (type == Long.class) {
                    Long.parseLong((String) object);
                  } else if (type == Float.class) {
                    Float.parseFloat((String) object);
                  } else if (type == Integer.class) {
                    Integer.parseInt((String) object);
                  }
                } else {
                  if (!Number.class.isAssignableFrom(object
                      .getClass())) {
                    return CodeAndMessage
                        .errorMessage("The number should be in this place");
                  }
                }
                return CodeAndMessage.OK_MESSAGE;
              } catch (NumberFormatException e) {
                return CodeAndMessage
                    .errorMessage("The number should be in this place");
              }
              // return super.isValid(context, object);
            }

          });
          t.setBinding(binding);
          ed.add(t);

          addIsNullButtonSelector(binding, ed, null);
          if (needIndexable) {
            addNotIndexableButton(binding, ed, f);
          }
        } else if (type == Boolean.class) {
          binding.setSubjectClass(type);
          ComboEnumeratedValueSelector<Boolean> t = new ComboEnumeratedValueSelector<Boolean>();
          t.setBinding(binding);
          ed.add(t);

          addIsNullButtonSelector(binding, ed, null);
          if (needIndexable) {
            addNotIndexableButton(binding, ed, f);
          }
        } else if (type == Text.class) {
          if (text == null) {
            text = new CTabFolderElement();
            text.setBordered(true);
            ed.setData("text", text);
            ed.add(text);
          }
          createText(ed, text, binding, true);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.