IncludeOptions.java 2.24 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  javax.servlet.ServletRequest
 */
package com.day.cq.wcm.api.components;

import com.day.cq.wcm.api.Page;
import java.util.HashSet;
import java.util.Set;
import javax.servlet.ServletRequest;

public class IncludeOptions {
    public static String ATTR_NAME = IncludeOptions.class.getName();
    private Page currentPage;
    private boolean sameContext = false;
    private boolean forceEditContext = false;
    private String cellName;
    private Set<String> cssClassNames = new HashSet<String>();
    private String decorationTagName;

    public static IncludeOptions getOptions(ServletRequest req, boolean force) {
        IncludeOptions opts = (IncludeOptions)req.getAttribute(ATTR_NAME);
        if (opts == null && force) {
            opts = new IncludeOptions();
            req.setAttribute(ATTR_NAME, (Object)opts);
        }
        return opts;
    }

    public static IncludeOptions clear(ServletRequest req) {
        IncludeOptions opts = (IncludeOptions)req.getAttribute(ATTR_NAME);
        if (opts != null) {
            req.removeAttribute(ATTR_NAME);
        }
        return opts;
    }

    public IncludeOptions forceSameContext(boolean force) {
        this.sameContext = force;
        return this;
    }

    public boolean isSameContext() {
        return this.sameContext;
    }

    public IncludeOptions forceCurrentPage(Page currentPage) {
        this.currentPage = currentPage;
        return this;
    }

    public Page getCurrentPage() {
        return this.currentPage;
    }

    public IncludeOptions forceCellName(String cellName) {
        this.cellName = cellName;
        return this;
    }

    public String getCellName() {
        return this.cellName;
    }

    public Set<String> getCssClassNames() {
        return this.cssClassNames;
    }

    public boolean isForceEditContext() {
        return this.forceEditContext;
    }

    public void forceEditContext(boolean forceEditContext) {
        this.forceEditContext = forceEditContext;
    }

    public String getDecorationTagName() {
        return this.decorationTagName;
    }

    public void setDecorationTagName(String decorationTagName) {
        this.decorationTagName = decorationTagName;
    }
}