Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » How to switch display mode of table cells?
How to switch display mode of table cells? [message #1017009] Fri, 08 March 2013 14:54 Go to next message
Joachim Fuchs is currently offline Joachim FuchsFriend
Messages: 34
Registered: February 2013
Member
Hi,

so far I did not find out how the nattable, its layers, config or ui bindings must be configured to control the edit/normal mode switching.

How can I configure a certain cell to become editable by mouse click or key event? What are the steps to take?

J


Re: How to switch display mode of table cells? [message #1017058 is a reply to message #1017009] Fri, 08 March 2013 19:13 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Take a look at the documentation here
http://www.eclipse.org/nattable/documentation.php?page=editing
Re: How to switch display mode of table cells? [message #1017271 is a reply to message #1017058] Mon, 11 March 2013 12:24 Go to previous messageGo to next message
Joachim Fuchs is currently offline Joachim FuchsFriend
Messages: 34
Registered: February 2013
Member
I did that (register th editable rule and the editor) but I still miss the point where a cell is being 'activated' for editing by some event. Where is that done or configured? Which layer is responsible for this? Clicking on a cell configured as alwalys_editable does nothing but select it.

J



Re: How to switch display mode of table cells? [message #1017273 is a reply to message #1017271] Mon, 11 March 2013 12:32 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Quote:
Which layer is responsible for this?


Written in the documentation:
Quote:
There is no special layer needed to enable editing in NatTable. Everything is done via configuration.


Quote:
Where is that done or configured?


Written in the documentation:
Quote:
The default cell editing configuration is provided by the DefaultEditConfiguration that is used by the DefaultGridLayerConfiguration.


If you want to change the default behaviour you have to create your own configuration and add it to your NatTable instance.

The EditableGridExample is a good place to look at.

Regarding your name I suppose you speak German. So you can also have a look at my articles where I explained how to get started: http://eclipse.org/nattable/documentation.php?page=articles

If you added a configuration that tells a cell to be editable but it doesn't either your label to set the editable mode is not attached or the configuration is not applied.
Re: How to switch display mode of table cells? [message #1017306 is a reply to message #1017273] Mon, 11 March 2013 14:54 Go to previous messageGo to next message
Joachim Fuchs is currently offline Joachim FuchsFriend
Messages: 34
Registered: February 2013
Member
[quote title=Dirk Fauth wrote on Mon, 11 March 2013 13:32]Quote:

...
Quote:
The default cell editing configuration is provided by the DefaultEditConfiguration that is used by the DefaultGridLayerConfiguration.


Well, using the DefaultGridLayerConfiguration causes a weird ClassCastException. I am not sure whether this is a bug or some other problem since I have seen very few exceptions thrown in line 1 of a class.

But I collected the necessary information from the code to make my cell editable on double click, which is enough for the moment.

java.lang.ClassCastException: org.eclipse.nebula.widgets.nattable.NatTable cannot be cast to org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
	at org.eclipse.nebula.widgets.nattable.edit.config.DefaultEditConfiguration.configureTypedLayer(DefaultEditConfiguration.java:1)
	at org.eclipse.nebula.widgets.nattable.config.AbstractLayerConfiguration.configureLayer(AbstractLayerConfiguration.java:24)
	at org.eclipse.nebula.widgets.nattable.config.AggregateConfiguration.configureLayer(AggregateConfiguration.java:33)
	at org.eclipse.nebula.widgets.nattable.NatTable.configure(NatTable.java:419)
	at treetable.nat.NatTreeTableViewTest.testCreateControlTEST(NatTreeTableViewTest.java:330)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)



Quote:

Regarding your name I suppose you speak German. So you can also have a look at my articles where I explained how to get started: http://eclipse.org/nattable/documentation.php?page=articles

Good guess. I already read the articles as a starting point for my explorations. Thanks for your help.

J

Re: How to switch display mode of table cells? [message #1017603 is a reply to message #1017306] Tue, 12 March 2013 07:25 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Hi,

well if you read my articles, have you also looked at the examples attached? There I'm using an additional configuration for editing instead of reusing the DefaultGridLayerConfiguration.

If you want to reuse the DefaultGridLayerConfiguration you need to know that it is a layer configuration. If you are trying to add it to the NatTable directly, you will get the posted exception. You need to add it to the GridLayer instead.

But I always suggest to create a new edit configuration to avoid any dependencies on existing stuff.

Greez,
Dirk
Re: How to switch display mode of table cells? [message #1019263 is a reply to message #1017603] Fri, 15 March 2013 10:36 Go to previous messageGo to next message
Joachim Fuchs is currently offline Joachim FuchsFriend
Messages: 34
Registered: February 2013
Member
Dirk Fauth wrote on Tue, 12 March 2013 08:25

...well if you read my articles, have you also looked at the examples attached?...


Thank you for this hint. I took a brief look and have a simple question:

The advanced examples seem to derive from the time when nattable was not an eclipse incubator project. Why are there two example TreeLayer implementations? Was the TreeLayer as it is part of the 0.9.0 release not part of the project at that time?

Are there any changes to the tree thing coming up in 1.0.0?

J
Re: How to switch display mode of table cells? [message #1019270 is a reply to message #1019263] Fri, 15 March 2013 10:47 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Quote:
Why are there two example TreeLayer implementations?


There aren't! Do you talk about TreeGridLayer and TreeGridLayer2 in my examples? The difference between these two implementations is the different PersonWithAddressTreeFormat
These are special implementations for my examples and are not special to NatTable core. In fact they are using the TreeLayer. That's a difference! Smile

Quote:
Are there any changes to the tree thing coming up in 1.0.0?


Despite several bugfixes nothing I'm aware of.
Previous Topic:How to do full row selection?
Next Topic:Bug in FilterRowDataProvider.{save,load}State()?
Goto Forum:
  


Current Time: Fri Apr 19 22:44:03 GMT 2024

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

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

Back to the top