public ItemWidget(ObjectBean object) { setStyleName(PlayerStyles.OBJECT_IN_BAG); this.object = object; SourcesMouseEvents widget; if (object.getIcon()==null) { getElement().getStyle().setDisplay(model.getSettings().isVerticalObjects() ? Display.BLOCK : Display.INLINE_BLOCK); setTitle(AppLocale.getAppConstants().playerClickToUse()); text = new Label(); if (model.getSettings().isVerticalObjects()) { text.setText(object.getName()); text.setWordWrap(false); } else { text.setText(object.getName()+","); } widget = text; add(text); } else { getElement().getStyle().setDisplay(Display.INLINE_BLOCK); setTitle(object.getName()); image = new Image(); image.addLoadHandler(this); if (object.getIcon().getBigUrl()==null) { image.setUrl(object.getIcon().getUrl() ); } else { big = true; image.setUrl(object.getIcon().getBigUrl()); } add(image); widget = image; } if (model.getSettings().isHiddenUsingObjects()) { addStyleName(PlayerStyles.CLICKABLE); widget.addMouseListener(this); } animationTimer.add(this); }
public void makeDraggable(SourcesMouseEvents w, boolean revert) { Draggable d = new Draggable(); d.widget = (Widget) w; d.listener = new DragSupportListener((Widget) w, revert); w.addMouseListener(d.listener); draggables.put(d.widget, d); }
public DragControl(Widget dragWidget, SourcesMouseEvents drag) { drag.addMouseListener(this); this.dragWidget = dragWidget; }
public void addDragListener(SourcesMouseEvents w, DragListener l) { Draggable d = this.draggables.get((Widget) w); d.listeners.add(l); }
public void removeDragListener(SourcesMouseEvents w, DragListener l) { Draggable d = this.draggables.get((Widget) w); d.listeners.remove(l); }
public void removeDraggable(SourcesMouseEvents w) { Draggable d = this.draggables.get((Widget) w); w.removeMouseListener(d.listener); this.draggables.remove(d.widget); }
public void removeDropListeners(SourcesMouseEvents w, DropListener dl) { List<DropListener> listeners = (dropListeners.get((Widget) w) != null) ? dropListeners.get((Widget) w) : new ArrayList<DropListener>(); listeners.remove(dl); }