Package org.springframework.rules.closure.support

Examples of org.springframework.rules.closure.support.Block


    public void setEnabled(final boolean enabled) {
        if (this.groupEnabledState != null && this.groupEnabledState.booleanValue() == enabled) {
            return;
        }
        Algorithms.instance().forEach(guardedGroup, new Block() {
            protected void handle(Object guarded) {
                ((Guarded)guarded).setEnabled(enabled);
            }
        });
        this.groupEnabledState = Boolean.valueOf(enabled);
View Full Code Here


   * @param constraints
   *            the list of constraints to add
   * @return A reference to this, to support chaining.
   */
  public CompoundConstraint addAll(List constraints) {
    Algorithms.instance().forEach(constraints, new Block() {
      protected void handle(Object o) {
        add((Constraint)o);
      }
    });
    return this;
View Full Code Here

      return true;
    }

    public void testSimpleProperty() {
        vm = pas.getPropertyValueModel("simpleProperty");
        Block setValueDirectly = new Block() {
           public void handle(Object newValue) {
                testBean.setSimpleProperty((String)newValue);
            }
        };
        Closure getValueDirectly = new Closure() {
View Full Code Here

    public void testNestedProperty() {
        final TestBean nestedProperty = new TestBean();
        testBean.setNestedProperty(nestedProperty);
        vm = pas.getPropertyValueModel("nestedProperty.simpleProperty");
        Block setValueDirectly = new Block() {
            public void handle(Object newValue) {
                nestedProperty.setSimpleProperty((String)newValue);
            }
        };
        Closure getValueDirectly = new Closure() {
View Full Code Here

        vm = cpas.getPropertyValueModel("simpleProperty");
        assertEquals("Child should return the same ValueModel as parent",
                pas.getPropertyValueModel("nestedProperty.simpleProperty"), vm);

        Block setValueDirectly = new Block() {
            public void handle(Object newValue) {
                nestedProperty.setSimpleProperty((String)newValue);
            }
        };
        Closure getValueDirectly = new Closure() {
View Full Code Here

    public void testMapProperty() {
        final Map map = new HashMap();
        testBean.setMapProperty(map);
        vm = pas.getPropertyValueModel("mapProperty[.key]");
        Block setValueDirectly = new Block() {
            public void handle(Object newValue) {
                map.put(".key", newValue);
            }
        };
        Closure getValueDirectly = new Closure() {
View Full Code Here

        final List list = new ArrayList();
        list.add(null);
        testBean.setListProperty(list);
        vm = pas.getPropertyValueModel("listProperty[0]");

        Block setValueDirectly = new Block() {
            public void handle(Object newValue) {
                list.set(0, newValue);
            }
        };
        Closure getValueDirectly = new Closure() {
View Full Code Here

            selectionDialog = filterDialog;
        } else {
            selectionDialog = new ListSelectionDialog("", null, eventList);
        }

        selectionDialog.setOnAboutToShow(new Block() {
            protected void handle(Object ignore) {
                itemRefresher.synchronize();
            }
        });
View Full Code Here

    }

    public BeanValidationResults collectResults(Rules rules) {
        Assert.notNull(rules, "rules is required");
        setResultsBuilder(new BeanValidationResultsBuilder(bean));
        new Block() {
            protected void handle(Object beanPropertyConstraint) {
                collectPropertyResultsInternal((PropertyConstraint)beanPropertyConstraint);
            }
        }.forEach(rules.iterator());
        return getBeanResultsBuilder();
View Full Code Here

    ElementGenerator finder = template.findAll(new Constraint() {
      public boolean test(Object o) {
        return ((String)o).startsWith("Item 4");
      }
    });
    finder.run(new Block() {
      protected void handle(Object o) {
        assertEquals("Item 4", o);
      }
    });
    finder = template.findAll(new Constraint() {
      public boolean test(Object o) {
        return ((String)o).startsWith("Element");
      }
    });
    finder.run(new Block() {
      protected void handle(Object o) {
        fail("Should not be called");
      }
    });
  }
View Full Code Here

TOP

Related Classes of org.springframework.rules.closure.support.Block

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.