Changeset 9150


Ignore:
Timestamp:
2005-02-23T14:06:11+13:00 (19 years ago)
Author:
kjdon
Message:

moved internal class ResultDialog out form ExportCOllectionPrompt into its own class, SimpleREsultDialog, so can use it for other things.

Location:
trunk/gli/src/org/greenstone/gatherer/gui
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gli/src/org/greenstone/gatherer/gui/ExportCollectionPrompt.java

    r9045 r9150  
    288288    //process.run();
    289289    DebugStream.println("ExportCollectionPrompt.exportCollection().return");
     290   
    290291    }
    291292
     
    313314        args[1] += "exported_"+cd_title.replaceAll("\\s","");
    314315    }
    315     ResultDialog result_dialog = new ResultDialog(success, extra, args);
     316    String title;
     317    String label;
     318    if (success) {
     319        title = Dictionary.get("ExportCollectionPrompt.Successful_Title");
     320        label = Dictionary.get("ExportCollectionPrompt.Successful_Export", args);
     321    } else {
     322        title = Dictionary.get("ExportCollectionPrompt.Failed_Title");
     323        label = Dictionary.get("ExportCollectionPrompt.Failed_Export", args);
     324    }
     325    SimpleResultDialog result_dialog = new SimpleResultDialog(title, label, extra);
    316326    result_dialog.setVisible(true); // Blocks
    317327    result_dialog.dispose();
    318328    result_dialog = null;
    319     /*
    320     if (success) {
    321         JOptionPane.showMessageDialog(prompt,Dictionary.get("ExportCollectionPrompt.Successful_Export", args)+"\n\n"+Dictionary.get("ExportCollectionPrompt.Output")+"\n"+extra, Dictionary.get("ExportCollectionPrompt.Successful_Title"),JOptionPane.INFORMATION_MESSAGE);
    322     }
    323     else {
    324         JOptionPane.showMessageDialog(prompt,Dictionary.get("ExportCollectionPrompt.Failed_Export", args)+"\n\n"+Dictionary.get("ExportCollectionPrompt.Output")+"\n"+extra, Dictionary.get("ExportCollectionPrompt.Failed_Title"),JOptionPane.WARNING_MESSAGE);
    325     }
    326     */
    327329    }
    328330
     
    509511    }
    510512
    511     private class ResultDialog
    512     extends ModalDialog {
    513    
    514     private Dimension size = new Dimension(600,300);
    515     private ResultDialog self;
    516 
    517     public ResultDialog(boolean success, String extra, String [] args) {
    518         super(Gatherer.g_man, Dictionary.get("ExportCollectionPrompt.Successful_Title"), true);
    519 
    520         this.self = this;
    521 
    522         setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    523         setSize(size);
    524        
    525         JPanel content_pane = (JPanel) getContentPane();
    526         JLabel result_label = new JLabel();
    527         if(success) {
    528         Dictionary.registerText(result_label, "ExportCollectionPrompt.Successful_Export", args);
    529         }
    530         else {
    531         Dictionary.registerText(result_label, "ExportCollectionPrompt.Failed_Export", args);
    532         }
    533 
    534         JPanel button_pane = new JPanel();
    535         JButton close_button = new GLIButton("Close");
    536         close_button.setMnemonic(KeyEvent.VK_C);
    537         close_button.addActionListener(new CloseButtonListener());
    538 
    539         JPanel output_pane = new JPanel();
    540         JLabel output_label = new JLabel();
    541         Dictionary.registerText(output_label, "ExportCollectionPrompt.Output");
    542 
    543         JTextArea output_textarea = new JTextArea(extra);
    544         output_textarea.setCaretPosition(0);
    545         output_textarea.setEditable(false);
    546         output_textarea.setLineWrap(true);
    547         output_textarea.setWrapStyleWord(true);
    548        
    549         button_pane.setLayout(new BorderLayout());
    550         button_pane.add(close_button, BorderLayout.EAST);
    551 
    552         output_pane.setBorder(BorderFactory.createEmptyBorder(5,0,5,0));
    553         output_pane.setLayout(new BorderLayout());
    554         output_pane.add(output_label, BorderLayout.NORTH);
    555         output_pane.add(new JScrollPane(output_textarea), BorderLayout.CENTER);
    556 
    557         content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    558         content_pane.setLayout(new BorderLayout());
    559         content_pane.add(result_label, BorderLayout.NORTH);
    560         content_pane.add(output_pane, BorderLayout.CENTER);
    561         content_pane.add(button_pane, BorderLayout.SOUTH);
    562 
    563         // Position
    564         Rectangle frame_bounds = Gatherer.g_man.getBounds();
    565         setLocation(frame_bounds.x + (frame_bounds.width - size.width) / 2, frame_bounds.y + (frame_bounds.height - size.height) / 2);
    566     }
    567 
    568     private class CloseButtonListener
    569         implements ActionListener {
    570         public void actionPerformed(ActionEvent event) {
    571         self.setVisible(false);
    572         }
    573     }
    574     }
     513
    575514}
    576515
Note: See TracChangeset for help on using the changeset viewer.