Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Tooltips(Tooltips)
Tooltips [message #894677] Tue, 10 July 2012 06:37 Go to next message
Domenic Lee is currently offline Domenic LeeFriend
Messages: 11
Registered: July 2012
Junior Member
Hi,

How to prevent displaying empty block for emtpty tooltips' content?

Thanks,
Domenic
Re: Tooltips [message #894787 is a reply to message #894677] Tue, 10 July 2012 14:20 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Hi Domenic,

you should override shouldCreateToolTip() of your DefaultToolTip. There you can define when to show the tooltip.

Greez,
Dirk
Re: Tooltips [message #894929 is a reply to message #894787] Wed, 11 July 2012 06:51 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Hi Domenic,

I have created some general NatTableContentTooltip on the 0.9 head. See bug 384800 on bugzilla. It can be configured to show only on specified grid regions and will render nothing if the cell is empty.

Greez,
Dirk
Re: Tooltips [message #895475 is a reply to message #894929] Fri, 13 July 2012 08:36 Go to previous messageGo to next message
Domenic Lee is currently offline Domenic LeeFriend
Messages: 11
Registered: July 2012
Junior Member
Hi Dirk,

Where can i download the example file NatTableContentTooltip.java ?

Thanks,
Domenic
Re: Tooltips [message #895866 is a reply to message #895475] Mon, 16 July 2012 11:34 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Hi Domenic,

NatTableContentTooltip is not an example, it is a default implementation for adding tooltips on a NatTable instance. It is checked in the current master in git. You can find it in package org.eclipse.nebula.widgets.nattable.tooltip. Have a look at the new documentation pages to see how to check out the current master from git.

Greez,
Dirk
Re: Tooltips [message #896083 is a reply to message #895866] Tue, 17 July 2012 08:28 Go to previous messageGo to next message
Domenic Lee is currently offline Domenic LeeFriend
Messages: 11
Registered: July 2012
Junior Member
Hi,

I could not find any downloads, the download page (http://eclipse.org/nattable/download.php) says: Downloads will coming soon...

Thanks,
Domenic

[Updated on: Tue, 17 July 2012 08:30]

Report message to a moderator

Re: Tooltips [message #896087 is a reply to message #896083] Tue, 17 July 2012 08:40 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Hi Domenic,

sorry for the misunderstanding. Current development is only checked into the source code repository. As we haven't released a Nebula version yet, there are no downloads so far. So if you want to benefit from current development, you need to checkout the sources as described here (http://eclipse.org/nattable/documentation.php?page=getting_started).

If this still doesn't help you I can try to post the source code of NatTableContentTooltip here. But it would be better to checkout the sources.

Greez,
Dirk
Re: Tooltips [message #896603 is a reply to message #896087] Thu, 19 July 2012 06:28 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Hi,

there was an error with the manifest. I forgot to add the package to be exported. (https://bugs.eclipse.org/bugs/show_bug.cgi?id=385444).
Thanks to Adrian Lewty who pointed me to this.

Greez,
Dirk
Re: Tooltips [message #896621 is a reply to message #896087] Thu, 19 July 2012 07:39 Go to previous messageGo to next message
Domenic Lee is currently offline Domenic LeeFriend
Messages: 11
Registered: July 2012
Junior Member
Hi,

I downloaded all sources from the sourforge's SVN today, but i still could not find the NatTableContentTooltip.java, where is it? Could you please post it here!Thank you very much!

Thanks,
Domenic
Re: Tooltips [message #896627 is a reply to message #896621] Thu, 19 July 2012 08:00 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Hi,

SVN is closed. With the move from sourceforge to Nebula we moved to a git repository. Look here (http://eclipse.org/nattable/documentation.php?page=getting_started)

Greez,
Dirk
Re: Tooltips [message #897217 is a reply to message #896627] Mon, 23 July 2012 08:53 Go to previous messageGo to next message
Domenic Lee is currently offline Domenic LeeFriend
Messages: 11
Registered: July 2012
Junior Member
Hi,

I looked the page(http://eclipse.org/nattable/documentation.php?page=getting_started) serveral times these days, it says: ".... or by simply downloading it here and putting it into the dropins folder manually.". I clicked the link "here", and then i get the page that always says: Downloads will coming soon...,

Please advise...

Thanks,
Domenic



Re: Tooltips [message #897221 is a reply to message #897217] Mon, 23 July 2012 09:19 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Hi Domenic,

sorry, I thought you are using the NatTable sources and not ready to use builds.

We are currently working on a stable version under Nebula. If you want to benefit from enhancements and bugfixes without relying to stable versions, you need to checkout the sources from Git and build a SNAPSHOT version yourself.

As the NatTableContentTooltip also works with a 2.3.2 Sourceforge version of NatTable, I post the code here so you can use it by adding it into your application. This way you don't have to checkout the sources and build NatTable yourself until a stable Nebula NatTable version is released.

public class NatTableContentTooltip extends DefaultToolTip {
	
	/**
	 * The {@link NatTable} instance for which this {@link ToolTip} is used. 
	 */
	private NatTable natTable;
	/**
	 * The regions of the {@link NatTable} for which this {@link ToolTip} is
	 * active.
	 */
	private String[] tooltipRegions;
	
	/**
	 * Creates a new {@link ToolTip} object, attaches it to the given {@link NatTable}
	 * instance and configures and activates it.
	 * @param natTable The {@link NatTable} instance for which this {@link ToolTip} is used.
	 * @param tooltipRegions The regions of the {@link NatTable} for which this {@link ToolTip} is
	 * 			active. If none are given, the tooltip will be active for all regions.
	 */
	public NatTableContentTooltip(NatTable natTable, String... tooltipRegions) {
		super(natTable, ToolTip.NO_RECREATE, false);
		setPopupDelay(500);
		setShift(new Point(10, 10));
		activate();
		this.natTable = natTable;
		this.tooltipRegions = tooltipRegions;
	}
	
	/**
	 * {@inheritDoc}
	 * 
	 * <p>Implementation here means the tooltip is not redrawn unless mouse hover moves outside of the
	 * current cell (the combination of ToolTip.NO_RECREATE style and override of this method).
	 */
	protected Object getToolTipArea(Event event) {
		int col = natTable.getColumnPositionByX(event.x);
		int row = natTable.getRowPositionByY(event.y);
		
		return new Point(col, row);
	}
	
	/**
	 * {@inheritDoc}
	 * 
	 * <p>Evaluates the cell for which the tooltip should be rendered and checks the
	 * display value. If the display value is empty <code>null</code> will be returned
	 * which will result in not showing a tooltip.
	 */
	@Override
	protected String getText(Event event) {
		int col = natTable.getColumnPositionByX(event.x);
		int row = natTable.getRowPositionByY(event.y);
		
		ILayerCell cell = natTable.getCellByPosition(col, row);
		if (cell != null) {
			String tooltipValue = CellDisplayConversionUtils.convertDataType(
					cell, 
					natTable.getConfigRegistry());
			
			if (tooltipValue.length() > 0) {
				return tooltipValue;
			}
		}
		return null;
	}
	
	/**
	 * {@inheritDoc}
	 * 
	 * <p>Will only display a tooltip if the value of the cell for which the tooltip 
	 * should be rendered is not empty.
	 * <p>If there are regions configured for which the tooltip should be visible, it
	 * is also checked if the the region for which the tooltip should be rendered is 
	 * in one of the configured tooltip regions.
	 */
	@Override
	protected boolean shouldCreateToolTip(Event event) {
		//check the region?
		boolean regionCheckPassed = false;
		if (this.tooltipRegions.length > 0) {
			LabelStack regionLabels = natTable.getRegionLabelsByXY(event.x, event.y);
			if (regionLabels != null) {
				for (String label : this.tooltipRegions) {
					if (regionLabels.hasLabel(label)) {
						regionCheckPassed = true;
						break;
					}
				}
			}
		}
		else {
			regionCheckPassed = true;
		}

		if (regionCheckPassed && getText(event) != null) {
			return super.shouldCreateToolTip(event);
		}
		
		return false;
	}

}


Hope this helps!

Greez,
Dirk
Re: Tooltips [message #904235 is a reply to message #897221] Tue, 28 August 2012 03:44 Go to previous message
Domenic Lee is currently offline Domenic LeeFriend
Messages: 11
Registered: July 2012
Junior Member
Hi,

It works now, thank you very much!

Thanks,
Domenic
Previous Topic:Tutorials and Examples
Next Topic:Sorting while Adding / Removing columns with glazed lists sort model
Goto Forum:
  


Current Time: Fri Mar 29 01:42:40 GMT 2024

Powered by FUDForum. Page generated in 0.07237 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top