Examples of ButtonSelector


Examples of com.onpositive.semantic.model.ui.property.editors.ButtonSelector

            final Binding multi = tmpBinding.getBinding("multi");
            multi.setReadOnly(false);
            multi.setName("Multivalue");
            multi.setValue(false, null);

            ButtonSelector multiB = new ButtonSelector(multi,
                SWT.CHECK);
            c1.add(multiB);

            final Binding kk = tmpBinding.getBinding("KeyKind");
            kk.setName("Kind");
            kk.setValue(e.getKind(), null);
            kk.setReadOnly(false);
            kk.setRequired(false);

            final OneLineTextElement<String> keyKind = new OneLineTextElement<String>(
                kk);

            type.addValueListener(new IValueListener<Class<?>>() {

              public void valueChanged(Class<?> oldValue,
                  Class<?> newValue) {
                if (newValue == Key.class) {
                  c1.add(1, keyKind);
                  c1.getControl().getShell().pack(true);
                } else if (oldValue == Key.class) {
                  c1.remove(keyKind);
                  c1.getControl().getShell().pack(true);
                }

              }

            });

            CompositeEditor c2 = new CompositeEditor();
            c2.setLayoutManager(new HorizontalLayouter());
            ButtonSelector ok = new ButtonSelector();
            ok.setText("submit");
            ButtonSelector canc = new ButtonSelector();
            canc.setText("cancel");

            c2.add(ok);
            c2.add(canc);

            CompositeEditor finall = new CompositeEditor(tmpBinding);
            finall.setLayoutManager(new OneElementOnLineLayouter());
            finall.add(c1);
            finall.add(c2);

            final InputElementDialog ied = new InputElementDialog(
                finall);

            ok.setValue(new Runnable() {

              public void run() {
                IStructuredSelection iss = ce.getSelection();
                if (!iss.isEmpty()) {
                  Object fe = iss.getFirstElement();
                  Class choosen = (Class) fe;
                  ied.close();
                  ed.getParent().remove(ed);// remove(bs);

                  // ed.setLayoutManager(new
                  // HorizontalLayouter());
                  // ed.setBordered(true);
                  f.setType(choosen);
                  Object val = multi.getValue();
                  Object kind = kk.getValue();
                  if (val != null && f instanceof GAEField) {
                    ((GAEField) f).multiplicity = (Boolean) val;
                  }
                  if (kind != null) {
                    ((GAEField) f)
                        .setKeyKind((String) kind);
                  }
                  createAppropriateControl(e, editor,
                      binding, facade, txt, f,
                      needIndexable);
                  // ed.recreate();

                  editor.getControl().getShell()
                      .layout(true, true);
                  editor.getControl().getShell().pack(true);

                  // tmpBinding.dispose();
                  return;
                }
              }
            });

            canc.setValue(new Runnable() {

              public void run() {
                tmpBinding.dispose();
                ied.close();
              }
View Full Code Here

Examples of com.onpositive.semantic.model.ui.property.editors.ButtonSelector

              bb.add(pe);

              CompositeEditor buttons = new CompositeEditor();
              buttons.setLayoutManager(new HorizontalLayouter());

              ButtonSelector ok = new ButtonSelector();
              ok.setText("submit");
              ok.setValue(new Runnable() {

                public void run() {
                  kinds[0] = (String) kind.getValue();
                  dlg.close();
                }
View Full Code Here

Examples of com.onpositive.semantic.model.ui.property.editors.ButtonSelector

    void update(Entity e);
  }

  private static void addIsNullButtonSelector(final IBinding bnd,
      Container editor, String rId) {
    ButtonSelector bs = new ButtonSelector(SWT.CHECK);
    bs.setText("is null");
    bs.addListener(SWT.Selection, new SWTEventListener() {

      public void handleEvent(AbstractUIElement element, Event event) {
        Binding b = (Binding) bnd;
        boolean readOnly = b.isReadOnly();
        b.setReadOnly(!readOnly);
        if (b instanceof EditingBinding) {
          ((EditingBinding) b).setResetToNull(!readOnly);
        }
        return;
      }
    });

    if (bnd instanceof EditingBinding) {
      EditingBinding ebd = (EditingBinding) bnd;
      Entity e = ebd.getE();
      String id = bnd.getId();
      if (e.hasProperty(id) && e.getProperty(id) == null) {
        Binding b = (Binding) bnd;
        ebd.setResetToNull(true);
        b.setReadOnly(true);
        bs.setValue(true);
      }
    }

    String ids = bnd.getId();
    if (rId != null) {
View Full Code Here

Examples of com.onpositive.semantic.model.ui.property.editors.ButtonSelector

    if (fType == Blob.class || fType == Text.class) {
      return;
    }

    ButtonSelector bsNotIndexable = new ButtonSelector(SWT.CHECK);
    bsNotIndexable.setText("not indexed");
    bsNotIndexable.addListener(SWT.Selection, new SWTEventListener() {

      public void handleEvent(AbstractUIElement element, Event event) {
        Binding b = (Binding) bnd;
        if (b instanceof EditingBinding) {
          boolean flg = ((EditingBinding) b).isNotIndexable();
          ((EditingBinding) b).setNotIndexable(!flg);
        }
        return;
      }
    });
    if (bnd instanceof EditingBinding) {
      EditingBinding ebd = (EditingBinding) bnd;
      Entity e = ebd.getE();
      String id = bnd.getId();
      if (e.isUnindexedProperty(id)) {
        if (bnd instanceof EditingBinding) {
          ((EditingBinding) bnd).setNotIndexable(true);
        }
        bsNotIndexable.setValue(true);
      }
    }
    editor.add(bsNotIndexable);
  }
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.