Skip to content

Commit

Permalink
deprecate IconLib
Browse files Browse the repository at this point in the history
  • Loading branch information
jakub-g committed Mar 21, 2013
1 parent 5b30650 commit e448869
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/aria/widgets/IconLib.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
* limitations under the License.
*/

/* BACKWARD-COMPATIBILITY-BEGIN */
// This whole file should be removed in AT 1.5.1.
// Please also remove reference to it from urlmap.json and pom.xml
/**
* Aria Icon Library Definition. A store of sprites and an API to retrieve needed information. Also here is a cataloging
* mechanism that allows the contents of the library in the template. To include this, declare {@aria:IconLib()} inside
Expand All @@ -24,6 +27,7 @@ Aria.classDefinition({
$dependencies : ['aria.widgets.AriaLib'],
$singleton : true,
$constructor : function () {
this.$logError(this.CLASS_DEPRECATED);

// Internal library map where the sprites are stored.
this._sprites = {
Expand Down Expand Up @@ -141,13 +145,18 @@ Aria.classDefinition({
}
};
},
$statics : {
CLASS_DEPRECATED : "The aria.widgets.IconLib class is deprecated and will be removed in Aria Templates 1.5-1. Please remove any dependency on it."
},
$prototype : {
/**
* A method to register a user-defined custom sprite in the icon library.
* @param {Object} sprite
* @return {Boolean} returns whether the sprite was correctly registered.
*/
registerSprite : function (sprite) {
this.$logWarn(this.CLASS_DEPRECATED);

var icon;
// Verify that the sprite passed follows the schema
if (!sprite)
Expand Down Expand Up @@ -188,6 +197,8 @@ Aria.classDefinition({
* @return {Boolean} returns whether the sprite was found and correctly deleted.
*/
_deleteSprite : function (name) {
this.$logWarn(this.CLASS_DEPRECATED);

if (this._sprites[name]) {
delete(this._sprites[name]);
return true;
Expand All @@ -202,6 +213,8 @@ Aria.classDefinition({
* @return {Object|Boolean}
*/
getIcon : function (sprite, icon) {
this.$logWarn(this.CLASS_DEPRECATED);

var curSprite = this._sprites[sprite], iconContent, iconLeft = 0, iconTop = 0;
if (curSprite && (iconContent = curSprite.content[icon]) !== undefined) {
if (curSprite.biDimensional) {
Expand Down Expand Up @@ -233,6 +246,8 @@ Aria.classDefinition({
* @param {Object} out - the output stream where we can write to
*/
writeMarkup : function (out) {
this.$logWarn(this.CLASS_DEPRECATED);

var curSprite, iconLeft = 0, iconTop = 0, iconContent;
for (var sprite in this._sprites) {
curSprite = this._sprites[sprite];
Expand Down Expand Up @@ -265,3 +280,4 @@ Aria.classDefinition({
}
}
});
/* BACKWARD-COMPATIBILITY-END */

0 comments on commit e448869

Please sign in to comment.