Ignore:
Timestamp:
2020-06-12T21:23:42+12:00 (4 years ago)
Author:
ak19
Message:

While trying to debug client-gli to remote issues, found some more bugs when connecting client-GLI against local remote server on same machine. While debugging that, am adding little improvements that make life easier for me (easy to forget though what I was actually trying to do). This commit now adds a scroll pane around the build log that is displayed in a JOptionPane when an error happens during building/activating a collection.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/remote/ActionQueue.java

    r18684 r34153  
    7979    }
    8080   
     81    // We often end up with giant blotted remote build error messages when things blow up
     82    // These messages appear in pop ups that take up the entire screen and we can't even see the OK button
     83    // This method therefore adds a scrollPane around error messages when displaying them.
     84    // https://alvinalexander.com/java/joptionpane-showmessagedialog-example-scrolling/
     85    private JScrollPane getMsgInScrollPane(String msg) {
     86    // create a JTextArea
     87    JTextArea textArea = new JTextArea(20, 70);
     88    textArea.setText(msg);
     89    textArea.setEditable(false);
     90    // wrap a scrollpane around message
     91    JScrollPane scrollPane = new JScrollPane(textArea);
     92    return scrollPane;
     93    }
    8194   
    8295    synchronized public void addAction(RemoteGreenstoneServerAction remote_greenstone_server_action)
     
    148161            DebugStream.printStackTrace(exception);
    149162        }
    150         JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("RemoteGreenstoneServer.Error", exception.getMessage()), Dictionary.get("RemoteGreenstoneServer.Error_Title"), JOptionPane.ERROR_MESSAGE);
     163        JScrollPane scrollPane = getMsgInScrollPane(Dictionary.get("RemoteGreenstoneServer.Error", exception.getMessage()));
     164        JOptionPane.showMessageDialog(Gatherer.g_man, scrollPane, Dictionary.get("RemoteGreenstoneServer.Error_Title"), JOptionPane.ERROR_MESSAGE);
    151165        remote_greenstone_server_action.processed_successfully = false;         
    152166        }
     
    156170        exit = true;
    157171        DebugStream.printStackTrace(exception);
     172        JScrollPane scrollPane = getMsgInScrollPane(Dictionary.get("RemoteGreenstoneServer.Error",
     173                                 "No gliserver.pl found. " + exception.getMessage()));
    158174        JOptionPane.showMessageDialog(Gatherer.g_man,
    159                           Dictionary.get("RemoteGreenstoneServer.Error",
    160                                  "No gliserver.pl found. " + exception.getMessage()),
     175                          scrollPane,
    161176                          Dictionary.get("RemoteGreenstoneServer.Error_Title"),
    162177                          JOptionPane.ERROR_MESSAGE);
     
    165180        catch (Exception exception) {
    166181        DebugStream.printStackTrace(exception);
    167         JOptionPane.showMessageDialog(Gatherer.g_man, Dictionary.get("RemoteGreenstoneServer.Error", exception.getMessage()), Dictionary.get("RemoteGreenstoneServer.Error_Title"), JOptionPane.ERROR_MESSAGE);
     182        JScrollPane scrollPane = getMsgInScrollPane(Dictionary.get("RemoteGreenstoneServer.Error", exception.getMessage()));
     183        JOptionPane.showMessageDialog(Gatherer.g_man, scrollPane, Dictionary.get("RemoteGreenstoneServer.Error_Title"), JOptionPane.ERROR_MESSAGE);
    168184        remote_greenstone_server_action.processed_successfully = false;
    169185        }
Note: See TracChangeset for help on using the changeset viewer.