diff --git a/src/CurScreen.java b/src/CurScreen.java index 5e4140e..96bf980 100644 --- a/src/CurScreen.java +++ b/src/CurScreen.java @@ -16,20 +16,20 @@ return new String(this.value); } public void updateFromState(String scId, String wid, int state) { - String temp_if5; + String temp_if1; if ((state==0)) { - temp_if5 = "001"; + temp_if1 = "000"; } else { - temp_if5 = this.value; + temp_if1 = this.value; } - this.value = temp_if5; - String temp_if4; + this.value = temp_if1; + String temp_if0; if ((state==0)) { - temp_if4 = "000"; + temp_if0 = "001"; } else { - temp_if4 = this.value; + temp_if0 = this.value; } - this.value = temp_if4; + this.value = temp_if0; Map screenTemplate = this.screenTemplate.getValue(); this.screenTemplate = screenTemplates.getScreenTemplate(curScreen.getValue()); this.screen.updateFromCurScreen(this.value, screenTemplate); @@ -38,20 +38,20 @@ this.screen.updateFromCurScreen(this.value, screenTemplate); } public void updateFromState(String scId, String wid, int state) { - String temp_if5; + String temp_if1; if ((state==0)) { - temp_if5 = "001"; + temp_if1 = "000"; } else { - temp_if5 = this.value; + temp_if1 = this.value; } - this.value = temp_if5; - String temp_if4; + this.value = temp_if1; + String temp_if0; if ((state==0)) { - temp_if4 = "000"; + temp_if0 = "001"; } else { - temp_if4 = this.value; + temp_if0 = this.value; } - this.value = temp_if4; + this.value = temp_if0; Map screenTemplate = this.screenTemplate.getValue(); this.screenTemplate = screenTemplates.getScreenTemplate(curScreen.getValue()); this.screen.updateFromCurScreen(this.value, screenTemplate); diff --git a/src/Main.java b/src/Main.java index e7e8cdd..c5177b3 100644 --- a/src/Main.java +++ b/src/Main.java @@ -9,24 +9,18 @@ this.screen = new Screen(screenTemplates); this.curScreen = new CurScreen(screen, screenTemplates); } - public Map getScreenTemplate(String scId) { - return this.screenTemplates.getScreenTemplate(scId).getValue(); - } public Map getWidget(String wid) { return this.screen.getWidgets().getWidget(wid).getValue(); } - public Map getScreenTemplates() { - return this.screenTemplates.getValue(); - } - public Map getWidgets() { - return this.screen.getWidgets().getValue(); - } - public Map getWidget(String scId, String wid) { - return this.screenTemplates.getScreenTemplate(scId).getWidgets().getWidget(wid).getValue(); + public Map getScreenTemplate(String scId) { + return this.screenTemplates.getScreenTemplate(scId).getValue(); } public Map getWidgets(String scId) { return this.screenTemplates.getScreenTemplate(scId).getWidgets().getValue(); } + public Map getScreenTemplates() { + return this.screenTemplates.getValue(); + } public Map getScreen() { return this.screen.getValue(); } @@ -36,11 +30,8 @@ public int getHeight(String wid) { return this.screen.getWidgets().getWidget(wid).getHeight(); } - public boolean getLayout() { - return this.screen.getLayout(); - } - public void changeLayout(boolean layout) { - this.screen.changeLayout(layout); + public boolean getVisible(String wid) { + return this.screen.getWidgets().getWidget(wid).getVisible(); } public int getY(String wid) { return this.screen.getWidgets().getWidget(wid).getY(); @@ -48,6 +39,36 @@ public void changeY(String wid, int y) { this.screen.getWidgets().getWidget(wid).changeY(wid, y); } + public String getText(String wid) { + return this.screen.getWidgets().getWidget(wid).getText(); + } + public void textEvent(String wid, String nextText) { + this.screen.getWidgets().getWidget(wid).textEvent(wid, nextText); + } + public int getX(String wid) { + return this.screen.getWidgets().getWidget(wid).getX(); + } + public void changeX(String wid, int x) { + this.screen.getWidgets().getWidget(wid).changeX(wid, x); + } + public void changeCurScreen(String nextScId) { + this.curScreen.changeCurScreen(nextScId); + } + public int getState(String scId, String wid) { + return this.screenTemplates.getScreenTemplate(scId).getWidgets().getWidget(wid).getState(); + } + public void mouseEvent(String wid, int nextState) { + this.screen.getWidgets().getWidget(wid).mouseEvent(wid, nextState); + } + public boolean getLayout() { + return this.screen.getLayout(); + } + public void changeLayout(boolean layout) { + this.screen.changeLayout(layout); + } + public int getWidth(String wid) { + return this.screen.getWidgets().getWidget(wid).getWidth(); + } public void addMovableButton(String text, int x, int y, int width, int height, String wid) { this.screen.getWidgets().addMovableButton(text, x, y, width, height, wid); } @@ -66,34 +87,4 @@ public void addLabel(String text, String wid) { this.screen.getWidgets().addLabel(text, wid); } - public int getWidth(String wid) { - return this.screen.getWidgets().getWidget(wid).getWidth(); - } - public int getX(String wid) { - return this.screen.getWidgets().getWidget(wid).getX(); - } - public void changeX(String wid, int x) { - this.screen.getWidgets().getWidget(wid).changeX(wid, x); - } - public boolean getVisible(String wid) { - return this.screen.getWidgets().getWidget(wid).getVisible(); - } - public String getText(String wid) { - return this.screen.getWidgets().getWidget(wid).getText(); - } - public void textEvent(String wid, String nextText) { - this.screen.getWidgets().getWidget(wid).textEvent(wid, nextText); - } - public void changeCurScreen(String nextScId) { - this.curScreen.changeCurScreen(nextScId); - } - public int getState(String scId, String wid) { - return this.screenTemplates.getScreenTemplate(scId).getWidgets().getWidget(wid).getState(); - } - public int getState(String wid) { - return this.screen.getWidgets().getWidget(wid).getState(); - } - public void mouseEvent(String wid, int nextState) { - this.screen.getWidgets().getWidget(wid).mouseEvent(wid, nextState); - } } \ No newline at end of file diff --git a/src/Screen.java b/src/Screen.java index 521c902..6935fda 100644 --- a/src/Screen.java +++ b/src/Screen.java @@ -9,21 +9,21 @@ this.layout = layout; } public Map getValue() { - Map temp_nil10 = new HashMap<>(); - temp_nil10.put("layout",this.getLayout()); - temp_nil10.put("widgets",this.widgets.getValue()); - return temp_nil10; + Map temp_nil2 = new HashMap<>(); + temp_nil2.put("layout",this.getLayout()); + temp_nil2.put("widgets",this.widgets.getValue()); + return temp_nil2; } public Widgets getWidgets() { return this.widgets; } + public void updateFromCurScreen(String curScreen, Map screenTemplate) { + this.value = screenTemplate; + } public boolean getLayout() { return this.layout; } public void changeLayout(boolean layout) { this.layout = layout; } - public void updateFromCurScreen(String curScreen, Map screenTemplate) { - this.value = screenTemplate; - } } \ No newline at end of file diff --git a/src/ScreenTemplate.java b/src/ScreenTemplate.java index b9a2da5..3ed1c67 100644 --- a/src/ScreenTemplate.java +++ b/src/ScreenTemplate.java @@ -3,9 +3,9 @@ public class ScreenTemplate { private Widgets widgets = new Widgets(); public Map getValue() { - Map temp_nil7 = new HashMap<>(); - temp_nil7.put("widgets",this.widgets.getValue()); - return temp_nil7; + Map temp_nil1 = new HashMap<>(); + temp_nil1.put("widgets",this.widgets.getValue()); + return temp_nil1; } public Widgets getWidgets() { return this.widgets; diff --git a/src/ScreenTemplates.java b/src/ScreenTemplates.java index 787128a..c8b5ed6 100644 --- a/src/ScreenTemplates.java +++ b/src/ScreenTemplates.java @@ -5,7 +5,7 @@ public Map getValue() { return new HashMap<>(this.value); } - public ScreenTemplate getScreenTemplate(String nextScId) { - return this.value.get(nextScId); + public ScreenTemplate getScreenTemplate(String scId) { + return this.value.get(scId); } } \ No newline at end of file diff --git a/src/Widget.java b/src/Widget.java index 3565092..fb0f538 100644 --- a/src/Widget.java +++ b/src/Widget.java @@ -1,13 +1,52 @@ import java.util.*; public class Widget { + private int height; + private boolean visible; + private int y; + private String text; + private int x; private CurScreen curScreen; private int state; private CurScreen curScreen; + private Widget widget; + private ScreenTemplates screenTemplates; + private Widget widget; + private int width; public Map getValue() { - Map temp_nil9 = new HashMap<>(); - temp_nil9.put("state",this.getState()); - return temp_nil9; + Map temp_nil0 = new HashMap<>(); + temp_nil0.put("x",this.getX()); + temp_nil0.put("y",this.getY()); + temp_nil0.put("visible",this.getVisible()); + temp_nil0.put("height",this.getHeight()); + temp_nil0.put("width",this.getWidth()); + temp_nil0.put("text",this.getText()); + temp_nil0.put("state",this.getState()); + return temp_nil0; + } + public int getHeight() { + return this.height; + } + public boolean getVisible() { + return this.visible; + } + public int getY() { + return this.y; + } + public void changeY(String wid, int y) { + this.y = y; + } + public String getText() { + return this.text; + } + public void textEvent(String wid, String nextText) { + this.text = nextText; + } + public int getX() { + return this.x; + } + public void changeX(String wid, int x) { + this.x = x; } public void updateStateFromState(String self, String self2, String wid, int state, String curScreen) { this.state = state; @@ -24,8 +63,29 @@ this.curScreen.updateFromState(scId, wid, this.state); this.curScreen.updateFromState(scId, wid, this.state); } + public void mouseEvent(String wid, int nextState) { + this.state = nextState; + String curScreen = this.curScreen.getValue(); + this.widget = screenTemplates.getScreenTemplate(curScreen.getValue()).getWidgets().getWidget(wid); + this.widget.updateStateFromState(wid, wid, this.state, curScreen); + String curScreen = this.curScreen.getValue(); + this.widget = screenTemplates.getScreenTemplate(curScreen.getValue()).getWidgets().getWidget(wid); + this.widget.updateStateFromState(wid, wid, this.state, curScreen); + } + public int getWidth() { + return this.width; + } public Widget(int state, CurScreen curScreen) { this.state = state; this.curScreen = curScreen; } + public Widget(boolean visible, ScreenTemplates screenTemplates, int x, int width, int y, String text, int height) { + this.visible = visible; + this.screenTemplates = screenTemplates; + this.x = x; + this.width = width; + this.y = y; + this.text = text; + this.height = height; + } } \ No newline at end of file diff --git a/src/Widgets.java b/src/Widgets.java index a021624..568d04a 100644 --- a/src/Widgets.java +++ b/src/Widgets.java @@ -8,4 +8,25 @@ public Widget getWidget(String wid) { return this.value.get(wid); } + public Widget getWidget(String wid) { + return this.value.get(wid); + } + public void addMovableButton(String text, int x, int y, int width, int height, String wid) { + this.value.put(wid,new Widget(0, curScreen)); + } + public void addMovableTextInput(int x, int y, int width, int height, String wid) { + this.value.put(wid,new Widget(0, curScreen)); + } + public void addMovableLabel(String text, int x, int y, int width, int height, String wid) { + this.value.put(wid,new Widget(0, curScreen)); + } + public void addButton(String text, String wid) { + this.value.put(wid,new Widget(0, curScreen)); + } + public void addTextInput(String wid) { + this.value.put(wid,new Widget(0, curScreen)); + } + public void addLabel(String text, String wid) { + this.value.put(wid,new Widget(0, curScreen)); + } } \ No newline at end of file