Revision 38051 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/view/toc/DnDJTree.java
DnDJTree.java | ||
---|---|---|
59 | 59 |
*/ |
60 | 60 |
|
61 | 61 |
|
62 |
import java.awt.BasicStroke; |
|
62 | 63 |
import java.awt.Color; |
63 | 64 |
import java.awt.Graphics; |
65 |
import java.awt.Graphics2D; |
|
64 | 66 |
import java.awt.Point; |
65 | 67 |
import java.awt.Rectangle; |
66 | 68 |
import java.awt.datatransfer.Transferable; |
... | ... | |
415 | 417 |
// como una propiedad de la capa (que luego borraremos) |
416 | 418 |
FLayer lyrToMove = ((TocItemBranch)newChild.getUserObject()).getLayer(); |
417 | 419 |
lyrToMove.setProperty("DROP_POS", new Integer(newPos)); |
420 |
lyrToMove.setProperty("GO_UP", new Boolean(bUpSelected)); |
|
418 | 421 |
callListeners(lpo,lpd,lyrToMove); |
419 | 422 |
} |
420 | 423 |
} |
... | ... | |
478 | 481 |
|
479 | 482 |
/** DropTaregetListener interface method */ |
480 | 483 |
public void dragExit(DropTargetEvent e) { |
484 |
clearDropMark(); |
|
481 | 485 |
} |
482 | 486 |
|
483 | 487 |
/** DropTaregetListener interface method */ |
... | ... | |
491 | 495 |
|
492 | 496 |
// if destination path is okay accept drop... |
493 | 497 |
if (destinationPath == null){ |
498 |
clearDropMark(); |
|
494 | 499 |
return; |
495 | 500 |
} |
496 | 501 |
|
... | ... | |
498 | 503 |
if (dragedTreeNode.getUserObject() instanceof TocItemBranch){ |
499 | 504 |
FLayer draggedLayer = ((TocItemBranch)dragedTreeNode.getUserObject()).getLayer(); |
500 | 505 |
if (draggedLayer != null){ |
501 |
Graphics graphics = this.getGraphics(); |
|
502 | 506 |
int increment = (int)separatorRectangle.getHeight(); |
503 | 507 |
|
504 |
graphics.clearRect(0, separatorPos, getWidth(), 1);
|
|
508 |
clearDropMark();
|
|
505 | 509 |
|
506 | 510 |
bUpSelected = false; |
507 | 511 |
separatorRectangle = getPathBounds(destinationPath); |
512 |
MARGIN = separatorRectangle.x; |
|
508 | 513 |
separatorPos = separatorRectangle.y + increment - 1; |
509 | 514 |
if (cursorLocationBis.y < separatorPos - increment/2) { |
510 | 515 |
increment = 0; |
... | ... | |
514 | 519 |
increment = separatorRectangle.height; |
515 | 520 |
separatorPos = separatorRectangle.y + increment - 1; |
516 | 521 |
|
517 |
System.out.println("bUpSelected=" + bUpSelected + " separatorPos =" + separatorPos |
|
518 |
+ " cursor=" + cursorLocationBis.y); |
|
519 |
graphics.setColor(Color.red); |
|
520 |
graphics.drawLine(MARGIN, separatorPos , getWidth() - MARGIN, separatorPos); |
|
522 |
// System.out.println("bUpSelected=" + bUpSelected + " separatorPos =" + separatorPos |
|
523 |
// + " cursor=" + cursorLocationBis.y); |
|
524 |
Graphics graphics = this.getGraphics(); |
|
525 |
graphics.setColor(Color.black); |
|
526 |
BasicStroke stroke = new BasicStroke(2); |
|
527 |
((Graphics2D) graphics).setStroke(stroke); |
|
528 |
graphics.drawLine(MARGIN, separatorPos , separatorRectangle.width, separatorPos); |
|
521 | 529 |
} |
522 | 530 |
} |
523 | 531 |
|
... | ... | |
535 | 543 |
// System.err.println(e.getDropTargetContext().getComponent()); |
536 | 544 |
|
537 | 545 |
// if (testSameComponent(e)) |
546 |
clearDropMark(); |
|
538 | 547 |
e.rejectDrag() ; |
539 | 548 |
/* else |
540 | 549 |
e.acceptDrag(DnDConstants.ACTION_MOVE); */ |
541 | 550 |
// } |
542 | 551 |
/* ****************** END OF CHANGE ******************** */ |
543 | 552 |
} |
553 |
protected void clearDropMark() { |
|
554 |
// Borramos la marca |
|
555 |
if (separatorPos != -1) { |
|
556 |
Graphics graphics = this.getGraphics(); |
|
557 |
graphics.clearRect(0, separatorPos-1, getWidth(), 2); |
|
558 |
separatorPos = 1; |
|
559 |
} |
|
560 |
} |
|
544 | 561 |
|
545 | 562 |
/** DropTaregetListener interface method */ |
546 | 563 |
public void dropActionChanged(DropTargetDragEvent e) { |
Also available in: Unified diff