Show
Ignore:
Timestamp:
04/08/10 12:21:52 (3 years ago)
Author:
hoge1e3
Message:
 
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/csharp/soyText/soyText/ListSyncer.cs

    r36859 r37171  
    122122            cond = SearchCondition.fromExpression(persistentTab.cond); 
    123123        } 
    124          
     124        public DocumentLabel getLabel(string id) 
     125        { 
     126            if (d2r.ContainsKey(id)) return d2r[id]; 
     127            return null; 
     128        } 
    125129        public bool update(Document d) 
    126130        { 
    127131            if (contains(d)) return removeUnlessMatch(d); 
    128132            else return addIfMatch(d); 
     133        } 
     134        public void bringToTop(Document d) 
     135        { 
     136            var lb = getLabel(d.id); 
     137            if (lb == null) return; 
     138            if (list.Items.IndexOf(lb) == 0) return; 
     139            list.Items.Remove(lb); 
     140            _insertAt(list, 0, lb); 
     141            list.SelectedIndex = 0; 
    129142        } 
    130143        bool addIfMatch(Document d) { 
     
    244257        internal void addAsNewDoc(Document curDoc) 
    245258        { 
    246             if (contains(curDoc)) return; 
     259            if (contains(curDoc)) 
     260            { 
     261                bringToTop(curDoc); 
     262                return; 
     263            } 
    247264            var r=createRef(curDoc); 
    248265            insertAt(0, r);