OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library search; | 5 library search; |
6 | 6 |
7 import 'dart:html'; | 7 import 'dart:html'; |
8 import 'dropdown.dart'; | 8 import 'dropdown.dart'; |
9 import '../dartdoc/nav.dart'; | 9 import '../dartdoc/nav.dart'; |
10 | 10 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 window.location.href = url; | 105 window.location.href = url; |
106 hideDropDown(); | 106 hideDropDown(); |
107 } | 107 } |
108 | 108 |
109 row = table.insertRow(table.rows.length); | 109 row = table.insertRow(table.rows.length); |
110 row.classes.add('drop-down-link-tr'); | 110 row.classes.add('drop-down-link-tr'); |
111 row.onMouseDown.listen((event) => hideDropDownSuspend = true); | 111 row.onMouseDown.listen((event) => hideDropDownSuspend = true); |
112 row.onClick.listen(clickHandler); | 112 row.onClick.listen(clickHandler); |
113 row.onMouseUp.listen((event) => hideDropDownSuspend = false); | 113 row.onMouseUp.listen((event) => hideDropDownSuspend = false); |
114 var sb = new StringBuffer(); | 114 var sb = new StringBuffer(); |
115 sb.add('<td class="drop-down-link-td">'); | 115 sb.write('<td class="drop-down-link-td">'); |
116 sb.add('<table class="drop-down-table"><tr><td colspan="2">'); | 116 sb.write('<table class="drop-down-table"><tr><td colspan="2">'); |
117 if (kind == GETTER) { | 117 if (kind == GETTER) { |
118 sb.add('get '); | 118 sb.write('get '); |
119 } else if (kind == SETTER) { | 119 } else if (kind == SETTER) { |
120 sb.add('set '); | 120 sb.write('set '); |
121 } | 121 } |
122 sb.add(match.toHtml()); | 122 sb.write(match.toHtml()); |
123 if (kind == CLASS || kind == INTERFACE || kind == TYPEDEF) { | 123 if (kind == CLASS || kind == INTERFACE || kind == TYPEDEF) { |
124 sb.add(args); | 124 sb.write(args); |
125 } else if (kind == CONSTRUCTOR || kind == METHOD) { | 125 } else if (kind == CONSTRUCTOR || kind == METHOD) { |
126 if (noargs) { | 126 if (noargs) { |
127 sb.add("()"); | 127 sb.write("()"); |
128 } else { | 128 } else { |
129 sb.add('(...)'); | 129 sb.write('(...)'); |
130 } | 130 } |
131 } | 131 } |
132 sb.add('</td></tr><tr><td class="drop-down-link-kind">'); | 132 sb.write('</td></tr><tr><td class="drop-down-link-kind">'); |
133 sb.add(kindToString(kind)); | 133 sb.write(kindToString(kind)); |
134 if (prefix != null) { | 134 if (prefix != null) { |
135 sb.add(' in '); | 135 sb.write(' in '); |
136 sb.add(prefix.toHtml()); | 136 sb.write(prefix.toHtml()); |
137 sb.add(args); | 137 sb.write(args); |
138 } else if (type != null) { | 138 } else if (type != null) { |
139 sb.add(' in '); | 139 sb.write(' in '); |
140 sb.add(type); | 140 sb.write(type); |
141 sb.add(args); | 141 sb.write(args); |
142 } | 142 } |
143 | 143 |
144 sb.add('</td><td class="drop-down-link-library">'); | 144 sb.write('</td><td class="drop-down-link-library">'); |
145 if (library != null) { | 145 if (library != null) { |
146 sb.add('library $library'); | 146 sb.write('library $library'); |
147 } | 147 } |
148 sb.add('</td></tr></table></td>'); | 148 sb.write('</td></tr></table></td>'); |
149 row.innerHtml = sb.toString(); | 149 row.innerHtml = sb.toString(); |
150 } | 150 } |
151 } | 151 } |
152 | 152 |
153 /** | 153 /** |
154 * Creates a [StringMatch] object for [text] if a substring matches | 154 * Creates a [StringMatch] object for [text] if a substring matches |
155 * [searchText], or returns [: null :] if no match is found. | 155 * [searchText], or returns [: null :] if no match is found. |
156 */ | 156 */ |
157 StringMatch obtainMatch(SearchText searchText, String text) { | 157 StringMatch obtainMatch(SearchText searchText, String text) { |
158 if (searchText.isEmpty) { | 158 if (searchText.isEmpty) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 // Sort type alphabetically. | 221 // Sort type alphabetically. |
222 // TODO(4805): Use [:type.compareToIgnoreCase] when supported. | 222 // TODO(4805): Use [:type.compareToIgnoreCase] when supported. |
223 result = a.type.toLowerCase().compareTo(b.type.toLowerCase()); | 223 result = a.type.toLowerCase().compareTo(b.type.toLowerCase()); |
224 if (result != 0) return result; | 224 if (result != 0) return result; |
225 } | 225 } |
226 | 226 |
227 // Sort match alphabetically. | 227 // Sort match alphabetically. |
228 // TODO(4805): Use [:text.compareToIgnoreCase] when supported. | 228 // TODO(4805): Use [:text.compareToIgnoreCase] when supported. |
229 return a.match.text.toLowerCase().compareTo(b.match.text.toLowerCase()); | 229 return a.match.text.toLowerCase().compareTo(b.match.text.toLowerCase()); |
230 } | 230 } |
OLD | NEW |