Examples of ValidatorConfig


Examples of javax.faces.view.facelets.ValidatorConfig

        public TagHandler createHandler(TagConfig cfg) throws FacesException, ELException
        {
            try
            {
                ValidatorConfig ccfg = new ValidatorConfigWrapper(cfg, validatorId);
                return constructor.newInstance(new Object[] { ccfg });
            }
            catch (InvocationTargetException e)
            {
                throw new FaceletException(e.getCause().getMessage(), e.getCause().getCause());
View Full Code Here

Examples of org.jbpm.ui.validation.ValidatorConfig

    }

    private void updateValidatorSelection() {
        ValidatorDefinition vd = getCurrentDefinition();
        if (vd != null) {
            ValidatorConfig config = getFieldValidator(getCurrentVariableName(), vd);
            if (config == null) {
                config = vd.create("");
            }
            infoGroup.setConfig(getCurrentVariableName(), vd, config);
        }
View Full Code Here

Examples of org.jbpm.ui.validation.ValidatorConfig

        gridData.horizontalAlignment = SWT.LEFT;
        gridData.verticalAlignment = SWT.TOP;
        addButton(buttonsBar, "button.add", new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                ValidatorConfig config = ValidatorDefinitionRegistry.getGlobalDefinition().create(ValidatorConfig.GLOBAL_FIELD_ID);
                validatorConfigs.add(config);
                validatorsTableViewer.refresh(true);
                validatorsTableViewer.setSelection(new StructuredSelection(config));
            }
        });
        deleteButton = addButton(buttonsBar, "button.delete", new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                ValidatorConfig config = (ValidatorConfig) ((IStructuredSelection) validatorsTableViewer.getSelection()).getFirstElement();
                if (config == null) {
                    infoGroup.setVisible(false);
                    return;
                }
                validatorConfigs.remove(config);
                validatorsTableViewer.refresh(true);
            }
        });
        deleteButton.setEnabled(false);
       
        validatorsTableViewer.setLabelProvider(new LabelProvider() {
            @Override
            public String getText(Object element) {
                return ((ValidatorConfig) element).getMessage();
            }
        });
        validatorsTableViewer.setContentProvider(new ArrayContentProvider());
        validatorsTableViewer.setInput(validatorConfigs);
        validatorsTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
            public void selectionChanged(SelectionChangedEvent event) {
                ValidatorConfig config = (ValidatorConfig) ((IStructuredSelection) validatorsTableViewer.getSelection()).getFirstElement();
                deleteButton.setEnabled(config != null);
                ValidatorDefinition def = null;
                if (config != null) {
                    def = ValidationUtil.getValidatorDefinition(config.getType());
                }
                infoGroup.setConfig(ValidatorConfig.GLOBAL_FIELD_ID, def, config);
            }
        });
View Full Code Here

Examples of org.jbpm.ui.validation.ValidatorConfig

            if (adapter == null) {
                DesignerLogger.logInfo("[InfoPath Validation DEBUG] : Not found adapter for expression '" + expr + "'");
            } else {
                try {
                    DesignerLogger.logInfo("[InfoPath Validation DEBUG] : Applying adapter " + adapter.getClass() + " to expression '" + expr + "'");
                    ValidatorConfig config = adapter.createConfig(expr, errorMessage);
                    if (validators.containsKey(variableName)) {
                        validators.get(variableName).put(config.getType(), config);
                    } else {
                        DesignerLogger.logInfo("[InfoPath Validation DEBUG] : Variable not found: " + variableName);
                    }
                } catch (Throwable e) {
                    DesignerLogger.logError("[InfoPath Validation] Failed to apply validation: " + adapter.getClass(), e);
View Full Code Here

Examples of org.jbpm.ui.validation.ValidatorConfig

public class StringLengthExpressionAdapter implements ExpressionAdapter {

    public ValidatorConfig createConfig(String expr, String errorMessage) throws Exception {
        ValidatorDefinition definition = ValidationUtil.getValidatorDefinition("stringlength");
        ValidatorConfig config = definition.create(errorMessage);

        String argName;
        int index;
        if (expr.indexOf("<") > 0) {
            argName = "maxLength";
            index = expr.indexOf("<");
        } else if (expr.indexOf(">") > 0) {
            argName = "minLength";
            index = expr.indexOf(">");
        } else {
            throw new Exception("Unknown expr: " + expr);
        }
        String argValue = expr.substring(index + 2);
        config.getParams().put(argName, argValue);
        return config;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.