All Downloads are FREE. Search and download functionalities are using the official Maven repository.

bibliothek.gui.dock.common.theme.CDockThemeFactory Maven / Gradle / Ivy

Go to download

DockingFrames is an open source Java Swing docking framework, licenced under LGPL 2.1. This is the same distribution as the original distribution (http://www.docking-frames.org/), only reinstalled in maven

There is a newer version: 1.1.2p20b.fix-1
Show newest version
package bibliothek.gui.dock.common.theme;

import bibliothek.gui.DockController;
import bibliothek.gui.DockTheme;
import bibliothek.gui.dock.common.CControl;
import bibliothek.gui.dock.themes.ThemeFactory;
import bibliothek.gui.dock.themes.ThemeMeta;
import bibliothek.gui.dock.themes.ThemePropertyFactory;

/**
 * A factory that envelops another factory in order to build a 
 * CX-theme instead of a X-theme.
 * @author Benjamin Sigg
 *
 * @param  the kind of theme that gets wrapped up
 */
public  abstract class CDockThemeFactory implements ThemeFactory{
    private ThemePropertyFactory delegate;
    private CControl control;
    
    /**
     * Creates a new factory.
     * @param delegate the factory that should be used as delegate to create
     * the initial {@link DockTheme}.
     * @param control the control for which this factory will work
     */
    public CDockThemeFactory( ThemePropertyFactory delegate, CControl control ){
        this.delegate = delegate;
        this.control = control;
    }
    
    /**
     * Gets the control for which this factory works.
     * @return the control
     */
    public CControl getControl() {
        return control;
    }
    
    public DockTheme create( DockController controller ) {
    	if( control.getController() != controller ){
    		throw new IllegalArgumentException( "the supplied controller does not match the CControl" );
    	}
        return create( control );
    }
    
    /**
     * Creates a new theme.
     * @param control the control in whose realm the theme will be used
     * @return the new theme
     */
    public abstract DockTheme create( CControl control );
    
    public ThemeMeta createMeta( DockController controller ){
	    ThemeMeta meta = delegate.createMeta( controller );
	    meta.setFactory( this );
	    return meta;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy