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"); }
private void removeItem() { if (consumedItem != null) { view.setImageUrl(""); fireItemReturnedEvent(consumedItem); consumedItem = null; ValueChangedEvent valueEvent = new ValueChangedEvent(model.getId(), "", "", "0"); playerServices.getEventBus().fireEvent(valueEvent); } }
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); } }
@Override public void reset() { readyToDraggableItem = null; consumedItem = null; view.setImageUrl(""); view.setDisabled(model.isDisabled()); if (model.isVisible()) { view.show(); } else { view.hide(); } }
@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"))); } }
private void setCorrectImage() { String[] answers = model.getAnswerId().split(";"); ImageSourcePresenter igp = (ImageSourcePresenter) playerServices.getModule(answers[0]); view.setImageUrl(igp.getImageUrl()); }