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

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

public abstract class AbstractNodeIconFactory
extends java.lang.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:
tmilos

Constructor Summary
AbstractNodeIconFactory()
           
 
Method Summary
static NodeIcon createNodeIcon(java.lang.Class location, java.lang.String type, java.lang.String name, java.lang.String iconPath, java.lang.String smallIconPath, java.lang.String group)
          Creates node icon object.
 java.util.Collection<NodeIcon> getNodeIcons()
           
protected  void init(java.lang.Class location, java.lang.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 java.util.Collection<NodeIcon> getNodeIcons()
Specified by:
getNodeIcons in interface INodeIconFactory
Returns:
collection of node icons provided by EP extender

init

protected void init(java.lang.Class location,
                    java.lang.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(java.lang.Class location,
                                      java.lang.String type,
                                      java.lang.String name,
                                      java.lang.String iconPath,
                                      java.lang.String smallIconPath,
                                      java.lang.String group)
Creates node icon object. If any of the specified images does not exist null is returned.

Parameters:
location -
type -
name -
iconPath -
smallIconPath -
group -
Returns:


Copyright © 2007-2008 AGH University of Science and Technology. All Rights Reserved.