pl.edu.agh.cast.backward.figure.icons
Class AbstractNodeIconFactory

java.lang.Object
  extended by pl.edu.agh.cast.backward.figure.icons.AbstractNodeIconFactory
All Implemented Interfaces:
INodeIconFactory
Direct Known Subclasses:
CoreNodeIconFactory

public abstract class AbstractNodeIconFactory
extends Object
implements INodeIconFactory

Abstract factory for creating NodeIcons. It should be extended by factories provided to pl.edu.agh.cast.nodeIcons extension point. Classes that derive from this abstract class should only call init() when created.

Author:
AGH CAST Team

Constructor Summary
AbstractNodeIconFactory()
           
 
Method Summary
static NodeIcon createNodeIcon(Class location, String type, String name, String iconPath, String smallIconPath, String group)
          Creates node icon object.
 Collection<NodeIcon> getNodeIcons()
          Return collection of node icons provided by pl.edu.agh.cast.nodeIcons EP extender.
protected  void init(Class location, String[][] description)
          Initializes the factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractNodeIconFactory

public AbstractNodeIconFactory()
Method Detail

getNodeIcons

public Collection<NodeIcon> getNodeIcons()
Return collection of node icons provided by pl.edu.agh.cast.nodeIcons EP extender.

Specified by:
getNodeIcons in interface INodeIconFactory
Returns:
collection of node icons provided by EP extender
See Also:
INodeIconFactory.getNodeIcons()

init

protected void init(Class location,
                    String[][] description)
Initializes the factory. Creates NodeIcons according to provided location and description.

Parameters:
location - defines the base path for image file lookup (see org.eclipse.jface.resource.ImageDescriptor.createFromFile(Class, String) location parameter)
description - description of icons provided in a Nx5 String array, where N is the number of rows. Each row has to have 5 cells which fully describe a NodeIcon to be created. The cells should contain:
  1. The type of node the icon is for (by default). This should be a unique value.
  2. Localized display name of the icon
  3. Path to the icon large image file (relative to the location)
  4. Path to the icon small image file (relative to the location)
  5. Localized name of the group this icon is in. This parameter is used to group icons in editor tools, such as Palette's

createNodeIcon

public static NodeIcon createNodeIcon(Class location,
                                      String type,
                                      String name,
                                      String iconPath,
                                      String smallIconPath,
                                      String group)
Creates node icon object. If any of the specified images does not exist null is returned.

Parameters:
location - location of the icon image (see ImageDescriptor.createFromFile(Class, String))
type - type of the node this icon is for (see NodeIcon.NodeIcon(String, String, ImageDescriptor, ImageDescriptor, String))
name - localized icon display name (see NodeIcon.NodeIcon(String, String, ImageDescriptor, ImageDescriptor, String))
iconPath - name of the file containing the icon (see ImageDescriptor.createFromFile(Class, String))
smallIconPath - name of the file containing the small icon (see ImageDescriptor.createFromFile(Class, String))
group - localized name of the group this icon is in (see NodeIcon.NodeIcon(String, String, ImageDescriptor, ImageDescriptor, String))
Returns:
node icon


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.