From 46ab4ff1bae1a992e262e8d1a4caaf47a40acd0f Mon Sep 17 00:00:00 2001 From: Yana Stamcheva Date: Sat, 21 Oct 2006 22:19:55 +0000 Subject: [PATCH] used to represent a call and a call record in the gui call list --- .../main/call/GuiCallParticipantRecord.java | 79 ++++++++++++++++ .../impl/gui/main/call/GuiCallRecord.java | 94 +++++++++++++++++++ 2 files changed, 173 insertions(+) create mode 100644 src/net/java/sip/communicator/impl/gui/main/call/GuiCallParticipantRecord.java create mode 100644 src/net/java/sip/communicator/impl/gui/main/call/GuiCallRecord.java diff --git a/src/net/java/sip/communicator/impl/gui/main/call/GuiCallParticipantRecord.java b/src/net/java/sip/communicator/impl/gui/main/call/GuiCallParticipantRecord.java new file mode 100644 index 000000000..04562f2bf --- /dev/null +++ b/src/net/java/sip/communicator/impl/gui/main/call/GuiCallParticipantRecord.java @@ -0,0 +1,79 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.impl.gui.main.call; + +import java.util.*; + +import net.java.sip.communicator.service.callhistory.*; + +/** + * The GuiCallParticipantRecord is meant to be used in the call history + * to represent a history call participant record. It wraps a + * CallParticipant or a CallParticipantRecord object. + * + * @author Yana Stamcheva + */ +public class GuiCallParticipantRecord +{ + public static final String INCOMING_CALL = "IncomingCall"; + + public static final String OUTGOING_CALL = "OutgoingCall"; + + private String direction; + + private String participantName; + + private Date startTime; + + private Date endTime; + + public GuiCallParticipantRecord(String participantName, + String direction, + Date startTime, + Date endTime) + { + this.direction = direction; + + this.participantName = participantName; + + this.startTime = startTime; + + this.endTime = endTime; + } + + public GuiCallParticipantRecord(CallParticipantRecord participantRecord, + String direction) + { + this.direction = direction; + + this.participantName = participantRecord.getParticipantAddress(); + + this.startTime = participantRecord.getStartTime(); + + this.endTime = participantRecord.getEndTime(); + } + + public String getDirection() + { + return direction; + } + + public Date getEndTime() + { + return endTime; + } + + public String getParticipantName() + { + return participantName; + } + + public Date getStartTime() + { + return startTime; + } +} diff --git a/src/net/java/sip/communicator/impl/gui/main/call/GuiCallRecord.java b/src/net/java/sip/communicator/impl/gui/main/call/GuiCallRecord.java new file mode 100644 index 000000000..027615b2c --- /dev/null +++ b/src/net/java/sip/communicator/impl/gui/main/call/GuiCallRecord.java @@ -0,0 +1,94 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.impl.gui.main.call; + +import java.util.*; + +import net.java.sip.communicator.service.callhistory.*; +import net.java.sip.communicator.service.protocol.*; + +/** + * The GuiCallRecord is meant to be used in the call history to + * represent a history call record. It wraps a Call or a + * CallRecord object. + * + * @author Yana Stamcheva + */ +public class GuiCallRecord +{ + private Vector participants; + + private Date startTime; + + private Date endTime; + + /** + * + * @param guiParticipantRecords + * @param direction + * @param startTime + * @param endTime + */ + public GuiCallRecord(Vector guiParticipantRecords, + Date startTime, + Date endTime) + { + this.startTime = startTime; + + this.endTime = endTime; + + participants = guiParticipantRecords; + } + + /** + * Creates a GuiCallRecord from a CallRecord. The + * GuiCallRecord will be used in the call history. + * + * @param callRecord the CallParticipantRecord + */ + public GuiCallRecord(CallRecord callRecord) + { + this.startTime = callRecord.getStartTime(); + + this.endTime = callRecord.getEndTime(); + + this.participants = new Vector(); + + Iterator records = callRecord.getParticipantRecords().iterator(); + + while(records.hasNext()) { + CallParticipantRecord record + = (CallParticipantRecord)records.next(); + + GuiCallParticipantRecord newRecord + = new GuiCallParticipantRecord( + record, callRecord.getDirection()); + + this.participants.add(newRecord); + } + } + + public Date getEndTime() + { + return endTime; + } + + public Iterator getParticipants() + { + return participants.iterator(); + } + + public int getParticipantsCount() + { + return participants.size(); + } + + public Date getStartTime() + { + return startTime; + } +}