Quaqua 8.0 2011-10-02

ch.randelshofer.quaqua
Interface BrowserPreviewRenderer

All Known Implementing Classes:
FilePreview

public interface BrowserPreviewRenderer

Identifies components that can be used to paint the preview column in a JBrowser. Unlike other renderers, this one is not just used for a rubber stamp. The renderer is added to the preview column of the JBrowser.

For example, to use a JLabel as a BrowserPreviewRenderer, you would write something like this:

 class MyPreviewRenderer extends JLabel implements BrowserPreviewRenderer {
     public MyPreviewRenderer() {
         setOpaque(true);
     }
     public Component getPreviewRendererRendererComponent(
         JBrowser browser,
         TreePath[] paths
         )
     {
         setText((paths.length == 1) 
            ? values[0].getLastPathComponent().toString() 
            : values.length+" items");
         return this;
     }
 }
 

Version:
$Id: BrowserPreviewRenderer.java 361 2010-11-21 11:19:20Z wrandelshofer $
Author:
Werner Randelshofer

Method Summary
 java.awt.Component getPreviewRendererComponent(JBrowser browser, javax.swing.tree.TreePath[] paths)
          Return a component that has been configured to display the specified value.
 

Method Detail

getPreviewRendererComponent

java.awt.Component getPreviewRendererComponent(JBrowser browser,
                                               javax.swing.tree.TreePath[] paths)
Return a component that has been configured to display the specified value. That component is then added to the preview column of the JBrowser.

Parameters:
browser - The JBrowser we're painting.
paths - The paths returned by browser.getSelectionPaths(). This is granted to be a non-null array containing at least one element.

Copyright 2003-2007 (c) Werner Randelshofer.
All rights reserved.