Skip to content
Snippets Groups Projects
Commit 00b1f34a authored by Vojtech Moravec's avatar Vojtech Moravec
Browse files

Add "Enable QCMP?" dialog when double clicking dataset.

This QCMP options should be eventually moved to the dataset list. This
is kinda annoying dialog and won't be left very long.
parent fc1651f1
No related branches found
No related tags found
No related merge requests found
Pipeline #13631 failed
...@@ -18,13 +18,7 @@ import java.util.HashMap; ...@@ -18,13 +18,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.swing.DefaultListCellRenderer; import javax.swing.*;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.scijava.command.Command; import org.scijava.command.Command;
...@@ -146,22 +140,26 @@ public class BigDataBrowserPlugIn implements Command ...@@ -146,22 +140,26 @@ public class BigDataBrowserPlugIn implements Command
list.addMouseListener( new MouseAdapter() list.addMouseListener( new MouseAdapter()
{ {
@Override @Override
public void mouseClicked( final MouseEvent evt ) public void mouseClicked(final MouseEvent evt) {
{
final JList<?> list = (JList<?>) evt.getSource(); final JList<?> list = (JList<?>) evt.getSource();
if ( evt.getClickCount() == 2 ) if (evt.getClickCount() == 2) {
{
final int index = list.locationToIndex(evt.getPoint()); final int index = list.locationToIndex(evt.getPoint());
final String key = String.valueOf(list.getModel().getElementAt(index)); final String key = String.valueOf(list.getModel().getElementAt(index));
System.out.println( key );
try final int qcmpDialogResult = JOptionPane.showConfirmDialog(null,
{ String.format("Enable QCMP compression for %s", key),
"QCMP compression",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null);
final boolean enableQcmp = qcmpDialogResult == JOptionPane.YES_OPTION;
System.out.printf("%s, qcmp: %s\n", key, (enableQcmp ? "Enabled" : "Disabled"));
try {
final String filename = datasetUrlMap.get(key); final String filename = datasetUrlMap.get(key);
final String title = new File(filename).getName(); final String title = new File(filename).getName();
BigDataViewer.open(filename, title, new ProgressWriterIJ(), ViewerOptions.options()); BigDataViewer.open(filename, title, new ProgressWriterIJ(), ViewerOptions.options());
} } catch (final SpimDataException e) {
catch ( final SpimDataException e )
{
e.printStackTrace(); e.printStackTrace();
} }
} }
...@@ -191,12 +189,12 @@ public class BigDataBrowserPlugIn implements Command ...@@ -191,12 +189,12 @@ public class BigDataBrowserPlugIn implements Command
final JList< ? > list, final Object value, final int index, final JList< ? > list, final Object value, final int index,
final boolean isSelected, final boolean cellHasFocus ) final boolean isSelected, final boolean cellHasFocus )
{ {
final JLabel label = ( JLabel ) super.getListCellRendererComponent( final JLabel label = ( JLabel ) super.getListCellRendererComponent(
list, value, index, isSelected, cellHasFocus ); list, value, index, isSelected, cellHasFocus );
label.setIcon( imageMap.get( value ) ); label.setIcon( imageMap.get( value ) );
label.setHorizontalTextPosition( JLabel.RIGHT ); label.setHorizontalTextPosition( JLabel.RIGHT );
label.setFont( font ); label.setFont( font );
return label; return label;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment