Below is the code written in custom control
jQuery.sap.declare("customControls.controls.StatusButton");
jQuery.sap.require("sap.m.Button");
jQuery.sap.require("sap.ui.core.Control");
jQuery.sap.require("sap.ui.core.IconPool");
jQuery.sap.require("sap.ui.core.Icon");
sap.m.Button.extend("customControls.controls.StatusButton",{
metadata:{
library:"customControls.controls",
properties:{
id : { status : {type : "string"},},
backgroundcolor : {type: "sap.ui.core.CSSColor",},
color : {type : "sap.ui.core.CSSColor",},
status : {type : "string"},
activity : {type :"string"},
},
aggregations : {
statusIcon : {
type : "sap.ui.core.Icon",
multiple : false,
},
icon : {
type : "sap.ui.core.Icon",
multiple : false,
}
},
events : {
"press" : {}
}
},
init : function(){
},
renderer: function(oRm , oControl){
oRm.write("<button id='");
oRm.write(oControl.getId());
oRm.write("'");
oRm.addClass("sapMBtn sapMBtnBase");
oRm.writeClasses();
oRm.write(">");
oRm.write("<div '");
oRm.addClass("sapMBtnDefault sapMBtnHoverable sapMBtnInner sapMBtnText sapMFocussable");
oRm.writeClasses();
oRm.addStyle("background", oControl.getBackgroundcolor());
oRm.addStyle("color", oControl.getColor());
oRm.addStyle("background-image", "none");
oRm.writeStyles();
oRm.write(">");
oRm.write("<span");
oRm.addClass("sapMBtnContent");
oRm.writeClasses();
oRm.write(">");
oRm.renderControl(oControl.getAggregation("statusIcon"));
orm.write(oControl.getText());
oRm.renderControl(oControl.getAggregation("icon"));
oRm.write("</span>");
oRm.write("</div>");
oRm.write("</button>");
},
/* onAfterRendering: function (oRm, OButton){
oRm.addStyle("background", OButton.getBackgroundcolor());
oRm.addStyle("color", OButton.getColor());
oRm.writeStyles();
},
*/
onclick : function(evt) {
this.firePress();
},
});