Exemple #1
0
        /// <summary>
        /// modelとfigureのmementoを格納したtupleを返す.
        /// 子孫は格納しない.
        /// </summary>
        private static TransferContent CreateTransferContentOnly(IEditor editor, Externalizer externalizer)
        {
            var modelMem = editor.Controller.GetModelMemento();

            var figClone = editor.Figure.CloneFigureOnly();

            foreach (var childfig in editor.Figure.Children)
            {
                /// editor parts figure (= editor figureでないfigure)のみ追加
                if (childfig.GetRole() != EditorConsts.EditorFigureFigureRole)
                {
                    var childClone = childfig.CloneFigure(null);
                    figClone.Children.Add(childClone);
                    var constraint = editor.Figure.GetLayoutConstraint(childfig);
                    if (constraint != null)
                    {
                        figClone.SetLayoutConstraint(childClone, constraint);
                    }
                }
            }
            var figMem = externalizer.Save(figClone);

            var id = Guid.NewGuid().ToString();

            return(new TransferContent(
                       id,
                       editor.Controller.ModelDescriptor,
                       modelMem,
                       figMem,
                       editor.Controller.GetTransferInitializer(),
                       editor.Controller.GetTranserInitArgs()
                       ));
        }
Exemple #2
0
        public override IMemento GetModelMemento()
        {
            var externalizer = new Externalizer();

            //return externalizer.Save(Model, (key, obj) => key == "Rows");
            return(externalizer.Save(Model));
        }
        public IFigure CloneFigure(ExternalizableFilter filter)
        {
            var persister = new Externalizer();
            var mem       = persister.Save(this, filter);

            return(persister.Load(mem, null) as IFigure);
        }
Exemple #4
0
        public override IMemento GetModelMemento()
        {
            var externalizer = new Externalizer();
            var ex           = new MemoTableCellReplacingExternalizable();

            ex.Editor = Host;
            return(externalizer.Save(ex, null));
        }
Exemple #5
0
        public override IMemento GetModelMemento()
        {
            var externalizer = new Externalizer();

            return(externalizer.Save(
                       Model,
                       (key, obj) => key == "SourceMemberEnd" || key == "TargetMemberEnd"
                       ));
        }
        public void TestNodeFigurePersist()
        {
            var persister = new Externalizer();
            var node      = new SimpleRect();

            node.Bounds = new Rectangle(0, 0, 100, 100);
            IMemento mem = persister.Save(node);

            var onode = persister.Load(mem) as IConnectable;

            Assert.AreNotEqual(node, onode);
            Assert.AreEqual(new Rectangle(0, 0, 100, 100), onode.Bounds);
        }
Exemple #7
0
        public override IMemento GetModelMemento()
        {
            var externalizer = new Externalizer();

            return(externalizer.Save(Model, (key, obj) => false));
        }
Exemple #8
0
        public override IMemento GetModelMemento()
        {
            var externalizer = new Externalizer();

            return(externalizer.Save(new UmlAttributeCollectionReplacingExternalizable(), null));
        }