Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    FormItemCriterionGetter and FormItemCriterionSetter

    Hi Isomorphic,

    I have a strange problems with FormItemCriterionGetter and FormItemCriterionSetter.
    Please take a look at this test case.
    I put breakpoint on every line which start with "SC.logWarn()". No breakpoint is hit.

    v11.1p_2018-12-03/PowerEdition Deployment (built 2018-12-03)
    Code:
    package com.smartgwt.sample.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.Version;
    import com.smartgwt.client.core.KeyIdentifier;
    import com.smartgwt.client.data.AdvancedCriteria;
    import com.smartgwt.client.data.Criterion;
    import com.smartgwt.client.data.SortSpecifier;
    import com.smartgwt.client.types.OperatorId;
    import com.smartgwt.client.types.SortDirection;
    import com.smartgwt.client.types.TextMatchStyle;
    import com.smartgwt.client.util.Page;
    import com.smartgwt.client.util.PageKeyHandler;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.Window;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.form.DynamicForm;
    import com.smartgwt.client.widgets.form.FormItemCriterionGetter;
    import com.smartgwt.client.widgets.form.FormItemCriterionSetter;
    import com.smartgwt.client.widgets.form.fields.FormItem;
    import com.smartgwt.client.widgets.form.fields.TextItem;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    public class BuiltInDS extends VLayout implements EntryPoint {
        private IButton recreateBtn;
    
        public void onModuleLoad() {
            KeyIdentifier debugKey = new KeyIdentifier();
            debugKey.setCtrlKey(true);
            debugKey.setKeyName("D");
    
            Page.registerKey(debugKey, new PageKeyHandler() {
                public void execute(String keyName) {
                    SC.showConsole();
                }
            });
    
            setWidth100();
            setHeight100();
    
            recreateBtn = new IButton("Recreate");
            recreateBtn.addClickHandler(new ClickHandler() {
                @Override
                public void onClick(ClickEvent event) {
                    new MyWindow().show();
                }
            });
            addMember(recreateBtn);
            new MyWindow().show();
            draw();
        }
    
        private class MyWindow extends Window {
            public MyWindow() {
                setWidth(600);
                setHeight(300);
                setMembersMargin(0);
                setModalMaskOpacity(70);
                setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")");
                setShowMinimizeButton(false);
                setIsModal(true);
                setShowModalMask(true);
                centerInPage();
    
                final ListGrid lg = new ListGrid() {
                    {
                        setShowFilterEditor(true);
                        setDataSource("animals");
    
                        ListGridField commonNameLGF = new ListGridField("commonName");
                        commonNameLGF.setCanFilter(false);
                        ListGridField informationLGF = new ListGridField("information");
                        informationLGF.setCanFilter(true);
                        informationLGF.setFilterEditorProperties(new TextItem("information") {
                            {
                                setCriterionGetter(new FormItemCriterionGetter() {
                                    @Override
                                    public Criterion getCriterion(DynamicForm form, FormItem item, TextMatchStyle textMatchStyle) {
                                        SC.logWarn("getCriterion 1 never called!");
                                        return this.getCriterion(form, item);
                                    }
    
                                    @Override
                                    public Criterion getCriterion(DynamicForm form, FormItem item) {
                                        SC.logWarn("getCriterion 2 never called!");
                                        Object obj = form.getValue("information");
                                        if (obj == null) {
                                            return null;
                                        } else {
                                            String value = String.valueOf(obj);
                                            String[] s = value.split(" ");
                                            AdvancedCriteria finalCriteria = new AdvancedCriteria(OperatorId.AND);
                                            for (int i = 0; i < s.length; i++) {
                                                finalCriteria.addCriteria(new Criterion("information", OperatorId.ICONTAINS, s[i]));
                                            }
                                            return finalCriteria;
                                        }
                                    }
                                });
    
                                setCriterionSetter(new FormItemCriterionSetter() {
                                    @Override
                                    public void setCriterion(DynamicForm form, FormItem item, Criterion criterion) {
                                        SC.logWarn("setCriterion never called!");
                                    }
                                });
    
                            }
    
                            @Override
                            public Boolean hasAdvancedCriteria() {
                                SC.logWarn("hasAdvancedCriteria never called!");
                                return true;
                            }
                        });
    
                        setFields(commonNameLGF, informationLGF);
                        setInitialSort(new SortSpecifier("commonName", SortDirection.ASCENDING));
                        fetchData();
                    }
    
                };
                addItem(lg);
            }
        }
    }
    This topic is probably related to my problem Bug: CriteriaEditing broken?

    Best regards
    Pavo
    Last edited by pavo123; 8 Jan 2019, 02:51.

    #2
    You’re expecting a constructor to be called on the properties object you supplied. It doesn’t work that way, it’s just properties. Configure it without trying to use a constructor and it will work.

    Note there’s a central discussion of how properties objects work in the docs.

    Comment


      #3
      I really don't know how should I do that. How to configure it without trying to use a constructor? Can you please give me some example?

      Strange thing is that in my app, "setCriterionGetter" works as excpected (configured in the same way as in this test case) and "setCriterionSetter" is never called.
      So I tried to reproduce that problem but stuck with this problem above. Little confuzing for me.
      Last edited by pavo123; 8 Jan 2019, 06:07.

      Comment


        #4
        ??

        You are creating an instance of TextItem. Simply call the methods on it.

        Comment


          #5
          Hi Isomorphic,

          did you mean in this way? Nothing changes.

          Code:
                      final ListGrid lg = new ListGrid() {
                          {
                              setShowFilterEditor(true);
                              setDataSource("animals");
          
                              ListGridField commonNameLGF = new ListGridField("commonName");
                              ListGridField informationLGF = new ListGridField("information");
                              TextItem ti = new TextItem();
                              ti.setCriterionGetter(new FormItemCriterionGetter() {
          
                                  @Override
                                  public Criterion getCriterion(DynamicForm form, FormItem item, TextMatchStyle textMatchStyle) {
                                      SC.logWarn("Never called!");
                                      return null;
                                  }
          
                                  @Override
                                  public Criterion getCriterion(DynamicForm form, FormItem item) {
                                      SC.logWarn("Never called!");
                                      return null;
                                  }
                              });
                              ti.setCriterionSetter(new FormItemCriterionSetter() {
                                  @Override
                                  public void setCriterion(DynamicForm form, FormItem item, Criterion criterion) {
                                      SC.logWarn("Never called!");
          
                                  }
                              });
          
                              informationLGF.setFilterEditorProperties(ti);
                              setFields(commonNameLGF, informationLGF);
                              setInitialSort(new SortSpecifier("commonName", SortDirection.ASCENDING));
                              fetchData();
                          }
          
                      };
          Best regards
          Pavo

          Comment


            #6
            This code doesn’t set any criteria, so one would not expected the setter to be called yet. The getter would be called after the user types something and triggers filtering.

            Comment


              #7
              Hi Isomorphic,

              in my test case, the getter is not called after the user types something and triggers filtering.

              v11.1p_2019-01-08/PowerEdition Deployment (built 2019-01-08)

              Code:
              package com.smartgwt.sample.client;
              
              import com.google.gwt.core.client.EntryPoint;
              import com.google.gwt.core.client.GWT;
              import com.smartgwt.client.Version;
              import com.smartgwt.client.bean.BeanFactory;
              import com.smartgwt.client.core.KeyIdentifier;
              import com.smartgwt.client.data.AdvancedCriteria;
              import com.smartgwt.client.data.Criterion;
              import com.smartgwt.client.data.SortSpecifier;
              import com.smartgwt.client.types.OperatorId;
              import com.smartgwt.client.types.SortDirection;
              import com.smartgwt.client.types.TextMatchStyle;
              import com.smartgwt.client.util.Page;
              import com.smartgwt.client.util.PageKeyHandler;
              import com.smartgwt.client.util.SC;
              import com.smartgwt.client.widgets.IButton;
              import com.smartgwt.client.widgets.Window;
              import com.smartgwt.client.widgets.events.ClickEvent;
              import com.smartgwt.client.widgets.events.ClickHandler;
              import com.smartgwt.client.widgets.form.DynamicForm;
              import com.smartgwt.client.widgets.form.FormItemCriterionGetter;
              import com.smartgwt.client.widgets.form.FormItemCriterionSetter;
              import com.smartgwt.client.widgets.form.fields.FormItem;
              import com.smartgwt.client.widgets.form.fields.TextItem;
              import com.smartgwt.client.widgets.grid.ListGrid;
              import com.smartgwt.client.widgets.grid.ListGridField;
              import com.smartgwt.client.widgets.layout.VLayout;
              
              public class BuiltInDS extends VLayout implements EntryPoint {
                  private IButton recreateBtn;
              
                  public void onModuleLoad() {
                      GWT.create(BeanFactory.FormItemMetaFactory.class);
              
                      KeyIdentifier debugKey = new KeyIdentifier();
                      debugKey.setCtrlKey(true);
                      debugKey.setKeyName("D");
              
                      Page.registerKey(debugKey, new PageKeyHandler() {
                          public void execute(String keyName) {
                              SC.showConsole();
                          }
                      });
              
                      setWidth100();
                      setHeight100();
              
                      recreateBtn = new IButton("Recreate");
                      recreateBtn.addClickHandler(new ClickHandler() {
                          @Override
                          public void onClick(ClickEvent event) {
                              new MyWindow().show();
                          }
                      });
                      addMember(recreateBtn);
                      new MyWindow().show();
                      draw();
                  }
              
                  private class MyWindow extends Window {
                      public MyWindow() {
                          setWidth(600);
                          setHeight(300);
                          setMembersMargin(0);
                          setModalMaskOpacity(70);
                          setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")");
                          setShowMinimizeButton(false);
                          setIsModal(true);
                          setShowModalMask(true);
                          centerInPage();
              
                          final ListGrid lg = new ListGrid() {
                              {
                                  setShowFilterEditor(true);
                                  setDataSource("animals");
              
                                  ListGridField commonNameLGF = new ListGridField("commonName");
                                  ListGridField informationLGF = new ListGridField("information");
                                  TextItem ti = new TextItem();
                                  ti.setCriterionGetter(new FormItemCriterionGetter() {
              
                                      @Override
                                      public Criterion getCriterion(DynamicForm form, FormItem item, TextMatchStyle textMatchStyle) {
                                          SC.logWarn("Never called!");
              
                                          return this.getCriterion(form, item);
                                      }
              
                                      @Override
                                      public Criterion getCriterion(DynamicForm form, FormItem item) {
                                          SC.logWarn("Never called!");
              
                                          AdvancedCriteria finalCriteria = new AdvancedCriteria(OperatorId.AND);
                                          finalCriteria.addCriteria(new Criterion("information", OperatorId.ICONTAINS, "is"));
                                          finalCriteria.addCriteria(new Criterion("information", OperatorId.ICONTAINS, "now"));
                                          return finalCriteria;
                                      }
                                  });
                                  ti.setCriterionSetter(new FormItemCriterionSetter() {
                                      @Override
                                      public void setCriterion(DynamicForm form, FormItem item, Criterion criterion) {
                                          SC.logWarn("Never called!");
              
                                      }
                                  });
              
                                  informationLGF.setFilterEditorProperties(ti);
                                  setFields(commonNameLGF, informationLGF);
                                  setInitialSort(new SortSpecifier("commonName", SortDirection.ASCENDING));
                                  fetchData();
                              }
              
                          };
                          addItem(lg);
                      }
                  }
              }
              Best regards
              Pavo

              Comment


                #8
                The problem here is that getCriterion() is not called when the grid's criterion is simple.

                You can force the grid to produce AdvancedCriteria either by setting a filterOperator on the field, or by setting grid.allowFilterExpressions: true.

                We're looking at adding a new attribute to directly force a grid to produce AdvancedCriteria and will update here as and when we have more information.

                Comment


                  #9
                  By way of a followup on this issue - our problem description was correct and the solutions offered would be expected to work, but it turns out that there was indeed a bug here.

                  Some JSNI logic intended to ensure that a custom getCriterion() implementation always runs was misbehaving - we've fixed that for builds dated January 16 and later.

                  We've also added ListGrid (and FormItem) .useAdvancedCriteria to enforce advancedCriteria in all cases, meaning filterItem.getCriterion() will always run (whether you customized it or not).

                  Comment


                    #10
                    Hi Isomorphic,

                    "filterItem.getCriterion()" is now called as expected, great!
                    But in my opinion, "setter" is not called as expected.

                    Click image for larger version  Name:	setter.gif Views:	1 Size:	168.0 KB ID:	256546

                    If I enter in filterItem: "easily in so", that whole string should be displayed.
                    Now only one criteria is displayed, and when I deleted it, then the second criterion is displayed. Then when I delete second criterion, third is displayed. Then I need to delete third criterion to have "filter without criteria" so that I can see all data.

                    So probably this job should be done in "setCriterionSetter". In this test case "setCriterionSetter" is never called.

                    v12.0p_2019-01-17/PowerEdition Deployment
                    Code:
                    package com.smartgwt.sample.client;
                    
                    import com.google.gwt.core.client.EntryPoint;
                    import com.google.gwt.core.client.GWT;
                    import com.smartgwt.client.Version;
                    import com.smartgwt.client.bean.BeanFactory;
                    import com.smartgwt.client.core.KeyIdentifier;
                    import com.smartgwt.client.data.AdvancedCriteria;
                    import com.smartgwt.client.data.Criterion;
                    import com.smartgwt.client.data.SortSpecifier;
                    import com.smartgwt.client.types.OperatorId;
                    import com.smartgwt.client.types.SortDirection;
                    import com.smartgwt.client.types.TextMatchStyle;
                    import com.smartgwt.client.util.Page;
                    import com.smartgwt.client.util.PageKeyHandler;
                    import com.smartgwt.client.util.SC;
                    import com.smartgwt.client.widgets.IButton;
                    import com.smartgwt.client.widgets.Window;
                    import com.smartgwt.client.widgets.events.ClickEvent;
                    import com.smartgwt.client.widgets.events.ClickHandler;
                    import com.smartgwt.client.widgets.form.DynamicForm;
                    import com.smartgwt.client.widgets.form.FormItemCriterionGetter;
                    import com.smartgwt.client.widgets.form.FormItemCriterionSetter;
                    import com.smartgwt.client.widgets.form.fields.FormItem;
                    import com.smartgwt.client.widgets.form.fields.TextItem;
                    import com.smartgwt.client.widgets.grid.ListGrid;
                    import com.smartgwt.client.widgets.grid.ListGridField;
                    import com.smartgwt.client.widgets.layout.VLayout;
                    
                    public class BuiltInDS extends VLayout implements EntryPoint {
                        private IButton recreateBtn;
                    
                        public void onModuleLoad() {
                            GWT.create(BeanFactory.FormItemMetaFactory.class);
                    
                            KeyIdentifier debugKey = new KeyIdentifier();
                            debugKey.setCtrlKey(true);
                            debugKey.setKeyName("D");
                    
                            Page.registerKey(debugKey, new PageKeyHandler() {
                                public void execute(String keyName) {
                                    SC.showConsole();
                                }
                            });
                    
                            setWidth100();
                            setHeight100();
                    
                            recreateBtn = new IButton("Recreate");
                            recreateBtn.addClickHandler(new ClickHandler() {
                                @Override
                                public void onClick(ClickEvent event) {
                                    new MyWindow().show();
                                }
                            });
                            addMember(recreateBtn);
                            new MyWindow().show();
                            draw();
                        }
                    
                        private class MyWindow extends Window {
                            public MyWindow() {
                                setWidth(600);
                                setHeight(300);
                                setMembersMargin(0);
                                setModalMaskOpacity(70);
                                setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")");
                                setShowMinimizeButton(false);
                                setIsModal(true);
                                setShowModalMask(true);
                                centerInPage();
                    
                                final ListGrid lg = new ListGrid() {
                                    {
                                        setShowFilterEditor(true);
                                        setDataSource("animals");
                    
                                        ListGridField commonNameLGF = new ListGridField("commonName");
                                        ListGridField informationLGF = new ListGridField("information");
                                        TextItem ti = new TextItem();
                                        ti.setCriterionGetter(new FormItemCriterionGetter() {
                    
                                            @Override
                                            public Criterion getCriterion(DynamicForm form, FormItem item, TextMatchStyle textMatchStyle) {
                                                return this.getCriterion(form, item);
                                            }
                    
                                            @Override
                                            public Criterion getCriterion(DynamicForm form, FormItem item) {
                                                Object obj = form.getValue("information");
                                                if (obj == null) {
                                                    return null;
                                                } else {
                                                    String value = String.valueOf(obj);
                                                    String[] s = value.split(" ");
                                                    AdvancedCriteria finalCriteria = new AdvancedCriteria(OperatorId.AND);
                                                    for (int i = 0; i < s.length; i++) {
                                                        finalCriteria.addCriteria(new Criterion("information", OperatorId.ICONTAINS, s[i]));
                                                    }
                                                    return finalCriteria;
                                                }
                                            }
                                        });
                                        ti.setCriterionSetter(new FormItemCriterionSetter() {
                                            @Override
                                            public void setCriterion(DynamicForm form, FormItem item, Criterion criterion) {
                                                SC.logWarn("Never called!");
                                            }
                                        });
                    
                                        informationLGF.setFilterEditorProperties(ti);
                                        setFields(commonNameLGF, informationLGF);
                                        setInitialSort(new SortSpecifier("commonName", SortDirection.ASCENDING));
                                        fetchData();
                                    }
                    
                                };
                                addItem(lg);
                            }
                        }
                    }
                    Best regards
                    Pavo
                    Last edited by pavo123; 18 Jan 2019, 02:14.

                    Comment


                      #11
                      This is a different issue - internal ListGrid code clobbers setCriterion() in this case - we'll fix it for tomorrow's builds.

                      Comment


                        #12
                        Okay, thank you very much. :)

                        Comment


                          #13
                          This issue affected overrides of both setCriterion() and canEditCriterion() - both have been fixed for builds dated January 21 and later.

                          You'll need to have your setCriterion() implementation build a space-separated string of each criteria value in criterion.getCriteria(), and pass that to item.setValue(). You may also need to install a FormItemCanEditCriterionPredicate that always returns true.
                          Last edited by Isomorphic; 20 Jan 2019, 05:07.

                          Comment


                            #14
                            Hi Isomorphic,

                            thanks for the tip. Now it works perfectly!

                            Best regards
                            Pavo

                            Comment


                              #15
                              Hi Isomorphic,

                              Unfortunately I have a new problem. When I use a filter for only one field, and modify the criteria for it, it works great!
                              But I have to use a filter and modify criteria for more fields.

                              Problem is: display the filter value for each field.

                              Click image for larger version  Name:	filter_test.gif Views:	1 Size:	83.1 KB ID:	256586

                              Code:
                                          setCriterionSetter(new FormItemCriterionSetter() {
                                              @Override
                                              public void setCriterion(DynamicForm form, FormItem item, Criterion criterion) {
                              
                                                  form.getField("commonName").setValue("commonName" + "-1");
                                                  form.getField("information").setValue("information" + "-1");
                              
                                                  form.getItem("commonName").setValue("commonName" + "-2");
                                                  form.getItem("information").setValue("information" + "-2");
                              
                                                  form.setValue("commonName", "commonName" + "-3");
                                                  form.setValue("information", "information" + "-3");
                              
                                                  item.setAttribute("commonName", "commonName" + "-4");
                                                  item.setAttribute("information", "information" + "-4");
                              
                                              }
                                          });
                              I must somehow set the filter's value for both fields: "commonName" and "information".
                              Inside "setter", the "item" is always the first field ("commonName") and can only set the value for it.

                              Whole code:
                              Code:
                              package com.smartgwt.sample.client;
                              
                              import com.google.gwt.core.client.EntryPoint;
                              import com.google.gwt.core.client.GWT;
                              import com.smartgwt.client.Version;
                              import com.smartgwt.client.bean.BeanFactory;
                              import com.smartgwt.client.core.KeyIdentifier;
                              import com.smartgwt.client.data.AdvancedCriteria;
                              import com.smartgwt.client.data.Criterion;
                              import com.smartgwt.client.data.SortSpecifier;
                              import com.smartgwt.client.types.OperatorId;
                              import com.smartgwt.client.types.SortDirection;
                              import com.smartgwt.client.types.TextMatchStyle;
                              import com.smartgwt.client.util.Page;
                              import com.smartgwt.client.util.PageKeyHandler;
                              import com.smartgwt.client.util.SC;
                              import com.smartgwt.client.widgets.IButton;
                              import com.smartgwt.client.widgets.Window;
                              import com.smartgwt.client.widgets.events.ClickEvent;
                              import com.smartgwt.client.widgets.events.ClickHandler;
                              import com.smartgwt.client.widgets.form.DynamicForm;
                              import com.smartgwt.client.widgets.form.FormItemCanEditCriterionPredicate;
                              import com.smartgwt.client.widgets.form.FormItemCriterionGetter;
                              import com.smartgwt.client.widgets.form.FormItemCriterionSetter;
                              import com.smartgwt.client.widgets.form.fields.FormItem;
                              import com.smartgwt.client.widgets.form.fields.TextItem;
                              import com.smartgwt.client.widgets.grid.ListGrid;
                              import com.smartgwt.client.widgets.grid.ListGridField;
                              import com.smartgwt.client.widgets.layout.VLayout;
                              
                              public class BuiltInDS extends VLayout implements EntryPoint {
                                  private IButton recreateBtn;
                              
                                  public void onModuleLoad() {
                                      GWT.create(BeanFactory.FormItemMetaFactory.class);
                              
                                      KeyIdentifier debugKey = new KeyIdentifier();
                                      debugKey.setCtrlKey(true);
                                      debugKey.setKeyName("D");
                              
                                      Page.registerKey(debugKey, new PageKeyHandler() {
                                          public void execute(String keyName) {
                                              SC.showConsole();
                                          }
                                      });
                              
                                      setWidth100();
                                      setHeight100();
                              
                                      recreateBtn = new IButton("Recreate");
                                      recreateBtn.addClickHandler(new ClickHandler() {
                                          @Override
                                          public void onClick(ClickEvent event) {
                                              new MyWindow().show();
                                          }
                                      });
                                      addMember(recreateBtn);
                                      new MyWindow().show();
                                      draw();
                                  }
                              
                                  private class MyWindow extends Window {
                                      public MyWindow() {
                                          setWidth(600);
                                          setHeight(300);
                                          setMembersMargin(0);
                                          setModalMaskOpacity(70);
                                          setTitle(" (" + Version.getVersion() + "/" + Version.getSCVersionNumber() + ")");
                                          setShowMinimizeButton(false);
                                          setIsModal(true);
                                          setShowModalMask(true);
                                          centerInPage();
                              
                                          final ListGrid lg = new ListGrid() {
                                              {
                                                  setShowFilterEditor(true);
                                                  setDataSource("animals");
                              
                                                  ListGridField commonNameLGF = new ListGridField("commonName");
                                                  commonNameLGF.setFilterEditorProperties(new FilterTextItem("information"));
                                                  ListGridField informationLGF = new ListGridField("information");
                                                  informationLGF.setFilterEditorProperties(new FilterTextItem("information"));
                              
                                                  setFields(commonNameLGF, informationLGF);
                                                  setInitialSort(new SortSpecifier("commonName", SortDirection.ASCENDING));
                                                  fetchData();
                                              }
                              
                                          };
                                          addItem(lg);
                                      }
                                  }
                              
                                  private class FilterTextItem extends TextItem {
                                      public FilterTextItem(final String name) {
                                          super(name);
                              
                                          setCriterionGetter(new FormItemCriterionGetter() {
                                              @Override
                                              public Criterion getCriterion(DynamicForm form, FormItem item, TextMatchStyle textMatchStyle) {
                                                  return this.getCriterion(form, item);
                                              }
                              
                                              @Override
                                              public Criterion getCriterion(DynamicForm form, FormItem item) {
                                                  Object obj = form.getValue(name);
                                                  if (obj == null) {
                                                      return null;
                                                  } else {
                                                      String value = String.valueOf(obj);
                                                      String[] s = value.split(" ");
                                                      AdvancedCriteria finalCriteria = new AdvancedCriteria(OperatorId.AND);
                                                      for (int i = 0; i < s.length; i++) {
                                                          finalCriteria.addCriteria(new Criterion(name, OperatorId.ICONTAINS, s[i]));
                                                      }
                                                      return finalCriteria;
                                                  }
                                              }
                                          });
                                          setCriterionSetter(new FormItemCriterionSetter() {
                                              @Override
                                              public void setCriterion(DynamicForm form, FormItem item, Criterion criterion) {
                              
                                                  form.getField("commonName").setValue("commonName" + "-1");
                                                  form.getField("information").setValue("information" + "-1");
                              
                                                  form.getItem("commonName").setValue("commonName" + "-2");
                                                  form.getItem("information").setValue("information" + "-2");
                              
                                                  form.setValue("commonName", "commonName" + "-3");
                                                  form.setValue("information", "information" + "-3");
                              
                                                  item.setAttribute("commonName", "commonName" + "-4");
                                                  item.setAttribute("information", "information" + "-4");
                              
                                              }
                                          });
                                          setCanEditCriterionPredicate(new FormItemCanEditCriterionPredicate() {
                                              @Override
                                              public boolean canEditCriterion(DynamicForm form, FormItem item, Criterion criterion) {
                                                  return true;
                                              }
                                          });
                              
                                      }
                                  }
                              }
                              Best regards
                              Pavo
                              Last edited by pavo123; 23 Jan 2019, 08:27.

                              Comment

                              Working...
                              X