当前位置: 首页>>代码示例>>Java>>正文


Java DragAndDropEvent.getTransferable方法代码示例

本文整理汇总了Java中com.vaadin.event.dd.DragAndDropEvent.getTransferable方法的典型用法代码示例。如果您正苦于以下问题:Java DragAndDropEvent.getTransferable方法的具体用法?Java DragAndDropEvent.getTransferable怎么用?Java DragAndDropEvent.getTransferable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vaadin.event.dd.DragAndDropEvent的用法示例。


在下文中一共展示了DragAndDropEvent.getTransferable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFilterButtonDropHandler

import com.vaadin.event.dd.DragAndDropEvent; //导入方法依赖的package包/类
@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));
                }
            }
        }
    };
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:24,代码来源:TargetTagFilterButtons.java

示例2: drop

import com.vaadin.event.dd.DragAndDropEvent; //导入方法依赖的package包/类
@Override
public void drop(DragAndDropEvent event) {
    WrapperTransferable transfrable = (WrapperTransferable) event.getTransferable();
    WrapperTargetDetails details = (WrapperTargetDetails) event.getTargetDetails();
    System.out.println("transfrable " + transfrable.getClass().getCanonicalName());
    System.out.println("transfrable.getDraggedComponent() " + transfrable.getDraggedComponent().getClass().getCanonicalName());
    if (transfrable.getDraggedComponent() instanceof Button) {
        // Calculate the drag coordinate difference
        int xChange = details.getMouseEvent().getClientX() - transfrable.getMouseDownEvent().getClientX();
        int yChange = details.getMouseEvent().getClientY() - transfrable.getMouseDownEvent().getClientY();

        // Move the component in the absolute layout
        AbsoluteLayout.ComponentPosition componentPosition = processModelLayout.getPosition(transfrable.getSourceComponent());
        componentPosition.setLeftValue(componentPosition.getLeftValue() + xChange);
        componentPosition.setTopValue(componentPosition.getTopValue() + yChange);

        ElementModelLayout elementModelLayout = (ElementModelLayout) ((Button) transfrable.getDraggedComponent()).getParent();
        TaskModel elementModel = elementModelLayout.getTaskModel();
        elementModel.setX(componentPosition.getLeftValue());
        elementModel.setY(componentPosition.getTopValue());
        processModel.getTaskModels().put(elementModel.getId(), elementModel);
        transitionManager.setValue(processModel.getTaskModels(), processModel.getTransitionModels());
        setTaskActive(elementModel);
    }
}
 
开发者ID:hybridbpm,项目名称:hybridbpm,代码行数:26,代码来源:ProcessModelLayout.java

示例3: validate

import com.vaadin.event.dd.DragAndDropEvent; //导入方法依赖的package包/类
/**
 * Validate the drop.
 *
 * @param event
 *            DragAndDropEvent reference
 * @return Boolean
 */
private Boolean validate(final DragAndDropEvent event) {
    final Transferable transferable = event.getTransferable();
    final Component compsource = transferable.getSourceComponent();
    if (!(compsource instanceof AbstractTable)) {
        notification.displayValidationError(i18n.getMessage(SPUILabelDefinitions.ACTION_NOT_ALLOWED));
        return false;
    }

    final TableTransferable tabletransferable = (TableTransferable) transferable;

    final AbstractTable<?> source = (AbstractTable<?>) tabletransferable.getSourceComponent();

    if (!validateIfSourceisTargetTable(source) && !checkForTargetUpdatePermission()) {
        return false;
    }

    final Set<Long> deletedEntityByTransferable = source.getDeletedEntityByTransferable(tabletransferable);
    if (deletedEntityByTransferable.isEmpty()) {
        final String actionDidNotWork = i18n.getMessage("message.action.did.not.work", new Object[] {});
        notification.displayValidationError(actionDidNotWork);
        return false;
    }

    return true;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:33,代码来源:TargetTagFilterButtons.java

示例4: filterByDroppedDist

import com.vaadin.event.dd.DragAndDropEvent; //导入方法依赖的package包/类
private void filterByDroppedDist(final DragAndDropEvent event) {
    if (doValidations(event)) {
        final TableTransferable tableTransferable = (TableTransferable) event.getTransferable();
        final Table source = tableTransferable.getSourceComponent();
        if (!UIComponentIdProvider.DIST_TABLE_ID.equals(source.getId())) {
            return;
        }
        final Set<Long> distributionIdSet = getDropppedDistributionDetails(tableTransferable);
        if (CollectionUtils.isEmpty(distributionIdSet)) {
            return;
        }
        final Long distributionSetId = distributionIdSet.iterator().next();
        final Optional<DistributionSet> distributionSet = distributionSetManagement
                .get(distributionSetId);
        if (!distributionSet.isPresent()) {
            notification.displayWarning(i18n.getMessage("distributionset.not.exists"));
            return;
        }
        final DistributionSetIdName distributionSetIdName = new DistributionSetIdName(distributionSet.get());
        getManagementUIState().getTargetTableFilters().setDistributionSet(distributionSetIdName);
        addFilterTextField(distributionSetIdName);
    }
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:24,代码来源:TargetTableHeader.java

示例5: doValidations

import com.vaadin.event.dd.DragAndDropEvent; //导入方法依赖的package包/类
/**
 * Validation for drag event.
 *
 * @param dragEvent
 * @return
 */
private Boolean doValidations(final DragAndDropEvent dragEvent) {
    final Component compsource = dragEvent.getTransferable().getSourceComponent();
    Boolean isValid = Boolean.TRUE;
    if (compsource instanceof Table && !isComplexFilterViewDisplayed) {
        final TableTransferable transferable = (TableTransferable) dragEvent.getTransferable();
        final Table source = transferable.getSourceComponent();

        if (!source.getId().equals(UIComponentIdProvider.DIST_TABLE_ID)) {
            notification.displayValidationError(i18n.getMessage("message.action.not.allowed"));
            isValid = Boolean.FALSE;
        } else {
            if (getDropppedDistributionDetails(transferable).size() > 1) {
                notification.displayValidationError(i18n.getMessage("message.onlyone.distribution.dropallowed"));
                isValid = Boolean.FALSE;
            }
        }
    } else {
        notification.displayValidationError(i18n.getMessage("message.action.not.allowed"));
        isValid = Boolean.FALSE;
    }
    return isValid;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:29,代码来源:TargetTableHeader.java

示例6: processDistributionDrop

import com.vaadin.event.dd.DragAndDropEvent; //导入方法依赖的package包/类
private void processDistributionDrop(final DragAndDropEvent event) {

        final com.vaadin.event.dd.TargetDetails targetDetails = event.getTargetDetails();

        final TableTransferable transferable = (TableTransferable) event.getTransferable();
        final AbstractTable<?> source = (AbstractTable<?>) transferable.getSourceComponent();

        final Set<Long> distSelected = source.getDeletedEntityByTransferable(transferable);

        final String distTagName = HawkbitCommonUtil.removePrefix(targetDetails.getTarget().getId(),
                SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS);

        final List<String> tagsClickedList = distFilterParameters.getDistSetTags();
        final DistributionSetTagAssignmentResult result = distributionSetManagement.toggleTagAssignment(distSelected,
                distTagName);

        notification.displaySuccess(HawkbitCommonUtil.createAssignmentMessage(distTagName, result, i18n));
        if (result.getUnassigned() >= 1 && !tagsClickedList.isEmpty()) {
            eventBus.publish(this, TargetFilterEvent.FILTER_BY_TAG);
        }
    }
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:22,代码来源:DistributionTagDropEvent.java

示例7: isDropValid

import com.vaadin.event.dd.DragAndDropEvent; //导入方法依赖的package包/类
protected boolean isDropValid(final DragAndDropEvent dragEvent) {
    final Transferable transferable = dragEvent.getTransferable();
    final Component compsource = transferable.getSourceComponent();

    if (!hasDropPermission()) {
        notification.displayValidationError(i18n.getMessage("message.permission.insufficient"));
        return false;
    }

    if (compsource instanceof Table) {
        return validateTable((Table) compsource)
                && validateDropList(getDraggedTargetList((TableTransferable) transferable, (Table) compsource));
    }

    if (compsource instanceof DragAndDropWrapper) {
        return validateDragAndDropWrapper((DragAndDropWrapper) compsource)
                && validateDropList(getDraggedTargetList(dragEvent));
    }
    notification.displayValidationError(i18n.getMessage(ACTION_NOT_ALLOWED_MSG));
    return false;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:22,代码来源:AbstractTable.java

示例8: drop

import com.vaadin.event.dd.DragAndDropEvent; //导入方法依赖的package包/类
@Override
public void drop(DragAndDropEvent event) {
	final Transferable t = event.getTransferable();
	AbstractSelect.AbstractSelectTargetDetails dropData = ((AbstractSelect.AbstractSelectTargetDetails) event.getTargetDetails());
	Object sourceItemId = ((DataBoundTransferable) t).getItemId();
	Object targetItemId = dropData.getItemIdOver();
	VerticalDropLocation location = dropData.getDropLocation();
	
	Item sourceItem = tree.getItem(sourceItemId);
	NavNode sourceNode = (NavNode) sourceItem.getItemProperty("object").getValue();

	Item targetItem = tree.getItem(targetItemId);
	NavNode targetNode = (NavNode) targetItem.getItemProperty("object").getValue();
	
	NavigationView.this.move(sourceNode, targetNode, location);
	// Sorting goes as
          // - If dropped ON (MIDDLE) a node, we preppend it as a child
          // - If dropped on the TOP part of a node, we move/add it before the node
          // - If dropped on the BOTTOM part of a node, we move/add it after the node if it has no children, or prepend it as a child if it has children
}
 
开发者ID:mhus,项目名称:cherry-web,代码行数:21,代码来源:NavigationView.java

示例9: drop

import com.vaadin.event.dd.DragAndDropEvent; //导入方法依赖的package包/类
public void drop(DragAndDropEvent event) {
    AbstractSelectTargetDetails targetDetails = (AbstractSelectTargetDetails) event.getTargetDetails();
    Transferable transferable = event.getTransferable();
    if (transferable.getSourceComponent() == table) {
        FlowParameter target = (FlowParameter) targetDetails.getItemIdOver();
        int targetIndex = container.indexOfId(target);
        FlowParameter source = (FlowParameter) transferable.getData("itemId");
        if (targetIndex == -1) {
            targetIndex = 0;
        }
        container.removeItem(source);
        container.addItemAt(targetIndex, source);
        table.select(source);
        saveAllPositions();
    }
}
 
开发者ID:JumpMind,项目名称:metl,代码行数:17,代码来源:EditFlowSettingsDialog.java

示例10: isFilesDropped

import com.vaadin.event.dd.DragAndDropEvent; //导入方法依赖的package包/类
private boolean isFilesDropped(final DragAndDropEvent event) {
    if (event.getTransferable() instanceof WrapperTransferable) {
        final Html5File[] files = ((WrapperTransferable) event.getTransferable()).getFiles();
        return files != null;
    }
    return false;
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:8,代码来源:UploadLayout.java

示例11: assignTargetToDs

import com.vaadin.event.dd.DragAndDropEvent; //导入方法依赖的package包/类
private void assignTargetToDs(final DragAndDropEvent event) {
    final TableTransferable transferable = (TableTransferable) event.getTransferable();
    final TargetTable targetTable = (TargetTable) transferable.getSourceComponent();
    final Set<Long> targetIdSet = targetTable.getDeletedEntityByTransferable(transferable);

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

    final Object distItemId = dropData.getItemIdOver();
    assignTargetToDs(getItem(distItemId), targetManagement.get(targetIdSet));

}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:12,代码来源:DistributionTable.java

示例12: dsToTargetAssignment

import com.vaadin.event.dd.DragAndDropEvent; //导入方法依赖的package包/类
private void dsToTargetAssignment(final DragAndDropEvent event) {
    final TableTransferable transferable = (TableTransferable) event.getTransferable();
    final AbstractTable<?> source = (AbstractTable<?>) transferable.getSourceComponent();
    final Set<Long> ids = source.getDeletedEntityByTransferable(transferable);
    final AbstractSelectTargetDetails dropData = (AbstractSelectTargetDetails) event.getTargetDetails();
    final Object targetItemId = dropData.getItemIdOver();
    LOG.debug("Adding a log to check if targetItemId is null : {} ", targetItemId);
    if (targetItemId == null) {
        getNotification().displayWarning(i18n.getMessage("target.not.exists", new Object[] { "" }));
        return;
    }
    final Long targetId = (Long) targetItemId;
    final Optional<Target> target = targetManagement.get(targetId);
    if (!target.isPresent()) {
        getNotification().displayWarning(i18n.getMessage("target.not.exists", new Object[] { "" }));
        return;
    }
    final TargetIdName createTargetIdName = new TargetIdName(target.get());

    final List<DistributionSet> findDistributionSetAllById = distributionSetManagement.get(ids);

    if (findDistributionSetAllById.isEmpty()) {
        notification.displayWarning(i18n.getMessage("distributionsets.not.exists"));
        return;
    }

    addNewTargetToAssignmentList(createTargetIdName, findDistributionSetAllById);
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:29,代码来源:TargetTable.java

示例13: drop

import com.vaadin.event.dd.DragAndDropEvent; //导入方法依赖的package包/类
@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.DIST_TABLE_ID)) {
            processDistributionDrop(event);
        }

    }
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:13,代码来源:DistributionTagDropEvent.java

示例14: onDropEventFromTable

import com.vaadin.event.dd.DragAndDropEvent; //导入方法依赖的package包/类
@Override
protected void onDropEventFromTable(final DragAndDropEvent event) {
    final TableTransferable transferable = (TableTransferable) event.getTransferable();
    final AbstractTable<?> source = (AbstractTable<?>) transferable.getSourceComponent();
    final Set<Long> softwareModulesIdList = source.getDeletedEntityByTransferable(transferable);

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

    final Object distItemId = dropData.getItemIdOver();
    handleDropEvent(source, softwareModulesIdList, distItemId);
}
 
开发者ID:eclipse,项目名称:hawkbit,代码行数:12,代码来源:DistributionSetTable.java

示例15: drop

import com.vaadin.event.dd.DragAndDropEvent; //导入方法依赖的package包/类
public void drop(DragAndDropEvent event) {
    AbstractSelectTargetDetails targetDetails = (AbstractSelectTargetDetails) event.getTargetDetails();
    Transferable transferable = event.getTransferable();
    if (transferable.getSourceComponent() == entityTable) {
        EntitySettings target = (EntitySettings) targetDetails.getItemIdOver();
        moveItemsTo(getSelectedItems(), entitySettingsContainer.indexOfId(target));
    }
}
 
开发者ID:JumpMind,项目名称:metl,代码行数:9,代码来源:EditDeduperPanel.java


注:本文中的com.vaadin.event.dd.DragAndDropEvent.getTransferable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。