- Enhance the SIPCommMenu to support mouse over fade effects.
Conference invite dialog:
- Add new contacts in the invite dialog by pressing the Enter key.
- Remove selection if the user decides to enter something in the field.
Conference window:
- Replace the call peer arrow icon with a more visible one
- Move the call transfer into the call peer menu (it was previously represented by an icon in the status bar)
- Change the local user background title color in the conference (the grey was looking like disabled)
cusax-fix
Yana Stamcheva 16 years ago
parent 8672fbb29f
commit e2c20d0644

@ -185,4 +185,4 @@ service.gui.CALL_PEER_NAME_BACKGROUND=A6D6FF
service.gui.CALL_MEMBER_NAME_BACKGROUND=BDFFA3
# Conference call local user title panel background color.
service.gui.CALL_LOCAL_USER_BACKGROUND=C0C0C0
service.gui.CALL_LOCAL_USER_BACKGROUND=398bcc

@ -151,6 +151,7 @@ service.gui.buttons.MORE_ACTIONS_BUTTON=resources/images/impl/gui/buttons/moreAc
service.gui.buttons.MORE_ACTIONS_ROLLOVER_BUTTON=resources/images/impl/gui/buttons/moreActionsRollover.png
service.gui.buttons.HIDE_ACTIONS_BUTTON=resources/images/impl/gui/buttons/hideMoreActions.png
service.gui.buttons.HIDE_ACTIONS_ROLLOVER_BUTTON=resources/images/impl/gui/buttons/hideMoreActionsRollover.png
service.gui.buttons.CALL_PEER_TOOLS=resources/images/impl/gui/buttons/tools.png
# Sound level icons
service.gui.soundlevel.SOUND_LEVEL_ACTIVE=resources/images/impl/gui/common/soundlevel/soundActive.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

@ -1,122 +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.impl.gui.customcontrols;
import java.awt.event.*;
import javax.swing.*;
/**
* The <tt>SIPCommMenu</tt> is very similar to a JComboBox. The main
* component here is a JLabel only with an icon. When user clicks on the icon a
* popup menu is opened, containing a list of icon-text pairs from which the
* user could choose one item. When user selects the desired item, the icon of
* the selected item is set to the main component label.
*
* @author Yana Stamcheva
*/
public class SIPCommMenu
extends JMenu
{
private static final long serialVersionUID = 1L;
private Object selectedObject;
/**
* Creates an instance of <tt>SIPCommMenu</tt>.
*/
public SIPCommMenu()
{
super();
}
/**
* Creates an instance of <tt>SIPCommMenu</tt> by specifying
* the text and the icon.
*/
public SIPCommMenu(String text, Icon defaultIcon)
{
super(text);
this.setIcon(defaultIcon);
}
/**
* Creates an instance of <tt>SIPCommMenu</tt> by specifying the
* initialy selected item.
*
* @param text The item that is initialy selected.
*/
public SIPCommMenu(String text)
{
super(text);
}
/**
* Adds an item to the "choice list" of this selector box.
*
* @param text The text of the item.
* @param icon The icon of the item.
* @param actionListener The <tt>ActionListener</tt>, which handles the
* case, when the item is selected.
*/
public void addItem(String text, Icon icon, ActionListener actionListener)
{
JMenuItem item = new JMenuItem(text, icon);
item.addActionListener(actionListener);
this.add(item);
}
/**
* Selects the given item.
*
* @param selectedObject The object to select.
*/
public void setSelected(SelectedObject selectedObject)
{
if (selectedObject.getIcon() != null)
this.setIcon(selectedObject.getIcon());
if (selectedObject.getText() != null)
this.setText(selectedObject.getText());
if (selectedObject.getObject() != null)
this.setSelectedObject(selectedObject.getObject());
}
/**
* Selects the given object.
*
* @param o The <tt>Object</tt> to select.
*/
public void setSelectedObject(Object o)
{
this.selectedObject = o;
}
/**
* Returns the selected object.
*
* @return the selected object.
*/
public Object getSelectedObject()
{
return this.selectedObject;
}
/**
* Sets the isMouseOver property value and repaints this component.
*
* @param isMouseOver <code>true</code> to indicate that the mouse is over
* this component, <code>false</code> - otherwise.
*/
public void setMouseOver(boolean isMouseOver)
{
this.repaint();
}
}

@ -12,6 +12,8 @@
import javax.swing.Timer;
import org.osgi.framework.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.utils.*;
@ -245,6 +247,84 @@ public static void mute(CallPeer callPeer, boolean isMute)
new MuteCallPeerThread(callPeer, isMute).start();
}
/**
* Transfers the given <tt>callPeer</tt>.
* @param callPeer the <tt>CallPeer</tt> to transfer
*/
public static void transferCall(CallPeer callPeer)
{
final Call call = callPeer.getCall();
if (call != null)
{
OperationSetAdvancedTelephony telephony
= call.getProtocolProvider()
.getOperationSet(OperationSetAdvancedTelephony.class);
if (telephony != null)
{
final TransferCallDialog dialog = new TransferCallDialog(null);
/*
* Transferring a call works only when the call is in progress
* so close the dialog (if it's not already closed, of course)
* once the dialog ends.
*/
CallChangeListener callChangeListener = new CallChangeAdapter()
{
/*
* Implements
* CallChangeAdapter#callStateChanged(CallChangeEvent).
*/
public void callStateChanged(CallChangeEvent evt)
{
// we are interested only in CALL_STATE_CHANGEs
if(!evt.getEventType().equals(
CallChangeEvent.CALL_STATE_CHANGE))
return;
if (!CallState.CALL_IN_PROGRESS.equals(call
.getCallState()))
{
dialog.setVisible(false);
dialog.dispose();
}
}
};
call.addCallChangeListener(callChangeListener);
try
{
dialog.setModal(true);
dialog.pack();
dialog.setVisible(true);
}
finally
{
call.removeCallChangeListener(callChangeListener);
}
String target = dialog.getTarget();
if ((target != null) && (target.length() > 0))
{
try
{
CallPeer targetPeer = findCallPeer(target);
if (targetPeer == null)
telephony.transfer(callPeer, target);
else
telephony.transfer(callPeer, targetPeer);
}
catch (OperationFailedException ex)
{
logger.error("Failed to transfer call " + call + " to "
+ target, ex);
}
}
}
}
}
/**
* Opens a call dialog.
*
@ -649,4 +729,86 @@ private static void stopAllSounds()
NotificationManager.stopSound(NotificationManager.INCOMING_CALL);
NotificationManager.stopSound(NotificationManager.OUTGOING_CALL);
}
/**
* Returns the first <tt>CallPeer</tt> among all existing ones
* who has a specific address.
*
* @param address the address of the <tt>CallPeer</tt> to be located
* @return the first <tt>CallPeer</tt> among all existing ones
* who has the specified <tt>address</tt>
*
* @throws OperationFailedException in case we fail retrieving a reference
* to <tt>ProtocolProviderService</tt>s
*/
private static CallPeer findCallPeer(String address)
throws OperationFailedException
{
BundleContext bundleContext = GuiActivator.bundleContext;
ServiceReference[] serviceReferences;
try
{
serviceReferences =
bundleContext.getServiceReferences(
ProtocolProviderService.class.getName(), null);
}
catch (InvalidSyntaxException ex)
{
throw new OperationFailedException(
"Failed to retrieve ProtocolProviderService references.",
OperationFailedException.INTERNAL_ERROR, ex);
}
Class<OperationSetBasicTelephony> telephonyClass
= OperationSetBasicTelephony.class;
CallPeer peer = null;
for (ServiceReference serviceReference : serviceReferences)
{
ProtocolProviderService service = (ProtocolProviderService)
bundleContext.getService(serviceReference);
OperationSetBasicTelephony telephony =
service.getOperationSet(telephonyClass);
if (telephony != null)
{
peer = findCallPeer(telephony, address);
if (peer != null)
break;
}
}
return peer;
}
/**
* Returns the first <tt>CallPeer</tt> known to a specific
* <tt>OperationSetBasicTelephony</tt> to have a specific address.
*
* @param telephony the <tt>OperationSetBasicTelephony</tt> to have its
* <tt>CallPeer</tt>s examined in search for one which has a specific
* address
* @param address the address to locate the associated <tt>CallPeer</tt> of
* @return the first <tt>CallPeer</tt> known to the specified
* <tt>OperationSetBasicTelephony</tt> to have the specified address
*/
private static CallPeer findCallPeer(
OperationSetBasicTelephony telephony, String address)
{
for (Iterator<? extends Call> callIter = telephony.getActiveCalls();
callIter.hasNext();)
{
Call call = callIter.next();
for (Iterator<? extends CallPeer> peerIter = call.getCallPeers();
peerIter.hasNext();)
{
CallPeer peer = peerIter.next();
if (address.equals(peer.getAddress()))
return peer;
}
}
return null;
}
}

@ -8,15 +8,10 @@
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import org.osgi.framework.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.event.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
/**
@ -28,12 +23,6 @@
public class TransferCallButton
extends SIPCommButton
{
/**
* Our class logger.
*/
private static final Logger logger =
Logger.getLogger(TransferCallButton.class);
/**
* The <tt>CallPeer</tt> (whose <tt>Call</tt> is) to be
* transfered.
@ -45,14 +34,14 @@ public class TransferCallButton
* transfer (the <tt>Call</tt> of) a specific
* <tt>CallPeer</tt>.
*
* @param callPeer the <tt>CallPeer</tt> to be associated
* @param peer the <tt>CallPeer</tt> to be associated
* with the new instance and to be transfered
*/
public TransferCallButton(CallPeer callPeer)
public TransferCallButton(CallPeer peer)
{
super(ImageLoader.getImage(ImageLoader.TRANSFER_CALL_BUTTON));
this.callPeer = callPeer;
this.callPeer = peer;
setToolTipText(GuiActivator.getResources().getI18NString(
"service.gui.TRANSFER_BUTTON_TOOL_TIP"));
@ -68,178 +57,11 @@ public TransferCallButton(CallPeer callPeer)
*/
public void actionPerformed(ActionEvent evt)
{
TransferCallButton.this.actionPerformed(this, evt);
CallManager.transferCall(callPeer);
}
});
}
/**
* Handles actions performed on this button on behalf of a specific
* <tt>ActionListener</tt>.
*
* @param listener the <tt>ActionListener</tt> notified about the
* performing of the action
* @param evt the <tt>ActionEvent</tt> containing the data associated
* with the action and the act of its performing
*/
private void actionPerformed(ActionListener listener, ActionEvent evt)
{
final Call call = callPeer.getCall();
if (call != null)
{
OperationSetAdvancedTelephony telephony =
call.getProtocolProvider()
.getOperationSet(OperationSetAdvancedTelephony.class);
if (telephony != null)
{
final TransferCallDialog dialog =
new TransferCallDialog(getFrame(this));
/*
* Transferring a call works only when the call is in progress
* so close the dialog (if it's not already closed, of course)
* once the dialog ends.
*/
CallChangeListener callChangeListener = new CallChangeAdapter()
{
/*
* Implements
* CallChangeAdapter#callStateChanged(CallChangeEvent).
*/
public void callStateChanged(CallChangeEvent evt)
{
// we are interested only in CALL_STATE_CHANGEs
if(!evt.getEventType().equals(
CallChangeEvent.CALL_STATE_CHANGE))
return;
if (!CallState.CALL_IN_PROGRESS.equals(call
.getCallState()))
{
dialog.setVisible(false);
dialog.dispose();
}
}
};
call.addCallChangeListener(callChangeListener);
try
{
dialog.setModal(true);
dialog.pack();
dialog.setVisible(true);
}
finally
{
call.removeCallChangeListener(callChangeListener);
}
String target = dialog.getTarget();
if ((target != null) && (target.length() > 0))
{
try
{
CallPeer targetPeer = findCallPeer(target);
if (targetPeer == null)
telephony.transfer(callPeer, target);
else
telephony.transfer(callPeer, targetPeer);
}
catch (OperationFailedException ex)
{
logger.error("Failed to transfer call " + call + " to "
+ target, ex);
}
}
}
}
}
/**
* Returns the first <tt>CallPeer</tt> known to a specific
* <tt>OperationSetBasicTelephony</tt> to have a specific address.
*
* @param telephony the <tt>OperationSetBasicTelephony</tt> to have its
* <tt>CallPeer</tt>s examined in search for one which has a specific
* address
* @param address the address to locate the associated <tt>CallPeer</tt> of
* @return the first <tt>CallPeer</tt> known to the specified
* <tt>OperationSetBasicTelephony</tt> to have the specified address
*/
private CallPeer findCallPeer(
OperationSetBasicTelephony telephony, String address)
{
for (Iterator<? extends Call> callIter = telephony.getActiveCalls();
callIter.hasNext();)
{
Call call = callIter.next();
for (Iterator<? extends CallPeer> peerIter = call.getCallPeers();
peerIter.hasNext();)
{
CallPeer peer = peerIter.next();
if (address.equals(peer.getAddress()))
return peer;
}
}
return null;
}
/**
* Returns the first <tt>CallPeer</tt> among all existing ones
* who has a specific address.
*
* @param address the address of the <tt>CallPeer</tt> to be located
* @return the first <tt>CallPeer</tt> among all existing ones
* who has the specified <tt>address</tt>
*
* @throws OperationFailedException in case we fail retrieving a reference
* to <tt>ProtocolProviderService</tt>s
*/
private CallPeer findCallPeer(String address)
throws OperationFailedException
{
BundleContext bundleContext = GuiActivator.bundleContext;
ServiceReference[] serviceReferences;
try
{
serviceReferences =
bundleContext.getServiceReferences(
ProtocolProviderService.class.getName(), null);
}
catch (InvalidSyntaxException ex)
{
throw new OperationFailedException(
"Failed to retrieve ProtocolProviderService references.",
OperationFailedException.INTERNAL_ERROR, ex);
}
Class<OperationSetBasicTelephony> telephonyClass
= OperationSetBasicTelephony.class;
CallPeer peer = null;
for (ServiceReference serviceReference : serviceReferences)
{
ProtocolProviderService service = (ProtocolProviderService)
bundleContext.getService(serviceReference);
OperationSetBasicTelephony telephony =
service.getOperationSet(telephonyClass);
if (telephony != null)
{
peer = findCallPeer(telephony, address);
if (peer != null)
break;
}
}
return peer;
}
/**
* Gets the first <tt>Frame</tt> in the ancestor <tt>Component</tt>
* hierarchy of a specific <tt>Component</tt>.

@ -6,12 +6,12 @@
*/
package net.java.sip.communicator.impl.gui.main.call.conference;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.main.call.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*;
@ -58,6 +58,8 @@ public CallPeerActionMenuBar(CallPeer peer)
SIPCommMenu menu = new SIPCommMenu();
menu.setPreferredSize(new Dimension(20, 20));
this.setOpaque(false);
menu.setOpaque(false);
@ -65,8 +67,8 @@ public CallPeerActionMenuBar(CallPeer peer)
// icon.
menu.setBorder(BorderFactory.createEmptyBorder());
menu.setIcon(new ImageIcon(ImageLoader
.getImage(ImageLoader.DOWN_ARROW_ICON)));
.getImage(ImageLoader.CALL_PEER_TOOLS)));
menu.setIconTextGap(0);
menu.addItem(
GuiActivator.getResources().getI18NString("service.gui.HANG_UP"),
null,
@ -84,6 +86,18 @@ public void actionPerformed(ActionEvent e)
menu.add(holdMenuItem);
menu.add(muteMenuItem);
menu.addItem(
GuiActivator.getResources().getI18NString(
"service.gui.TRANSFER_BUTTON_TOOL_TIP"),
null,
new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
CallManager.transferCall(callPeer);
}
});
this.add(menu);
// Add the call peer listener that would notify us for call peer state

@ -338,16 +338,6 @@ private void initStatusBar(CallPeer callPeer)
this.addToStatusBar(securityStatusLabel);
this.addToStatusBar(holdStatusLabel);
this.addToStatusBar(muteStatusLabel);
Component[] buttons = new Component[]
{
CallPeerRendererUtils.createTransferCallButton(callPeer)
};
Component buttonBar
= CallPeerRendererUtils.createButtonBar(false, buttons);
this.addToStatusBar(buttonBar);
}
/**

@ -12,7 +12,7 @@
import javax.swing.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.util.swing.*;
/**
* The <tt>HistoryMenu</tt> is the main menu in the history window.
@ -23,9 +23,15 @@ public class HistoryMenu
extends SIPCommMenu
implements ActionListener
{
/**
* The empty history menu item.
*/
private JMenuItem emptyMenuItem = new JMenuItem(
GuiActivator.getResources().getI18NString("service.gui.EMPTY_HISTORY"));
/**
* The close menu item.
*/
private JMenuItem closeMenuItem = new JMenuItem(
GuiActivator.getResources().getI18NString("service.gui.CLOSE"));
@ -63,14 +69,15 @@ public HistoryMenu(JFrame parentWindow) {
/**
* Handles the <tt>ActionEvent</tt> when user selects an item from the
* menu. When the close item is selected disposes the window.
* @param e the <tt>ActionEvent</tt> that notified us
*/
public void actionPerformed(ActionEvent e) {
public void actionPerformed(ActionEvent e)
{
JMenuItem menuItem = (JMenuItem) e.getSource();
String menuName = menuItem.getName();
if (menuName.equalsIgnoreCase("empty")) {
//TODO: Implement - "empty" history.
} else if (menuName.equalsIgnoreCase("service.gui.CLOSE")) {
if (menuName.equalsIgnoreCase("service.gui.CLOSE"))
{
this.parentWindow.setVisible(false);
this.parentWindow.dispose();
}

@ -99,7 +99,8 @@ public class HistoryWindow
* which this <code>HistoryWindow</code> has added itself as a
* <code>MessageListener</code>.
*/
private java.util.List<OperationSetBasicInstantMessaging> basicInstantMessagings;
private java.util.List<OperationSetBasicInstantMessaging>
basicInstantMessagings;
/**
* If the <code>historyContact</code> is a <code>ChatRoomWrapper</code>,
@ -245,6 +246,8 @@ public void showHistoryByKeyword(String keyword)
/**
* Shows the history given by the collection into a ChatConversationPanel.
* @param historyRecords a collection of history records
* @return an <tt>HTMLDocument</tt> containing the history given by
* <tt>historyRecords</tt>
*/
private HTMLDocument createHistory(Collection<Object> historyRecords)
{
@ -335,19 +338,22 @@ else if (o instanceof FileRecord)
/**
* Implements <tt>ChatConversationContainer.setStatusMessage</tt> method.
*/
public void setStatusMessage(String message)
{
//TODO : setStatusMessage(String message)
}
public void setStatusMessage(String message) {}
/**
* Implements <tt>ChatConversationContainer.getWindow</tt> method.
* @return this window
*/
public Window getConversationContainerWindow()
{
return this;
}
/**
* Indicates that the window is closing. Removes all message listeners when
* closing.
* @param e the <tt>WindowEvent</tt> that notified us
*/
protected void windowClosing(WindowEvent e)
{
super.windowClosing(e);
@ -387,10 +393,11 @@ public Date getNextDateFromHistory(Date date)
else
return new Date(System.currentTimeMillis());
}
/**
* Handles the ProgressEvent triggered from the history when processing
* a query.
* @param evt the <tt>ProgressEvent</tt> that notified us
*/
public void progressChanged(ProgressEvent evt)
{
@ -523,10 +530,10 @@ public void run() {
}
};
SwingUtilities.invokeLater(updateDatesPanel);
}
}
}
}
}
/**
* Loads history messages in the right panel.
*/
@ -547,7 +554,7 @@ public MessagesLoader (Date startDate, Date endDate)
this.startDate = startDate;
this.endDate = endDate;
}
public void run()
{
final Collection<Object> msgList;
@ -590,7 +597,7 @@ public void run()
SwingUtilities.invokeLater(updateMessagesPanel);
}
}
/**
* Loads dates found for keyword.
*/
@ -609,7 +616,7 @@ public KeywordDatesLoader(String keyword)
{
this.keyword = keyword;
}
public void run()
{
Collection<Object> msgList = null;
@ -663,7 +670,7 @@ else if (o instanceof MessageReceivedEvent)
}
}
}
Runnable updateDatesPanel = new Runnable()
{
public void run()
@ -706,7 +713,7 @@ public void run()
}
};
SwingUtilities.invokeLater(updateDatesPanel);
}
}
}
/**
@ -714,6 +721,8 @@ public void run()
* user presses the Esc key. Checks if the popup menu is visible and if
* this is the case hides it, otherwise saves the current history window
* size and location and disposes the window.
* @param isEscaped indicates if the window has been closed by pressing the
* Esc key
*/
protected void close(boolean isEscaped)
{
@ -774,7 +783,7 @@ public void messageDelivered(MessageDeliveredEvent evt)
{
Contact destContact = evt.getDestinationContact();
Message sourceMessage = evt.getSourceMessage();
this.processMessage(
destContact,
evt.getTimestamp(),
@ -782,10 +791,9 @@ public void messageDelivered(MessageDeliveredEvent evt)
sourceMessage.getContent(),
sourceMessage.getContentType());
}
public void messageDeliveryFailed(MessageDeliveryFailedEvent evt)
{}
public void messageDeliveryFailed(MessageDeliveryFailedEvent evt) {}
/**
* Processes the message given by the parameters.
*
@ -793,6 +801,7 @@ public void messageDeliveryFailed(MessageDeliveryFailedEvent evt)
* @param timestamp the timestamp of the message
* @param messageType INCOMING or OUTGOING
* @param messageContent the content text of the message
* @param messageContentType the content type of the message
*/
private void processMessage(Contact contact,
long timestamp,
@ -853,7 +862,8 @@ else if (lastDate == null
/**
* Appends the given string at the end of the given html document.
*
*
* @param doc the document to append to
* @param chatString the string to append
*/
private void appendMessageToDocument(HTMLDocument doc, String chatString)
@ -875,12 +885,9 @@ private void appendMessageToDocument(HTMLDocument doc, String chatString)
}
}
public void messageDelivered(ChatRoomMessageDeliveredEvent evt)
{}
public void messageDelivered(ChatRoomMessageDeliveredEvent evt) {}
public void messageDeliveryFailed(ChatRoomMessageDeliveryFailedEvent evt)
{}
public void messageDeliveryFailed(ChatRoomMessageDeliveryFailedEvent evt) {}
public void messageReceived(ChatRoomMessageReceivedEvent evt)
{}
public void messageReceived(ChatRoomMessageReceivedEvent evt) {}
}

@ -12,9 +12,9 @@
import javax.swing.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.main.chat.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.util.swing.*;
/**
* The <tt>EditMenu</tt> is the menu in the chat window menu bar, which contains
@ -22,7 +22,8 @@
*
* @author Yana Stamcheva
*/
public class EditMenu extends SIPCommMenu
public class EditMenu
extends SIPCommMenu
implements ActionListener
{
private JMenuItem fontDialogMenuItem = new JMenuItem(

@ -12,11 +12,11 @@
import javax.swing.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.main.chat.*;
import net.java.sip.communicator.impl.gui.main.chat.history.*;
import net.java.sip.communicator.impl.gui.main.chatroomslist.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.util.swing.*;
/**
* The <tt>FileMenu</tt> is the menu in the chat window menu bar that contains
@ -24,7 +24,8 @@
*
* @author Yana Stamcheva
*/
public class FileMenu extends SIPCommMenu
public class FileMenu
extends SIPCommMenu
implements ActionListener
{
private JMenuItem myChatRoomsItem = new JMenuItem(

@ -11,12 +11,12 @@
import java.awt.event.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.event.*;
import net.java.sip.communicator.impl.gui.main.chat.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.gui.Container;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
import org.osgi.framework.*;
/**

@ -29,7 +29,7 @@ public class MessageWindowMenuBar
private final FileMenu fileMenu;
private final EditMenu editMenu;
private final OptionsMenu optionsMenu;
private final HelpMenu helpMenu;

@ -13,9 +13,9 @@
import javax.swing.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.main.chat.*;
import net.java.sip.communicator.impl.gui.utils.ConfigurationManager;
import net.java.sip.communicator.util.swing.*;
/**
* The <tt>OptionMenu</tt> is a menu in the chat window menu bar.
*

@ -27,6 +27,7 @@
import net.java.sip.communicator.service.gui.Container;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
import org.osgi.framework.*;
@ -463,6 +464,7 @@ private void initMnemonics()
/**
* Handles the <tt>ActionEvent</tt>. Determines which menu item was
* selected and performs the appropriate operations.
* @param e the <tt>ActionEvent</tt> that notified us
*/
public void actionPerformed(ActionEvent e)
{
@ -789,6 +791,11 @@ else if (returnCode == MessageDialog.OK_DONT_ASK_CODE)
}
}
/**
* Indicates that a group has been selected during a move operation. Moves
* the selected contact to the selected group.
* @param evt the <tt>ContactListEvent</tt> has
*/
public void groupSelected(ContactListEvent evt)
{
this.moveDialog.dispose();
@ -816,6 +823,7 @@ else if(contactToMove != null)
/**
* Implements ContactListListener.contactSelected method in order
* to move the chosen sub-contact when a meta contact is selected.
* @param evt the <tt>ContactListEvent</tt> that notified us
*/
public void contactClicked(ContactListEvent evt)
{
@ -825,6 +833,7 @@ public void contactClicked(ContactListEvent evt)
/**
* Implements ContactListListener.contactSelected method in order
* to move the chosen sub-contact when a meta contact is selected.
* @param evt the <tt>ContactListEvent</tt> that notified us
*/
public void protocolContactClicked(ContactListEvent evt)
{

@ -24,6 +24,7 @@
import net.java.sip.communicator.service.gui.Container;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
import org.osgi.framework.*;
@ -160,12 +161,14 @@ private void initPluginComponents()
}
/**
* Handles the <tt>ActionEvent</tt>. The choosen menu item should correspond
* Handles the <tt>ActionEvent</tt>. The chosen menu item should correspond
* to an account, where the new contact will be added. We obtain here the
* protocol provider corresponding to the choosen account and show the
* protocol provider corresponding to the chosen account and show the
* dialog, where the user could add the contact.
* @param e the <tt>ActionEvent</tt> that notified us
*/
public void actionPerformed(ActionEvent e) {
public void actionPerformed(ActionEvent e)
{
JMenuItem item = (JMenuItem)e.getSource();
String itemName = item.getName();
@ -266,6 +269,11 @@ else if (returnCode == MessageDialog.OK_DONT_ASK_CODE) {
}
}
/**
* Indicates that a new plugin component has been added. Adds it to this
* container if it belongs to it.
* @param event the <tt>PluginComponentEvent</tt> that notified us
*/
public void pluginComponentAdded(PluginComponentEvent event)
{
PluginComponent c = event.getPluginComponent();
@ -281,6 +289,11 @@ public void pluginComponentAdded(PluginComponentEvent event)
this.repaint();
}
/**
* Indicates that a new plugin component has been removed. Removes it to
* from this container if it belongs to it.
* @param event the <tt>PluginComponentEvent</tt> that notified us
*/
public void pluginComponentRemoved(PluginComponentEvent event)
{
PluginComponent c = event.getPluginComponent();

@ -13,7 +13,6 @@
import javax.swing.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.main.*;
import net.java.sip.communicator.impl.gui.main.account.*;
import net.java.sip.communicator.impl.gui.main.chatroomslist.*;
@ -23,6 +22,7 @@
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
/**
* The <tt>FileMenu</tt> is a menu in the main application menu bar that

@ -10,12 +10,12 @@
import java.awt.event.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.event.*;
import net.java.sip.communicator.impl.gui.main.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.gui.Container;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
import org.osgi.framework.*;
@ -26,7 +26,7 @@
* @author Thomas Hofer
*/
public class HelpMenu
extends SIPCommMenu
extends SIPCommMenu
implements ActionListener,
PluginComponentListener
{

@ -12,13 +12,13 @@
import javax.swing.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.event.*;
import net.java.sip.communicator.impl.gui.main.*;
import net.java.sip.communicator.impl.gui.main.call.conference.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.gui.Container;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
import org.osgi.framework.*;
@ -143,7 +143,9 @@ public void pluginComponentAdded(PluginComponentEvent event)
}
/**
*
* Indicates that a plugin component has been removed. Removes it from this
* container if it is contained in it.
* @param event the <tt>PluginComponentEvent</tt> that notified us
*/
public void pluginComponentRemoved(PluginComponentEvent event)
{
@ -155,6 +157,9 @@ public void pluginComponentRemoved(PluginComponentEvent event)
}
}
/**
* Registers all menu items.
*/
private void registerMenuItems()
{
UIService uiService = GuiActivator.getUIService();
@ -179,11 +184,19 @@ private void registerMenuItems()
this.add(conferenceMenuItem);
}
/**
* Registers the preferences item in the MacOS X menu.
* @return <tt>true</tt> if the operation succeeds, otherwise - returns
* <tt>false</tt>
*/
private boolean registerConfigMenuItemMacOSX()
{
return FileMenu.registerMenuItemMacOSX("Preferences", this);
}
/**
* Registers the settings item in the MacOS X menu.
*/
private void registerConfigMenuItemNonMacOSX()
{
JMenuItem configMenuItem = new JMenuItem(

@ -9,8 +9,8 @@
import java.awt.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.main.*;
import net.java.sip.communicator.util.swing.*;
/**
* The <tt>ViewMenu</tt> is a menu in the main application menu bar.

@ -19,6 +19,7 @@
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.swing.*;
/**
* The <tt>StatusSelectorBox</tt> is a <tt>SIPCommMenu</tt> that contains
@ -263,10 +264,6 @@ public PresenceStatus getLastSelectedStatus()
return lastSelectedStatus;
}
public void updateStatus()
{
}
private class PublishPresenceStatusThread
extends Thread
{

@ -13,9 +13,9 @@
import javax.swing.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.service.configuration.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.swing.*;
/**
* A parent class for all status selector boxes.
@ -28,11 +28,20 @@
public abstract class StatusSelectorMenu
extends SIPCommMenu
{
/**
* Creates a <tt>StatusSelectorMenu</tt>.
*/
public StatusSelectorMenu()
{
super();
}
/**
* Creates a <tt>StatusSelectorMenu</tt> by specifying the text and icon to
* show.
* @param text the text of the menu
* @param defaultIcon the icon of the menu
*/
public StatusSelectorMenu(String text, Icon defaultIcon)
{
super(text, defaultIcon);
@ -69,6 +78,9 @@ public void setAccountIndex(int index){}
* Saves the last status for all accounts. This information is used
* on loging. Each time user logs in he's logged with the same status
* as he was the last time before closing the application.
* @param protocolProvider the protocol provider to save status information
* for
* @param statusName the name of the status to save
*/
protected void saveStatusInformation(
ProtocolProviderService protocolProvider,

@ -742,6 +742,12 @@ public class ImageLoader
public static final ImageID DEFAULT_FILE_ICON
= new ImageID("service.gui.icons.DEFAULT_FILE_ICON");
/**
* The tools icon shown in conference calls.
*/
public static final ImageID CALL_PEER_TOOLS
= new ImageID("service.gui.buttons.CALL_PEER_TOOLS");
/*
* =======================================================================
* ------------------------ EDIT TOOLBAR ICONS ---------------------------

@ -40,6 +40,10 @@ public class InviteDialog
private final DefaultListModel selectedContactListModel
= new DefaultListModel();
private final SIPCommTextField newContactField
= new SIPCommTextField(GuiActivator.getResources()
.getI18NString("service.gui.OR_ENTER_PHONE_NUMBER"));
/**
* Constructs an <tt>InviteDialog</tt>, by specifying the initial list of
* contacts available for invite.
@ -165,9 +169,24 @@ public void mouseClicked(MouseEvent e)
SIPCommBorders.getRoundBorder());
// New contact text field panel.
final SIPCommTextField newContactField
= new SIPCommTextField(GuiActivator.getResources()
.getI18NString("service.gui.OR_ENTER_PHONE_NUMBER"));
newContactField.getInputMap().put(
KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
"moveStringFromLeftToRight");
newContactField.getActionMap().put("moveStringFromLeftToRight",
new MoveStringToRight());
newContactField.addFocusListener(new FocusAdapter()
{
/**
* Removes all other selections.
* @param e the <tt>FocusEvent</tt> that notified us
*/
public void focusGained(FocusEvent e)
{
contactList.removeSelectionInterval(
0, contactList.getMaxSelectionIndex());
}
});
TransparentPanel leftPanel = new TransparentPanel(new BorderLayout());
leftPanel.setBorder(SIPCommBorders.getRoundBorder());
@ -203,13 +222,7 @@ public void actionPerformed(ActionEvent e)
if (metaContacts != null && metaContacts.length > 0)
moveContactsFromLeftToRight(metaContacts);
String newContactText = newContactField.getText();
if (newContactText != null && newContactText.length() > 0)
{
moveStringFromLeftToRight(newContactText);
newContactField.setText("");
}
moveStringFromLeftToRight();
}
});
@ -365,11 +378,15 @@ private void moveContactsFromLeftToRight(Object[] metaContacts)
/**
* Moves a string from left to right.
* @param text the text to move from left to right
*/
private void moveStringFromLeftToRight(String text)
private void moveStringFromLeftToRight()
{
selectedContactListModel.addElement(text);
String newContactText = newContactField.getText();
if (newContactText != null && newContactText.length() > 0)
selectedContactListModel.addElement(newContactField.getText());
newContactField.setText("");
}
/**
@ -388,4 +405,17 @@ private void moveContactsFromRightToLeft(Object[] contacts)
contactListModel.addElement(contact);
}
}
/**
* The <tt>MoveStringToRight</tt> is an <tt>AbstractAction</tt> that moves
* the text to right panel containing selected contacts.
*/
private class MoveStringToRight
extends UIAction
{
public void actionPerformed(ActionEvent e)
{
moveStringFromLeftToRight();
}
}
}

@ -67,7 +67,8 @@ public SIPCommButton( Image bgImage,
/**
* Creates a button with custom background image.
*
* @param bgImage The background button image.
* @param bgImage the background button image
* @param iconImage the icon of this button
*/
public SIPCommButton( Image bgImage,
Image iconImage)
@ -117,10 +118,13 @@ protected void paintComponent(Graphics g)
}
}
/**
* Paints this button.
* @param g the <tt>Graphics</tt> object used for painting
*/
private void internalPaintComponent(Graphics g)
{
AntialiasingManager.activateAntialiasing(g);
/*
* As JComponent#paintComponent says, if you do not invoke super's
* implementation you must honor the opaque property, that is if this

@ -65,8 +65,8 @@ public SIPCommFrame()
amap = rootPane.getActionMap();
amap.put("close", new CloseAction());
imap =
rootPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
imap
= rootPane.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
}
/**

@ -0,0 +1,271 @@
/*
* 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.util.swing;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import org.jvnet.lafwidget.animation.*;
/**
* The <tt>SIPCommMenu</tt> is very similar to a JComboBox. The main
* component here is a JLabel only with an icon. When user clicks on the icon a
* popup menu is opened, containing a list of icon-text pairs from which the
* user could choose one item. When user selects the desired item, the icon of
* the selected item is set to the main component label.
*
* @author Yana Stamcheva
*/
public class SIPCommMenu
extends JMenu
{
private static final long serialVersionUID = 1L;
private Object selectedObject;
/**
* Creates an instance of <tt>SIPCommMenu</tt>.
*/
public SIPCommMenu()
{
super();
init();
}
/**
* Creates an instance of <tt>SIPCommMenu</tt> by specifying
* the text and the icon.
*/
public SIPCommMenu(String text, Icon defaultIcon)
{
super(text);
this.setIcon(defaultIcon);
init();
}
/**
* Creates an instance of <tt>SIPCommMenu</tt> by specifying the
* initialy selected item.
*
* @param text The item that is initialy selected.
*/
public SIPCommMenu(String text)
{
super(text);
init();
}
private void init()
{
MouseRolloverHandler mouseHandler = new MouseRolloverHandler();
this.addMouseListener(mouseHandler);
this.addMouseMotionListener(mouseHandler);
}
/**
* Adds an item to the "choice list" of this selector box.
*
* @param text The text of the item.
* @param icon The icon of the item.
* @param actionListener The <tt>ActionListener</tt>, which handles the
* case, when the item is selected.
*/
public void addItem(String text, Icon icon, ActionListener actionListener)
{
JMenuItem item = new JMenuItem(text, icon);
item.addActionListener(actionListener);
this.add(item);
}
/**
* Selects the given item.
*
* @param selectedObject The object to select.
*/
public void setSelected(SelectedObject selectedObject)
{
if (selectedObject.getIcon() != null)
this.setIcon(selectedObject.getIcon());
if (selectedObject.getText() != null)
this.setText(selectedObject.getText());
if (selectedObject.getObject() != null)
this.setSelectedObject(selectedObject.getObject());
}
/**
* Selects the given object.
*
* @param o The <tt>Object</tt> to select.
*/
public void setSelectedObject(Object o)
{
this.selectedObject = o;
}
/**
* Returns the selected object.
*
* @return the selected object.
*/
public Object getSelectedObject()
{
return this.selectedObject;
}
/**
* Sets the isMouseOver property value and repaints this component.
*
* @param isMouseOver <code>true</code> to indicate that the mouse is over
* this component, <code>false</code> - otherwise.
*/
public void setMouseOver(boolean isMouseOver)
{
this.repaint();
}
/**
* Paints this component.
* @param g the <tt>Graphics</tt> object used for painting
*/
public void paintComponent(Graphics g)
{
g = g.create();
try
{
internalPaintComponent(g);
}
finally
{
g.dispose();
}
}
/**
* Paints a rollover effect when the mouse is over this menu.
* @param g the <tt>Graphics</tt> object used for painting
*/
private void internalPaintComponent(Graphics g)
{
AntialiasingManager.activateAntialiasing(g);
// Paint a roll over fade out.
FadeTracker fadeTracker = FadeTracker.getInstance();
float visibility = getModel().isRollover() ? 1.0f : 0.0f;
if (fadeTracker.isTracked(this, FadeKind.ROLLOVER))
{
visibility = fadeTracker.getFade(this, FadeKind.ROLLOVER);
}
visibility /= 2;
g.setColor(new Color(1.0f, 1.0f, 1.0f, visibility));
g.fillRoundRect(0, 0, this.getWidth(), this.getHeight(), 10, 10);
g.setColor(UIManager.getColor("Menu.foreground"));
super.paintComponent(g);
}
/**
* The <tt>ButtonRepaintCallback</tt> is charged to repaint this button
* when the fade animation is performed.
*/
private class ButtonRepaintCallback implements FadeTrackerCallback
{
public void fadeEnded(FadeKind arg0)
{
repaintLater();
}
public void fadePerformed(FadeKind arg0, float arg1)
{
repaintLater();
}
private void repaintLater()
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
SIPCommMenu.this.repaint();
}
});
}
public void fadeReversed(FadeKind arg0, boolean arg1, float arg2)
{
}
}
/**
* Perform a fade animation on mouse over.
*/
private class MouseRolloverHandler
implements MouseListener,
MouseMotionListener
{
public void mouseMoved(MouseEvent e)
{
}
public void mouseExited(MouseEvent e)
{
if (isEnabled())
{
getModel().setRollover(false);
FadeTracker fadeTracker = FadeTracker.getInstance();
fadeTracker.trackFadeOut(FadeKind.ROLLOVER,
SIPCommMenu.this,
true,
new ButtonRepaintCallback());
}
}
public void mouseClicked(MouseEvent e)
{
}
public void mouseEntered(MouseEvent e)
{
if (isEnabled())
{
getModel().setRollover(true);
FadeTracker fadeTracker = FadeTracker.getInstance();
fadeTracker.trackFadeIn(FadeKind.ROLLOVER,
SIPCommMenu.this,
true,
new ButtonRepaintCallback());
}
}
public void mousePressed(MouseEvent e)
{
}
public void mouseReleased(MouseEvent e)
{
}
public void mouseDragged(MouseEvent e)
{
}
}
}

@ -19,6 +19,8 @@
public class SIPCommMenuBar
extends JMenuBar
{
private boolean isRollover;
public SIPCommMenuBar()
{
this.setBorder(BorderFactory.createEmptyBorder());

@ -106,9 +106,9 @@ public String getText()
*/
public void setText(String text)
{
if (text != null && text.length() > 0)
super.setText(text);
else
super.setText(text);
if ((text == null || text.length() == 0) && !isFocusOwner())
setDefaultText();
}

@ -4,7 +4,7 @@
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.gui.customcontrols;
package net.java.sip.communicator.util.swing;
import javax.swing.*;
Loading…
Cancel
Save