title: JSF: Showing/Calling a dialog programmatically
body: <p>How can I show/call a dialog programmatically and add this to stage (actual browser window)?</p>
  
  <p>I want to trigger a database update every 2 hours. I have done this with a <code>TimerTask</code>. This works fine for me, the timer task gets all the data I want from the database. Before this timer task is triggered I want to "lock" the screen for some seconds that no user (session scoped) can access the database (I also know how this will work). My problem is that I don't know/cannot find a way to call a dialog programmatically.</p>
  
  <hr>
  
  <p><strong>Update</strong> I want to set this primefaces dialog: </p>
  
  <pre><code>Dialog dialog = new Dialog(); 
  dialog.setAppendToBody(true);
  dialog.setModal(true);
  dialog.setVisible(true);
  dialog.setWidgetVar("generatedDialog");
  dialog.setId("fancyDialog");
  dialog.setClosable(false);
  dialog.setHeader("Getting latest information from the database");
  dialog.setDynamic(true);
  dialog.setResizable(false);
  dialog.setDraggable(false);
  </code></pre>
  
  <p>How can I display it to my browser?</p>