Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » column with by percent and group column header
column with by percent and group column header [message #1735240] Thu, 16 June 2016 14:26 Go to next message
Martin Jacob is currently offline Martin JacobFriend
Messages: 185
Registered: July 2009
Senior Member
Hi,

I was using the setColumnWidthByPosition to set the percentage of the
column. BodyDataLayer.setColumnPercentageSizing(true) is set as well.

since I am using a group column header layer the
setColumnWidthByPosition does not have an effect.

Is this intended or may I have missed change some thing else while
adding the ColumnGroupLayer?

Any hints are appreciated, Martin
Re: column with by percent and group column header [message #1735243 is a reply to message #1735240] Thu, 16 June 2016 14:51 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2622
Registered: July 2012
Senior Member
Not sure. Typically the column header gets its width derived from the body. I suspect the column group header should get its column widths derived from the column header.

Are you setting the column width on the column group header or the body? Not sure where which communication might not be passed accordingly.
Re: column with by percent and group column header [message #1735294 is a reply to message #1735243] Fri, 17 June 2016 07:13 Go to previous messageGo to next message
Martin Jacob is currently offline Martin JacobFriend
Messages: 185
Registered: July 2009
Senior Member
Good Morning,

thanks Dirk. The column width is set at the BodyDataLayer only.

Please the implementation of the BodyLayerStack below:
class BodyLayerStack extends AbstractLayerTransform {
private SelectionLayer mSelectionLayer;
private DataLayer mBodyDataLayer;

public BodyLayerStack(BodyDataProvider dataProvider) {
mBodyDataLayer = new DataLayer(dataProvider);
mBodyDataLayer.setColumnPercentageSizing(true);

mBodyDataLayer.setColumnWidthByPosition(ColumnIndex.X_AXIS.getValue(), 5);
//
mBodyDataLayer.setColumnWidthByPosition(ColumnIndex.ITEMS_INFRA.getValue(),
9);

mBodyDataLayer.setColumnWidthByPosition(ColumnIndex.SHOW_H_LINES.getValue(),
5);


mBodyDataLayer.setColumnWidthByPosition(ColumnIndex.Y11_AXIS.getValue(), 5);

mBodyDataLayer.setColumnWidthByPosition(ColumnIndex.Y11_ITEMS_VALUES.getValue(),
7);

mBodyDataLayer.setColumnWidthByPosition(ColumnIndex.Y11_AVG_FUNCTION_TYPE.getValue(),
7);

mBodyDataLayer.setColumnWidthByPosition(ColumnIndex.Y11_COMPARATOR_FUNCTION_TYPE.getValue(),
5);


mBodyDataLayer.setColumnWidthByPosition(ColumnIndex.Y12_AXIS.getValue(), 5);

mBodyDataLayer.setColumnWidthByPosition(ColumnIndex.Y12_ITEMS_VALUES.getValue(),
7);

mBodyDataLayer.setColumnWidthByPosition(ColumnIndex.Y12_AVG_FUNCTION_TYPE.getValue(),
7);


mBodyDataLayer.setColumnWidthByPosition(ColumnIndex.Y21_AXIS.getValue(), 5);

mBodyDataLayer.setColumnWidthByPosition(ColumnIndex.Y21_ITEMS_VALUES.getValue(),
7);

mBodyDataLayer.setColumnWidthByPosition(ColumnIndex.Y21_AVG_FUNCTION_TYPE.getValue(),
7);


mBodyDataLayer.setColumnWidthByPosition(ColumnIndex.Y22_AXIS.getValue(), 5);

mBodyDataLayer.setColumnWidthByPosition(ColumnIndex.Y22_ITEMS_VALUES.getValue(),
7);

mBodyDataLayer.setColumnWidthByPosition(ColumnIndex.Y22_AVG_FUNCTION_TYPE.getValue(),
7);

mSelectionLayer = new SelectionLayer(mBodyDataLayer);
ViewportLayer viewportLayer = new ViewportLayer(mSelectionLayer);
setUnderlyingLayer(viewportLayer);
}

public SelectionLayer getSelectionLayer() {
return mSelectionLayer;
}

public DataLayer getBodyDataLayer() {
return mBodyDataLayer;
}
}

as well as the ColumnHeaderLayerStack
class ColumnHeaderLayerStack extends AbstractLayerTransform {

private ColumnHeaderLayer mColHeaderLayer;
private ColumnGroupHeaderLayer mColumnGroupHeaderLayer;

public ColumnHeaderLayerStack(IDataProvider dataProvider,
BodyLayerStack pBodyLayer) {
DataLayer dataLayer = new DataLayer(dataProvider);
mColHeaderLayer = new ColumnHeaderLayer(dataLayer, pBodyLayer,
pBodyLayer.getSelectionLayer());
ColumnGroupModel lColumnGroupModel = new ColumnGroupModel();
mColumnGroupHeaderLayer = new ColumnGroupHeaderLayer(mColHeaderLayer,
pBodyLayer.getSelectionLayer(), lColumnGroupModel);
mColumnGroupHeaderLayer.addColumnsIndexesToGroup(_("X Axis"),
ColumnIndex.X_AXIS.mValue, ColumnIndex.ITEMS_INFRA.mValue,
ColumnIndex.SHOW_H_LINES.mValue);
mColumnGroupHeaderLayer.setGroupUnbreakable(1);

mColumnGroupHeaderLayer.addColumnsIndexesToGroup(_("Y Axis Primary
1"), ColumnIndex.Y11_AXIS.mValue, ColumnIndex.Y11_ITEMS_VALUES.mValue,
ColumnIndex.Y11_AVG_FUNCTION_TYPE.mValue,
ColumnIndex.Y11_COMPARATOR_FUNCTION_TYPE.mValue);
mColumnGroupHeaderLayer.setGroupUnbreakable(2);

mColumnGroupHeaderLayer.addColumnsIndexesToGroup(_("Y Axis Primary
2"), ColumnIndex.Y12_AXIS.mValue, ColumnIndex.Y12_ITEMS_VALUES.mValue,
ColumnIndex.Y12_AVG_FUNCTION_TYPE.mValue);
mColumnGroupHeaderLayer.setGroupUnbreakable(3);

mColumnGroupHeaderLayer.addColumnsIndexesToGroup(_("Y Axis Secondary
1"), ColumnIndex.Y21_AXIS.mValue,
ColumnIndex.Y21_ITEMS_VALUES.mValue,
ColumnIndex.Y21_AVG_FUNCTION_TYPE.mValue);
mColumnGroupHeaderLayer.setGroupUnbreakable(4);

mColumnGroupHeaderLayer.addColumnsIndexesToGroup(_("Y Axis Secondary
2"), ColumnIndex.Y22_AXIS.mValue,
ColumnIndex.Y22_ITEMS_VALUES.mValue,
ColumnIndex.Y22_AVG_FUNCTION_TYPE.mValue);
mColumnGroupHeaderLayer.setGroupUnbreakable(5);

setUnderlyingLayer(mColHeaderLayer);
}

public ColumnGroupHeaderLayer getColumnGroupHeaderLayer() {
return mColumnGroupHeaderLayer;
}
}


Do you see any thing suspicious?

Thanks, Martin
Re: column with by percent and group column header [message #1735297 is a reply to message #1735294] Fri, 17 June 2016 07:32 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2622
Registered: July 2012
Senior Member
Why don't you set mColumnGroupHeaderLayer as underlying layer of your column header layer stack?
Re: column with by percent and group column header [message #1735307 is a reply to message #1735297] Fri, 17 June 2016 09:18 Go to previous messageGo to next message
Martin Jacob is currently offline Martin JacobFriend
Messages: 185
Registered: July 2009
Senior Member
Sorry, I forgot to replace when I was adding the ColumnGroupHeaderLayer.
I use now setUnderlyingLayer(mColumnGroupHeaderLayer); but the issues
still exist :(

Modified code ColumnHeaderLayerStack:

public ColumnHeaderLayerStack(IDataProvider dataProvider,
BodyLayerStack pBodyLayer) {
DataLayer dataLayer = new DataLayer(dataProvider);
mColHeaderLayer = new ColumnHeaderLayer(dataLayer, pBodyLayer,
pBodyLayer.getSelectionLayer());
ColumnGroupModel lColumnGroupModel = new ColumnGroupModel();
mColumnGroupHeaderLayer = new ColumnGroupHeaderLayer(mColHeaderLayer,
pBodyLayer.getSelectionLayer(), lColumnGroupModel);
mColumnGroupHeaderLayer.addColumnsIndexesToGroup(_("X Axis"),
ColumnIndex.X_AXIS.mValue, ColumnIndex.ITEMS_INFRA.mValue,
ColumnIndex.SHOW_H_LINES.mValue);
mColumnGroupHeaderLayer.setGroupUnbreakable(1);

mColumnGroupHeaderLayer.addColumnsIndexesToGroup(_("Y Axis Primary
1"), ColumnIndex.Y11_AXIS.mValue, ColumnIndex.Y11_ITEMS_VALUES.mValue,
ColumnIndex.Y11_AVG_FUNCTION_TYPE.mValue,
ColumnIndex.Y11_COMPARATOR_FUNCTION_TYPE.mValue);
mColumnGroupHeaderLayer.setGroupUnbreakable(2);

mColumnGroupHeaderLayer.addColumnsIndexesToGroup(_("Y Axis Primary
2"), ColumnIndex.Y12_AXIS.mValue, ColumnIndex.Y12_ITEMS_VALUES.mValue,
ColumnIndex.Y12_AVG_FUNCTION_TYPE.mValue);
mColumnGroupHeaderLayer.setGroupUnbreakable(3);

mColumnGroupHeaderLayer.addColumnsIndexesToGroup(_("Y Axis Secondary
1"), ColumnIndex.Y21_AXIS.mValue,
ColumnIndex.Y21_ITEMS_VALUES.mValue,
ColumnIndex.Y21_AVG_FUNCTION_TYPE.mValue);
mColumnGroupHeaderLayer.setGroupUnbreakable(4);

mColumnGroupHeaderLayer.addColumnsIndexesToGroup(_("Y Axis Secondary
2"), ColumnIndex.Y22_AXIS.mValue,
ColumnIndex.Y22_ITEMS_VALUES.mValue,
ColumnIndex.Y22_AVG_FUNCTION_TYPE.mValue);
mColumnGroupHeaderLayer.setGroupUnbreakable(5);

setUnderlyingLayer(mColumnGroupHeaderLayer);
}
Re: column with by percent and group column header [message #1735319 is a reply to message #1735307] Fri, 17 June 2016 11:00 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2622
Registered: July 2012
Senior Member
Have you tried to call setColumnWidthPercentageByPosition() instead of setColumnWidthByPosition()?

And please use the code formatting for posting code. It is very hard to read your code postings as simple text.
Re: column with by percent and group column header [message #1735332 is a reply to message #1735319] Fri, 17 June 2016 12:10 Go to previous messageGo to next message
Martin Jacob is currently offline Martin JacobFriend
Messages: 185
Registered: July 2009
Senior Member
Thanks Dirk,

yes setColumnWidthPercentageByPosition() works fine! :)

So I removed mBodyDataLayer.setColumnPercentageSizing(true); and call
setColumnWidthPercentageByPosition() instead of setColumnWidthByPosition()


Sorry to not format as source code. I am using thunderbird as forum
client and I am no sure how to format in code.
My login for the newsgroup unfortunately does not allow me to login to
use the web front end.

May be using html tags?
<code>
setColumnWidthPercentageByPosition()
</code>
Re: column with by percent and group column header [message #1735337 is a reply to message #1735332] Fri, 17 June 2016 12:38 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2622
Registered: July 2012
Senior Member
instead of the HTML tag syntax with the lower and greater than signs, you should use []
Re: column with by percent and group column header [message #1735339 is a reply to message #1735337] Fri, 17 June 2016 12:42 Go to previous message
Martin Jacob is currently offline Martin JacobFriend
Messages: 185
Registered: July 2009
Senior Member
Thanks

here the solution code:

		public BodyLayerStack(BodyDataProvider dataProvider) {
			mBodyDataLayer = new DataLayer(dataProvider);

		 
mBodyDataLayer.setColumnWidthPercentageByPosition(ColumnIndex.X_AXIS.getValue(), 
5);
		 
mBodyDataLayer.setColumnWidthPercentageByPosition(ColumnIndex.SHOW_H_LINES.getValue(), 
5);

		 
mBodyDataLayer.setColumnWidthPercentageByPosition(ColumnIndex.Y11_AXIS.getValue(), 
4);
		 
mBodyDataLayer.setColumnWidthPercentageByPosition(ColumnIndex.Y11_ITEMS_VALUES.getValue(), 
7);
		 
mBodyDataLayer.setColumnWidthPercentageByPosition(ColumnIndex.Y11_AVG_FUNCTION_TYPE.getValue(), 
7);
		 
mBodyDataLayer.setColumnWidthPercentageByPosition(ColumnIndex.Y11_COMPARATOR_FUNCTION_TYPE.getValue(), 
3);

		 
mBodyDataLayer.setColumnWidthPercentageByPosition(ColumnIndex.Y12_AXIS.getValue(), 
4);
		 
mBodyDataLayer.setColumnWidthPercentageByPosition(ColumnIndex.Y12_ITEMS_VALUES.getValue(), 
7);
		 
mBodyDataLayer.setColumnWidthPercentageByPosition(ColumnIndex.Y12_AVG_FUNCTION_TYPE.getValue(), 
7);

		 
mBodyDataLayer.setColumnWidthPercentageByPosition(ColumnIndex.Y21_AXIS.getValue(), 
4);
		 
mBodyDataLayer.setColumnWidthPercentageByPosition(ColumnIndex.Y21_ITEMS_VALUES.getValue(), 
7);
		 
mBodyDataLayer.setColumnWidthPercentageByPosition(ColumnIndex.Y21_AVG_FUNCTION_TYPE.getValue(), 
7);

		 
mBodyDataLayer.setColumnWidthPercentageByPosition(ColumnIndex.Y22_AXIS.getValue(), 
4);
		 
mBodyDataLayer.setColumnWidthPercentageByPosition(ColumnIndex.Y22_ITEMS_VALUES.getValue(), 
7);
		 
mBodyDataLayer.setColumnWidthPercentageByPosition(ColumnIndex.Y22_AVG_FUNCTION_TYPE.getValue(), 
7);

			mSelectionLayer = new SelectionLayer(mBodyDataLayer);
			ViewportLayer viewportLayer = new ViewportLayer(mSelectionLayer);
			setUnderlyingLayer(viewportLayer);
		}

Previous Topic:Copy/paste from external source
Next Topic:Nattable with "horizontal tree" structure
Goto Forum:
  


Current Time: Mon Nov 12 17:45:45 GMT 2018

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

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

Back to the top