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

bibliothek.gui.dock.security.TooltipStrategy 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.security;

import java.awt.Component;
import java.awt.event.MouseEvent;

import javax.swing.JToolTip;

/**
 * A {@link TooltipStrategy} is used by a {@link GlassedPane} to find out which tooltip present.
 * @author Benjamin Sigg
 */
public interface TooltipStrategy {
	/**
	 * Called if a {@link GlassedPane} starts using this strategy.
	 * @param pane the pane using this strategy
	 */
	public void install( GlassedPane pane );
	
	/**
	 * Called if a {@link GlassedPane} is no longer using this strategy.
	 * @param pane the pane that is no longer using this strategy
	 */
	public void uninstall( GlassedPane pane );
	
	/**
	 * Asks this strategy to find the tooltip of component, after the event is
	 * dispatched.
	 * @param component the current component, can be null
	 * @param event the event that is dispatched, can be null
	 * @param overNewComponent whether the component under the mouse changed since the last call of this method
	 * @param callback the caller, this method can call {@link TooltipStrategyCallback#setToolTipText(String)}
	 * to set a new tooltip
	 */
	public void setTooltipText( Component component, MouseEvent event, boolean overNewComponent, TooltipStrategyCallback callback );
	
	/**
	 * Asks this strategy to create a new tooltip, this tooltip will be shown as soon as the current
	 * event of the EDT is over.
	 * @param component the component over which the mouse currently hovers, can be null
	 * @param callback the caller of this method
	 * @return the new tooltip, must not be null
	 */
	public JToolTip createTooltip( Component component, TooltipStrategyCallback callback );
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy