Beispiel #1
0
        /// <summary>
        /// Receives client's call and gets the predicates
        /// </summary>
        /// <param name="eventArgument">The field's type</param>
        public void RaiseCallbackEvent(string eventArgument)
        {
            IField f = getField(eventArgument);

            predicates += eventArgument;

            if (f == null)
            {
                return;
            }

            List <MethodInfo> listPredicates = FieldsManager.GetPredicates(f.GetType());

            foreach (MethodInfo m in listPredicates)
            {
                predicates += '&' + m.Name;

                ParameterInfo[] parameters = m.GetParameters();

                foreach (ParameterInfo p in parameters)
                {
                    predicates += '|' + p.ParameterType.Name;
                }
            }
        }
Beispiel #2
0
        public FormView(CommunicationManager cm, FloadingForm list, FieldsManager fm, WorkflowManager wm, int n)
        {
            InitializeComponent();

            #region ProgressBar

            //
            // progressBar
            //
            this.progressBar           = new Mobile.ProgressBar(n);
            this.progressBar.BackColor = System.Drawing.Color.Black;
            this.progressBar.Location  = new System.Drawing.Point(0, 0);
            this.progressBar.Name      = "progressBar";
            this.progressBar.Size      = new System.Drawing.Size(240, 35);
            this.progressBar.TabIndex  = 0;
            this.progressBar.Text      = "progressBar1";
            this.progressBar.Load();
            this.Controls.Add(this.progressBar);

            #endregion

            fieldsManager        = fm;
            workflowManager      = wm;
            communicationManager = cm;
            menuList             = list;
            timer          = new Timer();
            timer.Interval = 1;
            timer.Tick    += new EventHandler(Timer_Tick);
            notification   = new Notification();
            //notification.BalloonChanged += new Microsoft.WindowsCE.Forms.BalloonChangedEventHandler(n_BalloonChanged);
            notification.Caption  = "Error";
            notification.Critical = true;
        }
Beispiel #3
0
        public ExTests01(AWindow w, Document doc)
        {
            this.w   = w;
            this.doc = doc;

            fm = new FieldsManager(w, doc);
        }
Beispiel #4
0
        public MainFields()
        {
            InitializeComponent();

            SharedCode.Windows.AWindow aw = this;

            fm = new FieldsManager(aw, "");
        }
 public void CreateFieldsManager()
 {
     fieldsManager     = new FieldsManager(new FieldsRepository(DBContext));
     tablesManager     = new TablesManager(new TablesRepository(DBContext));
     schemasManager    = new SchemasManager(new SchemasRepository(DBContext));
     databasesManager  = new PostgresDatabasesManager(new PostgresDatabasesRepository(DBContext));
     datastoresManager = new DatastoresManager(new DatastoresRepository(DBContext));
 }
Beispiel #6
0
        public void CreateForm(object sender, FormFetchEventArgs args)
        {
            FieldsManager fm = new FieldsManager(args.Types);

            new FormView(comManager,
                         this,
                         fm,
                         new WorkflowManager(fm, args.WorkflowNodes, args.WorkflowEdges, args.Types),
                         args.WorkflowNodes.ChildNodes[1].ChildNodes.Count).Show();
        }
Beispiel #7
0
 /// <summary>
 /// Adds a field in the node
 /// </summary>
 /// <param name="toNodeID">The field-required's type</param>
 private IBaseType getField(string fieldType)
 {
     foreach (Type t in FieldsManager.FieldTypes)
     {
         if (t.ToString() == ("Fields." + fieldType))
         {
             return((IBaseType)FieldsManager.GetInstance(t));
         }
     }
     return(null);
 }
Beispiel #8
0
    private List <Vector3> force;                  //The force experienced by each object in the list

    // Use this for initialization
    void Start()
    {
        ray = new Ray(gameObject.transform.position, gameObject.transform.up);

        fieldsManager    = FindObjectOfType <FieldsManager>();
        objectsInContact = new List <ExternalForce>();
        force            = new List <Vector3>();

        if (!alwaysActive)
        {
            fieldsManager.forceFields.Add(this.gameObject);
        }
    }
Beispiel #9
0
        public string GetValue(Control src, XmlNode renderingDocument)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("<" + nodeTypeName + ">");

            var cmplxTypeSchema = (XmlSchemaComplexType)this.GetNodeSchemas().GlobalTypes[new XmlQualifiedName(nodeTypeName)];

            sb.Append(
                FieldsManager.GetInstance(
                    renderingDocument, cmplxTypeSchema, GetNodeSchemas()).GetValue(((NamingUpdatePanel)src).ContentTemplateContainer.Controls[0], renderingDocument));

            sb.Append("</" + nodeTypeName + ">");

            return(sb.ToString());
        }
Beispiel #10
0
 public WorkflowManager(FieldsManager manager, XmlDocument workflowNodes, XmlDocument workflowEdges, XmlSchemaSet types)
 {
     this.manager = manager;
     workflow     = new Dictionary <string, Node>();
     try
     {
         BuildWorkflow(workflowNodes, workflowEdges, types);
     }
     catch (WorkflowException exc)
     {
         throw exc;
     }
     catch (Exception exc)
     {
         throw new WorkflowException(WorkflowExceptionType.WorkflowSchemaBadFormat, "There is an error in the workflow schema", exc);
     }
 }
Beispiel #11
0
        public Control GetWebControl(HttpServerUtility server, XmlNode renderingDocument)
        {
            NamingUpdatePanel np = new NamingUpdatePanel();

            np.ID = this.NodeTypeName;

            var cmplxType       = renderingDocument;
            var cmplxTypeSchema = (XmlSchemaComplexType)this.GetNodeSchemas().GlobalTypes[new XmlQualifiedName(nodeTypeName)];
            var fld             = FieldsManager.GetInstance(cmplxType, cmplxTypeSchema, this.GetNodeSchemas());

            if (IsWfNodeInstance && nodeIstance.DocumentElement.SchemaInfo != null)
            {
                ((IField)(fld)).SetValue(nodeIstance.DocumentElement.ChildNodes.ToList());
            }
            else if (IsWfNodeInstance && nodeIstance.DocumentElement.SchemaInfo == null)
            {
                throw new InvalidOperationException("Value not conforming the schema!");
            }

            np.ContentTemplateContainer.Controls.Add(fld.GetWebControl(server, cmplxType));
            return(np);
        }
Beispiel #12
0
        /// <summary>
        /// Receives client's call and gets the predicates
        /// </summary>
        /// <param name="eventArgument">The field's type</param>
        public void RaiseCallbackEvent(string eventArgument)
        {
            IField f = getField(eventArgument);

            if (f == null)
            {
                return;
            }
            List <MethodInfo> constr = FieldsManager.GetConstraints(f.GetType());

            foreach (MethodInfo mi in constr)
            {
                object[] attributes = mi.GetCustomAttributes(true);
                Fields.ConstraintAttribute attribute = (Fields.ConstraintAttribute)attributes[0];

                constraints += attribute.Name + '&' + attribute.Description + '&' + mi.Name;
                foreach (ParameterInfo pi in mi.GetParameters())
                {
                    constraints += "#" + pi.Name;
                }
                constraints += "|";
            }
        }
        public MainFields(Document doc)
        {
            this.doc = doc;

            InitializeComponent();

            fm     = new FieldsManager(this, doc);
            scMgr  = SchemaManager.Instance;
            et     = new ExTests01(this, doc);
            exData = ExStorData.Instance;

            docName = doc.Title;

            // temp to just creata a bogus old DS entry and name
            // docName = "HasDataStorage X";

            // save a local copy
            DocKey        = ExStorData.MakeKey(docName);
            exData.DocKey = docKey;

            // save a record copy
            // DataStoreManager.DocKey = ExStorData.MakeKey(docName);
        }
Beispiel #14
0
        /// <summary>
        /// Receives client's call and adds a node in the workflow
        /// </summary>
        /// <param name="eventArgument">WorkflowId  & Node id</param>
        public void RaiseCallbackEvent(string eventArgument)
        {
            try {
                fieldTypes = new XmlSchema();   //Creating the schema that will contain the field types
                string[] args     = eventArgument.Split('&');
                string   nodeID   = args[0];
                string   nodeName = args[1];

                //Initializing the string to return
                serialized_field_types += args[0] + '&';

                // idnodo & nodeName & basetype | id | label | position x | position y | width | height | rendered_label | constraints &  ...

                /**
                 *  EXAMPLE:
                 * workflow_1_node_1&nodeName&StringBox|1|pippo|120|208|100|30|pippo|AddMaxLengthConstraint#30@AddMinLengthConstraint#3@AddRangeLengthConstraint#3$30
                 **/

                for (int i = 2; i < args.Length; i++)
                {
                    string[] property = args[i].Split('|');

                    IBaseType f = getField(property[0]);
                    if (f != null)
                    {
                        f.TypeName = property[0] + property[1];

                        f.Name = XmlConvert.DecodeName(property[2]);

                        //Applying costraints
                        if (!property[8].Equals("")) //apply only if some costraints are defined
                        {
                            //---------------------------
                            //  COSTRAINTS STRING FORMAT:
                            //  & CostraintName # CostraintParameter1 | .. | CostraintParameterNN
                            //---------------------------

                            string[] constraints = property[8].Split('@');
                            for (int k = 0; k < constraints.Length; k++)
                            {
                                string[] constraintRapresentation = constraints[k].Split('#'); //divide costraint name from parameters

                                string[] tmpParams;
                                if (constraintRapresentation[1].Equals(""))
                                {
                                    tmpParams = null;
                                }
                                else
                                {
                                    tmpParams = constraintRapresentation[1].Split('$'); //divide each param
                                }
                                List <MethodInfo> constraintList = FieldsManager.GetConstraints(f.GetType());
                                bool constraint_loaded           = false;
                                foreach (MethodInfo c in constraintList)
                                {
                                    if (constraintRapresentation[0].Equals(c.Name))
                                    {
                                        constraint_loaded = (bool)c.Invoke(f, tmpParams); //apply costraint to field
                                        break;
                                    }
                                }
                                if (!constraint_loaded)
                                {
                                    throw new Exception("No constraint with name \"" + constraintRapresentation[0] + "\" could be applied.");
                                }
                            }
                        }

                        //for the client
                        fieldTypes.Items.Add(f.TypeSchema);
                    }
                }
            }
            catch (Exception e) {
                Console.Write(e.Message);
                error = e.Message;
            }
        }
Beispiel #15
0
        public MainWindow()
        {
            InitializeComponent();

            fmMgr = new FieldsManager(this);
        }
Beispiel #16
0
        /// <summary>
        /// Receives client's call and gets the predicates
        /// </summary>
        /// <param name="eventArgument">The constraints string</param>
        public void RaiseCallbackEvent(string eventArgument)
        {
            string[] property = eventArgument.Split('|');

            //property[0] -> field.basType
            IBaseType f = getField(property[0]);

            if (f != null)
            {
                returnValue = "";

                //Applying costraints
                if (!property[1].Equals("")) //apply only if some costraints are defined
                {
                    //---------------------------
                    //  COSTRAINTS STRING FORMAT:
                    //  & CostraintName # CostraintParameter1 | .. | CostraintParameterNN
                    //---------------------------

                    string[] constraints = property[1].Split('@');
                    for (int k = 0; k < constraints.Length; k++)
                    {
                        string[] constraintRapresentation = constraints[k].Split('#'); //divide costraint name from parameters

                        string[] tmpParams;
                        if (constraintRapresentation[1].Equals(""))
                        {
                            tmpParams = null;
                        }
                        else
                        {
                            tmpParams = constraintRapresentation[1].Split('$'); //divide each param
                        }
                        List <MethodInfo> constraintList = FieldsManager.GetConstraints(f.GetType());
                        bool constraint_loaded           = false;
                        foreach (MethodInfo c in constraintList)
                        {
                            if (constraintRapresentation[0].Equals(c.Name))
                            {
                                constraint_loaded = (bool)c.Invoke(f, tmpParams); //apply costraint to field
                                break;
                            }
                        }
                        if (!constraint_loaded)
                        {
                            List <MethodInfo> constr     = FieldsManager.GetConstraints(f.GetType());
                            string            constrName = "";
                            foreach (MethodInfo mi in constr)
                            {
                                if (mi.Name.Equals(constraintRapresentation[0]))
                                {
                                    object[] attributes = mi.GetCustomAttributes(true);
                                    Fields.ConstraintAttribute attribute = (Fields.ConstraintAttribute)attributes[0];
                                    constrName += attribute.Name;
                                    break;
                                }
                            }

                            returnValue = "Error applying constraint \"" + constrName + "\"";
                            if (tmpParams != null)
                            {
                                returnValue += " with parameter";
                                if (tmpParams.Length > 1)
                                {
                                    returnValue += "s ";
                                    for (int i = 0; i < tmpParams.Length; i++)
                                    {
                                        returnValue += ((i != 0)?", ":"") + tmpParams[i];
                                    }
                                }
                                else
                                {
                                    returnValue += " " + tmpParams[0];
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            listControl = new List <Control>();
            listControl.Add(new WFG_addNode());
            listControl.Add(new WFG_addArc());
            listControl.Add(new WFG_createWorkflow());
            listControl.Add(new WFE_saveWorkflow());
            listControl.Add(new WFC_publishWorkflow());
            listControl.Add(new WFG_initialNode());
            listControl.Add(new WFG_finalNode());
            listControl.Add(new WFF_addField());
            listControl.Add(new WFG_removeArc());
            listControl.Add(new WFG_removeNode());
            listControl.Add(new WFC_getPredicates());
            listControl.Add(new WFC_getOperations());
            listControl.Add(new WFC_setProperties());
            listControl.Add(new WFC_syncNode());
            listControl.Add(new WFF_getConstraints());
            listControl.Add(new WFF_saveConstraints());
            listControl.Add(new WFC_LoadXmlDocFromSession());
            listControl.Add(new WFC_getAuthServiceList());
            //listControl.Add(new WebInterface.FormFillier.action.ContactsRetrieve());
            //listControl.Add(new WebInterface.FormFillier.action.UserWorkflowSend());

            String cbReference;
            String callbackScript;

            List <Control> .Enumerator it = listControl.GetEnumerator();
            while (it.MoveNext())
            {
                Page.Controls.Add(it.Current);
                IControlWorkflowEditor t = (IControlWorkflowEditor)it.Current;
                cbReference =
                    Page.ClientScript.GetCallbackEventReference(it.Current, "arg", t.getNameFunctionServerResponse(), "context");
                callbackScript = "function " + t.getNameFunctionServerCall() + "(arg, context)" +
                                 "{ " + cbReference + ";}";

                Page.ClientScript.RegisterClientScriptBlock(it.Current.GetType(),
                                                            t.getNameFunctionServerCall(), callbackScript, true);
            }

            //Add WebControls to the UpdatePanel
            IBaseType field;
            //OLD System.Drawing.Image field_icon;
            WebControl field_icon, field_preview, field_rendering, special_icon, field_precondition;

            foreach (Type t in FieldsManager.FieldTypes)
            {
                //instantiate the Field for each type of field
                field = (IBaseType)FieldsManager.GetInstance(t);
                //get the type name
                field.TypeName = t.ToString();
                //get the icon
                field_icon = FieldsManager.GetIconControl(t);
                //get the preview html()
                field_preview = FieldsManager.GetPreviewControl(t);
                //get the rendering (big image) to be added onmouseover
                field_rendering    = FieldsManager.GetPreviewTooltipControl(t);
                field_precondition = FieldsManager.GetUnrelatedControl(t);


                String[] s1 = t.ToString().Split('.');
                field_preview.Attributes.Add("class", "WFF_" + s1[1]);
                HtmlGenericControl p1 = new HtmlGenericControl("div");
                p1.Controls.Add(field_preview);
                p1.Attributes.Add("id", s1[1]);
                upcontrols.ContentTemplateContainer.Controls.Add(p1);

                HtmlGenericControl p2 = new HtmlGenericControl("div");
                p2.Attributes.Add("id", s1[1]);
                p2.Attributes.Add("class", "WFF_widget_in_uppanel");
                p2.Controls.Add(field_icon);
                upicons.ContentTemplateContainer.Controls.Add(p2);

                HtmlGenericControl p3 = new HtmlGenericControl("div");
                p3.Attributes.Add("id", s1[1]);
                p3.Attributes.Add("class", "WFF_rendering_preview");
                p3.Controls.Add(field_rendering);
                uprendering.ContentTemplateContainer.Controls.Add(p3);

                field_precondition.Attributes.Add("class", "precondition_webcontrol_preview");
                HtmlGenericControl p4 = new HtmlGenericControl("div");
                p4.Controls.Add(field_precondition);
                p4.Attributes.Add("id", "precondition_" + s1[1]);
                //preconditionup.ContentTemplateContainer.Controls.Add(p4);
            }

            foreach (Type s in FieldsManager.SpecialFieldTypes)
            {
                //get the type name
                string sname = (s.ToString().Split('.'))[1];

                //get the icon
                special_icon = FieldsManager.GetIconControl(s);

                special_icon.Attributes.Add("class", "WFF_" + sname);
                HtmlGenericControl p1 = new HtmlGenericControl("div");
                p1.Controls.Add(special_icon);
                p1.Attributes.Add("id", sname);
                p1.Attributes.Add("class", "WFF_widget_in_upspecial");
                upspecial.ContentTemplateContainer.Controls.Add(p1);
            }

            //for manage contacts back button
            Session["contactReturn"] = "/WorkflowEditor/WorkflowEditor.aspx";
        }
Beispiel #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Init the Session element that bring the logo to null
            if (Page != null)
            {
                Page.Session["TE_currentLogo"] = null;
            }
            // Taking the CurrentWorkflow from the session elemnt.
            ComputableWorkflowReference wfr = null;
            IComputableWorkflow         wf  = null;



            try
            {
                wfr = (ComputableWorkflowReference)Page.Session["WFE_CurrentWorkflow"];
                wf  = wfr.GetWorkflow();
            }
            catch (Exception)
            {
                Response.Write("No workflow in session!");
                Response.End();
                return;
            }


            bool useStaticLabel = false;

            try
            {
                useStaticLabel = (bool)Page.Session["UsingStaticFields"];
            }
            catch (Exception)
            {
                Response.Write("No UsingStaticFields in session!");
                Response.End();
                return;
            }

            if (useStaticLabel)
            {
                editStaticLabel.InnerHtml = "<label for=\"color_staticLabel\">Static Label Color:</label><input rel=\"staticLabel\" class=\"gccolor\" onblur=\"toolbox.applyChanges('staticLabel','color', this.value, 'color' );\" title=\"Color of the Static Label. Example: #ff00ff\" id=\"color_staticLabel\" type=\"text\"/><div style=\"display:none;\"><input id=\"staticLabelApplyToID\" type=\"checkbox\" /></div>";
            }
            else
            {
                editStaticLabel.InnerHtml = "";
            }

            // bla bla bla
            int tabCounter = 1;

            List <Panel> divPanel = new List <Panel>();

            presenPanel.Controls.Add(new LiteralControl("<ul class=\"tabs\">"));

            // Iterating each workflow node to render the form elemnt list

            foreach (WFnode nd in wf.getNodeList())
            {
                Panel p = new Panel();
                //p.Enabled = false;
                XmlDocument renderDoc = nd.GetRenderingDocument();



                string nodeName = XmlConvert.DecodeName(renderDoc.DocumentElement.Attributes["name"].InnerText);

                presenPanel.Controls.Add(new LiteralControl("<li><a href=\"#tabs" + tabCounter + "\" >" + nodeName + "</a></li>"));

                //p.Controls.Add(new LiteralControl("<div id=\"tabs" + tabCounter + "\" style=\"position: relative; height: 500px;\" >"));

                // Hangling the webcontrol
                XmlNode cmplexRenering = renderDoc.DocumentElement.FirstChild;
                Control wc             = nd.GetWebControl(Page.Server, cmplexRenering);

                //Disabling all BaseValidator to remove useless text <.<
                DisableControl(wc);

                p.Controls.Add(new LiteralControl("<div>"));
                p.Controls.Add(wc);
                p.Controls.Add(new LiteralControl("</div>"));

                divPanel.Add(p);

                tabCounter++;
            }

            presenPanel.Controls.Add(new LiteralControl("</ul>"));
            presenPanel.Controls.Add(new LiteralControl("<div class=\"panes\"> "));
            // Add each panel to presenPanel
            foreach (var p in divPanel)
            {
                presenPanel.Controls.Add(p);
            }
            presenPanel.Controls.Add(new LiteralControl("</div>"));

            // Retriving the current Theme informations
            IWorkflowThemeReference iwfr = (IWorkflowThemeReference)Page.Session["WFE_CurrentWorkflow"];

            if (Page.Session["CurrentTheme"] == null)
            {
                Page.Session["CurrentTheme"] = (Theme)iwfr.GetTheme();
            }

            Theme theme = (Theme)Page.Session["CurrentTheme"];

            //Theme theme = (Theme)iwfr.GetTheme();

            string propertyListJson = "<script language='javascript'> initTE('" + theme.Title + "');";

            propertyListJson += " var PropertyList=function(){";
            IBaseType field;

            foreach (Type t in FieldsManager.FieldTypes)
            {
                field = (IBaseType)FieldsManager.GetInstance(t);
                if (!String.IsNullOrEmpty(field.JSON_StyleProperties))
                {
                    propertyListJson += "var " + field.GetType().Name + "PropertyList = " + field.JSON_StyleProperties + ";";
                }
            }
            propertyListJson +=
                @"
                    return{
                        getList:function( type ){
                            if( eval( ""typeof "" + type + ""PropertyList == 'undefined'"" ) ) {
                                type = ""StringBox"";
                            }            
                            return eval( type + ""PropertyList"");
                        },
                        validate:function( type, value ){
			                if( type == ""color"" )
				                return (value.match( /#[a-fA-F0-9]{6}/ ) || value.match(/rgb\([ ]*[0-9]{1,3}[ ]*,[ ]*[0-9]{1,3}[ ]*,[ ]*[0-9]{1,3}[ ]*\)/i));
			                if( type == ""size"" ) 
				                return ( value.match( /\d+px/ ) || value.match( /\d+\%/ ) || value.match( /\d+em/ ));
			                if( type == ""none"" )
				                return true;
                            if( type == ""font"" )
                                return true;
			                return false;            
                        }
                   };
                }(); ";


            CssParser cssParser = new CssParser();

            cssParser.AddStyleSheet(theme.CSS);
            foreach (var styles in cssParser.Styles)
            {
                foreach (KeyValuePair <string, string> pv in styles.Value.Attributes)
                {
                    propertyListJson += string.Format(CssAddJS, styles.Key.Substring(0, 1), styles.Key.Substring(1), pv.Key, pv.Value);
                }
            }
            if (theme.Image != null)
            {
                Page.Session["TE_currentLogo"] = theme.Image;
                propertyListJson += "stopUpload('drawLogo.aspx', true);";
            }

            propertyListJson += "</script>";
            Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", propertyListJson);

            //Adding the CSS to the Page Header.
            Page.Header.Controls.Add(
                new LiteralControl(
                    @"<style type='text/css'>" + theme.CSS + "</style" + ">"
                    )
                );

            //for manage contacts back button (GUI modify)
            Session["contactReturn"] = "/ThemeEditor/ThemeEditor.aspx";
        }