• Views
  • Iteration Report
  • My Iteration Report
  •  
OMERO.server
  • Login
  • Help/Guide
  • About Trac
  • Preferences
  • Wiki
  • Timeline
  • Roadmap
  • Browse Source
  • View Tickets
  • Search

Context Navigation

  • ← Previous Change
  • Next Change →

Changeset 1072 for branches/bioformats-omero

Show
Ignore:
Timestamp:
11/10/06 10:40:46 (2 years ago)
Author:
TheBrain
Message:

- Changed the way the splashscreen and about box works, centralizing the resources and planning for some
future development.
- Fixed a bug which prevented the partial name filter from working under windows
- changed all \ slashes / slashed in file path names. This was done to help homogenize file names used within
omero and facilitate sort-by-name and future search features
- changed the name of sevaral terms used in the importer to clarify their meaning.

Location:
branches/bioformats-omero/src/ome/formats/importer
Files:
6 modified

  • About.java (modified) (1 diff)
  • FileQueueHandler.java (modified) (3 diffs)
  • FileQueueTable.java (modified) (1 diff)
  • ImportDialog.java (modified) (6 diffs)
  • Main.java (modified) (4 diffs)
  • Splasher.java (modified) (1 diff)

Legend:

Unmodified
Added
Removed
  • branches/bioformats-omero/src/ome/formats/importer/About.java

    r1066 r1072  
    5454    private static String msg; 
    5555 
    56     public static void show(Component c) 
     56    public static void show(Component c, boolean useSplashScreen) 
    5757    { 
    5858 
    59 //        SplashWindow.splash(Splasher.class.getResource("gfx/Splash.png")); 
     59        if (useSplashScreen == true) 
     60        { 
     61            SplashWindow.splash(Splasher.class.getResource(Main.splash)); 
     62        } else 
     63        { 
    6064 
    61         if (title == null) 
    62         { 
    63             StringBuffer sb = new StringBuffer(); 
    64             try 
     65            if (title == null) 
    6566            { 
    66                 InputStream is = About.class.getResourceAsStream("about.txt"); 
    67                 if (is == null) 
     67                StringBuffer sb = new StringBuffer(); 
     68                try 
    6869                { 
    69                     title = "About"; 
    70                     msg = "Error: version information not found"; 
    71                 } else 
     70                    InputStream is = About.class.getResourceAsStream("about.txt"); 
     71                    if (is == null) 
     72                    { 
     73                        title = "About"; 
     74                        msg = "Error: version information not found"; 
     75                    } else 
     76                    { 
     77                        BufferedReader in = new BufferedReader( 
     78                                new InputStreamReader(is)); 
     79                        while (true) 
     80                        { 
     81                            String line = in.readLine(); 
     82                            if (line == null) break; 
     83                            if (title == null) title = "About " + line; 
     84                            else 
     85                                sb.append("\n"); 
     86                            sb.append(line); 
     87                        } 
     88                        in.close(); 
     89                        msg = sb.toString(); 
     90                    } 
     91                } catch (IOException exc) 
    7292                { 
    73                     BufferedReader in = new BufferedReader( 
    74                             new InputStreamReader(is)); 
    75                     while (true) 
    76                     { 
    77                         String line = in.readLine(); 
    78                         if (line == null) break; 
    79                         if (title == null) title = "About " + line; 
    80                         else 
    81                             sb.append("\n"); 
    82                         sb.append(line); 
    83                     } 
    84                     in.close(); 
    85                     msg = sb.toString(); 
     93                    if (title == null) title = "About"; 
     94                    msg = "Error: could not read version information"; 
    8695                } 
    87             } catch (IOException exc) 
    88             { 
    89                 if (title == null) title = "About"; 
    90                 msg = "Error: could not read version information"; 
    9196            } 
     97            JOptionPane.showMessageDialog(c, msg, title, 
     98                    JOptionPane.INFORMATION_MESSAGE);     
    9299        } 
    93         JOptionPane.showMessageDialog(c, msg, title, 
    94                 JOptionPane.INFORMATION_MESSAGE); 
    95100    } 
    96101 
    97102    public static void main(String[] args) 
    98103    { 
    99         show(null); 
     104        show(null, false); 
    100105        System.exit(0); 
    101106    } 
  • branches/bioformats-omero/src/ome/formats/importer/FileQueueHandler.java

    r1066 r1072  
    300300    private String getImageName(File file, Boolean useFullPath, int numOfDirectories) 
    301301    { 
    302        if (useFullPath == true) return file.toString(); 
     302       // standardize the format of files from window '\' to unix '/'  
     303       String path = file.getAbsolutePath().replace( '\\', '/' ); 
     304         
     305       if (useFullPath == true) return path; 
    303306       else if (numOfDirectories == 0) return file.getName();       
    304307       else  
    305308       { 
    306            String[] directories = splitDirectories(file); 
     309           String[] directories = splitDirectories(path); 
    307310           if (numOfDirectories > directories.length - 1)  
    308311               numOfDirectories = directories.length - 1; 
    … …  
    314317           for (int i = start; i < directories.length - 1; i++) 
    315318           { 
     319               //viewer.appendToDebugLn(directories[i]); 
    316320               if (directories[i].length() != 0) 
    317                    fileName = fileName + File.separator + directories[i]; 
     321               { 
     322                   if (i == start) 
     323                   { 
     324                       fileName = directories[i]; 
     325                   } else 
     326                   { 
     327                       fileName = fileName + "/" + directories[i];                        
     328                   } 
     329               } 
    318330           } 
    319331 
    320            fileName = fileName + File.separator + file.getName();            
     332           fileName = fileName + "/" + file.getName();   
     333            
    321334           return fileName; 
    322335       } 
    … …  
    324337 
    325338    // Split the directories by file seperator character ("/" or "\") 
    326     private String[] splitDirectories(File file) 
    327     { 
    328         String[] fields = file.getAbsolutePath().split(File.separator); 
     339    private String[] splitDirectories(String path) 
     340    { 
     341        //viewer.appendToDebugLn(path); 
     342        String[] fields = path.split("/"); 
     343        Integer length = fields.length; 
     344        //viewer.appendToDebugLn(length.toString()); 
     345        
    329346         
    330347        return fields; 
  • branches/bioformats-omero/src/ome/formats/importer/FileQueueTable.java

    r1066 r1072  
    188188    public void setProgressPrepping(int row) 
    189189    { 
    190         table.setValueAt("prepping", row, 2);  
     190        table.setValueAt("importing", row, 2);  
    191191    } 
    192192 
  • branches/bioformats-omero/src/ome/formats/importer/ImportDialog.java

    r1066 r1072  
    3838import java.awt.event.ActionEvent; 
    3939import java.awt.event.ActionListener; 
     40import java.awt.event.FocusEvent; 
     41import java.awt.event.FocusListener; 
    4042import java.text.NumberFormat; 
    4143import java.text.ParseException; 
    … …  
    6769import javax.swing.text.StyledDocument; 
    6870 
     71import org.apache.commons.logging.Log; 
     72import org.apache.commons.logging.LogFactory; 
     73 
    6974import ome.formats.OMEROMetadataStore; 
    7075import ome.model.containers.Dataset; 
    … …  
    100105 
    101106    public boolean    cancelled = true; 
     107     
     108    /** Logger for this class. */ 
     109    @SuppressWarnings("unused") 
     110    private static Log          log     = LogFactory.getLog(ImportDialog.class); 
    102111     
    103112    public OMEROMetadataStore store; 
    … …  
    155164        namedPanel.add(partPathButton, c); 
    156165 
    157        JPanel plainPanel = addPlainPanel(namedPanel, c); 
     166        JPanel plainPanel = addPlainPanel(namedPanel, c); 
    158167        numOfDirectoriesField = addEntryField(plainPanel,  
    159                 "" , "0", " leading directories", 0,  
    160                 "Add this number of leading directories to the file names", 
     168                "" , "0", " directories", 0,  
     169                "Add this number of directories to the file names", 
    161170                3); 
    162171         
    163          
    164         archiveImage = addCheckBox(this, "Also store the original image file(s)", c); 
     172//        // focus on the partial path button if you enter the numofdirfield 
     173//        numOfDirectoriesField.addFocusListener(new FocusListener() { 
     174//            public void focusGained(FocusEvent e) { 
     175//                partPathButton.setSelected(true); 
     176//            } 
     177// 
     178//            public void focusLost(FocusEvent e) {} 
     179//        }); 
     180         
     181        archiveImage = addCheckBox(this, "Also archive the original image file(s)", c); 
    165182        archiveImage.setSelected(true); 
    166183         
    … …  
    435452        { 
    436453            cancelled = false; 
     454            importBtn.requestFocus(); 
    437455            numOfDirectories = numOfDirectoriesField.getValue(); 
    438456            dataset = ((DatasetItem) dbox.getSelectedItem()).getDataset(); 
    … …  
    548566                } 
    549567                super.insertString(offs, new String(result, 0, j), a); 
     568                 
     569                 
    550570            } 
     571             
    551572        } 
    552573 
  • branches/bioformats-omero/src/ome/formats/importer/Main.java

    r1066 r1072  
    7676    /** The data of the last release date. */ 
    7777    public static String        releaseDate       
    78          = "2006-10-31 15:49:07 +0000 (Tue, 31 Oct 2006)"; 
     78         = "2006-11-06 13:06:59 +0000 (Mon, 06 Nov 2006)"; 
    7979 
    8080    /** The repository revision. */ 
    … …  
    9292    // -- Constants -- 
    9393 
    94     private final static String TITLE            = "OMERO Data Importer"; 
    95      
     94    private final static String TITLE            = "OMERO Importer"; 
     95    public final static String splash           = "gfx/Splash.png"; 
     96    private final static boolean useSplashScreenAbout   = false; 
     97      
    9698    private final static int width = 980; 
    9799    private final static int height = 580; 
    … …  
    278280    } 
    279281 
     282    /** 
     283     * @param s This method appends data to the output window. 
     284     */ 
     285    public void appendToDebug(String s) 
     286    { 
     287        try 
     288        { 
     289            StyledDocument doc = (StyledDocument) debugTextPane.getDocument(); 
     290            Style style = doc.addStyle("StyleName", null); 
     291            StyleConstants.setForeground(style, Color.black); 
     292            StyleConstants.setFontFamily(style, "SansSerif"); 
     293            StyleConstants.setFontSize(style, 12); 
     294            StyleConstants.setBold(style, false); 
     295 
     296            doc.insertString(doc.getLength(), s, style); 
     297        } catch (BadLocationException e) {} 
     298    } 
     299 
     300    /** 
     301     * @param s Append to the output window and add a line return 
     302     */ 
     303    public void appendToDebugLn(String s) 
     304    { 
     305        appendToDebug(s + "\n"); 
     306    } 
     307     
    280308    public void actionPerformed(ActionEvent e) 
    281309    { 
    … …  
    306334            // HACK - JOptionPane prevents shutdown on dispose 
    307335            setDefaultCloseOperation(EXIT_ON_CLOSE); 
    308             About.show(this.getContentPane()); 
     336            About.show(this.getContentPane(), useSplashScreenAbout); 
    309337        } 
    310338    } 
  • branches/bioformats-omero/src/ome/formats/importer/Splasher.java

    r1043 r1072  
    4848         
    4949 
    50         SplashWindow.splash(Splasher.class.getResource("gfx/Splash.png")); 
     50        SplashWindow.splash(Splasher.class.getResource(Main.splash)); 
    5151        try 
    5252        { 

Download in other formats:

  • Unified Diff
  • Zip Archive

Trac Powered

Powered by Trac 0.11
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/