Looking for best practice on showing data inside a TableView

I have an app, that can retrieve one ore more than 300,000 rows as the result of a query and i am displaying them into a TableView.. i am using a mechanism to bring the data "on parts", when i do the query an object with the ids of the rows is set into memory and a "queryResultKey" is passed in order to start asking for the complete set of data.
The controlers send the queryResultKey telling the DAO that it has already N resultas, so the DAO will return X registers (from N+1 to N+J) or less if the total number of registers is reached. At this point the registers are added to the items of the table view using a addAll to the list binded to the table itemsProperty.
it works fine for the first thounsands registers but suddenly a Null Pointer Exception is raised:
ene 15, 2013 12:56:40 PM mx.gob.scjn.iusjfx.presentacion.tesis.TablaResultadosController$5 call
SEVERE: null
java.lang.NullPointerException
     at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:291)
     at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:48)
     at com.sun.javafx.scene.control.ReadOnlyUnbackedObservableList.callObservers(ReadOnlyUnbackedObservableList.java:74)
     at javafx.scene.control.TableView$TableViewArrayListSelectionModel$3.onChanged(TableView.java:1725)
     at com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:134)
     at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:48)
     at com.sun.javafx.collections.ObservableListWrapper.callObservers(ObservableListWrapper.java:97)
     at com.sun.javafx.collections.ObservableListWrapper.clear(ObservableListWrapper.java:184)
     at javafx.scene.control.TableView$TableViewArrayListSelectionModel.quietClearSelection(TableView.java:2154)
     at javafx.scene.control.TableView$TableViewArrayListSelectionModel.updateSelection(TableView.java:1902)
     at javafx.scene.control.TableView$TableViewArrayListSelectionModel.access$2600(TableView.java:1681)
     at javafx.scene.control.TableView$TableViewArrayListSelectionModel$8.onChanged(TableView.java:1802)
     at com.sun.javafx.scene.control.WeakListChangeListener.onChanged(WeakListChangeListener.java:71)
     at com.sun.javafx.collections.ListListenerHelper$Generic.fireValueChangedEvent(ListListenerHelper.java:291)
     at com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:48)
     at com.sun.javafx.collections.ObservableListWrapper.callObservers(ObservableListWrapper.java:97)
     at com.sun.javafx.collections.ObservableListWrapper.addAll(ObservableListWrapper.java:171)
     at com.sun.javafx.collections.ObservableListWrapper.addAll(ObservableListWrapper.java:160)
     at javafx.beans.binding.ListExpression.addAll(ListExpression.java:280)
     at mx.gob.scjn.iusjfx.presentacion.tesis.TablaResultadosController$5.call(TablaResultadosController.java:433)
     at mx.gob.scjn.iusjfx.presentacion.tesis.TablaResultadosController$5.call(TablaResultadosController.java:427)
     at javafx.concurrent.Task$TaskCallable.call(Task.java:1259)
     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
     at java.util.concurrent.FutureTask.run(FutureTask.java:166)
     at java.lang.Thread.run(Thread.java:722)This exception ocurrs inside the Thread that is filling the table:
task = new Task<Integer>() {
            @Override
            protected Integer call() throws Exception {
                while (listaTesis.size() < pag.getLargo()) {
                    List<TesisTO> tesisParaincrustar = fac.getTesisParaLista(pag.getId(), listaTesis.size());
                    try {
                        listaTesis.addAll(tesisParaincrustar);
                    } catch (Exception exc) {
                        Logger.getLogger(TablaResultadosController.class.getName()).log(Level.SEVERE, null, exc);
                    tesisActuales.addAll(tesisParaincrustar);
                    updateProgress(listaTesis.size(), pag.getLargo());
                return new Integer(100);
            @Override
            protected void succeeded() {
                status.getProgreso().setVisible(false);
                preparaFiltros();
                llenandoTabla = false;
                tblResultados.getSelectionModel().select(0);
        status.getProgreso().progressProperty().bind(task.progressProperty());
        new Thread((Runnable) task).start();So, what can be another strategy to simulate (or have) that all the register values are in memory and "grab just the needed ones" to display them in the TableView???
Any idea will be helpfull.

The first thing I would do here is to check that
fac.getTesisParaLista(pag.getId(), listaTesis.size())cannot return null under any circumstances. If this is returning null, then that is the source of your exception. In this case you should add the appropriate guard to your code:
if (tesisParaincrustar != null) {
                    try {
                        listaTesis.addAll(tesisParaincrustar);
                    } catch (Exception exc) {
                        Logger.getLogger(TablaResultadosController.class.getName()).log(Level.SEVERE, null, exc);
                    tesisActuales.addAll(tesisParaincrustar);
}For the threading issue, you can schedule anything that changes the UI to run on the FX Application Thread using Platform.runLater(...). Note that any data you pass into that should not be modified elsewhere. So you can do something like:
Platform.runLater(new Runnable() {
  @Override
  public void run() {
                    try {
                        listaTesis.addAll(tesisParaincrustar);
                    } catch (Exception exc) {
                        Logger.getLogger(TablaResultadosController.class.getName()).log(Level.SEVERE, null, exc);
                    tesisActuales.addAll(tesisParaincrustar);
});You'll need to add the 'final' keyword to the declaration of tesisParaincrustar to get this to compile.
This is fine, assuming that the call to fac.getTesisParaLista(...) returns a new list instance each time (i.e. it doesn't modify an existing list).
You will be left with one remaining problem: the condition in your while(...) loop references listaTesis.size(). Since this list is now being updated on a thread different to the thread managing the while(...) loop. This can (and probably will) cause the loop to terminate at the wrong time. Can you adjust the while(...) condition so it doesn't refer to this list (for example, calculate ahead of time how many things need to be read, pass that number to your Task implementation, and use that in the while(...) condition.)
There are effectively two rules for multithreading in JavaFX:
1. Don't access the UI outside of the FX Application Thread. This includes data structures which are bound to the UI. I'm assuming at some point you've called tableView.setItems(listaTesis), so listaTesis should be considered part of the UI.
2. Don't perform long-running tasks on the FX Application Thread.
In attempting to conform to rule 2, you've violated rule 1.
Doing incremental updates to a displayed list in a background thread is one of the trickiest uses of Task. Read through the API documentation for Task ( http://docs.oracle.com/javafx/2/api/javafx/concurrent/Task.html ): the "PartialResultsTask" example under "A Task which returns partial results" is an example of what you're trying to do.

Similar Messages

  • Looking for best practice on application scope beans

    Hey – a portal newbie here. I’ve got some application scope beans that need to be initialized on startup. First thought was to create a servlet that would set the bean. Then I saw the GlobalApp setting, but I think that looks like it is more session scope than application… Looking to be corrected here if I am wrong.
    Is there a place where these type of things traditionally happen? Read only, so no cluster worries (I think) Using WLP 8.1 SP4 and looking for best practices. Thanks for the help!

    To support "code sharing" you need an integrated source code control system. Several options are out there but CVS (https://www.cvshome.org/) is a nice choice, and it's completely free and it runs on Windows, Linux, and most UNIX variants.
    Your next decision is on IDE and application server. These are usually from a single "source". For instance, you can choose Oracle's JDeveloper and Deploy to Oracle Application Server; or go with free NetBeans IDE and Jakarta Tomcat; or IBM's WebSphere and their application server. Selection of IDE and AppServer will likely result in heated debates.

  • Looking for best practice on J2EE development environment

    Hi,
    We are starting to develope with J2EE. We are looking for best practice on J2EE development environment. Our concern is mainly on code sharing and deployment.
    Thanks, Charles

    To support "code sharing" you need an integrated source code control system. Several options are out there but CVS (https://www.cvshome.org/) is a nice choice, and it's completely free and it runs on Windows, Linux, and most UNIX variants.
    Your next decision is on IDE and application server. These are usually from a single "source". For instance, you can choose Oracle's JDeveloper and Deploy to Oracle Application Server; or go with free NetBeans IDE and Jakarta Tomcat; or IBM's WebSphere and their application server. Selection of IDE and AppServer will likely result in heated debates.

  • Looking for best practice / installation guide for grid agent for RAC

    I am looking for best practice / installation guide for grid agent for RAC, running on windows server.
    Thanks.

    Please refer :
    MOS note Id : [ID 378037.1] -- How To Install Oracle 10g Grid Agent On RAC
    http://repettas.wordpress.com/2007/10/21/how-to-install-oracle-10g-grid-agent-on-rac/
    Regards
    Rajesh

  • Looking for best practice white paper on Internet Based Client Management

    Looking for best practice white paper on Internet Based Client Management for SCCM 2012 R2.
    Has anyone implemented this in a medium sized corporate environment? 10k+ workstations.  We have a single primary site, SQL server and 85 DP's. 

    How about the TechNet docs: http://technet.microsoft.com/en-us/library/gg712701.aspx#Support_Internet_Clients ?
    Or one of the many blog posts on the subject shown from a web search: http://www.bing.com/search?q=configuration+manager+2012+internet+based+client+management&go=Submit+Query&qs=bs&form=QBRE ?
    Jason | http://blog.configmgrftw.com | @jasonsandys

  • I'm looking for best practice on allowing employees to install apps.

    How does your company deal with employees uploading apps on company owned devices? Is there a request process? Can they expense them? What if they use their personal Apple accounts? Do you use an MDM to manage the devices? What are your security concerns? I'm in the process of formulating a policy (large multi national corp.) and am looking for some best practices.
    Thanks

    I think the main consideration is that you a multi-national organization, presumably widely distributed geographically.  Local management via Configurator or USB IPCU really don't make sense over the long term.  An MDM is designed for situations such as you describe.  For licensing reasons,each iPad used by a different individual must have a unique Apple ID.  One individual could use the same Apple ID on multiple devices he or she controls.  Individual devices used by multiple individuals can also have a single Apple ID. In our environment, we typically ask each user to setup an individual Apple ID when they receive their device.  They are allowed to download and pay for whatever personal apps they choose.  Apps which would be used for Business purposes must be vetted by Security to ensure they protect organization data.   Business apps can be deployed via the Apple VPP using our MDM, which is AirWatch.  An MDM is included with Lion Server.  You could look at this to get some ideas about what it does and how it does it.  Airwatch offers a free trial.  Some users of this forum have had experience with Meraki.  That is another choice.  You should also look at the Enterprise Deployment Guide
    http://manuals.info.apple.com/en_US/Enterprise_Deployment_guide.pdf
    and the VPP
    http://www.apple.com/business/vpp/
    Frankly, though it isn't completely applicable to your situation, the Education deployment guide has a great deal of good information
    http://images.apple.com/education/docs/IOS_5_Education_Deployment_Guide.pdf
    Hope this helps a bit. 

  • Looking for best practice sending args to classes

    Unfortunately, I'm stuck in a company that only employs MS developers, so I'm kind of stranded with no buddies to mentor my java skills... so thanks in advance for any help, I appreciate it.
    Anyway, I think that I've been doing things the hard way for a while and I'm looking for some sort of best practice to start using. I'm currently working on a GUI that will take all the selections, via combo boxes, text fields, etc., and send them to a class (a web bot, actually) and run it.
    I'm starting to run into the problem of having too many arguments to send to my Bot class. What's a good way that I should be doing this? I figure I can do it a couple of ways, right?
    new Bot(arg1, arg2, ......... argX);
    Bot bot = new Bot();
    bot.setArg1("something");
    bot.setArg2("something");
    etc..
    bot.run();Or, is there a better way? Can I package all the args in a collection somehow?? That way I only have 1 argument to send... I don't know... Thanks for the help.

    Create a class "Data" (for example) that encapsulates all the data you want to pass to the Bot class. Then create an instance of the Data class and set all the relevant fields (i.e. setArg1 etc). Now you pass this Data instance to your Bot class. This way you only have to pass one Object around and you've encapsulated all your data.

  • Audio & Captivate: Looking for best practice

    Good Morning,
    i'am looking for some sort of best practice, handling a lot of audios within single captivate slides. Please let us take a look at the workflow:
    I write concepts in Word or OpenOffice, describing on a slide-base the content, media (pics, animations, ...), interactions
    The client read these concepts, and write a reading report with all changes, additions
    We held a harmonisation meeting for every 3-5 hours calculated e-learning-concepts, argueing about the clients annotations and looking for a stable agreement
    I produce the first version, in this case with Adobe Captivate, and for the audios i use text2speech.
    The client checks this first Version, send me his audit report.
    I produce version 1.
    So, where is the problem? My problem is the handling of the audio-files, up to 10 per slide. In version 1, all audios are spoken by professional speakers from german radio-stations, recorded in our own studio. And i'am looking for a comfortable way to exchange all synthetic audios without leaving anything within captivate, the final version must be as clean and slim as possible.
    For the handling and tracking i use AlienBrain, because in some projects, we have a few hundred of thousands assets to watch and track ... and it is no problem if anything wents wrong, just some clicks and i've restored the older version of a pic, audio or a complete project.
    Using other tools, i do not care about this. Within the project-folders, they are stored within a modul-based audio-folder. And every single audio-files as an unique identifer (A024_37_12_004.mp4, "A" for Audio, then chapter_module_page_sequentialnumberperpage.mp4/mp3/wav). After i have recieved the spoken audios from the studio, i just overwrite the synthetic audios and the "real" audios are automatically embedded in my slides, so if i make a new release, everything is fine. Older, synthetic version kept by AlienBrain.
    In Captivate, everything seems to be ... hm, i have to be polite ;-) ... a little more complicated. Or even worse, i'am unable to see the solution. Maybe somebody may share a working and fast way for the needed audio-procedure? Or something like a proofed workaround?
    Kind regards
    Marc :-)

    Additional information:
    Mostly, we have 3-5 audios per slide/page. 10 is absolutely maximum.
    And because we are talk about overall thousands of audio-files, i hopefully find a good way to keep them as external sources and Captivate embedd them just at the moment, when i have to produce a new release. (That is the main problem - sorry, my english language modules are still asleep after a long and busy weekend) And as i've learned, object-audio can't be used with external audio-files.
    At the company, we've talked about the best process (theres is another huge project running and the guys - experienced people - are also new to captivate). At this moment, the prefered solution is to connect all audios, 4 by example. And then we can "Play/Pause" the audio at our needs. It is a little bit like stumbling blindfolded through heavy mist.
    Another idea, brought up by me, was to multiply the slide so the first slide shows paragraph/pic/audio. After a click, next slide loads, exactly in the same state as the previous slides ends, next text/pic/animation and the next audio. But with that, i will end up with thousends of slides only because of the audio-handling.
    Maybe it is a good idea to explain a really typically update process which may show what we like to see:
    The modul is ready, delivered and the client is happy
    After 6 months, there is a technical change within one part and the client need a single new audio
    In reality in one special module, part of over 200 hours learning, after a year we've been instructed to record new versions for 35 of 80 audios ... in just one of somehundred modules
    In captivate we try to avoid touching every single slide again.
    At the moment i own just a standalone version of Captivate (5.5), the eLearning Suite has been ordered and arrives next week.
    Tools we've used in the past (and until now due to clients requirements) without any problems ... dealing with audios ;-)  :
    Toolbook
    Sumatra
    CourseLab
    Individual Flash Solutions
    others

  • Looking for best practices when creating DNS reverse zones for DHCP

    Hello,
    We are migrating from ISC DHCP to Microsoft DHCP. We would like the DHCP server to automatically update DNS A and PTR records for computers when they get an IP. The question is, what is the best practice for creating the reverse look up zones in DNS? Here
    is an example:
    10.0.1.0/23
    This would give out IPs from 10.0.1.1-10.0.2.254. So with this in mind, do we then create the following reverse DNS zones?:
    1.0.10.in-addr.arpa AND 2.0.10.in-addr.arpa
    OR do we only create:
    0.10.in-addr.arpa And both 10.0.1 and 10.0.2 addresses will get stuffed into those zones.
    Or is there an even better way that I haven't thought about? Thanks in advance.

    Hi,
    Base on your description, creating two reverse DNS zones 1.0.10.in-addr.arpa and 2.0.10.in-addr.arpa, or creating one reverse DNS zone 0.10.in-addr.arpa, both methods are all right.
    Best Regards,
    Tina

  • Looking for best practices using Linux

    I use Linux plataform to all the Hyperion tools, we has been problems with Analyzer V7.0.1, the server hangs up ramdomly.<BR>I'm looking for a Linux best practices using Analyzer, Essbsae, EAS, etc.<BR>I'll appreciate any good or bad comments related Hyperion on Linux OS.<BR><BR>Thanks in advance.<BR><BR>Mario Guerrero<BR>Mexico

    Hi,<BR><BR>did you search for patches? It can be known problem. I use all Hyperion tools on Windows without any big problem.<BR><BR>Hope this helps,<BR>Grofaty

  • Looking for best practice on naming conventions

    Does anyone out there have a best practice on naming conventions that they could share.
    I'm starting to find the need to create objects and associated variables and actions.
    I can see this getting very messy, very quickly and would love to learn if someone has come up with a good set of guidelines that are both easy to follow and make perfect sense. (I know....what a balance to ask for!)
    Thanks
    Alan

    Hi Alan,
    Welcome to Adobe Community.
    There are couple of things that you can keep in mind while naming objects.
    When creating custom text caption styles, be sure to follow the correct naming conventions. Each caption style has a unique name, and you must
    use this name at the beginning of each associated bitmap filename. For example, if you create a text caption style named “Brightblue,” the five
    bitmap images that constitute the new style should be named as follows:
    Brightblue1.bmp, an image with no callouts
    Brightblue2.bmp, an image with a callout to the right or upper-right
    Brightblue3.bmp, an image with a callout to the left or upper-left
    Brightblue4.bmp, an image with a callout to the lower right
    Brightblue5.bmp, an image with a callout to the lower left
    Flash button-naming conventions
    Each SWF button contains three layers: a button, an icon, and an action layer.
    The SWF filename consists of the following elements:
    Acronym for playback control (“pbc”)
    Playback element identifier (“Btn” for button, “Bar” for bar, and so on)
    Name of the button (“play”).
    Hope this helps!
    Thanks!

  • Looking for Best Practice Configuration Building Block for Material Ledger

    I need to configure and create the Material Ledger for a customer in the near future.  Could someone help me find the Best Practice Configuration Guide for Material Ledger?
    Thanks in advance!

    The official config is in Best Practices for Primary Steel
    there is a delta building block which contains Material Ledger configuration
    http://help.sap.com/bp_bblibrary/500/HTML/T02_EN_ZH.htm

  • HT201407 I administer 50 phones. Looking for best practices concerning iCloud. This program and my users have made it difficult to reuse phones when persons are terminated.

    Several times I have had to chase after terminated employees for iCloud accounts and passwords. It has been a nightmare. How do I remove iCloud accounts from company devices, or better yet, prevent users from creating personal icloud accounts?  What are the 'best practices' concerning the use of iCloud?

    Several times I have had to chase after terminated employees for iCloud accounts and passwords. It has been a nightmare. How do I remove iCloud accounts from company devices, or better yet, prevent users from creating personal icloud accounts?  What are the 'best practices' concerning the use of iCloud?

  • Looking for best practice Port Authentication

    Hello,
    I'm currently deploying 802.1x on a campus with Catalyst 2950 and 4506.
    There are lots of Printers and non-802.1x devices (around 200) which should be controlled by their mac-address. Is there any "best practice" besides using sticky mac-address learning.
    I'm thinking of a central place where alle mac-addresses are stored (i.e. ACS).
    Another method would be checking only the first part of the mac-address (vendor OID) on the switch-ports.
    Any ideas out there??
    regards
    Hubert

    check out the following link, this provides info on port based authentication, see if it helps :
    http://www.cisco.com/en/US/products/hw/switches/ps628/products_configuration_guide_chapter09186a00801cde59.html

  • Looking for best practices advice

    Hi all !!
    We are planning to migrate an old application and are evaluating products, tools and frameworks. I've just finished the Netbeans tutorial at
    http://www.netbeans.org/kb/55/vwp-inserts_updates_deletes.html
    The application is not too complex but it's not trivial either, and we need to develop it as a web application, but in its behavior it's more like a classic desktop application.
    In the tutorial the CRUD operations are performed by data providers associated to visual components like tables, but we need to manipulate data by program.
    So after finishing the tutorial I've created some entity beans with Hibernate and now I'm trying to use them within the sample tutorial. For example a "Process" button which extract data from many tables an insert into others.
    I'm sure it will work, but I feel that I'm not using the proper techniques, like avoiding so much behavior in a button event handler. I would like to separate in tiers, have the SQL in stored procedures, etc.
    Even the turorial has SQL code embedded in the data providers.
    What would you advice me in order to get most clean code, productivity and maintanibility ??
    Thanks and cheers,
    Daniel

    I've found this all answered in the Netbeans nbusers mailing list archives, basically it says Web and Visual Web Applications are different kind of projects as of yet, but will be completely merged in a near future, hopefully the upcoming NB 6 due approx. May this year.
    For anyone interested in this issue I advice to search the nbusers archive for the keywords "visual web persistence" (without the quotes).
    Also I acknowledge that the netbeans mailing list archives are a best place to ask this kind of questions that tis forum.
    Cheers,
    Daniel

Maybe you are looking for

  • How do I set up stereo audio tracks as default in Premiere using the ProRes 422 codec?

    Forgive me if this has been asked many times before. I have searched but can't find anything that explains it in language that doesn't require an advanced degree in computer engineering. I am a recent convert for our beloved FCP 7. I am learning to l

  • How to attach documents in Iphone mail services

    Hi, Is there anyway to attach documents(even multiple docs at once) and send them from my iphone mail??

  • Mystery file in trash at startup

    Hi! I have this mysterious file in the trash every time I turned the iMac. It has been going on for a while now and I can't get rid of it. Even secure empty trash did not work. When I click on get info, instead of giving me information about the file

  • Centering text & wrapping words on lines

    Hi all, I need to have a JLabel that centers the text in it, and allows for multiple lines, where if a line is too long, it wraps onto the next line. I started off with a JTextArea, setting "setLineWrap" and "setWrapStyleWord", and this works fine fo

  • "Scratch Disk Full" in Photoshop CS3, 30MB Free"

    I've been all over the net and can't find an answer. I have only one drive (I will be fixing that problem tomorrow), a 250GB on my PowerMac G5. Disk Info says there are 50 GB Available. Photoshop preferences agree. Still, I cannot crop a lousy 4MB fi