/**
* @author Jonathan Jouret aka Dafooz
* @description Control creating rounded tiles
*/
// Register the control
jQuery.sap.declare("RoundedTile");
// Load the standard tile as this control inherits from it
jQuery.sap.require("sap.m.StandardTile");
// Extend the standard tile controller to create this control.
// The properties added are: the icon color, the background color and the border color
sap.m.StandardTile.extend("RoundedTile", {
metadata : {
properties : {
// Icon color property with default value to standard UI5 blue
iconColor : {
type : "string",
defaultValue : "#007cc0"
},
// Background color property with default value to white
bgColor : {
type : "string",
defaultValue : "rgb(255, 255, 255)"
},
// Border color property with default value to standard UI5 blue
borderColor : {
type : "string",
defaultValue : "#007cc0"
}
}
},
renderer : function(rm, oControl) {
rm.write("<div tabindex=\"0\""); // start div representing the tile
rm.writeControlData(oControl);
rm.addClass("roundedTile");
rm.addClass("sapMPointer");
rm.writeClasses();
rm.write(" style=\"border: 1px solid "+oControl.getBorderColor()+"; background-color: "+ oControl.getBgColor() +";\"");
if (oControl._invisible) {
rm.addStyle("visibility", "hidden");
rm.writeStyles();
}
var sTooltip = oControl.getTooltip_AsString();
if (sTooltip) {
rm.writeAttributeEscaped("title", sTooltip);
}
rm.write(">");
if (oControl.getRemovable()) {
rm.write("<div id=\"" + oControl.getId() + "-remove\" class=\"sapMTCRemove\"></div>");
} else {
rm.write("<div id=\"" + oControl.getId() + "-remove\" class=\"sapMTCNoRemove\"></div>");
}
rm.write("<div class=\"roundedTileContent\">");
rm.write("<div"); // Start top row
rm.addClass("roundedTileTopRow");
rm.writeClasses();
rm.write(">");
if (oControl.getIcon()) { //...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.