JAL-1780 Export settings for flatfile output
[jalview.git] / src / jalview / gui / AlignExportSettings.java
diff --git a/src/jalview/gui/AlignExportSettings.java b/src/jalview/gui/AlignExportSettings.java
new file mode 100644 (file)
index 0000000..fe7c940
--- /dev/null
@@ -0,0 +1,115 @@
+package jalview.gui;
+
+import java.awt.event.ActionEvent;
+
+import javax.swing.JDialog;
+import javax.swing.JInternalFrame;
+import javax.swing.JOptionPane;
+
+import jalview.api.AlignExportSettingI;
+import jalview.jbgui.GAlignExportSettings;
+
+@SuppressWarnings("serial")
+public class AlignExportSettings extends GAlignExportSettings implements
+        AlignExportSettingI
+{
+  protected JInternalFrame frame;
+
+  boolean cancelled = false;
+
+  private int width = 450;
+
+  private int height = 200;
+
+  JDialog dialog;
+
+  public AlignExportSettings(boolean hasHiddenSeq, boolean hasHiddenCols,
+          String alignFileFormat)
+  {
+    super(hasHiddenSeq, hasHiddenCols, alignFileFormat);
+
+    // frame = new JInternalFrame();
+    // frame.setContentPane(this);
+    // frame.setLayer(JLayeredPane.PALETTE_LAYER);
+    // Desktop.addInternalFrame(frame, "Export Settings", width, height);
+
+    JOptionPane pane = new JOptionPane(null, JOptionPane.DEFAULT_OPTION,
+            JOptionPane.DEFAULT_OPTION, null, new Object[]
+            { this });
+    dialog = pane.createDialog(Desktop.desktop, "Export Settings");
+
+    // dialog = new JDialog(Desktop.instance, true);
+    // dialog.setTitle("Export Settings");
+
+    dialog.pack();
+    dialog.setVisible(true);
+
+    dialog.setContentPane(this);
+    dialog.validate();
+
+  }
+
+  // public static void main(String[] args)
+  // {
+  // new AlignExportSettings(false, false, false);
+  // }
+
+  // public void cancel_actionPerformed(ActionEvent e)
+  // {
+    // try
+    // {
+    // frame.setClosed(true);
+    // } catch (Exception ex)
+    // {
+    // }
+  // }
+
+  public void ok_actionPerformed(ActionEvent e)
+  {
+    cancelled = false;
+    dialog.setVisible(false);
+  }
+
+  public void cancel_actionPerformed(ActionEvent e)
+  {
+    cancelled = true;
+    dialog.setVisible(false);
+  }
+
+  @Override
+  public boolean isExportHiddenSequences()
+  {
+    return chkHiddenSeqs.isSelected();
+  }
+
+  @Override
+  public boolean isExportHiddenColumns()
+  {
+    return chkHiddenCols.isSelected();
+  }
+
+  @Override
+  public boolean isExportAnnotations()
+  {
+    return chkExportAnnots.isSelected();
+  }
+
+  @Override
+  public boolean isExportFeatures()
+  {
+    return chkExportFeats.isSelected();
+  }
+
+  @Override
+  public boolean isExportGroups()
+  {
+    return chkExportGrps.isSelected();
+  }
+
+  @Override
+  public boolean isCancelled()
+  {
+    return cancelled;
+  }
+
+}