Class AbstractObjectRenderer

    • Field Detail

      • m_Cache

        protected static Hashtable<Class,​List<Class>> m_Cache
        the cache for object class / renderer relation.
      • m_Renderers

        protected static String[] m_Renderers
        the renderers (classnames) currently available.
      • m_RendererClasses

        protected static Class[] m_RendererClasses
        the renderers (classes) currently available.
    • Constructor Detail

      • AbstractObjectRenderer

        public AbstractObjectRenderer()
    • Method Detail

      • initRenderers

        protected static void initRenderers()
        Initializes the renderers.
      • getRenderer

        public static List<ObjectRenderer> getRenderer​(Object obj)
        Returns a renderer for the specified object.
        Parameters:
        obj - the object to get a commandline renderer for
        Returns:
        the renderer
      • instantiate

        protected static List<ObjectRenderer> instantiate​(List<Class> renderers)
        Instantiates the renderers.
        Parameters:
        renderers - the renderers to instantiate
        Returns:
        the instances
      • getRenderer

        public static List<ObjectRenderer> getRenderer​(Class cls)
        Returns a renderer for the specified class.
        Parameters:
        cls - the class to get a commandline renderer for
        Returns:
        the renderer
      • supportsLimit

        public boolean supportsLimit​(Object obj)
        Returns whether a limit is supported by the renderer.
        Default implementation returns false.
        Specified by:
        supportsLimit in interface ObjectRenderer
        Parameters:
        obj - the object to render
        Returns:
        true if supplying a limit has an effect
      • handles

        public abstract boolean handles​(Class cls)
        Checks whether the renderer can handle the specified class.
        Specified by:
        handles in interface ObjectRenderer
        Parameters:
        cls - the class to check
        Returns:
        true if the renderer can handle this type of object
      • doRender

        protected abstract String doRender​(Object obj,
                                           JPanel panel,
                                           Integer limit)
        Performs the actual rendering with a new renderer setup.
        Parameters:
        obj - the object to render
        panel - the panel to render into
        limit - the limit to use for the rendering (if applicable), ignored if null
        Returns:
        null if successful, otherwise error message
      • render

        public String render​(Object obj,
                             JPanel panel,
                             Integer limit)
        Renders the object with a new renderer setup.
        Specified by:
        render in interface ObjectRenderer
        Parameters:
        obj - the object to render
        panel - the panel to render into
        limit - the limit to use for the rendering (if applicable), ignored if null
        Returns:
        null if successful, otherwise error message
      • canRenderCached

        public boolean canRenderCached​(Object obj,
                                       JPanel panel)
        Checks whether the renderer can use a cached setup to render an object.
        Default implementation returns false.
        Specified by:
        canRenderCached in interface ObjectRenderer
        Parameters:
        obj - the object to render
        panel - the panel to render into
        Returns:
        true if possible
      • doRenderCached

        protected String doRenderCached​(Object obj,
                                        JPanel panel,
                                        Integer limit)
        Performs the actual rendering using a cached setup.
        Parameters:
        obj - the object to render
        panel - the panel to render into
        limit - the limit to use for the rendering (if applicable), ignored if null
        Returns:
        null if successful, otherwise error message
      • renderCached

        public String renderCached​(Object obj,
                                   JPanel panel,
                                   Integer limit)
        Renders the object using a cached setup (if available).
        Specified by:
        renderCached in interface ObjectRenderer
        Parameters:
        obj - the object to render
        panel - the panel to render into
        limit - the limit to use for the rendering (if applicable), ignored if null
        Returns:
        null if successful, otherwise error message
      • getRenderers

        public static String[] getRenderers()
        Returns a list with classnames of renderers.
        Returns:
        the renderer classnames