Ignore:
Timestamp:
2009-01-12T13:04:29+13:00 (15 years ago)
Author:
kjdon
Message:

committed code submitted by Amin Hedjazi for making the GLI right to left. I worked on this code on the rtl-gli branch, then merged the branch back to the trunk at revision 18368. The branch code was slightly different in a couple of places where it shouldn't have been. So don't use the branch code next time. Start a new branch.

File:
1 edited

Legend:

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

    r17612 r18370  
    111111    // Creation
    112112    JPanel content_pane = (JPanel) getContentPane();
     113        content_pane.setComponentOrientation(Dictionary.getOrientation());
    113114    tab_pane = new JTabbedPane();
     115        tab_pane.setComponentOrientation(Dictionary.getOrientation());
    114116    JPanel general_preferences = createGeneralPreferences();
     117        general_preferences.setComponentOrientation(Dictionary.getOrientation());
    115118    tab_pane.addTab(Dictionary.get("Preferences.General"), null, general_preferences, Dictionary.get("Preferences.General_Tooltip"));
    116119    tab_pane.addTab(Dictionary.get("Preferences.Mode"), null, createModePreferences(), Dictionary.get("Preferences.Mode_Tooltip"));
    117120    //  tab_pane.addTab(Dictionary.get("Preferences.Workflow"), null, createWorkflowPreferences(), Dictionary.get("Preferences.Workflow_Tooltip"));
    118121    JPanel connection_preferences = createConnectionPreferences();
     122        connection_preferences.setComponentOrientation(Dictionary.getOrientation());
    119123    tab_pane.addTab(Dictionary.get("Preferences.Connection"), null, connection_preferences, Dictionary.get("Preferences.Connection_Tooltip"));
    120124    tab_pane.addTab(Dictionary.get("Preferences.Warnings"), null, createWarningPreferences(), Dictionary.get("Preferences.Warnings_Tooltip"));
    121125   
    122126    JPanel button_pane = new JPanel();
     127        button_pane.setComponentOrientation(Dictionary.getOrientation());
    123128    ok_button = new GLIButton(Dictionary.get("General.OK"), Dictionary.get("General.OK_Tooltip"));
    124129   
     
    138143    button_pane.add(apply_button);
    139144    button_pane.add(cancel_button);
    140 
     145        button_pane.setComponentOrientation(Dictionary.getOrientation());
     146       
    141147    content_pane.setLayout(new BorderLayout());
    142148    content_pane.add(tab_pane, BorderLayout.CENTER);
    143149    content_pane.add(button_pane, BorderLayout.SOUTH);
    144 
     150        content_pane.setComponentOrientation(Dictionary.getOrientation());
     151       
    145152    Dimension frame_size = Gatherer.g_man.getSize();
    146153    Point frame_location = Gatherer.g_man.getLocation();
     
    171178    private JPanel createConnectionPreferences() {
    172179    JPanel program_pane = new JPanel();
     180        program_pane.setComponentOrientation(Dictionary.getOrientation());
    173181    program_pane.setPreferredSize(ROW_SIZE);
    174182    JLabel program_label = new JLabel(Dictionary.get("Preferences.Connection.ProgramCommand"));
    175183    program_label.setPreferredSize(LABEL_SIZE);
    176    
     184    program_label.setComponentOrientation(Dictionary.getOrientation());
     185       
    177186    program_field = new JTextField(Configuration.getPreviewCommand());
    178187    program_field.setCaretPosition(0);
    179188    program_field.setToolTipText(Dictionary.get("Preferences.Connection.ProgramCommand_Tooltip"));
    180    
     189    program_field.setComponentOrientation(Dictionary.getOrientation());
     190       
    181191    JPanel library_path_pane = new JPanel();
    182192    library_path_pane.setPreferredSize(ROW_SIZE);
     193        library_path_pane.setComponentOrientation(Dictionary.getOrientation());
    183194    JLabel library_path_label = new JLabel();
    184195    library_path_label.setPreferredSize(LABEL_SIZE);
     196        library_path_label.setComponentOrientation(Dictionary.getOrientation());
    185197    String library_url_string = "";
    186198    if (Configuration.library_url != null) {
     
    189201    library_path_field = new JTextField(library_url_string);
    190202    library_path_field.setCaretPosition(0);
     203        library_path_field.setComponentOrientation(Dictionary.getOrientation());
    191204    if (Gatherer.GS3) {
    192205        library_path_label.setText(Dictionary.get("Preferences.Connection.Library_Path_GS3"));
     
    208221        gliserver_url_label = new JLabel(Dictionary.get("Preferences.Connection.GLIServer_URL"));
    209222        gliserver_url_label.setPreferredSize(LABEL_SIZE);
     223            gliserver_url_label.setComponentOrientation(Dictionary.getOrientation());
    210224        String gliserver_url_string = "";
    211225        if (Configuration.gliserver_url != null) {
     
    213227        }
    214228        gliserver_url_field = new JTextField(gliserver_url_string);
     229            gliserver_url_field.setComponentOrientation(Dictionary.getOrientation());
    215230        gliserver_url_field.setCaretPosition(0);
    216231        gliserver_url_field.setToolTipText(Dictionary.get("Preferences.Connection.GLIServer_URL_Tooltip"));
    217         
     232       
    218233        // Disable this field when using the applet, as it is automatically determined
    219234        gliserver_url_label.setEnabled(!Gatherer.isApplet);
     
    228243        site_pane = new JPanel();
    229244        site_pane.setPreferredSize(ROW_SIZE);
     245            site_pane.setComponentOrientation(Dictionary.getOrientation());
    230246        site_label = new JLabel(Dictionary.get("Preferences.Connection.Site"));
    231247        site_label.setPreferredSize(LABEL_SIZE);
     248            site_label.setComponentOrientation(Dictionary.getOrientation());
    232249        // what should we do if Gatherer.servlet_config.getSites() is null?
    233250        site_combobox = new JComboBox(Gatherer.servlet_config.getSites().toArray());
    234251        site_combobox.setOpaque(false);
    235252        site_combobox.setToolTipText(Dictionary.get("Preferences.Connection.Site_Tooltip"));
    236        
     253        site_combobox.setComponentOrientation(Dictionary.getOrientation());
     254           
    237255        servlet_pane = new JPanel();
    238256        servlet_pane.setPreferredSize(ROW_SIZE);
     257            servlet_pane.setComponentOrientation(Dictionary.getOrientation());
     258           
    239259        servlet_label = new JLabel(Dictionary.get("Preferences.Connection.Servlet"));
    240260        servlet_label.setPreferredSize(LABEL_SIZE);
     261            servlet_label.setComponentOrientation(Dictionary.getOrientation());
    241262        servlet_combobox = new JComboBox();
    242263        servlet_combobox.setOpaque(false);
     264            servlet_combobox.setComponentOrientation(Dictionary.getOrientation());
    243265        // try to locate and select the current site
    244266        String this_site = Configuration.site_name;
     
    281303    // Creation
    282304    JPanel connection_pane = new JPanel();
     305        connection_pane.setComponentOrientation(Dictionary.getOrientation());
    283306    use_proxy_checkbox = new JCheckBox(Dictionary.get("Preferences.Connection.Use_Proxy"));
    284307    use_proxy_checkbox.setSelected(currently_enabled);
    285    
     308    use_proxy_checkbox.setComponentOrientation(Dictionary.getOrientation());       
    286309    use_proxy_checkbox.setPreferredSize(ROW_SIZE);
    287     JPanel proxy_host_pane = new JPanel();
     310   
     311        JPanel proxy_host_pane = new JPanel();
     312        proxy_host_pane.setComponentOrientation(Dictionary.getOrientation());
    288313    proxy_host_pane.setPreferredSize(ROW_SIZE);
     314       
    289315    JLabel proxy_host_label = new JLabel(Dictionary.get("Preferences.Connection.Proxy_Host"));
     316        proxy_host_label.setComponentOrientation(Dictionary.getOrientation());
    290317    proxy_host_label.setPreferredSize(LABEL_SIZE);
    291318   
     
    293320    proxy_host_field.setEnabled(currently_enabled);
    294321    proxy_host_field.setToolTipText(Dictionary.get("Preferences.Connection.Proxy_Host_Tooltip"));
    295    
     322    proxy_host_field.setComponentOrientation(Dictionary.getOrientation());
     323       
    296324    JPanel proxy_port_pane = new JPanel();
     325        proxy_port_pane.setComponentOrientation(Dictionary.getOrientation());
    297326    proxy_port_pane.setPreferredSize(ROW_SIZE);
     327       
    298328    JLabel proxy_port_label = new JLabel(Dictionary.get("Preferences.Connection.Proxy_Port"));
    299329    proxy_port_label.setPreferredSize(LABEL_SIZE);
     330        proxy_port_label.setComponentOrientation(Dictionary.getOrientation());
    300331   
    301332    String port_value = Configuration.getString("general.proxy_port", true);
     
    317348    // Layout
    318349    program_pane.setLayout(new BorderLayout());
    319     program_pane.add(program_label, BorderLayout.WEST);
     350    program_pane.add(program_label, BorderLayout.LINE_END);
    320351    program_pane.add(program_field, BorderLayout.CENTER);
    321352
    322353    library_path_pane.setLayout(new BorderLayout());
    323     library_path_pane.add(library_path_label, BorderLayout.WEST);
     354    library_path_pane.add(library_path_label, BorderLayout.LINE_START);
    324355    library_path_pane.add(library_path_field, BorderLayout.CENTER);
    325356
    326357    if (Gatherer.isGsdlRemote && !Gatherer.GS3) {
    327358        gliserver_url_pane.setLayout(new BorderLayout());
    328         gliserver_url_pane.add(gliserver_url_label, BorderLayout.WEST);
     359        gliserver_url_pane.add(gliserver_url_label, BorderLayout.LINE_START);
    329360        gliserver_url_pane.add(gliserver_url_field, BorderLayout.CENTER);
    330361    }
     
    332363    if (Gatherer.GS3) {
    333364        site_pane.setLayout(new BorderLayout());
    334         site_pane.add(site_label, BorderLayout.WEST);
     365        site_pane.add(site_label, BorderLayout.LINE_START);
    335366        site_pane.add(site_combobox, BorderLayout.CENTER);
    336367
    337368        servlet_pane.setLayout(new BorderLayout());
    338         servlet_pane.add(servlet_label, BorderLayout.WEST);
     369        servlet_pane.add(servlet_label, BorderLayout.LINE_START);
    339370        servlet_pane.add(servlet_combobox, BorderLayout.CENTER);
    340371    }
    341372
    342373    proxy_host_pane.setLayout(new BorderLayout());
    343     proxy_host_pane.add(proxy_host_label, BorderLayout.WEST);
     374    proxy_host_pane.add(proxy_host_label, BorderLayout.LINE_START);
    344375    proxy_host_pane.add(proxy_host_field, BorderLayout.CENTER);
    345376
    346377    proxy_port_pane.setLayout(new BorderLayout());
    347     proxy_port_pane.add(proxy_port_label, BorderLayout.WEST);
     378    proxy_port_pane.add(proxy_port_label, BorderLayout.LINE_START);
    348379    proxy_port_pane.add(proxy_port_field, BorderLayout.CENTER);
    349380
     
    368399    private JPanel createGeneralPreferences() {
    369400    JPanel general_pane = new JPanel();
    370 
     401        general_pane.setComponentOrientation(Dictionary.getOrientation());
    371402    // Build the model of available languages
    372403    ArrayList dictionary_model = new ArrayList();
     
    393424    // Users email
    394425    JPanel email_pane = new JPanel();
    395     JLabel email_label = new JLabel(Dictionary.get("Preferences.General.Email"));
     426        email_pane.setComponentOrientation(Dictionary.getOrientation());
     427
     428        JLabel email_label = new JLabel(Dictionary.get("Preferences.General.Email"));
     429        email_label.setComponentOrientation(Dictionary.getOrientation());
    396430    email_label.setPreferredSize(LABEL_SIZE);
    397     email_field = new EmailField(Configuration.getColor("coloring.error_background", false));
     431   
     432        email_field = new EmailField(Configuration.getColor("coloring.error_background", false));
    398433    email_field.setText(Configuration.getEmail());
    399434    email_field.setToolTipText(Dictionary.get("Preferences.General.Email_Tooltip"));
    400    
     435    email_field.setComponentOrientation(Dictionary.getOrientation());
    401436    // Font selection
    402437    JPanel font_pane = new JPanel();
    403     JLabel font_label = new JLabel(Dictionary.get("Preferences.General.Font"));
     438        font_pane.setComponentOrientation(Dictionary.getOrientation());
     439   
     440        JLabel font_label = new JLabel(Dictionary.get("Preferences.General.Font"));
     441        font_label.setComponentOrientation(Dictionary.getOrientation());
    404442    font_label.setPreferredSize(LABEL_SIZE);
    405     font_field = new JTextField(Configuration.getString("general.font", true));
     443   
     444        font_field = new JTextField(Configuration.getString("general.font", true));
    406445    font_field.setToolTipText(Dictionary.get("Preferences.General.Font_Tooltip"));
    407    
     446    font_field.setComponentOrientation(Dictionary.getOrientation());
     447       
    408448    // Extracted metadata
    409449    view_extracted_metadata_checkbox = new JCheckBox(Dictionary.get("Preferences.General.View_Extracted_Metadata"));
    410450    view_extracted_metadata_checkbox.setSelected(false);
    411     if (Configuration.get("general.view_extracted_metadata", Configuration.COLLECTION_SPECIFIC)) {
     451        view_extracted_metadata_checkbox.setComponentOrientation(Dictionary.getOrientation());
     452   
     453        if (Configuration.get("general.view_extracted_metadata", Configuration.COLLECTION_SPECIFIC)) {
    412454        view_extracted_metadata_checkbox.setSelected(true);
    413455    }
    414456    view_extracted_metadata_checkbox.setToolTipText(Dictionary.get("Preferences.General.View_Extracted_Metadata_Tooltip"));
    415    
     457        view_extracted_metadata_checkbox.setComponentOrientation(Dictionary.getOrientation());
     458       
    416459    // Show file sizes
    417460    show_file_size_checkbox = new JCheckBox(Dictionary.get("Preferences.General.Show_File_Size"));
    418461    show_file_size_checkbox.setSelected(false);
     462        show_file_size_checkbox.setComponentOrientation(Dictionary.getOrientation());
     463       
    419464    if (Configuration.get("general.show_file_size", Configuration.COLLECTION_SPECIFIC)) {
    420465        show_file_size_checkbox.setSelected(true);
     
    424469    // Language
    425470    JPanel language_pane = new JPanel();
    426     JLabel language_label = new JLabel(Dictionary.get("Preferences.General.Interface_Language"));
     471        language_pane.setComponentOrientation(Dictionary.getOrientation());
     472
     473        JLabel language_label = new JLabel(Dictionary.get("Preferences.General.Interface_Language"));
     474        language_label.setComponentOrientation(Dictionary.getOrientation());
    427475    language_label.setPreferredSize(LABEL_SIZE);
    428476   
     
    430478    language_combobox.setOpaque(false);
    431479    language_combobox.setToolTipText(Dictionary.get("Preferences.General.Interface_Language_Tooltip"));
    432    
     480    language_combobox.setComponentOrientation(Dictionary.getOrientation());
     481       
    433482    // Try to locate and select the current language
    434483    String language_code = Configuration.getLanguage();
     
    443492    // Layout
    444493    email_pane.setLayout(new BorderLayout());
    445     email_pane.add(email_label, BorderLayout.WEST);
     494    email_pane.add(email_label, BorderLayout.LINE_START);
    446495    email_pane.add(email_field, BorderLayout.CENTER);
    447496
    448497    language_pane.setLayout(new BorderLayout());
    449     language_pane.add(language_label, BorderLayout.WEST);
     498    language_pane.add(language_label, BorderLayout.LINE_START);
    450499    language_pane.add(language_combobox, BorderLayout.CENTER);
    451500
    452501    font_pane.setLayout(new BorderLayout());
    453     font_pane.add(font_label, BorderLayout.WEST);
     502    font_pane.add(font_label, BorderLayout.LINE_START);
    454503    font_pane.add(font_field, BorderLayout.CENTER);
    455504
     
    471520    // Create Controls
    472521    JPanel mode_panel = new JPanel();
    473     JPanel button_panel = new JPanel();
    474     ButtonGroup mode_button_group = new ButtonGroup();
    475     assistant_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Assistant"));
     522        mode_panel.setComponentOrientation(Dictionary.getOrientation());
     523   
     524        JPanel button_panel = new JPanel();
     525        button_panel.setComponentOrientation(Dictionary.getOrientation());
     526   
     527        ButtonGroup mode_button_group = new ButtonGroup();
     528   
     529        assistant_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Assistant"));
    476530    assistant_mode_radio_button.setOpaque(false);
     531        assistant_mode_radio_button.setComponentOrientation(Dictionary.getOrientation());
    477532    mode_button_group.add(assistant_mode_radio_button);
    478     expert_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Expert"));
     533   
     534        expert_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Expert"));
    479535    expert_mode_radio_button.setOpaque(false);
     536        expert_mode_radio_button.setComponentOrientation(Dictionary.getOrientation());
    480537    mode_button_group.add(expert_mode_radio_button);
    481     librarian_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Librarian"));
     538   
     539        librarian_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Librarian"));
    482540    librarian_mode_radio_button.setOpaque(false);
     541        librarian_mode_radio_button.setComponentOrientation(Dictionary.getOrientation());
    483542    mode_button_group.add(librarian_mode_radio_button);
    484     systems_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Systems"));
     543   
     544        systems_mode_radio_button = new JRadioButton(Dictionary.get("Preferences.Mode.Systems"));
    485545    systems_mode_radio_button.setOpaque(false);
     546        systems_mode_radio_button.setComponentOrientation(Dictionary.getOrientation());
    486547    mode_button_group.add(systems_mode_radio_button);
    487     mode_description_textarea = new JTextArea();
     548   
     549        mode_description_textarea = new JTextArea();
     550        mode_description_textarea.setComponentOrientation(Dictionary.getOrientation());
    488551    mode_description_textarea.setEditable(false);
    489552    mode_description_textarea.setLineWrap(true);
     
    535598    {
    536599    warning_preferences_check_list = new CheckList(false);
     600        warning_preferences_check_list.setComponentOrientation(Dictionary.getOrientation());
    537601
    538602    // Read all the warnings from the general xml/config.xml file, and their values from the user config.xml file
     
    552616
    553617    JPanel warning_preferences_pane = new JPanel();
     618        warning_preferences_pane.setComponentOrientation(Dictionary.getOrientation());
    554619    warning_preferences_pane.setBorder(BorderFactory.createEmptyBorder(5,5,5,5));
    555620    warning_preferences_pane.setLayout(new BorderLayout());
    556     warning_preferences_pane.add(new JScrollPane(warning_preferences_check_list), BorderLayout.CENTER);
     621        JScrollPane scrol_tmp = new JScrollPane(warning_preferences_check_list);
     622        scrol_tmp.setComponentOrientation(Dictionary.getOrientation());
     623    warning_preferences_pane.add(scrol_tmp, BorderLayout.CENTER);
    557624    return warning_preferences_pane;
    558625    }
     
    571638    // Creation
    572639    JPanel workflow_preferences_pane = new JPanel();
    573     JPanel checklist_pane = new JPanel();
    574     JLabel title_label = new JLabel(Dictionary.get("Preferences.Workflow.Title"));
     640        workflow_preferences_pane.setComponentOrientation(Dictionary.getOrientation());
     641   
     642        JPanel checklist_pane = new JPanel();
     643        checklist_pane.setComponentOrientation(Dictionary.getOrientation());
     644   
     645        JLabel title_label = new JLabel(Dictionary.get("Preferences.Workflow.Title"));
     646        title_label.setComponentOrientation(Dictionary.getOrientation());
    575647    title_label.setPreferredSize(ROW_SIZE);
    576648   
    577649    workflow_download = new JCheckBox(Dictionary.get("GUI.Download")+" - "+Dictionary.get("GUI.Download_Tooltip"));
     650        workflow_download.setComponentOrientation(Dictionary.getOrientation());
    578651    workflow_download.setSelected(Configuration.get("workflow.download", false));
    579652    workflow_download.setPreferredSize(ROW_SIZE);
     
    582655    workflow_gather.setSelected(Configuration.get("workflow.gather", false));
    583656    workflow_gather.setPreferredSize(ROW_SIZE);
    584    
     657    workflow_gather.setComponentOrientation(Dictionary.getOrientation());
     658       
    585659    workflow_enrich = new JCheckBox(Dictionary.get("GUI.Enrich")+" - "+Dictionary.get("GUI.Enrich_Tooltip"));
    586660    workflow_enrich.setSelected(Configuration.get("workflow.enrich", false));
    587661    workflow_enrich.setPreferredSize(ROW_SIZE);
    588    
     662    workflow_enrich.setComponentOrientation(Dictionary.getOrientation());
     663       
    589664    workflow_design = new JCheckBox(Dictionary.get("GUI.Design")+" - "+Dictionary.get("GUI.Design_Tooltip"));
    590665    workflow_design.setSelected(Configuration.get("workflow.design", false));
    591666    workflow_design.setPreferredSize(ROW_SIZE);
    592    
     667    workflow_design.setComponentOrientation(Dictionary.getOrientation());
     668       
    593669    workflow_create = new JCheckBox(Dictionary.get("GUI.Create")+" - "+Dictionary.get("GUI.Create_Tooltip"));
    594670    workflow_create.setSelected(Configuration.get("workflow.create", false));
    595671    workflow_create.setPreferredSize(ROW_SIZE);
    596    
    597 
     672    workflow_create.setComponentOrientation(Dictionary.getOrientation());
     673       
    598674    workflow_format = new JCheckBox(Dictionary.get("GUI.Format")+" - "+Dictionary.get("GUI.Format_Tooltip"));
    599675    workflow_format.setSelected(Configuration.get("workflow.format", false));
    600676    workflow_format.setPreferredSize(ROW_SIZE);
    601    
     677    workflow_format.setComponentOrientation(Dictionary.getOrientation());
     678       
    602679    JPanel predefined_pane = new JPanel();
    603     JLabel predefined_label = new JLabel(Dictionary.get("Preferences.Workflow.Predefined.Label"));
    604     JComboBox predefined_combobox = new JComboBox(predefined);
     680        predefined_pane.setComponentOrientation(Dictionary.getOrientation());
     681   
     682        JLabel predefined_label = new JLabel(Dictionary.get("Preferences.Workflow.Predefined.Label"));
     683        predefined_label.setComponentOrientation(Dictionary.getOrientation());
     684   
     685        JComboBox predefined_combobox = new JComboBox(predefined);
    605686    predefined_combobox.setOpaque(false);
    606687    // Connection
     
    630711   
    631712    predefined_pane.setLayout(new BorderLayout(5,0));
    632     predefined_pane.add(predefined_label, BorderLayout.WEST);
     713    predefined_pane.add(predefined_label, BorderLayout.LINE_START);
    633714    predefined_pane.add(predefined_combobox, BorderLayout.CENTER);
    634715
Note: See TracChangeset for help on using the changeset viewer.