Hi Dirk Möbius wrote: > Noel Grandin <[email protected]> wrote: >> That is the same approach Swing uses. > > No it's not, because Swing doesn't pass any events to the cell > renderer. (Neither does Pivot.) > Yes it is. This is exactly how JTable works.
>> And it has the same problems - getting events into and out of the cell >> is tricky and means that the cell component needs various bits of >> tweaking to cope properly with things like focus gain/release. > > True, it can be tricky. But the tricky part has been dealt with by the > JavaFX team, so it is not left to the framework user. > Even when the framework "deals with it", it leaves behind a variety of interesting little constraints and tricks for the developer to discover. Note how hard it is insert custom components into a JTable and get all of the focussing and other little details completely correct. And then someone tries to implement something like alternate-row-striping on the JTable, and it blows up the assumptions that the custom component was operating under. >> I'm in two minds about this. Personally, I try where-ever possible to >> avoid using the Swing components that do this (JTable) in favour of >> putting real components into real containers. >> >> However, there are a very few use-cases (editable tables containing very >> large numbers of rows) that can benefit from this approach. > > I think using components in tables is a pretty common use case in > modern applications. Examples: > - a link button, to navigate to detail panes > - an expander, to show additional row details > - a movie component, displaying a YouTube video (yes, I'm serious, and > JavaFX is capable of this) > - any input component (such as TextInput etc) that you want to show > immediately without forcing the user to enter edit mode explicitly > > Dirk. > True, which is why Pivot has TablePane. Maybe it's not perfect, because it forces you to use Label for a lot of things, and it's memory consumption is higher, but it's also very predictable in terms of how the components interact with their parent container. Like I said, there is maybe a need for this, I'm just not convinced that it is something that the core components need to support. Regards, Noel.
