ch.randelshofer.quaqua.BrowserPreviewRenderer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Quaqua Show documentation
Show all versions of Quaqua Show documentation
A Mavenisation of the Quaqua Mac OSX Swing Look and Feel (Java library)
Quaqua Look and Feel (C) 2003-2010, Werner Randelshofer.
Mavenisation by Matt Gumbley, DevZendo.org - for problems with
Mavenisation, see Matt; for issues with Quaqua, see the Quaqua home page.
For full license details, see http://randelshofer.ch/quaqua/license.html
The newest version!
/*
* @(#)BrowserPreviewRenderer.java
*
* Copyright (c) 2005-2010 Werner Randelshofer, Immensee, Switzerland.
* All rights reserved.
*
* You may not use, copy or modify this file, except in compliance with the
* license agreement you entered into with Werner Randelshofer.
* For details see accompanying license terms.
*/
package ch.randelshofer.quaqua;
import java.awt.*;
import javax.swing.tree.*;
/**
* 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;
* }
* }
*
*
* @author Werner Randelshofer
* @version $Id: BrowserPreviewRenderer.java 361 2010-11-21 11:19:20Z wrandelshofer $
*/
public interface BrowserPreviewRenderer {
/**
* Return a component that has been configured to display the specified
* value. That component is then added to the preview column of the JBrowser.
*
* @param browser The JBrowser we're painting.
* @param paths The paths returned by browser.getSelectionPaths(). This
* is granted to be a non-null array containing at least one element.
*
*/
public Component getPreviewRendererComponent(
JBrowser browser,
TreePath[] paths
);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy