Detection method for first time a Node is rendered

Hello,
I need to lazily perform some computation until after a particular Node is shown to the User. So if the app has multiple tabs, the goal is to not do work for a tab that hasn't even been switched to yet.
I figured the VisibleProperty of Node would help but it's not acting as I'd expect.
final BorderPane tab1 = BorderPaneBuilder.create().build();
setOnFirstShown(tab1, new Runnable() {
  @Override
  public void run()
    _log.info("Show 1");
    tab1.setCenter(new Text("1"));
final BorderPane tab2 = BorderPaneBuilder.create().build();
setOnFirstShown(tab2, new Runnable() {
  @Override
  public void run()
    _log.info("Show 2");
    tab2.setCenter(new Text("2"));
tabs.getTabs().addAll(
  TabBuilder.create().text("One").content(tab1).build(),
  TabBuilder.create().text("Two").content(tab2).build());Here is the listener:
public static void setOnFirstShown( final Node node, final Runnable response )
  class Changer implements ChangeListener<Boolean>
    @Override
    public void changed( ObservableValue<? extends Boolean> obsVal, Boolean oldVal, Boolean newVal )
      _log.debug("Changed: " + newVal);
      if( newVal.booleanValue() )
        /** remove the listener b/c it's only used once */
        node.visibleProperty().removeListener( this );
        _log.debug( "Responding to first show for: " + node );
        try
          response.run();
        catch( Exception e )
          _log.error( "Failed to run response:" + response, e );
  node.visibleProperty().addListener(new Changer());
}So each tab should replace its content with a Text when it becomes visible. However in actuality it works like this:
1. Scene launches, nothing displayed in the first tab. The visibility flag is set to false but not to true
2. Click on the second tab and its content correctly gets a change (to true) in visibility and the Text node appears
3. Click back on the first tab and now it gets visible set to true and shows the Text node
So it seems like for what is initially shown, the Nodes' visible flag is not properly set.
Does anyone have any insight or a better way to delay reaction until a given Node is actually visible to the User?

The visible property of a Node doesn't quite do what you think. From the javadocs:
Specifies whether this Node and any subnodes should be rendered as part of the scene graph. A node may be visible and yet not be shown in the rendered scene if, for instance, it is off the screen or obscured by another Node.
The default value of the visible property is true.
So, your first tab content originally has visibility set to true. You add it as the content of the first tab, and it remains true. Since it never changes, your ChangeListener is never invoked.
The second tab's content also originally has visibility set to true. When you add it as the second tab, it's visibility becomes false to indicate it should not be rendered. When it is selected, the visibility of the first tab content changes to false and the visibility of the second tab content changes to true, invoking the listeners.
This example may help:
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.Scene;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.layout.BorderPane;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class TabListenerTest extends Application {
  @Override
  public void start(Stage primaryStage) throws Exception {
    BorderPane root = new BorderPane();
    TabPane tabs = new TabPane();
    Tab tab1 = new Tab("Tab 1");
    Text text1 = new Text("This is tab 1");
    Tab tab2 = new Tab("Tab 2");
    Text text2 = new Text("This is tab 2");
    class VisibilityChangeListener implements ChangeListener<Boolean> {
      String content;
      VisibilityChangeListener(String content) {
        this.content = content ;
      @Override
      public void changed(ObservableValue<? extends Boolean> observable,
          Boolean oldValue, Boolean newValue) {
        System.out.println("Visibilty of "+content+" changed from "+oldValue+ " to "+newValue);
    text1.visibleProperty().addListener(new VisibilityChangeListener("Tab 1"));
    text2.visibleProperty().addListener(new VisibilityChangeListener("Tab 2"));
    tab1.setContent(text1);
    tab2.setContent(text2);
    tabs.getTabs().addAll(tab1, tab2);
    root.setCenter(tabs);
    Scene scene = new Scene(root, 400, 200);
    primaryStage.setScene(scene);
    primaryStage.sizeToScene();
    primaryStage.show();
  public static void main(String[] args) {
    launch(args);
}

Similar Messages

  • Performance issue in browsing SSAS cube using Excel for first time after cube refresh

    Hello Group Members,
    This is a continuation of my earlier blog question -
    https://social.msdn.microsoft.com/Forums/en-US/a1e424a2-f102-4165-a597-f464cf03ebb5/cache-and-performance-issue-in-browsing-ssas-cube-using-excel-for-first-time?forum=sqlanalysisservices
    As that thread is marked as answer, but my issue is not resolved, I am creating a new thread.
    I am facing a cache and performance issue for the first time when I try to open a SSAS cube connection using Excel (using Data tab  -> From Other Sources --> From Analysis Services) after daily cube refresh. In end users system (8 GB RAM but around
    4GB available RAM), for the first time, it takes 10 minutes to open the cube. From next run onwards, its open up quickly within 10 secs.
    We have daily ETL process running in high end servers. The configuration of dedicated SSAS cube server is 8 core, 64GB RAM. In total we have 4 cube DB - out of which for 3 is full cube refresh and 1 is incremental refresh. We have seen after daily cube
    refresh, it takes 10 odd minutes to open the cube in end users system. From next time onwards, it opens up really fast with 10 secs. After cube refresh, in server systems (32 GB RAM, around 4GB available RAM), it takes 2 odd minutes to open the cube.
    Is there, any way we could reduce the time taken for first attempt ?
    As mentioned in my previous thread, we have already implemented a cube wraming cache. But, there is no improvement.
    Currently, the cumulative size of the all 4 cube DB are more than 9 GB in Production and each cube DB having 4 individual cubes in average with highest cube DB size is 3.5 GB. Now, the question is how excel works with SSAS cube after
    daily cube refresh?
    Is it Excel creates a cache of the schema and data after each time cube is refreshed and in doing so it need to download the cube schema in Excel's memory? Now to download the the schema and data of each cube database from server to client, it will take
    a significant time based on the bandwidth of the network and connection.
    Is it anyway dependent to client system RAM ? Today the bigest cube DB size is 3.5 GB, tomorrow it will be 5-6 GB. Now, though client system RAM is 8 GB, the available or free RAM would be around 4 GB. So, what will happen then ?
    Best Regards, Arka Mitra.

    Could you run the following two DMV queries filling in the name of the cube you're connecting to. Then please post back the row count returned from each of them (by copying them into Excel and counting the rows).
    I want to see if this is an issue I've run across before with thousands of dimension attributes and MDSCHEMA_CUBES performance.
    select [HIERARCHY_UNIQUE_NAME]
    from $system.mdschema_hierarchies
    where CUBE_NAME = 'YourCubeName'
    select [LEVEL_UNIQUE_NAME]
    from $system.mdschema_levels
    where CUBE_NAME = 'YourCubeName'
    Also, what version of Analysis Services is it? If you connect Object Explorer in Management Studio to SSAS, what's the exact version number it says on the top server node?
    http://artisconsulting.com/Blogs/GregGalloway

  • Long time to open workbook for first time

    Hi,
    I have a workbook with three queries . Performance of workbook is good when it was created for first time. It has additional 22 sheets with formulas and other sheets with values based on query sheets.
    The problem starts after I close the existing session and open in another session when it takes 15 to 20 minutes to come up.But after that the book is slow even for single click button action.
    Version of analysis 1.4.6
    Win 7(64 bit)
    Ms office 2010(32 bit)
    Refresh on opening is disabled.
    Few thing which I did:
    >> I opened up task manager and did analyze wait chain, I found that excel.exe is waiting for splwow64.exe process.
    >> I enabled logging at "debugging information" in support setting for workbook and checked things out in log file.
    Found that
    There was warning "AddSerializer failed (Command processors not initialized)
    Looking at log file for events when book took time to open, I found that time stamp gap between  following events"
    -verbose: Working mode as serialized in document:'Local'
    -verbose: Successfully deserialized system info from workbook  XML
    - verbose: ...its logs various properties of queries like query name,id etc"
    and its immediate previous event of cache formula string is 20 mins.
    >> in another session I opened a workbook with normal performance.Found above mentioned warning message and deserialization... information.
    the difference in this case is that there is not delay in events.
    Has anybody faced this issue? Any idea on deserialization of workbook xml in analysis.
    Any idea where is metadata saved in analysis. is it in form of some hidden script object just as in BEx 7.0
    Thanks
    Pramod.

    Hi Pramod,
    Since you have several sheets in this workbook, have you checked the number of custom styles?
    Please check the SAP note http://service.sap.com/sap/support/notes/1899658
    According to the note, too many styles slow down Analysis for Office.
    The note also contains a macro that you can run on your workbook to delete the custom styles if you want to check.
    Regards,
    Filipe

  • HT201250 i am using for first time the time machine and an external hard drive because I want to erase my macbook and start from zero files. do i keep my files in the portable hard disk when I connect it again with the macbook or the time machine will era

    i am using for first time the time machine and an external hard drive because I want to erase my macbook and start from zero files. Am i keeping my files in the portable hard disk when I will connect it again with the macbook or the time machine will erase all?
    I would like to know if after I erase all my data, empy hard drive inside the macbook, the time machine will erase all my files that I have saved in my "WD "My passport" external hard drive

    Welcome to Apple Support Communities
    Time Machine has to erase the external disk in order to make backups. Before setting Time Machine up, copy the files of your external disk to the hard disk of the Mac in order not to lose them, and then, set up Time Machine. The first backup will start automatically.
    If you want more information about Time Machine, read the Pondini's site > http://pondini.org

  • How do I sync my new ipad mini with my old ipad 2, without losing any apps or data in notes?  I need step by step instructions for first-time sync with ipad mini.  Thanks.

    How do I sync my new ipad mini with my old ipad 2, without losing any apps or data in notes?  I need step by step instructions for first-time sync with ipad mini.  Thanks.

    If you synced it many times, you have to have a backup. It's just a question of how old that backup is now. When did you last sync?
    First of all launch iTunes on your computer and go to Edit>Preferences>Devices. Do you see any backups for you iPad in that window? If so, how new is the newest backup? That will be the backup that you will want to use. But remember that if you use that backup and it is one month old, you can only restore from that date back in time. Anything that you did on the iPad in the past month will not be in that backup.
    Turn on the new iPad Minin and start activating OTA via WiFi. You will get to a certain point in the process where you will be given the choice to Set up as new, Restore from iCloud - or Restore from iTunes. You will want to select Restore from iTunes.
    That is the short and sweet version. There are step by step instructions in this article. This applies to the mini as well as the iPad 4 or the iPad 3 for that matter.
    http://www.everythingicafe.com/how-to-set-up-new-ipad/2012/03/16/

  • Using iPod shuffle 4th generation for first time and receiving the error : one of the USB devices attached to this computer has malfunctioned, and windows does not recognize it. For assistance in solving this problem, click this message

    Using iPod shuffle 4th generation for first time and receiving the error : one of the USB devices attached to this computer has malfunctioned, and windows does not recognize it. For assistance in solving this problem, click this message.
    Using win 7 and latest iTunes [10.6.3]. Have already gone through below links and did not find any solution.
    http://support.apple.com/kb/HT2292
    http://support.apple.com/kb/TS1369
    http://support.apple.com/kb/HT1923
    http://en.kioskea.net/forum/affich-17997-ipod-not-detected

    I was hoping it would be something like a USB device conflict, but now the shuffle is the only thing connected...
    This article was one of the ones you linked to above in your initial post
    http://support.apple.com/kb/TS1369
    Under Part 9. Verify that USB drivers are installed, did you try the steps in If only "Unknown Device" appears?  That appears to be your situation.
    Also, you said that the shuffle initially worked well enough to do a sync, then it had the same problem again.  If you can get it to work again initially, before doing anything else, try the following.  Select the shuffle in the iTunes sidebar, under DEVICES.  Over to the right, go to the Summary tab.  By default, the checkbox for Enable disk use should be unchecked.  If so, check it and Apply the change.  See if that makes any difference. 
    (If Enable disk use was already checked, try unchecking it and Apply the change.  Basically, set it the "other way" and see if there is any improvement.)
    NOTE:  When disk use is enabled, you have to eject the iPod in iTunes before disconnecting it physically.
    If the disk use change makes a difference, that may provide a clue about the actual cause.

  • HT1476 if i bought my ipod touch 32gb in germany where the voltage is 220v and i live in America where the voltage is 110, i will have to wait to get to my home to charge it for first time or I can charge it here and change the voltage of the battery in A

    if i bought my ipod touch 32gb in germany where the voltage is 220v and i live in America where the voltage is 110, i will have to wait to get to my home to charge it for first time or I can charge it here and change the voltage of the battery in America?
    please i need help, im worried that if I connect my ipod here, it will burn or sometihng bad.

    Just connect it to a computer's USB port.
    Most wall chargers are dual voltage (110- 220 volts) and only require a plug adopter. Check the wall charger to see if yours is.

  • Error when launch MaxDB studio for first time

    Dear, Experts
    I faced with one issue for launch MaxDB studio for first time.
    It reported:
    Connect user failed
    SAP DBTech JDBC: Cannot connect to jdbc:sapdb://.../.UMDB [Restart required].
    Creating default user management failed
    Could not create database ".UMDB": [C:\sapdb\clients\DatabaseStudio\pgm\dbmcli.exe] > ERR, -24832, ERR_SHMNOTAVAILABLE ...
    Could you please help me on this?
    Thank you in advance.
    Best Regards

    If not solved yet...
    What says appsrv.log ? Which user are you using to start the appserver ? Which user have you specified when sreating the database ?
    Nicolas.

  • Mac 10.9.5 trying to launch Illustrator CS6 for first time and prompts Java even though I have Java 8 installed.

    Mac 10.9.5 trying to launch Illustrator CS6 for first time and won't launch, prompts for Java 6 even though I have Java 8 installed!
    Apple says Java 6 is very insecure and not to use it.  I have the latest Java installed.  Why won't Illustrator launch?  What else can I do?

    tm,
    I believe you should be able to get round the issue by following this:
    http://oliverdowling.com.au/2014/03/28/java-se-8-on-mac-os-x/
    It is even more thoroughly described in this thread, see post #3 on by gator soup:
    https://forums.adobe.com/thread/1706469

  • What should I do to setup a new MacBook pro for first time when moving from a PC?

    What should I do to setup a new MacBook pro for first time when moving from a PC?

    you have to use the migration assistant if you want your files transfered from your pc to mac this link will be helpful
    http://support.apple.com/kb/HT4796

  • Using Apple TV for first time - to rent a movie.  Logged in successfully - billing info updated.  Keep getting message to log into Itunes on PC - movie won't load on TV

    using Apple TV for first time - to rent a movie.  Logged in successfully - billing info updated.  Keep getting message to log into Itunes on PC - movie won't load on TV -
    any advice?

    3GB for a movie? That's almost equivalent to an original DVD. 
    Have you checked in the Recently Added playlist?
    I think this is possibly linear.  Select 'normal' in HB, iTunes accepts it; select 'high quality' in HB iTunes doesn't.  I can't say why; I don't have any video that anywhere approaches 3GB in size.  If that's how iTunes behaves I don't see you have too many options.  You either select normal and it works, or you select HQ and live with playing the movie outside of iTunes.
    I won't ask what movie because any help with illegally ripped copy protected DVDs is strictly prohibited by the Terms of Use so I'm assuming this is a 6 hour video of your puppy playing on the floor.

  • Lov is not validating when i open a form for first time

    hi all,
    i am using form6i.
    i have one multi record block. in which lov is attached to it.
    but when i open the form for first time the item corresponding the above said is not showing and if i enter the value then also its not validating against. its showing error frm-40210
    but when i click on other item and come to this item Lov is showing.
    what could be the reason for this strange behaviour.
    i have checked set_item_properties too(there is properties have been set)
    Please advice.
    Thanks..

    FRM-40210: Search string not found.
    what could be the reason for this strange behaviour.Do you have an "Initial Value" set for the item? Do you have the "Validate from list" property set to yes or are you setting the initial value through code?
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • ADF application taking more time for first time and less from second time

    Hi Experts,
    We are using ADF 11.1.1.2.
    Our application contains 5 jsp pages, 10 - 12 taskflows, and 50 jsff pages.
    For the first time in the day if we use the application it is taking more than 60 sec on some actions.
    And from the next time onwords it is taking 5 to 6 sec.
    Same thing is happening daily.
    Can any one tell me why this application is taking more time for first time and less time from second time.
    Regards
    Gayaz

    Hi,
    If you don't restart you WLS every day, then you should read about Tuning Application Module Pools and Connection Pools
    http://docs.oracle.com/cd/E15523_01/web.1111/b31974/bcampool.htm#sm0301
    And pay attention to the parameter: Maximum Available Size, Minimum Available Size
    http://docs.oracle.com/cd/E15523_01/web.1111/b31974/bcampool.htm#sm0314
    And adjust them to suit your needs.

  • Opening premier elements for first time. Been "gathering user info" for 15 minutes...what to do?

    Opening premier elements for first time. Been "gathering user info" for 15 minutes...what to do? Previously hit "organize", ran for 25 min till hit 100%, then "had to close"?

    Unfortunately, there's not enough info listed to give you an effective answer.
    Can you give more detailed system spec's.  There are a lot of differences in RAM, & Hard Drive Technologies.  Is your 2TB a single hard drive, or multiple drives in RAID?  While a single 2TB drive is nice for the storage capacity, they also sacrifice some performance to reach that capacity... What speed is the RAM, & I'm assuming it's properly opperating in Dual Channel mode (watch your POST screen to be sure).  Which Core i7 CPU are you running, & what Operating System are you running.   Finally, bring up your task manager, & see what processes are using CPU cycles.   Also, are you starting up PrE8 through the default shortcut which uses the Welcome screen?
    A quick guess is that Auto Analyzer & the Welcome screen are behind your troubles, but can't be sure till more info is available.
    There is a current thread about Auto Analyzer, & I've posted a way to bypass the Welcome screen in several threads. 
    See my post in this thread to bypass the Welcome screen http://forums.adobe.com/thread/516524 (2nd post in thread)
    Message was edited by: chaosdsmFL -  added link

  • Error when booting app server for first time

    Hi All,
    My OS is OEL 6,PT 8.53 and HCM9.2 after creating the app server domain and booting it for first time i am getting an error as below,
    exec PSWATCHSRV -o ./LOGS/stdout -e ./LOGS/stderr -A -- -ID 221921 -D TESTSERV -                              S PSWATCHSRV :
    CMDTUX_CAT:816: ERROR: Cannot exec, executable file not found
    tmboot: CMDTUX_CAT:827: ERROR: Fatal error encountered; initiating user error ha                              ndler
    exec tmshutdown -qy
    Any help appreciated.
    TUXEDO LOG Says,
    162253.wipcoe1234!tmloadcf.5379.1098766080.-2: 05-03-2013: client high water (0), total client (0)
    162253.wipcoe1234!tmloadcf.5379.1098766080.-2: 05-03-2013: Tuxedo Version 11.1.1.3.0, 64-bit
    162253.wipcoe1234!tmloadcf.5379.1098766080.-2: CMDTUX_CAT:879: INFO: A new file system has been created. (size = 1197 512-byte blocks)
    162253.wipcoe1234!tmloadcf.5379.1098766080.-2: CMDTUX_CAT:871: INFO: TUXCONFIG file /home/oracle/psft/pt/8.53/appserv/HCMDM92/PSTUXCFG has been created
    162253.wipcoe1234!tmloadcf.5384.2986219264.-2: 05-03-2013: Tuxedo Version 11.1.1.3.0, 64-bit
    162253.wipcoe1234!tmloadcf.5384.2986219264.-2: CMDTUX_CAT:879: INFO: A new file system has been created. (size = 1197 512-byte blocks)
    162253.wipcoe1234!tmloadcf.5384.2986219264.-2: CMDTUX_CAT:871: INFO: TUXCONFIG file /home/oracle/psft/pt/8.53/appserv/HCMDM92/PSTUXCFG has been created
    162258.wipcoe1234!PSADMIN.5355: Begin attempt on domain HCMDM92
    162302.wipcoe1234!tmadmin.5392.1509406464.-2: TMADMIN_CAT:1330: INFO: Command: boot -A
    162304.wipcoe1234!tmboot.5393.2297452288.-2: 05-03-2013: Tuxedo Version 11.1.1.3.0, 64-bit
    162304.wipcoe1234!tmboot.5393.2297452288.-2: CMDTUX_CAT:1851: INFO: TM_BOOTTIMEOUT is set to 120 seconds
    162304.wipcoe1234!tmboot.5393.2297452288.-2: CMDTUX_CAT:1855: INFO: TM_BOOTPRESUMEDFAIL option is selected
    162306.wipcoe1234!BBL.5394.2180380416.0: 05-03-2013: Tuxedo Version 11.1.1.3.0, 64-bit, Patch Level (none)
    162306.wipcoe1234!BBL.5394.2180380416.0: LIBTUX_CAT:262: INFO: Standard main starting
    162308.wipcoe1234!tmboot.5397.3909768960.-2: 05-03-2013: Tuxedo Version 11.1.1.3.0, 64-bit
    162308.wipcoe1234!tmboot.5397.3909768960.-2: CMDTUX_CAT:1851: INFO: TM_BOOTTIMEOUT is set to 120 seconds
    162308.wipcoe1234!tmboot.5397.3909768960.-2: CMDTUX_CAT:1855: INFO: TM_BOOTPRESUMEDFAIL option is selected
    162308.wipcoe1234!tmboot.5397.3909768960.-2: tmboot: CMDTUX_CAT:827: ERROR: Fatal error encountered; initiating user error handler
    162311.wipcoe1234!BBL.5394.2180380416.0: CMDTUX_CAT:26: INFO: The BBL is exiting system
    162314.wipcoe1234!PSADMIN.5355: End boot attempt on domain HCMDM92
    Edited by: ajith on May 3, 2013 5:39 PM

    If not solved yet...
    What says appsrv.log ? Which user are you using to start the appserver ? Which user have you specified when sreating the database ?
    Nicolas.

Maybe you are looking for

  • Import Clip From DVD

    I have been trying for a couple of days to take a clip from a DVD and insert it into PE11. I can't believe it's so incredibly hard, so I hope someone can help me. First i use DVD Shrink to extract just the portion I want to the normal VIDEO_TS folder

  • Dequeue a text message

    Hello everyone, DB version : 11.2.0.1.0 I'm able to add a text message on an AQ queue, but I'm not able to dequeue it from java. When I run the dequeue method, it waits ... it doesn't get any message in, even if new messages are being put on the queu

  • RFC -- XI --- SOAP synch scenaio

    Hi Experts,       My current scenario is RFC<> XI <-> SOAP.  Rfc sending request and getting responce back from WebService, current scenario is working fine.   Now i want to modify existing scenario, I want to send WebService response to RFC and Rece

  • 64-Bit and 32-Bit: Snow Leopard and Windows 7

    Hi All: I will eventually be dual booting Snow Leopard and Windows 7. I have never used Boot Camp before and have several questions, including one related to Boot Camp. First, when installing 7, will I need to format the 7 partition, presumably NTSF.

  • HT1531 netflix requires intel based, but I have a power PC (old power book G-4) are there any work arounds?

    I have an older Power book G-4 with 1.67 GHz powerPC G-4 mac osX 10.5.8 but cant get Netflix to work as they require an Intel based  to work Are theere any work arounds for this, as this used to work but Netflix requires an Intel based system now Hel