import java.util.*;

public class Widgets1 {
	private CurScreen curScreen;
	private Map<String, Widget1> value = new HashMap<>();
	public Map<String, Object> getValue() {
		Map<String, Object> value = new HashMap<>();
		for (String key: this.value.keySet()) {
			Widget1 widget = this.value.get(key);
			value.put(key, widget.getValue());
		}
		return value;
	}
	public void setValue(Map<String, Object> value) {
		for (String key: value.keySet()) {
			String type = "";
			if (((Map<String, Object>) value.get(key)).get("type") != null) type = (String) ((Map<String, Object>) value.get(key)).get("type");
			int y = 0;
			if (((Map<String, Object>) value.get(key)).get("y") != null) y = (int) ((Map<String, Object>) value.get(key)).get("y");
			int x = 0;
			if (((Map<String, Object>) value.get(key)).get("x") != null) x = (int) ((Map<String, Object>) value.get(key)).get("x");
			int height = 0;
			if (((Map<String, Object>) value.get(key)).get("height") != null) height = (int) ((Map<String, Object>) value.get(key)).get("height");
			String text = "";
			if (((Map<String, Object>) value.get(key)).get("text") != null) text = (String) ((Map<String, Object>) value.get(key)).get("text");
			boolean visible = false;
			if (((Map<String, Object>) value.get(key)).get("visible") != null) visible = (boolean) ((Map<String, Object>) value.get(key)).get("visible");
			int width = 0;
			if (((Map<String, Object>) value.get(key)).get("width") != null) width = (int) ((Map<String, Object>) value.get(key)).get("width");
			int state = 0;
			if (((Map<String, Object>) value.get(key)).get("state") != null) state = (int) ((Map<String, Object>) value.get(key)).get("state");
			this.value.put(key, new Widget1(type,true, width, x, y, text, 0, height, curScreen));
		}
	}
	public Widget1 getWidget1(String wid) {
		return this.value.get(wid);
	}
	public Widgets1(CurScreen curScreen) {
		this.curScreen = curScreen;
	}
}