Changeset 2454


Ignore:
Timestamp:
03/14/07 16:22:24 (13 years ago)
Author:
curtis
Message:

Add status update hooks to loci.formats.ome.Uploader logic.

Location:
trunk/loci/formats
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/FileStitcher.java

    r2453 r2454  
    720720    return reader.getFileChooser(); 
    721721  } 
     722 
     723  // -- StatusReporter API methods -- 
    722724 
    723725  /* @see IFormatHandler#addStatusListener(StatusListener) */ 
  • trunk/loci/formats/FormatHandler.java

    r2453 r2454  
    130130  } 
    131131 
    132   /* @see IFormatHandler#addStatusListener(StatusListener) */ 
     132  // -- StatusReporter API methods -- 
     133 
     134  /* @see StatusReporter#addStatusListener(StatusListener) */ 
    133135  public void addStatusListener(StatusListener l) { 
    134136    synchronized (statusListeners) { 
     
    137139  } 
    138140 
    139   /* @see IFormatHandler#removeStatusListener(StatusListener) */ 
     141  /* @see StatusReporter#removeStatusListener(StatusListener) */ 
    140142  public void removeStatusListener(StatusListener l) { 
    141143    synchronized (statusListeners) { 
     
    144146  } 
    145147 
    146   /* @see IFormatHandler#getStatusListeners() */ 
     148  /* @see StatusReporter#getStatusListeners() */ 
    147149  public StatusListener[] getStatusListeners() { 
    148150    synchronized (statusListeners) { 
  • trunk/loci/formats/IFormatHandler.java

    r2453 r2454  
    2929 
    3030/** Interface for all biological file format readers and writers. */ 
    31 public interface IFormatHandler { 
     31public interface IFormatHandler extends StatusReporter { 
    3232 
    3333  /** Checks if the given string is a valid filename for this file format. */ 
     
    5353  JFileChooser getFileChooser(); 
    5454 
    55   /** Adds a listener for status update events. */ 
    56   void addStatusListener(StatusListener l); 
    57  
    58   /** Removes a listener for status update events. */ 
    59   void removeStatusListener(StatusListener l); 
    60  
    61   /** Gets a list of all registered status update listeners. */ 
    62   StatusListener[] getStatusListeners(); 
    63  
    6455} 
  • trunk/loci/formats/ImageReader.java

    r2453 r2454  
    575575  } 
    576576 
     577  // -- StatusReporter API methods -- 
     578 
    577579  /* @see IFormatHandler#addStatusListener(StatusListener) */ 
    578580  public void addStatusListener(StatusListener l) { 
  • trunk/loci/formats/ImageWriter.java

    r2453 r2454  
    338338  } 
    339339 
     340  // -- StatusReporter API methods -- 
     341 
    340342  /* @see IFormatHandler#addStatusListener(StatusListener) */ 
    341343  public void addStatusListener(StatusListener l) { 
  • trunk/loci/formats/ReaderWrapper.java

    r2453 r2454  
    332332  } 
    333333 
     334  // -- StatusReporter API methods -- 
     335 
    334336  public void addStatusListener(StatusListener l) { 
    335337    reader.addStatusListener(l); 
  • trunk/loci/formats/ome/OMEUploader.java

    r2441 r2454  
    3737import org.openmicroscopy.xml.*; 
    3838 
    39 /** Utility methods for uploading pixels and metadata to an OME server. */ 
     39/** Module for uploading pixels and metadata to an OME server. */ 
    4040public class OMEUploader implements Uploader { 
    4141 
     
    7676  private Repository r; 
    7777 
     78  /** List of status listeners. */ 
     79  protected Vector statusListeners = new Vector(); 
     80 
    7881  // -- Constructors -- 
    7982 
     
    9396    login(server, user, pass); 
    9497    files = new Vector(); 
     98  } 
     99 
     100  // -- Internal FormatHandler API methods -- 
     101 
     102  /** Fires a status update event. */ 
     103  protected void status(String message) { 
     104    status(new StatusEvent(message)); 
     105  } 
     106 
     107  /** Fires a status update event. */ 
     108  protected void status(int progress, int maximum, String message) { 
     109    status(new StatusEvent(progress, maximum, message)); 
     110  } 
     111 
     112  /** Fires a status update event. */ 
     113  protected void status(StatusEvent e) { 
     114    StatusListener[] l = getStatusListeners(); 
     115    for (int i=0; i<l.length; i++) l[i].statusUpdated(e); 
    95116  } 
    96117 
     
    489510  } 
    490511 
    491   // -- Utility methods -- 
     512  // -- StatusReporter API methods -- 
     513 
     514  /* @see loci.formats.StatusReporter#addStatusListener(StatusListener) */ 
     515  public void addStatusListener(StatusListener l) { 
     516    synchronized (statusListeners) { 
     517      if (!statusListeners.contains(l)) statusListeners.add(l); 
     518    } 
     519  } 
     520 
     521  /* @see loci.formats.StatusReporter#removeStatusListener(StatusListener) */ 
     522  public void removeStatusListener(StatusListener l) { 
     523    synchronized (statusListeners) { 
     524      statusListeners.remove(l); 
     525    } 
     526  } 
     527 
     528  /* @see loci.formats.StatusReporter#getStatusListeners() */ 
     529  public StatusListener[] getStatusListeners() { 
     530    synchronized (statusListeners) { 
     531      StatusListener[] l = new StatusListener[statusListeners.size()]; 
     532      statusListeners.copyInto(l); 
     533      return l; 
     534    } 
     535  } 
     536 
     537 
     538  // -- Helper methods -- 
    492539 
    493540  /** Send a request string to the server and return the response. */ 
  • trunk/loci/formats/ome/Uploader.java

    r2327 r2454  
    2727import java.awt.image.BufferedImage; 
    2828import loci.formats.MetadataStore; 
     29import loci.formats.StatusReporter; 
    2930 
    30 public interface Uploader { 
     31/** Interface for uploading image information to a database. */ 
     32public interface Uploader extends StatusReporter { 
    3133 
    3234  /** Log in to the specified server, with the specified credentials. */ 
Note: See TracChangeset for help on using the changeset viewer.