diff options
author | j-james | 2022-11-27 11:34:42 +0000 |
---|---|---|
committer | j-james | 2022-11-27 11:34:42 +0000 |
commit | ec8ad6118e59572f350e1650d4e1d1fd665c671d (patch) | |
tree | 641a7af8aa373c739b7d94173c6963ef1f0d3682 /src/main/model/layout/DocumentLayout.java | |
parent | f68781603c7c77ac62d90c224e171c31064b50a6 (diff) |
Begin implementation of the layout engine
Diffstat (limited to 'src/main/model/layout/DocumentLayout.java')
-rw-r--r-- | src/main/model/layout/DocumentLayout.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/main/model/layout/DocumentLayout.java b/src/main/model/layout/DocumentLayout.java new file mode 100644 index 0000000..84f58f2 --- /dev/null +++ b/src/main/model/layout/DocumentLayout.java @@ -0,0 +1,25 @@ +package model.layout; + +import java.awt.*; + +public class DocumentLayout extends Layout { + + /* + * INCREDIBLY UNSAFE - but this is actually fine with our code design + * We only reference the node / parent layout from the child layout, + * and so as we aren't referencing them here it (should) be fine + */ + public DocumentLayout() { + super(null, null); + } + + public void layout() { + this.setLocation(new Point(0, 0)); + this.setDimension(new Dimension(DEFAULT_WIDTH, DEFAULT_HEIGHT)); + + for (Layout child : this.getChildren()) { + child.layout(); + this.setHeight(this.getHeight() + child.getHeight()); + } + } +} |