Shows all telephone numbers and different addresses as separate entries in conference and transfer invite dialogs.

Removes invite reason from conference invite dialog.
cusax-fix
Yana Stamcheva 14 years ago
parent 276d33addb
commit a4e0f832c1

@ -8,10 +8,12 @@
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.main.contactlist.contactsource.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.contactsource.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
@ -83,6 +85,21 @@ public void actionPerformed(ActionEvent e)
*/
private void initContactListData(ProtocolProviderService protocolProvider)
{
Iterator<UIContactSource> sourcesIter
= new ArrayList<UIContactSource>(
contactList.getContactSources()).iterator();
contactList.removeAllContactSources();
while (sourcesIter.hasNext())
{
ContactSourceService contactSource
= sourcesIter.next().getContactSourceService();
contactList.addContactSource(
new DemuxContactSource(contactSource));
}
contactList.addContactSource(
new ProtocolContactSourceServiceImpl(
protocolProvider, OperationSetBasicTelephony.class));

@ -74,7 +74,7 @@ public class ConferenceInviteDialog
public ConferenceInviteDialog(CallConference conference)
{
super(GuiActivator.getResources()
.getI18NString("service.gui.INVITE_CONTACT_TO_CALL"));
.getI18NString("service.gui.INVITE_CONTACT_TO_CALL"), false);
this.conference = conference;
@ -259,6 +259,21 @@ private void initContactListData(ProtocolProviderService protocolProvider)
srcContactList.removeContactSource(currentProviderContactSource);
srcContactList.removeContactSource(currentStringContactSource);
Iterator<UIContactSource> sourcesIter
= new ArrayList<UIContactSource>(
srcContactList.getContactSources()).iterator();
srcContactList.removeAllContactSources();
while (sourcesIter.hasNext())
{
ContactSourceService contactSource
= sourcesIter.next().getContactSourceService();
srcContactList.addContactSource(
new DemuxContactSource(contactSource));
}
currentProviderContactSource
= new ProtocolContactSourceServiceImpl(
protocolProvider,

@ -38,7 +38,7 @@ public class ChatInviteDialog
public ChatInviteDialog (ChatPanel chatPanel)
{
super(GuiActivator.getResources()
.getI18NString("service.gui.INVITE_CONTACT_TO_CHAT"));
.getI18NString("service.gui.INVITE_CONTACT_TO_CHAT"), true);
this.chatPanel = chatPanel;

@ -125,7 +125,7 @@ else if (!sourceContactList.isEmpty())
* filter to
* @return the <tt>ContactQuery</tt> that tracks this filter
*/
public ContactQuery applyFilter(UIContactSource contactSource)
protected ContactQuery applyFilter(UIContactSource contactSource)
{
ContactSourceService sourceService
= contactSource.getContactSourceService();
@ -233,7 +233,7 @@ private boolean isMatching(String text)
* Adds the list of <tt>sourceContacts</tt> to the contact list.
* @param sourceContacts the list of <tt>SourceContact</tt>s to add
*/
private void addMatching(List<SourceContact> sourceContacts)
protected void addMatching(List<SourceContact> sourceContacts)
{
Iterator<SourceContact> contactsIter = sourceContacts.iterator();

@ -0,0 +1,272 @@
/*
* Jitsi, 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.contactlist.contactsource;
import java.util.*;
import java.util.regex.*;
import net.java.sip.communicator.service.contactsource.*;
/**
* The <tt>DemuxContactSource</tt> is a contact source that takes as parameter
* another <tt>ContactSourceService</tt> and provides a demultiplexed result.
* Every contact detail like telephone number or protocol contact address is
* represented as a single entry in the query result.
*
* @author Yana Stamcheva
*/
public class DemuxContactSource
implements ContactSourceService
{
/**
* The underlying contact source service.
*/
private final ContactSourceService contactSource;
/**
* Create an instance of <tt>DemuxContactSource</tt> by specifying the
* underlying <tt>ContactSourceService</tt> to be demuxed.
*
* @param contactSource the underlying <tt>ContactSourceService</tt> to be
* demuxed
*/
public DemuxContactSource(ContactSourceService contactSource)
{
this.contactSource = contactSource;
}
/**
* Returns the type of the underlying contact source.
*
* @return the type of this contact source
*/
public int getType()
{
return contactSource.getType();
}
/**
* Returns a user-friendly string that identifies the underlying contact
* source.
*
* @return the display name of this contact source
*/
public String getDisplayName()
{
return contactSource.getDisplayName();
}
/**
* Queries this search source for the given <tt>queryString</tt>.
*
* @param queryString the string to search for
* @return the created query
*/
public ContactQuery queryContactSource(String queryString)
{
if (contactSource instanceof ExtendedContactSourceService)
return new DemuxContactQuery(
((ExtendedContactSourceService) contactSource)
.queryContactSource(Pattern.compile(
Pattern.quote(queryString),
Pattern.MULTILINE
| Pattern.CASE_INSENSITIVE
| Pattern.UNICODE_CASE)));
else
return new DemuxContactQuery(
contactSource.queryContactSource(queryString));
}
/**
* Queries this search source for the given <tt>queryString</tt>.
*
* @param queryString the string to search for
* @param contactCount the maximum count of result contacts
* @return the created query
*/
public ContactQuery queryContactSource(String queryString, int contactCount)
{
return new DemuxContactQuery(
contactSource.queryContactSource(queryString, contactCount));
}
/**
* Returns the index of the contact source in the result list.
*
* @return the index of the contact source in the result list
*/
public int getIndex()
{
return contactSource.getIndex();
}
/**
* The <tt>DemuxContactQuery</tt> takes a <tt>ContactQuery</tt> as a
* parameter and provides a demultiplexed result. Every contact detail like
* telephone number or protocol contact address is represented as a
* separate entry in the query result.
*/
private class DemuxContactQuery
extends AbstractContactQuery<ContactSourceService>
implements ContactQueryListener
{
/**
* The underlying query.
*/
private final ContactQuery sourceQuery;
/**
* Creates an instance of <tt>DemuxContactQuery</tt>.
*
* @param sourceQuery the source <tt>ContactQuery</tt>
*/
public DemuxContactQuery(ContactQuery sourceQuery)
{
super(DemuxContactSource.this);
this.sourceQuery = sourceQuery;
sourceQuery.addContactQueryListener(this);
}
/**
* Gets the <tt>ContactSourceService</tt> which is performing this
* <tt>ContactQuery</tt>.
*
* @return the <tt>ContactSourceService</tt> which is performing this
* <tt>ContactQuery</tt>
* @see ContactQuery#getContactSource()
*/
public ContactSourceService getContactSource()
{
return DemuxContactSource.this;
}
/**
* Returns the query string, this query was created for.
*
* @return the query string, this query was created for
*/
public String getQueryString()
{
return sourceQuery.getQueryString();
}
/**
* Returns the list of <tt>SourceContact</tt>s returned by this query.
*
* @return the list of <tt>SourceContact</tt>s returned by this query
*/
public List<SourceContact> getQueryResults()
{
List<SourceContact> sourceContacts = sourceQuery.getQueryResults();
if (sourceContacts == null)
return null;
List<SourceContact> newSourceContacts
= new ArrayList<SourceContact>();
Iterator<SourceContact> contactIter = sourceContacts.iterator();
while (contactIter.hasNext())
{
SourceContact sourceContact = contactIter.next();
Iterator<ContactDetail> detailsIter
= sourceContact.getContactDetails().iterator();
while (detailsIter.hasNext())
{
ContactDetail detail = detailsIter.next();
newSourceContacts.add(
createSourceContact(sourceContact,
detail));
}
}
return newSourceContacts;
}
public void cancel()
{
sourceQuery.cancel();
}
/**
* Returns the status of this query. One of the static constants
* QUERY_XXXX defined in this class.
*
* @return the status of this query
*/
public int getStatus()
{
return sourceQuery.getStatus();
}
/**
* Indicates that a new contact has been received for a search.
*
* @param event the <tt>ContactQueryEvent</tt> containing information
* about the received <tt>SourceContact</tt>
*/
public void contactReceived(ContactReceivedEvent event)
{
SourceContact sourceContact = event.getContact();
Iterator<ContactDetail> detailsIter
= sourceContact.getContactDetails().iterator();
while (detailsIter.hasNext())
{
ContactDetail detail = detailsIter.next();
fireContactReceived(
createSourceContact(sourceContact, detail));
}
}
/**
* Creates a single contact from the given <tt>sourceContact</tt> and
* <tt>contactDetail</tt>.
*
* @param sourceContact the source contact
* @param contactDetail the source contact detail
* @return the created contact
*/
private SourceContact createSourceContact( SourceContact sourceContact,
ContactDetail contactDetail)
{
List<ContactDetail> contactDetails = new ArrayList<ContactDetail>();
contactDetails.add(contactDetail);
GenericSourceContact genericContact
= new GenericSourceContact( DemuxContactSource.this,
sourceContact.getDisplayName(),
contactDetails);
genericContact.setDisplayDetails(contactDetail.getContactAddress());
return genericContact;
}
/**
* Indicates that the status of a search has been changed.
*
* @param event the <tt>ContactQueryStatusEvent</tt> containing
* information about the status change
*/
public void queryStatusChanged(ContactQueryStatusEvent event)
{
fireQueryStatusChanged(event.getEventType());
}
public void contactRemoved(ContactRemovedEvent event) {}
public void contactChanged(ContactChangedEvent event) {}
}
}

@ -15,7 +15,8 @@
import net.java.sip.communicator.service.protocol.*;
/**
*
* The <tt>ProtocolContactSourceServiceImpl</tt>
*
* @author Yana Stamcheva
*/
public class ProtocolContactSourceServiceImpl

@ -87,7 +87,7 @@ public class InviteDialog
*
* @param title the title to show on the top of this dialog
*/
public InviteDialog (String title)
public InviteDialog (String title, boolean enableReason)
{
this.setModal(false);
@ -104,10 +104,6 @@ public InviteDialog (String title)
mainPanel.setBorder(
BorderFactory.createEmptyBorder(15, 15, 15, 15));
this.reasonArea.setBorder(BorderFactory.createTitledBorder(
GuiActivator.getResources()
.getI18NString("service.gui.INVITE_REASON")));
JTextArea infoTextArea = new JTextArea();
infoTextArea.setText(GuiActivator.getResources()
@ -212,10 +208,19 @@ public void actionPerformed(ActionEvent e)
centerPanel.add(listPanel, BorderLayout.CENTER);
centerPanel.add(addRemoveButtonsPanel, BorderLayout.SOUTH);
TransparentPanel southPanel = new TransparentPanel(new BorderLayout());
southPanel.add(reasonArea, BorderLayout.CENTER);
TransparentPanel southPanel
= new TransparentPanel(new BorderLayout());
southPanel.add(buttonsPanel, BorderLayout.SOUTH);
if (enableReason)
{
this.reasonArea.setBorder(BorderFactory.createTitledBorder(
GuiActivator.getResources()
.getI18NString("service.gui.INVITE_REASON")));
southPanel.add(reasonArea, BorderLayout.CENTER);
}
mainPanel.add(northPanel, BorderLayout.NORTH);
mainPanel.add(centerPanel, BorderLayout.CENTER);
mainPanel.add(southPanel, BorderLayout.SOUTH);

Loading…
Cancel
Save