Exemple #1
0
 public void AddNew_ListObject_WithInt()
 {
     Source.Source = new List <object> {
         1, 2, 3
     };
     Assert.IsInstanceOfType <object> (Editable.AddNew(), "#1");
 }
Exemple #2
0
 public void AddNew_ListObject_WithRectangles()
 {
     Source.Source = new List <object> {
         new Rectangle(), new Rectangle()
     };
     Assert.IsInstanceOfType <object> (Editable.AddNew(), "#1");
 }
Exemple #3
0
 public void AddNew_MyList_WithInt()
 {
     Source.Source = new MyList {
         1, 2, 3
     };
     Assert.Throws <InvalidOperationException> (() => Editable.AddNew(), "#1");
 }
Exemple #4
0
        public static void GetName()
        {
            var id1 = Id <TConnector> .Parse("505c9566-9b6c-481d-b667-106f347a293f");

            var id2 = Id <TConnector> .Parse("249f9ad5-d04f-4f21-aff2-1644ab697bbd");

            var id3 = Id <TConnector> .Parse("8287d64b-ab8b-495e-8331-d371e85121d1");

            ConnectorDefinitionData definition = new ConnectorDefinitionData("AsdasD", Id <TConnectorDefinition> .Parse("9fd8b8af-35f2-4d60-8533-45b065d02057"), new List <NodeData.ParameterData>()
            {
            }, ConnectorPosition.Bottom, false);
            var parent          = new Editable(Id <NodeTemp> .Parse("b0bdc6d1-7f0c-4e82-b4c3-c5e6d2f3686d"));
            var connectionRules = new GenericConnectionRules((a, b) => false);

            string name1 = "name1";
            string name2 = "name2";

            var parameters1 = new IParameter[] { new StringParameter("p1", ConnectorDefinitionData.OutputName, name1) };
            var parameters2 = new IParameter[] { new StringParameter("p2", Id <Parameter> .Parse("cb82f5b9-9ea8-4e05-b851-20392bca923a"), name2) };
            var parameters3 = new IParameter[] { new BooleanParameter("p3", Id <Parameter> .Parse("945c7cd9-1d0a-4291-a560-ea77d49b4c19"), "false") };

            Output o1 = new Output(id1, definition, parent, parameters1, connectionRules);
            Output o2 = new Output(id2, definition, parent, parameters2, connectionRules);
            Output o3 = new Output(id3, definition, parent, parameters3, connectionRules);

            Assert.That(o1.GetName(), Is.EqualTo(name1));
            Assert.That(o2.GetName(), Is.EqualTo(name2));
            Assert.That(o3.GetName(), Is.EqualTo(""));
        }
Exemple #5
0
        public void EventOrdering_CommitItem_Sorted()
        {
            var items = new List <Rectangle>()
            {
                new Rectangle {
                    Width = 0
                },
                new Rectangle {
                    Width = 1
                },
                new Rectangle {
                    Width = 3
                },
                new Rectangle {
                    Width = 4
                },
            };

            Source.Source           = items;
            View.CollectionChanged += (o, e) => CollectionChangedArgs.Add(e);
            View.SortDescriptions.Add(new SortDescription("Width", ListSortDirection.Ascending));

            Editable.AddNew();
            CollectionChangedArgs.Clear();
            Editable.CommitNew();

            Assert.AreEqual(2, CollectionChangedArgs.Count, "#1");

            Assert.AreEqual(NotifyCollectionChangedAction.Remove, CollectionChangedArgs[0].Action, "#2");
            Assert.AreEqual(4, CollectionChangedArgs[0].OldStartingIndex, "#3");

            Assert.AreEqual(NotifyCollectionChangedAction.Add, CollectionChangedArgs[1].Action, "#4");
            Assert.AreEqual(0, CollectionChangedArgs[1].NewStartingIndex, "#5");
        }
Exemple #6
0
        public static void AddEditableToPage(ParsePage page, ParseContext context, NameValueCollection attributes, string innerHtml)
        {
            var elementId = StringUtils.GetElementId();
            var editable  = new Editable
            {
                ElementId   = elementId,
                ElementName = context.ElementName,
                Attributes  = TranslateUtils.ToDictionary(attributes),
                InnerHtml   = innerHtml,
                StlElement  = StringUtils.Base64Encode(context.OuterHtml),
                IncludeFile = string.IsNullOrEmpty(page.IncludeFile)
                ? string.Empty
                : StringUtils.Base64Encode(page.IncludeFile),
                StartIndex = context.StartIndex,
                IsChanged  = false
            };

            page.Editables.Add(editable);

            attributes["data-element"]      = "true";
            attributes["data-element-id"]   = elementId;
            attributes["data-element-name"] = context.ElementName;
            if (StringUtils.EqualsIgnoreCase(context.ElementName, StlEditable.ElementName))
            {
                attributes["id"] = elementId;
                attributes["contenteditable"] = "true";
            }
        }
Exemple #7
0
        public static void ConstructionParameters()
        {
            var id1 = Id <TConnector> .Parse("505c9566-9b6c-481d-b667-106f347a293f");

            var id2 = Id <TConnector> .Parse("249f9ad5-d04f-4f21-aff2-1644ab697bbd");

            ConnectorDefinitionData definition1 = new ConnectorDefinitionData("AsdasD", Id <TConnectorDefinition> .Parse("9fd8b8af-35f2-4d60-8533-45b065d02057"), new List <NodeData.ParameterData>()
            {
            }, ConnectorPosition.Bottom, false);
            ConnectorDefinitionData definition2 = new ConnectorDefinitionData("asdasd", Id <TConnectorDefinition> .Parse("81efd7b0-91c6-4ce1-899e-9a342477a287"), new List <NodeData.ParameterData>()
            {
            }, ConnectorPosition.Bottom, false);
            var parent1 = new Editable(Id <NodeTemp> .Parse("b0bdc6d1-7f0c-4e82-b4c3-c5e6d2f3686d"));
            var parent2 = new Editable(Id <NodeTemp> .Parse("fa322980-9720-4bc5-923f-a543c5f83e0e"));

            var connectionRules1 = new GenericConnectionRules((a, b) => false);
            var connectionRules2 = new GenericConnectionRules((a, b) => true);

            var parameters1 = new IParameter[] { new StringParameter("asdsdad", Id <Parameter> .Parse("cb82f5b9-9ea8-4e05-b851-20392bca923a")) };
            var parameters2 = new IParameter[] { new BooleanParameter("dxhgdh", Id <Parameter> .Parse("945c7cd9-1d0a-4291-a560-ea77d49b4c19"), "false") };

            Output o1 = new Output(id1, definition1, parent1, parameters1, connectionRules1);
            Output o2 = new Output(id2, definition2, parent2, parameters2, connectionRules2);

            Assert.That(o1.Id, Is.EqualTo(id1));
            Assert.That(o2.Id, Is.EqualTo(id2));
            Assert.That(o1.Definition, Is.EqualTo(definition1));
            Assert.That(o2.Definition, Is.EqualTo(definition2));
            Assert.That(o1.Parameters, Is.EquivalentTo(parameters1));
            Assert.That(o2.Parameters, Is.EquivalentTo(parameters2));
            Assert.That(o1.Parent, Is.EqualTo(parent1));
            Assert.That(o2.Parent, Is.EqualTo(parent2));
            Assert.That(o1.Rules, Is.EqualTo(connectionRules1));
            Assert.That(o2.Rules, Is.EqualTo(connectionRules2));
        }
Exemple #8
0
            public override int Execute()
            {
                if (where is null)
                {
                    return(wheres.Length == 1 ? Simple() : Complex());
                }

                var parameters = new Dictionary <string, object>();

                string sql = string.Join(";", this.GroupBy(item =>
                {
                    var limits = where.Invoke(item);

                    if (limits.Length == 0)
                    {
                        throw new DException("未指定删除条件!");
                    }

                    var columns = typeRegions.ReadWrites
                                  .Where(x => limits.Any(y => y == x.Key) || limits.Any(y => y == x.Value))
                                  .ToList();

                    if (columns.Count == 0)
                    {
                        throw new DException("未指定删除条件!");
                    }

                    return(columns);
                }).Select((item, index) =>
                {
                    return(item.Key.Count == 1 ? Simple(item.Key.First(), item, index.ToString(), parameters) : Complex(item.Key, item, index.ToString(), parameters));
                }));

                return(Editable.Excute(sql, parameters));
            }
 public EditableInsertAction (Editable editable, int start, string text, int length)
 {
     this.editable = editable;
     this.text = text;
     this.index = start;
     this.is_paste = length > 1;
 }
Exemple #10
0
 public EditableInsertAction(Editable editable, int start, string text, int length)
 {
     this.editable = editable;
     this.text     = text;
     index         = start;
     is_paste      = length > 1;
 }
Exemple #11
0
    internal void Launch(EditableData editableData)
    {
        GameHead.instance.EnterGameState(GameState.Preview);

        Editable editable = ModuleHead.instance.Spawn(editableData);

        editable.OnAttach(UserHead.instance.localUsers[0]);
    }
Exemple #12
0
        private void SwitchToEditingMode()
        {
            Editable.Visibility    = Visibility.Visible;
            NonEditable.Visibility = Visibility.Collapsed;

            Editable.Focus(FocusState.Programmatic);
            Editable.SelectAll();
        }
Exemple #13
0
        public void AddNew_Twice()
        {
            var o1 = Editable.AddNew();
            var o2 = Editable.AddNew();

            Assert.IsTrue(Items.Contains(o1), "#1");
            Assert.IsTrue(Items.Contains(o2), "#2");
        }
Exemple #14
0
 public void UndoItemChanges(Editable <TElement> item)
 {
     item.UndoChanges();
     if (_inserted.Contains(item))
     {
         _inserted.Remove(item);
     }
 }
 public EditableEraseAction (Editable editable, int start, int end)
 {
     this.editable = editable;
     this.text = editable.GetChars (start, end);
     this.start = start;
     this.end = end;
     this.is_cut = end - start > 1;
     this.is_forward = editable.Position < start;
 }
 public EditableEraseAction(Editable editable, int start, int end)
 {
     this.editable   = editable;
     this.text       = editable.GetChars(start, end);
     this.start      = start;
     this.end        = end;
     this.is_cut     = end - start > 1;
     this.is_forward = editable.Position < start;
 }
        protected EditableTreeNode(EditableEnvironment env, MultiEditable <T> dest, string title)
        {
            Env   = env;
            Dest  = null;
            Tag   = CreateSelectObject(dest);
            Title = title;

            SetupCommon();
        }
Exemple #18
0
        private void DataGrid_OnAutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
        {
            var attri = new Editable();

            if (((PropertyDescriptor)e.PropertyDescriptor).Attributes.Contains(attri) == false)
            {
                e.Cancel = true;
            }
        }
Exemple #19
0
    internal void Launch(UniverseData universeData)
    {
        GameHead.instance.universeData = universeData;
        GameHead.instance.EnterGameState(GameState.Runtime);

        Editable editable = ModuleHead.instance.Spawn(universeData.maps[0]);

        editable.OnAttach(UserHead.instance.localUsers[0]);
    }
Exemple #20
0
        public void AddNew_ActuallyAdded()
        {
            var orig = new List <object> (Items);

            var o = Editable.AddNew();

            Assert.AreEqual(orig.Count + 1, Items.Count, "#1");
            Assert.IsFalse(orig.Contains(o), "#2");
        }
Exemple #21
0
        public void CommitEdit_SelectsNextElement()
        {
            View.MoveCurrentToFirst();
            Editable.EditItem(View.CurrentItem);

            Assert.AreEqual(0, View.CurrentPosition, "#1");
            Editable.CommitEdit();
            Assert.AreEqual(0, View.CurrentPosition, "#2");
        }
Exemple #22
0
        public void AddNew_Twice_CancelAdd()
        {
            var o1 = Editable.AddNew();
            var o2 = Editable.AddNew();

            Editable.CancelNew();
            Assert.IsTrue(Items.Contains(o1), "#1");
            Assert.IsFalse(Items.Contains(o2), "#2");
        }
        protected EditableTreeNode(EditableEnvironment env, T data, object tag, Editable <T> dest, string title)
        {
            Env   = env;
            Data  = data;
            Dest  = dest;
            Tag   = tag;
            Title = title;

            SetupCommon();
        }
Exemple #24
0
        public void AddNew_DoesNotRegenerateGroups()
        {
            var groups = View.Groups;

            Editable.AddNew();
            Assert.AreSame(groups, View.Groups, "#1");

            Editable.CommitNew();
            Assert.AreSame(groups, View.Groups, "#2");
        }
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("Deletable=" + Deletable.ToString());
            sb.AppendLine("Editable=" + Editable.ToString());
            sb.AppendLine("Renamable=" + Renamable.ToString());

            return(sb.ToString());
        }
Exemple #26
0
    internal Editable Spawn(EditableData editableData)
    {
        GameObject gameObject = Instantiate(GetModulePrefab(editableData.GetType()).gameObject, _components.objectsContainer);
        Editable   editable   = gameObject.GetComponent <Editable>();

        gameObject.name = editableData.name;
        editable.PopulateData(editableData);
        _components.idEditableMap.Add(editableData.id, editable);
        return(editable);
    }
Exemple #27
0
    internal void Edit(UniverseData universeData, EditableData editableData)
    {
        GameHead.instance.universeData = universeData;
        this.editableData = editableData;


        GameHead.instance.EnterGameState(GameState.Editor);

        editable = ModuleHead.instance.Spawn(editableData);
        editable.transform.position = Vector3.zero;
    }
Exemple #28
0
        public static NameValueCollection GetEditableAttributes(Editable editable)
        {
            var attributes = new NameValueCollection(StringComparer.OrdinalIgnoreCase)
            {
                ["data-element"]      = "true",
                ["data-element-id"]   = editable.Id,
                ["data-element-name"] = editable.ElementName
            };

            return(attributes);
        }
Exemple #29
0
        protected override void Serialize(IDictionary <string, object> json)
        {
            var idPrefix = "#";

            if (!string.IsNullOrEmpty(Title))
            {
                json["title"] = Title;
            }

            string viewType = Type.ToString();

            json["type"] = Char.ToLowerInvariant(viewType[0]) + viewType.Substring(1);

            if (Editable != null)
            {
                if (Editable.Enabled == false)
                {
                    json["editable"] = false;
                }
                else if (Editable.ToJson().Count > 0)
                {
                    json["editable"] = Editable.ToJson();
                }
            }

            if (!string.IsNullOrEmpty(EventTemplate))
            {
                json["eventTemplate"] = EventTemplate;
            }

            if (!string.IsNullOrEmpty(EventTemplateId))
            {
                json["eventTemplate"] = new ClientHandlerDescriptor {
                    HandlerName = String.Format("kendo.template($('{0}{1}').html())", idPrefix, EventTemplateId)
                };
            }

            if (!string.IsNullOrEmpty(SelectedDateFormat))
            {
                json["selectedDateFormat"] = SelectedDateFormat;
            }

            if (Selected != false)
            {
                json["selected"] = Selected;
            }

            var group = Group.ToJson();

            if (group.Count > 0)
            {
                json["group"] = group;
            }
        }
Exemple #30
0
        public async Task <HttpResponseMessage> UpdateFeaturette(int id, [FromBody] Editable editable)
        {
            var result = await context.Entity <Editable>().Where(x => x.id == id).FirstOrDefaultAsync();

            result.content = editable.content;

            context.Entry(result).State = EntityState.Modified;
            context.SaveChanges();

            return(new HttpResponseMessage(HttpStatusCode.OK));
        }
        public void LoadConfiguration(Editable configuration)
        {
            // open workspace first
            if (string.IsNullOrWhiteSpace(WorkingDirectory))
            {
                OpenWorkspace(Path.GetDirectoryName(configuration.FullPath));
            }

            // set active configuration
            ActiveConfiguration = configuration;
        }
Exemple #32
0
        public void AddNew_CancelAdd()
        {
            var o1 = Editable.AddNew();

            Assert.IsTrue(Editable.IsAddingNew, "#1");
            Assert.IsTrue(Items.Contains(o1), "#2");

            Editable.CancelNew();
            Assert.IsFalse(Editable.IsAddingNew, "#3");
            Assert.IsFalse(Items.Contains(o1), "#4");
        }
			public override void afterTextChanged(Editable s)
			{
			}
 // Use this for initialization
 void Start()
 {
     parent_script = transform.parent.gameObject.GetComponent<Editable>();
 }
 public void afterTextChanged(Editable value)
 {
     yield(value);
 }