Changeset 3001


Ignore:
Timestamp:
07/20/07 11:22:39 (13 years ago)
Author:
melissa
Message:

Better folder support, including proper handling of nested folders.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/in/LIFReader.java

    r3000 r3001  
    525525    private int count = 0; 
    526526    private boolean firstElement = true; 
     527    private boolean dcroiOpen = false; 
     528 
     529    public void endElement(String uri, String localName, String qName) { 
     530      if (qName.equals("Element")) { 
     531        if (dcroiOpen) { 
     532          dcroiOpen = false; 
     533          return; 
     534        } 
     535        if (fullSeries.indexOf("/") != -1) { 
     536          fullSeries = fullSeries.substring(0, fullSeries.lastIndexOf("/")); 
     537        } 
     538        else fullSeries = "";  
     539      }  
     540    }  
    527541 
    528542    public void startElement(String uri, String localName, String qName, 
     
    533547          series = attributes.getValue("Name"); 
    534548          containerNames.add(series);  
     549          if (fullSeries == null || fullSeries.equals("")) fullSeries = series; 
     550          else fullSeries += "/" + series; 
    535551        } 
    536552        else if (firstElement) firstElement = false;  
     553         
     554        if (attributes.getValue("Name").equals("DCROISet")) { 
     555          dcroiOpen = true; 
     556        } 
    537557      } 
    538558      else if (qName.equals("Experiment")) { 
     
    546566          containerCounts.add(new Integer(1)); 
    547567        } 
    548         else { 
     568        else if (containerCounts.size() > 0) { 
    549569          int ndx = containerCounts.size() - 1; 
    550570          int n = ((Integer) containerCounts.get(ndx)).intValue(); 
    551571          containerCounts.setElementAt(new Integer(n + 1), ndx); 
    552572        } 
    553         fullSeries = containerNames.get(containerNames.size() - 1) +  
    554           "/" + series; 
     573        if (fullSeries == null || fullSeries.equals("")) fullSeries = series; 
    555574        seriesNames.add(fullSeries);  
    556575      } 
Note: See TracChangeset for help on using the changeset viewer.