Changeset 5651


Ignore:
Timestamp:
2003-10-16T11:22:08+13:00 (21 years ago)
Author:
jmt12
Message:

Workaround for [ and ] bug, plus ensuring collection released, configuration saved etc

File:
1 edited

Legend:

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

    r5593 r5651  
    4848import org.greenstone.gatherer.cdm.Format;
    4949import org.greenstone.gatherer.msm.ElementWrapper;
    50 import org.greenstone.gatherer.util.GSDLSiteConfig;
    5150import org.greenstone.gatherer.util.Utility;
    5251import org.w3c.dom.*;
     
    103102    }
    104103
     104   /** Have the formats changed since the last save. */
     105   public boolean formatsChanged() {
     106      return formats_changed;
     107   }
     108   
    105109    /** Gets the format indicated by the index.
    106110     * @param index The location of the desired format, as an <i>int</i>.
     
    144148    }
    145149
     150   /** Set the state of the formats changed flag.
     151    * @param state the new state as a boolean
     152    */
     153   public void setFormatsChanged(boolean state) {
     154      formats_changed = state;
     155   }
     156   
    146157    private HashMap buildDefaultMappings(ArrayList features_model, ArrayList parts_model) {
    147158    System.err.println("buildDefaultMappings(): replace me with something that reads in a data xml file.");
     
    385396    public void destroy() {
    386397    }
    387 
     398       
    388399    /** Overriden to ensure that the instructions pane is scrolled to the top.
    389400     */
     
    414425        format = null;
    415426        }
    416 
    417         // Now if the formats have changed, and the greenstone local library is being used and the collection has been built for previewing, then remove the add the collection to Greenstone to ensure the formatting updates correctly.
    418         if(formats_changed && Gatherer.c_man.built() && Gatherer.config.exec_file != null) {
    419         // Release the collection
    420         Gatherer.g_man.preview_pane.configServer(GSDLSiteConfig.RELEASE_COMMAND + Gatherer.c_man.getCollection().getName());
    421         // Then re-add it to force format commands to be processed
    422         Gatherer.g_man.preview_pane.configServer(GSDLSiteConfig.ADD_COMMAND + Gatherer.c_man.getCollection().getName());
    423         }
    424         formats_changed = false;
    425427    }
    426428
     
    735737        implements ActionListener {
    736738
    737         public void actionPerformed(ActionEvent event) {
    738         /** @todo **/
    739         }
     739       public void actionPerformed(ActionEvent event) {
     740          ignore_event = true; // Prevent format_list excetera propagating events
     741
     742          if(!format_list.isSelectionEmpty()) {
     743
     744         // Remove the current format
     745         removeFormat((Format)format_list.getSelectedValue());
     746         
     747         Entry entry = (Entry)feature_combobox.getSelectedItem();
     748         Object f = entry.getFeature();
     749         String p = (String)part_combobox.getSelectedItem();
     750         Format format = null;
     751         if(view_type.equals(FLAG)) {
     752            format = new Format(f, p, enabled_checkbox.isSelected());
     753         }
     754         else {
     755            format = new Format(f, p, editor_textarea.getText());
     756         }
     757         addFormat(format);
     758         add_button.setEnabled(false);
     759         remove_button.setEnabled(true);
     760         // Update list selection
     761         format_list.setSelectedValue(format, true);
     762         format = null;
     763         p = null;
     764         f = null;
     765         entry = null;
     766          }
     767          replace_button.setEnabled(false);
     768          ignore_event = false;
     769       }
    740770    }
    741771    }
Note: See TracChangeset for help on using the changeset viewer.