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

bibliothek.gui.dock.ExpandableToolbarItemStrategy Maven / Gradle / Ivy

There is a newer version: 1.1.2p6a
Show 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 Herve Guillaume, 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
 * 
 * Herve Guillaume
 * [email protected]
 * FR - France
 *
 * Benjamin Sigg
 * [email protected]
 * CH - Switzerland
 */

package bibliothek.gui.dock;

import bibliothek.gui.DockController;
import bibliothek.gui.Dockable;
import bibliothek.gui.dock.toolbar.expand.DefaultExpandableToolbarItemStrategy;
import bibliothek.gui.dock.toolbar.expand.DisabledExpandableToolbarItemStrategy;
import bibliothek.gui.dock.toolbar.expand.ExpandableToolbarItemStrategyListener;
import bibliothek.gui.dock.toolbar.expand.ExpandedState;
import bibliothek.gui.dock.util.PropertyKey;
import bibliothek.gui.dock.util.property.ConstantPropertyFactory;

/**
 * An {@link ExpandableToolbarItemStrategy} is a strategy that allows to expand
 * and to shrink items of a toolbar.
 * 
 * @author Benjamin Sigg
 */
public interface ExpandableToolbarItemStrategy {
	/**
	 * An identifier to exchange the strategy.
	 * @see DefaultExpandableToolbarItemStrategy
	 */
	public static final PropertyKey STRATEGY = new PropertyKey( 
			"expandable toolbar item strategy", new ConstantPropertyFactory( new DisabledExpandableToolbarItemStrategy() ), true );

	/**
	 * Called if this strategy is used by controller.
	 * @param controller the controller using this strategy
	 */
	public void install( DockController controller );

	/**
	 * Called if this strategy is no longer used by controller.
	 * @param controller the controller which is no longer using this strategy
	 */
	public void uninstall( DockController controller );

	/**
	 * Tells whether the {@link Dockable} item can have the state
	 * state.
	 * @param item the item to check
	 * @param state the state that might be applied to item
	 * @return true if this strategy knows how to change the state 
	 * of item to state
	 */
	public boolean isEnabled( Dockable item, ExpandedState state );

	/**
	 * Gets the current state item has.
	 * @param item some {@link Dockable}
	 * @return the state or null if item is not supported by this strategy.
	 */
	public ExpandedState getState( Dockable item );

	/**
	 * Changes the state of item to state.
	 * @param item the item whose state is changed
	 * @param state the new state, this is a state which is {@link #isEnabled(Dockable, ExpandedState) enabled}
	 */
	public void setState( Dockable item, ExpandedState state );

	/**
	 * Adds a listener to this strategy, the listener is to be informed if the
	 * state of an item changes.
	 * @param listener the new listener, not null
	 */
	public void addExpandedListener( ExpandableToolbarItemStrategyListener listener );

	/**
	 * Removes a listener from this strategy.
	 * @param listener the listener to remove
	 */
	public void removeExpandedListener( ExpandableToolbarItemStrategyListener listener );
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy