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

bibliothek.gui.dock.extension.css.transition.CssTransitionCallback Maven / Gradle / Ivy

The newest version!
/*
 * Bibliothek - DockingFrames
 * Library built on Java/Swing, allows the user to "drag and drop"
 * panels containing any Swing-Component the developer likes to add.
 * 
 * Copyright (C) 2012 Benjamin Sigg
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 * 
 * Benjamin Sigg
 * [email protected]
 * CH - Switzerland
 */
package bibliothek.gui.dock.extension.css.transition;

import bibliothek.gui.dock.extension.css.CssProperty;
import bibliothek.gui.dock.extension.css.CssPropertyKey;
import bibliothek.gui.dock.extension.css.CssRule;
import bibliothek.gui.dock.extension.css.CssScheme;
import bibliothek.gui.dock.extension.css.CssType;

/**
 * Given to a {@link CssTransition}, allows the transition to access and modify properties.
 * @author Benjamin Sigg
 */
public interface CssTransitionCallback {
	/**
	 * Will call {@link CssTransition#step()} after a short delay.
	 * @see #step(int)
	 */
	public void step();
	
	/**
	 * Will call {@link CssTransition#step()} in about delay milliseconds. The call
	 * may happen a bit later because of other code that needs to executed first.
	 * @param delay the delay in milliseconds, at least 0. To save CPU time the delay
	 * should be at least 20 milliseconds.
	 */
	public void step( int delay );
	
	/**
	 * Called by a {@link CssTransition} if it is no longer in use, immediately releases all resources
	 * that were ever used by the transition.
	 */
	public void destroyed();
	
	/**
	 * Gets the scheme in whose realm the transition is working.
	 * @return the scheme, not null
	 */
	public CssScheme getScheme();
	
	/**
	 * Gets the unique identifiers of all the properties that are using type to convert
	 * {@link String}s into their values.
	 * @param type the type of the properties
	 * @return the unique identifiers of all properties using type
	 * @see CssProperty#getType(CssScheme)
	 */
	public  CssPropertyKey[] getPropertiesOfType( CssType type );
	
	/**
	 * Sets the value of some property. If using the wrong type an exception is thrown.
	 * @param type the type of the property
	 * @param key the unique identifier of the property
	 * @param value the new value of the property, may be null depending on the property
	 * @throws IllegalArgumentException if type does not match the type of the property, or if
	 * key does not point to a property at all
	 */
	public  void setProperty( CssType type, CssPropertyKey key, T value );
	
	/**
	 * Gets the value of some property, the value from the last call to {@link #setProperty(CssType, String, Object)}
	 * or from the root {@link CssRule} is returned.
	 * @param type the expected type of the value
	 * @param key the name of the property
	 * @return the value of the property
	 */
	public  T getProperty( CssType type, CssPropertyKey key );
	
	/**
	 * Adds property as dependency, the property will behave as if it would be long to the
	 * parent of the {@link CssTransition}. As source dependency the value of the property will be set using
	 * the old (source) {@link CssRule}.
	 * @param key the key of the property
	 * @param property the property to automatically set
	 */
	public void addSourceDependency( String key, CssProperty property );
	
	/**
	 * Removes the source dependency key.
	 * @param key the name of the property to remove
	 */
	public void removeSourceDependency( String key );
	

	/**
	 * Adds property as dependency, the property will behave as if it would be long to the
	 * parent of the {@link CssTransition}. As target dependency the value of the property will be set using
	 * the new (target) {@link CssRule}.
	 * @param key the key of the property
	 * @param property the property to automatically set
	 */
	public void addTargetDependency( String key, CssProperty property );
	
	/**
	 * Removes the target dependency key.
	 * @param key the name of the property to remove
	 */
	public void removeTargetDependency( String key );
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy