/*! * 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. */ sap.ui.define(['sap/ui/core/ValueStateSupport', 'sap/ui/core/library'], function(ValueStateSupport, coreLibrary) { "use strict"; // shortcut for sap.ui.core.TextDirection var TextDirection = coreLibrary.TextDirection; // shortcut for sap.ui.core.ValueState var ValueState = coreLibrary.ValueState; /** * ObjectStatus renderer. * @namespace */ var ObjectStatusRenderer = { }; /** * Renders the HTML for the given control, using the provided {@link sap.ui.core.RenderManager}. * * @param {sap.ui.core.RenderManager} oRm The RenderManager that can be used for writing to the render output buffer * @param {sap.ui.core.Control} oObjStatus An object representation of the control that should be rendered */ ObjectStatusRenderer.render = function(oRm, oObjStatus){ oRm.write(""); } else { var sState = oObjStatus.getState(); var sTextDir = oObjStatus.getTextDirection(); var bPageRTL = sap.ui.getCore().getConfiguration().getRTL(); if (sTextDir === TextDirection.Inherit) { sTextDir = bPageRTL ? TextDirection.RTL : TextDirection.LTR; } oRm.writeControlData(oObjStatus); var sTooltip = oObjStatus.getTooltip_AsString(); if (sTooltip) { oRm.writeAttributeEscaped("title", sTooltip); } oRm.addClass("sapMObjStatus"); oRm.addClass("sapMObjStatus" + sState); if (oObjStatus._isActive()) { oRm.addClass("sapMObjStatusActive"); oRm.writeAttribute("tabindex", "0"); oRm.writeAccessibilityState(oObjStatus, { role: "link" }); } oRm.writeClasses(); /* ARIA region adding the aria-describedby to ObjectStatus */ if (sState != ValueState.None) { oRm.writeAccessibilityState(oObjStatus, { describedby: { value: oObjStatus.getId() + "sapSRH", append: true } }); } oRm.write(">"); if (oObjStatus.getTitle()) { oRm.write(""); oRm.writeEscaped(oObjStatus.getTitle() + ":"); oRm.write(""); } if (oObjStatus._isActive()) { oRm.write(""); } if (oObjStatus.getIcon()) { oRm.write(""); oRm.renderControl(oObjStatus._getImageControl()); oRm.write(""); } if (oObjStatus.getText()) { oRm.write(""); oRm.writeEscaped(oObjStatus.getText()); oRm.write(""); } if (oObjStatus._isActive()) { oRm.write(""); } /* ARIA adding hidden node in span element */ if (sState != ValueState.None) { oRm.write(""); oRm.writeEscaped(ValueStateSupport.getAdditionalText(sState)); oRm.write(""); } } oRm.write(""); }; return ObjectStatusRenderer; }, /* bExport= */ true);