GuideDatePicker.java 2.25 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  org.apache.sling.api.resource.ValueMap
 *  org.apache.sling.commons.json.io.JSONWriter
 */
package com.adobe.aemds.guide.common;

import com.adobe.aemds.guide.common.GuideField;
import com.adobe.aemds.guide.service.GuideException;
import java.io.StringWriter;
import java.io.Writer;
import org.apache.sling.api.resource.ValueMap;
import org.apache.sling.commons.json.io.JSONWriter;

public class GuideDatePicker
extends GuideField {
    public String getGuideFieldType() {
        return "guideDatePicker";
    }

    public String getDateInputOptions() {
        StringWriter jsonStringWriter = new StringWriter();
        JSONWriter writer = new JSONWriter((Writer)jsonStringWriter);
        try {
            writer.object();
            writer.key("dateFormat").value(this.resourceProps.get("dateDisplayFormat", (Object)"date{M/D/YYYY}"));
            writer.key("placeholderMonth").value((Object)this.externalize((String)this.resourceProps.get("placeholderMonth", (Object)"")));
            writer.key("placeholderDay").value((Object)this.externalize((String)this.resourceProps.get("placeholderDay", (Object)"")));
            writer.key("placeholderYear").value((Object)this.externalize((String)this.resourceProps.get("placeholderYear", (Object)"")));
            writer.key("labelMonth").value((Object)this.externalize((String)this.resourceProps.get("titleMonth", (Object)"")));
            writer.key("labelDay").value((Object)this.externalize((String)this.resourceProps.get("titleDay", (Object)"")));
            writer.key("labelYear").value((Object)this.externalize((String)this.resourceProps.get("titleYear", (Object)"")));
            writer.key("hideLabels").value((Object)this.checkIfDateInputTitleHidden());
            writer.endObject();
        }
        catch (Exception e) {
            throw new GuideException(e);
        }
        return jsonStringWriter.toString();
    }

    public Boolean checkIfDateInputTitleHidden() {
        return (Boolean)this.resourceProps.get("hideTitleDate", (Object)false);
    }

    public String getHeightOfDiv() {
        if (!this.checkIfDateInputTitleHidden().booleanValue()) {
            return "showDateInputLabels";
        }
        return "";
    }
}