RectangleValue.java 2.5 KB
/*
 * Decompiled with CFR 0_118.
 */
package com.adobe.xfa.content;

import com.adobe.xfa.AppModel;
import com.adobe.xfa.Element;
import com.adobe.xfa.Model;
import com.adobe.xfa.Node;
import com.adobe.xfa.XFA;
import com.adobe.xfa.content.Content;
import org.xml.sax.Attributes;

public final class RectangleValue
extends Content {
    public RectangleValue(Element parent, Node prevSibling) {
        super(parent, prevSibling, null, "rectangle", "rectangle", null, XFA.RECTANGLETAG, "rectangle");
    }

    @Override
    public boolean equals(Object obj) {
        return this == obj;
    }

    @Override
    public int hashCode() {
        return System.identityHashCode(this);
    }

    @Override
    protected Node defaultElementImpl(int eTag, int nOccurrence, boolean bAppend) {
        if (eTag == XFA.SCHEMA_DEFAULTTAG) {
            eTag = this.defaultElement();
        }
        if (eTag == XFA.SCHEMA_DEFAULTTAG) {
            return null;
        }
        Element e = null;
        if (nOccurrence == 0) {
            String className = XFA.getString(eTag);
            RectangleValue parent = bAppend ? this : null;
            e = this.getModel().createElement(parent, null, null, className, className, null, 0, null);
        } else if (nOccurrence == 1) {
            Element source;
            e = bAppend ? this.getElement(eTag, false, 0, false, false).clone(this, true) : ((source = this.getElement(eTag, true, 0, false, false)) != null ? source.clone(null, true) : this.getModel().createElement(eTag, null));
        } else if (nOccurrence == 2) {
            if (bAppend) {
                this.getElement(eTag, false, 1, false, false);
                e = this.getElement(eTag, false, 0, false, false).clone(this, true);
            } else {
                Element source = this.getElement(eTag, true, 0, false, false);
                e = source != null ? source.clone(null, true) : this.getModel().createElement(eTag, null);
            }
        } else if (nOccurrence == 3 || this.getAppModel().getLegacySetting(AppModel.XFA_LEGACY_V27_SCRIPTING)) {
            if (bAppend) {
                this.getElement(eTag, false, 2, false, false);
                return this.getElement(eTag, false, 1, false, false).clone(this, true);
            }
            Element source = this.getElement(eTag, true, 0, false, false);
            e = source != null ? source.clone(null, true) : this.getModel().createElement(eTag, null);
        }
        if (e != null) {
            e.isTransient(true, true);
        }
        return e;
    }
}