Examples of HorizontalLayouter


Examples of com.onpositive.commons.ui.appearance.HorizontalLayouter

        sev.setOrdered(true);
        sev.setBinding(bnd.getBinding("minSeverityToFetch"));
        r.add(str);
        r.add(sev);       
        Container buttons=new Container();       
        HorizontalLayouter horizontalLayouter = new HorizontalLayouter();
        buttons.setLayoutManager(horizontalLayouter);
        r.add(buttons);
        final InputElementDialog inputElementDialog = new InputElementDialog(bnd,r,"Settings","you may configure settings here");
        ButtonSelector bs=new ButtonSelector();
        bs.setValue(new Runnable() {
View Full Code Here

Examples of com.onpositive.commons.ui.appearance.HorizontalLayouter

    r.add(elementL);
    r.add(elementP);

    Container element2 = new Container(Container.GROUP);
    element2.getLayoutHints().setGrabHorizontal(true);
    element2.setLayoutManager(new HorizontalLayouter());
    element2.setText("Class Path");

    final ListEnumeratedValueSelector<String> classpath = new ListEnumeratedValueSelector<String>(
        bndr.getBinding("jdbcDriverClassPath")) {
View Full Code Here

Examples of com.onpositive.commons.ui.appearance.HorizontalLayouter

            CompositeEditor ed = new CompositeEditor(b);
            ed.setLayoutManager(new OneElementOnLineLayouter());
            ed.add(idel);
            // ed.add(nl);
            Container buttons = new Container();
            buttons.setLayoutManager(new HorizontalLayouter());
            ButtonSelector ba = new ButtonSelector();
            ba.setText("Ok");
            final InputElementDialog dlg = new InputElementDialog(
                ed);
            ba.setValue(new Runnable() {

              public void run() {
                String value = (String) id.getValue();
                Key k = null;
                Entity value2 = (Entity) editor.getBinding()
                    .getValue();
                Key c = (Key) value2.getKey();
                if (c != null && c.isComplete()) {
                  if (!value2.hasProperty("$$OLD_KEY_SET")) {
                    value2.setProperty("$$OLD_KEY_SET",
                        Boolean.TRUE);
                    value2.setProperty("$$OLD_KEY"
                        + Entity.KEY_RESERVED_PROPERTY,
                        c);
                  }
                }
                if (value != null && value.trim().length() != 0) {
                  String vl = value.trim();
                  try {
                    long l = Long.parseLong(vl);

                    k = KeyFactory.createKey(
                        value2.getKind(), l);
                  } catch (Exception e) {
                    k = KeyFactory.createKey(
                        ((Entity) editor.getBinding()
                            .getValue()).getKind(),
                        vl);
                  }
                } else {
                  return;
                }
                // value2.setProperty(Entity.KEY_RESERVED_PROPERTY,
                // k);
                try {
                  java.lang.reflect.Field f = value2
                      .getClass().getDeclaredField("key");
                  f.setAccessible(true);
                  f.set(value2, k);
                } catch (Exception e) {
                  Activator.log(e);
                }
                if (k != null) {
                  String string = "" + k.toString();
                  ((Binding) editor.getBinding())
                      .setName(string);
                  EditDialog.this.setTitle(string);
                  ;
                  dlg.close();
                }
              }
            });
            ButtonSelector ba1 = new ButtonSelector();
            ba1.setValue(new Runnable() {

              public void run() {
                dlg.close();
              }
            });
            ba1.setText("Cancel");
            buttons.add(ba);
            buttons.add(ba1);
            ed.add(buttons);
            DisposeBindingListener.linkBindingLifeCycle(b, ed);
            dlg.open();
            super.widgetSelected(e);
          }
        });
      }
      Link l1 = new Link(cm, SWT.NONE);
      l1.setText("<a>Add new property</a>");
      l1.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
          Binding b = new Binding("");
          b.setName("Configure new Property");
          final Binding binding = b.getBinding("name");
          binding.setName("Name");
          binding.setReadOnly(false);

          binding.addValidator(new ValidatorAdapter<String>() {

            public CodeAndMessage isValid(IBinding context,
                String object) {
              if (object == null || object.length() == 0) {
                return CodeAndMessage
                    .errorMessage("please define property name");
              }
              Binding b = (Binding) editor.getBinding();
              if (b.getKnownChilds().contains(object)) {
                return CodeAndMessage
                    .errorMessage("property with this name already exits");
              }
              return super.isValid(context, object);
            }
          });
          final Binding type = b.getBinding("type");
          final Binding kc = b.getBinding("keyKind");
          kc.setName("Kind:");
          kc.setValue(
              ((Entity) editor.getBinding().getValue()).getKind(),
              null);
          kc.setReadOnly(false);
          kc.setRequired(false);
          type.setName("Type");
          type.setReadOnly(false);
          type.setRequired(true);
          final OneLineTextElement<String> keyKind = new OneLineTextElement<String>(
              kc);
          type.setAdapter(ITextLabelProvider.class,
              new TextProviderAdapter() {

                public String getText(Object object) {
                  Class<?> c = (Class<?>) object;
                  return c.getSimpleName();
                }
              });
          type.setValue(String.class, null);
          type.setRealm(new Realm<Class<?>>(
              EditorUtility.SUPPORTED_TYPES));
          final Binding multi = b.getBinding("multi");
          multi.setReadOnly(false);
          multi.setName("Multivalue");
          type.setName("Type");
          multi.setValue(false, null);
          CompositeEditor z = new CompositeEditor(b);
          final Container m = new Container();
          m.setLayoutManager(new OneElementOnLineLayouter());
          OneLineTextElement<String> t = new OneLineTextElement<String>(
              binding);
          // t.setCaption("Name:");
          m.add(t);
          ComboEnumeratedValueSelector<Class<?>> element2 = new ComboEnumeratedValueSelector<Class<?>>(
              type);
          type.addValueListener(new IValueListener<Class<?>>() {

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

            }

          });
          ButtonSelector sl = new ButtonSelector(SWT.CHECK);
          sl.setBinding(multi);
          m.add(element2);
          m.add(sl);
          z.setLayoutManager(new OneElementOnLineLayouter());
          z.add(m);
          Container m1 = new Container();
          m1.setLayoutManager(new HorizontalLayouter());
          final InputElementDialog dl = new InputElementDialog(z);
          final ButtonSelector ok = new ButtonSelector();
          ok.setText("Ok");
          ok.setValue(new Runnable() {

            public void run() {
              String value = (String) binding.getValue();
              BaseDataFacade.GAEField gaeField = facade
                  .createField(value,
                      (Class<?>) type.getValue(),
                      (Boolean) (multi.getValue()),
                      (String) kc.getValue());
              EditingBinding binding2 = (EditingBinding) editor
                  .getBinding();
              binding2.removedElements.remove(value);
              binding2.fieldsChanged = true;
              binding2.getBinding(value).setValue(null, null);
              EditorUtility.createBindingsWithButton(
                  (Entity) binding2.getValue(), editor,
                  (Binding) binding2,
                  new Field[] { gaeField }, facade, true);
              dl.close();
              editor.getControl().getShell().layout(true, true);
              editor.getControl().getShell().pack(true);
            }
          });
          ok.setEnabled(false);
          b.addStatusChangeListener(new IStatusChangeListener() {

            public void statusChanged(IBinding bnd,
                CodeAndMessage cm) {
              ok.setEnabled(cm.getCode() == 0);

            }
          });
          ButtonSelector cancel = new ButtonSelector();
          cancel.setText("Cancel");
          m1.add(ok);
          m1.add(cancel);
          cancel.setValue(new Runnable() {

            public void run() {
              dl.close();
            }
          });
          m1.getLayoutHints().setGrabHorizontal(true);
          m1.getLayoutHints().setAlignmentHorizontal(SWT.RIGHT);
          z.add(m1);
          DisposeBindingListener.linkBindingLifeCycle(b, z);
          dl.open();
        }

        public void widgetDefaultSelected(SelectionEvent e) {

        }
      });
      Link l2 = new Link(cm, SWT.NONE);
      l2.setText("<a>Remove property</a>");
      l2.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
          Binding bnd2 = new Binding("");
          bnd2.setName("Select property to remove");
          CompositeEditor ed = new CompositeEditor(bnd2);
          ed.setLayoutManager(new OneElementOnLineLayouter());
          final ListEnumeratedValueSelector<String> element2 = new ListEnumeratedValueSelector<String>();
          ed.add(element2);
          final Binding bnd = (Binding) editor.getBinding();
          Collection<String> str = bnd.getKnownChilds();
          element2.setRealm(new Realm<String>(str));
          element2.setValue(str);
          element2.getLayoutHints().setHint(new Point(200, 300));
          final InputElementDialog em = new InputElementDialog(ed);

          DisposeBindingListener.linkBindingLifeCycle(bnd2, ed);
          Container b = new Container();
          b.setLayoutManager(new HorizontalLayouter());
          final ButtonSelector ok = new ButtonSelector();
          ok.setText("Ok");
          ok.setEnabled(false);
          element2.addSelectionChangedListener(new ISelectionChangedListener() {
View Full Code Here

Examples of com.onpositive.commons.ui.appearance.HorizontalLayouter

      final BaseDataFacade facade, Container text, final Field f,
      final boolean needIndexable) {
    final GAEField fm = (GAEField) f;
    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);

          // addIsNullButtonSelector(binding, ed, null);
          if (needIndexable) {
            addNotIndexableButton(binding, ed, f);
          }
        } else if (type == Link.class) {
          createLink(ed, binding);

          addIsNullButtonSelector(binding, ed, null);
          if (needIndexable) {
            addNotIndexableButton(binding, ed, f);
          }
        } else if (type == Category.class) {
          createCategory(ed, binding);

          addIsNullButtonSelector(binding, ed, null);
          if (needIndexable) {
            addNotIndexableButton(binding, ed, f);
          }
        } else if (type == Email.class) {
          createEmail(ed, binding);

          addIsNullButtonSelector(binding, ed, null);
          if (needIndexable) {
            addNotIndexableButton(binding, ed, f);
          }
        } else if (type == PostalAddress.class) {
          createPostalAddress(ed, binding);

          addIsNullButtonSelector(binding, ed, null);
          if (needIndexable) {
            addNotIndexableButton(binding, ed, f);
          }
        } else if (type == PhoneNumber.class) {
          createPhoneNumber(ed, binding);

          addIsNullButtonSelector(binding, ed, null);
          if (needIndexable) {
            addNotIndexableButton(binding, ed, f);
          }
        } else if (type == Date.class) {
          createDate(ed, binding);

          addIsNullButtonSelector(binding, ed, null);
          if (needIndexable) {
            addNotIndexableButton(binding, ed, f);
          }
        } else if (type == IMHandle.class) {
          createIMHandle(ed, binding);

          addIsNullButtonSelector(binding, ed, null);
          if (needIndexable) {
            addNotIndexableButton(binding, ed, f);
          }
        } else if (type == GeoPt.class) {
          createGeoPt(ed, binding);

          addIsNullButtonSelector(binding, ed, null);
          if (needIndexable) {
            addNotIndexableButton(binding, ed, f);
          }
        } else if (type == User.class) {
          createUser(ed, binding);

          addIsNullButtonSelector(binding, ed, null);
          if (needIndexable) {
            addNotIndexableButton(binding, ed, f);
          }
        } else if (type == Blob.class || type == ShortBlob.class) {
          createBlob(ed, type, binding, facade.getProject());

          addIsNullButtonSelector(binding, ed, null);
          if (needIndexable) {
            addNotIndexableButton(binding, ed, f);
          }
        } else if (type == Rating.class) {
          createRating(ed, binding);

          addIsNullButtonSelector(binding, ed, null);
          if (needIndexable) {
            addNotIndexableButton(binding, ed, f);
          }
        } else if (type == Key.class) {
          createKey(ed, binding, f);

          addIsNullButtonSelector(binding, ed, null);
          if (needIndexable) {
            addNotIndexableButton(binding, ed, f);
          }
        }
        // editor.setId(binding.getId());
      } else {
        final Binding binding = bnd.getBinding(f.name);
        final Container txt = text;

        binding.setReadOnly(false);
        binding.setName(f.getTitle());

        final LinkElement bs = new LinkElement();
        bs.setId(binding.getId());
        ed.setId(binding.getId());
        bs.getLayoutHints().setGrabVertical(false);
        bs.setText("Specify type");
        bs.setCaption(f.getTitle());
        bs.addHyperLinkListener(new IHyperlinkListener() {

          public void linkExited(HyperlinkEvent e) {
            // TODO Auto-generated method stub

          }

          public void linkEntered(HyperlinkEvent e) {
            return;

          }

          public void linkActivated(HyperlinkEvent event) {
            final Binding tmpBinding = new Binding("");
            tmpBinding.setName("Specify type for property");

            final Binding type = tmpBinding.getBinding("type");
            type.setReadOnly(false);
            type.setRequired(true);
            type.setName("Select type");
            type.setAdapter(ITextLabelProvider.class,
                new TextProviderAdapter() {

                  public String getText(Object object) {
                    Class<?> c = (Class<?>) object;
                    return c.getSimpleName();
                  }
                });
            type.setValue(String.class, null);
            type.setRealm(new Realm<Class<?>>(
                EditorUtility.SUPPORTED_TYPES));

            final ComboEnumeratedValueSelector ce = new ComboEnumeratedValueSelector(
                type);

            final CompositeEditor c1 = new CompositeEditor();
            c1.setLayoutManager(new OneElementOnLineLayouter());
            c1.add(ce);

            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");
View Full Code Here

Examples of com.onpositive.commons.ui.appearance.HorizontalLayouter

            } else {
              Object firstElement = null;
              Binding bnd = new Binding(firstElement);
              bnd.setName("Edit");
              CompositeEditor m = new CompositeEditor(bnd);
              m.setLayoutManager(new HorizontalLayouter());
              TitledDialog dlg = new TitledDialog(m);
              GAEField singleField = fm.getSingleField();
              ApiProxy.setEnvironmentForCurrentThread(new FakeEnvironment(
                  e.getAppId()));
              Entity c = new Entity("A");
View Full Code Here

Examples of com.onpositive.commons.ui.appearance.HorizontalLayouter

                  kind);
              pe.add(keyKind);
              bb.add(pe);

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

              ButtonSelector ok = new ButtonSelector();
              ok.setText("submit");
              ok.setValue(new Runnable() {
View Full Code Here

Examples of com.onpositive.commons.ui.appearance.HorizontalLayouter

  private static void createUser(CompositeEditor editor, final Binding binding) {
    CompositeEditor tr = new CompositeEditor(binding, Container.GROUP);

    tr.setCaption(binding.getName());
    tr.setLayoutManager(new HorizontalLayouter());

    tr.setLayoutManager(new HorizontalLayouter());
    if (binding.getValue() == null) {
      binding.setValue(new User("", "", ""), null);// setValueSilent
    }
    binding.addBindingChangeListener(new IBindingChangeListener<Object>() {
View Full Code Here

Examples of com.onpositive.commons.ui.appearance.HorizontalLayouter

  private static void createGeoPt(CompositeEditor editor,
      final Binding binding) {
    CompositeEditor tr = new CompositeEditor(binding, Container.GROUP);

    tr.setCaption(binding.getName());
    tr.setLayoutManager(new HorizontalLayouter());
    if (binding.getValue() == null) {
      binding.setValue(new GeoPt(0f, 0f), null); // Silent
    }

    binding.addBindingChangeListener(new IBindingChangeListener<Object>() {
View Full Code Here

Examples of com.onpositive.commons.ui.appearance.HorizontalLayouter

  private static void createIMHandle(CompositeEditor editor,
      final Binding binding) {
    CompositeEditor tr = new CompositeEditor(binding, Container.GROUP);

    tr.setCaption(binding.getName());
    tr.setLayoutManager(new HorizontalLayouter());
    final Binding binding2 = binding.getBinding("Address");
    final Binding binding3 = binding.getBinding("Protocol");
    IBindingChangeListener<Object> l = new IBindingChangeListener<Object>() {

      public void changed() {
View Full Code Here

Examples of org.openbp.cockpit.modeler.figures.layouter.HorizontalLayouter

   * Creates the layouter for this tag.
   * By default, this is a {@link HorizontalLayouter}
   */
  protected void initTagLayouter()
  {
    layouter = new HorizontalLayouter(this);
  }
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.