aboutsummaryrefslogtreecommitdiffstats
path: root/src/de/gultsch/chat/ConversationList.java
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-01-24 02:04:05 +0100
committerDaniel Gultsch <daniel.gultsch@rwth-aachen.de>2014-01-24 02:04:05 +0100
commit35f8ab58f4b6f97f02031b056d2a5f6f993672cf (patch)
treef3b9cda64e6e08337a44588a564d5194fe8b3225 /src/de/gultsch/chat/ConversationList.java
inital commit
Diffstat (limited to 'src/de/gultsch/chat/ConversationList.java')
-rw-r--r--src/de/gultsch/chat/ConversationList.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/de/gultsch/chat/ConversationList.java b/src/de/gultsch/chat/ConversationList.java
new file mode 100644
index 00000000..b043f61a
--- /dev/null
+++ b/src/de/gultsch/chat/ConversationList.java
@@ -0,0 +1,41 @@
+package de.gultsch.chat;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+
+public class ConversationList extends ArrayList<Conversation> {
+
+ private static final long serialVersionUID = 3661496589984289968L;
+
+ private int selectedConversationPosition = -1;
+
+ private ConversationCursor cursor = new ConversationCursor(this);
+
+ public ConversationCursor getCursor() {
+ return this.cursor;
+ }
+
+ public Conversation getSelectedConversation() {
+ return this.get(this.selectedConversationPosition);
+ }
+
+ public void setSelectedConversationPosition(int selectedConversation) {
+ this.selectedConversationPosition = selectedConversation;
+ }
+
+ public void sort() {
+ Conversation selectedConversation = this.get(selectedConversationPosition);
+ //sort this
+ Collections.sort(this, new Comparator<Conversation>() {
+
+ @Override
+ public int compare(Conversation lhs, Conversation rhs) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+ });
+
+ this.selectedConversationPosition = this.indexOf(selectedConversation);
+ }
+}