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


Java VerticalDropLocation类代码示例

本文整理汇总了Java中com.vaadin.shared.ui.dd.VerticalDropLocation的典型用法代码示例。如果您正苦于以下问题:Java VerticalDropLocation类的具体用法?Java VerticalDropLocation怎么用?Java VerticalDropLocation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


VerticalDropLocation类属于com.vaadin.shared.ui.dd包,在下文中一共展示了VerticalDropLocation类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drop

import com.vaadin.shared.ui.dd.VerticalDropLocation; //导入依赖的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

示例2: initTree

import com.vaadin.shared.ui.dd.VerticalDropLocation; //导入依赖的package包/类
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);
		}
	});

}
 
开发者ID:chipster,项目名称:chipster,代码行数:64,代码来源:TreeToolEditor.java

示例3: move

import com.vaadin.shared.ui.dd.VerticalDropLocation; //导入依赖的package包/类
public abstract void move(NavNode source, NavNode target, VerticalDropLocation location); 
开发者ID:mhus,项目名称:cherry-web,代码行数:2,代码来源:NavigationView.java


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