
com.adobe.aemds.guide.common.GuideSwitch Maven / Gradle / Ivy
/*******************************************************************************
* ADOBE CONFIDENTIAL
* ___________________
* Copyright 2016 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 all applicable intellectual property
* laws, including trade secret and copyright laws.
* 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 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 GuideSwitch extends GuideField {
/**
* 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, 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, getResource());
}
/**
* Returns the field type of the AEM Forms Component
* @return String representing guide field type
*/
public String getGuideFieldType() {
return GuideConstants.GUIDE_FIELD_SWITCH;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy