田源
2024-03-07 4b4083fd73dc27ece42f4835483565eef0e4f608
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package com.mxgraph.io;
 
import com.mxgraph.model.mxGraphModel.mxChildChange;
import com.mxgraph.model.mxICell;
import java.util.Map;
import java.util.Set;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
 
public class mxChildChangeCodec extends mxObjectCodec
{
  public mxChildChangeCodec()
  {
    this(new mxGraphModel.mxChildChange(), new String[] { "model", "child", "previousIndex" }, new String[] { "parent", "previous" }, null);
  }
 
  public mxChildChangeCodec(Object paramObject, String[] paramArrayOfString1, String[] paramArrayOfString2, Map<String, String> paramMap)
  {
    super(paramObject, paramArrayOfString1, paramArrayOfString2, paramMap);
  }
 
  public boolean isReference(Object paramObject1, String paramString, Object paramObject2, boolean paramBoolean)
  {
    if ((paramString.equals("child")) && (paramObject1 instanceof mxGraphModel.mxChildChange) && (((((mxGraphModel.mxChildChange)paramObject1).getPrevious() != null) || (!(paramBoolean)))))
      return true;
    return this.idrefs.contains(paramString);
  }
 
  public Node afterEncode(mxCodec parammxCodec, Object paramObject, Node paramNode)
  {
    if (paramObject instanceof mxGraphModel.mxChildChange)
    {
      mxGraphModel.mxChildChange localmxChildChange = (mxGraphModel.mxChildChange)paramObject;
      Object localObject = localmxChildChange.getChild();
      if (isReference(paramObject, "child", localObject, true))
        mxCodec.setAttribute(paramNode, "child", parammxCodec.getId(localObject));
      else
        parammxCodec.encodeCell((mxICell)localObject, paramNode, true);
    }
    return paramNode;
  }
 
  public Node beforeDecode(mxCodec parammxCodec, Node paramNode, Object paramObject)
  {
    if (paramObject instanceof mxGraphModel.mxChildChange)
    {
      mxGraphModel.mxChildChange localmxChildChange = (mxGraphModel.mxChildChange)paramObject;
      Object localObject;
      if ((paramNode.getFirstChild() != null) && (paramNode.getFirstChild().getNodeType() == 1))
      {
        paramNode = paramNode.cloneNode(true);
        localObject = paramNode.getFirstChild();
        localmxChildChange.setChild(parammxCodec.decodeCell((Node)localObject, false));
        Node localNode = ((Node)localObject).getNextSibling();
        ((Node)localObject).getParentNode().removeChild((Node)localObject);
        for (localObject = localNode; localObject != null; localObject = localNode)
        {
          localNode = ((Node)localObject).getNextSibling();
          if (((Node)localObject).getNodeType() == 1)
          {
            String str = ((Element)localObject).getAttribute("id");
            if (parammxCodec.lookup(str) == null)
              parammxCodec.decodeCell((Node)localObject, true);
          }
          ((Node)localObject).getParentNode().removeChild((Node)localObject);
        }
      }
      else
      {
        localObject = ((Element)paramNode).getAttribute("child");
        localmxChildChange.setChild((mxICell)parammxCodec.getObject((String)localObject));
      }
    }
    return ((Node)paramNode);
  }
 
  public Object afterDecode(mxCodec parammxCodec, Node paramNode, Object paramObject)
  {
    if (paramObject instanceof mxGraphModel.mxChildChange)
    {
      mxGraphModel.mxChildChange localmxChildChange = (mxGraphModel.mxChildChange)paramObject;
      ((mxICell)localmxChildChange.getChild()).setParent((mxICell)localmxChildChange.getPrevious());
      localmxChildChange.setPrevious(localmxChildChange.getParent());
      localmxChildChange.setPreviousIndex(localmxChildChange.getIndex());
    }
    return paramObject;
  }
}
 
/* Location:           C:\Users\platform-001\Desktop\新建文件夹 (2)\jgraphx.jar
 * Qualified Name:     com.mxgraph.io.mxChildChangeCodec
 * JD-Core Version:    0.5.3
 */