Changeset 185 for trunk/src/org/expeditee/agents/Sort.java
- Timestamp:
- 08/04/08 12:42:11 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/agents/Sort.java
r130 r185 3 3 import java.awt.Point; 4 4 import java.util.ArrayList; 5 import java.util.Collection; 5 6 import java.util.Collections; 6 7 import java.util.Comparator; … … 8 9 import org.expeditee.gui.Frame; 9 10 import org.expeditee.gui.FrameGraphics; 10 import org.expeditee. items.Item;11 import org.expeditee.gui.FrameUtils; 11 12 import org.expeditee.items.Text; 12 13 … … 18 19 */ 19 20 public Frame process(Frame start) { 21 // Check the position of the cursor and only format stuff inside the 22 // same box as the cursor 23 Collection<Text> itemsToSort = FrameUtils.getCurrentTextItems(); 24 if (itemsToSort.size() < 1) { 25 itemsToSort = start.getBodyTextItems(false); 26 } 27 20 28 ArrayList<Text> textItems = new ArrayList<Text>(); 21 22 for (Item i : start.getItems()) 23 if (i instanceof Text) 24 // do not sort title and framename 25 if (i.getID() > -1 && i != start.getTitleItem() 26 && !i.isAnnotation()) { 27 textItems.add((Text) i); 28 } 29 textItems.addAll(itemsToSort); 29 30 30 31 // copy current positions of items … … 37 38 Collections.sort(textItems, new Comparator<Text>() { 38 39 public int compare(Text a, Text b) { 39 return String.CASE_INSENSITIVE_ORDER.compare(a.getText(), 40 b.getText());40 return String.CASE_INSENSITIVE_ORDER.compare(a.getText(), b 41 .getText()); 41 42 } 42 43 });
Note:
See TracChangeset
for help on using the changeset viewer.