Ignore:
Timestamp:
2009-01-12T11:40:15+13:00 (15 years ago)
Author:
kjdon
Message:

updated the rtl-gli branch with files from trunk. Result of a merge 14807:18318, and fixed some conflicts. I think this is the last commit following merging the files. Haven't tried to compile yet... here goes...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gli/branches/rtl-gli/src/org/greenstone/gatherer/gui/SimpleResultDialog.java

    r18297 r18364  
    4848
    4949public class SimpleResultDialog
    50     extends ModalDialog {
     50  extends ModalDialog {
    5151   
    52     private Dimension size = new Dimension(600,300);
    53     private SimpleResultDialog self;
     52  private Dimension size = new Dimension(600,300);
     53  private SimpleResultDialog self;
    5454   
    55     public SimpleResultDialog(String title, String label, String results) {
    56     super(Gatherer.g_man, title, true);
    57     this.self = this;
     55  public SimpleResultDialog(String title, String label, String results) {
     56    super(Gatherer.g_man, title, true);
     57    this.self = this;
    5858    this.setComponentOrientation(Dictionary.getOrientation());
    5959       
    60     setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    61     setSize(size);
     60    setUpGUI(label, results);
     61  }
     62
     63  /** If you are calling this from another dialog, and you want that dialog blocked while this is open, need to use this method, passing in the calling dialog as the parent */
     64  public SimpleResultDialog(Dialog parent, String title, String label, String results) {
     65
     66    super(parent, title, true);
     67    this.self = this;
     68 
     69    setUpGUI(label, results);
     70  }
     71
     72  private void setUpGUI(String label, String results) {
     73    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
     74    setSize(size);
    6275   
    63     JPanel content_pane = (JPanel) getContentPane();
    64         content_pane.setComponentOrientation(Dictionary.getOrientation());
    65     JLabel result_label = new JLabel(label);
    66         result_label.setComponentOrientation(Dictionary.getOrientation());
     76    JPanel content_pane = (JPanel) getContentPane();
     77    content_pane.setComponentOrientation(Dictionary.getOrientation());
     78    JLabel result_label = new JLabel(label);
     79    result_label.setComponentOrientation(Dictionary.getOrientation());
    6780   
    68     JPanel button_pane = new JPanel();
    69         button_pane.setComponentOrientation(Dictionary.getOrientation());
    70     JButton close_button = new GLIButton(Dictionary.get("General.Close"));
    71     close_button.addActionListener(new CloseButtonListener());
     81    JPanel button_pane = new JPanel();
     82    button_pane.setComponentOrientation(Dictionary.getOrientation());
     83    JButton close_button = new GLIButton(Dictionary.get("General.Close"));
     84    close_button.addActionListener(new CloseButtonListener());
    7285   
    73     JPanel output_pane = new JPanel();
    74         output_pane.setComponentOrientation(Dictionary.getOrientation());
    75     JLabel output_label = new JLabel(Dictionary.get("General.Review_Output"));
    76     output_label.setComponentOrientation(Dictionary.getOrientation());
    77     JTextArea output_textarea = new JTextArea(results);
    78         output_textarea.setComponentOrientation(Dictionary.getOrientation());
    79     output_textarea.setCaretPosition(0);
    80     output_textarea.setEditable(false);
    81     output_textarea.setLineWrap(true);
    82     output_textarea.setWrapStyleWord(true);
     86    JPanel output_pane = new JPanel();
     87    output_pane.setComponentOrientation(Dictionary.getOrientation());
     88    JLabel output_label = new JLabel(Dictionary.get("General.Review_Output"));
     89    output_label.setComponentOrientation(Dictionary.getOrientation());
     90
     91    JTextArea output_textarea = new JTextArea(results);
     92    output_textarea.setComponentOrientation(Dictionary.getOrientation());
     93    output_textarea.setCaretPosition(0);
     94    output_textarea.setEditable(false);
     95    output_textarea.setLineWrap(true);
     96    output_textarea.setWrapStyleWord(true);
    8397   
    84     button_pane.setLayout(new BorderLayout());
    85     button_pane.add(close_button, BorderLayout.LINE_END);
     98    button_pane.setLayout(new BorderLayout());
     99    button_pane.add(close_button, BorderLayout.LINE_END);
    86100   
    87     output_pane.setBorder(BorderFactory.createEmptyBorder(5,0,5,0));
    88     output_pane.setLayout(new BorderLayout());
    89     output_pane.add(output_label, BorderLayout.NORTH);
    90     output_pane.add(new JScrollPane(output_textarea), BorderLayout.CENTER);
     101    output_pane.setBorder(BorderFactory.createEmptyBorder(5,0,5,0));
     102    output_pane.setLayout(new BorderLayout());
     103    output_pane.add(output_label, BorderLayout.NORTH);
     104    output_pane.add(new JScrollPane(output_textarea), BorderLayout.CENTER);
    91105   
    92     content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    93     content_pane.setLayout(new BorderLayout());
    94     content_pane.add(result_label, BorderLayout.NORTH);
    95     content_pane.add(output_pane, BorderLayout.CENTER);
    96     content_pane.add(button_pane, BorderLayout.SOUTH);
     106    content_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
     107    content_pane.setLayout(new BorderLayout());
     108    content_pane.add(result_label, BorderLayout.NORTH);
     109    content_pane.add(output_pane, BorderLayout.CENTER);
     110    content_pane.add(button_pane, BorderLayout.SOUTH);
    97111   
    98     // Position
    99     Rectangle frame_bounds = Gatherer.g_man.getBounds();
    100     setLocation(frame_bounds.x + (frame_bounds.width - size.width) / 2, frame_bounds.y + (frame_bounds.height - size.height) / 2);
     112    // Position
     113    Rectangle frame_bounds = Gatherer.g_man.getBounds();
     114    setLocation(frame_bounds.x + (frame_bounds.width - size.width) / 2, frame_bounds.y + (frame_bounds.height - size.height) / 2);
     115    //new SimpleResultDialog(Gatherer.g_man, title, label, results);
     116  }
     117 
     118 
     119  private class CloseButtonListener
     120    implements ActionListener {
     121    public void actionPerformed(ActionEvent event) {
     122      self.setVisible(false);
    101123    }
    102    
    103     private class CloseButtonListener
    104     implements ActionListener {
    105     public void actionPerformed(ActionEvent event) {
    106         self.setVisible(false);
    107     }
    108     }
     124  }
    109125}
Note: See TracChangeset for help on using the changeset viewer.