

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
2 messages in net.java.dev.openjfx-compiler.devDrag and Drop changes| From | Sent On | Attachments |
|---|---|---|
| Jim Clarke | Jan 22, 2008 5:56 pm | |
| Jim Weaver | Jan 22, 2008 7:33 pm |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Drag and Drop changes | Actions |
|---|---|---|
| From: | Jim Clarke (Jim....@Sun.COM) | |
| Date: | Jan 22, 2008 5:56:35 pm | |
| List: | net.java.dev.openjfx-compiler.dev | |
I have made many changes to the Drag and Drop framework for the following classes in javafx.ui, TextField, TextArea, PasswordField, EditorPane, ListBox, Tree, and Table.
I have also checked in a demo, "BasicDND", that is a JavaFX version of the BasicDND example in the "Introduction to Drag and Drop and Data Transfer".
Each of these classes now has the following attributes:
----------------------------------------------------------------------------- /** indicates whether DND is enabled or disabled */ public attribute enableDND: Boolean;
/** Called when something is dropped on the component */ public attribute onDrop: function(e:XXXDropEvent):Void ;
/** Called to determine if the component can Accept the Drop. public attribute canAcceptDrop: function(e:XXXDropEvent):Boolean;
public attribute dropMode:DropMode = DropMode.USE_SELECTION;
----------------------------------------------------------------------------- * XXXDropEvent ==> javafx.ui.DropEvent, ListDropEvent, and TableDropEvent
I added a new FX class *javafx.ui.DropMode* which will map to the JDK1.6 */javax.swing.DropMode/* enums in the runtime, for JDK 1.5 this internal setting is ignored for the actual swing components and only effects the visual representation of the drop. Nonetheless, the default drop actions, defined below, are still applied. For JDK 1.6, this gives you the added visual effect that supports this new feature. DropMode.USE_SELECTION is the default value as per JDK 1.6.
For each component there are default drop, "onDrop(XXXDropEvent)" actions. The present rules are as follows:
*javafx.ui.TextField: javafx.ui.TextArea: javafx.ui.PasswordField*: javafx.ui.EditorPane:*
valid options are: INSERT and USE_SELECTION.
* INSERT inserts the dropped text near the drop point,
* USE_SELECTION either replaces the currently selected text or drops at the cursor if nothing is selected.
(* Drag value for PasswordField is "****")
*javafx.ui.ListBox*
valid options are INSERT, USE_SELECTION, ON, or ON_OR_INSERT.
* INSERT - inserts the text as a list item near the drop point. * USE_SELECTION - replaces the selection. * ON - replaces the item near the drop point. * ON_OR_INSERT - inserts the item either before or after the item near the drop point if the drop point is near the top or bottom of the selection. If the drop point is on the item, then the item is replaced.
*javafx.ui.Tree*:
valid options are INSERT, USE_SELECTION, ON, or ON_OR_INSERT.
* INSERT - tree node is added as a sibling before the node near the drop point * USE_SELECTION - Adds a new child node to the selected node. * ON - Adds a new child node to the dropped on node. * ON_OR_INSERT - if the drop point is on the enclosing rectangle for a node, a new child node is added to the dropped on node, otherwise it is inserted as a sibling before or after the nearest node depending on drop location.
*javafx.ui.Table*: (Incomplete)
valid options are INSERT, USE_SELECTION, ON, or ON_OR_INSERT, INSERT_COLS, INSERT_ROWS, ON_OR_INSERT_COLS, ON_OR_INSERT_ROWS.
INSERT - Not Implemented yet. USE_SELECTION - the selected cell's are replaced ON - the dropped on cell's are replaced ON_OR_INSERT - if on the cell, then the cell is replaced, otherwise it is Not Implemented yet. INSERT_COLS - Not Implemented yet. INSERT_ROWS - Not Implemented yet. ON_OR_INSERT_COLS - if on the cell, then the cell is replaced, otherwise it is Not Implemented yet. ON_OR_INSERT_ROWS - if on the cell, then the cell is replaced, otherwise it is Not Implemented yet.
As you can see, I have not fully worked out the rules for inserts into a table, and I would appreciate any suggestions.
*Dragging types are:*
*javafx.ui.TextField: javafx.ui.TextArea: javafx.ui.PasswordField*: javafx.ui.EditorPane*: - String
*javafx.ui.ListBox* - java.util.List of javafx.ui.ListCell
*Tree* - javax.swing.tree.TreePath
*Table* - java.util.List of javafx.ui.TableCell (one item for each cell dragged)
*TODOs:*
1. Multiple Selection still needs implementation for dragging in ListBox, Tree, and Table. 2. Finish Table. 3. Need to look at javafx.ui.Canvas. 4. Implement Image drops. 5. When JDK 1.6 becomes the standard release level for JavaFX, then enhance to fully take advantage of the JDK1.6 DND enhancements.
Any suggestions would be appreciated.
jim







