Plz rescue me from delete prob of sorting jtable

i have a JTable referneced to SortableTableModel which is a seperate class and extended to DefaultTableModel, this jtable has diff classes of TableSorter.
in main panel program sorting works find but when I delete a record it doesnt work and delete the wrong row frm the view and i tried many ways to fix it...please help me if you know who has sorting classes working fine somewhere plz send me the sources...thanks...
my email is [email protected]
here is the part where i am deleting the row in my panel, as you can see i tried diff things to fix ...nothing worked..:(
JOptionPane.showConfirmDialog(null,
int deletedRow = abcTable.getSelectedRow();
tableModel.removeRow(deletedRow);
//abcTable.tableChanged(new TableModelEvent(tableModel));
tableModel.fireTableRowsDeleted(deletedRow,deletedRow);
//tableModel.sortByColumn(sortCol, isAscent);
//tableModel.fireTableDataChanged();
((SortableTableModel)header.getTable().getModel()).sortByColumn(sortCol, isAscent);
//abcTable.revalidate();
// ((SortableTableModel)header.getTable().getModel()).sortByColumn(sortCol, isAscent);
//tableModel.indexes = tableModel.getIndexes();
//abcTable.repaint();
// tableModel.fireTableRowsDeleted(deletedRow,deletedRow);
// update indexes with removed row
// tableModel.indexes = tableModel.removeIndexfromIndexes(deletedRow);
// ((SortableTableModel)header.getTable().getModel()).sortByColumn(sortCol, isAscent);
//tableModel.indexes = tableModel.getIndexes();
//tableModel.removeRow(sorter.convertSortedRowIndexToModel(abcTable.getSelectedRow()));
//=====------------------
plz try rescue me
THANKS
amir

Hi!
The data is sorted in the tableSorter class and not in the tableModel class. Change your code like this and check
Add this method to your tableSorter class:
     public int convertToSortedRow(int i) {
          if (indexes!=null) return indexes(i);
          return i;
And during deleting use:
//row in sorted view
int deletedRow = abcTable.getSelectedRow();
// actual row in data model
int actualRow = sorterObj.convertToSortedRow(deletedRow);
tableModel.removeRow(actualRow);

Similar Messages

  • Plz rescue me from delete prob of table sorting

    i have a JTable referneced to SortableTableModel which is a seperate class and extended to DefaultTableModel, this jtable has diff classes of TableSorter.
    in main panel program sorting works find but when I delete a record it doesnt work and delete the wrong row frm the view and i tried many ways to fix it...please help me if you know who has sorting classes working fine somewhere plz send me the sources...thanks...
    my email is [email protected]
    here is the part where i am deleting the row in my panel, as you can see i tried diff things to fix ...nothing worked..:(
    JOptionPane.showConfirmDialog(null,
    int deletedRow = abcTable.getSelectedRow();
    tableModel.removeRow(deletedRow);
    //abcTable.tableChanged(new TableModelEvent(tableModel));
    tableModel.fireTableRowsDeleted(deletedRow,deletedRow);
    //tableModel.sortByColumn(sortCol, isAscent);
    //tableModel.fireTableDataChanged();
    ((SortableTableModel)header.getTable().getModel()).sortByColumn(sortCol, isAscent);
    //abcTable.revalidate();
    // ((SortableTableModel)header.getTable().getModel()).sortByColumn(sortCol, isAscent);
    //tableModel.indexes = tableModel.getIndexes();
    //abcTable.repaint();
    // tableModel.fireTableRowsDeleted(deletedRow,deletedRow);
    // update indexes with removed row
    // tableModel.indexes = tableModel.removeIndexfromIndexes(deletedRow);
    // ((SortableTableModel)header.getTable().getModel()).sortByColumn(sortCol, isAscent);
    //tableModel.indexes = tableModel.getIndexes();
    //tableModel.removeRow(sorter.convertSortedRowIndexToModel(abcTable.getSelectedRow()));
    //=====------------------
    plz try rescue me
    THANKS
    amir

    If you are using the TableSorter downloaded from SUN, then you might have problem deleting row from the table once it's sorted.
    Here is my solution:
    Step 1:
    Add the following method to TableSorter class.
    public int getTranslatedIndex(int sortedIndex)
        checkModel();
        return indexes[sortedIndex];
    }Step 2:
    The row index you get from the Table does not reflect the real index once the table has been sorted. You will need to tranlate the row index in order to find the real row index in your table modle.
    int row = Table.getSelectedRow();
    int realRow = TableSorter.getTranslatedIndex(row);
    TableModel.removeRow(realRow);Good Luck :)

  • Launching Rescue & Recovery from a Command Line

    Question - I would like to know how I can launch Rescue & Recovery from a command line.
    Issue that is prompting the question -  My laptop was sitting in my computer bag overnight. The battery was fully charged. I BELIEVE that it was in suspend mode at the time. When I opened it in the morning, there was a message on the screen saying that a backup had not completed successfully. I then noticed that the battery had run down completely.
    My Plan - I would like to launch Rescue & Recovery (as well as the Defrag utility) from Windows Task Scheduler. If I do, then all schedule tasks will be launched and controlled using the same process. Windows Task Scheduler also provides two key scheduling criteria that the IBM Rescue & Recoverry or the IBM Maintenance Manager utilities do not provide -
    #1 - Run this task only when the PC is on AC power.
    #2 - Run this task ony when the computer is idle (so that it doesn't slow down the PC if I happen to be working on it)
     Background Concerns -
    - Having a backup job automatically start when the computer is in my computer bag will run down my battery when I least expect it.
    - The PC may could also be damaged due to overheating, since the sides of the computer bag  block the ventilation holes.
    Additional Info
    - If I go to the ThinkVantage Productivity Center and select the Quick Link for "Backup Now" this will indeed launch a backup on demand. I assume that selecting this option is calling a specific executable file.
    - However, the only two applicable executable files that I see in the C:\Program Files\Lenovo\Rescue and Recovery directory are "mr_gui.exe" and "wizrr.exe". Both of these files launch an interface that requires the user to make a selection. As a result, it doesn't look as if either of these files would work for unattended operation, unless there is some sort of switch that I can put in that will automatically start the backup process.
    - I called the support line (only once so far), but that particular rep did not know of any way to launch Rescue & Recovery other than from the standard R&R user interfaces.
     Any help is greatly appreciated,
    Mathew

    The correct way to invoke a JSP is to make a request to the Server.
    Normally you would use your browser to do this.
    On a unix system, you can use the wget command to invoke a url without using a browser.

  • TS4002 stop email from deletion when deleted on another device

    how to stop email from deletion when deleted on another device.

    With IMAP - the email protocol the iCloud uses - the messages live on the server and are read from there by your devices. Think of it as being like webmail and it makes sense. Therefore when your wife deletes a message she is actually deleting it from the server, which is why you see it as deleted. You can't alter this; it's inherent in the system.
    The only workaround is to sort out a method whereby emails don't get deleted until both of you have seen them - for example she could move them to another folder and you could then read them there and delete them (so their presence in that folder always means that the other person has seen them).

  • How do I keep my Itunes 10.5 from deleting my music library? E

    Every time I shut down my macbook pro, and start itunes up again, my music is all gone but the files are still in the finder folder. It's a hassle to create a new itunes library and having to make my playlists all over again every time. Ever since I upgraded my computer software with the software update, I been having problems. First, the mp3 files in the finder folder have been missing the artwork. But I managed to fix that and now the mp3 files in the finder folder are back again. Now my itunes has me worried. I deleted itunes and tried downloading the software all over again, to see if that would work, but it didn't. This is the 3rd time I'm having to create my itunes library all over again. I own a ipod touch 4g and I need itunes 10.5. The touch won't work on anything older than that. As of now, I redownloaded itunes all over again. Itunes 10.5.1 is what I have now, but i'm still worried it will delete my itunes library all over again. I don't want to keep having this same problem every **** time. I want my itunes library to stay in my itunes every time i open it up. Does anybody know what i can do to prevent this please? I tried everything, and I even downloaded a antivirus for mac. And I don't have a virus on my computer. Which is a relief. Please help. I own a macbook pro. What can I do to stop itunes from deleting my library over and over again? Thanks!            -Samantha

    There is other options like http://supersync.com that I've tried but it is a headache.
    Another option: http://lifehacker.com/5715126/how-to-sync-itunes-across-all-your-computers-with- dropbox
    I prefer iTunes Match.
    Good luck

  • How to restrict the user(Schema) from deleting the data from a table

    Hi All,
    I have scenario here.
    I want to know how to restrict a user(Schema) from deleting the values from a table created in the same schema.
    Below is the example.
    I have created a table employee in abc schema which has two values.
    EMPLOYEE
    ABC
    XYZ
    In the above scenario the abc user can only fire select query on the EMPLOYEE table.
    SELECT * FROM EMPLOYEE;
    He should not be able to use any other DML commands on that table.
    If he uses then Insufficient privileges error should be thrown.
    Can anyone please help me out on this.

    Hi,
    kumar0828 wrote:
    Hi Frank,
    Thanks for the reply.
    Can you please elaborate on how to add policies for a table for just firing a select DML statement on table.See the SQL Packages and Types manual first. It has examples. You can also search the web for examples. This is sometimes called "Virtual Private Database" or VPD.
    If you have problems, post a specific question here. Include CREATE TABLE and INSERT statements to create a table as it exists before the policies go into effect, the PL/SQL code to create the policies, and additonal DML statements that will be affected by the policies. Show what the table should contain after each of those DML statements.
    Always say which version of Oracle you're using. Confirm that you have Enterprise Edition.
    See the forum FAQ {message:id=9360002}
    The basic idea behind row-level security is that it generates a string that is automatically added to SELECT and/or DML statement WHERE clauses. For example, if user ABC is only allowed to query a table on Sunday, then you might write a function that returns the string
    USER  != 'ABC'
    OR      TO_CHAR (SYSDATE, 'DY', 'NLS_DATE_LANGUAGE=ENGLISH') = 'SUN'So whenever any user says
    SELECT  *
    FROM    table_x
    ;what actually runs is:
    SELECT  *
    FROM    table_x
    WHERE   USER  != 'ABC'
    OR      TO_CHAR (SYSDATE, 'DY', 'NLS_DATE_LANGUAGE=ENGLISH') = 'SUN'
    ;If you want to prevent any user from deleting rows, then the policy function can return just this string
    0 = 1Then, if somone says
    DELETE  employee
    ;what actually gets run is
    DELETE  employee
    WHERE   0 = 1
    ;No error will be raised, but no rows will be deleted.
    Once again, it would be simpler, more efficient, more robust and easier to maintain if you just created the table in a different schema, and not give DELETE privileges.
    Edited by: Frank Kulash on Nov 2, 2012 10:26 AM
    I just saw the previous response, which makes some additional good points (e.g., a user can always TRUNCATE his own tables). ALso, if user ABC applies a security policy to the table, then user ABC can also remove the policy, so if you really want to prevent user ABC from deleting rows, no matter how hard the user tries, then you need to create the policies in a different schema. If you're creating things in a different schema, then you might as well create the table in a different schema.

  • Trying to decode this from USB Prober re. old joystick device

    I'm troubleshooting a USB issue with an old joystick device. I can't find explanations to the various fields in USB Prober, i.e. what are the consequences of specific values/labels. I would like to verify that this device will not work with OS Mavericks or if possible find a workaround.
    The device shows up on USB Prober, but it will not show up in "Joystick and Gamepad Tester" for Mac and will not work in FG v3.0 for Mac.
    The device does work under a virtual WinXP on my iMac, but the application (FG v3.0) under the virtual machine is running very slow.
    I suspect the "Not Captive" could be the problem, but I would appreciate help to simply understand what the various outputs from USB Prober means for this device and what you think causes it not to work and of course if there is any way in your opnion to make it work.
    From USB Prober:
    Full Speed device @ 5 (0xFD130000): .............................................   Composite device: "Wingman Force"
        Port Information:   0x0018
               Not Captive
               External Device
               Connected
               Enabled
        Device Descriptor  
            Descriptor Version Number:   0x0100
            Device Class:   0   (Composite)
            Device Subclass:   0
            Device Protocol:   0
            Device MaxPacketSize:   8
            Device VendorID/ProductID:   0x046D/0xC281   (Logitech Inc.)
            Device Version Number:   0x0100
            Number of Configurations:   1
            Manufacturer String:   1 "Logitech"
            Product String:   2 "Wingman Force"
            Serial Number String:   0 (none)
        Configuration Descriptor  
            Length (and contents):   32
            Number of Interfaces:   1
            Configuration Value:   1
            Attributes:   0x40 (self-powered)
            MaxPower:   0 ma
            Interface #0 - Vendor-specific  
                Alternate Setting   0
                Number of Endpoints   2
                Interface Class:   255   (Vendor-specific)
                Interface Subclass;   255   (Vendor-specific)
                Interface Protocol:   255
                Endpoint 0x82 - Interrupt Input  
                    Address:   0x82  (IN)
                    Attributes:   0x03  (Interrupt no synchronization data endpoint)
                    Max Packet Size:   16
                    Polling Interval:   8 ms
                Endpoint 0x01 - Interrupt Output  
                    Address:   0x01  (OUT)
                    Attributes:   0x03  (Interrupt no synchronization data endpoint)
                    Max Packet Size:   32
                    Polling Interval:   4 ms
    From Logitech support forum:
    Re: Logitech Wingman Force & Windows 7 64-bit
    Options
    06-25-2012 11:21 AM
    SO:
    The Wingman Force and Formula Force are not USB HID products
    They do not use the common drivers that HID products can
    They are serial products that can use a special USB adapter and communicate to the PC in very nonstandard ways
    Their feedback effects HAVE to be prewritten to the memory of the device and executed by calling to the memory space of the effect. Every USB Force Feecback device we made after these two devices can accept on-the-fly effects sent to them from the comptuer and do not require preloading to the hardware.
    The memory of the device was quite good at the time of the build, but now and with what game developers are doing, it's very limited
    To extend the life of the product, we implemented ever-more complex tricks to get the device to transparently work as long as possible, but modern game effects continued to put more demand on the hardware.
    With 64-bit addressing, our tricks were completely broken. Considering the limitations of the hardware on such a fundamental level, we did not continue development. To unify the codebase, all support was taken out for both 5.x builds, and if you want to continue using this product, use LGS 4.6 on a Windows x86 machine.
    Our LGS 4.6 code is not prepared for public release and I do not think we will ever release it openly.
    Update: Here is more information from USB Prober IORegistry:                5: Wingman Force@fd130000  <class IOUSBDevice>
    Message was edited by: renapple

    As long as you have not reloaded much (or any) new information to the iPod (or the PCs), the following links will direct you to software that has a chance of recovering some or all of your music files. Most are not shareware or freeware, so you may have to spend a little money.....
    This PodSalvage software will only work with Macs running OS X. See the PodSalvage page at SubRosaSoft.com: http://www.subrosasoft.com/MacSoftware/index.php?mainpage=product_info&productsid=2
    This link will give you several 'Erased iPod' recovery resources for both Mac and Windows users:
    http://forums.ipodlounge.com/showthread.php?s=&threadid=45619
    Make sure you read through many of the posts on the iLounge – some folks had good results, others had poor results. There seems to be a split camp on the effectiveness of recovery programs.
    Either way, strongly consider a backup strategy after you recover/replace your music: http://discussions.apple.com/click.jspa?searchID=210939&messageID=1215125
    http://www.recover4all.com/
    http://www.pcinspector.de/file_recovery/UK/welcome.htm
    http://www.handyrecovery.com/index.shtml
    http://www.stellarinfo.com/mac-data-recovery.htm
    http://www.binarybiz.com/vlab/mac.php
    http://www.yamipod.com/main/modules/home/

  • Is it Ok to remove old .plist files remaining from deleted software?

    Hi Folks,
    I'd appreciate some thoughts from some of you experts here.
    I''m doing some house cleaning of my OSX Mountain Lion and have found some old .plist files in my preferences folder, that remain after the software was removed long ago. For Example, I found some old Color Munki files remaining from when I tried a Color Munki unit for a week or so and sent it back, unstalling alll of its associated software.
    Any harm in throwing these in the trash and emptying it?
    And I guess on a more general basis can old files left over from deleted software be removed as well?
    Many thanks

    Installing 3rd party apps can affect permissions on system files and folders. Running Repair permissions ensures all system files permissions are set to what they should be as listed in the BOM, stored in Library/Receipts.
    If you can provide me one argument as to why that isn't worth doing, I might let you keep that chicken's head...

  • Read from a textfile and sort scores

    Hi!
    I'm making a highscore list but I have some issues. How do I read values from a textfile and sort them (highest on the top). I only know how to write and read from the file. But not how to sort the values inside it when I get a new score. I just keep writing at the end of the file all the time.
         public static void writeToFile() throws IOException
              pw = new PrintWriter(new FileWriter(filP,true));
              for(int i = 0; i < 1; i++)
                   pw.println(a);
              pw.close();
         public static void highScore() throws IOException
              FileReader    fr = new FileReader(filP);
              BufferedReader    br = new BufferedReader(fr);
              String    lasa = br.readLine();
              while(lasa != null)
                   out.println(lasa);
                   lasa = br.readLine();
         }Thanks for help!

    Thechrismeister wrote:
    ...I only know how to write and read from the file. But not how to sort the values inside it when I get a new score. I just keep writing at the end of the file all the time. 1. Read the file into a data structure
    2. Add the new score into the data structure
    3. Sort the data structure
    4. Write the data structure back to the file

  • Project Online - Can't Delete Resource and User from Delete Enterprise Objects

    I would like to link a resource account to a user account but I ran into an error: "The resource account
    is already in use.".  This is a known issue which I attempted to resolve by following the instructions in KB2881398.
    However when deleting the selected resource from Delete Enterprise Objects I get a message indicating success ("The
    selected Resources and Users have been deleted.") but the duplicate user is still in the listing in Delete Enterprise Objects and when attempting to link the remaining resource to a user logon account I still get the error
    "The resource account is already in use."
    Why is the user not deleted even though Delete Enterprise Objects reports success and how can I delete these duplicates to be able to successfully link the account?

    Hi,
    This might be due to your Exchange Sync issue, where your project workspace is unable to delete that user from local DB. Try following steps to diagnose the problem:
    1) Go to your Resource Pool, DELETE a resource.
    2) While resource is being Deleted, open another window 
    Server Settings -> Manage Queue Jobs
    3) Here you can view the progress of your current Resource Deletion update, check if all goes smooth and your Resource is deleted successfully by showing process completion 100% :
     ( to view any error look at the
    last column of table on Manage Queue Job page)
    4) Cross check your Resource by running Resource Availability Report.
    Basically this will give you a fair idea of your resource deletion problems and how system is responding to it.
    Regards

  • Stopping the assembler from deleting the war file

    Is there any way to stop the Web Services assembler from deleting the build directory (or the war file) after it is done packaging the ear file? I want to take the war file and package it into my own ear file.

    Using wsa from 10.1.3, you have the -war option wich can be used to provide the location where to put the file that will be otherwise packaged in the war file.
    For more details check the documentation page 172 at http://download-west.oracle.com/otn/java/oc4j/1013/doc/web.1013/b14434.pdf
    Hope this helps,
    Eric

  • BAPI to change invoice document status from deleted to something else

    Hi experts,
    When the document is deleted thorugh MR8M, the invoice status(rbstat) in rbkp table of the invoice doument(MIRO) change to 2 i.e. deleted.
    I want to use the same data for parking again by using standard BAPI_INCOMINGINVOICE_GETDETAIL. But v=before that i have to change the status of the document from deleted to something else
    Is there any BAPI exist by which i can change the status (rbstat) from deleted to parking or somthing else. i am trying to change it thorugh BAPI_INCOMINGINVOICE_CHANGE , but its not working.
    Please help me to find such BAPI
    regards
    Mudit

    Hi Lan,
    you can print with SDK using following code :
    ReportLayoutsService oReportLayoutService = SBO_Company.GetCompanyService().GetBusinessService(ServiceTypes.ReportLayoutsService);
    ReportLayoutPrintParams oReporPrintParams = oReportLayoutService.GetDataInterface(ReportLayoutsServiceDataInterfaces.rlsdiReportLayoutPrintParams);
    ReportParams oReportParam = oReportLayoutService.GetDataInterface(ReportLayoutsServiceDataInterfaces.rlsdiReportParams);
    oReportParam.ReportCode = "QUT1";
    DefaultReportParams oReportParaDefault  = oReportLayoutService.GetDefaultReport(oReportParam);
    oReporPrintParams.LayoutCode = oReportParaDefault.LayoutCode;
    oReporPrintParams.DocEntry = 337;
    oReportLayoutService.Print(oReporPrintParams);
    I tried to print an unprinted document but it didn't change the printed flag at all ( in / active BP ). So unfortunately it doesn't work.
    regards,
    Maik

  • Restricting the user from deleting a personel number

    Hi All,
    Can anyone help me in restricting the user from deleting a personel number.
    Thanks & regards,
    Venkat

    Hi Venkat,
    The utility menu will ultimately calls to PU00 so it doesnt matter , system wont allow him to delet.
    You can try it out in quality if you want.
    Award points if useful
    Regards,
    Bhupesh Wankar

  • Stop user from Deleting Staffing Data

    Hi Friends,
    We are implementing cProjects.  We need to control Deleting of Staffing from a project, because the deletion of staffing record is a hard delete.  The data is removed from the staffing tables of cProjects.  So if someone is staffed, data saved and then is deleted we are not able to capture this information as who was staffed earlier whose record is no more now.
    When some user changes the staffing dates, we are able to capture this in the BADI DPR_ATTRIBUTES, as the check method gives us the old attributes of the record as well as the new one that has been changed.
    But if some staffing is deleted, the DPR_ATTRIBUTES does not indicates
    through some variable that delete action has been performed for a
    record.
    Request you to suggest which BADI shall be implemented to capture
    Delete staffing data event that brings in the role that is being
    deleted such that we can stop the record from deleting in case we want to do so.
    We are very near to go-live and have already missed two deadlines till
    date, so request you all to help.
    Regards, Sandeep

    Hi,
    the BAdI DPR_ATTRIBUTES also has a method called DELETE_CHECK, this is called when staffing is deleted (called in class CL_DPR_PARTICIPANT and method DELETE_CHECK), so you could implement your own logic here.
    Regards,
    Silvia

  • Deny access from deleting *.txt file?

    HI all,
    I have created a *.txt file from xcode with objective c using NSFileManager.Also i gave permission to this file like below,
    [NSDictionary dictionaryWithObject:[NSNumber numberWithUnsignedLong:0000u] forkey : NSFilePosixPermissions];
    so that there is no read/write permissions.This is working fine too.
    Apart from above,i want to deny users from deleting this file..How can i mention this in objective c.?Please help..
    Thanks
    Athira

    Hi Athira,
    You'll have more luck in getting a response to this if you posted in on the Apple Developer Forums.
    devforums.apple.com
    You need to be a registered (and paid) up member to access the developer forums.
    Good luck!

Maybe you are looking for

  • How do i switch from copy mode to print mode on my office jet 4500 wireless?

    Having trouble switching back to print mode on my printer? I can only switch from copy to fax to scan. How do I switch to print???

  • Virtualbox and Windows 7

    Hi I install virtual box and i need windows 7 in my arch. but it have error and i can't install windows 7 or xp see this: http://www.pic.iran-forum.ir/images/d0z - byvrhg.png Moderator edit: The included image is too big. See post below. -- bernarche

  • Not able to connect to portal / MDM after some time

    Hi, I am displaying some data in Portal from MDM. The connection goes successful for some time after that , connection hangs. The flow come till ExecuteMatchingStrategyCommand executeMatchingStrgyCom = new ExecuteMatchingStrategyCommand(objcon.connec

  • Confirm emails are being received

    I am looking for an application like MSGTAG - MessageTag for the Mac as I would be really helpful to know if my email have been received by my clients. Can anyone help. http://msgtag.com/home/

  • Graphical Sudo

    Hi, I'm looking for something that will create a sudo popup when using graphical applications for example: If i open an archive file with xarchiver and would like to drag it with the mouse to a certain dir opened in thunar and it doesn't have permiss