Changeset 1072 for branches/bioformats-omero
- Timestamp:
- 11/10/06 10:40:46 (2 years ago)
- 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 54 54 private static String msg; 55 55 56 public static void show(Component c )56 public static void show(Component c, boolean useSplashScreen) 57 57 { 58 58 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 { 60 64 61 if (title == null) 62 { 63 StringBuffer sb = new StringBuffer(); 64 try 65 if (title == null) 65 66 { 66 InputStream is = About.class.getResourceAsStream("about.txt");67 if (is == null)67 StringBuffer sb = new StringBuffer(); 68 try 68 69 { 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) 72 92 { 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"; 86 95 } 87 } catch (IOException exc)88 {89 if (title == null) title = "About";90 msg = "Error: could not read version information";91 96 } 97 JOptionPane.showMessageDialog(c, msg, title, 98 JOptionPane.INFORMATION_MESSAGE); 92 99 } 93 JOptionPane.showMessageDialog(c, msg, title,94 JOptionPane.INFORMATION_MESSAGE);95 100 } 96 101 97 102 public static void main(String[] args) 98 103 { 99 show(null );104 show(null, false); 100 105 System.exit(0); 101 106 } -
branches/bioformats-omero/src/ome/formats/importer/FileQueueHandler.java
r1066 r1072 300 300 private String getImageName(File file, Boolean useFullPath, int numOfDirectories) 301 301 { 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; 303 306 else if (numOfDirectories == 0) return file.getName(); 304 307 else 305 308 { 306 String[] directories = splitDirectories( file);309 String[] directories = splitDirectories(path); 307 310 if (numOfDirectories > directories.length - 1) 308 311 numOfDirectories = directories.length - 1; … … 314 317 for (int i = start; i < directories.length - 1; i++) 315 318 { 319 //viewer.appendToDebugLn(directories[i]); 316 320 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 } 318 330 } 319 331 320 fileName = fileName + File.separator + file.getName(); 332 fileName = fileName + "/" + file.getName(); 333 321 334 return fileName; 322 335 } … … 324 337 325 338 // 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 329 346 330 347 return fields; -
branches/bioformats-omero/src/ome/formats/importer/FileQueueTable.java
r1066 r1072 188 188 public void setProgressPrepping(int row) 189 189 { 190 table.setValueAt(" prepping", row, 2);190 table.setValueAt("importing", row, 2); 191 191 } 192 192 -
branches/bioformats-omero/src/ome/formats/importer/ImportDialog.java
r1066 r1072 38 38 import java.awt.event.ActionEvent; 39 39 import java.awt.event.ActionListener; 40 import java.awt.event.FocusEvent; 41 import java.awt.event.FocusListener; 40 42 import java.text.NumberFormat; 41 43 import java.text.ParseException; … … 67 69 import javax.swing.text.StyledDocument; 68 70 71 import org.apache.commons.logging.Log; 72 import org.apache.commons.logging.LogFactory; 73 69 74 import ome.formats.OMEROMetadataStore; 70 75 import ome.model.containers.Dataset; … … 100 105 101 106 public boolean cancelled = true; 107 108 /** Logger for this class. */ 109 @SuppressWarnings("unused") 110 private static Log log = LogFactory.getLog(ImportDialog.class); 102 111 103 112 public OMEROMetadataStore store; … … 155 164 namedPanel.add(partPathButton, c); 156 165 157 JPanel plainPanel = addPlainPanel(namedPanel, c);166 JPanel plainPanel = addPlainPanel(namedPanel, c); 158 167 numOfDirectoriesField = addEntryField(plainPanel, 159 "" , "0", " leadingdirectories", 0,160 "Add this number of leadingdirectories to the file names",168 "" , "0", " directories", 0, 169 "Add this number of directories to the file names", 161 170 3); 162 171 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); 165 182 archiveImage.setSelected(true); 166 183 … … 435 452 { 436 453 cancelled = false; 454 importBtn.requestFocus(); 437 455 numOfDirectories = numOfDirectoriesField.getValue(); 438 456 dataset = ((DatasetItem) dbox.getSelectedItem()).getDataset(); … … 548 566 } 549 567 super.insertString(offs, new String(result, 0, j), a); 568 569 550 570 } 571 551 572 } 552 573 -
branches/bioformats-omero/src/ome/formats/importer/Main.java
r1066 r1072 76 76 /** The data of the last release date. */ 77 77 public static String releaseDate 78 = "2006-1 0-31 15:49:07 +0000 (Tue, 31 Oct2006)";78 = "2006-11-06 13:06:59 +0000 (Mon, 06 Nov 2006)"; 79 79 80 80 /** The repository revision. */ … … 92 92 // -- Constants -- 93 93 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 96 98 private final static int width = 980; 97 99 private final static int height = 580; … … 278 280 } 279 281 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 280 308 public void actionPerformed(ActionEvent e) 281 309 { … … 306 334 // HACK - JOptionPane prevents shutdown on dispose 307 335 setDefaultCloseOperation(EXIT_ON_CLOSE); 308 About.show(this.getContentPane() );336 About.show(this.getContentPane(), useSplashScreenAbout); 309 337 } 310 338 } -
branches/bioformats-omero/src/ome/formats/importer/Splasher.java
r1043 r1072 48 48 49 49 50 SplashWindow.splash(Splasher.class.getResource( "gfx/Splash.png"));50 SplashWindow.splash(Splasher.class.getResource(Main.splash)); 51 51 try 52 52 {
