Changeset 14122 in osm for applications/editors/josm
- Timestamp:
- 2009-03-18T16:37:03+01:00 (16 years ago)
- Location:
- applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageEntries.java
r13497 r14122 16 16 private static final class ImageReadyListener implements 17 17 IImageReadyListener { 18 private final ImageEntries imageEntries;19 20 public ImageReadyListener(final ImageEntries imageEntries) {21 this.imageEntries = imageEntries;22 }23 24 public final void onImageReady(final ImageEntry imageEntry,25 final Image image) {26 this.imageEntries.setCurrentImage(imageEntry, image);27 }18 private final ImageEntries imageEntries; 19 20 public ImageReadyListener(final ImageEntries imageEntries) { 21 this.imageEntries = imageEntries; 22 } 23 24 public final void onImageReady(final ImageEntry imageEntry, 25 final Image image) { 26 this.imageEntries.setCurrentImage(imageEntry, image); 27 } 28 28 } 29 29 … … 39 39 40 40 private ImageEntries() { 41 this.images = new ArrayList<ImageEntry>();42 this.locatedImages = new ArrayList<ImageEntry>();43 this.listeners = new ArrayList<IImageChangeListener>();44 this.listener = new ImageReadyListener(this);45 46 this.currentImageEntry = null;47 this.currentImage = null;41 this.images = new ArrayList<ImageEntry>(); 42 this.locatedImages = new ArrayList<ImageEntry>(); 43 this.listeners = new ArrayList<IImageChangeListener>(); 44 this.listener = new ImageReadyListener(this); 45 46 this.currentImageEntry = null; 47 this.currentImage = null; 48 48 } 49 49 50 50 public static final ImageEntries getInstance() { 51 return ImageEntries.INSTANCE;51 return ImageEntries.INSTANCE; 52 52 } 53 53 54 54 public final void addListener(final IImageChangeListener listener) { 55 this.listeners.add(listener);55 this.listeners.add(listener); 56 56 } 57 57 58 58 public final void removeListener(final IImageChangeListener listener) { 59 this.listeners.remove(listener);59 this.listeners.remove(listener); 60 60 } 61 61 62 62 public final void add(final File[] imageFiles) { 63 if (null != imageFiles) {64 for (int index = 0; index < imageFiles.length; index++) {65 this.images.add(new ImageEntry(imageFiles[index]));66 }67 this.associateAllLayers();68 }63 if (null != imageFiles) { 64 for (int index = 0; index < imageFiles.length; index++) { 65 this.images.add(new ImageEntry(imageFiles[index])); 66 } 67 this.associateAllLayers(); 68 } 69 69 } 70 70 71 71 public final void associateAllLayers() { 72 for (int index = 0; index < this.images.size(); index++) {73 this.images.get(index).setWayPoint(null);74 }75 this.locatedImages.clear();76 77 if (null != Main.map && null != Main.map.mapView) {78 final Collection<Layer> layerCollection = Main.map.mapView.getAllLayers();79 final Layer[] layers = layerCollection.toArray(new Layer[layerCollection.size()]);80 81 for (int index = 0; index < layers.length; index++) {82 if (layers[index] instanceof GpxLayer83 && null != ((GpxLayer) layers[index]).data84 && !((GpxLayer) layers[index]).data.fromServer) {85 this.doAssociateLayer((GpxLayer) layers[index]);86 }87 }88 89 for (IImageChangeListener listener : this.listeners) {90 listener.onSelectedImageEntryChanged(this);91 }92 }72 for (int index = 0; index < this.images.size(); index++) { 73 this.images.get(index).setWayPoint(null); 74 } 75 this.locatedImages.clear(); 76 77 if (null != Main.map && null != Main.map.mapView) { 78 final Collection<Layer> layerCollection = Main.map.mapView.getAllLayers(); 79 final Layer[] layers = layerCollection.toArray(new Layer[layerCollection.size()]); 80 81 for (int index = 0; index < layers.length; index++) { 82 if (layers[index] instanceof GpxLayer 83 && null != ((GpxLayer) layers[index]).data 84 && !((GpxLayer) layers[index]).data.fromServer) { 85 this.doAssociateLayer((GpxLayer) layers[index]); 86 } 87 } 88 89 for (IImageChangeListener listener : this.listeners) { 90 listener.onSelectedImageEntryChanged(this); 91 } 92 } 93 93 } 94 94 95 95 private final void doAssociateLayer(final GpxLayer gpxLayer) { 96 if (null != gpxLayer && null != gpxLayer.data96 if (null != gpxLayer && null != gpxLayer.data 97 97 && !gpxLayer.data.fromServer) { 98 for (WayPoint wayPoint : gpxLayer.data.waypoints) {99 final List<String> texts = this.getTextContentsFromWayPoint(wayPoint);100 101 for (String text : texts) {102 final ImageEntry image = this.findImageEntryWithFileName(text);103 if (null != image) {104 image.setWayPoint(wayPoint);105 this.locatedImages.add(image);106 }107 }108 }109 }98 for (WayPoint wayPoint : gpxLayer.data.waypoints) { 99 final List<String> texts = this.getTextContentsFromWayPoint(wayPoint); 100 101 for (String text : texts) { 102 final ImageEntry image = this.findImageEntryWithFileName(text); 103 if (null != image) { 104 image.setWayPoint(wayPoint); 105 this.locatedImages.add(image); 106 } 107 } 108 } 109 } 110 110 } 111 111 … … 134 134 135 135 private final ImageEntry findImageEntryWithFileName(final String fileName) { 136 ImageEntry foundimage = null;137 138 for (int index = 0; index < this.images.size() && null == foundimage; index++) {139 final ImageEntry image = this.images.get(index);140 if (null == image.getWayPoint()141 && image.getFileName().startsWith(fileName)) {142 foundimage = image;143 }144 }145 146 return foundimage;136 ImageEntry foundimage = null; 137 138 for (int index = 0; index < this.images.size() && null == foundimage; index++) { 139 final ImageEntry image = this.images.get(index); 140 if (null == image.getWayPoint() 141 && image.getFileName().startsWith(fileName)) { 142 foundimage = image; 143 } 144 } 145 146 return foundimage; 147 147 } 148 148 149 149 private final void setCurrentImage(final ImageEntry imageEntry, 150 150 final Image image) { 151 if (imageEntry == this.currentImageEntry) {152 this.currentImage = image;153 }154 155 for (IImageChangeListener listener : this.listeners) {156 listener.onSelectedImageEntryChanged(this);157 }151 if (imageEntry == this.currentImageEntry) { 152 this.currentImage = image; 153 } 154 155 for (IImageChangeListener listener : this.listeners) { 156 listener.onSelectedImageEntryChanged(this); 157 } 158 158 } 159 159 160 160 public final ImageEntry[] getImages() { 161 return this.locatedImages.toArray(new ImageEntry[this.locatedImages.size()]);161 return this.locatedImages.toArray(new ImageEntry[this.locatedImages.size()]); 162 162 } 163 163 164 164 public final ImageEntry getCurrentImageEntry() { 165 return this.currentImageEntry;165 return this.currentImageEntry; 166 166 } 167 167 168 168 public final Image getCurrentImage() { 169 return this.currentImage;169 return this.currentImage; 170 170 } 171 171 172 172 public final boolean hasNext() { 173 return null != this.currentImageEntry173 return null != this.currentImageEntry 174 174 && this.locatedImages.indexOf(this.currentImageEntry) < this.locatedImages.size() - 1; 175 175 } 176 176 177 177 public final boolean hasPrevious() { 178 return null != this.currentImageEntry178 return null != this.currentImageEntry 179 179 && this.locatedImages.indexOf(this.currentImageEntry) > 0; 180 180 } 181 181 182 182 public final void next() { 183 if (null != this.currentImageEntry183 if (null != this.currentImageEntry 184 184 && this.locatedImages.indexOf(this.currentImageEntry) < this.locatedImages.size() - 1) { 185 this.setCurrentImageEntry(this.locatedImages.get(this.locatedImages.indexOf(this.currentImageEntry) + 1));186 }185 this.setCurrentImageEntry(this.locatedImages.get(this.locatedImages.indexOf(this.currentImageEntry) + 1)); 186 } 187 187 } 188 188 189 189 public final void previous() { 190 if (null != this.currentImageEntry190 if (null != this.currentImageEntry 191 191 && this.locatedImages.indexOf(this.currentImageEntry) > 0) { 192 this.setCurrentImageEntry(this.locatedImages.get(this.locatedImages.indexOf(this.currentImageEntry) - 1));193 }192 this.setCurrentImageEntry(this.locatedImages.get(this.locatedImages.indexOf(this.currentImageEntry) - 1)); 193 } 194 194 } 195 195 196 196 public final void rotateCurrentImageLeft() { 197 if (null != this.currentImageEntry) {198 this.currentImageEntry.setOrientation(this.currentImageEntry.getOrientation()199 .rotateLeft());200 }201 202 this.setCurrentImageEntry(this.currentImageEntry);197 if (null != this.currentImageEntry) { 198 this.currentImageEntry.setOrientation(this.currentImageEntry.getOrientation() 199 .rotateLeft()); 200 } 201 202 this.setCurrentImageEntry(this.currentImageEntry); 203 203 } 204 204 205 205 public final void rotateCurrentImageRight() { 206 if (null != this.currentImageEntry) {207 this.currentImageEntry.setOrientation(this.currentImageEntry.getOrientation()208 .rotateRight());209 }210 211 this.setCurrentImageEntry(this.currentImageEntry);206 if (null != this.currentImageEntry) { 207 this.currentImageEntry.setOrientation(this.currentImageEntry.getOrientation() 208 .rotateRight()); 209 } 210 211 this.setCurrentImageEntry(this.currentImageEntry); 212 212 } 213 213 214 214 public final void setCurrentImageEntry(final ImageEntry imageEntry) { 215 if (null == imageEntry || this.locatedImages.contains(imageEntry)) { 216 if (null != this.currentImageEntry) { 217 this.currentImageEntry.flush(); 218 } 219 220 this.currentImageEntry = imageEntry; 221 this.currentImage = null; 222 223 for (IImageChangeListener listener : this.listeners) { 224 listener.onSelectedImageEntryChanged(this); 225 } 226 227 // now try to get the image 228 this.currentImageEntry.requestImage(this.listener); 229 } 215 if (null == imageEntry || this.locatedImages.contains(imageEntry)) { 216 if (null != this.currentImageEntry) 217 this.currentImageEntry.flush(); 218 219 this.currentImageEntry = imageEntry; 220 this.currentImage = null; 221 222 for (IImageChangeListener listener : this.listeners) 223 listener.onSelectedImageEntryChanged(this); 224 225 if(imageEntry != null) // now try to get the image 226 this.currentImageEntry.requestImage(this.listener); 227 } 230 228 } 231 229 } -
applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointLayer.java
r13497 r14122 20 20 public final class ImageWayPointLayer extends Layer { 21 21 private static final class ImageWayPointMouseListener extends MouseAdapter { 22 private final ImageWayPointLayer layer;22 private final ImageWayPointLayer layer; 23 23 24 public ImageWayPointMouseListener(final ImageWayPointLayer layer) {25 this.layer = layer;26 }24 public ImageWayPointMouseListener(final ImageWayPointLayer layer) { 25 this.layer = layer; 26 } 27 27 28 @Override29 public final void mouseClicked(final MouseEvent event) {30 if (MouseEvent.BUTTON1 == event.getButton() && this.layer.visible) {31 final ImageEntry[] images = ImageEntries.getInstance()32 .getImages();28 @Override 29 public final void mouseClicked(final MouseEvent event) { 30 if (MouseEvent.BUTTON1 == event.getButton() && this.layer.visible) { 31 final ImageEntry[] images = ImageEntries.getInstance() 32 .getImages(); 33 33 34 if (null != images) { 35 boolean found = false; 36 // Note: the images are checked in the *reverse* order to 37 // which they're painted - this means than an image which 38 // partly obscures another will match the click first 39 for (int index = images.length - 1; !found && index >= 0; index--) { 40 final Rectangle bounds = images[index].getBounds(Main.map.mapView); 41 if (null != bounds && bounds.contains(event.getPoint())) { 42 found = true; 43 ImageEntries.getInstance() 44 .setCurrentImageEntry(images[index]); 45 } 34 if (null != images) { 35 boolean found = false; 36 // Note: the images are checked in the *reverse* order to 37 // which they're painted - this means than an image which 38 // partly obscures another will match the click first 39 for (int index = images.length - 1; !found && index >= 0; index--) { 40 final Rectangle bounds = images[index].getBounds(Main.map.mapView); 41 if (null != bounds && bounds.contains(event.getPoint())) { 42 found = true; 43 ImageEntries.getInstance() 44 .setCurrentImageEntry(images[index]); 45 } 46 } 47 } 46 48 } 47 49 } 48 }49 }50 50 } 51 51 52 52 private static final class ImageChangeListener implements 53 54 private final ImageWayPointLayer layer;53 IImageChangeListener { 54 private final ImageWayPointLayer layer; 55 55 56 public ImageChangeListener(final ImageWayPointLayer layer) {57 this.layer = layer;58 }56 public ImageChangeListener(final ImageWayPointLayer layer) { 57 this.layer = layer; 58 } 59 59 60 public final void onAvailableImageEntriesChanged(60 public final void onAvailableImageEntriesChanged( 61 61 final ImageEntries entries) { 62 Main.map.repaint();63 }62 Main.map.repaint(); 63 } 64 64 65 public final void onSelectedImageEntryChanged(final ImageEntries entries) {66 Main.map.repaint();67 }65 public final void onSelectedImageEntryChanged(final ImageEntries entries) { 66 Main.map.repaint(); 67 } 68 68 } 69 69 … … 72 72 73 73 public ImageWayPointLayer() { 74 super(tr("Imported Images"));74 super(tr("Imported Images")); 75 75 76 Main.main.addLayer(this);76 Main.main.addLayer(this); 77 77 78 this.layerMouseListener = new ImageWayPointMouseListener(this);79 Main.map.mapView.addMouseListener(this.layerMouseListener);78 this.layerMouseListener = new ImageWayPointMouseListener(this); 79 Main.map.mapView.addMouseListener(this.layerMouseListener); 80 80 81 this.imageChangeListener = new ImageChangeListener(this);82 ImageEntries.getInstance().addListener(this.imageChangeListener);81 this.imageChangeListener = new ImageChangeListener(this); 82 ImageEntries.getInstance().addListener(this.imageChangeListener); 83 83 } 84 84 85 85 @Override 86 86 public final Icon getIcon() { 87 return ImageProvider.get("dialogs/imagewaypoint");87 return ImageProvider.get("dialogs/imagewaypoint"); 88 88 } 89 89 90 90 @Override 91 91 public final Object getInfoComponent() { 92 return null;92 return null; 93 93 } 94 94 95 95 @Override 96 96 public final Component[] getMenuEntries() { 97 return new Component[0];97 return new Component[0]; 98 98 } 99 99 100 100 @Override 101 101 public final String getToolTipText() { 102 // TODO103 return "";102 // TODO 103 return ""; 104 104 } 105 105 106 106 @Override 107 107 public final boolean isMergable(final Layer other) { 108 // TODO109 return false;108 // TODO 109 return false; 110 110 } 111 111 112 112 @Override 113 113 public final void mergeFrom(final Layer from) { 114 // TODO not supported yet114 // TODO not supported yet 115 115 } 116 116 117 117 @Override 118 118 public final void paint(final Graphics graphics, final MapView mapView) { 119 final ImageEntry[] images = ImageEntries.getInstance().getImages();119 final ImageEntry[] images = ImageEntries.getInstance().getImages(); 120 120 121 if (null != images) {122 final ImageEntry currentImage = ImageEntries.getInstance()123 .getCurrentImageEntry();121 if (null != images) { 122 final ImageEntry currentImage = ImageEntries.getInstance() 123 .getCurrentImageEntry(); 124 124 125 for (int index = 0; index < images.length; index++) { 126 final Rectangle bounds = images[index].getBounds(mapView); 127 if (null != bounds) { 128 if (images[index] == currentImage) { 129 ImageEntry.SELECTED_ICON.paintIcon(mapView, 130 graphics, 131 bounds.x, 132 bounds.y); 133 } else { 134 ImageEntry.ICON.paintIcon(mapView, 135 graphics, 136 bounds.x, 137 bounds.y); 125 for (int index = 0; index < images.length; index++) { 126 final Rectangle bounds = images[index].getBounds(mapView); 127 if (null != bounds) { 128 if (images[index] == currentImage) { 129 ImageEntry.SELECTED_ICON.paintIcon(mapView, 130 graphics, 131 bounds.x, 132 bounds.y); 133 } else { 134 ImageEntry.ICON.paintIcon(mapView, 135 graphics, 136 bounds.x, 137 bounds.y); 138 } 139 } 138 140 } 139 141 } 140 }141 }142 142 } 143 143 144 144 @Override 145 145 public final void visitBoundingBox(final BoundingXYVisitor visitor) { 146 final ImageEntry[] images = ImageEntries.getInstance().getImages();146 final ImageEntry[] images = ImageEntries.getInstance().getImages(); 147 147 148 if (null != images) {149 for (int index = 0; index < images.length; index++) {150 final ImageEntry imageEntry = images[index];148 if (null != images) { 149 for (int index = 0; index < images.length; index++) { 150 final ImageEntry imageEntry = images[index]; 151 151 152 if (null != imageEntry.getWayPoint() 153 && null != imageEntry.getWayPoint().eastNorth) { 154 visitor.visit(imageEntry.getWayPoint().eastNorth); 152 if (null != imageEntry.getWayPoint() 153 && null != imageEntry.getWayPoint().eastNorth) { 154 visitor.visit(imageEntry.getWayPoint().eastNorth); 155 } 156 } 155 157 } 156 }157 }158 158 } 159 159 160 160 @Override 161 161 public final void destroy() { 162 super.destroy();162 super.destroy(); 163 163 164 Main.map.mapView.removeMouseListener(this.layerMouseListener);165 ImageEntries.getInstance().removeListener(this.imageChangeListener);164 Main.map.mapView.removeMouseListener(this.layerMouseListener); 165 ImageEntries.getInstance().removeListener(this.imageChangeListener); 166 166 } 167 167 } -
applications/editors/josm/plugins/imagewaypoint/src/org/insignificant/josm/plugins/imagewaypoint/ImageWayPointPlugin.java
r14120 r14122 22 22 public final class ImageWayPointPlugin extends org.openstreetmap.josm.plugins.Plugin { 23 23 private static final class ImageFileFilter extends FileFilter { 24 @Override25 public final boolean accept(final File file) {26 return file.isDirectory()27 || file.getName().toLowerCase().endsWith(".jpg")28 || file.getName().toLowerCase().endsWith(".jpeg")29 || file.getName().toLowerCase().endsWith(".png")30 || file.getName().toLowerCase().endsWith(".gif");31 }24 @Override 25 public final boolean accept(final File file) { 26 return file.isDirectory() 27 || file.getName().toLowerCase().endsWith(".jpg") 28 || file.getName().toLowerCase().endsWith(".jpeg") 29 || file.getName().toLowerCase().endsWith(".png") 30 || file.getName().toLowerCase().endsWith(".gif"); 31 } 32 32 33 @Override34 public final String getDescription() {35 return tr("Image files (*.jpg, *.jpeg, *.png, *.gif)");36 }33 @Override 34 public final String getDescription() { 35 return tr("Image files (*.jpg, *.jpeg, *.png, *.gif)"); 36 } 37 37 } 38 38 39 39 private static final class LoadImagesAction extends JosmAction { 40 private static final long serialVersionUID = 4480306223276347301L;40 private static final long serialVersionUID = 4480306223276347301L; 41 41 42 private final ImageWayPointPlugin plugin;42 private final ImageWayPointPlugin plugin; 43 43 44 public LoadImagesAction(final ImageWayPointPlugin plugin) {45 super(tr("Open images with ImageWayPoint"),46 "imagewaypoint-open",47 tr("Load set of images as a new layer."),48 null,49 false);44 public LoadImagesAction(final ImageWayPointPlugin plugin) { 45 super(tr("Open images with ImageWayPoint"), 46 "imagewaypoint-open", 47 tr("Load set of images as a new layer."), 48 null, 49 false); 50 50 51 this.plugin = plugin;52 }51 this.plugin = plugin; 52 } 53 53 54 public final void actionPerformed(final ActionEvent actionEvent) {55 final JFileChooser fileChooser = new JFileChooser(Main.pref.get("tagimages.lastdirectory"));56 fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);57 fileChooser.setMultiSelectionEnabled(true);58 fileChooser.setAcceptAllFileFilterUsed(false);59 fileChooser.setFileFilter(new ImageFileFilter());54 public final void actionPerformed(final ActionEvent actionEvent) { 55 final JFileChooser fileChooser = new JFileChooser(Main.pref.get("tagimages.lastdirectory")); 56 fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); 57 fileChooser.setMultiSelectionEnabled(true); 58 fileChooser.setAcceptAllFileFilterUsed(false); 59 fileChooser.setFileFilter(new ImageFileFilter()); 60 60 61 fileChooser.showOpenDialog(Main.parent);61 fileChooser.showOpenDialog(Main.parent); 62 62 63 final File[] selectedFiles = fileChooser.getSelectedFiles();64 if (null != selectedFiles && 0 != selectedFiles.length) {65 Main.pref.put("tagimages.lastdirectory",66 fileChooser.getCurrentDirectory().getPath());63 final File[] selectedFiles = fileChooser.getSelectedFiles(); 64 if (null != selectedFiles && 0 != selectedFiles.length) { 65 Main.pref.put("tagimages.lastdirectory", 66 fileChooser.getCurrentDirectory().getPath()); 67 67 68 // recursively find all files69 final List<File> allFiles = new ArrayList<File>();70 this.plugin.addFiles(allFiles, selectedFiles);68 // recursively find all files 69 final List<File> allFiles = new ArrayList<File>(); 70 this.plugin.addFiles(allFiles, selectedFiles); 71 71 72 // add files to ImageEntries73 ImageEntries.getInstance()74 .add(allFiles.toArray(new File[allFiles.size()]));72 // add files to ImageEntries 73 ImageEntries.getInstance() 74 .add(allFiles.toArray(new File[allFiles.size()])); 75 75 76 // check to see whether there's already an ImageWayPointLayer 77 boolean foundImageWayPointLayer = false; 78 if (null != Main.map && null != Main.map.mapView) { 79 final Collection<Layer> layerCollection = Main.map.mapView.getAllLayers(); 80 final Iterator<Layer> layerIterator = layerCollection.iterator(); 81 while (layerIterator.hasNext() && !foundImageWayPointLayer) { 82 if (layerIterator.next() instanceof ImageWayPointLayer) { 83 foundImageWayPointLayer = true; 84 } 76 // check to see whether there's already an ImageWayPointLayer 77 boolean foundImageWayPointLayer = false; 78 if (null != Main.map && null != Main.map.mapView) { 79 final Collection<Layer> layerCollection = Main.map.mapView.getAllLayers(); 80 final Iterator<Layer> layerIterator = layerCollection.iterator(); 81 while (layerIterator.hasNext() && !foundImageWayPointLayer) { 82 if (layerIterator.next() instanceof ImageWayPointLayer) { 83 foundImageWayPointLayer = true; 84 } 85 } 86 } 87 if (!foundImageWayPointLayer) { 88 new ImageWayPointLayer(); 89 } 85 90 } 86 91 } 87 if (!foundImageWayPointLayer) {88 new ImageWayPointLayer();89 }90 }91 }92 92 } 93 93 … … 103 103 public final void mapFrameInitialized(final MapFrame oldFrame, 104 104 final MapFrame newFrame) { 105 if (newFrame != null) {106 newFrame.addToggleDialog(ImageWayPointDialog.getInstance()107 .getDisplayComponent());108 } else {109 ImageEntries.getInstance().setCurrentImageEntry(null);110 }105 if (newFrame != null) { 106 newFrame.addToggleDialog(ImageWayPointDialog.getInstance() 107 .getDisplayComponent()); 108 } else { 109 ImageEntries.getInstance().setCurrentImageEntry(null); 110 } 111 111 } 112 112 113 113 private void addFiles(List<File> allFiles, File[] selectedFiles) { 114 for (int index = 0; index < selectedFiles.length; index++) {115 final File selectedFile = selectedFiles[index];116 if (selectedFile.isDirectory()) {117 this.addFiles(allFiles, selectedFile.listFiles());118 } else if (selectedFile.getName().toLowerCase().endsWith(".jpg")) {119 allFiles.add(selectedFile);114 for (int index = 0; index < selectedFiles.length; index++) { 115 final File selectedFile = selectedFiles[index]; 116 if (selectedFile.isDirectory()) 117 this.addFiles(allFiles, selectedFile.listFiles()); 118 else if (selectedFile.getName().toLowerCase().endsWith(".jpg")) 119 allFiles.add(selectedFile); 120 120 } 121 121 } 122 }123 122 }
Note:
See TracChangeset
for help on using the changeset viewer.