Skip to main content

added row in table (summary row)

6 replies [Last post]
Anonymous

Hello,
Can I add row (or any components) in table with same columns (length,size) like table's row
and that row is always visible (for summary and like information)

regards
Haris Peco

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
snpe

Hello,
I don't worry about value in tables - I want only visuals elements (they can be labels)
Jide framework have similar posibility
There is yet another cool thing for tables - first column (or more columns in begining) doesn't scroll with
scrollpane - when we do scroll columns 1,...x are visible always - it isn't important for me like summary row

Thanks
Peco
On Tuesday 14 June 2005 01:59 pm, jdnc-interest@javadesktop.org wrote:
> Just doing a little brainstorming..
>
> He could also keep the row inside his data structure by firing an event every time a node is added, which calls setValue... the event code could loop through the data structure and perform aggregate calculation (sum of X column, or count of Y column, or whatever) then call setValue, passing it the location of the summary row and the aggregate calculation.
>
> If the data structure were a Vector, he could also opt to keep the summary row at the bottom of the table rather than the top, by removing and re-adding the summary row each time the event is fired. There could also be a separate event fired when any value in the summary column is modified (are the cells editable?) that just updates the value in the summary row, but doesn't remove or re-add the entire row.
>
> If fire___ events don't exist for this, you can write them easily - the issue is determining when columns are added or removed, or when a column you care about has its value changed.
>
> I still agree 100% that it would be weird if he wanted this row to be visible all the time within a ScrollPane. He'd have to keep track of the currently displayed rows, and perhaps move the summary row around in the data structure (without firing the previously mentioned events of course) so that it bumps other rows out of the viewport so that the summary can be seen. Sounds complicated...
>
> Sean
> ---
> [Message sent by forum member 'allquixotic' (allquixotic)]
>
> http://www.javadesktop.org/forums/thread.jspa?messageID=91800
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
> For additional commands, e-mail: jdnc-help@jdnc.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

Patrick Wright

Haris

Can you clarify if you mean a JTable (JX, JN) or DataTable?

Regards
Patrick

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

snpe

JTable (or JXTable)

I want one row (yet) and that is same like table's row (change column's size together with table)
and that it is visible always

I try with row+1 in table, but it isn't visible always

I think like this :

- main table in CENTER
- added row in SOUTH
- I will add sum of rows (or like sum data) in this row

Thanks
On Tuesday 14 June 2005 07:26 am, Patrick Wright wrote:
> Haris
>
> Can you clarify if you mean a JTable (JX, JN) or DataTable?
>
>
> Regards
> Patrick
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
> For additional commands, e-mail: jdnc-help@jdnc.dev.java.net
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

Patrick Wright

Not sure if I can help much, then.

There are different ways to accomplish this, and I think it's a Swing
issue and not a JDNC issue. Others should jump in, please.

My thoughts:

1) Your rows are read from a TableModel. If you are willing to show
the row at the top in all cases, you can have getValueAt(row, col)
return the summary values as row 0 in all cases, and start your data
with row 1. Make sure the summary row is excluded from any
sorting--maybe just don't include it in the data structure and offset
reads into your data structure by 1.

2) You need a splitter on the table, as with Excel or other
spreadsheets. Anyone--is this available on a row-basis? I don't
remember seeing it and haven't tried to do this.

Because rows in a JTable can be cut off within a ScrollPane, it might
be harder to apply trick (1) to have the row at the bottom of the
table even when scrolling, though I'm sure with some Swing magic this
might work, to restrict the ScrollPane to scrolling complete rows, and
to figure out how many rows will be displayed--could be a boondoggle.

Anyone else? I am sticking my foot in my mouth, to be sure.

Regards
Patrick

---------------------------------------------------------------------
To unsubscribe, e-mail: jdnc-unsubscribe@jdnc.dev.java.net
For additional commands, e-mail: jdnc-help@jdnc.dev.java.net

allquixotic
Offline
Joined: 2005-05-31

Just doing a little brainstorming..

He could also keep the row inside his data structure by firing an event every time a node is added, which calls setValue... the event code could loop through the data structure and perform aggregate calculation (sum of X column, or count of Y column, or whatever) then call setValue, passing it the location of the summary row and the aggregate calculation.

If the data structure were a Vector, he could also opt to keep the summary row at the bottom of the table rather than the top, by removing and re-adding the summary row each time the event is fired. There could also be a separate event fired when any value in the summary column is modified (are the cells editable?) that just updates the value in the summary row, but doesn't remove or re-add the entire row.

If fire___ events don't exist for this, you can write them easily - the issue is determining when columns are added or removed, or when a column you care about has its value changed.

I still agree 100% that it would be weird if he wanted this row to be visible all the time within a ScrollPane. He'd have to keep track of the currently displayed rows, and perhaps move the summary row around in the data structure (without firing the previously mentioned events of course) so that it bumps other rows out of the viewport so that the summary can be seen. Sounds complicated...

Sean

allquixotic
Offline
Joined: 2005-05-31

It sounds like *his* idea was to create another table directly beneath the first, with exactly one row - but his problem is that the columns' sizes didn't stay synchronized (you can see why, they are two different tables) and for some reason the one-row was sometimes failing to appear in the summary "table" at all. Not sure if I'm as comfortable with that idea as having it within the same table...