Versions Compared

Key

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

...

Code Block
public void viewHookMethodName(final ViewDefinitionState state, final Locale locale) {

        // VIEW HOOK BODY

}

Where

  • viewHookMethodName - name of view hook method
  • state - view state
  • locale - users locale

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

...

Code Block
    public void checkIfCommentIsRequiredBasedOnResult(final ViewDefinitionState state, final Locale locale) {
        FieldComponentState comment = (FieldComponentState) state.getComponentByReference("comment");

        FieldComponentState controlResult = (FieldComponentState) state.getComponentByReference("controlResult");

        if (controlResult != null && controlResult.getFieldValue() != null && "03objection".equals(controlResult.getFieldValue())) {
            comment.setRequired(true);
            comment.requestComponentUpdateState();
        } else {
            comment.setRequired(false);
        }

    }

...