All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.adobe.aemds.guide.common.AbstractStyledFDField Maven / Gradle / Ivy

/*************************************************************************
 *
 * ADOBE CONFIDENTIAL
 * __________________
 *
 *  Copyright 2017 Adobe Systems Incorporated
 *  All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Adobe Systems Incorporated and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Adobe Systems Incorporated and its
 * suppliers and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 **************************************************************************/

package com.adobe.aemds.guide.common;


import javax.annotation.Nonnull;

import com.adobe.aemds.guide.utils.GuideConstants;
import com.adobe.aemds.guide.utils.GuideUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.sling.commons.json.JSONObject;
import org.osgi.annotation.versioning.ConsumerType;

import java.util.Map;

/**
 * Abstract implementation of a forms and document field component
 */
@ConsumerType
public abstract class AbstractStyledFDField extends AbstractFDField implements StyledFDField {

    /**
     * {@inheritDoc}
     */
    @Nonnull
    @Override
    public String getWidth() {
        return properties.get(GuideConstants.WIDTH, "");
    }

    /**
     * {@inheritDoc}
     */
    @Nonnull
    @Override
    public String getHeight() {
        return properties.get(GuideConstants.HEIGHT, "");
    }

    /**
     * {@inheritDoc}
     */
    @Nonnull
    @Override
    public String getCssClassName() {
        return properties.get(com.day.cq.wcm.foundation.forms.FormsConstants.ELEMENT_PROPERTY_CSS, "");
    }

    public String getAuthoringConfigJSON(){
        Map authoringConfig = new HashedMap();
        GuideUtils.setMasterAuthoringConfig(authoringConfig, resource.getValueMap());
        JSONObject authoringConfigJson =new JSONObject(authoringConfig);
        return authoringConfigJson.toString();
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy