Interface CyCustomGraphicsFactory<T extends CustomGraphicLayer>


public interface CyCustomGraphicsFactory<T extends CustomGraphicLayer>
This interface provides the factory to create CyCustomGraphics objects. CyCustomGraphicsFactory objects should be registered as services in OSGi and will be used by Renderers to create the actual custom graphics implementations. Note that the type of a CyCustomGraphicsFactory is the type of the underlying CustomGraphicLayer not the type of the resulting CyCustomGraphics object this creates. In general, the pattern is to add to your CyActivator class:
        
                CyCustomGraphicsFactory myCustomGraphicsFactory = new MyCustomGraphicsFactory();
                registerService(bundleContext, myCustomGraphicsFactory, CyCustomGraphicsFactory.class, new Properties());
  

Cytoscape Backwards Compatibility (SPI Interface): We expect that this interface will be implemented. Therefore to maintain backwards compatibility this interface will only be modified for major version updates.

Module: presentation-api

To use this in your app, include the following dependency in your POM:

<dependency>
    <groupId>org.cytoscape</groupId>
    <artifactId>presentation-api</artifactId>
</dependency>
  • Method Details

    • getPrefix

      String getPrefix()
      Return the prefix to identify this custom graphics factory. This is used by the passthrough mapping logic to figure out if a given String value should be mapped to this factory.
      Returns:
      the prefix for this CyCustomGraphics
    • supportsMime

      boolean supportsMime(String mimeType)
      Given a mime type, return true if this CyCustomGraphicsFactory can utilize this type of data. If this factory doesn't support URL resources a tall, this should just always return false.
      Parameters:
      mimeType - the mime type string
      Returns:
      true if this mimeType is supported, false otherwise
    • getInstance

      CyCustomGraphics<T> getInstance(URL url)
      Get a new instance of the CyCustomGraphics based on pulling the data from a URL. If this CyCustomGraphics type doesn't support URLs, this should always return null.
      Parameters:
      url - the url that points to the CyCustomGraphics data
      Returns:
      the new instance, or null if URL references are not supported
    • getInstance

      CyCustomGraphics<T> getInstance(String input)
      Get a new instance of the CyCustomGraphics. The string argument may be used by some implementations to create the initial graphics objects. For example, a bitmap graphic implementation might use the input argument as a URI that gives the location of an image file. This is the method that will be used to take a String passthrough mapping and create the correct CyCustomGraphics instance. Note that the prefix defined above will get removed from the string before this method is called.
      Parameters:
      input - a possible input string that may be used to create the instance. Not all implementations will use this.
      Returns:
      the new instance
    • parseSerializableString

      CyCustomGraphics<T> parseSerializableString(String string)
      Create a new CyCustomGraphics object by parsing the string resulting from the toSerializableString() method. This method will be used to suport serialization of discrete mappings.
    • getSupportedClass

      Class<? extends CyCustomGraphics> getSupportedClass()
      Returns the class that this factory creates. This is used by the deserialization mechanism to find the factory method that can deserialize a given string.
    • getSupportedTargetTypes

      default Set<Class<? extends CyIdentifiable>> getSupportedTargetTypes()
      Returns all the target types supported by this factory, usually CyNode and CyColumn. Only CyNode is supported by default.
      Returns:
      A set containing all types supported by this factory and the CyCustomGraphics it creates.