Changeset 7923


Ignore:
Timestamp:
2004-08-10T11:24:13+12:00 (20 years ago)
Author:
davidb
Message:

GLI applet now only quits once the web page with the launch button
is replaced in the browser with a new page.

Location:
trunk/gli/src/org/greenstone/gatherer
Files:
2 edited

Legend:

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

    r7739 r7923  
    113113    /** A public reference to the GUIManager. */
    114114    static public GUIManager g_man;
     115    static public boolean g_man_built = false;
     116
    115117    /** A static reference to ourselves. */
    116118    static public Gatherer self;
     
    374376    if (splash != null) { splash.toFront(); }
    375377
    376     g_man.display();
    377 
    378     // Place the window in the desired location on the screen, if this is do-able (not under most linux window managers apparently. In fact you're lucky if they listen to any of your screen size requests).
    379     g_man.setLocation(bounds.x, bounds.y);
    380     g_man.setVisible(true);
    381 
    382     // After the window has been made visible, check that it is in the correct place
    383     // sometimes java places a window not in the correct place,
    384     // but with an offset. If so, we work out what the offset is
    385     // and change the desired location to take that into account
    386     Point location = g_man.getLocation();
    387     int x_offset = bounds.x - location.x;
    388     int y_offset = bounds.y - location.y;
    389     // If not, offset the window to move it into the correct location
    390     if (x_offset > 0 || y_offset > 0) {
    391         ///ystem.err.println("changing the location to "+(bounds.x + x_offset)+" "+ (bounds.y + y_offset));
    392         g_man.setLocation(bounds.x + x_offset, bounds.y + y_offset);
    393     }
    394 
    395     // The 'after-display' triggers several events which don't occur until after the visual components are actually available on screen. Examples of these would be the various html renderings, as they can't happen offscreen.
    396     g_man.afterDisplay();
     378    if (!g_man_built) {
     379
     380        g_man.display();
     381
     382        // Place the window in the desired location on the screen, if this is do-able (not under most linux window managers apparently. In fact you're lucky if they listen to any of your screen size requests).
     383        g_man.setLocation(bounds.x, bounds.y);
     384        g_man.setVisible(true);
     385
     386        // After the window has been made visible, check that it is in the correct place
     387        // sometimes java places a window not in the correct place,
     388        // but with an offset. If so, we work out what the offset is
     389        // and change the desired location to take that into account
     390        Point location = g_man.getLocation();
     391        int x_offset = bounds.x - location.x;
     392        int y_offset = bounds.y - location.y;
     393        // If not, offset the window to move it into the correct location
     394        if (x_offset > 0 || y_offset > 0) {
     395        ///ystem.err.println("changing the location to "+(bounds.x + x_offset)+" "+ (bounds.y + y_offset));
     396        g_man.setLocation(bounds.x + x_offset, bounds.y + y_offset);
     397        }
     398
     399        // The 'after-display' triggers several events which don't occur until after the visual components are actually available on screen. Examples of these would be the various html renderings, as they can't happen offscreen.
     400        g_man.afterDisplay();
     401        g_man_built = true;
     402    }
     403    else {
     404        g_man.setVisible(true);
     405    }
    397406
    398407    if (splash != null) {
     
    431440    }
    432441
     442    // Store the current position and size (if reasonable) of the Gatherer for next time
     443    Rectangle bounds = g_man.getBounds();
     444    config.setBounds("general.bounds", true, bounds);
     445
     446    // Save configuration.
     447    saveConfig();
     448
    433449    // Get the gui to deallocate
    434450    g_man.hide();
    435451    g_man.destroy();
    436 
    437     // Store the current position and size (if reasonable) of the Gatherer for next time
    438     Rectangle bounds = g_man.getBounds();
    439     config.setBounds("general.bounds", true, bounds);
    440 
    441     // Save configuration.
    442     saveConfig();
     452    g_man_built = false;
     453
    443454
    444455    // Flush dictionary
  • trunk/gli/src/org/greenstone/gatherer/GathererApplet.java

    r7738 r7923  
    9494    public void init()
    9595    {
    96     // Work-around to reduce number of
    97     // 'Could not lock user prefs' error messages.
    98     // Thanks to Walter Schatz from the java forums.
    99     System.setProperty("java.util.prefs.syncInterval","2000000");
     96    try {
     97        // Work-around to reduce number of
     98        // 'Could not lock user prefs' error messages.
     99        // Thanks to Walter Schatz from the java forums.
     100        System.setProperty("java.util.prefs.syncInterval","2000000");
     101    }
     102
     103    catch (Exception exception) {
     104        // convenient way of finding out if user has agreed to
     105        // to requested security settings
     106
     107        JLabel lab
     108        = new JLabel("Greenstone Librarian Interface Applet deactivated",
     109                 JLabel.CENTER);
     110        getContentPane().add(lab);
     111        return;
     112    }
    100113
    101114    // Ensure platform specific LAF
     
    187200    bttn.addActionListener(this);
    188201    getContentPane().add(bttn);
    189 
    190     // getContentPane().add("Center", g_man.getRootPane());
    191202    }
    192203
     
    215226    public void actionPerformed(ActionEvent e)
    216227    {
    217         Object obj = e.getSource();
    218 
    219     // Splash screen.
    220     // Splash splash = new Splash();
    221 
    222228    Splash splash = null;
    223229
Note: See TracChangeset for help on using the changeset viewer.