Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » How to add own CellPainters and Editors to the FilterRowHeaderComposite?
How to add own CellPainters and Editors to the FilterRowHeaderComposite? [message #1065292] Tue, 25 June 2013 09:14 Go to next message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 260
Registered: July 2012
Senior Member
I would like to add own painters to the FilterRowHeaderComposite Cells.
I have done which had no effect.
What do I miss?

FilterRowHeaderComposite f= new FilterRowHeaderComposite(...);
f.addConfiguration(new ConfigurationFilterRowTextEditors());

...

class ConfigurationFilterRowTextEditors{
	private void configureInputFields(IConfigRegistry configRegistry) {
		
		cellPainter = new ComboBoxPainter();
		
		// Plug in custom painter
		configRegistry.registerConfigAttribute(CELL_PAINTER, cellPainter, NORMAL, LABEL_FILTERS);

		// Make cells editable
		configRegistry.registerConfigAttribute(CELL_EDITABLE_RULE, ALWAYS_EDITABLE, NORMAL, LABEL_FILTERS);

		// Default text matching mode
		configRegistry.registerConfigAttribute(TEXT_MATCHING_MODE, textMatchingMode);

		// Default display converter. Used to convert the values typed into the text boxes into String objects.
		configRegistry.registerConfigAttribute(FILTER_DISPLAY_CONVERTER, new DefaultDisplayConverter());

		// Default comparator. Used to compare objects in the column during threshold matching.
		configRegistry.registerConfigAttribute(FILTER_COMPARATOR, DefaultComparator.getInstance());
	}

[Updated on: Tue, 25 June 2013 09:15]

Report message to a moderator

Re: How to add own CellPainters and Editors to the FilterRowHeaderComposite? [message #1065303 is a reply to message #1065292] Tue, 25 June 2013 09:43 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Because the filter row uses its own labels you need to use in order to change that.

These are
FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + columnIndex
Re: How to add own CellPainters and Editors to the FilterRowHeaderComposite? [message #1065304 is a reply to message #1065303] Tue, 25 June 2013 09:50 Go to previous messageGo to next message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 260
Registered: July 2012
Senior Member
Thnx!
So I suppose there should be a mechanism to collect all labels for a cell,
collect all the editors which are soociated with those labels ,
and pick one editor.

Where is this mechanism?
Which Editor would be picked, if I register different editors to different labels,
but if I add all labels to one cell?

Re: How to add own CellPainters and Editors to the FilterRowHeaderComposite? [message #1065309 is a reply to message #1065304] Tue, 25 June 2013 09:53 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
ConfigRegistry.getConfigAttribute()


If there are several labels registered against a cell, and every label has its own editor, the editor for the label that is found first in the label stack is used
Re: How to add own CellPainters and Editors to the FilterRowHeaderComposite? [message #1065315 is a reply to message #1065309] Tue, 25 June 2013 10:07 Go to previous messageGo to next message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 260
Registered: July 2012
Senior Member
Mmmm, back to the Labels:
as far as I can see the chain of dependencies looks as following:

FilterRowHeaderComposite -> use
FilterRowDataLayer -> use
DefaultFilterRowConfiguration -> use
GridRegion.FILTER_ROW

and GridRegion.FILTER_ROW is what I registered ne weditors for.
Indeed I did it for the top level - for the FilterRowHeaderComposite level.

Where are the labels "FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + columnIndex" are used?

Re: How to add own CellPainters and Editors to the FilterRowHeaderComposite? [message #1065340 is a reply to message #1065315] Tue, 25 June 2013 11:14 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
They are used for converters in several examples. The are added in the FilterRowDataLayer and should therefore be usable in other places too. In the FilterRowGridExample a different editor is registered like it.

Do you know about the Ctrl+Shift+G shortcut in Eclipse? It opens view showing you the references in the source code for the searched type, method, constant etc.
Re: How to add own CellPainters and Editors to the FilterRowHeaderComposite? [message #1065376 is a reply to message #1065340] Tue, 25 June 2013 13:34 Go to previous messageGo to next message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 260
Registered: July 2012
Senior Member
Thnx Dirk, I know about CTRL+SHIFT+G.
I mean where are those labels applied in the special case of FilterRowHeaderComposite?

Indeed I only see the usage of FILTER_ROW_COLUMN_LABEL_PREFIX in the general method "getConfigLabelsByPosition()"
This method is widely used, so that it is not clear, where the labels are used in the special case of FilterRowHeaderComposite.

http://i520.photobucket.com/albums/w327/schajtan/2013-06-25_15-32-15_zpsc6f1697e.png
Re: How to add own CellPainters and Editors to the FilterRowHeaderComposite? [message #1065378 is a reply to message #1065376] Tue, 25 June 2013 13:47 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
You:
Quote:
where are those labels applied in the special case of FilterRowHeaderComposite


Me:
Quote:
The are added in the FilterRowDataLayer


You:
Quote:
This method is widely used, so that it is not clear, where the labels are used in the special case of FilterRowHeaderComposite.


Well that is a concept of OO programming. Encapsulation, abstraction and the possibility to reuse code. There is nothing special for activating an editor in the body or in the filter row. The EditCellCommandHandler determines whether a cell is editable and if there is an editor. That is done by interpreting the label stack of the cell in combination with the ConfigRegistry.

Just check the DefaultFilterRowConfiguration.configureUiBindings() to see that configuration.
Re: How to add own CellPainters and Editors to the FilterRowHeaderComposite? [message #1065749 is a reply to message #1065378] Thu, 27 June 2013 11:29 Go to previous message
Alex Kipling is currently offline Alex KiplingFriend
Messages: 260
Registered: July 2012
Senior Member
We are talking at cross purposes, because my question was not formulated precisely. I will reformulate the question:

I registered new editors and painters, using the labels "GridRegion.FILTER_ROW"
"GridRegion.FILTER_ROW" are labels, which are used in registered in FilterRowDataLayer, together with "FILTER_ROW_COLUMN_LABEL_PREFIX + columnPosition" labels

So, it is my understanding using "GridRegion.FILTER_ROW" - should work and the editors editors and painters should apear, but they did not.

Now you have have told me to use the "FILTER_ROW_COLUMN_LABEL_PREFIX + columnPosition" labels, which worked.

So I assume that editors / painters, reigstered using "FILTER_ROW_COLUMN_LABEL_PREFIX + columnPosition" have higher priority, because they have been put into the label stack first. And I assume that somewhere else these "FILTER_ROW_COLUMN_LABEL_PREFIX + columnPosition" are used to register editors/painters,
which have overriden my first editors/painters which were registerred using "GridRegion.FILTER_ROW" painters.

The question is WHERE have the labels "FILTER_ROW_COLUMN_LABEL_PREFIX + columnPosition" been used to register those editors, which have overriden my editors?
I can not see this, by doing STRG+Shift+G!

Previous Topic:Is it possible to add an SWT Widget to a Layer?
Next Topic:SelectCellCommand issue with TextPainter calculateByTextHeight
Goto Forum:
  


Current Time: Sat Apr 20 00:27:51 GMT 2024

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

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

Back to the top