mirror of https://github.com/sipwise/jitsi.git
Remove the call history form plugin, which is now replaced with the new call history feature in the contact list.cusax-fix
parent
4cb5df263d
commit
ad857d7606
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* 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.plugin.callhistoryform;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import net.java.sip.communicator.service.gui.*;
|
||||
|
||||
/**
|
||||
* Tha button that will open the call history through the favorites menu.
|
||||
*
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public class CallHistoryButton
|
||||
implements FavoritesButton
|
||||
{
|
||||
byte[] buttonIcon = ExtendedCallHistorySearchActivator.getResources()
|
||||
.getImageInBytes("plugin.callhistorysearch.HISTORY_BUTTON");
|
||||
|
||||
public void actionPerformed()
|
||||
{
|
||||
ExtendedCallHistorySearchDialog callHistorySearchDialog
|
||||
= new ExtendedCallHistorySearchDialog();
|
||||
|
||||
callHistorySearchDialog.setLocation(Toolkit.getDefaultToolkit()
|
||||
.getScreenSize().width
|
||||
/ 2 - callHistorySearchDialog.getWidth() / 2, Toolkit
|
||||
.getDefaultToolkit().getScreenSize().height
|
||||
/ 2 - callHistorySearchDialog.getHeight() / 2);
|
||||
|
||||
callHistorySearchDialog.loadHistoryCalls();
|
||||
|
||||
callHistorySearchDialog.setVisible(true);
|
||||
}
|
||||
|
||||
public byte[] getImage()
|
||||
{
|
||||
return ExtendedCallHistorySearchActivator.getResources()
|
||||
.getImageInBytes("plugin.callhistorysearch.HISTORY_BUTTON");
|
||||
}
|
||||
|
||||
public String getText()
|
||||
{
|
||||
return ExtendedCallHistorySearchActivator.getResources()
|
||||
.getI18NString("service.gui.HISTORY");
|
||||
}
|
||||
}
|
||||
@ -1,85 +0,0 @@
|
||||
/*
|
||||
* 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.plugin.callhistoryform;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* The <tt>CallList</tt> is the component that contains history call records.
|
||||
*
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public class CallList
|
||||
extends JList
|
||||
implements MouseListener
|
||||
{
|
||||
public CallList()
|
||||
{
|
||||
this.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
|
||||
|
||||
this.getSelectionModel().setSelectionMode(
|
||||
ListSelectionModel.SINGLE_SELECTION);
|
||||
|
||||
this.setCellRenderer(new CallListCellRenderer());
|
||||
|
||||
this.setModel(new CallListModel());
|
||||
|
||||
this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
|
||||
this.addMouseListener(this);
|
||||
}
|
||||
|
||||
public void addItem(Object item)
|
||||
{
|
||||
((CallListModel)this.getModel()).addElement(item);
|
||||
}
|
||||
|
||||
public void addItem(Object item, int index)
|
||||
{
|
||||
((CallListModel)this.getModel()).addElement(index, item);
|
||||
}
|
||||
|
||||
public void removeAll()
|
||||
{
|
||||
((CallListModel)this.getModel()).removeAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes or opens a group of calls.
|
||||
*/
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
if (e.getClickCount() > 1) {
|
||||
|
||||
CallListModel listModel = (CallListModel) this.getModel();
|
||||
|
||||
Object element = listModel.getElementAt(this.getSelectedIndex());
|
||||
|
||||
if (element instanceof String) {
|
||||
if (listModel.isDateClosed(element)) {
|
||||
listModel.openDate(element);
|
||||
} else {
|
||||
listModel.closeDate(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void mouseEntered(MouseEvent e)
|
||||
{}
|
||||
|
||||
public void mouseExited(MouseEvent e)
|
||||
{}
|
||||
|
||||
public void mousePressed(MouseEvent e)
|
||||
{}
|
||||
|
||||
public void mouseReleased(MouseEvent e)
|
||||
{}
|
||||
}
|
||||
@ -1,234 +0,0 @@
|
||||
/*
|
||||
* 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.plugin.callhistoryform;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import net.java.sip.communicator.util.*;
|
||||
import net.java.sip.communicator.util.swing.*;
|
||||
|
||||
/**
|
||||
* The <tt>ContactListCellRenderer</tt> is the custom cell renderer used in
|
||||
* the SIP-Communicator's <tt>ContactList</tt>. It extends JPanel instead of
|
||||
* JLabel, which allows adding different buttons and icons to the contact cell.
|
||||
* The cell border and background are repainted.
|
||||
*
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public class CallListCellRenderer
|
||||
extends JPanel
|
||||
implements ListCellRenderer
|
||||
{
|
||||
|
||||
private JPanel dataPanel = new JPanel(new BorderLayout());
|
||||
|
||||
private JLabel nameLabel = new JLabel();
|
||||
|
||||
private JPanel timePanel = new JPanel(new BorderLayout(8, 0));
|
||||
|
||||
private JLabel timeLabel = new JLabel();
|
||||
|
||||
private JLabel durationLabel = new JLabel();
|
||||
|
||||
private JLabel iconLabel = new JLabel();
|
||||
|
||||
private Icon incomingIcon
|
||||
= ExtendedCallHistorySearchActivator.getResources()
|
||||
.getImage("plugin.callhistorysearch.INCOMING_CALL");
|
||||
|
||||
private Icon outgoingIcon
|
||||
= ExtendedCallHistorySearchActivator.getResources()
|
||||
.getImage("plugin.callhistorysearch.OUTGOING_CALL");
|
||||
|
||||
private boolean isSelected = false;
|
||||
|
||||
private boolean isLeaf = true;
|
||||
|
||||
private String direction;
|
||||
|
||||
/**
|
||||
* Initialize the panel containing the node.
|
||||
*/
|
||||
public CallListCellRenderer()
|
||||
{
|
||||
|
||||
super(new BorderLayout(5, 5));
|
||||
|
||||
this.setBackground(Color.WHITE);
|
||||
|
||||
this.setOpaque(true);
|
||||
|
||||
this.dataPanel.setOpaque(false);
|
||||
|
||||
this.timePanel.setOpaque(false);
|
||||
|
||||
this.setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
|
||||
|
||||
this.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
|
||||
|
||||
this.nameLabel.setIconTextGap(2);
|
||||
|
||||
this.nameLabel.setFont(this.getFont().deriveFont(Font.BOLD));
|
||||
|
||||
this.dataPanel.add(nameLabel, BorderLayout.WEST);
|
||||
|
||||
this.add(dataPanel, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements the <tt>ListCellRenderer</tt> method.
|
||||
*
|
||||
* Returns this panel that has been configured to display the meta contact
|
||||
* and meta contact group cells.
|
||||
*/
|
||||
public Component getListCellRendererComponent(JList list, Object value,
|
||||
int index, boolean isSelected, boolean cellHasFocus)
|
||||
{
|
||||
|
||||
this.dataPanel.remove(timePanel);
|
||||
this.dataPanel.remove(timeLabel);
|
||||
this.dataPanel.remove(durationLabel);
|
||||
this.remove(iconLabel);
|
||||
|
||||
if (value instanceof GuiCallPeerRecord)
|
||||
{
|
||||
|
||||
GuiCallPeerRecord peer = (GuiCallPeerRecord) value;
|
||||
|
||||
this.direction = peer.getDirection();
|
||||
|
||||
if (direction.equals(GuiCallPeerRecord.INCOMING_CALL))
|
||||
iconLabel.setIcon(incomingIcon);
|
||||
else
|
||||
iconLabel.setIcon(outgoingIcon);
|
||||
|
||||
this.nameLabel.setText(peer.getPeerName());
|
||||
|
||||
this.timeLabel.setText(
|
||||
ExtendedCallHistorySearchActivator.getResources()
|
||||
.getI18NString("service.gui.AT") + " "
|
||||
+ GuiUtils.formatTime(peer.getStartTime()));
|
||||
|
||||
this.durationLabel.setText(
|
||||
ExtendedCallHistorySearchActivator.getResources()
|
||||
.getI18NString("service.gui.DURATION") + " "
|
||||
+ GuiUtils.formatTime(peer.getCallTime()));
|
||||
|
||||
// this.nameLabel.setIcon(listModel
|
||||
// .getMetaContactStatusIcon(contactItem));
|
||||
|
||||
this.timePanel.add(timeLabel, BorderLayout.WEST);
|
||||
this.timePanel.add(durationLabel, BorderLayout.EAST);
|
||||
this.dataPanel.add(timePanel, BorderLayout.EAST);
|
||||
|
||||
this.add(iconLabel, BorderLayout.WEST);
|
||||
|
||||
this.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
|
||||
|
||||
// We should set the bounds of the cell explicitely in order to
|
||||
// make getComponentAt work properly.
|
||||
this.setBounds(0, 0, list.getWidth() - 2, 25);
|
||||
|
||||
this.isLeaf = true;
|
||||
}
|
||||
else if (value instanceof String)
|
||||
{
|
||||
|
||||
String dateString = (String) value;
|
||||
|
||||
this.nameLabel.setText(dateString);
|
||||
|
||||
this.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));
|
||||
|
||||
// We should set the bounds of the cell explicitely in order to
|
||||
// make getComponentAt work properly.
|
||||
this.setBounds(0, 0, list.getWidth() - 2, 20);
|
||||
|
||||
this.isLeaf = false;
|
||||
}
|
||||
|
||||
this.isSelected = isSelected;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Paint a background for all groups and a round blue border and background
|
||||
* when a cell is selected.
|
||||
*/
|
||||
public void paintComponent(Graphics g)
|
||||
{
|
||||
super.paintComponent(g);
|
||||
|
||||
g = g.create();
|
||||
try
|
||||
{
|
||||
internalPaintComponent(g);
|
||||
}
|
||||
finally
|
||||
{
|
||||
g.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private void internalPaintComponent(Graphics g)
|
||||
{
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
|
||||
AntialiasingManager.activateAntialiasing(g2);
|
||||
|
||||
if (!this.isLeaf)
|
||||
{
|
||||
|
||||
GradientPaint p = new GradientPaint(0, 0,
|
||||
Constants.BORDER_COLOR, this.getWidth(), this
|
||||
.getHeight(), Constants.GRADIENT_LIGHT_COLOR);
|
||||
|
||||
g2.setPaint(p);
|
||||
g2.fillRoundRect(1, 1, this.getWidth(), this.getHeight() - 1, 7, 7);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (direction.equals(GuiCallPeerRecord.INCOMING_CALL))
|
||||
{
|
||||
|
||||
GradientPaint p = new GradientPaint(0, 0,
|
||||
Constants.HISTORY_IN_CALL_COLOR, this.getWidth(), this
|
||||
.getHeight(), Constants.GRADIENT_LIGHT_COLOR);
|
||||
|
||||
g2.setPaint(p);
|
||||
g2.fillRoundRect(1, 1, this.getWidth(), this.getHeight() - 1,
|
||||
7, 7);
|
||||
}
|
||||
else if (direction.equals(GuiCallPeerRecord.OUTGOING_CALL))
|
||||
{
|
||||
|
||||
GradientPaint p = new GradientPaint(0, 0,
|
||||
Constants.HISTORY_OUT_CALL_COLOR, this.getWidth(), this
|
||||
.getHeight(), Constants.GRADIENT_LIGHT_COLOR);
|
||||
|
||||
g2.setPaint(p);
|
||||
g2.fillRoundRect(1, 1, this.getWidth(), this.getHeight() - 1,
|
||||
7, 7);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isSelected)
|
||||
{
|
||||
|
||||
g2.setColor(Constants.SELECTED_COLOR);
|
||||
g2.fillRoundRect(1, 0, this.getWidth(), this.getHeight(), 7, 7);
|
||||
|
||||
g2.setColor(Constants.LIST_SELECTION_BORDER_COLOR);
|
||||
g2.setStroke(new BasicStroke(1.5f));
|
||||
g2.drawRoundRect(1, 0, this.getWidth() - 2, this.getHeight() - 1,
|
||||
7, 7);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,156 +0,0 @@
|
||||
/*
|
||||
* 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.plugin.callhistoryform;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* The data model of the Call list.
|
||||
*
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public class CallListModel extends AbstractListModel
|
||||
{
|
||||
private final LinkedList<Object> callList = new LinkedList<Object>();
|
||||
|
||||
private final Map<Object, Object> closedDates = new Hashtable<Object, Object>();
|
||||
|
||||
/**
|
||||
* Closes the given date by hiding all containing calls.
|
||||
*
|
||||
* @param date The date to close.
|
||||
*/
|
||||
public void closeDate(Object date)
|
||||
{
|
||||
int startIndex = this.indexOf(date);
|
||||
int endIndex = startIndex;
|
||||
int currentSize = getSize();
|
||||
Collection<Object> c = new ArrayList<Object>();
|
||||
|
||||
for(int i = startIndex + 1; i < currentSize; i ++) {
|
||||
Object o = this.getElementAt(i);
|
||||
|
||||
if(o instanceof GuiCallPeerRecord) {
|
||||
this.closedDates.put(o, date);
|
||||
c.add(o);
|
||||
endIndex++;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
removeAll(c);
|
||||
fireIntervalRemoved(this, startIndex, endIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the given date by showing all containing calls.
|
||||
*
|
||||
* @param date The date to open.
|
||||
*/
|
||||
public void openDate(Object date)
|
||||
{
|
||||
int startIndex = this.indexOf(date);
|
||||
int endIndex = startIndex;
|
||||
|
||||
if (closedDates.containsValue(date))
|
||||
{
|
||||
Iterator<Map.Entry<Object, Object>> dates
|
||||
= closedDates.entrySet().iterator();
|
||||
|
||||
while (dates.hasNext())
|
||||
{
|
||||
Map.Entry<Object, Object> entry = dates.next();
|
||||
Object callRecord = entry.getKey();
|
||||
Object callDate = entry.getValue();
|
||||
|
||||
if (callDate.equals(date))
|
||||
{
|
||||
endIndex++;
|
||||
dates.remove();
|
||||
this.addElement(endIndex, callRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
fireIntervalAdded(this, startIndex, endIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the given date is closed.
|
||||
*
|
||||
* @param date The date to check.
|
||||
* @return True if the date is closed, false - otherwise.
|
||||
*/
|
||||
public boolean isDateClosed(Object date) {
|
||||
return this.closedDates.containsValue(date);
|
||||
}
|
||||
|
||||
public int getSize()
|
||||
{
|
||||
return callList.size();
|
||||
}
|
||||
|
||||
public Object getElementAt(int index)
|
||||
{
|
||||
if (index>=0)
|
||||
return callList.get(index);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addElement(Object item)
|
||||
{
|
||||
synchronized (callList) {
|
||||
this.callList.add(item);
|
||||
|
||||
int index = callList.indexOf(item);
|
||||
fireIntervalAdded(this, index, index);
|
||||
}
|
||||
}
|
||||
|
||||
public void addElement(int index, Object item)
|
||||
{
|
||||
synchronized (callList) {
|
||||
this.callList.add(index, item);
|
||||
fireIntervalAdded(this, index, index);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeElement(Object item)
|
||||
{
|
||||
synchronized (callList) {
|
||||
this.callList.remove(item);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeAll(Collection<Object> c)
|
||||
{
|
||||
synchronized (callList) {
|
||||
callList.removeAll(c);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeAll()
|
||||
{
|
||||
int currentSize = getSize();
|
||||
|
||||
while(callList.size() > 0) {
|
||||
synchronized (callList) {
|
||||
callList.removeLast();
|
||||
}
|
||||
}
|
||||
fireIntervalRemoved(this, 0, currentSize);
|
||||
}
|
||||
|
||||
public int indexOf(Object item)
|
||||
{
|
||||
synchronized (callList) {
|
||||
return callList.indexOf(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,123 +0,0 @@
|
||||
/*
|
||||
* 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.plugin.callhistoryform;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* All look and feel related constants are stored here.
|
||||
*
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public class Constants
|
||||
{
|
||||
|
||||
/*
|
||||
* ===================================================================
|
||||
* ---------------------- CALLTYPE CONSTANTS -------------------------
|
||||
* ===================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* The incoming call flag.
|
||||
*/
|
||||
public static final int INCOMING_CALL = 1;
|
||||
|
||||
/**
|
||||
* The outgoing call flag.
|
||||
*/
|
||||
public static final int OUTGOING_CALL = 2;
|
||||
|
||||
/**
|
||||
* The Incoming & outcoming flag.
|
||||
*/
|
||||
public static final int INOUT_CALL = 3;
|
||||
|
||||
/*
|
||||
* ======================================================================
|
||||
* -------------------- FONTS AND COLOR CONSTANTS ------------------------
|
||||
* ======================================================================
|
||||
*/
|
||||
/**
|
||||
* The color used to paint the background of an incoming call history
|
||||
* record.
|
||||
*/
|
||||
public static final Color HISTORY_IN_CALL_COLOR
|
||||
= new Color(ExtendedCallHistorySearchActivator.getResources()
|
||||
.getColor("service.gui.HISTORY_INCOMING_CALL_BACKGROUND"));
|
||||
|
||||
/**
|
||||
* The color used to paint the background of an outgoing call history
|
||||
* record.
|
||||
*/
|
||||
public static final Color HISTORY_OUT_CALL_COLOR
|
||||
= new Color(ExtendedCallHistorySearchActivator.getResources()
|
||||
.getColor("service.gui.HISTORY_OUTGOING_CALL_BACKGROUND"));
|
||||
|
||||
/**
|
||||
* The end color used to paint a gradient selected background of some
|
||||
* components.
|
||||
*/
|
||||
public static final Color SELECTED_COLOR
|
||||
= new Color(ExtendedCallHistorySearchActivator.getResources()
|
||||
.getColor("service.gui.LIST_SELECTION_COLOR"));
|
||||
|
||||
/**
|
||||
* The start color used to paint a gradient mouse over background of some
|
||||
* components.
|
||||
*/
|
||||
public static final Color GRADIENT_DARK_COLOR
|
||||
= new Color(ExtendedCallHistorySearchActivator.getResources()
|
||||
.getColor("service.gui.GRADIENT_DARK_COLOR"));
|
||||
|
||||
/**
|
||||
* The end color used to paint a gradient mouse over background of some
|
||||
* components.
|
||||
*/
|
||||
public static final Color GRADIENT_LIGHT_COLOR
|
||||
= new Color(ExtendedCallHistorySearchActivator.getResources()
|
||||
.getColor("service.gui.GRADIENT_LIGHT_COLOR"));
|
||||
|
||||
/**
|
||||
* A color between blue and gray used to paint some borders.
|
||||
*/
|
||||
public static final Color BORDER_COLOR
|
||||
= new Color(ExtendedCallHistorySearchActivator.getResources()
|
||||
.getColor("service.gui.BORDER_COLOR"));
|
||||
|
||||
/**
|
||||
* A color between blue and gray (darker than the other one), used to paint
|
||||
* some borders.
|
||||
*/
|
||||
public static final Color LIST_SELECTION_BORDER_COLOR
|
||||
= new Color(ExtendedCallHistorySearchActivator.getResources()
|
||||
.getColor("service.gui.LIST_SELECTION_BORDER_COLOR"));
|
||||
|
||||
/*
|
||||
* ======================================================================
|
||||
* --------------------------- FONT CONSTANTS ---------------------------
|
||||
* ======================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* The name of the font used in this ui implementation.
|
||||
*/
|
||||
public static final String FONT_NAME = "Verdana";
|
||||
|
||||
/**
|
||||
* The size of the font used in this ui implementation.
|
||||
*/
|
||||
public static final String FONT_SIZE = "12";
|
||||
|
||||
/**
|
||||
* The default <tt>Font</tt> object used through this ui implementation.
|
||||
*/
|
||||
public static final Font FONT = new Font(Constants.FONT_NAME,
|
||||
Font.PLAIN, new Integer(Constants.FONT_SIZE).intValue());
|
||||
|
||||
|
||||
}
|
||||
@ -1,84 +0,0 @@
|
||||
/*
|
||||
* 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.plugin.callhistoryform;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import net.java.sip.communicator.service.callhistory.*;
|
||||
import net.java.sip.communicator.service.gui.*;
|
||||
import net.java.sip.communicator.service.resources.*;
|
||||
import net.java.sip.communicator.util.*;
|
||||
|
||||
import org.osgi.framework.*;
|
||||
|
||||
/**
|
||||
* Call History Search PlugIn Activator
|
||||
*
|
||||
* @author Bourdon Maxime & Meyer Thomas
|
||||
*/
|
||||
public class ExtendedCallHistorySearchActivator
|
||||
implements BundleActivator
|
||||
{
|
||||
private Logger logger
|
||||
= Logger.getLogger(ExtendedCallHistorySearchActivator.class);
|
||||
|
||||
private static ResourceManagementService resourceService;
|
||||
|
||||
static BundleContext context;
|
||||
|
||||
public void start(BundleContext bc) throws Exception
|
||||
{
|
||||
context = bc;
|
||||
|
||||
ExtendedCallHistorySearchItem extendedSearch
|
||||
= new ExtendedCallHistorySearchItem();
|
||||
|
||||
Hashtable<String, String> containerFilter
|
||||
= new Hashtable<String, String>();
|
||||
containerFilter.put(
|
||||
Container.CONTAINER_ID,
|
||||
Container.CONTAINER_TOOLS_MENU.getID());
|
||||
|
||||
context.registerService( PluginComponent.class.getName(),
|
||||
extendedSearch,
|
||||
containerFilter);
|
||||
|
||||
context.registerService(FavoritesButton.class.getName(),
|
||||
new CallHistoryButton(),
|
||||
null);
|
||||
|
||||
logger.info("EXTENDED CALL HISTORY SEARCH... [REGISTERED]");
|
||||
}
|
||||
|
||||
public void stop(BundleContext bc) throws Exception
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an instance of the <tt>CallHistoryService</tt>.
|
||||
*/
|
||||
public static CallHistoryService getCallHistoryService()
|
||||
{
|
||||
ServiceReference callHistoryServiceRef = context
|
||||
.getServiceReference(CallHistoryService.class.getName());
|
||||
|
||||
CallHistoryService callHistoryService = (CallHistoryService) context
|
||||
.getService(callHistoryServiceRef);
|
||||
|
||||
return callHistoryService;
|
||||
}
|
||||
|
||||
public static ResourceManagementService getResources()
|
||||
{
|
||||
if (resourceService == null)
|
||||
resourceService =
|
||||
ResourceManagementServiceUtils
|
||||
.getService(ExtendedCallHistorySearchActivator.context);
|
||||
return resourceService;
|
||||
}
|
||||
}
|
||||
@ -1,485 +0,0 @@
|
||||
/*
|
||||
* 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.plugin.callhistoryform;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.*;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import net.java.sip.communicator.service.callhistory.*;
|
||||
import net.java.sip.communicator.util.*;
|
||||
import net.java.sip.communicator.util.swing.*;
|
||||
|
||||
import com.toedter.calendar.*;
|
||||
|
||||
/**
|
||||
* The <tt>ExtendedCallHistorySearchDialog</tt> allows to search in call
|
||||
* history records, by specifying a period, or a call peer name, or type
|
||||
* of the call (incoming or outgoing).
|
||||
*
|
||||
* @author Maxime Bourdon & Thomas Meyer
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ExtendedCallHistorySearchDialog
|
||||
extends SIPCommDialog
|
||||
implements ActionListener,
|
||||
ItemListener
|
||||
{
|
||||
/* PANEL */
|
||||
private JPanel mainSearchPanel = new TransparentPanel(new BorderLayout());
|
||||
|
||||
private JPanel mainPanel = new TransparentPanel(new BorderLayout(3, 1));
|
||||
|
||||
private JPanel searchPanel = new TransparentPanel(new GridBagLayout());
|
||||
|
||||
private JPanel callTypePanel = new TransparentPanel(new GridBagLayout());
|
||||
|
||||
/* BUTTON */
|
||||
private JButton searchButton = new JButton(
|
||||
ExtendedCallHistorySearchActivator.getResources()
|
||||
.getI18NString("service.gui.SEARCH"),
|
||||
ExtendedCallHistorySearchActivator.getResources()
|
||||
.getImage("plugin.callhistorysearch.SEARCH_ICON"));
|
||||
|
||||
/* TEXT FIELD */
|
||||
private JTextField contactNameField = new JTextField();
|
||||
|
||||
/* LABEL */
|
||||
private JLabel contactNameLabel = new JLabel(
|
||||
ExtendedCallHistorySearchActivator.getResources()
|
||||
.getI18NString("plugin.callhistoryform.CONTACT_NAME") + ": ");
|
||||
|
||||
private JLabel sinceDateLabel
|
||||
= new JLabel(ExtendedCallHistorySearchActivator.getResources()
|
||||
.getI18NString("plugin.callhistoryform.SINCE") + ": ");
|
||||
|
||||
private JLabel untilDateLabel
|
||||
= new JLabel(ExtendedCallHistorySearchActivator.getResources()
|
||||
.getI18NString("plugin.callhistoryform.UNTIL") + ": ");
|
||||
|
||||
private JLabel callTypeLabel
|
||||
= new JLabel(ExtendedCallHistorySearchActivator.getResources()
|
||||
.getI18NString("plugin.callhistoryform.CALLTYPE") + ": ");
|
||||
|
||||
/* CHECKBOX */
|
||||
private JCheckBox inCheckBox = new SIPCommCheckBox(
|
||||
ExtendedCallHistorySearchActivator.getResources()
|
||||
.getI18NString("plugin.callhistoryform.INCOMING"), true);
|
||||
|
||||
private JCheckBox outCheckBox = new SIPCommCheckBox(
|
||||
ExtendedCallHistorySearchActivator.getResources()
|
||||
.getI18NString("plugin.callhistoryform.OUTGOING"), true);
|
||||
|
||||
/* contraint grid */
|
||||
private GridBagConstraints constraintsGRbag = new GridBagConstraints();
|
||||
|
||||
private CallList callList = new CallList();
|
||||
|
||||
/* Service */
|
||||
CallHistoryService callAccessService;
|
||||
|
||||
private Date lastDateFromHistory = null;
|
||||
|
||||
private Collection<CallRecord> callListCollection;
|
||||
|
||||
private JDateChooser untilDC
|
||||
= new JDateChooser("dd/MM/yyyy", "##/##/####", ' ');
|
||||
|
||||
private JDateChooser sinceDC
|
||||
= new JDateChooser("dd/MM/yyyy", "##/##/####", ' ');
|
||||
|
||||
private int direction;
|
||||
|
||||
/**
|
||||
* Creates a new instance of <tt>ExtendedCallHistorySearchDialog</tt>.
|
||||
*/
|
||||
public ExtendedCallHistorySearchDialog()
|
||||
{
|
||||
this.mainPanel.setPreferredSize(new Dimension(650, 550));
|
||||
|
||||
this.setTitle(ExtendedCallHistorySearchActivator.getResources()
|
||||
.getI18NString("plugin.callhistoryform.TITLE"));
|
||||
|
||||
this.initPanels();
|
||||
|
||||
this.initDateChooser();
|
||||
|
||||
this.searchPanel.setBorder(BorderFactory.createCompoundBorder(
|
||||
BorderFactory.createTitledBorder(
|
||||
ExtendedCallHistorySearchActivator.getResources()
|
||||
.getI18NString("service.gui.SEARCH")), BorderFactory
|
||||
.createEmptyBorder(5, 5, 5, 5)));
|
||||
|
||||
this.callTypePanel.setBorder(BorderFactory.createCompoundBorder(
|
||||
BorderFactory.createTitledBorder(""), BorderFactory
|
||||
.createEmptyBorder(5, 5, 5, 5)));
|
||||
|
||||
this.getContentPane().add(mainPanel);
|
||||
this.pack();
|
||||
|
||||
/* action listener */
|
||||
searchButton.addActionListener(this);
|
||||
inCheckBox.addItemListener(this);
|
||||
outCheckBox.addItemListener(this);
|
||||
|
||||
this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads all calls from history and shows them in this dialog.
|
||||
*/
|
||||
public void loadHistoryCalls()
|
||||
{
|
||||
/* get the call list collection */
|
||||
callAccessService = ExtendedCallHistorySearchActivator
|
||||
.getCallHistoryService();
|
||||
callListCollection = callAccessService.findByEndDate(new Date());
|
||||
loadTableRecords(
|
||||
callListCollection, Constants.INOUT_CALL, null, new Date());
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the "until" date field to the current date.
|
||||
*/
|
||||
private void initDateChooser()
|
||||
{
|
||||
untilDC.getJCalendar().setWeekOfYearVisible(false);
|
||||
untilDC.getJCalendar().setDate(new Date());
|
||||
sinceDC.getJCalendar().setWeekOfYearVisible(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Init panels display.
|
||||
*/
|
||||
private void initPanels()
|
||||
{
|
||||
this.getRootPane().setDefaultButton(searchButton);
|
||||
|
||||
this.mainSearchPanel.add(searchPanel, BorderLayout.NORTH);
|
||||
this.mainSearchPanel.add(callTypePanel, BorderLayout.CENTER);
|
||||
|
||||
JScrollPane scrollPane = new JScrollPane();
|
||||
scrollPane.getViewport().add(callList);
|
||||
|
||||
this.mainPanel.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
|
||||
this.mainPanel.add(mainSearchPanel, BorderLayout.NORTH);
|
||||
this.mainPanel.add(scrollPane, BorderLayout.CENTER);
|
||||
|
||||
/* SEARCH PANEL */
|
||||
constraintsGRbag.anchor = GridBagConstraints.WEST;
|
||||
constraintsGRbag.insets = new Insets(5, 5, 5, 5);
|
||||
constraintsGRbag.gridwidth = 1;
|
||||
constraintsGRbag.fill = GridBagConstraints.NONE;
|
||||
this.searchPanel.add(contactNameLabel, constraintsGRbag);
|
||||
|
||||
constraintsGRbag.gridwidth = GridBagConstraints.REMAINDER;
|
||||
constraintsGRbag.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraintsGRbag.weightx = 1.0;
|
||||
constraintsGRbag.gridx = GridBagConstraints.RELATIVE;
|
||||
this.searchPanel.add(contactNameField, constraintsGRbag);
|
||||
|
||||
/* DATE */
|
||||
constraintsGRbag.anchor = GridBagConstraints.WEST;
|
||||
constraintsGRbag.gridwidth = 1;
|
||||
constraintsGRbag.gridy = 2;
|
||||
constraintsGRbag.fill = GridBagConstraints.NONE;
|
||||
this.searchPanel.add(sinceDateLabel, constraintsGRbag);
|
||||
|
||||
constraintsGRbag.gridwidth = GridBagConstraints.RELATIVE;
|
||||
constraintsGRbag.fill = GridBagConstraints.HORIZONTAL;
|
||||
constraintsGRbag.weightx = 1.0;
|
||||
this.searchPanel.add(sinceDC, constraintsGRbag);
|
||||
|
||||
constraintsGRbag.gridy = 3;
|
||||
constraintsGRbag.gridwidth = 1;
|
||||
constraintsGRbag.fill = GridBagConstraints.NONE;
|
||||
this.searchPanel.add(untilDateLabel, constraintsGRbag);
|
||||
|
||||
constraintsGRbag.fill = GridBagConstraints.HORIZONTAL;
|
||||
this.searchPanel.add(untilDC, constraintsGRbag);
|
||||
|
||||
/* BUTTON */
|
||||
constraintsGRbag.gridy = 4;
|
||||
constraintsGRbag.gridx = 3;
|
||||
constraintsGRbag.fill = GridBagConstraints.NONE;
|
||||
constraintsGRbag.anchor = GridBagConstraints.EAST;
|
||||
this.searchPanel.add(searchButton, constraintsGRbag);
|
||||
|
||||
/* CALL TYPE */
|
||||
constraintsGRbag.anchor = GridBagConstraints.WEST;
|
||||
constraintsGRbag.insets = new Insets(5, 5, 5, 5);
|
||||
constraintsGRbag.gridwidth = 1;
|
||||
constraintsGRbag.gridx = 1;
|
||||
constraintsGRbag.gridy = 1;
|
||||
this.callTypePanel.add(callTypeLabel, constraintsGRbag);
|
||||
constraintsGRbag.gridx = 2;
|
||||
this.callTypePanel.add(inCheckBox, constraintsGRbag);
|
||||
constraintsGRbag.gridx = 3;
|
||||
this.callTypePanel.add(outCheckBox, constraintsGRbag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the appropriate history calls when user clicks on the search
|
||||
* button.
|
||||
*/
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
JButton sourceButton = (JButton) e.getSource();
|
||||
|
||||
if (sourceButton.equals(searchButton))
|
||||
{
|
||||
/* update the callList */
|
||||
new Thread()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
callListCollection = callAccessService
|
||||
.findByEndDate(new Date());
|
||||
|
||||
if (inCheckBox.isSelected() && outCheckBox.isSelected())
|
||||
{
|
||||
direction = Constants.INOUT_CALL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (inCheckBox.isSelected())
|
||||
direction = Constants.INCOMING_CALL;
|
||||
else
|
||||
{
|
||||
if (outCheckBox.isSelected())
|
||||
direction = Constants.OUTGOING_CALL;
|
||||
else
|
||||
direction = Constants.INOUT_CALL;
|
||||
}
|
||||
}
|
||||
|
||||
SwingUtilities.invokeLater(new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
loadTableRecords(callListCollection, direction,
|
||||
sinceDC.getDate(), untilDC.getDate());
|
||||
}
|
||||
});
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove or add calls to the list of calls depending on the state of
|
||||
* incoming and outgoing checkboxes.
|
||||
*/
|
||||
public void itemStateChanged(ItemEvent e)
|
||||
{
|
||||
JCheckBox sourceCheckBox = (JCheckBox) e.getSource();
|
||||
|
||||
/* Incoming checkbox */
|
||||
if (sourceCheckBox.equals(inCheckBox)
|
||||
|| sourceCheckBox.equals(outCheckBox))
|
||||
{
|
||||
/* INCOMING box Checked */
|
||||
if (inCheckBox.isSelected())
|
||||
{
|
||||
/* OUTCOMING box checked */
|
||||
if (outCheckBox.isSelected() == true)
|
||||
{
|
||||
loadTableRecords(callListCollection,
|
||||
Constants.INOUT_CALL,
|
||||
sinceDC.getDate(), untilDC.getDate());
|
||||
}
|
||||
// only incoming is checked
|
||||
else
|
||||
{
|
||||
loadTableRecords(callListCollection,
|
||||
Constants.INCOMING_CALL,
|
||||
sinceDC.getDate(), untilDC.getDate());
|
||||
}
|
||||
}
|
||||
/* check the OUTCOMING box */
|
||||
else
|
||||
{
|
||||
// checked
|
||||
if (outCheckBox.isSelected() == true)
|
||||
{
|
||||
loadTableRecords(callListCollection,
|
||||
Constants.OUTGOING_CALL,
|
||||
sinceDC.getDate(), untilDC.getDate());
|
||||
}
|
||||
/* both are unchecked */
|
||||
else
|
||||
loadTableRecords(callListCollection,
|
||||
Constants.INOUT_CALL,
|
||||
sinceDC.getDate(), untilDC.getDate());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String processDate(Date date)
|
||||
{
|
||||
String resultString;
|
||||
long currentDate = System.currentTimeMillis();
|
||||
|
||||
if (GuiUtils.compareDates(date, new Date(currentDate)) == 0)
|
||||
{
|
||||
|
||||
resultString = ExtendedCallHistorySearchActivator.getResources()
|
||||
.getI18NString("service.gui.TODAY");
|
||||
}
|
||||
else
|
||||
{
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.setTime(date);
|
||||
|
||||
resultString = GuiUtils.formatDate(date);
|
||||
}
|
||||
|
||||
return resultString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the callRecord direction equals the direction wanted by the user
|
||||
*
|
||||
* @param callType integer value (incoming = 1, outgoing = 2, in/out = 3)
|
||||
* @param callrecord A Callrecord
|
||||
* @return A string containing the callRecord direction if it equals the
|
||||
* callType Call, null if not
|
||||
*/
|
||||
private String checkCallType(int callType, CallRecord callRecord)
|
||||
{
|
||||
String direction = null;
|
||||
|
||||
// in
|
||||
if (callRecord.getDirection().equals(CallRecord.IN)
|
||||
&& ((callType == Constants.INCOMING_CALL)
|
||||
|| callType == Constants.INOUT_CALL))
|
||||
direction = GuiCallPeerRecord.INCOMING_CALL;
|
||||
// out
|
||||
else if (callRecord.getDirection().equals(CallRecord.OUT)
|
||||
&& (callType == Constants.OUTGOING_CALL
|
||||
|| callType == Constants.INOUT_CALL))
|
||||
direction = GuiCallPeerRecord.OUTGOING_CALL;
|
||||
|
||||
return direction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if sinceDate <= callStartDate <= beforeDate
|
||||
*
|
||||
* @param callStartDate
|
||||
* @param sinceDate
|
||||
* @param beforeDate
|
||||
* @return true if sinceDate <= callStartDate <= beforeDate false if not
|
||||
*/
|
||||
private boolean checkDate(Date callStartDate, Date sinceDate, Date untilDate)
|
||||
{
|
||||
/* Test callStartDate >= sinceDate */
|
||||
if (sinceDate != null)
|
||||
if (callStartDate.before(sinceDate))
|
||||
return false;
|
||||
|
||||
/* Test callStartDate <= beforeDate */
|
||||
if (untilDate != null)
|
||||
if (callStartDate.after(untilDate))
|
||||
return false;
|
||||
|
||||
/* sinceDate <= callStartDate <= beforeDate */
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the collection of call records in the table.
|
||||
*
|
||||
* @param historyCalls the collection of call records
|
||||
* @param calltype the type of the call - could be incoming or outgoing
|
||||
* @param since the start date of the search
|
||||
* @param before the end date of the search
|
||||
*/
|
||||
private void loadTableRecords(Collection<CallRecord> historyCalls,
|
||||
int calltype, Date since, Date before)
|
||||
{
|
||||
boolean addMe = true;
|
||||
lastDateFromHistory = null;
|
||||
callList.removeAll();
|
||||
// callList = new CallList();
|
||||
Iterator<CallRecord> lastCalls = historyCalls.iterator();
|
||||
|
||||
while (lastCalls.hasNext())
|
||||
{
|
||||
addMe = true;
|
||||
|
||||
CallRecord callRecord = lastCalls.next();
|
||||
|
||||
/* DATE Checking */
|
||||
Date callStartDate = callRecord.getStartTime();
|
||||
|
||||
if (checkDate(callStartDate, since, before))
|
||||
{
|
||||
if (lastDateFromHistory == null)
|
||||
{
|
||||
callList.addItem(processDate(callStartDate));
|
||||
lastDateFromHistory = callStartDate;
|
||||
}
|
||||
else
|
||||
{
|
||||
int compareResult = GuiUtils.compareDates(callStartDate,
|
||||
lastDateFromHistory);
|
||||
|
||||
if (compareResult != 0)
|
||||
{
|
||||
callList.addItem(processDate(callStartDate));
|
||||
lastDateFromHistory = callStartDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
addMe = false;
|
||||
|
||||
/* PEERS Checking */
|
||||
if (addMe)
|
||||
{
|
||||
Iterator<CallPeerRecord> peers =
|
||||
callRecord.getPeerRecords().iterator();
|
||||
|
||||
while (peers.hasNext() && addMe)
|
||||
{
|
||||
CallPeerRecord peerRecord =
|
||||
peers.next();
|
||||
|
||||
String peerName = peerRecord
|
||||
.getPeerAddress();
|
||||
|
||||
if (peerName.matches(
|
||||
"(?i).*" + contactNameField.getText() + ".*"))
|
||||
{
|
||||
/* DIRECTION Checking */
|
||||
String direction;
|
||||
direction = checkCallType(calltype, callRecord);
|
||||
|
||||
if (direction != null)
|
||||
callList.addItem(new GuiCallPeerRecord(
|
||||
peerRecord, direction));
|
||||
else
|
||||
addMe = false;
|
||||
}
|
||||
else
|
||||
addMe = false; // useless
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (callList.getModel().getSize() > 0)
|
||||
callList.addItem(ExtendedCallHistorySearchActivator.getResources()
|
||||
.getI18NString("service.gui.OLDER_CALLS") + "...");
|
||||
}
|
||||
|
||||
protected void close(boolean isEscaped)
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -1,81 +0,0 @@
|
||||
/*
|
||||
* 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.plugin.callhistoryform;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
import net.java.sip.communicator.service.gui.*;
|
||||
import net.java.sip.communicator.service.gui.Container;
|
||||
|
||||
/**
|
||||
* The <tt>ExtendedCallHistorySearchButton</tt> is the button that will be
|
||||
* added in the Call List panel and from which the user would be able to access
|
||||
* the <tt>ExtendCallHistorySearchDialog</tt>.
|
||||
*
|
||||
* @author Bourdon Maxime & Meyer Thomas
|
||||
*/
|
||||
public class ExtendedCallHistorySearchItem
|
||||
extends AbstractPluginComponent
|
||||
implements ActionListener
|
||||
{
|
||||
private final JMenuItem historyMenuItem
|
||||
= new JMenuItem(ExtendedCallHistorySearchActivator.getResources()
|
||||
.getI18NString("plugin.callhistoryform.TITLE"),
|
||||
ExtendedCallHistorySearchActivator.getResources()
|
||||
.getImage("plugin.callhistorysearch.HISTORY_MENU_ICON"));
|
||||
|
||||
private ExtendedCallHistorySearchDialog callHistorySearchDialog = null;
|
||||
|
||||
/**
|
||||
* Creates an instance of <tt>ExtendedCallHistoryButton</tt>.
|
||||
*/
|
||||
public ExtendedCallHistorySearchItem()
|
||||
{
|
||||
super(Container.CONTAINER_TOOLS_MENU);
|
||||
|
||||
this.historyMenuItem.setMnemonic(
|
||||
ExtendedCallHistorySearchActivator.getResources()
|
||||
.getI18nMnemonic("plugin.callhistoryform.TITLE"));
|
||||
this.historyMenuItem.addActionListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Launches the extended call history dialog when user clicks on this button.
|
||||
*/
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
if (callHistorySearchDialog == null)
|
||||
{
|
||||
callHistorySearchDialog = new ExtendedCallHistorySearchDialog();
|
||||
|
||||
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
||||
callHistorySearchDialog
|
||||
.setLocation(
|
||||
screenSize.width / 2
|
||||
- callHistorySearchDialog.getWidth() / 2,
|
||||
screenSize.height / 2
|
||||
- callHistorySearchDialog.getHeight() / 2);
|
||||
}
|
||||
|
||||
callHistorySearchDialog.loadHistoryCalls();
|
||||
|
||||
callHistorySearchDialog.setVisible(true);
|
||||
}
|
||||
|
||||
public Object getComponent()
|
||||
{
|
||||
return historyMenuItem;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return historyMenuItem.getText();
|
||||
}
|
||||
}
|
||||
@ -1,120 +0,0 @@
|
||||
/*
|
||||
* 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.plugin.callhistoryform;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import net.java.sip.communicator.service.callhistory.*;
|
||||
import net.java.sip.communicator.util.*;
|
||||
|
||||
/**
|
||||
* The <tt>GuiCallPeerRecord</tt> is meant to be used in the call history
|
||||
* to represent a history call peer record. It wraps a
|
||||
* <tt>CallPeer</tt> or a <tt>CallPeerRecord</tt> object.
|
||||
*
|
||||
* @author Yana Stamcheva
|
||||
*/
|
||||
public class GuiCallPeerRecord
|
||||
{
|
||||
public static final String INCOMING_CALL = "IncomingCall";
|
||||
|
||||
public static final String OUTGOING_CALL = "OutgoingCall";
|
||||
|
||||
private String direction;
|
||||
|
||||
private String peerName;
|
||||
|
||||
private Date startTime;
|
||||
|
||||
private Date callTime;
|
||||
|
||||
/**
|
||||
* Creates an instance of <tt>GuiCallPeerRecord</tt> by specifying
|
||||
* the peer name, the call direction (incoming or outgoing), the
|
||||
* time at which the call has started and the duration of the call.
|
||||
*
|
||||
* @param peerName the name of the call peer
|
||||
* @param direction the direction of the call - INCOMING_CALL
|
||||
* or OUTGOING_CALL
|
||||
* @param startTime the time at which the call has started
|
||||
* @param callTime the duration of the call
|
||||
*/
|
||||
public GuiCallPeerRecord(String peerName,
|
||||
String direction,
|
||||
Date startTime,
|
||||
Date callTime)
|
||||
{
|
||||
this.direction = direction;
|
||||
|
||||
this.peerName = peerName;
|
||||
|
||||
this.startTime = startTime;
|
||||
|
||||
this.callTime = callTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an instance of <tt>GuiCallPeerRecord</tt> by specifying
|
||||
* the corresponding <tt>CallPeerRecord</tt>, which gives all the
|
||||
* information for the peer and the call duration.
|
||||
*
|
||||
* @param peerRecord the corresponding <tt>CallPeerRecord</tt>
|
||||
* @param direction the call direction - INCOMING_CALL or OUTGOING_CALL
|
||||
*/
|
||||
public GuiCallPeerRecord(CallPeerRecord peerRecord,
|
||||
String direction)
|
||||
{
|
||||
this.direction = direction;
|
||||
|
||||
this.peerName = peerRecord.getPeerAddress();
|
||||
|
||||
this.startTime = peerRecord.getStartTime();
|
||||
|
||||
this.callTime = GuiUtils.substractDates(
|
||||
peerRecord.getEndTime(), startTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the call direction - INCOMING_CALL or OUTGOING_CALL.
|
||||
*
|
||||
* @return the call direction - INCOMING_CALL or OUTGOING_CALL.
|
||||
*/
|
||||
public String getDirection()
|
||||
{
|
||||
return direction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the duration of the call.
|
||||
*
|
||||
* @return the duration of the call
|
||||
*/
|
||||
public Date getCallTime()
|
||||
{
|
||||
return callTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the peer.
|
||||
*
|
||||
* @return the name of the peer
|
||||
*/
|
||||
public String getPeerName()
|
||||
{
|
||||
return peerName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the time at which the call has started.
|
||||
*
|
||||
* @return the time at which the call has started
|
||||
*/
|
||||
public Date getStartTime()
|
||||
{
|
||||
return startTime;
|
||||
}
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
Bundle-Activator: net.java.sip.communicator.plugin.callhistoryform.ExtendedCallHistorySearchActivator
|
||||
Bundle-Name: Extended Call History Search
|
||||
Bundle-Description: An Extended Call History Search
|
||||
Bundle-Vendor: sip-communicator.org
|
||||
Bundle-Version: 0.0.1
|
||||
System-Bundle: yes
|
||||
Import-Package: org.osgi.framework,
|
||||
net.java.sip.communicator.service.callhistory,
|
||||
net.java.sip.communicator.service.configuration,
|
||||
net.java.sip.communicator.service.contactlist,
|
||||
net.java.sip.communicator.service.contactlist.event,
|
||||
net.java.sip.communicator.service.gui,
|
||||
net.java.sip.communicator.service.gui.event,
|
||||
net.java.sip.communicator.service.resources,
|
||||
net.java.sip.communicator.service.protocol,
|
||||
net.java.sip.communicator.util,
|
||||
net.java.sip.communicator.util.swing,
|
||||
javax.swing,
|
||||
javax.swing.event,
|
||||
javax.swing.table,
|
||||
javax.swing.text,
|
||||
javax.accessibility,
|
||||
javax.swing.plaf,
|
||||
javax.swing.plaf.metal,
|
||||
javax.swing.plaf.basic,
|
||||
javax.imageio,
|
||||
javax.swing.filechooser,
|
||||
javax.swing.tree,
|
||||
javax.swing.border
|
||||
Loading…
Reference in new issue