Changeset 2206


Ignore:
Timestamp:
02/01/07 16:56:41 (13 years ago)
Author:
chris
Message:

fixed bug where metadata not displayed when filestitching

Location:
trunk/loci
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/ome/notebook/MetadataNotebook.java

    r2178 r2206  
    3131import javax.swing.*; 
    3232import javax.swing.border.*; 
     33import org.openmicroscopy.xml.OMENode; 
    3334import org.w3c.dom.*; 
    3435 
     
    8788 
    8889  public MetadataNotebook() { 
    89     this((String[]) null,true,true); 
     90    this((String[]) null); 
    9091  } 
    9192 
    9293  /** Create a default notebook window with save function and editing enabled.*/ 
    9394  public MetadataNotebook(String[] args) { 
    94     this(args,true,true); 
     95    this(args,(OMENode)null,(String)null,true,true); 
    9596  } 
    9697 
    9798  /** 
    9899  * Create a notebook window with specified save and editing policies. 
     100  * @param args an array of strings the first entry of which should be a 
     101  * filename, otherwise, send a (String[]) null as this parameter. 
     102  * @param ome An OMENode xml root to be launched if a filename is not 
     103  * appropriate, for instance when in the LociDataBrowser we have a 
     104  * FilePattern if using a FileStitcher. Thus, send ome instead. Note 
     105  * that this is a temporary fix. If your file is OME-Tiff there's going 
     106  * to be a problem if saving is enabled and you try to save to it, since 
     107  * we're circumventing the code that flags TIFF files. 
     108  * @param title Sets the title of the notebook window, which is done by 
     109  * default if a file URL is given in args, but otherwise should be set 
     110  * using this String parameter. 
    99111  * @param addSave whether or not saving should be enabled 
    100112  * @param editable whether or not users should be able to edit the xml 
    101113  */ 
    102   public MetadataNotebook(String[] args, boolean addSave, boolean editable) { 
     114  public MetadataNotebook(String[] args, OMENode ome, String title, 
     115    boolean addSave, boolean editable) 
     116  { 
    103117    super("OME Metadata Notebook"); 
     118    if (title != null) setTitle(title); 
    104119 
    105120    try { 
     
    127142    scanP.setEditable(editable); 
    128143 
    129     //create a MetadataPane, where most everything happen 
     144    //create a MetadataPane, where most everything happens 
    130145    if (args != null && args.length > 0) { 
    131146      File file = null; 
     
    141156    } 
    142157    else metadata = new MetadataPane((File) null, addSave, editable); 
     158    if(ome != null) metadata.setOMEXML(ome); 
    143159 
    144160    metadata.setVisible(true); 
  • trunk/loci/ome/notebook/MetadataPane.java

    r2178 r2206  
    221221    rawPanel.setVisible(false); 
    222222    add(rawPanel,"raw"); 
    223  
     223     
     224    //open initial file 
    224225    if (file != null) { 
    225226      setOMEXML(file); 
     
    434435 
    435436  /** Sets the displayed OME-XML metadata. */ 
    436   private void setOMEXML(OMENode ome) { 
     437  protected void setOMEXML(OMENode ome) { 
    437438    // test for document, then call the setup(OMENode ome) method 
    438439    Document doc = null; 
     
    440441    catch (Exception exc) { } 
    441442    if (doc == null) { 
     443      JOptionPane.showMessageDialog(this, 
     444          "Document is NULL.", 
     445          "MetadataNotebook Error", JOptionPane.ERROR_MESSAGE); 
    442446      System.out.println("Document is NULL."); 
    443447      return; 
  • trunk/loci/plugins/browser/CustomWindow.java

    r2087 r2206  
    3636import loci.formats.ReflectException; 
    3737import loci.formats.FilePattern; 
     38import loci.formats.FormatException; 
     39import loci.formats.OMEXMLMetadataStore; 
     40import org.openmicroscopy.xml.OMENode; 
     41import java.io.IOException; 
     42 
    3843//import loci.ome.notebook.MetadataNotebook; 
    3944 
     
    501506    if (cmd == null) cmd = ""; // prevent NullPointer 
    502507    if (cmd.equals("xml")) { 
    503       String[] args = {db.id}; 
    504       //MetadataNotebook metaNote = new MetadataNotebook(args, false, false); 
     508      String[] args = (String[]) null; 
     509 
     510      String title = db.id; 
    505511      try { 
     512        OMENode ome = (OMENode)(db.reader.getMetadataStoreRoot(db.id)); 
     513         
    506514        ReflectedUniverse r = new ReflectedUniverse(); 
    507515        r.exec("import loci.ome.notebook.MetadataNotebook"); 
    508516        r.setVar("args", args); 
     517        r.setVar("ome", ome); 
     518        r.setVar("title", title); 
    509519        r.setVar("false", false); 
    510         r.exec("new MetadataNotebook(args, false, false)"); 
     520        r.exec("new MetadataNotebook(args, ome, title, false, false)"); 
    511521      } 
    512522      catch (ReflectException exc) { 
     
    515525          "LOCI 4D Data Browser", JOptionPane.ERROR_MESSAGE); 
    516526        LociDataBrowser.exceptionMessage(exc); 
     527      } 
     528      catch (IOException exc) { 
     529        JOptionPane.showMessageDialog(this, 
     530          "We could not find metadata for this file.", 
     531          "LOCI 4D Data Browser", JOptionPane.ERROR_MESSAGE); 
     532      } 
     533      catch (FormatException exc) { 
     534        JOptionPane.showMessageDialog(this, 
     535          "A FormatException occured trying to get the metadata for this file.", 
     536          "LOCI 4D Data Browser", JOptionPane.ERROR_MESSAGE); 
    517537      } 
    518538    } 
  • trunk/loci/plugins/browser/LociDataBrowser.java

    r2026 r2206  
    4747 
    4848  /** Debugging flag. */ 
    49   protected static final boolean DEBUG = false; 
     49  protected static final boolean DEBUG = true; 
    5050 
    5151  // -- Fields -- 
     
    311311 
    312312        if (virtual) { 
    313           OMEXMLMetadataStore store = new OMEXMLMetadataStore(); 
    314313          synchronized (reader) { 
    315             reader.setMetadataStore(store); 
    316             store.createRoot(); 
    317314            reader.setSeries(id, series); 
    318315 
     
    350347          FileInfo fi = new FileInfo(); 
    351348          try { 
     349            OMEXMLMetadataStore store = 
     350              (OMEXMLMetadataStore) reader.getMetadataStore(id); 
    352351            fi.description = store.dumpXML(); 
    353352          } 
Note: See TracChangeset for help on using the changeset viewer.