Changeset 5042


Ignore:
Timestamp:
2003-07-25T16:49:22+12:00 (21 years ago)
Author:
mdewsnip
Message:

Added new option to Connection pane: library path.

File:
1 edited

Legend:

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

    r4675 r5042  
    33import java.awt.*;
    44import java.awt.event.*;
     5import java.net.*;
    56import java.util.*;
    67import javax.swing.*;
     
    3334    private JCheckBox workflow_preview;
    3435    private JTabbedPane tab_pane;
     36    private JTextField library_path_field;
    3537    private JTextField proxy_host_field;
    3638    private JTextField proxy_port_field;
     
    9799
    98100    private JPanel createConnectionPreferences() {
     101    JPanel library_path_pane = new JPanel();
     102    library_path_pane.setPreferredSize(ROW_SIZE);
     103    JLabel library_path_label = new JLabel("Preferences.Connection.Library_Path");
     104    library_path_label.setPreferredSize(LABEL_SIZE);
     105    library_path_field = new JTextField(Gatherer.config.getString("general.exec_address", true));
     106    library_path_field.setCaretPosition(0);
     107
    99108    boolean currently_enabled = Gatherer.config.get("general.use_proxy", true);
    100109    // Creation
     
    116125
    117126    // Connection
     127    Gatherer.dictionary.register(library_path_label, null, false);
    118128    Gatherer.dictionary.register(use_proxy_checkbox, null, false);
    119129    Gatherer.dictionary.register(proxy_host_label, null, false);
     
    121131    use_proxy_checkbox.addActionListener(new UseProxyListener());
    122132    // Layout
     133    library_path_pane.setLayout(new BorderLayout());
     134    library_path_pane.add(library_path_label, BorderLayout.WEST);
     135    library_path_pane.add(library_path_field, BorderLayout.CENTER);
     136
    123137    proxy_host_pane.setLayout(new BorderLayout());
    124138    proxy_host_pane.add(proxy_host_label, BorderLayout.WEST);
     
    130144
    131145    connection_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
     146    connection_pane.add(library_path_pane);
    132147    connection_pane.add(use_proxy_checkbox);
    133148    connection_pane.add(proxy_host_pane);
     
    275290                // Submit the various changes.
    276291                // Connection preferences
     292        String library_path_string = library_path_field.getText();
     293        Gatherer.config.setString("general.exec_address", true, library_path_string);
     294        if (!library_path_string.equals("")) {
     295        try {
     296            Gatherer.config.exec_address = new URL(library_path_string);
     297        }
     298        catch (MalformedURLException error) {
     299            ///ystem.err.println("Error: Bad address: " + exec_address_string);
     300        }
     301        }
     302
    277303        Gatherer.config.set("general.use_proxy", true, use_proxy_checkbox.isSelected());
    278304        Gatherer.config.setString("general.proxy_host", true, proxy_host_field.getText());
Note: See TracChangeset for help on using the changeset viewer.