aspose file tools*
The moose likes Applets and the fly likes Problem with cell Editing of three columns Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Problem with cell Editing of three columns" Watch "Problem with cell Editing of three columns" New topic
Author

Problem with cell Editing of three columns

Kushi Gadiparthi
Ranch Hand

Joined: Sep 23, 2010
Posts: 52
Hi All,

I am having a problem in editing three columns,
My problem is , I am able to edit the three columns and able to get the values of three columns,

But if I won't edit any one of these three columns even though I am asigning the value manually ,the editor value is pointing to null

I am giving the code below,


The if statement which I had used in the code is not executing, and I am not getting any errors
Please can any one help me in this,


Jashvika
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

Which if statement is not executing?


Swastik
Kushi Gadiparthi
Ranch Hand

Joined: Sep 23, 2010
Posts: 52
Hi Swastik Dey,

thanks for your quick reply

Not even one of th if is working

If editor value is null I am unable to asign the value through the if statements
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6



Now in the above case even if stepname is null, the ternary operator and if condition must execute.
Kushi Gadiparthi
Ranch Hand

Joined: Sep 23, 2010
Posts: 52
Hello Swastik Dey,



I had tried the code like this also ,

But even the Print statements is also not executing,

I am not understanding that where I had done a mistake,

Could you give me any Idea,

Thanks a lot,
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

http://download.oracle.com/javase/1.4.2/docs/api/javax/swing/JTable.html#getCellEditor(int,%20int)

Is there any problem with the parameters passed to the method?

Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

Put the entire code in a try catch handler and see if you get any exception. If you have three columns, this line is likely to throw some exception

Kushi Gadiparthi
Ranch Hand

Joined: Sep 23, 2010
Posts: 52
Hello Swastik Dey,

No, I am printing the values also,

If we are not editing the value, then the cell is going to be blank,

In order to avoid this I am again passing the old value which is in the cell before editing,

But I am unable to do that, Still my cell is pointing to blank,

Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

From where are you passing the old values?
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

If you just wish to retrieve values of the cells, I think its better to use getValueMethod of JTable class.

http://download.oracle.com/javase/1.4.2/docs/api/javax/swing/table/TableModel.html#getValueAt(int,%20int)
Kushi Gadiparthi
Ranch Hand

Joined: Sep 23, 2010
Posts: 52
Swastik Dey,

I am getting the values from the before table,

and passing them here, But there is not at all a problem from the old values

Because I am Printing the values befor asigning them, So they are perfect,


Thank you very much for spending your valuable time
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

What exactly do you mean by before table? Do you mean that you have two tables, and values retrieved from is assigned to another one? Sorry if I am wasting your time.
Kushi Gadiparthi
Ranch Hand

Joined: Sep 23, 2010
Posts: 52
Swastik Dey,

No Don't think like that of wasting my time,

Actually I am displaying a table and it is having "4" columns and some "x" number of rows,

columns names are(ID, Step Name, Step Type, DTSPackage)

if the user double clicks in the ID column of any row then a new sub screen is opened with the table of same row values,

So, to do this I am reading the values from the main table and displaying the single row with the edit mode inorder to edit the values

So I am assigning the same values which I had read from the main table when the user does not edit the value(as it is pointing null , if the user does not edit it),

for this I am using the code which I had send to you before,

If you want I will send the total java code what I am using,

Thanks a lot

Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

If you wish you can.
Kushi Gadiparthi
Ranch Hand

Joined: Sep 23, 2010
Posts: 52
Swastik Dey,



Here is the code, please have a look,

Thanks
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

You are probably getting the values from your previous table in the constructor, correct me if I am wrong. But which method is setting the values in the new table?
Kushi Gadiparthi
Ranch Hand

Joined: Sep 23, 2010
Posts: 52
Hello Swastik Dey,

Yes I am getting the values from my previous table,

and the method is

and actual method used is

and the code used for this method to get the data is

this one to set the values from the table,

Thanks a lot,
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

Look at these three lines


Don't you think that when setDataSet(data) is called, the variable data has been just initialized( StorageDataSet data = new StorageDataSet(); ), but it does not contain any thing.

I think the code should be
Kushi Gadiparthi
Ranch Hand

Joined: Sep 23, 2010
Posts: 52
Hello Swastik Dey,

Well, I don't think so,

Because my getData() method is working perfectly and I am getting the data also,

My main problem is just to replace the unedited value with the previous value instead of null[code=java]


Thanks,
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

If you include a print statement in between, what does data print?

Kushi Gadiparthi
Ranch Hand

Joined: Sep 23, 2010
Posts: 52
Hello Swastik Dey,



I am getting this value for the above print statement

Data value=com.borland.dx.dataset.StorageDataSet@1cd6d1f:ID=6:Step Name=Load Fact Table:Step Type=Transaction Data UploadTS Package=AM_OPS_CTRL_TX_OA_UPLOAD_OPS_DATA

This is the value which I am getting from the table,

Thanks,
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

And this data is set to the table, but the table cell values are still null??
Kushi Gadiparthi
Ranch Hand

Joined: Sep 23, 2010
Posts: 52
But I am setting the data to my table

Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

So, even after calling the method you are getting a blank table, right? Probably the setDataSet method belongs to either of these two classes, CBRCommentedTable/CBRDefaultTable. Can you show the code of showDataSet method?
Kushi Gadiparthi
Ranch Hand

Joined: Sep 23, 2010
Posts: 52
No, It does not belong to those 2 classes,

It belongs to class

Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

I haven't worked with this third party library, however I just went through the api doc of the class you mentioned, but I didn't find any method called setDataSet. Please have a look.

http://147.91.177.212/extra/java2/libs/dbswing/ref/dx/com.borland.dx.dataset.StorageDataSet.html
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

More over your getTable() method is returning CBRDefaultTable, so the method should belong to this class, correct me if I am wrong.
Kushi Gadiparthi
Ranch Hand

Joined: Sep 23, 2010
Posts: 52
yes, you are right getTable() belongs to CBRDefaultTable
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

And you are calling setDatSet method on this, right?
Kushi Gadiparthi
Ranch Hand

Joined: Sep 23, 2010
Posts: 52
Hello Swastik Dey,

Apologies for the late reply!
Yes, I am calling ,


Thanks,
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1477
    
    6

No need for the Apologies. Now the point is the data you are getting is not null. However after calling the setDataSet method with this data, you are getting a blank table. So it seems that there is something wrong with the setDataSet method, correct me if I am wrong.
Kushi Gadiparthi
Ranch Hand

Joined: Sep 23, 2010
Posts: 52
Hello Swastik Dey,

I don't think so because I am getting tha data for the table perfactly,

My problem is not related with this because I am getting the row values perfectly after getting the data in to the table, I just want to substitute this values if the related cell is not edited


Thanks

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with cell Editing of three columns