Package org.jbpm.ui.common.model

Examples of org.jbpm.ui.common.model.FormNode


        IFile file = elementMatch.getFile();

        IEditorPart editor = null;
        if (ElementMatch.CONTEXT_FORM.equals(elementMatch.getContext())) {
            try {
                FormNode formNode = (FormNode) elementMatch.getGraphElement();
                editor = FormTypeProvider.getFormType(formNode.getFormType()).openForm(file, formNode);
            } catch (CoreException e) {
                DesignerLogger.logError(e);
            }
        } else if (ElementMatch.CONTEXT_FORM_VALIDATION.equals(elementMatch.getContext())) {
            FormNode formNode = (FormNode) elementMatch.getGraphElement();
            OpenFormValidationDelegate delegate = new OpenFormValidationDelegate();
            delegate.openValidationFile(formNode, elementMatch.getFile());
        } else if (elementMatch.getGraphElement() instanceof Delegable) {
            Delegable delegable = (Delegable) elementMatch.getGraphElement();
            DelegableProvider provider = CustomizationRegistry.getProvider(delegable.getDelegationClassName());
View Full Code Here


        for (int i = 0; i < formElementsList.getLength(); i++) {
            Element formElement = (Element) formElementsList.item(i);
            String stateName = formElement.getAttribute(STATE_ATTRIBUTE_NAME);
            Node node = definition.getNodeByNameNotNull(stateName);
            if (node instanceof FormNode) {
                FormNode formNode = (FormNode) node;
                String typeName = formElement.getAttribute(TYPE_ATTRIBUTE_NAME);
                if (!isEmptyOrNull(typeName)) {
                    formNode.setFormType(typeName);
                }
                String fileName = formElement.getAttribute(FILE_ATTRIBUTE_NAME);
                if (!isEmptyOrNull(fileName)) {
                    formNode.setFormFileName(fileName);
                }
                String validationFileName = formElement.getAttribute(VALIDATION_FILE_ATTRIBUTE_NAME);
                if (!isEmptyOrNull(validationFileName)) {
                    formNode.setValidationFileName(validationFileName);
                    boolean useJsValidation = false;
                    String useJsAttr = formElement.getAttribute(JS_VALIDATION_ATTRIBUTE_NAME);
                    if ((useJsAttr != null) && (useJsAttr.length() > 0)) {
                        useJsValidation = Boolean.parseBoolean(useJsAttr);
                    }
                    formNode.setUseJSValidation(useJsValidation);
                }
                String scriptFileName = formElement.getAttribute(SCRIPT_FILE_ATTRIBUTE_NAME);
                if (!isEmptyOrNull(scriptFileName)) {
                    formNode.setScriptFileName(scriptFileName);
                }
            }
        }
    }
View Full Code Here

    public void saveToFile(IFolder folder, ProcessDefinition definition) throws Exception {
        Document document = XmlUtil.createDocument(FORMS_ELEMENT_NAME, FORMS_XSD_FILE_NAME);
        Element root = document.getDocumentElement();
        for (Node node : definition.getNodes()) {
            if (node instanceof FormNode) {
                FormNode formNode = (FormNode) node;
                if (formNode.hasForm() || formNode.hasFormValidation()) {
                    Element formElement = document.createElement(FORM_ELEMENT_NAME);
                    formElement.setAttribute(STATE_ATTRIBUTE_NAME, formNode.getName());
                    root.appendChild(formElement);
                    if (formNode.hasForm()) {
                        formElement.setAttribute(FILE_ATTRIBUTE_NAME, formNode.getFormFileName());
                        formElement.setAttribute(TYPE_ATTRIBUTE_NAME, formNode.getFormType());
                    }
                    if (formNode.hasFormValidation()) {
                        formElement.setAttribute(VALIDATION_FILE_ATTRIBUTE_NAME, formNode.getValidationFileName());
                        formElement.setAttribute(JS_VALIDATION_ATTRIBUTE_NAME, String.valueOf(formNode.isUseJSValidation()));
                    }
                    if (formNode.hasFormScript()) {
                        formElement.setAttribute(SCRIPT_FILE_ATTRIBUTE_NAME, formNode.getScriptFileName());
                    }
                }
            }
        }
        byte[] bytes = XmlUtil.writeXml(document);
View Full Code Here

public class OpenFormScriptDelegate extends BaseActionDelegate {
    private static final String EDITOR_ID = "tk.eclipse.plugin.jseditor.editors.JavaScriptEditor";
   
    public void run(IAction action) {
        try {
            FormNode formNode = ((FormNodeEditPart) selectedPart).getModel();
            String fileName;
            if (!formNode.hasFormScript()) {
                fileName = formNode.getName() + "." + FormNode.SCRIPT_SUFFIX;
            } else {
                fileName = formNode.getScriptFileName();
            }
            IFile file = IOUtils.getAdjacentFile(getDefinitionFile(), fileName);
            if (!file.exists()) {
                file = IOUtils.createFileSafely(file);
                setNewScriptFormFile(formNode, file.getName());
View Full Code Here

public class OpenFormValidationDelegate extends BaseActionDelegate {

    public void run(IAction action) {
        try {
            FormNode formNode = ((FormNodeEditPart) selectedPart).getModel();

            if (!formNode.hasFormValidation()) {
                if (!MessageDialog.openQuestion(targetPart.getSite().getShell(), "", Messages
                        .getString("OpenFormValidationDelegate.CreateEmptyValidation"))) {
                    return;
                }
                String validationFileName = ValidationUtil.getFormValidationFileName(formNode.getName());
                IFile file = ValidationUtil.rewriteValidation(getDefinitionFile(), validationFileName,
                        new HashMap<String, Map<String, ValidatorConfig>>());
                setNewValidationFormFile(formNode, file.getName());
            }
            IFile validationFile = IOUtils.getAdjacentFile(getDefinitionFile(), formNode.getValidationFileName());
            if (!validationFile.exists()) {
                ValidationUtil.createEmptyValidation(getDefinitionFile(), formNode.getValidationFileName());
            }
            openValidationFile(formNode, validationFile);
        } catch (Exception e) {
            DesignerLogger.logError(e);
        }
View Full Code Here

import org.jbpm.ui.common.part.graph.FormNodeEditPart;

public class EnableJSValidationDelegate extends BaseActionDelegate {

    public void run(IAction action) {
        FormNode formNode = ((FormNodeEditPart) selectedPart).getModel();
        setJSValidation(formNode, action.isChecked());
    }
View Full Code Here

    @Override
    public void selectionChanged(IAction action, ISelection selection) {
        super.selectionChanged(action, selection);
        if (selectedPart == null)
            return;
        FormNode formNode = ((FormNodeEditPart) selectedPart).getModel();
        action.setEnabled(formNode.hasFormValidation());
        action.setChecked(formNode.isUseJSValidation());
    }
View Full Code Here

  public void run(IAction action) {
    if (MessageDialog.openQuestion(
        targetPart.getSite().getShell(),
        Messages.getString("ConfirmDelete"),
        Messages.getString("Form.WillBeDeleted"))) {
      FormNode formNode = ((FormNodeEditPart) selectedPart).getModel();
      formNode.setFormFileName(FormNode.EMPTY);
      formNode.setValidationFileName(FormNode.EMPTY);
            formNode.setScriptFileName(FormNode.EMPTY);
    }
  }
View Full Code Here

public class CreateFormDelegate extends BaseActionDelegate {

  public void run(IAction action) {
        try {
            FormNode formNode = ((FormNodeEditPart) selectedPart).getModel();
            ChooseFormTypeDialog chooseFormTypeDialog = new ChooseFormTypeDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell());
            if (chooseFormTypeDialog.open() != Dialog.OK) {
                return;
            }
            formNode.setFormType(chooseFormTypeDialog.getType());
            String fileName = FormTypeProvider.getFormType(formNode.getFormType()).getFormFileName(getDefinitionFile(), formNode);
            IFile file = IOUtils.getAdjacentFile(getDefinitionFile(), fileName);
            if (!file.exists()) {
                file = IOUtils.createFileSafely(file);
            }
            setNewFormFile(formNode, file.getName());
            formNode.setDirty();
           
            // open form
            OpenFormEditorDelegate openFormEditorDelegate;
            if (ChooseFormTypeDialog.EDITOR_EXTERNAL.equals(chooseFormTypeDialog.getEditorType())) {
                openFormEditorDelegate = new OpenExternalFormEditorDelegate();
View Full Code Here

public abstract class OpenFormEditorDelegate extends BaseActionDelegate {

    public void run(IAction action) {
        try {
            FormNode formNode = ((FormNodeEditPart) selectedPart).getModel();
            String fileName = formNode.getFormFileName();
            IFile file = IOUtils.getAdjacentFile(getDefinitionFile(), fileName);
            if (!PluginConstants.UTF_ENCODING.equalsIgnoreCase(file.getCharset())) {
              // TODO bug for imported processes fixed in ExportParWizard now
              file.setCharset(PluginConstants.UTF_ENCODING, null);
            }
View Full Code Here

TOP

Related Classes of org.jbpm.ui.common.model.FormNode

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.