Package com.onpositive.commons.ui.appearance

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


      public void run() {
        final Binding bnd=new Binding(LogViewPart.this);
        bnd.setAutoCommit(false);
        bnd.setReadOnly(false);
        Container r=new Container();
        IContainerLayoutManager ca=new OneElementOnLineLayouter();
        OneLineTextElement<Integer>str=new OneLineTextElement<Integer>(bnd.getBinding("days"));
        ComboEnumeratedValueSelector<Integer>sev=new ComboEnumeratedValueSelector<Integer>();
        sev.setOrdered(true);
        sev.setBinding(bnd.getBinding("minSeverityToFetch"));
        r.add(str);
View Full Code Here


      final Binding bndr) {
    CompositeEditor r = new CompositeEditor(bndr);

    Container c = new Container(Container.GROUP);
    c.setCaption("Output format");
    c.setLayoutManager(new OneElementOnLineLayouter());
    c.add(new ButtonSelector(bndr.getBinding("asCsv"), SWT.RADIO));
    c.add(new ButtonSelector(bndr.getBinding("asXML"), SWT.RADIO));

    r.add(c);
    return r;
View Full Code Here

  private static CompositeEditor createOptionsPage(final Binding bndr) {
    CompositeEditor r = new CompositeEditor(bndr);
    Container c = new Container(Container.GROUP);
    c.setCaption("Output format");
    c.setLayoutManager(new OneElementOnLineLayouter());
    c.add(new ButtonSelector(bndr.getBinding("asCsv"), SWT.RADIO));
    c.add(new ButtonSelector(bndr.getBinding("asXML"), SWT.RADIO));
    c.add(new ButtonSelector(bndr.getBinding("asBinary"), SWT.RADIO));

    r.add(c);

    Container cm = new Container(Container.GROUP);
    cm.setCaption("Scope of import");
    cm.setLayoutManager(new OneElementOnLineLayouter());
    cm.add(new ButtonSelector(bndr.getBinding("allEntitiesOf"), SWT.RADIO));
    cm.add(new ButtonSelector(bndr.getBinding("selectedEntitiesOf"),
        SWT.RADIO));
    cm.add(new ButtonSelector(bndr.getBinding("entitiesOfSelectedKinds"),
        SWT.RADIO));
View Full Code Here

  private static CompositeEditor createOptionsPageForExport(final Binding bndr) {
    CompositeEditor r = new CompositeEditor(bndr);
    Container c = new Container(Container.GROUP);
    c.setCaption("Type of import");
    c.setLayoutManager(new OneElementOnLineLayouter());
    c.add(new ButtonSelector(bndr.getBinding("asCsv"), SWT.RADIO));
    c.add(new ButtonSelector(bndr.getBinding("asXML"), SWT.RADIO));
    c.add(new ButtonSelector(bndr.getBinding("asBinary"), SWT.RADIO));

    r.add(c);

    Container cm = new Container(Container.GROUP);
    cm.setCaption("Scope of export");
    cm.setLayoutManager(new OneElementOnLineLayouter());
    cm.add(new ButtonSelector(bndr.getBinding("multiExport"), SWT.CHECK));

    r.add(cm);

    return r;
View Full Code Here

  private static CompositeEditor createOptionsPageForBulkExport(
      final Binding bndr) {
    CompositeEditor r = new CompositeEditor(bndr);
    Container c = new Container(Container.GROUP);
    c.setCaption("Type of import");
    c.setLayoutManager(new OneElementOnLineLayouter());
    c.add(new ButtonSelector(bndr.getBinding("asCsv"), SWT.RADIO));
    c.add(new ButtonSelector(bndr.getBinding("asXML"), SWT.RADIO));

    r.add(c);
View Full Code Here

    bnd.setName("Namespace list");
    bnd.setDescription("Please choose namespace");

    CompositeEditor editor = new CompositeEditor(bnd);
    Container c1 = new Container();
    c1.setLayoutManager(new OneElementOnLineLayouter());
    Container c2 = new Container();
    Container all = new Container();

    GridData c1gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    c1gd.horizontalIndent = 0;
View Full Code Here

                id);

            // OneLineTextElement<String>nl=new
            // OneLineTextElement<String>(name);
            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));
View Full Code Here

  public static void createBindingsForType(Class parentType, Binding bnd,
      CompositeEditor editor, IJavaProject project) {
    java.lang.reflect.Field[] fs = parentType.getDeclaredFields();
    if (editor.getLayoutManager() == null) {
      editor.setLayoutManager(new OneElementOnLineLayouter());
    }

    Container text = (Container) editor.getData("text");

    for (java.lang.reflect.Field f : fs) {
View Full Code Here

    Container text = (Container) editor.getData("text");
    Map<String, Collection<Field>> sorted = sortFields(fields, facade);
    Collection<Field> ownFields = sorted.get(facade.getKind());
    if (editor.getLayoutManager() == null) {
      editor.setLayoutManager(new OneElementOnLineLayouter());
    }
    if (ownFields == null) {
      ownFields = new HashSet<Field>();
    }
    for (Field f : ownFields) {
View Full Code Here

            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");

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

TOP

Related Classes of com.onpositive.commons.ui.appearance.OneElementOnLineLayouter

Copyright © 2018 www.massapicom. 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.