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


Java DockDragEvent类代码示例

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


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

示例1: scanDrop

import com.vlsolutions.swing.docking.event.DockDragEvent; //导入依赖的package包/类
@Override
protected void scanDrop(DockEvent event, boolean drop) {
	if (getParent() instanceof TabbedDockableContainer) {
		if (drop) {
			((DockDropEvent) event).rejectDrop();
		} else {
			((DockDragEvent) event).delegateDrag();
		}
		return;
	}
	if (event.getDragSource().getDockable() == dockable) {
		if (drop) {
			((DockDropEvent) event).rejectDrop();
		} else {
			((DockDragEvent) event).rejectDrag();
		}
		return;
	}
	if (event.getDragSource().getDockableContainer() instanceof TabbedDockableContainer) {
		if (drop) {
			((DockDropEvent) event).rejectDrop();
		} else {
			((DockDragEvent) event).rejectDrag();
		}
		return;
	}
	Rectangle bounds = getBounds();
	DockGroup sourceGroup = event.getDragSource().getDockable().getDockKey().getDockGroup();
	DockGroup destinationGroup = dockable.getDockKey().getDockGroup();
	if (!DockGroup.areGroupsCompatible(destinationGroup, sourceGroup)) {
		if (drop) {
			((DockDropEvent) event).rejectDrop();
		} else {
			((DockDragEvent) event).rejectDrag();
		}
		return;
	}
	Dockable sourceDockable = event.getDragSource().getDockable();
	DockableState.Location dockableLocation = sourceDockable.getDockKey().getLocation();
	DockableState.Location viewLocation = dockable.getDockKey().getLocation();
	if (drop) {
		event.setDockingAction(new DockingActionCreateTabEvent(event.getDesktop(), sourceDockable, dockableLocation,
				viewLocation, dockable, 0));
		((DockDropEvent) event).acceptDrop(false);
		desktop.createTab(dockable, event.getDragSource().getDockable(), 0, true);
	} else {
		Rectangle2D r2d = new Rectangle2D.Float(bounds.x, bounds.y, bounds.width, bounds.height);
		event.setDockingAction(new DockingActionCreateTabEvent(event.getDesktop(), sourceDockable, dockableLocation,
				viewLocation, dockable, 0));
		if (r2d.equals(lastDropShape)) {
			((DockDragEvent) event).acceptDrag(lastDropGeneralPath);
		} else {
			GeneralPath path = buildPathForTab(bounds);
			;
			lastDropShape = r2d;
			lastDropGeneralPath = path;
			((DockDragEvent) event).acceptDrag(lastDropGeneralPath);
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:61,代码来源:DetachedDockViewAsTab.java

示例2: scanDrop

import com.vlsolutions.swing.docking.event.DockDragEvent; //导入依赖的package包/类
@Override
protected void scanDrop(DockEvent event, boolean drop){
	if (getParent() instanceof TabbedDockableContainer){
		if (drop){
			((DockDropEvent) event).rejectDrop();
		} else {
			((DockDragEvent) event).delegateDrag();
		}
		return;
	}
	if (event.getDragSource().getDockable() == dockable) {
		if (drop){
			((DockDropEvent) event).rejectDrop();
		} else {
			((DockDragEvent) event).rejectDrag();
		}
		return;
	}
	if (event.getDragSource().getDockableContainer() instanceof TabbedDockableContainer) {
		if (drop){
			((DockDropEvent) event).rejectDrop();
		} else {
			((DockDragEvent) event).rejectDrag();
		}
		return;
	}
	Rectangle bounds = getBounds();
	DockGroup sourceGroup = event.getDragSource().getDockable().getDockKey().getDockGroup();
	DockGroup destinationGroup = dockable.getDockKey().getDockGroup();
	if (!DockGroup.areGroupsCompatible(destinationGroup, sourceGroup)){
		if (drop){
			((DockDropEvent) event).rejectDrop();
		} else {
			((DockDragEvent) event).rejectDrag();
		}
		return;
	}
	Dockable sourceDockable = event.getDragSource().getDockable();
	DockableState.Location dockableLocation = sourceDockable.getDockKey().getLocation();
	DockableState.Location viewLocation = dockable.getDockKey().getLocation();
	if (drop){
		event.setDockingAction(new DockingActionCreateTabEvent(event.getDesktop(), sourceDockable, dockableLocation, viewLocation, dockable, 0));
		((DockDropEvent) event).acceptDrop(false);
		desktop.createTab(dockable, event.getDragSource().getDockable(), 0, true);
	} else {
		Rectangle2D r2d = new Rectangle2D.Float(bounds.x, bounds.y, bounds.width, bounds.height);
		event.setDockingAction(new DockingActionCreateTabEvent(event.getDesktop(), sourceDockable, dockableLocation, viewLocation, dockable, 0));
		if (r2d.equals(lastDropShape)) {
			((DockDragEvent) event).acceptDrag(lastDropGeneralPath);
		} else {
			GeneralPath path = buildPathForTab(bounds);;
			lastDropShape = r2d;
			lastDropGeneralPath = path;
			((DockDragEvent) event).acceptDrag(lastDropGeneralPath);
		}
	}    
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:58,代码来源:DetachedDockViewAsTab.java


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