Changeset 12823


Ignore:
Timestamp:
2006-09-21T17:23:54+12:00 (18 years ago)
Author:
kjdon
Message:

added a sort_options flag - if set to false, won't sort the options in the comobobox

File:
1 edited

Legend:

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

    r9184 r12823  
    5757    private Color selection_foreground = null;
    5858
     59    private boolean sort_objects = true;
     60
    5961    public GComboBox() {
    6062    super();
     
    7981    }
    8082
     83    public GComboBox(ArrayList data, boolean editable, boolean sorted) {
     84    super(data.toArray());
     85    setEditable(editable);
     86    setSorted(sorted);
     87    init();
     88    }
     89
    8190    public GComboBox(ComboBoxModel model) {
    8291    super(model);
     
    101110    }
    102111
     112    public GComboBox(Object data[], boolean editable, boolean sorted) {
     113    super(data);
     114    setEditable(editable);
     115    setSorted(sorted);
     116    init();
     117    }
     118
    103119    public GComboBox(Vector data) {
    104120    super(data);
     
    112128    }
    113129
     130    public void setSorted(boolean sort) {
     131    sort_objects = sort;
     132    }
    114133    public int add(Object object) {
    115134    if (dataModel instanceof Model) {
     
    247266    private class Model
    248267    extends DefaultComboBoxModel {
    249 
     268   
     269   
    250270    public int add(Object extension) {
    251271        int position = 0;
     
    255275        int order = extension_str.compareTo(sibling);
    256276        // If we are now less than the sibling, insert here.
    257         if(order < 0) {
     277        if(sort_objects && order < 0) {
    258278            insertElementAt(extension, position);
    259279            extension = null;
Note: See TracChangeset for help on using the changeset viewer.