田源
2025-01-16 404966637eda6881a0f17683c5aacc7c1c34aed8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
 * $Id: mxTerminalChangeCodec.java,v 1.1 2012/11/15 13:26:47 gaudenz Exp $
 * Copyright (c) 2006, Gaudenz Alder
 */
package com.mxgraph.io;
 
import java.util.Map;
 
import org.w3c.dom.Node;
 
import com.mxgraph.model.mxGraphModel.mxTerminalChange;
 
/**
 * Codec for mxChildChanges. This class is created and registered
 * dynamically at load time and used implicitely via mxCodec
 * and the mxCodecRegistry.
 */
public class mxTerminalChangeCodec extends mxObjectCodec
{
 
    /**
     * Constructs a new model codec.
     */
    public mxTerminalChangeCodec()
    {
        this(new mxTerminalChange(), new String[] { "model", "previous" },
                new String[] { "cell", "terminal" }, null);
    }
 
    /**
     * Constructs a new model codec for the given arguments.
     */
    public mxTerminalChangeCodec(Object template, String[] exclude,
            String[] idrefs, Map<String, String> mapping)
    {
        super(template, exclude, idrefs, mapping);
    }
 
    /* (non-Javadoc)
     * @see com.mxgraph.io.mxObjectCodec#afterDecode(com.mxgraph.io.mxCodec, org.w3c.dom.Node, java.lang.Object)
     */
    @Override
    public Object afterDecode(mxCodec dec, Node node, Object obj)
    {
        if (obj instanceof mxTerminalChange)
        {
            mxTerminalChange change = (mxTerminalChange) obj;
 
            change.setPrevious(change.getTerminal());
        }
 
        return obj;
    }
 
}