From 59d0646a48e31e068c8410f545dda2ddba4701c4 Mon Sep 17 00:00:00 2001 From: Christian Tischer Date: Fri, 5 Jul 2024 13:28:06 +0200 Subject: [PATCH] Fixes issue when showing large tables --- pom.xml | 2 +- .../java/org/embl/mobie/lib/data/ImageGridSources.java | 7 ++++--- src/main/java/org/embl/mobie/lib/table/TableView.java | 4 +--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 856a03f2..6c75ff37 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ org.embl.mobie mobie-viewer-fiji - 5.1.3-SNAPSHOT + 5.1.5-SNAPSHOT diff --git a/src/main/java/org/embl/mobie/lib/data/ImageGridSources.java b/src/main/java/org/embl/mobie/lib/data/ImageGridSources.java index ea1f5ce4..a8d7e2cf 100644 --- a/src/main/java/org/embl/mobie/lib/data/ImageGridSources.java +++ b/src/main/java/org/embl/mobie/lib/data/ImageGridSources.java @@ -179,6 +179,7 @@ private void setMetadata( Integer channelIndex ) { // Take the first source to fetch metadata metadataSource = nameToFullPath.keySet().iterator().next(); + long start = System.currentTimeMillis(); IJ.log( "Fetching metadata for channel " + channelIndex + "..." ); IJ.log( "...from " + nameToFullPath.get( metadataSource ) ); // FIXME: Cache the image data, because for multiple images it is now reloaded! @@ -192,7 +193,7 @@ private void setMetadata( Integer channelIndex ) IJ.log( "Slices: " + metadata.numZSlices ); IJ.log( "Frames: " + metadata.numTimePoints ); - // determine contrast limits if affordable + // determine contrast limits, if affordable RandomAccessibleInterval< ? > lowResRAI = source.getSource( 0, source.getNumMipmapLevels() - 1 ); long numElements = Intervals.numElements( lowResRAI.dimensionsAsLongArray() ); if ( numElements < 1024 * 1024 ) @@ -202,11 +203,11 @@ private void setMetadata( Integer channelIndex ) } else { - IJ.log( "Image is too large => taking contrast limits from datatype..." ); + IJ.log( "Image is large, thus taking contrast limits from datatype range." ); } IJ.log( "Contrast limits: " + Arrays.toString( metadata.contrastLimits ) ); - + IJ.log( "Fetched metadata in " + ( System.currentTimeMillis() - start ) + " ms." ); } diff --git a/src/main/java/org/embl/mobie/lib/table/TableView.java b/src/main/java/org/embl/mobie/lib/table/TableView.java index c0d3f169..8572a8eb 100644 --- a/src/main/java/org/embl/mobie/lib/table/TableView.java +++ b/src/main/java/org/embl/mobie/lib/table/TableView.java @@ -111,7 +111,6 @@ public void close() public void show() { - // Prefetch the columns and wait a bit as this hopefully makes it less likely that // there are errors thrown by Java Swing when rendering the table window // below during frame.pack() @@ -168,13 +167,12 @@ private void configureJTable() { swingTableModel = new SwingTableModel( tableModel ); jTable = new JTable( swingTableModel ); - TableColumnModel columnModel = jTable.getColumnModel(); - TableColumn column = columnModel.getColumn( 0 ); jTable.updateUI(); jTable.setPreferredScrollableViewportSize( new Dimension( 500, 200 ) ); jTable.setFillsViewportHeight( true ); jTable.setAutoCreateRowSorter( true ); jTable.setRowSelectionAllowed( true ); + jTable.setAutoResizeMode( JTable.AUTO_RESIZE_OFF ); jTable.setSelectionMode( ListSelectionModel.SINGLE_SELECTION ); }