/*
 * SaveAsDialog.java
 *
 * Created on March 28, 2002, 2:44 PM
 */

package jas2.hist;
import jas2.util.Application;
import jas2.util.JASDialog;
import jas2.util.JASState;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.Vector;

import javax.swing.DefaultListCellRenderer;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
//FREEHEP 
import org.freehep.graphics2d.VectorGraphics;
import org.freehep.graphicsbase.util.export.*;


/**
 *
 * @author tonyj
 * @version $Id: SaveAsDialog.java 11553 2007-06-05 22:06:23Z duns $
 */
// public class SaveAsDialog extends JASDialog implements ActionListener
public class SaveAsDialog implements ActionListener
{ 
   /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
private static Vector list = new Vector();
   private static Properties props;
   
   private static final String rootKey = "HplotJas";
  private static final String SAVE_AS_TYPE = rootKey +".SaveAsType";
  private static final String SAVE_AS_FILE = rootKey +".SaveAsFile";

  
  /*
   static
   {      
       Application app = Application.getApplication();
       if (app != null) props = app.getUserProperties();
       else props = new Properties();

       String prop = "org.freehep.graphics2d.exportchooser.EPS_PSExportFileType.EmbedFonts";
       String embed = props.getProperty(prop);
       if (embed == null) props.setProperty(prop,"Embed unknown as Type3");
       
       register(new SaveAsPlotML());
       register(new SaveAsGIF());
   }
   */
   
  
   public static void register(SaveAsPlugin plugin)
   {
  //    list.addElement(plugin);
  //    plugin.restoreOptions(props);
   }
   
   /** Creates a new instance of SaveAsDialog */
   public SaveAsDialog(Component c)
   {
	   
	//  super((Frame) SwingUtilities.getAncestorOfClass(Frame.class,c),"Image was saved",false,JASDialog.OK_BUTTON);
      this.component = c;
   
      
      /**
       * Exports the image to some graphic format.
       */


              ExportDialog export = new ExportDialog();
          export.showExportDialog(this.component, "Export image as ...",
        		  this.component, "hplotjas");


      }

      
      /*
      JPanel pane = new JPanel();
      pane.setLayout(new GridBagLayout());
      
      GridBagConstraints gridBagConstraints = new GridBagConstraints();
      gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
      gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
      pane.add(file, gridBagConstraints);

      gridBagConstraints.fill = 1;
      gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
      pane.add(browse, gridBagConstraints);

      Vector fileTypes = new Vector();
      for (int i=0; i0);
   }
   private JButton browse = new JButton("Browse...");
   private JButton advanced = new JButton("Options...");
   private JTextField file = new JTextField(40);
   private JComboBox type;
   private Component component;
   
   private class SaveAsRenderer extends DefaultListCellRenderer
   {
      
	   /*
	   public Component getListCellRendererComponent(JList list,
                                              Object value,
                                              int index,
                                              boolean isSelected,
                                              boolean cellHasFocus)
      {
         super.getListCellRendererComponent(list,value,index,isSelected,cellHasFocus);
         if (value instanceof SaveAsPlugin)
         {
            this.setText(((SaveAsPlugin) value).getFileFilter().getDescription());
         }
         return this;
      }
      */
   }
}

 

Ads help maintain this website.