Changeset 1436 for trunk/src/org/expeditee/gio/DragAndDropManager.java
- Timestamp:
- 11/05/19 16:16:11 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gio/DragAndDropManager.java
r1142 r1436 11 11 import org.expeditee.core.Point; 12 12 import org.expeditee.gui.DisplayController; 13 import org.expeditee.gui.FreeItems; 13 14 import org.expeditee.importer.FileImporter; 14 15 import org.expeditee.importer.FilePathImporter; … … 79 80 * @param text 80 81 * The text content. 81 *82 82 * @param expediteeDropPoint 83 83 * The location in the current expeditee frame of where to drop 84 84 * the text item. 85 */ 86 public static Text importString(String text, Point expediteeDropPoint) 85 * @param attachToFreeItems TODO 86 */ 87 public static Text importString(String text, Point expediteeDropPoint, boolean attachToFreeItems) 87 88 { 88 89 assert (DisplayController.getCurrentFrame() != null); … … 92 93 importedTextItem.setPosition(expediteeDropPoint); 93 94 94 DisplayController.getCurrentFrame().addItem(importedTextItem); 95 if (attachToFreeItems) { 96 FreeItems.getInstance().add(importedTextItem); 97 98 } else { 99 DisplayController.getCurrentFrame().addItem(importedTextItem); 100 } 95 101 DisplayController.requestRefresh(true); 96 102 … … 98 104 } 99 105 100 /** Imports a list of files into Expeditee's current frame. */101 public void importFileList(List<? extends File> files, Point expediteeDropPoint) throws IOException102 {106 /** Imports a list of files into Expeditee's current frame. 107 * @param attachToFreeItems TODO*/ 108 public void importFileList(List<? extends File> files, Point expediteeDropPoint, boolean attachToFreeItems) throws IOException { 103 109 Point currentPoint = new Point(expediteeDropPoint); 104 110 … … 106 112 for (File fileToImport : files) { 107 113 108 Item lastItem = importFile(fileToImport, currentPoint );109 114 Item lastItem = importFile(fileToImport, currentPoint, attachToFreeItems); 115 110 116 if (lastItem == null) { 111 117 currentPoint.setY(currentPoint.getY() + 30); … … 127 133 * @param f 128 134 * The file to import. 129 *130 135 * @param expediteeDropPoint 136 * @param attachToFreeItems If true, instead of adding to generated item at {@code expediteeDropPoint}, add to free items. 131 137 * 132 138 * @throws IOException 133 139 */ 134 public Item importFile(File f, Point expediteeDropPoint ) throws IOException140 public Item importFile(File f, Point expediteeDropPoint, boolean attachToFreeItems) throws IOException 135 141 { 136 142 assert (f != null); … … 139 145 // importing routines... 140 146 Item lastCreatedItem; 141 if (null == (lastCreatedItem = performFileImport(_customFileImporters, f, expediteeDropPoint ))) {147 if (null == (lastCreatedItem = performFileImport(_customFileImporters, f, expediteeDropPoint, attachToFreeItems))) { 142 148 // Standard file importing 143 lastCreatedItem = performFileImport(_standardFileImporters, f, expediteeDropPoint );149 lastCreatedItem = performFileImport(_standardFileImporters, f, expediteeDropPoint, attachToFreeItems); 144 150 } 145 151 … … 150 156 * Imports a single file into Expeditee's current frame. Importers are given the opportunity to 151 157 * interpret the file in order of their addition to the list. 152 */ 153 private Item performFileImport(List<FileImporter> importers, File f, Point expediteeDropPoint) throws IOException 158 * @param attachToFreeItems If true, instead of adding to generated item at {@code expediteeDropPoint}, add to free items. 159 */ 160 private Item performFileImport(List<FileImporter> importers, File f, Point expediteeDropPoint, boolean attachToFreeItems) throws IOException 154 161 { 155 162 for (FileImporter fi : importers) { 156 Item lastCreated = fi.importFile(f, expediteeDropPoint );163 Item lastCreated = fi.importFile(f, expediteeDropPoint, attachToFreeItems); 157 164 158 165 if (lastCreated != null) return lastCreated;
Note:
See TracChangeset
for help on using the changeset viewer.