public TreeOptions CloneOptions (Gtk.TreeIter newIter)
			{
				TreeOptions ops = new TreeOptions (pad, newIter);
				foreach (DictionaryEntry de in this)
					ops [de.Key] = de.Value;
				return ops;
			}
        public ActionResult AddPrivilegeTemplate(long corptype)
        {
            var privileges = privilegeTemplateBll.GetSysPrivilegeTemplateByCorpType(corptype).Aggregate(string.Empty, (current, item) => current + (item.Privilege + ","));
            var treeList   = privilegeTemplateBll.GetPrivilegeTreeList(corptype, 0, privilegeTemplateBll.GetPrivileges(), privileges.TrimEnd(','));
            PrivilegeTemplateResult result = new PrivilegeTemplateResult()
            {
                Privileges = privileges,
                CorpType   = corptype
            };

            ViewBag.CorpTypeName = sysCorpTypeBll.GetModelById(corptype).Name;
            ViewData["TreeList"] = new TreeOptions()
            {
                animate      = false,
                cascadeCheck = false,
                checkbox     = true,
                data         = treeList
            };

            ViewData["CorpTypeList"] = dropDownListService.InitCorpTypeDropDownList();
            if (treeList.Count == 0)
            {
                ModelState.AddModelError("Privileges", "请先设置菜单模板!");
            }

            return(View(result));
        }
示例#3
0
        public DecisionTree BuildConditionalTree(TableFixedData data, TreeOptions options,
                                                 int[] attributes = null)
        {
            var ret = new C45AlgorithmDataOptimized(data, options);

            return(ret.BuildConditionalTree(null, attributes));
        }
        public void TreePopulate(TreeOptions options)
        {
            _linkableComponent = null;
            _treeOptions       = options;

            _items.Clear();

            TreeCreate(null);
        }
示例#5
0
            public TreeOptions CloneOptions(Gtk.TreeIter newIter)
            {
                TreeOptions ops = new TreeOptions(pad, newIter);

                foreach (DictionaryEntry de in this)
                {
                    ops [de.Key] = de.Value;
                }
                return(ops);
            }
        public void TreePopulate(ITimeSpaceComponent linkableComponent, TreeOptions options)
        {
            _linkableComponent = linkableComponent;
            _treeOptions       = options;

            _items = _treeOptions.IsSource
                ? Sources(linkableComponent)
                : Targets(linkableComponent);

            TreeCreate(null);
        }
        public static MvcHtmlString TreeListFor <TModel, TProperty>(
            this HtmlHelper <TModel> htmlHelper,
            Expression <Func <TModel, TProperty> > expression,
            TreeOptions treeOptions,
            object htmlAttributes
            )
        {
            TagBuilder tagBuilder = new TagBuilder("ul");

            tagBuilder.MergeAttribute("class", "easyui-tree");



            //htmlAttributes字典
            var htmlAttributesDic = ((IDictionary <string, object>)HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes));

            if (treeOptions != null)
            {
                if (treeOptions.data != null && treeOptions.data.Count > 0)
                { //获取model的默认值
                    ModelMetadata metadata = ModelMetadata.FromLambdaExpression <TModel, TProperty>(expression, htmlHelper.ViewData);
                    if (metadata.Model != null)
                    {
                        string defaultValue = metadata.Model.ToString();
                        treeOptions.data = SetDefaultValue(treeOptions.data, defaultValue);
                    }
                }
                tagBuilder.MergeAttribute("data-options", JsonConvert.SerializeObject(treeOptions,
                                                                                      Formatting.Indented,
                                                                                      new JsonSerializerSettings {
                    NullValueHandling = NullValueHandling.Ignore
                }));
            }
            string fullHtmlFieldName = htmlHelper.ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName(ExpressionHelper.GetExpressionText(expression));

            if (htmlAttributesDic.Count > 0)
            {
                tagBuilder.MergeAttributes(htmlAttributesDic);
            }

            ////生成name项
            //tagBuilder.MergeAttribute("name", fullHtmlFieldName, true);
            //生成id
            tagBuilder.GenerateId(fullHtmlFieldName + "Tree");
            //增加验证信息
            //tagBuilder.MergeAttributes(htmlHelper.GetUnobtrusiveValidationAttributes(ExpressionHelper.GetExpressionText(expression), metadata));

            //string inputHidden = string.Format(@"<input type='hidden' id='{0}' name='{0}' value='{1}'/>",
            //    fullHtmlFieldName, defaultValue);

            return(new MvcHtmlString(tagBuilder.ToString(TagRenderMode.Normal)));
        }
        public ActionResult AddPrivilegeTemplate(PrivilegeTemplateResult privilegeTemplate)
        {
            //处理其他请求
            var ac = Request["actionName"] ?? "";

            if (ac != "")
            {
                return(OtherAction(ac));
            }

            var currentUser = HttpContext.Session[Constants.USER_KEY] as USP.Models.POCO.User;

            ViewData["TreeList"] = new TreeOptions()
            {
                animate      = false,
                cascadeCheck = false,
                checkbox     = true,
                data         = privilegeTemplateBll.GetPrivilegeTreeList(privilegeTemplate.CorpType, 0, privilegeTemplateBll.GetPrivileges())
            };

            if (privilegeTemplate.Privileges == null)
            {
                TempData["returnMsgType"] = "false";
                TempData["returnMsg"]     = "您未选择权限!";
                return(RedirectToAction("AddPrivilegeTemplate", "PrivilegeTemplate", new { area = "System", corpType = privilegeTemplate.CorpType }));
            }
            else
            {
                if (ModelState.IsValid)
                {
                    var result = privilegeTemplateBll.SavePrivileges(privilegeTemplate.CorpType, privilegeTemplate.Privileges.TrimEnd(','), currentUser.SysOperator.ID);
                    if (!result.flag)
                    {
                        ModelState.AddModelError("Privileges", result.message);
                        return(View(privilegeTemplate));
                    }
                    else
                    {
                        TempData["returnMsgType"] = "success";
                        TempData["returnMsg"]     = "设置成功";
                        return(RedirectToAction("PrivilegeTemplates", "PrivilegeTemplate", new { area = "System", corptype = privilegeTemplate.CorpType }));
                    }
                }
                else
                {
                    TempData["returnMsgType"] = "false";
                    TempData["returnMsg"]     = "设置失败!";
                    return(RedirectToAction("AddPrivilegeTemplate", "PrivilegeTemplate", new { area = "System", corpType = privilegeTemplate.CorpType }));
                }
            }
        }
示例#9
0
 public TreeOptionsViewModel(TreeOptions treeOptions)
 {
     OK = new RelayCommand(OnOkExecute);
     TreeOptionsModel   = treeOptions;
     TransparenceInvert = (byte)(255 - TreeOptionsModel.Transparence);
     TreeVisualOptions  = new ObservableCollection <TreeVisualOption> (treeOptions.TreeVisualOptions);
     foreach (var item in TreeVisualOptions)
     {
         item.PropertyChanged += VisualTree_PropertyChanged;
     }
     AddVisualTree    = new RelayCommand(OnAddVisualTreeExecute, OnAddVisualTreeCanExecute);
     ResetVisualTree  = new RelayCommand(OnResetVisualTreeExecute);
     DeleteVisualTree = new RelayCommand <TreeVisualOption>(OnDeleteVisualTreeExecute, OnDeleteVisualTreeCanExecute);
     SelectColor      = new RelayCommand <TreeVisualOption>(OnSelectColorExecute);
 }
        public ActionResult AuditorPrivilegeTemplate(PrivilegeTemplateResult privilegeTemplate)
        {
            //处理其他请求
            var ac = Request["actionName"] ?? "";

            if (ac != "")
            {
                return(OtherAction(ac));
            }

            var currentUser = HttpContext.Session[Constants.USER_KEY] as USP.Models.POCO.User;

            ViewData["TreeList"] = new TreeOptions()
            {
                animate      = false,
                cascadeCheck = false,
                checkbox     = true,
                data         = privilegeTemplateBll.GetPrivilegeTreeList(privilegeTemplate.CorpType, 0, privilegeTemplateBll.GetPrivileges())
            };
            ViewData["CorpTypeList"] = dropDownListService.InitCorpTypeDropDownList();

            if (ModelState.IsValid)
            {
                var result = privilegeTemplateBll.AuditorPrivileges(privilegeTemplate.CorpType, privilegeTemplate.Privileges.TrimEnd(','), currentUser.SysOperator.ID);
                if (!result.flag)
                {
                    ModelState.AddModelError("Privileges", result.message);
                    TempData["returnMsgType"] = "error";
                    TempData["returnMsg"]     = "审核通过失败";
                    return(View(privilegeTemplate));
                }
                else
                {
                    TempData["returnMsgType"] = "success";
                    TempData["returnMsg"]     = "审核通过成功";
                    return(RedirectToAction("PrivilegeTemplates", "PrivilegeTemplate", new { area = "System" }));
                }
            }
            TempData["CorpType"] = privilegeTemplate.CorpType;
            return(View("PrivilegeTemplates"));
        }
        public ActionResult AuditorPrivilegeTemplate(long corptype = 0)
        {
            var privileges = privilegeTemplateBll.GetSysPrivilegeTemplateByCorpType(corptype).Aggregate(string.Empty, (current, item) => current + (item.Privilege + ","));
            var treeList   = privilegeTemplateBll.GetPrivilegeTreeList(corptype, 0, privilegeTemplateBll.GetPrivileges(), privileges.TrimEnd(','));
            PrivilegeTemplateResult result = new PrivilegeTemplateResult()
            {
                Privileges = privileges,
                CorpType   = corptype
            };

            ViewBag.CorpTypeName = sysCorpTypeBll.GetModelById(corptype).Name;
            ViewData["TreeList"] = new TreeOptions()
            {
                animate      = false,
                cascadeCheck = false,
                checkbox     = true,
                data         = treeList
            };

            return(View(result));
        }
示例#12
0
        public void TreePopulate(ITimeSpaceComponent source, ITimeSpaceComponent target, List <UIOutputItem> extraSources, TreeOptions options)
        {
            _treeOptions = options;

            List <UIExchangeItem> sources = Sources(source);
            List <UIExchangeItem> targets = Targets(target);

            UIExchangeItem toCheck = null;

            if (extraSources != null)
            {
                sources.AddRange(extraSources.ToArray());

                if (extraSources.Count > 0)
                {
                    toCheck = extraSources[0];
                }
            }

            Filter(sources, targets);

            if (_treeOptions.IsSource)
            {
                _linkableComponent = source;
                _items             = sources;
            }
            else if (_treeOptions.IsTarget)
            {
                _linkableComponent = target;
                _items             = targets;
            }
            else
            {
                _linkableComponent = null;
                _items             = new List <UIExchangeItem>();
            }

            TreeCreate(toCheck);
        }
示例#13
0
        public void TreePopulate(UIConnection connection, TreeOptions options)
        {
            ITimeSpaceComponent source = connection.SourceModel.LinkableComponent;
            ITimeSpaceComponent target = connection.TargetModel.LinkableComponent;

            List <UIOutputItem> extraSources = new List <UIOutputItem>();

            UIOutputItem src;

            foreach (Link pair in connection.Links)
            {
                src = pair.Source;

                //while (src.Parent != null) // decorator
                //{
                //    extraSources.Add(src);
                //    src = src.Parent;
                //}
            }

            TreePopulate(source, target, extraSources, options);
        }
示例#14
0
 public DecisionTree BuildConditionalTree(ITableData data, TreeOptions options)
 {
     var ret = new C45AlgorithmDataOptimized(TableFixedData.FromTableData(data), options);
     return ret.BuildConditionalTree();
 }
示例#15
0
 public void TreePopulate(ITimeSpaceComponent source, ITimeSpaceComponent target, TreeOptions options)
 {
     TreePopulate(source, target, null, options);
 }
 internal void SetIterOptions(Gtk.TreeIter iter, TreeOptions ops)
 {
     ops.Pad = this;
     ops.Iter = iter;
     nodeOptions [iter] = ops;
 }
        public virtual void Initialize(string label, string icon, NodeBuilder[] builders, TreePadOption[] options)
        {
            // Create default options

            this.options = options;
            globalOptions = new TreeOptions ();
            foreach (TreePadOption op in options)
                globalOptions [op.Id] = op.DefaultValue;

            globalOptions.Pad = this;

            // Check that there is only one node builder per type

            Hashtable bc = new Hashtable ();
            foreach (NodeBuilder nb in builders) {
                TypeNodeBuilder tnb = nb as TypeNodeBuilder;
                if (tnb != null) {
                    TypeNodeBuilder other = (TypeNodeBuilder) bc [tnb.NodeDataType];
                    if (other != null)
                        throw new ApplicationException (string.Format ("The type node builder {0} can't be used in this context because the type {1} is already handled by {2}", nb.GetType(), tnb.NodeDataType, other.GetType()));
                    bc [tnb.NodeDataType] = tnb;
                }
                else if (!(nb is NodeBuilderExtension))
                    throw new InvalidOperationException (string.Format ("Invalid NodeBuilder type: {0}. NodeBuilders must inherit either from TypeNodeBuilder or NodeBuilderExtension", nb.GetType()));
            }

            NodeBuilders = builders;
            Title = label;
            Icon = icon;

            builderContext = new TreeBuilderContext (this);

            tree = new Gtk.TreeView ();

            /*
            0 -- Text
            1 -- Icon (Open)
            2 -- Icon (Closed)
            3 -- Node Data
            4 -- Builder chain
            5 -- Pango weight
            6 -- Expanded
            */
            store = new Gtk.TreeStore (typeof (string), typeof (Gdk.Pixbuf), typeof (Gdk.Pixbuf), typeof (object), typeof (object), typeof(int), typeof(bool));
            tree.Model = store;

            tree.EnableModelDragDest (target_table, Gdk.DragAction.Copy | Gdk.DragAction.Move);
            Gtk.Drag.SourceSet (tree, Gdk.ModifierType.Button1Mask, target_table, Gdk.DragAction.Copy | Gdk.DragAction.Move);

            store.DefaultSortFunc = new Gtk.TreeIterCompareFunc (CompareNodes);
            store.SetSortColumnId (/* GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID */ -1, Gtk.SortType.Ascending);

            tree.HeadersVisible = false;
            tree.SearchColumn = 0;
            tree.EnableSearch = true;
            complete_column = new Gtk.TreeViewColumn ();
            complete_column.Title = "column";

            Gtk.CellRendererPixbuf pix_render = new Gtk.CellRendererPixbuf ();
            complete_column.PackStart (pix_render, false);
            complete_column.AddAttribute (pix_render, "pixbuf", OpenIconColumn);
            complete_column.AddAttribute (pix_render, "pixbuf-expander-open", OpenIconColumn);
            complete_column.AddAttribute (pix_render, "pixbuf-expander-closed", ClosedIconColumn);

            text_render = new Gtk.CellRendererText ();
            text_render.Edited += new Gtk.EditedHandler (HandleOnEdit);

            complete_column.PackStart (text_render, true);
            complete_column.AddAttribute (text_render, "text", TextColumn);
            complete_column.AddAttribute (text_render, "weight", WeightColumn);

            tree.AppendColumn (complete_column);

            Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow ();
            sw.Add(tree);
            contentPanel = new Gtk.Frame ();
            contentPanel.Add(sw);

            tree.TestExpandRow += new Gtk.TestExpandRowHandler (OnTestExpandRow);
            tree.RowActivated += new Gtk.RowActivatedHandler(OnNodeActivated);

            contentPanel.ButtonReleaseEvent += new Gtk.ButtonReleaseEventHandler(OnButtonRelease);
            contentPanel.PopupMenu += new Gtk.PopupMenuHandler (OnPopupMenu);

            foreach (NodeBuilder nb in builders)
                nb.SetContext (builderContext);

            workNode = new TreeNodeNavigator (this);
            compareNode1 = new TreeNodeNavigator (this);
            compareNode2 = new TreeNodeNavigator (this);

            tree.DragBegin += new Gtk.DragBeginHandler (OnDragBegin);
            tree.DragDataReceived += new Gtk.DragDataReceivedHandler (OnDragDataReceived);
            tree.DragDrop += new Gtk.DragDropHandler (OnDragDrop);
            tree.DragEnd += new Gtk.DragEndHandler (OnDragEnd);
            tree.DragMotion += new Gtk.DragMotionHandler (OnDragMotion);

            tree.CursorChanged += new EventHandler (OnSelectionChanged);

            contentPanel.ShowAll ();
        }
示例#18
0
        public DecisionTree BuildConditionalTree(ITableData data, TreeOptions options)
        {
            var ret = new C45AlgorithmDataOptimized(TableFixedData.FromTableData(data), options);

            return(ret.BuildConditionalTree());
        }
示例#19
0
 public DecisionTree BuildConditionalTree(TableFixedData data, TreeOptions options,
     int[] attributes = null)
 {
     var ret = new C45AlgorithmDataOptimized(data, options);
     return ret.BuildConditionalTree(null, attributes);
 }
示例#20
0
 public TerrainGenerator(Terrain terrain, SplatmapOptions splatOptions, TreeOptions treeOptions)
 {
     this.splatOptions = splatOptions;
     this.treeOptions  = treeOptions;
     this.terrain      = terrain;
 }