Changeset 8581


Ignore:
Timestamp:
2004-11-17T10:42:21+13:00 (19 years ago)
Author:
mdewsnip
Message:

Updated GEMS, by Attila Aros.

Location:
trunk/gli/src/org/greenstone/gatherer/gems
Files:
3 added
4 edited

Legend:

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

    r8394 r8581  
    33 *
    44 * A component of the Gatherer application, part of the Greenstone digital
    5  * library suite from the New Zealand Digital Library Project at the
    6  * University of Waikato, New Zealand.
     5 * library suite from the New Zealand Digital Library Project at th * University of Waikato, New Zealand.
    76 *
    87 * <BR><BR>
     
    3736package org.greenstone.gatherer.gems;
    3837
     38
     39
    3940import java.awt.*;
    4041import java.awt.event.*;
    4142import java.io.File;
     43import java.io.PrintStream;
     44import java.io.FileInputStream;
     45import java.io.FileOutputStream;
     46import java.io.DataInputStream;
     47import java.io.IOException;
    4248import java.util.*;
    4349import javax.swing.*;
     
    5460import org.greenstone.gatherer.gui.GComboBox;
    5561import org.greenstone.gatherer.gui.GLIButton;
    56 import org.greenstone.gatherer.gui.SmarterTable;
     62//import org.greenstone.gatherer.gui.SmarterTable;
    5763import org.greenstone.gatherer.gui.ModalDialog;
    5864import org.greenstone.gatherer.gui.NonWhitespaceField;
    5965import org.greenstone.gatherer.gui.TransformCharacterTextField;
    60 import org.greenstone.gatherer.help.HelpFrame;
    61 //import org.greenstone.gatherer.cdm.*;
     66import org.greenstone.gatherer.gui.HelpFrame;
     67import org.greenstone.gatherer.cdm.*;
    6268import org.greenstone.gatherer.util.Codec;
    6369import org.greenstone.gatherer.util.Utility;
    6470import org.w3c.dom.*;
     71
     72
    6573
    6674/** Provides a GUI and relevant suite of tools for the editing of the metadata set associated with this collection. Again I have tried to capture a file manager type feel, with a tree showing the various set-element relations to the left of the dialog, and the right side showing details on the current tree selection. When a set is selected these details include a list of attributes, while when an element is selected this list is joined by another showing assigned values. In order for the editor to be stable and consistant with the rest of the tool, care must be taken for fire appropriate events whenever the sets are changed. There is also the addded complexity of determining what actions have to occur in order for a users edit of an assigned value to be completed, i.e. if the user chooses to remove a value then a call must be made to record_set.root.removeMetadata() to ensure all such values are actually removed, so it is not enough just to remove the value from the value model.
     
    7785    static final private Dimension ADD_ELEMENT_SIZE = new Dimension(400,125);
    7886    static final private Dimension ADD_FILE_SIZE = new Dimension(400,125);
    79     static final private Dimension ADD_SET_SIZE = new Dimension(400,125);
     87    static final private Dimension ADD_SET_SIZE = new Dimension(400,150);
    8088    static final private Dimension ADD_OR_EDIT_ATTRIBUTE_SIZE = new Dimension(600,325);
    8189    static final private Dimension ADD_OR_EDIT_VALUE_SIZE = new Dimension(600,440);
     
    141149    private SmarterTable set_attributes = null;
    142150    private SmarterTree element_values = null;
     151    public org.w3c.dom.Element rootelement;
     152   
     153   // public LanguageManager languageManager = new LanguageManager(rootelement);
    143154    //PopupListener provides right-click functionality to any component that needs it
    144155    //It is a centralized manager for all popups, then we use evt.Source() and determine where the
    145156    //event was performed
    146     private PopupListener popupListener = new PopupListener();
    147     private boolean set_changed = false;
     157    private PopupListener popupListener = new PopupListener(this);
    148158    /** A tree that represents the current metadata sets associated with this collection. */
    149159    private SmarterTree mds_tree = null;
    150160    private String current_collection_file = null;
    151161    private String dialog_options[] = null;
    152    
     162    private boolean atLeastOneSetChanged = false;
    153163
    154164    static public void main(String[] args)
     
    166176       // }
    167177    // Debugging control
     178      //  Configuration.setLocale("general.locale", true, new Locale("ar"));
     179       
    168180    if (go.debug) {
    169181        DebugStream.enableDebugging();
     
    185197        DebugStream.printStackTrace(exception);
    186198    }
    187         GEMS gems;
    188     gems = new GEMS();
     199        GEMS GEMS;
     200    GEMS = new GEMS();
    189201    }
    190202
     
    213225    setSize(SIZE);
    214226    setJMenuBar(new GEMSMenuBar());
    215     Dictionary.setText(this, "MEM.Title");
     227    Dictionary.setText(this, "GEMS.Title");
    216228
    217229    JPanel content_pane = (JPanel) getContentPane();
     
    241253    mds_tree_pane.setPreferredSize(new Dimension(300,500));
    242254    mds_tree = new SmarterTree(model);
    243     mds_tree.setCellRenderer(new MEMTreeCellRenderer());
     255    mds_tree.setCellRenderer(new GEMSTreeCellRenderer());
    244256    mds_tree.setRootVisible(false);
    245257    mds_tree.setBackground(config.getColor("coloring.collection_tree_background", false));
     
    262274    JLabel set_name_label = new JLabel();
    263275    set_name_label.setOpaque(false);
    264     //Dictionary.setText(set_name_label, "MEM.Name");
     276    //Dictionary.setText(set_name_label, "GEMS.Name");
    265277    set_name = new JLabel();
    266278    //set_name.setBorder(BorderFactory.createLoweredBevelBorder());
     
    290302    JLabel element_name_label = new JLabel();
    291303    element_name_label.setOpaque(false);
    292     //Dictionary.setText(element_name_label, "MEM.Name");
     304    //Dictionary.setText(element_name_label, "GEMS.Name");
    293305    //element_name = new JLabel();
    294306    //element_name.setBorder(BorderFactory.createLoweredBevelBorder());
     
    334346    JLabel profile_name_label = new JLabel();
    335347    profile_name_label.setOpaque(false);
    336     //Dictionary.setText(profile_name_label, "MEM.Name");
     348    //Dictionary.setText(profile_name_label, "GEMS.Name");
    337349    profile_name = new JLabel();
    338350    profile_name.setBorder(BorderFactory.createLoweredBevelBorder());
     
    362374    JLabel attribute_label = new JLabel();
    363375    attribute_label.setOpaque(false);
    364     Dictionary.setText(attribute_label, "MEM.Attribute");
     376    Dictionary.setText(attribute_label, "GEMS.Attribute");
    365377
    366378    JLabel element_label = new JLabel();
    367379    element_label.setOpaque(false);
    368     Dictionary.setText(element_label, "MEM.Element");
     380    Dictionary.setText(element_label, "GEMS.Element");
    369381
    370382    JLabel file_label = new JLabel();
    371383    file_label.setOpaque(false);
    372     Dictionary.setText(file_label, "MEM.File");
     384    Dictionary.setText(file_label, "GEMS.File");
    373385
    374386    JLabel set_label = new JLabel();
    375387    set_label.setOpaque(false);
    376     Dictionary.setText(set_label, "MEM.Set");
     388    Dictionary.setText(set_label, "GEMS.Set");
    377389
    378390    JLabel value_label = new JLabel();
    379391    value_label.setOpaque(false);
    380     Dictionary.setText(value_label, "MEM.Value");
     392    Dictionary.setText(value_label, "GEMS.Value");
    381393
    382394    JPanel inner_button_pane = new JPanel();
     
    384396    add_attribute = new GLIButton();
    385397    add_attribute.setMnemonic(KeyEvent.VK_4);
    386     Dictionary.setBoth(add_attribute, "MEM.Add", "MEM.Add_Attribute_Tooltip");
     398    Dictionary.setBoth(add_attribute, "GEMS.Add", "GEMS.Add_Attribute_Tooltip");
    387399    add_element = new GLIButton();
    388400    add_element.setMnemonic(KeyEvent.VK_3);
    389     Dictionary.setBoth(add_element, "MEM.Add", "MEM.Add_Element_Tooltip");
     401    Dictionary.setBoth(add_element, "GEMS.Add", "GEMS.Add_Element_Tooltip");
    390402    add_file = new GLIButton();
    391403    add_file.setMnemonic(KeyEvent.VK_2);
    392     Dictionary.setBoth(add_file, "MEM.Add", "MEM.Add_File_Tooltip");
     404    Dictionary.setBoth(add_file, "GEMS.Add", "GEMS.Add_File_Tooltip");
    393405    add_set = new GLIButton();
    394406    add_set.setMnemonic(KeyEvent.VK_1);
    395     Dictionary.setBoth(add_set, "MEM.Add", "MEM.Add_Set_Tooltip");
     407    Dictionary.setBoth(add_set, "GEMS.Add", "GEMS.Add_Set_Tooltip");
    396408    add_value = new GLIButton();
    397409    add_value.setMnemonic(KeyEvent.VK_5);
    398     Dictionary.setBoth(add_value, "MEM.Add", "MEM.Add_Value_Tooltip");
     410    Dictionary.setBoth(add_value, "GEMS.Add", "GEMS.Add_Value_Tooltip");
    399411
    400412    edit_attribute = new GLIButton();
    401413    edit_attribute.setMnemonic(KeyEvent.VK_6);
    402     Dictionary.setBoth(edit_attribute, "MEM.Edit", "MEM.Edit_Attribute_Tooltip");
     414    Dictionary.setBoth(edit_attribute, "GEMS.Edit", "GEMS.Edit_Attribute_Tooltip");
    403415    edit_value = new GLIButton();
    404416    edit_value.setMnemonic(KeyEvent.VK_7);
    405     Dictionary.setBoth(edit_value, "MEM.Edit", "MEM.Edit_Value_Tooltip");
     417    Dictionary.setBoth(edit_value, "GEMS.Edit", "GEMS.Edit_Value_Tooltip");
    406418
    407419    remove_attribute = new GLIButton();
    408420    remove_attribute.setMnemonic(KeyEvent.VK_MINUS);
    409     Dictionary.setBoth(remove_attribute, "MEM.Remove", "MEM.Remove_Attribute_Tooltip");
     421    Dictionary.setBoth(remove_attribute, "GEMS.Remove", "GEMS.Remove_Attribute_Tooltip");
    410422    remove_element = new GLIButton();
    411423    remove_element.setMnemonic(KeyEvent.VK_0);
    412     Dictionary.setBoth(remove_element, "MEM.Remove", "MEM.Remove_Element_Tooltip");
     424    Dictionary.setBoth(remove_element, "GEMS.Remove", "GEMS.Remove_Element_Tooltip");
    413425    remove_file = new GLIButton();
    414426    remove_file.setMnemonic(KeyEvent.VK_9);
    415     Dictionary.setBoth(remove_file, "MEM.Remove", "MEM.Remove_File_Tooltip");
     427    Dictionary.setBoth(remove_file, "GEMS.Remove", "GEMS.Remove_File_Tooltip");
    416428    remove_set = new GLIButton();
    417429    remove_set.setMnemonic(KeyEvent.VK_8);
    418     Dictionary.setBoth(remove_set, "MEM.Remove", "MEM.Remove_Set_Tooltip");
     430    Dictionary.setBoth(remove_set, "GEMS.Remove", "GEMS.Remove_Set_Tooltip");
    419431    remove_value = new GLIButton();
    420432    remove_value.setMnemonic(KeyEvent.VK_EQUALS);
    421     Dictionary.setBoth(remove_value, "MEM.Remove", "MEM.Remove_Value_Tooltip");
    422     setControls(false, false, false, false, false, false, false, false, false, false, false, false);
     433    Dictionary.setBoth(remove_value, "GEMS.Remove", "GEMS.Remove_Value_Tooltip");
     434    //setControls(false, false, false, false, false, false, false, false, false, false, false, false);
    423435
    424436    add_element_action_listener = new AddElementActionListener();
    425437    add_file_action_listener = new AddFileActionListener();
    426438    add_set_action_listener = new AddSetActionListener();
     439       
     440       
     441 
    427442    add_or_edit_attribute_action_listener = new AddOrEditAttributeActionListener();
    428443    add_or_edit_value_action_listener = new AddOrEditValueActionListener();
     
    467482    set_attributes_scroll.setViewportView(set_attributes);
    468483
    469     set_attributes_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.get("MEM.Attributes")), BorderFactory.createEmptyBorder(2,2,2,2)));
     484    set_attributes_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.get("GEMS.Attributes")), BorderFactory.createEmptyBorder(2,2,2,2)));
    470485    set_attributes_pane.setLayout(new BorderLayout());
    471486    set_attributes_pane.add(set_attributes_scroll, BorderLayout.CENTER);
    472487       
    473     set_details_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.get("MEM.Set_Details")), BorderFactory.createEmptyBorder(2,2,2,2)));
     488    set_details_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.get("GEMS.Set_Details")), BorderFactory.createEmptyBorder(2,2,2,2)));
    474489    set_details_pane.setLayout(new BorderLayout());
    475490    set_details_pane.add(set_name_pane, BorderLayout.NORTH);
     
    482497    element_attributes_scroll.setViewportView(element_attributes);
    483498
    484     element_attributes_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.get("MEM.Attributes")), BorderFactory.createEmptyBorder(2,2,2,2)));
     499    element_attributes_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.get("GEMS.Attributes")), BorderFactory.createEmptyBorder(2,2,2,2)));
    485500    element_attributes_pane.setLayout(new BorderLayout());
    486501    element_attributes_pane.add(element_attributes_scroll, BorderLayout.CENTER);
    487502         
    488     element_values_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.get("MEM.Values")), BorderFactory.createEmptyBorder(2,2,2,2)));
     503    element_values_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.get("GEMS.Values")), BorderFactory.createEmptyBorder(2,2,2,2)));
    489504    element_values_pane.setLayout(new BorderLayout());
    490505    element_values_pane.add(new JScrollPane(element_values), BorderLayout.CENTER);
     
    497512        //element_inner_pane.add(element_values_pane);
    498513         
    499     element_details_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.get("MEM.Element_Details")), BorderFactory.createEmptyBorder(2,2,2,2)));
     514    element_details_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.get("GEMS.Element_Details")), BorderFactory.createEmptyBorder(2,2,2,2)));
    500515    element_details_pane.setLayout(new BorderLayout());
    501516    //element_details_pane.add(element_name_pane, BorderLayout.NORTH);
     
    508523    profile_attributes_scroll.setViewportView(profile_attributes);
    509524
    510     profile_attributes_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.get("MEM.Profiles")), BorderFactory.createEmptyBorder(2,2,2,2)));
     525    profile_attributes_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.get("GEMS.Profiles")), BorderFactory.createEmptyBorder(2,2,2,2)));
    511526    profile_attributes_pane.setLayout(new BorderLayout());
    512527    profile_attributes_pane.add(profile_attributes_scroll, BorderLayout.CENTER);
    513528
    514     profile_details_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.get("MEM.Profile_Details")), BorderFactory.createEmptyBorder(2,2,2,2)));
     529    profile_details_pane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder(Dictionary.get("GEMS.Profile_Details")), BorderFactory.createEmptyBorder(2,2,2,2)));
    515530    profile_details_pane.setLayout(new BorderLayout());
    516531    //profile_details_pane.add(profile_name_pane, BorderLayout.NORTH);
     
    578593        //System.out.println("Final exit func");
    579594    DebugStream.closeDebugStream();
    580         if(set_changed == true) {
    581            
    582             int result = JOptionPane.showOptionDialog(self, Dictionary.get("Gems.Menu.Confirm_Exit_Save", Dictionary.get("MEM.Element")), Dictionary.get("Gems.Menu.Confirm_Exit_Save_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);
     595        if(atLeastOneSetChanged == true) {
     596           
     597            int result = JOptionPane.showOptionDialog(self, Dictionary.get("GEMS.Menu.Confirm_Exit_Save", Dictionary.get("GEMS.Element")), Dictionary.get("GEMS.Menu.Confirm_Exit_Save_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);
    583598
    584599         //   System.out.println("Exit: "+result);
     
    615630        file = new JMenu();
    616631        file.setMnemonic(KeyEvent.VK_F);
    617         Dictionary.registerText(file, "Gems.Menu.File");
     632        Dictionary.registerText(file, "Menu.File");
    618633
    619634        file_exit = new JMenuItem();
    620635        file_exit.addActionListener(this);
    621636        file_exit.setMnemonic(KeyEvent.VK_X);
    622         Dictionary.registerText(file_exit, "Gems.Menu.File_Exit");
     637        Dictionary.registerText(file_exit, "Menu.File_Exit");
    623638
    624639        file_new = new JMenuItem();
    625640        file_new.addActionListener(this);
    626641        file_new.setMnemonic(KeyEvent.VK_N);
    627         Dictionary.registerText(file_new, "Gems.Menu.File_New");
     642        Dictionary.registerText(file_new, "Menu.File_New");
    628643
    629644        file_open = new JMenuItem();
    630645        file_open.addActionListener(this);
    631646        file_open.setMnemonic(KeyEvent.VK_O);
    632         Dictionary.registerText(file_open, "Gems.Menu.File_Open");
     647        Dictionary.registerText(file_open, "Menu.File_Open");
    633648
    634649        file_save = new JMenuItem();
    635650        file_save.addActionListener(this);
    636651        file_save.setMnemonic(KeyEvent.VK_S);
    637         Dictionary.registerText(file_save, "Gems.Menu.File_Save");
     652       // Dictionary.registerText(file_save, "GEMS.Menu.File_Save");
     653            Dictionary.registerText(file_save, "Menu.File_Save");
    638654           
    639655            file_delete = new JMenuItem();
    640656        file_delete.addActionListener(new RemoveSetActionListener());
    641657        file_delete.setMnemonic(KeyEvent.VK_S);
    642         Dictionary.registerText(file_delete, "Gems.Menu.File_Delete");
     658       // Dictionary.registerText(file_delete, "GEMS.Menu.File_Delete");
     659            Dictionary.registerText(file_delete, "Menu.File_Delete");
    643660           
    644661            file_preferences = new JMenuItem();
    645662        file_preferences.addActionListener(this);
    646663        file_preferences.setMnemonic(KeyEvent.VK_S);
    647         Dictionary.registerText(file_preferences, "Gems.Menu.File_Preferences");
     664        //Dictionary.registerText(file_preferences, "GEMS.Menu.File_Preferences");
     665            Dictionary.registerText(file_preferences, "Menu.File_Options");
    648666
    649667        // Layout (file menu)
     
    652670        file.add(file_save);
    653671            file.add(file_delete);
    654        // file.add(new JSeparator());
    655            // file.add(file_preferences);
     672        file.add(new JSeparator());
     673            file.add(file_preferences);
    656674            file.add(new JSeparator());
    657675        file.add(file_exit);
     
    660678        edit = new JMenu();
    661679        edit.setMnemonic(KeyEvent.VK_E);
    662         Dictionary.registerText(edit, "Gems.Menu.Edit");
     680        Dictionary.registerText(edit, "Menu.Edit");
    663681
    664682        edit_cut = new JMenuItem();
    665683        edit_cut.addActionListener(this);
    666684        edit_cut.setMnemonic(KeyEvent.VK_X);
    667         Dictionary.registerText(edit_cut, "Gems.Menu.Edit_Cut");
     685        Dictionary.registerText(edit_cut, "Menu.Edit_Cut");
    668686
    669687        edit_copy = new JMenuItem();
    670688        edit_copy.addActionListener(this);
    671689        edit_copy.setMnemonic(KeyEvent.VK_C);
    672         Dictionary.registerText(edit_copy, "Gems.Menu.Edit_Copy");
     690        Dictionary.registerText(edit_copy, "Menu.Edit_Copy");
    673691
    674692        edit_paste = new JMenuItem();
    675693        edit_paste.addActionListener(this);
    676694        edit_paste.setMnemonic(KeyEvent.VK_V);
    677         Dictionary.registerText(edit_paste, "Gems.Menu.Edit_Paste");
     695        Dictionary.registerText(edit_paste, "Menu.Edit_Paste");
    678696
    679697        // Layout (edit menu)
     
    685703        help = new JMenu();
    686704        help.setIcon(Utility.HELP_ICON);
    687         Dictionary.setText(help, "Gems.Menu.Help");
     705        Dictionary.setText(help, "GEMS.Menu.Help");
    688706
    689707        help_help = new JMenuItem();
    690708        help_help.addActionListener(this);
    691         Dictionary.registerText(help_help, "Gems.Menu.Help");
     709        Dictionary.registerText(help_help, "GEMS.Menu.Help");
    692710
    693711        // Layout (help menu)
     
    699717        this.add(edit);
    700718        this.add(Box.createHorizontalGlue());
    701         this.add(help);
     719        //this.add(help);
    702720    }
    703721
     
    710728        if (event_source == file_new) {
    711729        add_set.doClick();
    712                 set_changed = true;
     730               // set_changed = true;
    713731        return;
    714732        }
     
    734752        if (event_source == file_save) {
    735753        msm.save();
    736                 set_changed = false;
     754                atLeastOneSetChanged = false;
    737755        return;
    738756        }
     
    743761              /* 
    744762                if(set_changed == true) {
    745                     int result = JOptionPane.showOptionDialog(self, Dictionary.get("Gems.Menu.Confirm_Exit_Save", Dictionary.get("MEM.Element")), Dictionary.get("Gems.Menu.Confirm_Exit_Save_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);
     763                    int result = JOptionPane.showOptionDialog(self, Dictionary.get("GEMS.Menu.Confirm_Exit_Save", Dictionary.get("GEMS.Element")), Dictionary.get("GEMS.Menu.Confirm_Exit_Save_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);
    746764       
    747765                 //   System.out.println("Exit: "+result);
     
    762780
    763781        // Edit -> Cut
     782            if(event_source == file_preferences){
     783              GEMSPreferences GemsPreferences = new GEMSPreferences(); 
     784 
     785               
     786            }
    764787        if (event_source == edit_cut) {
    765788        try {
     
    838861
    839862
    840     private class ActionTask
    841     extends Thread {
    842     private int action;
    843     public ActionTask(int action) {
    844         this.action = action;
    845     }
    846     public void run() {
    847         boolean complete = false;
    848         while(!complete) {
    849         if(self.isVisible()) {
    850             switch(action) {
    851             case ADD_SET:
    852             add_set_action_listener.actionPerformed(new ActionEvent(this, 0, "Blarg!"));
    853             break;
    854             case REMOVE_SET:
    855             if(!mds_tree.isSelectionEmpty()) {
    856                 remove_set_action_listener.actionPerformed(new ActionEvent(this, 0, "Blarg!"));
    857             }
    858             break;
    859             }
    860             complete = true;
    861         }
    862         else {
    863             try {
    864             synchronized(this) {
    865                 wait(100);
    866             }
    867             }
    868             catch(Exception exception) {
    869             }
    870         }
    871         }
    872     }
    873     }
    874863    //callback method
    875864     protected void processWindowEvent(WindowEvent evt){
     
    885874 
    886875   public void warn_cant_load_set(){
    887             JOptionPane.showMessageDialog(self, Dictionary.get("Gems.Already_Loaded_Set_Error"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
    888      
     876            JOptionPane.showMessageDialog(self, Dictionary.get("GEMS.Already_Loaded_Set_Error"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
    889877        }
    890878    public void dispose() {
     
    892880       
    893881         //if anything has changed, warn user that they should save
    894         if(set_changed == true) {
    895            
    896             int result = JOptionPane.showOptionDialog(self, Dictionary.get("Gems.Menu.Confirm_Exit_Save", Dictionary.get("MEM.Element")), Dictionary.get("Gems.Menu.Confirm_Exit_Save_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);
     882        if(atLeastOneSetChanged == true) {
     883           
     884            int result = JOptionPane.showOptionDialog(self, Dictionary.get("GEMS.Menu.Confirm_Exit_Save", Dictionary.get("GEMS.Element")), Dictionary.get("GEMS.Menu.Confirm_Exit_Save_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);
    897885         //   System.out.println("Exit: "+result);
    898886            if(result == 0) {
     
    901889            }
    902890        }
    903         set_changed = false;
     891        atLeastOneSetChanged = false;
    904892    // Destructor
    905893    card_layout = null;
     
    963951    }
    964952
    965     private class AddOrEditAttributeActionListener
     953   private class AddOrEditAttributeActionListener
    966954    extends ModalDialog
    967955    implements ActionListener {
     
    974962    private HashMap name_to_values = null;
    975963    private JLabel target = null;
     964        private Vector attributeLists = null;
     965       
     966       
     967        //org.w3c.dom.Document lang = Utility.parse("/home/arosmain/gsdl/gli/classes/xml/languages.xml", false);
     968          org.w3c.dom.Document lang = Utility.parse(Configuration.gsdl_path + "/gli/classes/xml/languages.xml", false);
     969         
    976970    /** Constructor. */
    977971    public AddOrEditAttributeActionListener() {
    978972        super(self);
    979973        setModal(true);
     974            attributeLists = new Vector();
     975            //
     976            attributeLists.add("identifier");
     977            attributeLists.add("comment");
     978            attributeLists.add("definition");
     979            attributeLists.add("name");
     980           
     981            attributeLists.add("creator");
     982            attributeLists.add("date");
     983            attributeLists.add("contact");
     984            attributeLists.add("family");
     985           
     986            attributeLists.add("lastchanged");
     987            attributeLists.add("language_dependant");
     988            attributeLists.add("version");
     989            attributeLists.add("datatype");
     990           
     991            attributeLists.add("obligation");
     992            attributeLists.add("maximum_occurence");
     993            attributeLists.add("registration_authority");
     994           
     995           
     996            //
    980997        setSize(ADD_OR_EDIT_ATTRIBUTE_SIZE);
    981998        name_to_values = new HashMap();
     
    9921009        JLabel target_label = new JLabel();
    9931010        target_label.setOpaque(false);
    994         Dictionary.setText(target_label, "MEM.Target");
     1011        Dictionary.setText(target_label, "GEMS.Target");
    9951012        target = new JLabel();
    9961013        target.setOpaque(false);
     
    9981015        JLabel name_label = new JLabel();
    9991016        name_label.setOpaque(false);
    1000         Dictionary.setText(name_label, "MEM.Name");
     1017        Dictionary.setText(name_label, "GEMS.Name");
    10011018        name = new GComboBox();
    10021019        name.setEditable(true);
    1003         Dictionary.setTooltip(name, "MEM.Attribute_Name_Tooltip");
     1020        Dictionary.setTooltip(name, "GEMS.Attribute_Name_Tooltip");
    10041021
    10051022        JLabel language_label = new JLabel();
    10061023        language_label.setOpaque(false);
    1007         Dictionary.setText(language_label, "MEM.Language");
     1024        Dictionary.setText(language_label, "GEMS.Language");
    10081025        language_box = new JComboBox();  // !!! Gatherer.g_man.design_pane.getLanguageCodes().toArray());
    1009             //LanguageManager languageManager = new LanguageManager(org.w3c.dom.Element());
     1026           
     1027           
     1028            for(int n = 0; n < attributeLists.size(); n++){
     1029               
     1030                name.add(attributeLists.get(n));
     1031               
     1032            }
     1033           // org.w3c.dom.Element myelem = new org.w3c.dom.Element();
     1034           
     1035           // LanguageManager languageManager = new LanguageManager(myelem);
    10101036           
    10111037         
    10121038        // !!! language_box.setRenderer(new LanguageListCellRenderer());
    1013         Dictionary.setTooltip(language_box, "MEM.Attribute_Language_Tooltip");
     1039        Dictionary.setTooltip(language_box, "GEMS.Attribute_Language_Tooltip");
    10141040
    10151041        JPanel center_pane = new JPanel();
    10161042        center_pane.setOpaque(false);
    1017         value = new ComboArea(Dictionary.get("MEM.Values"), COMPONENT_SIZE);
     1043        value = new ComboArea(Dictionary.get("GEMS.Values"), COMPONENT_SIZE);
    10181044        value.setOpaque(false);
    10191045
     
    10231049        v_text_area.setSelectionColor(config.getColor("coloring.collection_selection_background", false));
    10241050        v_text_area.setSelectedTextColor(config.getColor("coloring.collection_selection_foreground", false));
    1025         Dictionary.setTooltip(v_text_area, "MEM.Attribute_Value_Tooltip");
     1051        Dictionary.setTooltip(v_text_area, "GEMS.Attribute_Value_Tooltip");
    10261052
    10271053        JPanel button_pane = new JPanel();
     
    10721098
    10731099        setLocation((config.screen_size.width - ADD_OR_EDIT_ATTRIBUTE_SIZE.width) / 2, (config.screen_size.height - ADD_OR_EDIT_ATTRIBUTE_SIZE.height) / 2);
    1074     }
     1100   
     1101           
     1102           // create dom object for language_Box
     1103            //GEMSLanguageManager GemsLangManager = new GEMSLanguageManager("/home/arosmain/gsdl/gli/classes/xml/languages.xml");
     1104        GEMSLanguageManager GemsLangManager = new GEMSLanguageManager(Configuration.gsdl_path + "/gli/classes/xml/languages.xml");
     1105       
     1106            Vector languagecodes = GemsLangManager.getLanguageCodes();
     1107           
     1108            for(int p = 0; p < languagecodes.size(); p++){
     1109             
     1110                language_box.addItem(languagecodes.get(p).toString());
     1111            }
     1112           
     1113        }
    10751114    /** Any implementation of ActionListener must include this method so that we can be informed when an action as occured on our registered component, allowing us to add a new attribute to the selected set or element.
    10761115     * @param event An <strong>ActionEvent</strong> containing information about the event.
    10771116     */
     1117       
     1118       
    10781119    public void actionPerformed(ActionEvent event) {
    10791120        Object source = event.getSource();
    1080         if(source == ok_button) {
     1121            AttributeTableModel tablemodel;
     1122            String prevLang = new String("");
     1123            String prevValue = new String("");
     1124           
     1125          //allow user to choose language when they create attr
     1126         
     1127           
     1128          if(source == popupListener.menuAddAttributeAttribute) { 
     1129            add_type =  true;
     1130           language_box.setEnabled(true);
     1131          }//end if source== menuaddattributeattribute
     1132          else if (source == popupListener.menuEditValue){
     1133              add_type = false;
     1134              //grab the table model based on what is currently selected
     1135                switch(current_attribute_type) {
     1136        case GEMSNode.COLLECTION:
     1137            tablemodel = (AttributeTableModel) profile_attributes.getModel();
     1138                    //String prevLang =  tablemodel.getValueAt(current_attribute,0).toString();
     1139                    //String prevValue = tablemodel.getValueAt(current_attribute,1).toString();
     1140           
     1141            break;
     1142        case GEMSNode.SET:
     1143            tablemodel = (AttributeTableModel) set_attributes.getModel();
     1144                    //grab value in table(
     1145            prevLang =  tablemodel.getValueAt(current_attribute,0).toString();
     1146                    prevValue = tablemodel.getValueAt(current_attribute,1).toString();
     1147               
     1148            break;
     1149        case GEMSNode.ELEMENT:
     1150            tablemodel = (AttributeTableModel) element_attributes.getModel();
     1151                    //grab values in table( lang and value)
     1152                    prevLang =  tablemodel.getValueAt(current_attribute,1).toString();
     1153                    prevValue = tablemodel.getValueAt(current_attribute,2).toString();
     1154           
     1155            break;
     1156                    default:
     1157                        //by default grab element_attr's
     1158                    tablemodel = (AttributeTableModel) element_attributes.getModel();
     1159                    prevLang =  tablemodel.getValueAt(current_attribute,1).toString();
     1160                    prevValue = tablemodel.getValueAt(current_attribute,2).toString();
     1161           
     1162                    break;
     1163        }         
     1164              language_box.setEnabled(false);
     1165             
     1166           //if a set attr is selected, then do not do any lang operations, other than setting index to -1
     1167              if(current_attribute_type != GEMSNode.SET) {
     1168
     1169                //set the current language to show up in language_box(no lang if no lang specified)
     1170                if(prevLang == null || prevLang.compareTo(" ")==0 || prevLang.compareTo("") == 0 || prevLang.compareTo("  ")==0) {
     1171                    language_box.setSelectedIndex(-1);
     1172             
     1173                }
     1174                else {
     1175                    language_box.setSelectedItem(prevLang.toLowerCase());
     1176                }
     1177              }// end currattr != GEMSnode.set
     1178              else {
     1179                 
     1180                 language_box.setSelectedIndex(-1);
     1181                 
     1182              }// end currattr == GEMSnode.set
     1183             
     1184              value.setText(prevValue);
     1185             
     1186          }//end if source == popupListener.menuEditValue)
     1187        ///////////////////////////////////////////////
     1188            if(source == ok_button) {
    10811189        boolean success = true;
    10821190        AttributeTableModel model;
     
    10901198        case GEMSNode.SET:
    10911199            model = (AttributeTableModel) set_attributes.getModel();
    1092             success = addOrEditSetAttribute(model);         
     1200            success = addOrEditSetAttribute(model);
     1201                   
    10931202            break;
    10941203        case GEMSNode.ELEMENT:
     
    10971206            break;
    10981207        }
    1099 
     1208                 
    11001209        if (success) {
    11011210            // Hide dialog
    1102                      set_changed = true;
     1211               
    11031212            setVisible(false);
     1213                    return;
    11041214        }
    11051215        }
     
    11071217        // Hide dialog
    11081218        setVisible(false);
     1219                return;
    11091220        }
    11101221        else if(source == name) {
    1111         Object object = name.getSelectedItem();
     1222                Object object = name.getSelectedItem();
    11121223        if(object != null) {
    11131224            java.util.List values = (java.util.List) name_to_values.get(object.toString());
     
    11151226            values = msm.getElements();
    11161227            }
    1117             value.clear();
    1118             for(int i = 0; i < values.size(); i++) {
    1119             value.add(values.get(i));
    1120             }
    1121         }
    1122         }
    1123         else {
     1228                   
     1229                    if(value != null && values != null){
     1230                        value.clear();
     1231                        for(int i = 0; i < values.size(); i++) {
     1232                            value.add(values.get(i));
     1233                        }
     1234                    }
     1235        }
     1236        }
     1237        else if (source == popupListener.menuAddAttributeAttribute){
     1238                 
     1239                   for(int i = 0; i < attributeLists.size(); i++) {
     1240                        name.add(attributeLists.get(i).toString());   
     1241                   
     1242                        }
     1243                 name.setEnabled(true);
     1244            }
     1245           /* else if (source == popupListener.menuAddAttributeAttribute){
     1246                System.out.println("add attr\n");
     1247               
     1248                name.setEnabled(true);
     1249               
     1250            }*/
     1251          /* else{
    11241252        // Name combo box is enabled except when attributes are edited
    1125         //name.setEnabled((source != edit_attribute));
     1253        //name.setEnabled((source != popupListener.menuEditValue));
    11261254                //System.out.println("elsed");
    11271255        name_to_values.clear();
     
    12171345        if(source == add_attribute || source == popupListener.menuAddAttributeSet || source == popupListener.menuAddAttributeElement || source == popupListener.menuAddAttributeAttribute) {
    12181346            add_type = true;
    1219             Dictionary.setText(this, "MEM.AddAttribute");
     1347            Dictionary.setText(this, "GEMS.AddAttribute");
    12201348            if(current_collection_file != null) {
    12211349            // Name is empty in this one, however values must be the current elements in the collection.   
     
    12271355            }
    12281356            setVisible(true);
    1229         }
     1357        }*/
    12301358               // else if(source == popupListener.menuAddAttributeAttribute){
    12311359                   
     
    12351363                   
    12361364                 //   System.out.println("from elements");
    1237                // }
     1365               // }*/
    12381366        else if(current_attribute != -1) {
     1367                   
     1368                    //System.out.println(source.toString()+"\n");
    12391369            AttributeTableModel model = null;
    12401370            switch(current_attribute_type) {
     
    12501380            }
    12511381            add_type = false;
    1252             Dictionary.setText(this, "MEM.EditAttribute");
     1382            Dictionary.setText(this, "GEMS.EditAttribute");
    12531383            String name_str = (String) model.getValueAt(current_attribute, 0);
    12541384            String value_str = (String) model.getValueAt(current_attribute, model.getColumnCount() - 1);
     
    12741404            value.setSelectedItem(value_str);
    12751405            value_str = null;
    1276             setVisible(true);
    1277         }
    1278         }
     1406           
     1407        }
     1408       // }
     1409            setVisible(true);
    12791410        source = null;
    12801411    }
    1281 
    12821412
    12831413    private boolean addOrEditCollectionAttribute(AttributeTableModel model)
     
    13051435        else {
    13061436        cont = false;
    1307         JOptionPane.showMessageDialog(self, Dictionary.get("MEM.Attribute_Already_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
     1437        JOptionPane.showMessageDialog(self, Dictionary.get("GEMS.Attribute_Already_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
    13081438        }
    13091439
     
    13201450
    13211451        // Remove the existing attribute if this is an edit
     1452             
    13221453        if(!add_type && current_attribute != -1) {
     1454             
    13231455        current_set.removeAttribute(name_str);
    13241456        // Update attribute table
    1325         model.removeRow(current_attribute);
    1326         }
    1327 
     1457               model.removeRow(current_attribute);
     1458        }
     1459            current_set.addAttribute(name_str, value_str);
     1460        // Update the attribute table
     1461        model.add(new Attribute(name_str, value_str));
    13281462        boolean cont = true;
    1329         // Check that there isn't already an entry for this attribute
     1463         
     1464      /*  // Check that there isn't already an entry for this attribute
     1465           *
     1466           
    13301467        if (!model.contains(name_str, 0)) {
    13311468        // Add the new attribute
     
    13371474        else {
    13381475        cont = false;
    1339         JOptionPane.showMessageDialog(self, Dictionary.get("MEM.Attribute_Already_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
    1340         }
     1476        JOptionPane.showMessageDialog(self, Dictionary.get("GEMS.Attribute_Already_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
     1477        }*/
    13411478
    13421479        value_str = null;
     
    13511488        String name_str = name.getSelectedItem().toString();
    13521489        String language_code = (String) language_box.getSelectedItem();
     1490           
    13531491        String value_str = Codec.transform(Codec.transformUnicode(value.getText()), Codec.TEXT_TO_DOM);
    1354 
     1492             
    13551493        // Remove the existing attribute if this is an edit
    13561494        if(!add_type && current_attribute != -1) {
     
    14091547        JLabel set_label = new JLabel();
    14101548        set_label.setOpaque(false);
    1411         Dictionary.setText(set_label, "MEM.Set");
     1549        Dictionary.setText(set_label, "GEMS.Set");
    14121550        set_field = new JLabel();
    14131551        set_field.setOpaque(false);
     
    14171555        JLabel name_label = new JLabel();
    14181556        name_label.setOpaque(false);
    1419         Dictionary.setText(name_label, "MEM.Name");
     1557        Dictionary.setText(name_label, "GEMS.Name");
    14201558        name_field = new NonWhitespaceField();
    14211559        name_field.setBackground(config.getColor("coloring.collection_tree_background", false));
     
    14231561        name_field.setSelectionColor(config.getColor("coloring.collection_selection_background", false));
    14241562        name_field.setSelectedTextColor(config.getColor("coloring.collection_selection_foreground", false));
    1425         Dictionary.setTooltip(name_field, "MEM.Element_Name_Tooltip");
     1563        Dictionary.setTooltip(name_field, "GEMS.Element_Name_Tooltip");
    14261564
    14271565        JPanel button_pane = new JPanel();
     
    14901628            element = null;
    14911629            setVisible(false);
    1492                      set_changed = true;
     1630                   
     1631                    //mark as changed
     1632                    atLeastOneSetChanged = true;
     1633                    current_set.setSetChanged(true);
     1634                 
    14931635        }
    14941636        // Otherwise show an error message and do not proceed.
    14951637        else {
    1496             JOptionPane.showMessageDialog(self, Dictionary.get("Gems.Element_Already_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
     1638            JOptionPane.showMessageDialog(self, Dictionary.get("GEMS.Element_Already_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
    14971639        }
    14981640        name_str = null;
     
    15131655            // Warn the user that they can't do that dave.
    15141656            else {
    1515                         set_changed = false;
    1516             JOptionPane.showMessageDialog(self, Dictionary.get("MEM.Cannot_Add_Elements_To_Greenstone_MDS"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
     1657                       
     1658            JOptionPane.showMessageDialog(self, Dictionary.get("GEMS.Cannot_Add_Elements_To_Greenstone_MDS"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
    15171659            }
    15181660        }
     
    15501692        JLabel profile_label = new JLabel();
    15511693        profile_label.setOpaque(false);
    1552         Dictionary.setText(profile_label, "MEM.Profile");
     1694        Dictionary.setText(profile_label, "GEMS.Profile");
    15531695
    15541696        JPanel name_pane = new JPanel();
     
    15561698        JLabel name_label = new JLabel();
    15571699        name_label.setOpaque(false);
    1558         Dictionary.setText(name_label, "MEM.Name");
     1700        Dictionary.setText(name_label, "GEMS.Name");
    15591701        name_field = new JTextField();
    15601702        name_field.setBackground(config.getColor("coloring.collection_tree_background", false));
     
    15621704        name_field.setSelectionColor(config.getColor("coloring.collection_selection_background", false));
    15631705        name_field.setSelectedTextColor(config.getColor("coloring.collection_selection_foreground", false));
    1564         Dictionary.setTooltip(name_field, "MEM.Profile_Name_Tooltip");
     1706        Dictionary.setTooltip(name_field, "GEMS.Profile_Name_Tooltip");
    15651707
    15661708        JPanel button_pane = new JPanel();
     
    16231765        // Otherwise warn the user and don't hide the prompt.
    16241766        // else {
    1625         JOptionPane.showMessageDialog(self, Dictionary.get("MEM.File_Already_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
     1767        JOptionPane.showMessageDialog(self, Dictionary.get("GEMS.File_Already_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
    16261768        // }
    16271769        name_str = null;
     
    16531795    private JTextField name_field = null;
    16541796    private JTextField namespace_field = null;
     1797        private JComboBox existingSetJComboBox = new JComboBox();
     1798           
    16551799    public AddSetActionListener() {
    16561800        super(self);
    16571801        setModal(true);
    16581802        setSize(ADD_SET_SIZE);
    1659         Dictionary.setText(this, "MEM.AddSet");
     1803        Dictionary.setText(this, "GEMS.AddSet");
    16601804
    16611805        // Creation
     
    16701814        JLabel namespace_label = new JLabel();
    16711815        namespace_label.setOpaque(false);
    1672         Dictionary.setText(namespace_label, "MEM.Namespace");
     1816        Dictionary.setText(namespace_label, "GEMS.Namespace");
    16731817        namespace_field = TransformCharacterTextField.createNamespaceTextField();
    16741818        namespace_field.setBackground(config.getColor("coloring.collection_tree_background", false));
     
    16761820        namespace_field.setSelectionColor(config.getColor("coloring.collection_selection_background", false));
    16771821        namespace_field.setSelectedTextColor(config.getColor("coloring.collection_selection_foreground", false));
    1678         Dictionary.setTooltip(namespace_field, "MEM.Set_Namespace_Tooltip");
     1822        Dictionary.setTooltip(namespace_field, "GEMS.Set_Namespace_Tooltip");
    16791823
    16801824        JLabel name_label = new JLabel();
    16811825        name_label.setOpaque(false);
    1682         Dictionary.setText(name_label, "MEM.Name");
     1826        Dictionary.setText(name_label, "GEMS.Name");
    16831827        name_field = new JTextField();
    16841828        name_field.setBackground(config.getColor("coloring.collection_tree_background", false));
     
    16861830        name_field.setSelectionColor(config.getColor("coloring.collection_selection_background", false));
    16871831        name_field.setSelectedTextColor(config.getColor("coloring.collection_selection_foreground", false));
    1688         Dictionary.setTooltip(name_field, "MEM.Set_Name_Tooltip");
     1832        Dictionary.setTooltip(name_field, "GEMS.Set_Name_Tooltip");
    16891833
    16901834        JPanel button_pane = new JPanel();
     
    17061850
    17071851        // Layout
    1708         label_pane.setLayout(new GridLayout(2,1,0,5));
     1852        label_pane.setLayout(new GridLayout(3,1));
    17091853        label_pane.add(name_label);
    17101854        label_pane.add(namespace_label);
    1711 
    1712         boxes_pane.setLayout(new GridLayout(2,1,0,5));
     1855           // label_pane.add
     1856      //  boxes_pane.setLayout(new GridLayout(2,1,0,5));
     1857            boxes_pane.setLayout(new GridLayout(3,1));
    17131858        boxes_pane.add(name_field);
    17141859        boxes_pane.add(namespace_field);
    1715 
     1860           
     1861            JLabel inheritJLabel = new JLabel();
     1862            Dictionary.setText(inheritJLabel, "GEMS.inheritMetadataSet");
     1863       
     1864            label_pane.add(inheritJLabel);
     1865       
     1866           
     1867            //add inherit metadata set functionality
     1868           // String[] s = msm.getSets().toArray();
     1869           
     1870          //JComboBox existingSetJComboBox = new JComboBox(new String(msm.getSetsForInherit().toArray()));
     1871           
     1872            int getSetsLen = msm.getSets().toArray().length;
     1873            Vector theSets = msm.getSets();
     1874           
     1875            for(int k = 0; k < theSets.size(); k++){
     1876                MetadataSet ms = (MetadataSet)theSets.elementAt(k);
     1877               
     1878                existingSetJComboBox.addItem(new String(ms.getName() + "                                                                             #% " + ms.getFile().toString()));
     1879               
     1880            }
     1881            //add sets to existingSetJComboBox
     1882           
     1883           
     1884            //String tempstr = new String();
     1885            JLabel dummyl = new JLabel();
     1886            Dictionary.setText(dummyl, "GEMS.Add_Set.No_Inherit");
     1887           
     1888           
     1889           
     1890            existingSetJComboBox.addItem("Do not inherit");
     1891            existingSetJComboBox.setSelectedIndex(getSetsLen);
     1892            boxes_pane.add(existingSetJComboBox);
     1893             
    17161894        center_pane.setLayout(new BorderLayout(5,0));
    17171895        center_pane.add(label_pane, BorderLayout.WEST);
     
    17261904        content_pane.add(center_pane, BorderLayout.CENTER);
    17271905        content_pane.add(button_pane, BorderLayout.SOUTH);
    1728 
     1906         
    17291907        setLocation((config.screen_size.width - ADD_SET_SIZE.width) / 2, (config.screen_size.height - ADD_SET_SIZE.height) / 2);
    17301908    }
     
    17321910     * @param event An <strong>ActionEvent</strong> containing information about the event.
    17331911     */
     1912        private boolean a_set_exists_with_this_namespace(String namespace){
     1913            Vector p = msm.getSets();
     1914            boolean flag = false;
     1915            for(int k = 0; k < p.size(); k++){
     1916                MetadataSet s = (MetadataSet)p.get(k);
     1917               
     1918                if(s.getNamespace().compareTo(namespace) == 0){
     1919                    flag = true;     
     1920                }
     1921               
     1922            }
     1923           
     1924            return flag;
     1925        }
    17341926    public void actionPerformed(ActionEvent event) {
    17351927        Object source = event.getSource();
     1928           
     1929           
     1930          // if(a_set_exists_with_this_namespace(namespace_field.getText()) == false){
    17361931        if(source == ok_button) {
    1737         String namespace_str = namespace_field.getText();
     1932                //this code below handles whether we inherit from an existing set or not
     1933             
     1934                String namespace_str = namespace_field.getText();
    17381935        String name_str = Codec.transform(Codec.transformUnicode(name_field.getText()), Codec.TEXT_TO_DOM);
     1936       
     1937               
     1938               
     1939                if (existingSetJComboBox.getSelectedItem().toString().trim().compareTo("Do not inherit") == 0){
     1940
    17391941        // Ensure the set doesn't already exist
    1740         if(msm.getSet(namespace_str) == null) {
     1942        //if(msm.getSet(namespace_str) == null) {
     1943                if(a_set_exists_with_this_namespace(namespace_str) == false){
     1944       
     1945             
     1946                   
    17411947            MetadataSet set = msm.addSet(namespace_str, name_str);
     1948                   
     1949                    //mark as set changed = true
     1950                    set.setSetChanged(true);
     1951                    atLeastOneSetChanged = true;
     1952                   
    17421953            // Update tree.
    17431954            model.add(null, set, GEMSNode.SET);
     
    17451956            set = null;
    17461957            setVisible(false);
    1747                      set_changed = true;
    1748         }
     1958                   
     1959        }
     1960                else{
     1961                   
     1962                       JOptionPane.showMessageDialog(self, Dictionary.get("GEMS.Set_Already_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
     1963         
     1964                }
     1965                //do not inherit == 0
    17491966        // Otherwise show a warning.
    1750         else {
    1751             JOptionPane.showMessageDialog(self, Dictionary.get("Gems.Set_Already_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
    1752         }
     1967        //else {
     1968         //   JOptionPane.showMessageDialog(self, Dictionary.get("GEMS.Set_Already_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
     1969        //}
     1970               
     1971               
    17531972        name_str = null;
    17541973        namespace_str = null;
     1974                }//end do not inherit
     1975                else {
     1976                    //lets grab the metadata we want to inherit from...
     1977                    String anitem = existingSetJComboBox.getSelectedItem().toString();
     1978                   
     1979                   // if(msm.getSet(namespace_str) == null) {
     1980                    if(a_set_exists_with_this_namespace(namespace_field.getText()) == false){
     1981       
     1982                        //setup to read the filename from mds file
     1983                         String [] items = anitem.split("#%");
     1984                        try {
     1985
     1986                        FileInputStream fstream = new FileInputStream(items[1].trim());
     1987                        DataInputStream in = new DataInputStream(fstream);
     1988                        ///////////////
     1989
     1990                        FileOutputStream out;
     1991                        PrintStream p;
     1992                        //setup to write to filename from existing file
     1993                        try {
     1994                        out = new FileOutputStream(Utility.METADATA_DIR + "/"+ namespace_str + ".mds");
     1995                        p = new PrintStream(out);
     1996
     1997                        //cycle through all lines in IN and print to OUT
     1998                        while(in.available() != 0){
     1999
     2000                            //System.out.println(in.readLine()+ "\n"
     2001                            String nextline = in.readLine();
     2002
     2003                            if(nextline.matches(".+namespace=\".+\".*") == true){
     2004
     2005                               nextline = nextline.replaceFirst("namespace=\".+\"","namespace=\"" + namespace_str+ "\"");                         
     2006                            }
     2007                            else{
     2008                             nextline = nextline.replaceFirst(">.+</Name>",">" + name_str + "</Name>");
     2009
     2010                            }
     2011
     2012
     2013
     2014
     2015                            p.print(nextline + "\n");
     2016                        }
     2017
     2018
     2019                        //
     2020                        p.close();
     2021                       
     2022                        MetadataSet loadedset = msm.loadMetadataSet(new File(Utility.METADATA_DIR + "/" + namespace_str + ".mds"));
     2023                         model.add(null, loadedset, GEMSNode.SET);
     2024                        }
     2025                        catch(Exception e){
     2026                            System.out.println("Print file error");
     2027
     2028                        }
     2029
     2030
     2031
     2032                        ///////////////
     2033
     2034
     2035                        }
     2036                        catch(Exception e){
     2037
     2038                            System.out.println("File Input error");
     2039
     2040                        }
     2041                   
     2042                    }//msm.getset(namespacE) == null
     2043                    else{
     2044                       
     2045                      JOptionPane.showMessageDialog(self, Dictionary.get("GEMS.Set_Already_Exists"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
     2046         
     2047                       
     2048                    }
     2049                }
     2050            //}//if a_set_exists_with_this_namespace
     2051                 //set = null;
     2052         setVisible(false);
    17552053        }
    17562054        else if(source == cancel_button) {
     
    18002098        JLabel subject_tree_label = new JLabel();
    18012099        subject_tree_label.setOpaque(false);
    1802         Dictionary.setText(subject_tree_label, "MEM.Subject");
     2100        Dictionary.setText(subject_tree_label, "GEMS.Subject");
    18032101        subject_tree = new SmarterTree();
    18042102        subject_tree.setBackground(config.getColor("coloring.collection_tree_background", false));
     
    18102108        JLabel value_label = new JLabel();
    18112109        value_label.setOpaque(false);
    1812         Dictionary.setText(value_label, "MEM.Value");
     2110        Dictionary.setText(value_label, "GEMS.Value");
    18132111        value = new JTextArea();
    18142112        value.setBackground(config.getColor("coloring.collection_tree_background", false));
     
    18162114        value.setSelectionColor(config.getColor("coloring.collection_selection_background", false));
    18172115        value.setSelectedTextColor(config.getColor("coloring.collection_selection_foreground", false));
    1818         Dictionary.setTooltip(value, "MEM.Value_Tooltip");
     2116        Dictionary.setTooltip(value, "GEMS.Value_Tooltip");
    18192117
    18202118        JPanel button_pane = new JPanel();
     
    19262224        // Hide dialog
    19272225        setVisible(false);
    1928                  set_changed = true;
     2226                 atLeastOneSetChanged = true;
    19292227        }
    19302228        else if(source == cancel_button) {
     
    19482246            }
    19492247            value.setText("");
    1950             Dictionary.setText(this, "MEM.AddValue");
     2248            Dictionary.setText(this, "GEMS.AddValue");
    19512249        }
    19522250        else {
     
    19592257            }
    19602258            value.setText(Codec.transform(current_value_node.toString(), Codec.DOM_TO_TEXT));
    1961             Dictionary.setText(this, "MEM.EditValue");
     2259            Dictionary.setText(this, "GEMS.EditValue");
    19622260        }
    19632261        model = null;
     
    20342332    public void actionPerformed(ActionEvent event) {
    20352333        if(current_attribute != -1) {
    2036         int result = JOptionPane.showOptionDialog(self, Dictionary.get("MEM.Confirm_Removal", Dictionary.get("MEM.Attribute")), Dictionary.get("MEM.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);
     2334        int result = JOptionPane.showOptionDialog(self, Dictionary.get("GEMS.Confirm_Removal", Dictionary.get("GEMS.Attribute")), Dictionary.get("GEMS.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);
    20372335        // Remove this attribute
    20382336        if(result == 0) {
     
    20672365            }
    20682366            // Disable buttons
    2069             edit_attribute.setEnabled(false);
     2367           // edit_attribute.setEnabled(false);
    20702368            remove_attribute.setEnabled(false);
    20712369            ignore = false;
    2072                      set_changed = true;
     2370                   
     2371                     atLeastOneSetChanged= true;
    20732372        }
    20742373        }
     
    20822381     */
    20832382    public void actionPerformed(ActionEvent event) {
     2383         
    20842384        if(current_element != null) {
    2085         int result = JOptionPane.showOptionDialog(self, Dictionary.get("MEM.Confirm_Removal", Dictionary.get("MEM.Element")), Dictionary.get("MEM.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);
     2385        int result = JOptionPane.showOptionDialog(self, Dictionary.get("GEMS.Confirm_Removal", Dictionary.get("GEMS.Element")), Dictionary.get("GEMS.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);
    20862386        // Remove this attribute
    20872387        if(result == 0) {
     
    20962396            card_layout.show(details_pane, BLANK);
    20972397            ignore = false;
    2098                      set_changed = true;
     2398                   
     2399                     atLeastOneSetChanged = true;
    20992400        }
    21002401        }
     
    21122413    public void actionPerformed(ActionEvent event) {
    21132414        if(current_collection_file != null) {
    2114         int result = JOptionPane.showOptionDialog(self, Dictionary.get("MEM.Confirm_Removal", Dictionary.get("MEM.File")), Dictionary.get("MEM.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);
     2415        int result = JOptionPane.showOptionDialog(self, Dictionary.get("GEMS.Confirm_Removal", Dictionary.get("GEMS.File")), Dictionary.get("GEMS.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);
    21152416        // Remove the current collection file profile from the profiler.
    21162417        if(result == 0) {
     
    21382439        if(current_set != null) {
    21392440               
    2140                 //If the current_set_filename is dls or dc or ex and in the METADATA_DIR, then do
     2441                //If the current_set_filename is dls or dublin or ex and in the METADATA_DIR, then do
    21412442                //not let anyone remove them --Attila
    21422443               // System.out.println(current_set.getName());
     
    21452446                File current_set_filename = current_set.getFile();
    21462447              //  System.out.println(current_set_filename.toString());
    2147                 
     2448               
    21482449                if(current_set_filename.toString().compareTo(new String(Utility.METADATA_DIR+"dls.mds")) == 0 ||
    2149                     current_set_filename.toString().compareTo(new String(Utility.METADATA_DIR+"dc.mds")) == 0 ||
     2450                    current_set_filename.toString().compareTo(new String(Utility.METADATA_DIR+"dublin.mds")) == 0 ||
    21502451                    current_set_filename.toString().compareTo(new String(Utility.METADATA_DIR+"ex.mds")) == 0){
    21512452                 
    2152                     JOptionPane.showMessageDialog(self, Dictionary.get("Gems.Cannot_Delete_Core_Sets_Error"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
     2453                    JOptionPane.showMessageDialog(self, Dictionary.get("GEMS.Cannot_Delete_Core_Sets_Error"), Dictionary.get("General.Error"), JOptionPane.ERROR_MESSAGE);
    21532454                    return;
    21542455                }
    21552456               
    21562457               
    2157         int result = JOptionPane.showOptionDialog(self, Dictionary.get("MEM.Confirm_Removal", Dictionary.get("MEM.Set")), Dictionary.get("MEM.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);
     2458        int result = JOptionPane.showOptionDialog(self, Dictionary.get("GEMS.Confirm_Removal", Dictionary.get("GEMS.Set")), Dictionary.get("GEMS.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);
    21582459        // Remove the currently selected set
    21592460        if(result == 0) {
     2461                   
    21602462            ignore = true;
    21612463            msm.removeSet(current_set);
     
    21682470            card_layout.show(details_pane, BLANK);
    21692471            ignore = false;
    2170                      set_changed = true;
     2472                   
     2473                   
     2474                    //We do not need to set the following var because by this point the set was
     2475                    //completetely removed
     2476                    //atLeastOneSetChanged
     2477                   
     2478                   
    21712479        }
    21722480        }
     
    21812489    public void actionPerformed(ActionEvent event) {
    21822490        if(current_value_node != null) {                 
    2183         int result = JOptionPane.showOptionDialog(self, Dictionary.get("MEM.Confirm_Removal", Dictionary.get("MEM.Value")), Dictionary.get("MEM.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);
     2491        int result = JOptionPane.showOptionDialog(self, Dictionary.get("GEMS.Confirm_Removal", Dictionary.get("GEMS.Value")), Dictionary.get("GEMS.Confirm_Removal_Title"), JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, dialog_options, dialog_options[0]);
    21842492        // Remove the current selected value
    21852493        if(result == 0) {
     
    21912499            remove_value.setEnabled(false);
    21922500            ignore = false;
    2193                      set_changed = true;
     2501                   
     2502                    //does this every get called?
     2503                    System.out.println("\nGEMS.RemovevalueActionListener called");
     2504                    atLeastOneSetChanged = true;
    21942505        }
    21952506        }
     
    22572568        if(!event.getValueIsAdjusting()) {
    22582569        if((current_attribute = table.getSelectedRow()) != -1) {
    2259             edit_attribute.setEnabled(true);
    2260             remove_attribute.setEnabled(true);
     2570          //  edit_attribute.setEnabled(true);
     2571          //  remove_attribute.setEnabled(true);
     2572                     // System.out.println("curr_attr != -1");
     2573         
    22612574        }
    22622575        else {
     2576                   // System.out.println("curr_attr = -1");
    22632577            current_attribute = -1;
    2264             edit_attribute.setEnabled(false);
    2265             remove_attribute.setEnabled(false);
     2578          //  edit_attribute.setEnabled(false);
     2579          //  remove_attribute.setEnabled(false);
    22662580        }
    22672581        }
     
    23132627            // !!! String action = msm.profiler.getAction(current_collection_file, source);
    23142628            // if (action == null) {
    2315             // action = Dictionary.get("MEM.Ignore");
     2629            // action = Dictionary.get("GEMS.Ignore");
    23162630            // }
    23172631            // attributes.add(new Attribute(source, action));
    23182632            // }
    2319             atm = new AttributeTableModel(attributes, Dictionary.get("MEM.Source"), Dictionary.get("MEM.Target"), Dictionary.get("MEM.Ignore"));
     2633            atm = new AttributeTableModel(attributes, Dictionary.get("GEMS.Source"), Dictionary.get("GEMS.Target"), Dictionary.get("GEMS.Ignore"));
    23202634            //current_node.setModel(atm);
    23212635            }
     
    23252639
    23262640            card_layout.show(details_pane, PROFILE);
    2327             setControls(true, false, false, true, false, false, true, false, false, false, false, false);
     2641           // setControls(true, false, false, true, false, false, true, false, false, false, false, false);
    23282642            break;
    23292643        case GEMSNode.ELEMENT:
     
    23312645            atm = current_node.getModel();
    23322646            if(atm == null) {
    2333             atm = new AttributeTableModel(current_element.getAttributes(), Dictionary.get("MEM.Name"), Dictionary.get("MEM.Language_Code"), Dictionary.get("MEM.Value"), "");
     2647            atm = new AttributeTableModel(current_element.getAttributes(), Dictionary.get("GEMS.Name"), Dictionary.get("GEMS.Language_Code"), Dictionary.get("GEMS.Value"), "");
    23342648            //current_node.setModel(atm);
    23352649            }
     
    23462660            element_values_layout.show(element_values_pane, VALUES);
    23472661            // Meanwhile disable/enable controls depending on this Element selection.
    2348             setControls(true, false, false, false, false, true, true, false, false, true, false, false);
     2662            //setControls(true, false, false, false, false, true, true, false, false, true, false, false);
    23492663            }
    23502664            else {
    23512665            element_values_layout.show(element_values_pane, BLANK);
    23522666            // Meanwhile disable/enable controls depending on this Element selection.
    2353             setControls(true, false, false, false, false, false, true, false, false, false, false, false);
     2667            //setControls(true, false, false, false, false, false, true, false, false, false, false, false);
    23542668            }
    23552669            card_layout.show(details_pane, ELEMENT);
     
    23692683                attribute = null;
    23702684            }
    2371             atm = new AttributeTableModel(attributes, Dictionary.get("MEM.Name"), Dictionary.get("MEM.Value"), "");
     2685            atm = new AttributeTableModel(attributes, Dictionary.get("GEMS.Name"), Dictionary.get("GEMS.Value"), "");
    23722686            //current_node.setModel(atm);
    23732687            temp = null;
     
    23802694            attributes = null;
    23812695            // Meanwhile disable/enable controls depending on this Element selection.
    2382             setControls(true, true, false, false, true, false, true, false, false, false, false, false);
     2696           // setControls(true, true, false, false, true, false, true, false, false, false, false, false);
    23832697            break;
    23842698        case GEMSNode.PROFILER:
    23852699            // Meanwhile disable/enable controls depending on this Element selection.
    2386             setControls(true, false, true, false, false, false, false, false, false, false, false, false);
     2700            //setControls(true, false, true, false, false, false, false, false, false, false, false, false);
    23872701        default:
    23882702            // Show a blank panel.
     
    23922706        path = null;
    23932707        atm = null;
     2708               
     2709                //System.out.println("Tree eventselection");
    23942710        }
    23952711    }
    23962712    }
    23972713
    2398     private class MEMTreeCellRenderer
     2714    private class GEMSTreeCellRenderer
    23992715    extends DefaultTreeCellRenderer {
    24002716    public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
     
    24372753        static final public int ROOT       = 3;
    24382754        static final public int SET        = 4;
    2439         PopupListener() {
     2755       
     2756        GEMS GEMSRef = null;
     2757        PopupListener(GEMS g) {
    24402758        setPopup = new JPopupMenu();
    24412759        subfieldPopup = new JPopupMenu();
    24422760        elementPopup = new JPopupMenu();
    24432761        attributePopup = new JPopupMenu();
    2444        
     2762           
     2763            //reference to our parent(GEMS), because some of the actionlisteners would not
     2764            //work unless they were declared in GEMS, and I need a way to reference GEMS
     2765           
     2766        GEMSRef = g;
    24452767       
    24462768        //create the MenuItems
     
    24482770        //set related popups
    24492771        menuAddSet = new JMenuItem();
    2450             Dictionary.setText(menuAddSet,"Gems.Popup.menuAddSet");
     2772            //Dictionary.setText(menuAddSet,"GEMS.Popup.menuAddSet");
     2773            Dictionary.setText(menuAddSet,"GEMS.Add_Set_Tooltip");
    24512774           
    24522775        menuRenameSet = new JMenuItem();
    2453         Dictionary.setText(menuRenameSet,"Gems.Popup.menuRenameSet");
     2776        Dictionary.setText(menuRenameSet,"GEMS.Popup.menuRenameSet");
    24542777       
    24552778        menuAddElement =new JMenuItem();
    2456         Dictionary.setText(menuAddElement,"Gems.Popup.menuAddElement");
     2779       // Dictionary.setText(menuAddElement,"GEMS.Popup.menuAddElement");
     2780        Dictionary.setText(menuAddElement,"GEMS.Add_Element_Tooltip");
    24572781       
    24582782        menuAddAttributeSet = new JMenuItem();
    2459         Dictionary.setText(menuAddAttributeSet, "Gems.Popup.menuAddAttribute");
    2460         menuRemoveSet = new JMenuItem();
    2461         Dictionary.setText(menuRemoveSet,"Gems.Popup.menuRemoveSet");
    2462         //subfield related Gems.Popups
     2783       // Dictionary.setText(menuAddAttributeSet, "GEMS.Popup.menuAddAttribute");
     2784        Dictionary.setText(menuAddAttributeSet, "GEMS.Add_Attribute_Tooltip");
     2785       
     2786           
     2787            menuRemoveSet = new JMenuItem();
     2788        //Dictionary.setText(menuRemoveSet,"GEMS.Popup.menuRemoveSet");
     2789       Dictionary.setText(menuRemoveSet,"GEMS.Remove_Set_Tooltip");
     2790       
     2791            //subfield related GEMS.Popups
    24632792            menuRenameSubfield = new JMenuItem();
    2464             Dictionary.setText(menuRenameSubfield,"Gems.Popup.menuRenameSubfield");
     2793            Dictionary.setText(menuRenameSubfield,"GEMS.Popup.menuRenameSubfield");
    24652794           
    24662795            menuDeleteSubfield=new JMenuItem();
    2467             Dictionary.setText(menuDeleteSubfield,"Gems.Popup.menuRemoveSubfield");
     2796            Dictionary.setText(menuDeleteSubfield,"GEMS.Popup.menuRemoveSubfield");
    24682797           
    24692798            menuAddAttributeSubfield=new JMenuItem();
    2470             Dictionary.setText(menuAddAttributeSubfield,"Gems.Popup.menuAddAttribute");
    2471            
    2472             //element related Gems.Popups
     2799           // Dictionary.setText(menuAddAttributeSubfield,"GEMS.Popup.menuAddAttribute");
     2800             Dictionary.setText(menuAddAttributeSubfield,"GEMS.Add_Attribute_Tooltip");
     2801           
     2802            //element related GEMS.Popups
    24732803            menuRenameElement=new JMenuItem();
    2474             Dictionary.setText(menuRenameElement,"Gems.Popup.menuRenameElement");
     2804           // Dictionary.setText(menuRenameElement,"GEMS.Popup.menuRenameElement");
     2805            //Dictionary.setText(menuRenameElement,"GEMS.Rename_Element_Tooltip");
    24752806           
    24762807            menuDeleteElement=new JMenuItem();
    2477             Dictionary.setText(menuDeleteElement,"Gems.Popup.menuRemoveElement");
     2808           // Dictionary.setText(menuDeleteElement,"GEMS.Popup.menuRemoveElement");
     2809            Dictionary.setText(menuDeleteElement,"GEMS.Remove_Element_Tooltip");
    24782810           
    24792811            menuAddAttributeElement=new JMenuItem();
    2480             Dictionary.setText(menuAddAttributeElement,"Gems.Popup.menuAddAttribute");
     2812            //Dictionary.setText(menuAddAttributeElement,"GEMS.Popup.menuAddAttribute");
     2813            Dictionary.setText(menuAddAttributeElement,"GEMS.Add_Attribute_Tooltip");
    24812814           
    24822815            menuAddSubfield=new JMenuItem();
    2483             Dictionary.setText(menuAddSubfield,"Gems.Popup.menuAddSubfield");
     2816            Dictionary.setText(menuAddSubfield,"GEMS.Popup.menuAddSubfield");
     2817             //Dictionary.setText(menuAddSubfield,"GEMS.Add_Subfield");
    24842818       
    2485             //attribute related Gems.Popups
     2819            //attribute related GEMS.Popups
    24862820            menuEditValue=new JMenuItem();
    2487             Dictionary.setText(menuEditValue,"Gems.Popup.menuEditValue");
     2821            //Dictionary.setText(menuEditValue,"GEMS.Popup.menuEditValue");
     2822            Dictionary.setText(menuEditValue,"GEMS.Edit_Value_Tooltip");
    24882823           
    24892824            menuDeleteAttribute=new JMenuItem();
    2490             Dictionary.setText(menuDeleteAttribute,"Gems.Popup.menuRemoveAttribute");
     2825           // Dictionary.setText(menuDeleteAttribute,"GEMS.Popup.menuRemoveAttribute");
     2826            Dictionary.setText(menuDeleteAttribute,"GEMS.Remove_Attribute_Tooltip");
    24912827           
    24922828            menuAddAttributeAttribute=new JMenuItem();
    2493             Dictionary.setText(menuAddAttributeAttribute,"Gems.Popup.menuAddAttribute");
     2829           // Dictionary.setText(menuAddAttributeAttribute,"GEMS.Popup.menuAddAttribute");
     2830             Dictionary.setText(menuAddAttributeAttribute,"GEMS.Add_Attribute_Tooltip");
    24942831             
    24952832             //start Associate the menu items with the appropriate popups:
    24962833             //setPopup.add(menuRenameSet);
    2497             //setPopup.add(menuAddSet);
     2834            setPopup.add(menuAddSet);
    24982835        setPopup.add(menuAddAttributeSet);
    24992836        setPopup.add(menuAddElement);
     
    25282865             menuAddSubfield.addActionListener(this);
    25292866             
     2867            // menuEditValue.addActionListener(new AddOrEditAttributeActionListener());
     2868             AddOrEditAttributeActionListener tes = new AddOrEditAttributeActionListener();
     2869             
    25302870             menuEditValue.addActionListener(new AddOrEditAttributeActionListener());
     2871             
     2872             //menuEditValue.addActionListener(this);
     2873             
    25312874             menuDeleteAttribute.addActionListener(new RemoveAttributeActionListener());
    25322875             menuAddAttributeAttribute.addActionListener(new AddOrEditAttributeActionListener());
     
    25522895               // setPopup.show(e.getComponent(),
    25532896                 //          e.getX(), e.getY());
    2554                
     2897               //System.out.println(e.getSource().toString());
     2898               
     2899               //SmarterTable table = (SmarterTable) e.getSource();
     2900               
     2901             /*  if(table.getSelectedRow() <= -1) {
     2902                   
     2903                   System.out.println("blahasdf");                   
     2904               }
     2905               
     2906               table.getComponent(0)
     2907             
     2908               System.out.println(.get);
     2909               
     2910             
     2911              */
     2912               
    25552913             if(e.getSource() == mds_tree) {
    25562914                try {
     
    26072965     
    26082966        public void actionPerformed(ActionEvent e) {
    2609             System.out.println("dsf");
     2967           // GEMSRef.add_or_edit_attribute_action_listener.actionPerformed(e);
     2968            System.out.println("NO way hose");
    26102969        }
    26112970       
  • trunk/gli/src/org/greenstone/gatherer/gems/MSMUtils.java

    r8270 r8581  
    297297    static public TreeSet getAttributes(Element element) {
    298298    TreeSet attribute_tree = new TreeSet();
     299       
     300       
     301       // GemsLanguageManager gemsLangManager = new GemsLanguageManager("/home/arosmain/gsdl/gli/classes/xml/languages.xml");
     302        GEMSLanguageManager gemsLangManager = new GEMSLanguageManager(Configuration.gsdl_path + "/gli/classes/xml/languages.xml");
     303       
     304        String[] enabled_langs = gemsLangManager.getEnabledLanguageCodesToArray();
     305                       
    299306    for(Node node = element.getFirstChild(); node != null; node = node.getNextSibling()) {
    300307        if(node instanceof Element) {
     
    303310        if(some_element_name.equals(StaticStrings.ATTRIBUTE_ELEMENT)) {
    304311            attribute_tree.add(new Attribute(some_element.getAttribute(StaticStrings.NAME_ATTRIBUTE), some_element.getAttribute(StaticStrings.LANGUAGE_ATTRIBUTE), MSMUtils.getValue(some_element)));
    305         }
     312                    // System.out.println(some_element_name +  "<- some_element nodes' value");
     313                 
     314               
     315                }
    306316        else if(some_element_name.equals(StaticStrings.LANGUAGE_ELEMENT)) {
     317                    ///Added by Attila on Nov 05 04
     318                   // System.out.println(some_element_name +  "<- some_element nodes' value");
     319                   
     320                   
     321                    ////
     322                   
    307323            String language_code = some_element.getAttribute(StaticStrings.CODE_ATTRIBUTE);
    308324            NodeList attribute_elements = some_element.getElementsByTagName(StaticStrings.ATTRIBUTE_ELEMENT);
     325                   
    309326            for(int i = 0; i < attribute_elements.getLength(); i++) {
    310327            Element attribute_element = (Element) attribute_elements.item(i);
    311             attribute_tree.add(new Attribute(attribute_element.getAttribute(StaticStrings.NAME_ATTRIBUTE), language_code, MSMUtils.getValue(attribute_element)));
     328                     
     329                     
     330                            //System.out.println("code is:" + language_code);
     331                       
     332                           
     333                            for(int k = 0; k < enabled_langs.length; k++){
     334                               
     335                               if(enabled_langs[k].trim().compareTo(some_element.getAttributes().item(0).getNodeValue().toString()) == 0){
     336                                   
     337                               
     338                               
     339                                 attribute_tree.add(new Attribute(attribute_element.getAttribute(StaticStrings.NAME_ATTRIBUTE), language_code, MSMUtils.getValue(attribute_element)));
     340                     attribute_element = null;
     341                                 
     342                                 break;
     343                               }
     344                               //else {
     345                               //    System.out.println(enabled_langs[k].trim().toString() + some_element.getAttributes().item(0).getNodeValue().toString());
     346                              // }
     347                           
     348                            }
     349                        //  enabled_languages_split[k].toLowerCase().trim();
     350             
     351                           
     352                       // if(match_exit_flag == false)
     353                            // break;
     354                        //add language specific attr's:
     355            //attribute_tree.add(new Attribute(attribute_element.getAttribute(StaticStrings.NAME_ATTRIBUTE), language_code, MSMUtils.getValue(attribute_element)));
    312356            attribute_element = null;
    313357            }
     
    319363        }
    320364    }
     365     //  attribute_tree.
    321366    return attribute_tree;
    322367    }
  • trunk/gli/src/org/greenstone/gatherer/gems/MetadataSet.java

    r8392 r8581  
    6666    // the nmae of the collection if this set is collection-specific
    6767    private String collection = null;
    68     //I realize I should be using getters and setters, but for a quick fix
    69     public boolean set_changed = false;
     68    //set_changed is check in msm(metadatasetmanager).save() and if this is true then we save
     69    //the collection, otherwise we leave it as is
     70    private boolean setChanged = false;
    7071    private String current_language_code;
    7172    /** The description of this metadata set. Cached as it takes more computation time. */
     
    124125    }
    125126    }
    126     /** Conditional copy constructor.
     127 
     128    public boolean getSetChanged() {
     129       
     130        return setChanged;   
     131    }
     132    public void setSetChanged(boolean val) {
     133         
     134        setChanged = val;
     135    }
     136      /** Conditional copy constructor.
    127137     * @param original The original metadata set to copy from.
    128138     * @param condition An <i>int</i> which matches one of the tree pruning filter types.
  • trunk/gli/src/org/greenstone/gatherer/gems/MetadataSetManager.java

    r8393 r8581  
    102102    return mds;
    103103    }
    104 
     104    public Vector getVectorSets() {   
     105        Vector sets = new Vector();
     106       
     107        File metadata_directory = new File(Utility.METADATA_DIR);
     108    if (metadata_directory.exists()) {
     109        // Load just those .mds files in this directory, and return them
     110        File[] directory_files = metadata_directory.listFiles();
     111        for (int i = 0; i < directory_files.length; i++) {
     112        File child_file = directory_files[i];
     113        if (!child_file.isDirectory() && child_file.getName().endsWith(".mds")) {
     114            System.err.println("Found mds file: " + child_file);
     115            MetadataSet metadata_set = loadMetadataSet(child_file);
     116                  //  metadata_set.getName();
     117                    sets.add(new String(child_file.toString() + " ^ " + metadata_set.getName()));
     118            //model.add(null, metadata_set, GEMSNode.SET);
     119        }
     120        }
     121    }
     122        return sets;
     123    }
     124    public Object [] getVectorSetsToStringArray() {
     125       
     126        return getSets().toArray();   
     127    }
    105128    /** Add a value tree to a given metadata element represented as a GValueModel
    106129     * @param model The <strong>GValueTree</strong> model
     
    288311    return result;
    289312    }
    290 
     313 
    291314
    292315    /** Get the value tree that matches the given element.
     
    465488                //set has not changed(or has been recently saved
    466489             
    467                 //if(set.set_changed == false){
    468                 //  continue;     
    469                 //}
     490             
     491             /*
     492                if(set.getSetChanged() == false){
     493                  continue;   
     494                }*/
    470495               
    471496         // just use the existing file path
     
    477502               
    478503               
    479                    // System.out.println("::: " + mds_file.toString());
     504            // System.out.println("::: " + mds_file.toString());
    480505         Utility.export(set.getDocument(), mds_file);
     506             
     507             set.setSetChanged(false);
    481508         //What does setfile do?
    482509         //set.setFile(mds_file);
     
    512539    public void removeSet(MetadataSet set) {
    513540    mds_hashtable.remove(set.getNamespace());
     541        File f =  set.getFile();
     542        f.delete();
     543        //System.out.println(f.toString() + Utility.METADATA_DIR);
    514544    // fireSetChanged(set);
    515545    }
Note: See TracChangeset for help on using the changeset viewer.