本文整理汇总了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);
}
}
}
示例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);
}
}
}