Search in sources :

Example 1 with ExpressionTypeChangeHandler

use of org.drools.workbench.screens.guided.rule.client.editor.ExpressionTypeChangeHandler in project drools-wb by kiegroup.

the class FactPatternWidget method associateExpressionWithChangeHandler.

private void associateExpressionWithChangeHandler(final FlexTable inner, final int row, final SingleFieldConstraint constraint, final int col, HorizontalPanel ebContainer) {
    ExpressionBuilder eb = (ExpressionBuilder) ebContainer.getWidget(0);
    eb.addExpressionTypeChangeHandler(new ExpressionTypeChangeHandler() {

        public void onExpressionTypeChanged(ExpressionTypeChangeEvent event) {
            try {
                // Change "operator" drop-down as the content depends on data-type
                constraint.setFieldType(event.getNewType());
                inner.setWidget(row, 1 + col, operatorDropDown(constraint, inner, row, 2 + col));
                // Change "value" editor to the pen icon as the applicable Widget depends on data-type
                constraint.setConstraintValueType(SingleFieldConstraint.TYPE_UNDEFINED);
                constraint.setValue("");
                inner.setWidget(row, 2 + col, createValueEditor(constraint));
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });
}
Also used : ExpressionTypeChangeEvent(org.drools.workbench.screens.guided.rule.client.editor.ExpressionTypeChangeEvent) ExpressionTypeChangeHandler(org.drools.workbench.screens.guided.rule.client.editor.ExpressionTypeChangeHandler)

Aggregations

ExpressionTypeChangeEvent (org.drools.workbench.screens.guided.rule.client.editor.ExpressionTypeChangeEvent)1 ExpressionTypeChangeHandler (org.drools.workbench.screens.guided.rule.client.editor.ExpressionTypeChangeHandler)1