001    /**
002     * Copyright (c) 2009, Piet Blok
003     * All rights reserved.
004     *
005     * Redistribution and use in source and binary forms, with or without
006     * modification, are permitted provided that the following conditions
007     * are met:
008     *
009     *   * Redistributions of source code must retain the above copyright
010     *     notice, this list of conditions and the following disclaimer.
011     *   * Redistributions in binary form must reproduce the above
012     *     copyright notice, this list of conditions and the following
013     *     disclaimer in the documentation and/or other materials provided
014     *     with the distribution.
015     *   * Neither the name of the copyright holder nor the names of the
016     *     contributors may be used to endorse or promote products derived
017     *     from this software without specific prior written permission.
018     *
019     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
020     * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
021     * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
022     * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
023     * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
024     * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
025     * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
026     * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
027     * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
028     * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
029     * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
030     */
031    
032    package org.pbjar.jxlayer.repaint;
033    
034    import javax.swing.RepaintManager;
035    
036    import org.jdesktop.swingx.ForwardingRepaintManager;
037    
038    /**
039     * To be implemented by classes that provide for a custom RepaintManager.
040     * 
041     * @see RepaintManagerUtils
042     * @author Piet Blok
043     */
044    public interface RepaintManagerProvider {
045        /**
046         * Get the class of a {@link RepaintManager} that extends
047         * {@link ForwardingRepaintManager}.
048         * <p>
049         * <b>Note:</b> the class must provide for a public constructor that takes a
050         * delegate {@link RepaintManager} as its only argument.
051         * </p>
052         * 
053         * @return a class object
054         */
055        public abstract Class<? extends ForwardingRepaintManager> getForwardingRepaintManagerClass();
056    
057        /**
058         * Get the class of a {@link RepaintManager} that extends
059         * {@link WrappedRepaintManager}.
060         * <p>
061         * <b>Note:</b> the class must provide for a public constructor that takes a
062         * delegate {@link RepaintManager} as its only argument.
063         * </p>
064         * 
065         * @return a class object
066         */
067        public abstract Class<? extends WrappedRepaintManager> getWrappedRepaintManagerClass();
068    
069        /**
070         * Checks whether or not the argument class is a {@link RepaintManager}
071         * class that will do the required job.
072         * 
073         * @param rpm
074         *            a {@link RepaintManager} class
075         * @return {@code true} if the argument class will do the required job,
076         *         {@code false} otherwise
077         */
078        public boolean isAdequate(Class<? extends RepaintManager> rpm);
079    
080    }