MCPcopy Create free account
hub / github.com/rambaut/figtree / FigTreeWebApplication

Class FigTreeWebApplication

src/figtree/webui/FigTreeWebApplication.java:42–298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40import figtree.treeviewer.treelayouts.RectilinearTreeLayout;
41
42public class FigTreeWebApplication extends WApplication {
43 private TreeWidget treeWidget;
44 private SimpleLabelPainter tipPainter;
45 private SimpleLabelPainter nodePainter;
46 private SimpleLabelPainter branchPainter;
47
48 public FigTreeWebApplication(WEnvironment env) {
49 super(env);
50 setTitle("FigTree");
51 useStyleSheet("figtree.css");
52
53 WVBoxLayout layout = new WVBoxLayout(getRoot());
54
55 FileUploadWidget uploadWidget = new FileUploadWidget();
56 uploadWidget.fileUploaded().addListener(this, new Listener<String>() {
57 @Override
58 public void trigger(String path) {
59 readFile(path);
60 }
61 });
62
63 layout.addWidget(uploadWidget);
64 layout.addWidget(treeWidget = new TreeWidget(), 1);
65 treeWidget.setStyleClass("tree");
66
67 readFile("/etc/figtree/example.tree");
68
69 treeWidget.getTreePane().setTipLabelPainter
70 (tipPainter = new SimpleLabelPainter(SimpleLabelPainter.PainterIntent.TIP));
71 treeWidget.getTreePane().setNodeLabelPainter
72 (nodePainter = new SimpleLabelPainter(SimpleLabelPainter.PainterIntent.NODE));
73 treeWidget.getTreePane().setBranchLabelPainter
74 (branchPainter = new SimpleLabelPainter(SimpleLabelPainter.PainterIntent.BRANCH));
75
76 createControls(layout);
77 }
78
79
80 private void readFile(String path) {
81 try {
82 FileReader reader = new FileReader(path);
83 readData(reader, true);
84 } catch (FileNotFoundException e) {
85 e.printStackTrace();
86 } catch (IOException e) {
87 e.printStackTrace();
88 }
89 }
90
91
92 private void createControls(WVBoxLayout layout) {
93 WHBoxLayout controlsLayout = new WHBoxLayout();
94 layout.addLayout(controlsLayout, 0, AlignmentFlag.AlignJustify, AlignmentFlag.AlignTop);
95
96 WVBoxLayout column = new WVBoxLayout();
97 controlsLayout.addLayout(column, 0, AlignmentFlag.AlignJustify, AlignmentFlag.AlignMiddle);
98
99 WComboBox box = new WComboBox();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…