Package org.photovault.imginfo

Examples of org.photovault.imginfo.PhotoInfo


    */
    public void testPhotoDelete() {
  PhotoFolder folder = PhotoFolder.create( "testListener", null );
  String fname = "test1.jpg";
  File f = new File( testImgDir, fname );
  PhotoInfo photo = null;
  try {
      photo = PhotoInfo.addToDB( f );
  } catch ( PhotoNotFoundException e ) {
      fail( "Could not find photo: " + e.getMessage() );
  }

  folder.addPhoto( photo );
  photo.delete();
  assertEquals( "After deleting the photo there should be no photos in the folder",
          folder.getPhotoCount(), 0 );
 
    }
View Full Code Here


       
        Iterator iter =photos.iterator();
        int photoCount = photos.size();
        int processedPhotos = 0;
        while ( iter.hasNext() ) {
            PhotoInfo photo = (PhotoInfo) iter.next();
            for ( int n = 0; n < photo.getNumInstances(); n++ ) {
                ImageInstance inst = photo.getInstance( n );
                /*
                 Hashes are generated on demand, so this call calculates the hash
                 if it has not been calculated previously.
                 */
                byte[] hash = inst.getHash();
            }
            // Check tha also the photo info object contains original contains hash.
            byte[] origHash = photo.getOrigInstanceHash();
            processedPhotos++;
            fireStatusChangeEvent( new SchemaUpdateEvent( PHASE_CREATING_HASHES,
                    (processedPhotos*100)/photoCount ) );
        }
    }
View Full Code Here

            int exportHeight = dlg.getImgHeight();
            Collection selection = view.getSelection();
            if ( selection != null ) {
                if ( selection.size() > 1 ) {
                    // Ensure that the numbering order is the same is in current view
                    PhotoInfo exportPhotos[]
                            = (PhotoInfo[]) selection.toArray( new PhotoInfo[selection.size() ]);
                    Comparator comp = view.getPhotoOrderComparator();
                    if ( comp != null ) {
                        Arrays.sort( exportPhotos, comp );
                    }
                    String format = getSequenceFnameFormat( exportFileTmpl );
                    BrowserWindow w = null;
                    ExportThread exporter = new ExportThread( this, exportPhotos,
                            format, exportWidth, exportHeight );
                    Thread t = new Thread( exporter );
                    setEnabled( false );
                    t.start();
                } else {
                    Iterator iter = selection.iterator();
                    if ( iter.hasNext() ) {
                        PhotoInfo photo = (PhotoInfo) iter.next();
                        try {
                            photo.exportPhoto( new File( exportFileTmpl ),
                                    exportWidth, exportHeight );
                        } catch (PhotovaultException ex) {
                            JOptionPane.showMessageDialog( view.getRootPane(),
                                    ex.getMessage(),
                                    "Error exporting image",
View Full Code Here

                        break;
                    }
                    int percent = (n) * 100 / exportPhotos.length;
                    owner.exportingPhoto( this, fname, percent );
                    File f = new File( fname );
                    PhotoInfo photo = exportPhotos[n];
                    int triesLeft = 1;
                    boolean succeeded = false;
                    while ( !succeeded && triesLeft > 0 ) {
                        try {
                            photo.exportPhoto( f, exportWidth, exportHeight );
                            succeeded = true;
                        } catch ( PhotovaultException e ) {
                            owner.exportError( e.getMessage() );
                        } catch ( OutOfMemoryError e ) {
                            /*
 
View Full Code Here

        Comparator c;
       
        public int compare(Object o1, Object o2 ) {
            int res = c.compare( o1, o2 );
            if ( res == 0 ) {
                PhotoInfo p1 = (PhotoInfo) o1;
                PhotoInfo p2 = (PhotoInfo) o2;
                int id1 = p1.getUid();
                int id2 = p2.getUid();
                if ( id1 < id2 ) res = -1;
                if ( id1 > id2 ) res = 1;
            }
            return res;
        }
View Full Code Here

TOP

Related Classes of org.photovault.imginfo.PhotoInfo

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.