import java.util.*;
public class Widgets {
ScreenTemplates screenTemplates;
CurScreen curScreen;
private Map<String, Widget> value = new HashMap<>();
public Map<String, Widget> getValue() {
return new HashMap<>(this.value);
}
public void setValue(Map<String, Object> value) {
for (String key: value.keySet()) {
String type = "";
if (((Map<String, Object>) value.get(key)) != null) type = (String) ((Map<String, Object>) value.get(key)).get("type");
int y = 0;
if (((Map<String, Object>) value.get(key)) != null) y = (int) ((Map<String, Object>) value.get(key)).get("y");
int x = 0;
if (((Map<String, Object>) value.get(key)) != null) x = (int) ((Map<String, Object>) value.get(key)).get("x");
int height = 0;
if (((Map<String, Object>) value.get(key)) != null) height = (int) ((Map<String, Object>) value.get(key)).get("height");
String text = "";
if (((Map<String, Object>) value.get(key)) != null) text = (String) ((Map<String, Object>) value.get(key)).get("text");
boolean visible = true;
if (((Map<String, Object>) value.get(key)) != null) visible = (boolean) ((Map<String, Object>) value.get(key)).get("visible");
int width = 0;
if (((Map<String, Object>) value.get(key)) != null) width = (int) ((Map<String, Object>) value.get(key)).get("width");
int state = 0;
if (((Map<String, Object>) value.get(key)) != null) state = (int) ((Map<String, Object>) value.get(key)).get("state");
this.value.put(key, new Widget(type, true, screenTemplates, width, x, y, text, 0, height, curScreen));
}
}
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("button", true, screenTemplates, width, x, y, text, 0, height, curScreen));
}
public void addMovableTextInput(int x, int y, int width, int height, String wid) {
this.value.put(wid,new Widget("textInput", true, screenTemplates, width, x, y, "", 0, height, curScreen));
}
public void addMovableLabel(String text, int x, int y, int width, int height, String wid) {
this.value.put(wid,new Widget("label", true, screenTemplates, width, x, y, text, 0, height, curScreen));
}
public void addButton(String text, String wid) {
this.value.put(wid,new Widget("button",true, screenTemplates, 0, 0, 0, text, 0, 0, curScreen));
}
public void addTextInput(String wid) {
this.value.put(wid,new Widget("textInput", true, screenTemplates, 0, 0, 0, "", 0, 0, curScreen));
}
public void addLabel(String text, String wid) {
this.value.put(wid,new Widget("label", true, screenTemplates, 0, 0, 0, text, 0, 0, curScreen));
}
public Widgets(ScreenTemplates screenTemplates, CurScreen curScreen) {
this.screenTemplates = screenTemplates;
this.curScreen = curScreen;
}
}