com.vaadin.event.dd.acceptcriteria.AcceptCriterion Java Examples

The following examples show how to use com.vaadin.event.dd.acceptcriteria.AcceptCriterion. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractTable.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
private DropHandler getTableDropHandler() {
    return new DropHandler() {
        private static final long serialVersionUID = 1L;

        @Override
        public AcceptCriterion getAcceptCriterion() {
            return getDropAcceptCriterion();
        }

        @Override
        public void drop(final DragAndDropEvent event) {
            if (!isDropValid(event)) {
                return;
            }
            if (event.getTransferable().getSourceComponent() instanceof Table) {
                onDropEventFromTable(event);
            } else if (event.getTransferable().getSourceComponent() instanceof DragAndDropWrapper) {
                onDropEventFromWrapper(event);
            }
        }
    };
}
 
Example #2
Source File: DSTypeFilterButtons.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected DropHandler getFilterButtonDropHandler() {

    return new DropHandler() {
        private static final long serialVersionUID = 1L;

        @Override
        public AcceptCriterion getAcceptCriterion() {
            return distributionsViewClientCriterion;
        }

        @Override
        public void drop(final DragAndDropEvent event) {
            /* Not required */
        }
    };
}
 
Example #3
Source File: DistSMTypeFilterButtons.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected DropHandler getFilterButtonDropHandler() {

    return new DropHandler() {
        private static final long serialVersionUID = 1L;

        @Override
        public AcceptCriterion getAcceptCriterion() {
            return distributionsViewClientCriterion;
        }

        @Override
        public void drop(final DragAndDropEvent event) {
            /* Not required */
        }
    };
}
 
Example #4
Source File: SMTypeFilterButtons.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected DropHandler getFilterButtonDropHandler() {
    return new DropHandler() {
        private static final long serialVersionUID = 1L;

        @Override
        public AcceptCriterion getAcceptCriterion() {
            return uploadViewClientCriterion;
        }

        @Override
        public void drop(final DragAndDropEvent event) {
            /* Not required */
        }
    };
}
 
Example #5
Source File: TargetTagFilterButtons.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected DropHandler getFilterButtonDropHandler() {

    return new DropHandler() {
        private static final long serialVersionUID = 1L;

        @Override
        public AcceptCriterion getAcceptCriterion() {
            return managementViewClientCriterion;
        }

        @Override
        public void drop(final DragAndDropEvent event) {
            if (validate(event) && isNoTagAssigned(event)) {
                final TableTransferable tbl = (TableTransferable) event.getTransferable();
                final Table source = tbl.getSourceComponent();
                if (source.getId().equals(UIComponentIdProvider.TARGET_TABLE_ID)) {
                    UI.getCurrent().access(() -> processTargetDrop(event));
                }
            }
        }
    };
}
 
Example #6
Source File: TargetTableHeader.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected DropHandler getDropFilterHandler() {
    return new DropHandler() {
        /**
         *
         */
        private static final long serialVersionUID = 1L;

        @Override
        public void drop(final DragAndDropEvent event) {
            filterByDroppedDist(event);
        }

        @Override
        public AcceptCriterion getAcceptCriterion() {
            return managementViewClientCriterion;
        }

    };
}
 
Example #7
Source File: DefaultFormLayoutDropHandler.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public AcceptCriterion getAcceptCriterion() {
    TargetDetailIs isOverEmptyLayout = new TargetDetailIs(
            Constants.DROP_DETAIL_TO, "-1");
    return new Or(isOverEmptyLayout, VerticalLocationIs.TOP,
            VerticalLocationIs.BOTTOM);
}
 
Example #8
Source File: TreeToolEditor.java    From chipster with MIT License 4 votes vote down vote up
private void initTree() {
	this.setSizeFull();
	this.setImmediate(true);
	this.setSelectable(true);
	this.addItemClickListener(this);
	this.addContainerProperty("", String.class, null);
	this.addContainerProperty(ACTIONS, HorizontalLayout.class, null	);
	this.addItem(new Object[] {TOOL, getActionLayout(false, false, TOOL)}, TOOL);
	this.setItemDescriptionGenerator(new ItemDescriptionGenerator() {
		private static final long serialVersionUID = -1913286695570843896L;

		@Override
		public String generateDescription(Component source, Object itemId,
				Object propertyId) {
			String description = "Show all ";
			if(itemId.equals(TOOL))
				description += "elements";
			else if (itemId.equals(INPUTS))
				description += "inputs";
			else if (itemId.equals(OUTPUTS))
				description += "outputs";
			else if (itemId.equals(PARAMETERS))
				description += "parameters";
			else
				return null;
			return description;
		}
	});
	this.setCollapsed(TOOL, false);
	String[] rootToolElements = new String[] {INPUTS, OUTPUTS, PARAMETERS};
	for(String element : rootToolElements) {
		this.addItem(new Object[] {element, getActionLayout(true, false, element)}, element);
		this.setParent(element, TOOL);
		this.setCollapsed(element, false);
	}
	this.setDragMode(TableDragMode.ROW);
	this.setDropHandler(new DropHandler() {
		private static final long serialVersionUID = -4415321436294383112L;

		@Override
		public AcceptCriterion getAcceptCriterion() {
			return new Or(Tree.TargetItemAllowsChildren.get(), new Not(VerticalLocationIs.MIDDLE));
		}
		
		@Override
		public void drop(DragAndDropEvent event) {
            final Transferable t = event.getTransferable();
            if (t.getSourceComponent() != TreeToolEditor.this
                    || !(t instanceof DataBoundTransferable)) {
                return;
            }

            final AbstractSelectTargetDetails dropData = ((AbstractSelectTargetDetails) event.getTargetDetails());

            final Object sourceItemId = ((DataBoundTransferable) t).getItemId();
            final Object targetItemId = dropData.getItemIdOver();
            final VerticalDropLocation location = dropData.getDropLocation();

            moveNode(sourceItemId, targetItemId, location);
		}
	});

}
 
Example #9
Source File: AbstractDefaultLayoutDropHandler.java    From cuba with Apache License 2.0 4 votes vote down vote up
public AcceptCriterion getAcceptCriterion() {
    return AcceptAll.get();
}
 
Example #10
Source File: PolicyWorkspace.java    From XACML with MIT License 4 votes vote down vote up
@Override
public AcceptCriterion getAcceptCriterion() {
       return AcceptAll.get();
}
 
Example #11
Source File: MultiFileUpload.java    From mycollab with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public AcceptCriterion getAcceptCriterion() {
    return AcceptAll.get();
}
 
Example #12
Source File: SwModuleTable.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected AcceptCriterion getDropAcceptCriterion() {
    return distributionsViewClientCriterion;
}
 
Example #13
Source File: DistributionSetTable.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public AcceptCriterion getDropAcceptCriterion() {
    return distributionsViewClientCriterion;
}
 
Example #14
Source File: TargetTable.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public AcceptCriterion getDropAcceptCriterion() {
    return managementViewClientCriterion;
}
 
Example #15
Source File: DistributionTable.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public AcceptCriterion getDropAcceptCriterion() {
    return managementViewClientCriterion;
}
 
Example #16
Source File: SoftwareModuleTable.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected AcceptCriterion getDropAcceptCriterion() {
    return uploadViewClientCriterion;
}
 
Example #17
Source File: UploadDropAreaLayout.java    From hawkbit with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public AcceptCriterion getAcceptCriterion() {
    return acceptAllExceptBlacklisted;
}
 
Example #18
Source File: DefaultAccordionDropHandler.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public AcceptCriterion getAcceptCriterion() {
    return new Not(VerticalLocationIs.MIDDLE);
}
 
Example #19
Source File: DefaultVerticalSplitPanelDropHandler.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public AcceptCriterion getAcceptCriterion() {
    // Only allow dropping in slots, not on the center bar
    return new Not(VerticalLocationIs.MIDDLE);
}
 
Example #20
Source File: DefaultTabSheetDropHandler.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public AcceptCriterion getAcceptCriterion() {
    // Only allow drops between tabs
    return new Not(HorizontalLocationIs.CENTER);
}
 
Example #21
Source File: DefaultHorizontalSplitPanelDropHandler.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public AcceptCriterion getAcceptCriterion() {
    // Only allow dropping in slots, not on the center bar
    return new Not(HorizontalLocationIs.CENTER);
}
 
Example #22
Source File: DistributionTagDropEvent.java    From hawkbit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Criteria.
 *
 * @return AcceptCriterion as accept
 */
@Override
public AcceptCriterion getAcceptCriterion() {
    return managementViewClientCriterion;
}
 
Example #23
Source File: AbstractTable.java    From hawkbit with Eclipse Public License 1.0 votes vote down vote up
protected abstract AcceptCriterion getDropAcceptCriterion();