How do I filter the JTable lines such as changing data

Hello

all suggestions are welcome, I'm at a bit of a dead-end at the moment.

So, I have a JTable supported by a table model. The data in the table are likely to change while the system is running, when it does certain events are triggered. Table pattern listen to the appropriate events so he could work on what line in the table must be updated, I can call then through the
int row = determineWhichRow( changedDataObject );
fireTableRowsUpdated( row, row );
Correctly, this causes the row in the table to be updated. Now, the bit that's not going to. The user is able to activate filters on the table, more precisely on an attribute of the data in this table that changes. So when I raise the updated event I need to my line (with the filter set) re sorter - sort the table. Have a look there is a method on line sorter:
getSortsOnUpdate()
that the Javadoc, I thought I would create the behavior that I needed - assuming that I told it to return true. This after trying the functionality remains the same, that the data model changes, update the values in the table but the filters don't are not reapplied.

Debugging in the code of the jdk to get an idea of what might happen on this subject seems that filters are called and it determines that the modified line must be filtered, but gets to a point where it was decided that because the event from the table model was an event of update should not call a repaint and resizing method and nothing seems to happen.

I think that simply re-defining the line on the table sorter would cause the desired effect but would be incredibly inefficient with a data model that can potentially change at any time. I can put the specific line number and the jdk version if this will help anyone, but I hope that you all will be able to give me an idea of what I might have missed.

Thank you

Dan.

Hello

Thanks for the update and the NBS.

I tested my 'Hammer' solutions in the SOFTWARE, and they work.

then sorterChanged is true, nothing is being edited so the first block is not entered, then the second block when a method of resizeAndRepaint - that sounds more useful since it seems that repaint correct is missing - is not entered because the event is an UPDATE.

It reminds me that referred explicitly to the javadoc for setSortsOnUpdate + "by example, if this is true, and that the user modifies an entry the location of this element in the view can change." The default value is false. ' +, so apparently they had mounting in mind and not other consequences, such as filtered lines by changing the number of lines and the line of the table positions.

The resizeAndRepaint is only call revalidate and which I've tried first JTable #tableChanged repaint (earlier in the call tree) and call revalidate and paint - I don't know how much of the impact that could have on performance.

Probably the same impact on one than the other methods of Hammer (I don't know paint involves sorting and filtering, which would frustrate the purpose of caching the results of sorting; have you tried and it works?).

I also notice in the private method DefaultRowSorter.shouldOptimizeChange () , which is called somewhere at the treatment of the update of the line, that the code checks to see if the change is over one-tenth (and Yes, the ten are hardcoded!) lines and doesn't force not re - sorting so this isn't... With the explicit comment 'changed too, sort all this '. I really wonder how much they paid the consequences of updates when sorting/filtering...

Tables in general should not have more than a few hundred lines, but there are four of them in the client at any time. There are two different branches of data types and two different periods, the tables are for.
As you say if this does not work, "hammer" approach is all that remains... Thanks for having the eye well.

Revisit this point: I don't see how you could save a full repaint anyway: If the results of change of model in the first row being filtered, all lines must be repainted (a place), and even a new line can be displayed at the bottom. Yet once if painting involves sort, has no way around sorting in any case, this isn't worth trying to avoid the kind.
I agree that this should be handled automatically (and I consider a bug because it's not).

In fact if you fireRowUpdated (i-1, i) (test quick hacky-ish), you will notice that the two rows are properly painted and shift, but not the rest of the table (which should be moved to the top line). This is clearly a bug, it seems that the JTable only redraws the line range in the case of the update, not taking into account that changes of impluies new kind other indices of line outside this range.

* In short: rowupdated in the presence of a sorter/filter should involve the use/filtering and if necessary to repaint, of the whole table. and this should be in the stock of JDK, not imposed the application code to find

Published by: jduprez on June 29, 2011 13:23

Tags: Java

Similar Questions

  • How can I filter the noises of thermocouple using a TC-2095 and SCXI - 1102c?

    Hi all

    I currently have four TC - 2095 s connected to the SCXI - 1102c inside an SCXI-1001 chassis cards. These thermocouples are floating and I get a good amount of noise (400 Hz 3 phases and same 60 Hz noise) when we turn on some equipment such as fans, and fans. Using this current set up, how can I filter the noise? Or I would need to put in place a new hardware configuration (e.g., the SCXI-1102 cards)?

    Hi RALoo,

    The 1102 C has a lowpass filter with a cutoff at 10 kHz frequency, so you will not be able to filter into the material with your current configuration.

    Your first option is to use a software filter.  LabVIEW has several functions that do this. More information can be found here: http://zone.ni.com/reference/en-XX/help/371361J-01/lvanls/filter_vis/

    The second option would be to change to SCXI 1102 cards as you suggest.  The low-pass filter of the 1102 was a cut-off adjustable to 2 Hz frequency, which will stop the noise of 400 and 60 Hz don't affect your readings.

  • How we can filter the members of attributes using MDX ASO

    How can we filter the members of attributes using MDX ASO?

    SELECT {Descendants ([1_Account], LEVELS([1_Account],0))}

    ON COLUMNS,

    {Filter (different 1_Cost [Online], 1_Cost [Online]. CurrentMember = [1_AllocAccountR]. [85151010])} on the LINES

    OF Alloc1R.Alloc1R

    WHERE ([DC], [GenealogyAllocation], [Bill], [FY14],

    2_Cost [Online]. [Impact], [3_Cost online]. [Impact], [4_Cost online]. [Impact], [5_Cost Center_intra]. [Impact], [2_Project]. [Impact], [1_Project]. [Impact]

    )

    The code marked in yellow, is suppose to filter and to provide an output only the cost that has 85151010 attribute tag - Center but it generates all cost centers


    Thank you

    Vishal

    How about using attribute or WithAttr

    Concerning

    Celvin Kattookaran

  • in windows 7 when you right click on how do you get the little line under the letter of the you can click on to make it open Windows 7

    in windows 7 when you right click on how do you get the little line under the letter of the you can click on to make it open Windows 7

    Example when you right click on a program, you can see Open if you click o the file opens, it was in XP, but not in 7

    That's what you want.

    1 - Open "Control Panel" and go to accessibility.

    2 - click make the keyboard easier to use.

    3. the title of 'Make it easier to use keyboard shortcuts' tick the box 'Underline access keys and keyboard shortcuts' and click 'Ok '.

    Oh sure, it could be useful.

  • How can I enlarge the guide lines?

    How can I enlarge the guide lines?

    Al

    simple answer is you can't. You can try to change the black color may seem more dense than cyan, but the difference will be negligible

  • How to fill out the "to:" line with a variable email address?

    I'm new to coding and am not sure how to ask my question. I have a link in an 'Email' symbol that I would like to have the window open to a 'mailto', but there are several instances of that symbol on the timeline, each using a different email address. If the [symbol]. Email.Click code reads as follows:

    Window.Open ('mailto:'+ sym.getVariable = ("emailWindow"), "_self")

    and the line in the Stage.creationComplete code that is supposed to call the variable code reads:

    sym.getSymbol("Details_David").$("Email").html ("[email protected]" "").setVariable("emailWindow","[email protected]");

    With this code, the browser opens a window of mailto, but the ' to: ' line readings, "indefinite".

    Either in the [symbol]. Email code. Click, I have:

    Window.Open('mailto:"emailWindow"',"_self")

    without the "emailWindow" as the variable name, the "to:" line to the mailto line reads, "emailWindow".

    How to fill out the "to:" line with a variable email address?

    Otherwise, it works better:

    1)

    replace

    sym.getSymbol("Details_David").$("Email").html ("[email protected]").setVariable("emailWindow", "mailto:[email protected]");

    with

    sym.getSymbol("Details_David").$("Email").html ("[email protected]");

  • My user folder displays the data of 30 GB. Actual data are only 2 GB. I want to wipe my drive C of hidden data. How can I get the details of 30 GB of data shown in the properties of the folder

    My user folder displays the data of 30 GB. Actual data are only 2 GB. I want to wipe my drive C of hidden data. How can I get the details of 30 GB of data shown in the properties of the folder.

    Hello

    This free program allows you to see what is taking place.

    http://www.Jam-software.com/treesize_free/

    Here's how to understand Treesize Screenshots:

    http://www.Jam-software.com/treesize_free/screenshots.shtml

    ____________________________________

    Also check how much space system restore uses:

    http://Windows.Microsoft.com/en-us/Windows7/how-much-disk-space-does-System-Restore-require

    _____________________________________

    You can clean your hard drive using these two methods.

    "Delete files using Disk Cleanup"

    http://Windows.Microsoft.com/en-us/Windows/delete-files-using-disk-cleanup#delete-files-using-disk-cleanup=Windows-7

    Using the free CCleaner program:

    http://www.Piriform.com/CCleaner

    In NO case use the registry cleaning Option in CCleaner

    _____________________________________

    Download, install, update and scan your system with the free version of Malwarebytes AntiMalware:

    http://www.Malwarebytes.org/products/malwarebytes_free

    And Norton Backup, if you are using Norton, can do strange things with filling of hard drive space.

    See you soon.

  • How to set up the PFI lines as input to PXI-6713 module

    Hello

    I have 6713 PXI module in my chassis PXI-1044. I have configured the PXI-6713 module to geneate some analog signals to my Board of Directors.

    Council inturn process this analog signal and answers in return the status signals through a registry to the Board of Directors. In my application, the status bits in the register state of the governing body are mapped on the PFI 0:3 bits of the PXI-6713 (pins 11,10, 42 and 43) module.

    My query is how can I configuration lines PFI as 6713 PXI module entries to read these status bits?

    May be less than the explanation could give you little more information w.r.to my request.

    When I use NI USB - 6008 module to read the same bits, because this unit has 12 e / s digital, I was able able to read the status bits in the last 4 digital lines by setting up those digital lines as input.

    In the PXI-6713 module, I have only 8 digital lines. These 8 digital lines I used to send digital signals to the Board of Directors. I find myself with no digital i/o. Therefore, I could not use these digital lines. I'm left with only one option to use. Joana re PFI lines. Also the bits of status in the axis of the room are mapped such that the bits can be read through the PFI lines.

    I was wondering do we have any example code to use inorder to read these status bits to the Board of Directors using the PFI lines.

    Please let me know if you need more information to help out me.

    Thank you.

    Hello

    When using the PFI PIN as input, you can individually configure each PFI for edge detection or level and the selection of the polarity.  This information of PFI are referenced in the manual of Series DAQ Analog Output on page 6-1 (http://www.ni.com/pdf/manuals/370735e.pdf).  Unfortunately, the PXI-6713 PFI lines are able to time a signal input and output for functions, AO or counters/timers.  The ability to create static DI of the PFI lines is not available for the PXI-6713. However, some cards have this capability.  The latest National Instruments products with PFI lines have the option of setting as PFI lines:

    1. Static digital input
    2. Static digital output
    3. Input signal of sync for functions HAVE, AO, DI, or counters/timers
    4. Output signal of the calendar functions HAVE, AO, DI, or counters/timers
      (http://digital.ni.com/public.nsf/allkb/14F20D79C649F8CD86256FBE005C2BC4)

    When the static value such as DIO, PFI lines are assigned to a different port (for example. PFI0-7 is Port1).  More details on this subject can be referenced at:

    http://digital.NI.com/public.nsf/allkb/DA2D3CD0B8E8EE2A8625752F007596E1

    http://digital.NI.com/public.nsf/allkb/862567530005F09E8625677800577C27

  • How can I filter the data and display it in the html table?

    Hello

    How do I filter data that contains the database table and already displayed in html table, then when the user write a data to filter or search, it will automatically display the data in html table. ?

    can someone help me to do this? Here is my php code for the table that will display the data:

    <?php
      $servername = "localhost";
      $username = "root";
      $password = "pass";
      $dbname = "ses";
       
       
      // Create connection
      $conn = new mysqli($servername, $username, $password, $dbname);
      // Check connection
      if ($conn->connect_error) {
      die("Connection failed: " . $conn->connect_error);
      }
       
      $sql = "SELECT No, Calon, ID, Jurusan FROM candidates";
    
      $result = $conn->query($sql);
      ?>
    
    <?php
      if ($result->num_rows > 0) {
      echo "<table >
    
      <tr>
      <th>NO</th>
      <th>Candidate</th>
      <th>ID Number</th>
      <th>Programme</th>
      <th>Edit</th>
      <th>Delete</th>
      </tr>";
      // output data of each row
      while($row = $result->fetch_assoc()) {
      echo "<tr>
      <td align='center'>" . $row["No"]. "</td>
      <td>" . $row["Calon"]. "</td>
      <td>" . $row["ID"]. " </td>
      <td>" . $row["Jurusan"]. "</td>
      <td align='center'><a href='main2.php?edit=".$row["No"]."'>Edit</a></td>
      <td align='center'><a href='delete.php?del=".$row["No"]."'>Delete</a></td>
      </tr>";
      }
    
      echo "</table>";
      } else {
      echo "0 results";
      }
      $conn->close();
      ?>
    

    hope someone can help me with this.

    Thank you.

    You must first create a search form for the user to enter a search word:

    Then create a page named search_page.php and insert the following code into it and save it. The code in red below Gets information from the search form field name = "Calon" and the SQL query finds in the "Calon" database field for a game.

    <>

    $servername = "localhost";

    $username = 'root ';

    $password = "pass";

    $dbname = 'his ';

    Create the connection

    $conn = new mysqli ($dbname, $servername, $username, $password);

    Check the connection

    If {($conn-> connect_error)

    Die ("connection failed:".) $conn-> connect_error);

    }

    $Calon = trim($_POST['Calon']);

    $sql = (' SELECT no, Calon, ID, Jurusan candidates WHERE Calon = "'.") $Calon.' » ") ;

    $result = $conn-> Query;

    ?>

    <>

    If ($result-> num_rows > 0) {}

    ECHO '.

    ";

    each line output

    While ($row = {$result-> fetch_assoc())}

    ECHO '.

    ";

    }

    ECHO '.

    NO. Candidate Identification number Program Edit Delete
    " . $row ["no"]. " " . $row ["Calon"]. " " . $row ['ID']. " " . $row ["Jurusan"]. " Edit Delete
    ";

    } else {}

    echo "0 results."

    }

    $conn-> close();

    ?>

  • How do you get the tag line in last-one click on a tree control?

    The API for tree controls is infuriatingly obtuse.

    In response to an event initiated by the tree control, I need to query the currently selected item in the tree and get his tag, so I can handle the element and its children. How this is done? I found the method of 'Set the tag', but there is no Tag «get» In fact, the only way to get the tag of any element seems to be through the 'Point to the column line' method, which takes a pair of coordinates entry component! It's confusing!

    Oh hell. Value of tree is the tag of the element currently selected. It's so easy that I never thought to look there for it, given the complexity of almost all other actions in the API.

    * sigh *.

  • How can I view the new lines when line is inserted in a VO in Popup

    Hi Experts,

    JDEV version 12.1.3.0

    I have a page jsff where I show the data as below. This table is read-only

    image1.jpg

    If I click on the button create.

    I open a pop-up window. During the initial loading of popup I am inserting a line at the VO. The page main jsff and popup VO are inspired by the same iterator. Screenshot below.

    Untitled.jpg

    But however I note when popup open should see the newly single line.

    But its showing an old recordi, first line of the VO.  How can I avoid showing the old line of the pop-up window. The jsff and the popup are inspired by the same iterator.

    Thank you

    Roy

    Hello

    Requirement is not like that. We must show new lines in the table. Done with the visible property of inputText in the transitional attribute value column on 'Y '.

    On insertion, I put transitional attribute as "O".

  • How can I remove the blue line after the deletion/change the link?

    I deleted the link and delete the text in the url, but still have the blue line, if you're wondering how delete/modify it.

    Generally, you may not. At the time wherever they go to PDF format, the link, text, and line are three things unconnected.

  • How do I know the current line of javascript

    Apex 4.2

    A Javascript function uses the following jQuery statement to access certain values of the element "tabular":
    $('input [name = "f01"]') [0]

    But to refer to point of the line, I need to know which line the column element was clicked.
    The function is taken on an attribute column-> attributes of the element-> onClick = "javascript:f_setglp (this); »

    How is it possible?

    Any help is very appreciated.

    Hi JVO,.

    with this setting you can get the line number in the table of the property id.
    For example, the entry with the name f01 element will have an id of f01_0001 for the first row, f01_0002 for the second row, etc.
    The $(this).attr("id") of jQuery education you will get the value of the id and with the substr, you get the line number.
    Because the use of jQuery table to access the input elements is zero-based you must subtract 1 from the line number to access the right items.

    To get all the other entry in the same line as the clicked element you can use this:

    $(this).closest('tr').find('input');
    

    Kind regards
    Erik-jan

  • How can I update the last line in a file.

    Hello

    I need to add text that should be on the 2nd last line of a text file. I get the last line using RandomAccessFile and surroundings,
            fileHandler.seek(fileHandler.length()-1-lastLine.length()-1);
            
            fileHandler.writeUTF("last_line\r"+lastLine.replaceFirst("0x00", "0x80"));
    updated the code above, I'm trying to add the text to the last line. But instead of add, the above code simply replaces the last line.
    How to solve this problem?

    BR
    Umer

    Just by adding a single line to rewrite the entire file may not be a good idea eapscially when the file is in MBs. so that is the reason why I use RandonAccessFile,.

    You don't know that? HDs store files on several trays at the same spot on the Board, so you won't lose anything in rewriting.

    I have also an other question. In other words, how I can I know the last line is achieved using PrintWriter?

    Steps to follow:
    1. read the entire file into a string
    2. parse the string by using the String.lastIndexOf ("\n") to the last character of line break.
    3. use printwriter to write the string up to the last line (use string.substring), then give your new data, and then enter the second part

    >

    BR
    Umer

  • How selectBooleanCheckbox can set the current line?

    Hello

    Using ADF Faces 10 g, I have an af:table component that is read-only, but the last column contains an af:selectBooleanCheckbox. This checkbox is used to 'activate' and 'disable' to each line. When I click on the box, I need the valueChangeListener be aware which line has been activated (so that I can then make some changes on this line to toggle). By clicking on the box to check must call setCurrentRow, or at least pass on values I can use later to set the current line manually.

    My first thought was setActionListener, but it seems that it may not be combined with af:selectBooleanCheckbox. I searched and found the following post:
    HOW to set an ID for the component from variable
    and after reading this I tried setPropertyListener, once again, I found that this is not a valid child of af: selectBooleanCheckbox. The post dry with nuansantio mentioning several times that setActionListener and setPropertyListener cannot be used, but there is no other comments on a solution.

    Any thoughts on how I can get this to work?

    Hello

    Could you elaborate more about

    I need to make a number of manual steps (invoking request Module) when the user selects / disables the check box

    You can pretty much add a method in your Impl VO (who did all the steps you want to do) and call the method in an expression for the value of groovy / call it in valueChangedListener of the box?

    Arun-

Maybe you are looking for

  • How to use the Satellite phone webcam internal?

    Please help me.On my new Toshiba, it has a webcam equipped.How can I connect with another webcam so I can contact them?Sorry for the stupid question.

  • Envy 15-J073CA backlit keyboard is NOT cascade

    Hi, this is my first post, I have a HP ENVY 15-J073CA model, I'm just wodering if it's settings for the keyboard backlight? I don't get the cool cascading effect in my model.

  • Fast forward Question

    My old Sansa C200 has to listen to you (obviously at a very fast pace) then you were fast shipping.  This has been useful in trying to move forward in a podcast, but not directly to the order of the day.  The Clip + does not seem to support this func

  • Drivers &amp; software

    I have 7 freshly installed windows on my HP Pavilion dv6000 and was looking for drivers, when I left it automatically detect my system it says that the model is" laptop HP Pavilion dv6910tx but cannot find the software for Win7 32 bit, all while the

  • Monitor flashes blue after running for a few hours.

    My monitor did not come with internal speakers.  The speakers I bought has a subwoofer.  My monitor keeps going blue from time to time.  The subwoofer is 110-120V.  Is this too much for the monitor?