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
Pipeline #13631 failed with stages
in 4 minutes and 59 seconds
......@@ -18,13 +18,7 @@ import java.util.HashMap;
import java.util.Map;
import javax.imageio.ImageIO;
import javax.swing.DefaultListCellRenderer;
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 javax.swing.*;
import org.apache.commons.lang.StringUtils;
import org.scijava.command.Command;
......@@ -146,22 +140,26 @@ public class BigDataBrowserPlugIn implements Command
list.addMouseListener( new MouseAdapter()
{
@Override
public void mouseClicked( final MouseEvent evt )
{
final JList< ? > list = ( JList< ? > ) evt.getSource();
if ( evt.getClickCount() == 2 )
{
final int index = list.locationToIndex( evt.getPoint() );
final String key = String.valueOf( list.getModel().getElementAt( index ) );
System.out.println( key );
try
{
final String filename = datasetUrlMap.get( key );
final String title = new File( filename ).getName();
BigDataViewer.open( filename, title, new ProgressWriterIJ(), ViewerOptions.options() );
}
catch ( final SpimDataException e )
{
public void mouseClicked(final MouseEvent evt) {
final JList<?> list = (JList<?>) evt.getSource();
if (evt.getClickCount() == 2) {
final int index = list.locationToIndex(evt.getPoint());
final String key = String.valueOf(list.getModel().getElementAt(index));
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 title = new File(filename).getName();
BigDataViewer.open(filename, title, new ProgressWriterIJ(), ViewerOptions.options());
} catch (final SpimDataException e) {
e.printStackTrace();
}
}
......@@ -191,12 +189,12 @@ public class BigDataBrowserPlugIn implements Command
final JList< ? > list, final Object value, final int index,
final boolean isSelected, final boolean cellHasFocus )
{
final JLabel label = ( JLabel ) super.getListCellRendererComponent(
list, value, index, isSelected, cellHasFocus );
label.setIcon( imageMap.get( value ) );
label.setHorizontalTextPosition( JLabel.RIGHT );
label.setFont( font );
return label;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment