List of usage examples for com.vaadin.event.dd.acceptcriteria TargetDetailIs TargetDetailIs
public TargetDetailIs(String dataFlavor, Boolean true1)
From source file:com.haulmont.cuba.web.widgets.addons.dragdroplayouts.drophandlers.DefaultFormLayoutDropHandler.java
License:Apache License
@Override public AcceptCriterion getAcceptCriterion() { TargetDetailIs isOverEmptyLayout = new TargetDetailIs(Constants.DROP_DETAIL_TO, "-1"); return new Or(isOverEmptyLayout, VerticalLocationIs.TOP, VerticalLocationIs.BOTTOM); }
From source file:com.liferay.mail.vaadin.FolderTree.java
License:Open Source License
public AcceptCriterion getAcceptCriterion() { TargetDetailIs isMiddle = new TargetDetailIs("detail", "MIDDLE"); SourceIs isFromMessageList = new SourceIs(messageList.getTable()); List<TargetItemIs> rootItemCriterias = new ArrayList<TargetItemIs>(); for (Object root : rootItemIds()) { rootItemCriterias.add(new TargetItemIs(this, root)); }//from w w w . j a v a 2s . c o m Or or = new Or(rootItemCriterias.toArray(new TargetItemIs[rootItemCriterias.size()])); Not notRootItem = new Not(or); return new And(isMiddle, isFromMessageList, notRootItem); }
From source file:info.magnolia.ui.admincentral.shellapp.favorites.GroupDragAndDropWrapper.java
License:Open Source License
@Override protected void init() { setDragStartMode(DragStartMode.WRAPPER); setSizeUndefined();/*from w w w . j a v a2s .c om*/ setDropHandler(new DropHandler() { @Override public void drop(DragAndDropEvent event) { AbstractFavoritesDragAndDropWrapper droppedComponent = (AbstractFavoritesDragAndDropWrapper) event .getTransferable().getSourceComponent(); if (droppedComponent.getWrappedComponent() instanceof FavoritesEntry) { String favoritePath = ((FavoritesEntry) ((EntryDragAndDropWrapper) event.getTransferable() .getSourceComponent()).getWrappedComponent()).getRelPath(); getListener().moveFavorite(favoritePath, group.getRelPath()); } else if (droppedComponent.getWrappedComponent() instanceof FavoritesGroup) { String groupToMove = ((FavoritesGroup) droppedComponent.getWrappedComponent()).getRelPath(); WrapperTransferable transferable = (WrapperTransferable) event.getTransferable(); WrapperTargetDetails details = (WrapperTargetDetails) event.getTargetDetails(); String verticalDropLocation = (String) details.getData("verticalLocation"); boolean isDragDown = (details.getMouseEvent().getClientY() - transferable.getMouseDownEvent().getClientY()) > 0; if (isDragDown && (verticalDropLocation.equals(VerticalDropLocation.BOTTOM.name()) || verticalDropLocation.equals(VerticalDropLocation.MIDDLE.name()))) { getListener().orderGroupAfter(groupToMove, group.getRelPath()); } else if (!isDragDown && (verticalDropLocation.equals(VerticalDropLocation.TOP.name()) || verticalDropLocation.equals(VerticalDropLocation.MIDDLE.name()))) { getListener().orderGroupBefore(groupToMove, group.getRelPath()); } } else { log.warn("Trying to drop neither entry nor group on a group."); } } @Override public AcceptCriterion getAcceptCriterion() { return new And(new TargetDetailIs("verticalLocation", VerticalDropLocation.MIDDLE.name()), new TargetDetailIs("horizontalLocation", HorizontalDropLocation.CENTER.name())); } }); }