Package org.photovault.imginfo

Examples of org.photovault.imginfo.Thumbnail


    /**
       Implementation of @see PhotoInfoChangeListener. Checks if the Thumbnail has changed (e.g. the preferred
       rotation has changed) and updates thumbnail if appropriate
    */
    public void photoInfoChanged( PhotoInfoChangeEvent e ) {
  Thumbnail newThumb = photo.getThumbnail();
  if ( newThumb != thumbnail ) {
      thumbnail = newThumb;
      repaint();
  }
    }
View Full Code Here


       
        // Create a transaction which will be used for persisten object operations
        // during painting (to avoid creating several short-livin transactions)
        ODMGXAWrapper txw = new ODMGXAWrapper();
       
        Thumbnail thumbnail = null;
        log.debug( "finding thumb" );
        boolean hasThumbnail = photo.hasThumbnail();
        log.debug( "asked if has thumb" );
        if ( hasThumbnail ) {
            log.debug( "Photo " + photo.getUid() + " has thumbnail" );
            thumbnail = photo.getThumbnail();
            log.debug( "got thumbnail" );
        } else {
            /*
             Check if the thumbnail has been just invalidated. If so, use the
             old one until we get the new thumbnail created.
             */
            thumbnail = photo.getOldThumbnail();
            if ( thumbnail != null ) {
                useOldThumbnail = true;
            } else {
                // No success, use default thumnail.
                thumbnail = Thumbnail.getDefaultThumbnail();
            }

            // The photo does not have a thumbnail, so request one to be created
            if ( !thumbCreatorThread.isBusy() ) {
                log.debug( "Create thumbnail for " + photo.getUid() );
                thumbCreatorThread.createThumbnail( photo );
                log.debug( "Thumbnail request submitted" );
            }           
        }
        thumbReadyTime = System.currentTimeMillis();
       
        log.debug( "starting to draw" );
        // Find the position for the thumbnail
        BufferedImage img = thumbnail.getImage();
        if ( img.getWidth() > columnWidth || img.getHeight() > rowHeight ) {
            /*
             If the image is too large for the space reserved for thumbnail, crop
             (yes, this should not be possible but many kinds of miracles do
             happen. Also this has happened in some weird test cases!!!
View Full Code Here

            log.debug( "Checking bounds" );

            // Get thumbnail dimensions or use defaults if no thumbnail available
            int width = 100;
            int height = 75;
            Thumbnail thumb = null;
      if ( photoCandidate.hasThumbnail() ) {
    thumb = photoCandidate.getThumbnail();
      }
            if ( thumb != null ) {
                BufferedImage img = thumb.getImage();
                width = img.getWidth();
                height = img.getHeight();
            }
      int row = (int) photoNum / columnsToPaint;
      int col = photoNum - row*columnsToPaint;
 
View Full Code Here

        log.debug( "Waiting..." );
        wait();
        log.debug( "Waited..." );
        if ( photo != null ) {
      log.debug( "Creating thumbnail for " + photo.getUid() );
      Thumbnail thumb = null;
      while ( thumb == null ) {
          try {
        thumb = photo.getThumbnail();
          } catch ( Throwable e ) {
        // Most likely out of memory. Sleep for a while (to allow for other
View Full Code Here

        }
        photo.setPhotographer( "test" );
        try {
           
            PhotoInfo photo2 = PhotoInfo.retrievePhotoInfo( photo.getUid() );
            Thumbnail thumb = photo2.getThumbnail();
            this.assertFalse( "Default thumbnail returned", thumb == Thumbnail.getDefaultThumbnail() );
        } catch (PhotoNotFoundException ex) {
            fail( "Photo not found in database" );
        }
    }
View Full Code Here

TOP

Related Classes of org.photovault.imginfo.Thumbnail

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.