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

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

/*************************************************************************
 *
 * ADOBE CONFIDENTIAL
 * __________________
 *
 *  Copyright 2014 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 may be covered by U.S. and Foreign Patents,
 * patents in process, 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 com.adobe.aemds.guide.utils.GuideConstants;
import com.day.cq.wcm.foundation.forms.FormsHelper;

import javax.jcr.RepositoryException;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;


/**
 * GuideCheckBox encapsulates basic properties of the adaptive forms Check Box Component.
 * Few are listed below:
 * 
    *
  • Options of the check box configured during authoring *
  • Alignment of the check box configured during authoring *
* * @since 6.0 */ public class GuideCheckBox extends GuideField { @Override public String getLabelForId() throws RepositoryException { return getId(); } /** * Returns the options configured for the check box component during authoring * @return Map whose keys are the option values and the values are the text of corresponding option. */ public Map getOptions() { Map options = FormsHelper.getOptions(slingRequest, super.getResource()); if (options == null) { return null; } Map result = new LinkedHashMap(); Iterator keyset = options.keySet().iterator(); while(keyset.hasNext()) { String key = keyset.next(); String value = externalize(options.get(key)); result.put(key,value); } return result; } /** * Returns the values of options present in the checkbox component. * @return List representing the values of the options */ public List getValues() { return FormsHelper.getValuesAsList(slingRequest, super.getResource()); } /** * Returns the field type of the AEM Forms Component * @return String representing guide field type */ public String getGuideFieldType() { return GuideConstants.GUIDE_FIELD_CHECKBOXGROUP; } /** * Returns the alignment of the check box Component configured in authoring dialog * @return String representing alignment of the check box Component */ public String getAlignment() { return resourceProps.get("alignment", "guideFieldHorizontalAlignment"); } /** * Returns type of HTML input element to be used * @return {@link com.adobe.aemds.guide.utils.GuideConstants#GUIDE_FIELD_CHECK_INPUT_TYPE} */ public String getInputType() { return GuideConstants.GUIDE_FIELD_CHECK_INPUT_TYPE; } /** * Return the name of class that should be applied to checkbox item if the * type of appearance is checkbox * @return {@link com.adobe.aemds.guide.utils.GuideConstants#GUIDE_FIELD_CHECKBOX_ITEM} */ public String getItemClassName() { return GuideConstants.GUIDE_FIELD_CHECKBOX_ITEM; } /** * Returns the class based on appearance type that should be applied on the group * of check box items * @return {@link com.adobe.aemds.guide.utils.GuideConstants#GUIDE_FIELD_CHECKBOXGROUP_ITEMS} */ public String getItemsClass() { return GuideConstants.GUIDE_FIELD_CHECKBOXGROUP_ITEMS; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy