| 53 | |
| 54 | } |
| 55 | |
| 56 | public void loaded() { |
| 57 | properties.put(tap, (x, name) -> { |
| 58 | |
| 59 | String kind = name.substring(0, name.lastIndexOf(":")); |
| 60 | |
| 61 | Box c; |
| 62 | |
| 63 | if (kind.equalsIgnoreCase("PAD")) |
| 64 | c = Pads.padFactory(x, kind, name); |
| 65 | else |
| 66 | c = x.first(Templates.ensureChildTemplated) |
| 67 | .get() |
| 68 | .apply(x, "tap-" + kind, name); |
| 69 | |
| 70 | if (c == null) // no template or child found, just make a box |
| 71 | { |
| 72 | c = x.first(DefaultMenus.newBox).get().apply(x); |
| 73 | c.properties.put(Box.name, name); |
| 74 | } |
| 75 | |
| 76 | // do something with 'c' -> function |
| 77 | |
| 78 | Binding bindingwWas = c.properties.get(tapBinding); |
| 79 | if (bindingwWas == null) { |
| 80 | Binding binding = new Binding(c, x, name); |
| 81 | Optional<RemoteEditor> first = this.first(RemoteEditor.editor, both()); |
| 82 | if (first.isPresent()) { |
| 83 | binding.server = first.get() |
| 84 | .getServer(); |
| 85 | binding.lastSocket = Server.currentWebSocket.get(); |
| 86 | } |
| 87 | c.properties.put(tapBinding, binding); |
| 88 | x.first(Chorder.begin).get().apply(c); |
| 89 | } |
| 90 | |
| 91 | return c; |
| 92 | |
| 93 | }); |
| 94 | |
| 95 | |
| 96 | this.properties.putToMap(Boxes.insideRunLoop, "main.__activate/deactivate__", this::update); |
| 97 | } |
| 98 | |
| 99 | protected boolean update() { |