本文整理匯總了Java中com.intellij.uiDesigner.FormEditingUtil.isDropOnChild方法的典型用法代碼示例。如果您正苦於以下問題:Java FormEditingUtil.isDropOnChild方法的具體用法?Java FormEditingUtil.isDropOnChild怎麽用?Java FormEditingUtil.isDropOnChild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.uiDesigner.FormEditingUtil
的用法示例。
在下文中一共展示了FormEditingUtil.isDropOnChild方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: dragOver
import com.intellij.uiDesigner.FormEditingUtil; //導入方法依賴的package包/類
public void dragOver(DropTargetDragEvent dtde) {
try {
if (myComponentDragObject == null) {
dtde.rejectDrag();
return;
}
final int dx = dtde.getLocation().x - myLastPoint.x;
final int dy = dtde.getLocation().y - myLastPoint.y;
if (myDraggedComponentsCopy != null && myDraggedComponentList != null) {
for (RadComponent aMySelection : myDraggedComponentsCopy) {
aMySelection.shift(dx, dy);
}
}
myLastPoint = dtde.getLocation();
myEditor.getDragLayer().repaint();
ComponentDropLocation location = myGridInsertProcessor.processDragEvent(dtde.getLocation(), myComponentDragObject);
ComponentTree componentTree = DesignerToolWindowManager.getInstance(myEditor).getComponentTree();
if (!location.canDrop(myComponentDragObject) ||
(myDraggedComponentList != null && FormEditingUtil.isDropOnChild(myDraggedComponentList, location))) {
if (componentTree != null) {
componentTree.setDropTargetComponent(null);
}
dtde.rejectDrag();
}
else {
if (componentTree != null) {
componentTree.setDropTargetComponent(location.getContainer());
}
dtde.acceptDrag(dtde.getDropAction());
}
}
catch (Exception e) {
LOG.error(e);
}
}
示例2: processDrop
import com.intellij.uiDesigner.FormEditingUtil; //導入方法依賴的package包/類
private boolean processDrop(final DraggedComponentList dcl, final Point dropPoint, final int dropAction) {
myEditor.getActiveDecorationLayer().removeFeedback();
final ArrayList<RadComponent> dclComponents = dcl.getComponents();
final int componentCount = dclComponents.size();
ComponentDropLocation location = GridInsertProcessor.getDropLocation(myEditor.getRootContainer(), dropPoint);
if (FormEditingUtil.isDropOnChild(dcl, location)) {
setDraggingState(dcl, false);
return false;
}
if (!location.canDrop(dcl)) {
setDraggingState(dcl, false);
return false;
}
if (!myEditor.ensureEditable()) {
setDraggingState(dcl, false);
return false;
}
List<RadComponent> droppedComponents;
RadContainer[] originalParents = dcl.getOriginalParents();
cancelDrag();
if (dropAction == DnDConstants.ACTION_COPY) {
setDraggingState(dcl, false);
droppedComponents = myDraggedComponentsCopy;
if (droppedComponents == null) {
return false;
}
}
else {
for(int i=0; i<dclComponents.size(); i++) {
LOG.info("Removing component " + dclComponents.get(i).getId() + " with constraints " + dcl.getOriginalConstraints() [i]);
originalParents [i].removeComponent(dclComponents.get(i));
}
droppedComponents = dclComponents;
}
final RadComponent[] components = droppedComponents.toArray(new RadComponent[componentCount]);
final GridConstraints[] originalConstraints = dcl.getOriginalConstraints();
location.processDrop(myEditor, components, originalConstraints, dcl);
if (dropAction == DnDConstants.ACTION_COPY) {
for (RadComponent component : droppedComponents) {
InsertComponentProcessor.createBindingWhenDrop(myEditor, component, false);
}
FormEditingUtil.selectComponents(myEditor, droppedComponents);
}
else {
setDraggingState(dcl, false);
}
for (int i = 0; i < originalConstraints.length; i++) {
if (originalParents[i].getLayoutManager().isGrid()) {
FormEditingUtil.deleteEmptyGridCells(originalParents[i], originalConstraints[i]);
}
}
return true;
}