Articles and Tutorials

GSIconFactory

GSIconFactory is a convenience class that creates new icon instances by cloning prototypical icon instances it has been initialized with. Use the icon factory when an application has a larger number of icons that may be instantiated.

The make() method makes a deep copy of the named icon.

All methods of GSIconFactory should be called statically without attempting to instantiate the factory itself.

 

 
var icon = new GSIcon();
icon.imageSrc = "http://www.example.com/images/default.png";
icon.imageSize = new GSDimension(22, 16);
 
GSIconFactory.addIcon("defaultIcon", icon);
 
var iconCopy = GSIconFactory.make("defaultIcon");
Constructor Summary
GSIconFactory ()
            GSIconFactory should not be instantiated, all of its methods are called statically.
 
Method Summary
<static> void addIcon(<String> name, <GSIcon> icon)
           Adds an icon to the factory icon cache
<static> GSIcon make(<String> name)
           Called by client classes to create a new icon instance.
<static> void removeIcon(<String> name)
           Removes the named icon from the factory icon cache

Constructor Detail

GSIconFactory

GSIconFactory()
    GSIconFactory should not be instantiated, all of its methods are called statically.
Method Detail

addIcon

<static> void addIcon(<String> name, <GSIcon> icon)
    Adds an icon to the factory icon cache
  •  
      name - unique identifier for the type of icon that is to be added
      icon - the icon to add
  • Parameters:

make

<static> GSIcon make(<String> name)
    Called by client classes to create a new icon instance. The type of icon to be created by the factory is specified by the name parameter
  •  
      name - the named icon to create
  • Parameters:
  •  
      an instance of the named icon
  • Returns:

removeIcon

<static> void removeIcon(<String> name)
    Removes the named icon from the factory icon cache
  •  
      name - the name of the icon to remove
  • Parameters: