Interface PreviewModel


  • public interface PreviewModel
    The Preview Model contains all items and all preview properties.

    Items are the visual elements built from the Graph by ItemBuilder implementations and can be retrieved from this class. Each item has a type and default types are Item.NODE, Item.EDGE, Item.NODE_LABEL and Item.EDGE_LABEL.

    A preview model is attached to it's workspace and can be retrieved from the PreviewController.

    Author:
    Yudi Xue, Mathieu Bastian
    See Also:
    Item, Renderer
    • Method Detail

      • getProperties

        PreviewProperties getProperties()
        Returns the preview properties attached to this model.
        Returns:
        the preview properties
      • getItems

        Item[] getItems​(Object source)
        Returns all items attached to source.

        The source is the graph object behind the item (e.g. Node or Edge). Multiple items can be created from the same source object. For instance both Item.NODE and Item.NODE_LABEL have the node object as source.

        Parameters:
        source - the item's source
        Returns:
        all items with source as source
      • getItem

        Item getItem​(String type,
                     Object source)
        Returns the item attached to source and with the type type.

        The source is the graph object behind the item (e.g. Node or Edge) and the type a default or a custom type.

        Default types are Item.NODE, Item.EDGE, Item.NODE_LABEL and Item.EDGE_LABEL.

        Parameters:
        type - the item's type
        source - the item's source object
        Returns:
        the item or null if not found
      • getManagedRenderers

        ManagedRenderer[] getManagedRenderers()

        Returns currently managed renderers, or null.

        If managedRenderers is set to null, all renderers will be executed when rendering, in default implementation order.

        Returns:
        Enabled renderers or null
      • setManagedRenderers

        void setManagedRenderers​(ManagedRenderer[] managedRenderers)

        Sets an user-defined array of managed renderers to use when rendering.

        Only the renderers marked as enabled will be executed when rendering, and respecting the array order

        If the input array does not contain a managed renderer for some renderer existing implementation, a new not enabled managed renderer will be added to the end of the input array

        If managedRenderers is set to null, all renderers will be executed when rendering, in default implementation order.

        Parameters:
        managedRenderers - Managed renderers for future renderings
      • getManagedEnabledRenderers

        Renderer[] getManagedEnabledRenderers()
        Returns managedRenderers Renderers that are enabled, or null if managedRenderers is null.
        Returns:
        Enabled renderers or null
      • getGraphicsCanvasSize

        CanvasSize getGraphicsCanvasSize()
        Computes the graphics canvas size.
        Returns:
        the graphics canvas size