Newer
Older
StartupManagement / src / Widget.java
import java.util.*;

public class Widget {
	private String type;
	private String text;
	private boolean visible;
	private int x;
	private int y;
	private int width;
	private int height;
	private int state;
	private Map<String, Map<String, Object>> data;
	private Widget1 widget;
	private CurScreen curScreen;
	private ScreenTemplates screenTemplates;
	private SwingPresenter presenter;
	public Widget(String type, String text, boolean visible, int x, int y, int width, int height, int state, Map<String, Map<String, Object>> data, ScreenTemplates screenTemplates, SwingPresenter presenter) {
		this.type = type;
		this.text = text;
		this.visible = visible;
		this.x = x;
		this.y = y;
		this.width = width;
		this.height = height;
		this.state = state;
		this.data = data;
		this.screenTemplates = screenTemplates;
		this.presenter = presenter;
	}
	public Map<String, Object> getValue() {
		Map temp_nil3 = new HashMap<>();
		temp_nil3.put("type",this.getType());
		temp_nil3.put("text",this.getText());
		temp_nil3.put("visible",this.getVisible());
		temp_nil3.put("x",this.getX());
		temp_nil3.put("y",this.getY());
		temp_nil3.put("width",this.getWidth());
		temp_nil3.put("height",this.getHeight());
		temp_nil3.put("state",this.getState());
		temp_nil3.put("data",this.getData());
		return temp_nil3;
	}
	public String getType() {
		return this.type;
	}
	public String getText() {
		return this.text;
	}
	public boolean getVisible() {
		return this.visible;
	}
	public int getX() {
		return this.x;
	}
	public int getY() {
		return this.y;
	}
	public int getWidth() {
		return this.width;
	}
	public int getHeight() {
		return this.height;
	}
	public int getState() {
		return this.state;
	}
	public Map<String, Map<String, Object>> getData() {
		return this.data;
	}
	public void changeX(String wid, int x) {
		this.x = x;
		this.presenter.setX(wid, x);
	}
	public void changeY(String wid, int y) {
		this.y = y;
		this.presenter.setY(wid, y);
	}
	public void changeVisible(String wid, boolean visible) {
		this.visible = visible;
		this.presenter.setVisible(wid, visible);
	}
	public void updateFromWidget(String self, String scId, String wid, Map<String, Object> widget, String curScreen) {
		this.value = widget;
	}
	public void updateDataFromState(String screenId, String widId, int state, String searchCriteriaScreen, String search1, String search2, String search3, String search5, String search6, String result, String address1_, String address2_, String businessdescription1_, String businessdescription2_, String companyoverview_, Map<String, Map<String, Object>> businessCardManagement) {
		Map<String, Map<String, Object>> temp_if0;
		if ((state==0)) {
			Map<String, Object> temp_json92 = new HashMap<>();
			temp_json92.put("address1", text);
			temp_json92.put("address2", text);
			temp_json92.put("businessDescription1", text);
			temp_json92.put("businessDescription2", text);
			temp_json92.put("companyOverview", text);
			Map<String, Map<String, Object>> temp_search0 = new HashMap<>();
			for (String key: businessCardManagement.keySet()) {
				boolean isMatch = true;
				for (String qKey: temp_json92.keySet()) {
					Map<String, Object> value = businessCardManagement.get(key);
					for (String valKey: value.keySet()) {
						if (valKey.equals(qKey)) {
							if (value.get(valKey).equals(temp_json92.get(qKey))) {
								isMatch = false;
							}
							break;
						}
					}
					if (!isMatch) break;
				}
				if (isMatch) {
					temp_search0.put(key, businessCardManagement.get(key));
				}
			}
			temp_if0 = temp_search0;
		} else {
			temp_if0 = this.data;
		}
		this.data = temp_if0;
		this.presenter.setTable(screenId, widId, temp_if0);
	}
	public void textEvent(String wid, String nextText) {
		this.text = nextText;
	}
	public void mouseEvent(String wid, int nextState) {
		this.state = nextState;
		this.widget = screenTemplates.getScreenTemplate(curScreen.getValue()).getWidgets1().getWidget1(wid);
		this.widget.updateStateFromState(wid, wid, wid, this.state, curScreen.getValue());
	}
	public void setCurScreen(CurScreen curScreen) {
		this.curScreen = curScreen;
	}
}