src/Tools/Graphview/src/floating_dialog.scala
changeset 49557 61988f9df94d
child 49558 af7b652180d5
equal deleted inserted replaced
49556:47e4178f9a94 49557:61988f9df94d
       
     1 /*  Title:      Tools/Graphview/src/floating_dialog.scala
       
     2     Author:     Markus Kaiser, TU Muenchen
       
     3 
       
     4 PopUp Dialog containing node meta-information.
       
     5 */
       
     6 
       
     7 package isabelle.graphview
       
     8 
       
     9 
       
    10 import isabelle._
       
    11 import isabelle.jedit._
       
    12 
       
    13 import scala.swing.{Dialog, BorderPanel, Component}
       
    14 import java.awt.{Point, Dimension}
       
    15 
       
    16 
       
    17 class Floating_Dialog(private val html: String, _title: String, _location: Point)
       
    18 extends Dialog
       
    19 {    
       
    20   location = _location
       
    21   title = _title
       
    22   //No adaptive size because we don't want to resize the Dialog about 1 sec
       
    23   //after it is shown.
       
    24   preferredSize = new Dimension(300, 300)
       
    25   peer.setAlwaysOnTop(true)
       
    26 
       
    27   private def render_document(text: String) =
       
    28     html_panel.peer.render_document("http://localhost", text)
       
    29 
       
    30   private val html_panel = new Component()
       
    31   {
       
    32     override lazy val peer: HTML_Panel =
       
    33       new HTML_Panel(Parameters.font_family, Parameters.font_size) with SuperMixin
       
    34       {
       
    35         setPreferredWidth(290)
       
    36       }
       
    37   }
       
    38   
       
    39   render_document(html)
       
    40   contents = new BorderPanel {
       
    41     add(html_panel, BorderPanel.Position.Center)
       
    42   }
       
    43 }