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
Related
I have two forms for EmployeeDetail and DriverDetail for entering data.
Form 1 has 8 columns viz-Date,Name,Accno,ifsc,Amt,Mode,Comp,Salarymonth
Form 2 has 12 columns where 1-7 is same except SalaryMonth column plus 4 more AccHolder,Bank,Remark,Purpose in Form2 i.e DriverDetail
I have created a JFrame class for searching and retrieving data which will be shown below in the JTable.
My Coding is finished till designing of 2 forms now retrieving data from DB to JTable is pending .
While coding for JTable the below question arose ?
My Question is:
Do I have to design two JTable for retrieving from each form as there is no. of column mismatch?
Or Is it possible to use same JTable for both different forms ?
When i select EmpDetail then JTable with 8 column must appear and when i select driverDetail then JTable with 12 column must appear
Please suggest what can be done.
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
I've got a primefaces datatable with some data generated, with multiple selection and pagination and i have to count all the selected rows on each page and i done this but the problem is that i have to count also the number of subpages with selected items on it. So if i check 3 items on page number 1 and 3 items on page number 3 i want an output like: selected: 6 subpages: 2. Is there an easy way to count subpages ? For counting rows i just use a lenght of selected items table. How can i do this ?
You could use a listener in the bean to get current page onselection and kept a tally.
EX.
DataTable dataTable = (DataTable) FacesContext.getCurrentInstance().getViewRoot()
.findComponent("someOformID:someTableId");
dataTable.getPage()
What i want to do is to get all the tableItems from the selected row. but i have find out that the tableItems are stored in indexes (like in arrary) and not like give row and column and store it on specific cell of table (row, column).
So i have to go through all the next rows upto the end of table and then go through all the rows upto the selected row to get to my required tableItem.
See image for clearance of my question. The coloured row is the selected one. If i want to go from 'a' to 'b' and then 'c' and so on for complete row, i have go through all the next rows.
so now the problem is how can i get the total number of rows present in swt.table
A SWT TableItem IS a row in your Table. You can use it's getText(int index) method to get the contents of the column with index (starting from 0 for the first column) of the selected TableItem.
Therefor the number of TableItems is the total number of rows.
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