src/Tools/jEdit/src/jedit/StateViewDockable.scala
author wenzelm
Fri Dec 19 23:11:08 2008 +0100 (2008-12-19)
changeset 34408 ad7b6c4813c8
parent 34406 f81cd75ae331
child 34424 c880492754d0
permissions -rw-r--r--
added some headers and comments;
wenzelm@34408
     1
/*
wenzelm@34408
     2
 * Dockable window with rendered state output
wenzelm@34408
     3
 *
wenzelm@34408
     4
 * @author Fabian Immler, TU Munich
wenzelm@34408
     5
 * @author Johannes Hölzl, TU Munich
wenzelm@34408
     6
 */
wenzelm@34408
     7
wenzelm@34318
     8
package isabelle.jedit
wenzelm@34318
     9
wenzelm@34318
    10
immler@34361
    11
import java.awt.BorderLayout
immler@34361
    12
import javax.swing.{ JButton, JPanel, JScrollPane }
wenzelm@34318
    13
wenzelm@34318
    14
import isabelle.IsabelleSystem.getenv
wenzelm@34318
    15
wenzelm@34318
    16
import org.xhtmlrenderer.simple.XHTMLPanel
wenzelm@34318
    17
import org.xhtmlrenderer.context.AWTFontResolver
wenzelm@34318
    18
wenzelm@34318
    19
import org.gjt.sp.jedit.View
wenzelm@34318
    20
wenzelm@34318
    21
class StateViewDockable(view : View, position : String) extends JPanel {
immler@34406
    22
  val panel = new XHTMLPanel(new UserAgent())
immler@34406
    23
  setLayout(new BorderLayout)
immler@34406
    24
immler@34406
    25
  //Copy-paste-support
immler@34406
    26
  private val cp = new SelectionActions
immler@34406
    27
  cp.install(panel)
immler@34361
    28
immler@34406
    29
  add(new JScrollPane(panel), BorderLayout.CENTER)
immler@34361
    30
immler@34406
    31
  private val fontResolver =
immler@34406
    32
    panel.getSharedContext.getFontResolver.asInstanceOf[AWTFontResolver]
immler@34406
    33
  if (Plugin.plugin.viewFont != null)
immler@34406
    34
    fontResolver.setFontMapping("Isabelle", Plugin.plugin.viewFont)
immler@34406
    35
immler@34406
    36
  Plugin.plugin.viewFontChanged.add(font => {
wenzelm@34318
    37
    if (Plugin.plugin.viewFont != null)
wenzelm@34318
    38
      fontResolver.setFontMapping("Isabelle", Plugin.plugin.viewFont)
wenzelm@34318
    39
immler@34406
    40
    panel.relayout()
immler@34406
    41
  })
immler@34406
    42
wenzelm@34318
    43
}