Changeset 2213


Ignore:
Timestamp:
02/02/07 18:08:17 (13 years ago)
Author:
chris
Message:

Notebook:
Added merger gui and some logic, but no merging actually
takes place as of yet. Also added checking for companion
files upon opening.

Location:
trunk/loci/ome/notebook
Files:
3 edited

Legend:

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

    r2208 r2213  
    166166    contentPanel.setLayout(new CardLayout()); 
    167167    contentPanel.setBorder((EmptyBorder) null); 
    168 //    metadata.setBorder(new EmptyBorder(0,0,0,0)); 
    169 //    mdp.setBorder(new EmptyBorder(0,0,0,0)); 
    170168    contentPanel.add("notebook", metadata); 
    171169    contentPanel.add("viewer", mdp); 
  • trunk/loci/ome/notebook/MetadataPane.java

    r2208 r2213  
    317317   
    318318  public void saveCompanionFile(File file) throws RuntimeException { 
    319     File compFile = new File(file.getPath() + ".meta"); 
     319    File compFile = new File(file.getPath() + ".ome"); 
    320320    try { 
    321321      thisOmeNode.writeOME(compFile, false); 
     
    358358 
    359359      OMENode ome = null; 
     360       
     361      boolean doMerge = false; 
    360362 
    361363      try { 
     
    366368        reader.setMetadataStore(ms); 
    367369        String id = file.getPath(); 
     370        File companionFile = new File(id + ".ome"); 
     371        if(companionFile.exists()) { 
     372          Object[] options = {"Sounds good", "No thanks"}; 
     373         
     374          int n = JOptionPane.showOptionDialog(getTopLevelAncestor(), 
     375            "We detected that an OME-xml companion file exists for" 
     376              + " the file you just opened,\n would you like to merge these" 
     377              + " files in some manner?", 
     378            "Companion File Detected", 
     379            JOptionPane.YES_NO_OPTION, 
     380            JOptionPane.QUESTION_MESSAGE, 
     381            (javax.swing.Icon)null, 
     382            options, 
     383            options[0]); 
     384          if (n == JOptionPane.YES_OPTION) doMerge = true; 
     385        } 
    368386 
    369387        int num = reader.getImageCount(id); 
     
    376394        thumb = ImageTools.scale(img, width, height, false); 
    377395        ome = (OMENode) ms.getRoot(); 
     396        if(doMerge) { 
     397          Merger merge = new Merger(ome,companionFile,this); 
     398          ome = merge.getRoot(); 
     399        } 
     400         
    378401        setOMEXML(ome); 
    379402      } 
  • trunk/loci/ome/notebook/NotePane.java

    r2178 r2213  
    112112    titlePanel.setBackground(TEXT_COLOR); 
    113113 
    114     chooser = new JFileChooser(System.getProperty("user.dir")); 
    115     chooser.setDialogTitle("Export Notes to Text File"); 
    116     chooser.setApproveButtonText("Save"); 
    117     chooser.setApproveButtonToolTipText("Export notes to " + 
    118       "selected file."); 
    119     chooser.setFileFilter(new TextFileFilter()); 
     114    SwingUtilities.invokeLater(new Runnable() { 
     115      public void run() { 
     116        chooser = new JFileChooser(System.getProperty("user.dir")); 
     117        chooser.setDialogTitle("Export Notes to Text File"); 
     118        chooser.setApproveButtonText("Save"); 
     119        chooser.setApproveButtonToolTipText("Export notes to " + 
     120          "selected file."); 
     121        chooser.setFileFilter(new TextFileFilter()); 
     122      } 
     123    }); 
    120124  } 
    121125 
Note: See TracChangeset for help on using the changeset viewer.