Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To attach created validator method to model xml file see see 'model custom validators' section section.

If you need some sample code see Custom validator example in  in Examples section

Anchor
modelHooks
modelHooks

...

To attach created model hook method to model xml file see see 'custom model event hooks' section section.

If you need some sample code see Model hook example in  in Examples section

Anchor
viewHooks
viewHooks

...

To attach created view hook method to view xml file see see 'view hooks' section section.

If you need some sample code see View hook example in  in Examples section.

Anchor
viewListeners
viewListeners

...

To attach created view listener method to view xml file see see 'view listeners' section section.

If you need some sample code see View listener example in  in Examples section.

Anchor
rowStyleResolvers
rowStyleResolvers

...

(Grid's) Row style resolvers returns set of CSS clas names for given row entity. You can use them to mark specified grid rows, e.g. whith negative balance of some arbitrary values. 
Resolver method is invoked for each of row entity.

...

To see how to bind created resolver method with view component go to 'row style resolvers' section in 'Hook an Listeners' section.

If you need some sample code see Row style resolver example in Examples section in Examples section.

Anchor
criteriaModifier
criteriaModifier

2.6. Criteria modifier

(Grid's) Criteria modifier allow you to modify state of the SearchCriteriaBuilder used by component to fetch row entities.

Code Block
themeEclipse
languagejava
linenumberstrue
public void criteriamodifierName(final SearchCriteriaBuilder searchCriteriaBuilder) {

        // CRITERIA MODIFIER BODY

}

Where

  • criteriaModifierName - arbitrary name of modifier method
  • searchCriteriaBuilder - criteria builder used by component

To see how to bind modifier method with view component go to 'criteria modifiers' in 'Hook an Listeners' section.

If you need some sample code see Criteria modifier example in Examples section.

Anchor
examples
examples

3. Examples

...

Code Block
themeEclipse
languagejava
linenumberstrue
    public Set<String> productsListRowStyleResolver(final Entity product) {
        final Set<String> entityStyles = Sets.newHashSet();
        final String materialType = product.getStringField(ProductFields.GLOBAL_TYPE_OF_MATERIAL);

        if ("04waste".equals(materialType)) {
            entityStyles.add(RowStyle.RED_BACKGROUND);
        }

        if (StringUtils.isBlank(product.getStringField(ProductFields.EAN))) {
            entityStyles.add(RowStyle.BOLD_FONT);
        }
        return entityStyles;
    }

Anchor
criteriaModifierExample
criteriaModifierExample

3.5 Criteria modifier example

Code Block
themeEclipse
languagejava
linenumberstrue
    public void filterOutNotBelongingToCurrentUser(final SearchCriteriaBuilder scb) {
        scb.add(SearchRestrictions.eq("owner", securityService.getCurrentUserName()));
    }