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

Class SimpleTweaks

src/main/java/fieldbox/boxes/plugins/SimpleTweaks.java:6–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4import fieldbox.boxes.Box;
5
6public class SimpleTweaks extends Box {
7
8 static public final Dict.Prop<FunctionOfBox<Boolean>> applyTweaks = new Dict.Prop<>("applyTweaks").type().toCanon().doc("call `_.applyTweaks()` to make `FLine`s in this box that have been " +
9 "marked as `line.tweaky = true` hand editable, and to apply their edits");
10 static public final Dict.Prop<FunctionOfBox<Boolean>> clearTweaks = new Dict.Prop<>("clearTweaks").type().toCanon().doc("call `_.clearTweaks()` to clear any tweaks applied to lines in this" +
11 " box");
12
13 static public final Dict.Prop<String> _simpleTweaks = new Dict.Prop<>("_simpleTweaks").type().toCanon().autoConstructs(() -> "");
14 static public final Dict.Prop<Boolean> tweaky = new Dict.Prop<>("tweaky").type().toCanon();
15
16 String tweakNow = BoxDefaultCode.findSource(this.getClass(), "tweakNow");
17
18 public SimpleTweaks(Box root) {
19
20 this.properties.put(applyTweaks, (box) -> {
21 box.find(Exec.exec, box.upwards()).findFirst().ifPresent(x -> x.apply(box, tweakNow));
22 return true;
23 });
24 this.properties.put(clearTweaks, (box) -> {
25 box.properties.put(_simpleTweaks, "");
26 return true;
27 });
28 }
29}

Callers

nothing calls this directly

Calls 5

findSourceMethod · 0.95
docMethod · 0.80
toCanonMethod · 0.80
typeMethod · 0.80
autoConstructsMethod · 0.80

Tested by

no test coverage detected