title: JavaFX Scene Graph modification for Responsiveness Indicator
body: <p>It is bad practice to do big jobs on the UI thread as if you do, those big jobs will cause the program to hang (not accept user input or render any new data) until that job is finished.</p>
  
  <p>I am looking to add a widget to our code base that will indicate to developers when they have committed this taboo. My idea, and one I've seen on a number of other applications, is to have some component that is constantly moving at a constant speed, such as a bar that is constantly twirling on the screen. With such a tool, if a developer is working and accidentally does something that is more computationally difficult than he expected on the UI thread, this spinning bar will become choppy, indicating to him, when he does functional testing, that he needs to implement mechanisms that will cause this job to be executed elsewhere.</p>
  
  <p>One odd requirement on this code is that it should be completely non-existent in production builds, and only present in dev builds, since it is a widget not for users, but for developers.</p>
  
  <p>I jumped into the Canvas objects and wrote up a quick component that simply spins a teal bar. The idea is that if a big job is dumped on the UI thread, the bar will stop spinning (since the FX job queue wont continue dispatching) and the bar will jump forward, rather than rotate smoothly (as it does when the program is at rest).</p>
  
  <p>Below is a screen-shot of this first implementation:</p>
  
  <p><img src="https://i.stack.imgur.com/USkkO.png" alt="Our product with two such teal spinners spinning away">
  (notice the teal bars, which, if you saw our application running, would be rotating slowly but steadily --hopefully anyways)</p>
  
  <p>The issue here (as you might notice) is that our layout's been screwed up. This is because I'm modifying the scene graph from this:</p>
  
  <pre><code>Scene
      RootComponent
          Content
  </code></pre>
  
  <p>to</p>
  
  <pre><code>Scene
      obnoxiousPane
          Canvas
              Spinner(s)
          RootComponent
              Content
  </code></pre>
  
  <p>Modifying the scene graph in such a way has things like preferred height, mouse events and (presumably) any number of other events getting dispatched to the spinners rather than the content components.</p>
  
  <p>Of course, when we go to production, I would like to have the original scene graph in the version that we give to our users. </p>
  
  <p>So my question is this: How should I go about correcting these problems?</p>
  
  <p>I could go after each of them individually as they come up, writing a lot of custom code to do things like</p>
  
  <pre><code>obnoxiousPane.prefHeightProperty().bind(content.prefHeightProperty)
  obnoxiousPane.prefWidthProperty()//...
  spinner.setMouseTransparent(true)
  spinner.setOtherEventsIProbablyCantEnumerateWithoutSeriousResearchTransparent(true)
  </code></pre>
  
  <p>Or I could try to go after this problem with reflection, attempting to bind <em>every</em> property in the content pane to the corresponding obnoxiousPane property, but this seems like a bug breeding ground.</p>
  
  <p>Or... what? I'm hoping there's some <code>LightWeight</code> component or <code>ImNotReallyHereProperty</code> that I can leverage to add this development aid.</p>
  
  <p>Thanks for any help!</p>