Changeset 6801


Ignore:
Timestamp:
2004-02-13T12:01:48+13:00 (20 years ago)
Author:
kjdon
Message:

when you select a feature the part selector is disabled unless parts are allowed

File:
1 edited

Legend:

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

    r6539 r6801  
    462462        Entry entry = (Entry)feature_combobox.getSelectedItem();
    463463        Object f = entry.getFeature();
    464         String p = part_combobox.getSelectedItem().toString();
     464        String p = "";
     465        if (entry.canHavePart()) {
     466            p = part_combobox.getSelectedItem().toString();
     467        }
    465468        Format format = null;
    466469        if(view_type.equals(FLAG)) {
     
    529532        if(!ignore_event) {
    530533            ignore_event = true;
     534            Entry entry = (Entry) feature_combobox.getSelectedItem();
    531535            // Step one: reset part
    532             part_combobox.setSelectedIndex(4);
     536            if (entry.canHavePart()) {
     537            part_combobox.setEnabled(true);
     538            part_combobox.setSelectedIndex(4);
     539
     540            } else {
     541            part_combobox.setEnabled(false);
     542            part_combobox.setSelectedIndex(0);
     543            }
    533544            // Step two: the rest
    534             Entry entry = (Entry) feature_combobox.getSelectedItem();
     545           
    535546            String name = entry.toString();
    536547            // Add is only enabled if there isn't already a format for the choosen feature and part. Create a dummy format and test if itsa already in the model
     
    782793         Entry entry = (Entry)feature_combobox.getSelectedItem();
    783794         Object f = entry.getFeature();
    784          String p = part_combobox.getSelectedItem().toString();
     795         String p =  "";
     796         if (entry.canHavePart()) {
     797            p = part_combobox.getSelectedItem().toString();
     798         }
    785799         Format format = null;
    786800         if(view_type.equals(FLAG)) {
     
    828842    }
    829843   
     844    public boolean canHavePart() {
     845        if (classifier !=null) return true;
     846        return Format.canHavePart(text);
     847    }
     848
    830849    public int compareTo(Object object) {
    831850        if(object == null) {
Note: See TracChangeset for help on using the changeset viewer.