/*! * UI development toolkit for HTML5 (OpenUI5) * (c) Copyright 2009-2018 SAP SE or an SAP affiliate company. * Licensed under the Apache License, Version 2.0 - see LICENSE.txt. */ // Provides default renderer for control sap.ui.commons.CheckBox sap.ui.define(['jquery.sap.global', 'sap/ui/core/ValueStateSupport'], function(jQuery, ValueStateSupport) { "use strict"; /** * @author SAP SE * @namespace */ var CheckBoxRenderer = { }; /** * Renders the HTML for the CheckBox, using the provided {@link sap.ui.core.RenderManager}. * * @param {sap.ui.core.RenderManager} oRenderManager The RenderManager that is used for writing to the render output buffer. * @param {sap.ui.commons.CheckBox} oCheckBox The CheckBox control that should be rendered. */ CheckBoxRenderer.render = function(rm, oCheckBox) { rm.addClass("sapUiCb"); // Open the containing tag rm.write(""); // close the containing tag // Write the (potentially hidden) HTML checkbox element rm.write(""); // close checkbox-input-element // Write the checkbox label which also holds the background image rm.write(""); if (oCheckBox.getText()) { this.renderText(rm, oCheckBox.getText(), oCheckBox.getTextDirection()); } rm.write(""); // close the surrounding element rm.write(""); }; /** * Write the CheckBox label either flat or - in case the text direction is different from the environment - within a span tag with an explicit "dir". */ CheckBoxRenderer.renderText = function(oRenderManager, sText, eTextDirection) { var rm = oRenderManager; if (!eTextDirection || eTextDirection == sap.ui.core.TextDirection.Inherit) { rm.writeEscaped(sText); } else { rm.write(""); rm.writeEscaped(sText); rm.write(""); } }; return CheckBoxRenderer; }, /* bExport= */ true);