MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / WebApps

Method WebApps

src/main/java/fielded/boxbrowser/WebApps.java:84–122  ·  view source on GitHub ↗
(Box root)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 13

getCurrentlyEditingMethod · 0.95
firstMethod · 0.95
upwardsMethod · 0.95
isPresentMethod · 0.80
inverseMethod · 0.80
computeIfAbsentMethod · 0.80
getMethod · 0.65
putMethod · 0.45
findMethod · 0.45
bothMethod · 0.45

Tested by

no test coverage detected