(Box root)
| 82 | HashBiMap<String, String> resources = HashBiMap.create(); |
| 83 | |
| 84 | public WebApps(Box root) { |
| 85 | this.root = root; |
| 86 | |
| 87 | properties.put(Commands.commands, () -> { |
| 88 | Map<Pair<String, String>, Runnable> m = new LinkedHashMap<>(); |
| 89 | RemoteEditor ed = this.find(RemoteEditor.editor, both()) |
| 90 | .findFirst() |
| 91 | .get(); |
| 92 | |
| 93 | Box box = ed.getCurrentlyEditing(); |
| 94 | Dict.Prop<String> cep = ed.getCurrentlyEditingProperty(); |
| 95 | |
| 96 | if (box == null) return m; |
| 97 | |
| 98 | String s = box.properties.get(WebApps.html); |
| 99 | if (!cep.equals(html) && (box.first(html, box.upwards()) |
| 100 | .isPresent() || s != null)) m.put(new Pair<>("Edit <i>HTML</i>", |
| 101 | "Switch to editing html associated with this box, served at http://localhost:8082/" + lookup.inverse() |
| 102 | .get(box)), |
| 103 | () -> { |
| 104 | ed.setCurrentlyEditingProperty(html); |
| 105 | }); |
| 106 | |
| 107 | return m; |
| 108 | }); |
| 109 | |
| 110 | this.properties.put(newStaticHTML, (x, name) -> { |
| 111 | |
| 112 | lookup.put(name, x); |
| 113 | |
| 114 | return x.properties.computeIfAbsent(html, m -> ""); |
| 115 | }); |
| 116 | |
| 117 | this.properties.put(newStaticFile, (name, path) -> { |
| 118 | |
| 119 | resources.put(name, path); |
| 120 | }); |
| 121 | |
| 122 | } |
| 123 | |
| 124 | static AtomicInteger uid = new AtomicInteger(0); |
| 125 |
nothing calls this directly
no test coverage detected