示例#1
0
	private void setGapAnswer(int index, String value) {
		isSetGapAnswers = true;
		ImageSourcePresenter igp = (ImageSourcePresenter) playerServices.getModule(value.replaceAll("\"", ""));
		view.setImageUrl(igp.getImageUrl());
		view.resetStyles();
		view.setDisabled(true);
		view.showCorrectAnswers();
		view.removeClass("ui-state-disabled");
	}
示例#2
0
	private void removeItem() {
		if (consumedItem != null) {
			view.setImageUrl("");
			fireItemReturnedEvent(consumedItem);
			consumedItem = null;
			ValueChangedEvent valueEvent = new ValueChangedEvent(model.getId(), "", "", "0");
			playerServices.getEventBus().fireEvent(valueEvent);
		}
	}
示例#3
0
	private void insertItem() {
		if (readyToDraggableItem != null) {
			view.setImageUrl(readyToDraggableItem.getValue());
			consumedItem = readyToDraggableItem;
			fireItemConsumedEvent();
			String score = Integer.toString(getScore());
			ValueChangedEvent valueEvent = new ValueChangedEvent(model.getId(), "", consumedItem.getId(), score);
			playerServices.getEventBus().fireEvent(valueEvent);
			view.makeDraggable(this);
		}
	}
示例#4
0
	@Override
	public void reset() {
		readyToDraggableItem = null;
		consumedItem = null;
		view.setImageUrl("");
		view.setDisabled(model.isDisabled());

		if (model.isVisible()) {
			view.show();
		} else {
			view.hide();
		}
	}
示例#5
0
	@Override
	public void setState(String stateObj) {
		IJsonServices json = playerServices.getJsonServices();
		HashMap<String, String> state = json.decodeHashMap(stateObj);
		if (state.containsKey("consumed")) {
			consumedItem = DraggableItem.createFromString(state.get("consumed"));
			view.setImageUrl(getImageURL(consumedItem));
			view.makeDraggable(this);
		}
		if (state.containsKey("isVisible")) {
			if (Boolean.parseBoolean(state.get("isVisible"))) {
				show();
			} else {
				hide();
			}
		}

		if (state.containsKey("isDisabled")) {
			view.setDisabled(Boolean.parseBoolean(state.get("isDisabled")));
		}
	}
示例#6
0
	private void setCorrectImage() {
		String[] answers = model.getAnswerId().split(";");
		ImageSourcePresenter igp = (ImageSourcePresenter) playerServices.getModule(answers[0]);
		view.setImageUrl(igp.getImageUrl());
	}