public void showFilePopupMenu(JButton fileOperations, boolean layoutsaving) {

        JPopupMenu menu = new JPopupMenu();
        JMenuItem item = new JMenuItem("Export Graph As JPEG");
        item.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
                JFileChooser chooser = new JFileChooser();

                if (chooser.showSaveDialog(getContentPane()) == JFileChooser.APPROVE_OPTION) {
                    String name = chooser.getSelectedFile().toString();

                    if (!name.endsWith(".jpg")) name = name + ".jpg";
                    JPGIOHandler ioh = new JPGIOHandler();
                    //ioh.setQuality(1.0f);
                    try {
                        ioh.write(graphViewer.view.getGraph2D(), name);
                    } catch (IOException ioe) {
                        D.show(ioe);
                    }

                }
            }
        });
        menu.add(item);

        item = new JMenuItem("Visualize Graph from (BioPAX or SXG) file");
        item.addActionListener(new LoadAction(this));
        menu.add(item);

        //layout: JMenuItem Save Layout
        if (layoutsaving) {
            item = new JMenuItem("Save the layout information");
            item.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent evt) {
                    /* FOR DEBUG or BACKUP save it in a txt file
               JFileChooser chooser = new JFileChooser();
               if(chooser.showSaveDialog(getContentPane()) == JFileChooser.APPROVE_OPTION) {
                   String name = chooser.getSelectedFile().toString();
                   if(!name.endsWith(".txt")) {
                       name += ".txt";
                   }
                   try{
                       PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(name)));
                       pw.write(layoutInfo());
                       pw.close();
                       return;
                   }catch(IOException ioe) {
                       D.show(ioe);
                   }
                    }//*/

                    //TODO: move call to web methods to PathCaseServices
                    pool.submit(new Thread() {
                        public void run() {
                            String expandedPathwayGuids = (String) configuration.get("expandedPathwayGuids");
                            if (numberOfPathways() == 1) {
                                String lo = layoutInfo();
                                createLoaderDialog("Saving the layout information...");
                                try {
                                      boolean b ;
                                    if(valueOfcompartmentH.equalsIgnoreCase("true")){
                                        b = serviceM.getPathwaysServiceSoap().storeLayout2("", expandedPathwayGuids, "", "", lo, "dblabpathcase");
                                    }else b = service.getPathwaysServiceSoap().storeLayout("", expandedPathwayGuids, "", "", lo);

                                    if (!b) {
                                        throw new Exception("layout not stored");
                                    }
                                    killLoaderDialog();
                                    JOptionPane.showMessageDialog(null, "Layout has been successfully saved", "information", JOptionPane.INFORMATION_MESSAGE);
                                } catch (Exception e) {
                                    D.show(e);
                                }
                            } else {
                                JOptionPane.showMessageDialog(null, "Can only save layout for a single pathway", "information", JOptionPane.INFORMATION_MESSAGE);
                            }
                        }
                    });

                    //*/
                    //bool = service.getPathwaysServiceSoap().
                }
            });
            menu.add(item);
        }

        menu.show(fileOperations, 0, 15);
    }