public void onAddDetail(final Detail d, boolean fireEvent) { final DetailItem<Detail> di = new DetailItem<Detail>(d); di.getCloseButton() .addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { handleRemoveDetail(di); } }); mDisplay.getContextItemsContainer().add(di); if (fireEvent) { if (mDataModel.getValue().getDetails() == null) mDataModel.getValue().setDetails(new ArrayList<Detail>()); mDataModel.getValue().getDetails().add(d); } }
protected void showMapItemEdit(MapItem mi) { mDisplay.setMapItem(mi); mDisplay.getMenuContent().setOpen(true); mDisplay.getContextItemsContainer().clear(); if (mi.getPros() != null) { for (String s : mi.getPros()) onAddPro(s, false); } if (mi.getCons() != null) { for (String s : mi.getCons()) onAddCon(s, false); } if (mi.getDetails() != null) { for (Detail d : mi.getDetails()) onAddDetail(d, false); } setLeftButton(true, "edit", DrifMaps.Words.Edit()); setRightButton(true, "cancel", DrifMaps.Words.Hide()); }
/** * Called when is created Cons * * @param value */ public void onAddCon(String value, boolean fireEvent) { if (value != null && value.trim().length() != 0) { final ContextItem<String> ci = new ContextItem<String>(); ci.getCloseButton() .addClickHandler( new ClickHandler() { @Override public void onClick(ClickEvent event) { handleRemoveCon(ci); } }); ci.setTextValue(value); ci.setIcon(ContextItem.IconType.Cons); mDisplay.getContextItemsContainer().add(ci); if (fireEvent) { if (mDataModel.getValue().getCons() == null) mDataModel.getValue().setCons(new ArrayList<String>()); mDataModel.getValue().getCons().add(value); } } }
public void onClearContextItems() { mDisplay.getContextItemsContainer().clear(); }
public void onRemoveDetail(final DetailItem<Detail> di) { mDisplay.getContextItemsContainer().remove(di); mDataModel.getValue().getDetails().remove(di.getValue()); }
public void onRemoveCon(final ContextItem<String> ci) { mDisplay.getContextItemsContainer().remove(ci); mDataModel.getValue().getCons().remove(ci.getTextValue()); }