I'm trying to use a GridLayout with 2 rows and "4" columns to achieve the below:
Since I figured that I can't make row 2's column 1 span 1½ column, I figured that if I instead used say 8 columns, I could just span each column in row 1 over 2 columns, and then for row 2 column 1 I could span that over 3 columns
However if I try this I get the following result:
How can i get the result of the first one using GridLayout?
EDIT
Doesn't have to be GridLayout, if theres an obvious alternative
Related
I am trying to create a table in NatTable that has two columns.
The first column is straight-forward but I need help while creating the second one.
Each cell of the second column has to have a dynamic number of rows, like in the image provided. In other words, each cell of the second column is divided into a variable number of rows.
I am using NatTable because of it's capacity to handle large data. But any solution is good at this point. (JFace etc)
This is what I am trying to achieve (image)
This can be achieved by using the TableCellPainter. A description with an example is contained here: https://eclipse.org/nattable/nandn/nandn_110.php
I have the following code snippet.
int index = getEventList().indexOf(myObj);
SelectionLayer selectionLayer = getGlazedListsGridLayer()
.getBodyLayerStack().getSelectionLayer();
getNatTable().repaintCell(0,selectionLayer.getRowIndexByPosition(index));
When I run the code shown above, the affected cells only get repainted after I click on the table displayed in the GUI. If I comment out that code and use getNatTable().refresh(); it repaints without me having to first click on the table.
Is there a way to have a cell repainted without having to click on the table displayed in the GUI? I would hate to have to call refresh() for a large table where this code may be executed many times.
No you don't need to perform some additional step in order to trigger the repainting. The issue in your code is the usage of wrong index values. You have a grid so column 0 is the row header from the NatTable perspective. I suppose you want to redraw the first column of the body, which is index 1 from the NatTable point of view. Also the row index is incorrect, as you calculate the index in the SelectionLayer but actually need the index in the table, which is at minimum +1 if you only have a column header row.
Actually your code should work by adding 1 on the index if you have one row header column and one column header row in the grid.
getNatTable().repaintCell(1, selectionLayer.getRowIndexByPosition(index) + 1);
I have to calculate the webtable data.
A WebTable has 6 columns and 20 Rows. We have to calculate
On Form-1
addition of data in column1 (from row1 to row20)
addition of data in column2 ( from row1 to row20)
addition of data in column4= (from row1 to row20)
addition of data in column5= (from row1 to row20)
Similarly data on Form-2, and Form-3 with 6 columns and 20 Rows
But, On Form-4
6 columns available on that page but Rows are not 20. Rows count is not specific it might be anything less than 20.
Condition-1:
If addition of , then don’t count the values from that row. So, please suggest me how to program this in Java.
Page navigation point is at bottom
when Form-1 is open, page navigation is as shown below
1 - 2 - 3 - 4 - >
when Form-2 is open, page navigation is as shown below
<- 1 - 2 - 3 - 4 ->
when Form-4 is open, page navigation is as shown below
< - 1 - 2 - 3 - 4
I want to calculate the data of column1 from "Form-1,Form-2,Form-3 & Form-4".
Thanks in Advance.
Vivek
I am creating a table using itext. Now while setting header row, if I set table.setheaderrows(2) then it sets first 2 rows as the header. But in my case I want only row no. 2 (not row number 1) to be reprinted while table is extended on the next page.
Is there any way to achieve this?
If you only work with a single PdfPTable, you can't define the second row as the header row that needs to be repeated. The trick is to use two PdfPTable instances with the same widths for the columns. The first one would be a single row table for the first header row, the second one would start with the header row that needs to be repeated. If you add two tables to a document, one right after the other, they are glued to each other and nobody will notice that it's not a single table.
I have the following Problem.
Let's Say I have a JTable with the folowing Values:
1
2
3
4
5
Now I select "3" and press a button which saves the index of the row and prints "3"
I have another Button let's call it the "next button", when I press it it will print "4"
Now I sort (Or in this Case just randomise) the whole Table and it's now like this:
2
5
4
1
3
When I now press the "next button" I want it to print "1" because it's the value after "4".
How can I manage this to work ?
It already works when I'm not sorting the Table than I can just print the saved row +1...
Is there something like a sort Listener so I can overwrite the saved row with the new value?
Cheers Timothy
I suggest you dive into the world of TableModel. When programming in Swing it is usually best to split the model from the component straight away. Add a column to the table to handle order, but don't show it.
A simpler method, but a bit of a dead end, is to make the the object stored in the table of a type of your own devising. Just override toString to return the display representation.
As i understand that the problem is with the last index , in ur problem that when it's 4 the next one should be 1 . this problem can be done by makeing if condition .
fore example if i suppose u save the index in a varible rowIndex = 4;
if(rowIndex ==jTable.getRowCount()-1)
nextRowinsex = 1 ; // which is the first index