Joshua
open source statistical hierarchical phrase-based machine translation system
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
joshua.ui.tree_visualizer.DerivationViewer Class Reference
Inheritance diagram for joshua.ui.tree_visualizer.DerivationViewer:
[legend]
Collaboration diagram for joshua.ui.tree_visualizer.DerivationViewer:
[legend]

List of all members.

Classes

enum  AnchorType

Public Member Functions

 DerivationViewer (DerivationTree g, Dimension d, Color targetColor, AnchorType anchor)
void setGraph (DerivationTree tree)

Static Public Attributes

static final int DEFAULT_HEIGHT = 500
static final int DEFAULT_WIDTH = 500
static final Color SRC = Color.WHITE
static final Color HIGHLIGHT = Color.pink

Private Attributes

Color TGT
AnchorType anchorStyle
Point2D anchorPoint
Transformer< Node, Paint > vp

Static Private Attributes

static Transformer
< DerivationTreeEdge, Stroke > 
es
static Transformer< Node, Shape > ns

Constructor & Destructor Documentation

joshua.ui.tree_visualizer.DerivationViewer.DerivationViewer ( DerivationTree  g,
Dimension  d,
Color  targetColor,
AnchorType  anchor 
)

Here is the call graph for this function:


Member Function Documentation

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Transformer<DerivationTreeEdge, Stroke> joshua.ui.tree_visualizer.DerivationViewer.es [static, private]
Initial value:
      new Transformer<DerivationTreeEdge, Stroke>() {
        public Stroke transform(DerivationTreeEdge e) {
          if (e.pointsToSource())
            return new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f,
                new float[] {10.0f}, 0.0f);
          else
            return new BasicStroke(1.0f);
        }
      }
final Color joshua.ui.tree_visualizer.DerivationViewer.HIGHLIGHT = Color.pink [static]
Transformer<Node, Shape> joshua.ui.tree_visualizer.DerivationViewer.ns [static, private]
Initial value:
 new Transformer<Node, Shape>() {
    public Shape transform(Node n) {
      JLabel x = new JLabel();
      double len = x.getFontMetrics(x.getFont()).stringWidth(n.toString());
      double margin = 5.0;
      return new Rectangle2D.Double((len + margin) / (-2), 0, len + 2 * margin, 20);
    }
  }
final Color joshua.ui.tree_visualizer.DerivationViewer.SRC = Color.WHITE [static]
Transformer<Node, Paint> joshua.ui.tree_visualizer.DerivationViewer.vp [private]
Initial value:
 new Transformer<Node, Paint>() {
    public Paint transform(Node n) {
      if (n.isHighlighted()) return HIGHLIGHT;
      if (n.isSource())
        return SRC;
      else
        return TGT;
    }
  }