Ignore:
Timestamp:
02/05/14 11:15:35 (10 years ago)
Author:
jts21
Message:

Implement automatically downloading images from FrameShare servers. Also includes code for uploading images, but that's not ready yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/items/ItemUtils.java

    r778 r838  
    2626import org.expeditee.items.widgets.WidgetCorner;
    2727import org.expeditee.items.widgets.WidgetEdge;
     28import org.expeditee.network.FrameShare;
    2829import org.expeditee.settings.folders.FolderSettings;
    2930
     
    344345         *         not found.
    345346         */
    346         public static Picture CreatePicture(Text source, ImageObserver observer) {
     347        public static Picture CreatePicture(Text source, ImageObserver observer, boolean tryRemote) {
    347348                String text = source.getText();
    348349                String path = "";
     
    398399                                path = file.getPath();
    399400
    400                         // if the image isn't found by now, give up.
     401                        // if the image isn't found by now, try remote servers
    401402                        file = new File(path);
    402403                        if (!file.exists() || file.isDirectory()) {
     404                        if(tryRemote && FrameShare.getInstance().loadImage(fileName, null)) {
     405                                // call CreatePicture again, but with tryRemote set to false so we won't get into an infinite loop
     406                                // if something goes wrong with finding the downloaded image
     407                                return CreatePicture(source, observer, false);
     408                        }
    403409                                return null;
    404410                        }
     
    417423                }
    418424
     425        }
     426       
     427        public static Picture CreatePicture(Text source, ImageObserver observer) {
     428                return CreatePicture(source, observer, true);
    419429        }
    420430
Note: See TracChangeset for help on using the changeset viewer.