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

Class Open

src/main/java/fieldbox/Open.java:50–530  ·  view source on GitHub ↗

This Opens a document, loading a Window and a standard assortment of plugins into the top of a Box graph and the document into the "bottom" of the Box graph. A Plugin is simply something that's initialized: Constructor(root).connect(root) we can take these from a classname and can optionally ini

Source from the content-addressed store, hash-verified

48
49/**
50 * This Opens a document, loading a Window and a standard assortment of plugins into the top of a Box graph and the document into the "bottom" of the Box graph.
51 * <p>
52 * A Plugin is simply something that's initialized: Constructor(boxes.root()).connect(boxes.root()) we can take these from a classname and can optionally initialize them connected to something else
53 */
54public class Open {
55
56 static public final Dict.Prop<String> fieldFilename = new Dict.Prop<>("fieldFilename").toCanon()
57 .type()
58 .doc("the name of the field sheet that we are currently in");
59
60 private FieldBoxWindow window;
61 private final Boxes boxes;
62 private final Drawing drawing;
63 private final FLineDrawing frameDrawing;
64 private final Mouse mouse;
65 private final FrameManipulation frameManipulation;
66 private final TextDrawing textDrawing;
67 private final FLineInteraction interaction;
68
69 private final MarkingMenus markingMenus;
70 private final String filename;
71 private final Keyboard keyboard;
72 private final Drops drops;
73 private PluginList pluginList;
74 private Map<String, List<Object>> plugins;
75 private Nashorn javascript;
76
77// private int sizeX = AutoPersist.persist("window_sizeX", () -> 1000, x -> Math.min(1920 * 2, Math.max(100, x)), (x) -> window == null ? x : (int) window.getBounds().w);
78// private int sizeY = AutoPersist.persist("window_sizeY", () -> 800, x -> Math.min(1920 * 2, Math.max(100, x)), (x) -> window == null ? x : (int) window.getBounds().h);
79// private int atX = AutoPersist.persist("window_atX", () -> 0, x -> x, (x) -> window == null ? x : (int) window.getBounds().x);
80// private int atY = AutoPersist.persist("window_atY", () -> 0, x -> x, (x) -> window == null ? x : (int) window.getBounds().y);
81
82 public boolean experimental = Options.dict().isTrue(new Dict.Prop<Boolean>("experimental"), false);
83
84 public Open(String filename) {
85
86 DefaultMenus.safeToSave = false;
87
88 ServiceLoader<GuardingDynamicLinkerExporter> ll = ServiceLoader.load(GuardingDynamicLinkerExporter.class);
89
90 this.filename = filename;
91 Log.log("startup", () -> " -- Initializing window -- ");
92
93 try {
94 pluginList = new PluginList();
95 plugins = pluginList.read(System.getProperty("user.home") + "/.field/plugins.edn", true);
96
97 if (plugins != null) pluginList.interpretClassPathAndOptions(plugins);
98
99 FieldBox.fieldBox.io.setPluginList(pluginList);
100
101 } catch (IOException e) {
102 e.printStackTrace();
103 pluginList = null;
104 }
105
106
107 Rect bounds = ScreenGeometry.primaryMonitorBounds();

Callers

nothing calls this directly

Calls 5

dictMethod · 0.95
docMethod · 0.80
typeMethod · 0.80
toCanonMethod · 0.80
isTrueMethod · 0.80

Tested by

no test coverage detected