Пример #1
0
        public Field HandleEvents(Event currentEvent, Node node, out Field renamedField)
        {
            Field deletedField = null;
            renamedField = null;

            NodeSeparateFieldDrawer renamingDrawer = null;

            foreach (var drawer in _fieldToDrawer)
            {
                if (drawer.Value.IsRenaming)
                {
                    renamingDrawer = drawer.Value;
                    break;
                }
            }

            for (int i = 0; i < node.Fields.Count; i++)
            {
                var field = node.Fields[i];

                var fieldDrawer = _fieldToDrawer[field];
                if (renamingDrawer == null || renamingDrawer == fieldDrawer)
                {
                    bool hasSuccessfullyRenamedField;
                    
                    var isDeleted = _fieldToDrawer[field].HandleEvent(currentEvent, out hasSuccessfullyRenamedField);

                    deletedField = isDeleted ? field : deletedField;
                    renamedField = hasSuccessfullyRenamedField ? field : renamedField;
                }
            }

            return deletedField;
        }
Пример #2
0
 public NodeFieldsDrawer(Node node)
 {
     foreach (var nodeField in node.Fields)
     {
         _fieldToDrawer[nodeField] = new NodeSeparateFieldDrawer(nodeField);
     }
 }
Пример #3
0
 public void HandleFieldAddition(Field addedField, FieldTypeProviderProxy fieldTypeProviderProxy,
     Action<Field, Type> onFieldTypeChanged)
 {
     _fieldToDrawer[addedField] = new NodeSeparateFieldDrawer(addedField);
     _fieldToDrawer[addedField].OnRegister(fieldTypeProviderProxy, onFieldTypeChanged);
 }