|
|
Re: column header with multiple rows [message #1008069 is a reply to message #1008050] |
Fri, 08 February 2013 17:31 |
Martin Jacob Messages: 191 Registered: July 2009 |
Senior Member |
|
|
The grouping is OK in row 0 and 1 of the column header.
Row 2 of the column header is also OK (Name, Type, 9,10,11,0,1,.....)
Furthermore I want a row 3 and 4 of the column header without grouping, just like in row 2 of the
column header.
schrieb Dirk Fauth, Am 08.02.2013 17:19:
> Sorry, I don't understand. Do you need to have a ColumnHeader with 3 rows or do you need to have a
> ColumnHeaderLayer stacked up with ColumnGroupHeaderLayer and ColumnGroupGroupHeaderLayer?
>
> For the last one there is the "Two level column groups example" that will show how this works.
|
|
|
|
Re: column header with multiple rows [message #1008372 is a reply to message #1008161] |
Tue, 12 February 2013 08:13 |
Martin Jacob Messages: 191 Registered: July 2009 |
Senior Member |
|
|
Thanks Dirk,
Yes the data provider provides data for all 3 rows but only row 0 get called. May be there is an
error in ColumnHeaderLayerStack?
here the code:
public ColumnHeaderLayerStack(IDataProvider dataProvider, BodyLayerStack pBodyLayer) {
DataLayer dataLayer = new DataLayer(dataProvider);
colHeaderLayer = new ColumnHeaderLayer(dataLayer, pBodyLayer, pBodyLayer.getSelectionLayer());
ColumnGroupModel columnGroupModelTrack = new ColumnGroupModel();
columnGroupHeaderLayerTrack = new ColumnGroupHeaderLayer(colHeaderLayer,
pBodyLayer.getSelectionLayer(), columnGroupModelTrack);
columnGroupHeaderLayerTrack.addColumnsIndexesToGroup("Track", 0, 1);
ColumnGroupModel columnGroupModelLine = new ColumnGroupModel();
columnGroupHeaderLayerLine = new ColumnGroupGroupHeaderLayer(columnGroupHeaderLayerTrack,
pBodyLayer.getSelectionLayer(),
columnGroupModelLine);
columnGroupHeaderLayerLine.addColumnsIndexesToGroup("Line", 0, 1);
}
Does this give you any hints of an error?
Martin
schrieb Dirk Fauth, Am 12.02.2013 06:10:
> Does your IDataProvider provide data for those 2 additional rows? In terms of height it seems to
> interpret the 3 rows correctly.
|
|
|
|
Re: column header with multiple rows [message #1008378 is a reply to message #1008373] |
Tue, 12 February 2013 08:46 |
Martin Jacob Messages: 191 Registered: July 2009 |
Senior Member |
|
|
public class ColHeaderDataProvider implements IDataProvider {// extends BodyDataProvider {
private LinkedHashMap<Integer, Object> colIndexToObject = new LinkedHashMap<Integer, Object>();
@Override
public Object getDataValue(int arg0, int arg1) {
Object lRet = colIndexToObject.get(arg0);
if (null == lRet) {
int lColIdx = arg0;
Vector<Network> lNwV = getProject().getJniProject().getNetworks();
if (0 == lColIdx) {
colIndexToObject.put(arg0, "Name");
return colIndexToObject.get(arg0);
} else {
lColIdx--;
}
if (0 == lColIdx) {
colIndexToObject.put(arg0, "Type");
return colIndexToObject.get(arg0);
} else {
lColIdx--;
}
for (Network lNw : lNwV) {
Vector<Line> lLineV = lNw.getLines();
for (Line lLine : lLineV) {
Vector<Track> lTrackV = lLine.getTracks();
for (Track lTrack : lTrackV) {
Vector<Connector> lConnV = lTrack.getLineConnectorsFrom();
for (Connector lConn : lConnV) {
if (0 == lColIdx) {
colIndexToObject.put(arg0, lConn);
return colIndexToObject.get(arg0);
} else {
lColIdx--;
}
}
}
}
}
}
// System.out.println(this.getClass().toString() + ": getDataValue( " + arg0 + ", " + arg1 + " ) =
" + lRet);
return lRet;
}
@Override
public int getRowCount() {
// System.out.println(this.getClass().toString() + ": getRowCount = " + 2);
return 3;
}
@Override
public void setDataValue(int arg0, int arg1, Object arg2) {
}
@Override
public int getColumnCount() {
int lRet = 2;// Name & Type column
if (getProject().isSetJniProject()) {
Vector<Network> lNetworkV = getProject().getJniProject().getNetworks();
for (Network lNetwork : lNetworkV) {
lRet += lNetwork.countLineConnectors();
}
}
// System.out.println(this.getClass().toString() + ": getColumnCount = " + mColumnCount);
return lRet;
}
}
schrieb Dirk Fauth, Am 12.02.2013 09:29:
> Looks reasonable, I think the code for the IDataProvider you implemented should provide more
> information on that.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03430 seconds