Skip to main content



      Home
Home » Eclipse Projects » NatTable » Not able to select Row Header when only one column is present
Not able to select Row Header when only one column is present [message #1769242] Fri, 28 July 2017 03:40 Go to next message
Eclipse UserFriend
Hi,

There are cases when in NatTable I just have one column with many rows.
In such cases, I am not able to click/select on row header.

I don't know why NatTable is behaving like this or is this any bug.

Please let me know the solution if any.

Thanks in advance.
Re: Not able to select Row Header when only one column is present [message #1769250 is a reply to message #1769242] Fri, 28 July 2017 04:57 Go to previous messageGo to next message
Eclipse UserFriend
Can't tell what your issue is. Such a behavior is not known to me. Therefore it is no known bug. And if I take one of our examples and change it to only show one column everything still works as expected.
Re: Not able to select Row Header when only one column is present [message #1769276 is a reply to message #1769250] Fri, 28 July 2017 09:49 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for such a quick reply.

I took your example _513_FreezeExample. In this, I freeze 1st column and remaining column I hide it and then I am not able to select row header.

In my case by default, I will freeze 1st column. So when there is no more than 1 column I am not able to select row header.

Re: Not able to select Row Header when only one column is present [message #1769283 is a reply to message #1769276] Fri, 28 July 2017 11:01 Go to previous messageGo to next message
Eclipse UserFriend
Please provide all relevant information. You did not mention that the freeze layer is involved.

Need to check, but it is not known
Re: Not able to select Row Header when only one column is present [message #1769370 is a reply to message #1769283] Mon, 31 July 2017 02:24 Go to previous message
Eclipse UserFriend
Providing all relevant information:
IColumnPropertyAccessor<EObject> columnPropertyAccessor = new ContainerColumnPropertyAccessor(propNames,propertyToLabelMap);

		bodyDataProvider = new ListDataProvider<EObject>(eventList, columnPropertyAccessor);

		final DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
		ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(bodyDataLayer);
		ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(columnReorderLayer);
		selectionLayer = new SelectionLayer(columnHideShowLayer);
		final ViewportLayer viewportLayer = new ViewportLayer(selectionLayer);
		final FreezeLayer freezeLayer = new FreezeLayer(selectionLayer);
		final CompositeFreezeLayer compositeFreezeLayer = new CompositeFreezeLayer(freezeLayer, viewportLayer,
				selectionLayer);

		// build the column header layer
		IDataProvider columnHeaderDataProvider = new CustomColumnHeaderDataProvider(propNames, propertyToLabelMap);
		DataLayer columnHeaderDataLayer = new DefaultColumnHeaderDataLayer(columnHeaderDataProvider);
		ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, compositeFreezeLayer,
				selectionLayer);

		// build the row header layer
		IDataProvider rowHeaderDataProvider = new CustomRowHeaderDataProvider(bodyDataProvider);
		DataLayer rowHeaderDataLayer = new DefaultRowHeaderDataLayer(rowHeaderDataProvider);
		ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer, compositeFreezeLayer, selectionLayer);

		// build the corner layer
		IDataProvider cornerDataProvider = new DefaultCornerDataProvider(columnHeaderDataProvider,
				rowHeaderDataProvider);
		DataLayer cornerDataLayer = new DataLayer(cornerDataProvider);
		ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer, columnHeaderLayer);

		// build the grid layer
		GridLayer gridLayer = new GridLayer(compositeFreezeLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer);
		final ColumnOverrideLabelAccumulator columnLabelAccumulator = new ColumnOverrideLabelAccumulator(bodyDataLayer);
		bodyDataLayer.registerCommandHandler(new DeleteRowCommandHandler<EObject>(((ListDataProvider<EObject>)bodyDataProvider).getList(), getSelectionLayer()));

			private NatTable generateNatTable(Composite parent, ScrolledForm body, Set<EObject> propertyNamesObject,
			final SelectionLayer selectionLayer, final ViewportLayer viewportLayer, final FreezeLayer freezeLayer,
			final CompositeFreezeLayer compositeFreezeLayer, GridLayer gridLayer,
			DefaultRowStyleConfiguration rowStyleConfiguration, LinkedHashMap<String, EObject> propertyToLabelMap) {

		final NatTable natTable = new NatTable(parent, gridLayer, false);

		TableWrapData td = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.FILL_GRAB,
				(body.getBounds().height / 11)-3, 1);
		natTable.setLayoutData(td);

		natTable.addConfiguration(new DefaultNatTableStyleConfiguration() {
			{
				cellPainter = new LineBorderDecorator(new TextPainter(false, true, 3, true));
			}
		});
		natTable.addConfiguration(new DefaultFreezeGridBindings());
		natTable.addConfiguration(rowStyleConfiguration);
		natTable.addConfiguration(new ColumnHeaderRightClickConfig(natTable, compositeFreezeLayer, freezeLayer,
				viewportLayer, selectionLayer));
		natTable.addConfiguration(new EditorConfiguration(propertyNamesObject));
		natTable.addConfiguration(new DefaultColumnHeaderStyleConfiguration(){
			{
				font = GUIHelper.getFont(new FontData[] { new FontData("Calibri", 10, SWT.BOLD) });
				cellPainter = new BeveledBorderDecorator(new TextPainter(false, true, true , true));
			}
		});
		Menu menu = createRightClickMenu(natTable, selectionLayer);

		natTable.addConfiguration(new AbstractUiBindingConfiguration() {

			@Override
			public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
				uiBindingRegistry.registerMouseDownBinding(
						new MouseEventMatcher(SWT.NONE, GridRegion.BODY, MouseEventMatcher.RIGHT_BUTTON),
						new CellPopupMenuAction(menu, selectionLayer, propertyToLabelMap));

			}
		});
		natTable.configure();
		
		natTable.doCommand(new FreezeColumnCommand(compositeFreezeLayer, 0, false, false));
		natTableBodyChangeListener(body, natTable);

		new NatTableContentTooltip(natTable, GridRegion.BODY,GridRegion.COLUMN_HEADER);
		return natTable;
	
Previous Topic:How to set native SWT images in CheckBoxPainter?
Next Topic:Dynamically create new row on commit last row's last cell's CellEditor
Goto Forum:
  


Current Time: Wed Jul 23 03:41:13 EDT 2025

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

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

Back to the top