Adds a general dial pad in the contact list.

cusax-fix
Yana Stamcheva 15 years ago
parent 30097d3f76
commit 94ee4e2f2e

@ -154,6 +154,30 @@ service.gui.buttons.NINE_DIAL_BUTTON=resources/images/impl/gui/buttons/nine.png
service.gui.buttons.STAR_DIAL_BUTTON=resources/images/impl/gui/buttons/star.png
service.gui.buttons.ZERO_DIAL_BUTTON=resources/images/impl/gui/buttons/zero.png
service.gui.buttons.DIEZ_DIAL_BUTTON=resources/images/impl/gui/buttons/diez.png
service.gui.buttons.ONE_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/oneMac.png
service.gui.buttons.TWO_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/twoMac.png
service.gui.buttons.THREE_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/threeMac.png
service.gui.buttons.FOUR_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/fourMac.png
service.gui.buttons.FIVE_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/fiveMac.png
service.gui.buttons.SIX_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/sixMac.png
service.gui.buttons.SEVEN_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/sevenMac.png
service.gui.buttons.EIGHT_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/eightMac.png
service.gui.buttons.NINE_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/nineMac.png
service.gui.buttons.STAR_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/starMac.png
service.gui.buttons.ZERO_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/zeroMac.png
service.gui.buttons.DIEZ_DIAL_BUTTON_MAC=resources/images/impl/gui/buttons/diezMac.png
service.gui.buttons.ONE_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/oneMacRollover.png
service.gui.buttons.TWO_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/twoMacRollover.png
service.gui.buttons.THREE_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/threeMacRollover.png
service.gui.buttons.FOUR_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/fourMacRollover.png
service.gui.buttons.FIVE_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/fiveMacRollover.png
service.gui.buttons.SIX_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/sixMacRollover.png
service.gui.buttons.SEVEN_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/sevenMacRollover.png
service.gui.buttons.EIGHT_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/eightMacRollover.png
service.gui.buttons.NINE_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/nineMacRollover.png
service.gui.buttons.STAR_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/starMacRollover.png
service.gui.buttons.ZERO_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/zeroMacRollover.png
service.gui.buttons.DIEZ_DIAL_BUTTON_MAC_ROLLOVER=resources/images/impl/gui/buttons/diezMacRollover.png
service.gui.buttons.CALL_PANEL_MINIMIZE_BUTTON=resources/images/impl/gui/buttons/callPanelMinimizeButton.png
service.gui.buttons.CALL_PANEL_RESTORE_BUTTON=resources/images/impl/gui/buttons/callPanelRestoreButton.png
service.gui.buttons.CALL_PANEL_MINIMIZE_ROLLOVER_BUTTON=resources/images/impl/gui/buttons/callPanelMinimizeButtonRollover.png
@ -218,6 +242,10 @@ service.gui.buttons.TRANSPARENT_WINDOW_BUTTON=resources/images/impl/gui/buttons/
service.gui.buttons.HD_VIDEO_BUTTON=resources/images/impl/gui/buttons/hdVideo.png
service.gui.buttons.SD_VIDEO_BUTTON=resources/images/impl/gui/buttons/sdVideo.png
service.gui.buttons.LO_VIDEO_BUTTON=resources/images/impl/gui/buttons/loVideo.png
service.gui.buttons.CONTACT_LIST_DIAL_BUTTON=resources/images/impl/gui/buttons/contactListDialButton.png
service.gui.buttons.CONTACT_LIST_DIAL_BUTTON_PRESSED=resources/images/impl/gui/buttons/contactListDialButtonPressed.png
service.gui.buttons.DIAL_PAD_CALL_BUTTON_BG=resources/images/impl/gui/buttons/dialPadCallButtonBg.png
service.gui.buttons.DIAL_PAD_CALL_BUTTON_ROLLOVER_BG=resources/images/impl/gui/buttons/dialPadCallButtonBgRollover.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: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

@ -156,7 +156,7 @@ service.gui.DATE=Date
service.gui.DELETE=Delete
service.gui.DENY=&Deny
service.gui.DESKTOP_SHARING_WARNING=<b>Are you sure you want to start screen sharing?</b> <br> Clicking OK will let people on this call see your screen.
service.gui.DIALPAD=Dialpad
service.gui.DIALPAD=Dial Pad
service.gui.DISPLAY_NAME=Display name
service.gui.DISCONNECTED_STATUS=Disconnected
service.gui.DND_STATUS=Do not disturb

@ -0,0 +1,62 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.gui.main;
import java.awt.*;
import java.awt.event.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.util.swing.*;
/**
* The dial pad button in the contact list.
*
* @author Yana Stamcheva
*/
public class DialPadButton
extends SIPCommTextButton
{
/**
* The dial pad dialog that this button opens.
*/
GeneralDialPadDialog dialPad;
/**
* Creates an instance of <tt>DialPadButton</tt>.
*/
public DialPadButton()
{
super("");
loadSkin();
addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
if (dialPad == null)
dialPad = new GeneralDialPadDialog();
dialPad.clear();
dialPad.setVisible(true);
}
});
}
/**
* Loads images and sets history view.
*/
public void loadSkin()
{
Image image = ImageLoader.getImage(ImageLoader.CONTACT_LIST_DIAL_BUTTON);
setBgImage(image);
this.setPreferredSize(new Dimension(image.getWidth(this),
image.getHeight(this)));
}
}

@ -0,0 +1,93 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.gui.main;
import java.awt.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.skin.*;
import net.java.sip.communicator.util.swing.*;
import net.java.sip.communicator.util.swing.plaf.*;
/**
* The <tt>SearchTextFieldUI</tt> is the one responsible for the search field
* look & feel. It draws a search icon inside the field and adjusts the bounds
* of the editor rectangle according to it.
*
* @author Yana Stamcheva
* @author Adam Netocny
*/
public class DialPadFieldUI
extends SIPCommTextFieldUI
implements Skinnable
{
/**
* Creates a <tt>SIPCommTextFieldUI</tt>.
*/
public DialPadFieldUI()
{
loadSkin();
}
/**
* Adds the custom mouse listeners defined in this class to the installed
* listeners.
*/
protected void installListeners()
{
super.installListeners();
}
/**
* Implements parent paintSafely method and enables antialiasing.
* @param g the <tt>Graphics</tt> object that notified us
*/
protected void paintSafely(Graphics g)
{
customPaintBackground(g);
super.paintSafely(g);
}
/**
* Paints the background of the associated component.
* @param g the <tt>Graphics</tt> object used for painting
*/
protected void customPaintBackground(Graphics g)
{
Graphics2D g2 = (Graphics2D) g.create();
try
{
AntialiasingManager.activateAntialiasing(g2);
super.customPaintBackground(g2);
}
finally
{
g2.dispose();
}
}
/**
* If we are in the case of disabled delete button, we simply call the
* parent implementation of this method, otherwise we recalculate the editor
* rectangle in order to leave place for the delete button.
* @return the visible editor rectangle
*/
protected Rectangle getVisibleEditorRect()
{
Rectangle rect = super.getVisibleEditorRect();
if ((rect.width > 0) && (rect.height > 0))
{
rect.x += 8;
rect.width -= 18;
return rect;
}
return null;
}
}

@ -0,0 +1,320 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.gui.main;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.main.call.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.skin.*;
import net.java.sip.communicator.util.swing.*;
import net.java.sip.communicator.util.swing.plaf.*;
import com.explodingpixels.macwidgets.*;
/**
* The <tt>DialpadDialog</tt> is a popup dialog containing a dialpad.
*
* @author Yana Stamcheva
*/
public class GeneralDialPadDialog
{
/**
* The call field, where the dialed number is typed.
*/
private final JTextField callField;
/**
* The actual dial pad dialog.
*/
private final JDialog dialPadDialog;
/**
* The call button.
*/
private JButton callButton;
/**
* A keyboard manager, where we register our own key dispatcher.
*/
private KeyboardFocusManager keyManager;
/**
* A key dispatcher that redirects all key events to call field.
*/
private KeyEventDispatcher keyDispatcher;
/**
* Creates an instance of <tt>GeneralDialPadDialog</tt>.
*/
public GeneralDialPadDialog()
{
if (OSUtils.IS_MAC)
{
HudWindow window = new HudWindow();
dialPadDialog = window.getJDialog();
}
else
{
dialPadDialog = new SIPCommDialog(false);
}
callField = new CallField(GuiActivator.getResources()
.getI18NString("service.gui.ENTER_NAME_OR_NUMBER"));
dialPadDialog.setTitle(
GuiActivator.getResources().getI18NString("service.gui.DIALPAD"));
JPanel mainPanel = new TransparentPanel(new BorderLayout());
mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
mainPanel.add(callField, BorderLayout.NORTH);
DTMFHandler dtmfHandler = new DTMFHandler();
dtmfHandler.addParent(dialPadDialog);
mainPanel.add(new GeneralDialPanel(this, dtmfHandler));
mainPanel.add(createCallPanel(), BorderLayout.SOUTH);
dialPadDialog.add(mainPanel);
dialPadDialog.pack();
dialPadDialog.addWindowListener(new WindowAdapter()
{
public void windowOpened(WindowEvent e)
{
if (keyManager == null)
{
keyManager
= KeyboardFocusManager.getCurrentKeyboardFocusManager();
keyDispatcher = new MainKeyDispatcher(keyManager);
}
keyManager.addKeyEventDispatcher(
new MainKeyDispatcher(keyManager));
}
@Override
public void windowClosed(WindowEvent e)
{
if (keyManager != null)
keyManager.removeKeyEventDispatcher(keyDispatcher);
keyManager = null;
keyDispatcher = null;
}
});
}
/**
* Creates the call panel.
*
* @return the created call panel.
*/
private JComponent createCallPanel()
{
JPanel buttonsPanel
= new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
Image callButtonImage
= ImageLoader.getImage(ImageLoader.DIAL_PAD_CALL_BUTTON_BG);
callButton = new SIPCommTextButton(
GuiActivator.getResources().getI18NString("service.gui.CALL"),
callButtonImage);
callButton.setPreferredSize(new Dimension(
callButtonImage.getWidth(null),
callButtonImage.getHeight(null)));
callButton.setForeground(Color.WHITE);
callButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
CallManager.createCall(callField.getText(), callButton,
new CallInterfaceListener()
{
public void callInterfaceStarted()
{
dialPadDialog.setVisible(false);
}
});
}
});
buttonsPanel.add(callButton);
dialPadDialog.getRootPane().setDefaultButton(callButton);
return buttonsPanel;
}
/**
* Indicates that a dial button was pressed.
*
* @param s the string corresponding to a number to add to the call field
*/
public void dialButtonPressed(String s)
{
callField.setText(callField.getText() + s);
}
/**
* Shows/hides the dial pad dialog.
*
* @param visible indicates if the dial pad should be shown or hidden.
*/
public void setVisible(boolean visible)
{
dialPadDialog.setLocationRelativeTo(
GuiActivator.getUIService().getMainFrame());
dialPadDialog.setVisible(visible);
callField.requestFocus();
}
/**
* Clears the call field.
*/
public void clear()
{
callField.setText("");
}
/**
* The <tt>MainKeyDispatcher</tt> is added to pre-listen KeyEvents before
* they're delivered to the current focus owner in order to introduce a
* specific behavior for the <tt>CallField</tt> on top of the dial pad.
*/
private class MainKeyDispatcher implements KeyEventDispatcher
{
private KeyboardFocusManager keyManager;
/**
* Creates an instance of <tt>MainKeyDispatcher</tt>.
* @param keyManager the parent <tt>KeyboardFocusManager</tt>
*/
public MainKeyDispatcher(KeyboardFocusManager keyManager)
{
this.keyManager = keyManager;
}
/**
* Dispatches the given <tt>KeyEvent</tt>.
* @param e the <tt>KeyEvent</tt> to dispatch
* @return <tt>true</tt> if the KeyboardFocusManager should take no
* further action with regard to the KeyEvent; <tt>false</tt>
* otherwise
*/
public boolean dispatchKeyEvent(KeyEvent e)
{
// If this window is not the focus window or if the event is not
// of type PRESSED we have nothing more to do here.
if (!dialPadDialog.isFocused()
|| (e.getID() != KeyEvent.KEY_TYPED))
return false;
if (e.getKeyChar() == KeyEvent.CHAR_UNDEFINED
|| e.getKeyCode() == KeyEvent.VK_ENTER
|| e.getKeyCode() == KeyEvent.VK_DELETE
|| e.getKeyCode() == KeyEvent.VK_BACK_SPACE
|| e.getKeyCode() == KeyEvent.VK_TAB
|| e.getKeyCode() == KeyEvent.VK_SPACE)
{
return false;
}
if (!callField.isFocusOwner()
&& keyManager.getFocusOwner() != null)
{
// Request the focus in the call field if a letter is typed.
callField.requestFocusInWindow();
// We re-dispatch the event to call field.
keyManager.redispatchEvent(callField, e);
// We don't want to dispatch further this event.
return true;
}
return false;
}
}
/**
* A custom call field.
*/
private class CallField
extends SIPCommTextField
implements Skinnable
{
/**
* The text field ui.
*/
private SIPCommTextFieldUI textFieldUI;
/**
* Creates an instance of the <tt>CallField</tt>.
*/
public CallField(String text)
{
super(text);
textFieldUI = new DialPadFieldUI();
textFieldUI.setDeleteButtonEnabled(true);
this.setPreferredSize(new Dimension(200, 23));
this.setUI(textFieldUI);
this.setBorder(null);
this.setOpaque(false);
this.setDragEnabled(true);
InputMap imap
= getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "escape");
ActionMap amap = getActionMap();
amap.put("escape", new AbstractAction()
{
public void actionPerformed(ActionEvent e)
{
setText("");
}
});
loadSkin();
}
/**
* Reloads text field UI defs.
*/
public void loadSkin()
{
textFieldUI.loadSkin();
if (OSUtils.IS_MAC)
{
textFieldUI.setBgStartColor(Color.BLACK);
textFieldUI.setBgEndColor(Color.BLACK);
textFieldUI.setBgBorderStartColor(Color.DARK_GRAY);
textFieldUI.setBgBorderEndColor(Color.GRAY);
setForegroundColor(Color.WHITE);
setDefaultTextColor(Color.GRAY);
setCaretColor(Color.WHITE);
}
}
}
}

@ -0,0 +1,244 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.gui.main;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import javax.swing.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.main.call.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.resources.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.skin.*;
import net.java.sip.communicator.util.swing.*;
/**
* The <tt>DialPanel</tt> is the panel that contains the buttons to dial a
* phone number.
*
* @author Yana Stamcheva
* @author Adam Netocny
*/
public class GeneralDialPanel
extends TransparentPanel
implements MouseListener,
Skinnable
{
/**
* The dial panel.
*/
private final JPanel dialPadPanel =
new TransparentPanel(new GridLayout(4, 3,
GuiActivator.getResources()
.getSettingsInt("impl.gui.DIAL_PAD_HORIZONTAL_GAP"),
GuiActivator.getResources()
.getSettingsInt("impl.gui.DIAL_PAD_VERTICAL_GAP")));
/**
* Handles DTMFs.
*/
private DTMFHandler dtmfHandler;
/**
* The parent dial pad dialog.
*/
private final GeneralDialPadDialog dialPadDialog;
/**
* Creates an instance of <tt>DialPanel</tt> for a specific call, by
* specifying the parent <tt>CallManager</tt> and the
* <tt>CallPeer</tt>.
*
* @param dtmfHandler handles DTMFs.
*/
public GeneralDialPanel(GeneralDialPadDialog dialPadDialog,
DTMFHandler dtmfHandler)
{
this.dialPadDialog = dialPadDialog;
this.dtmfHandler = dtmfHandler;
this.init();
}
/**
* Initializes this panel by adding all dial buttons to it.
*/
public void init()
{
this.dialPadPanel.setOpaque(false);
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
loadSkin();
this.add(dialPadPanel, BorderLayout.CENTER);
}
/**
* Creates DTMF button.
*
* @param bgImage
* @param iconImage
* @param name
* @return the created dial button
*/
private JButton createDialButton(Image bgImage, ImageID iconImage,
String name)
{
JButton button =
new SIPCommButton(bgImage, ImageLoader.getImage(iconImage));
button.setAlignmentY(JButton.LEFT_ALIGNMENT);
button.setName(name);
button.setOpaque(false);
button.addMouseListener(this);
return button;
}
/**
* Creates DTMF button.
*
* @param bgImage
* @param iconImage
* @param name
* @return the created dial button
*/
private JButton createMacOSXDialButton( ImageID imageID,
ImageID rolloverImageID,
String name)
{
JButton button = new SIPCommButton(
ImageLoader.getImage(imageID),
ImageLoader.getImage(rolloverImageID),
ImageLoader.getImage(rolloverImageID),
null,
null,
null);
button.setName(name);
button.addMouseListener(this);
return button;
}
public void mouseClicked(MouseEvent e) {}
public void mouseEntered(MouseEvent e) {}
public void mouseExited(MouseEvent e) {}
/**
* Handles the <tt>MouseEvent</tt> triggered when user presses one of the
* dial buttons.
* @param e the event
*/
public void mousePressed(MouseEvent e)
{
JButton button = (JButton) e.getSource();
dialPadDialog.dialButtonPressed(button.getName());
dtmfHandler.startSendingDtmfTone(button.getName());
}
/**
* Handles the <tt>MouseEvent</tt> triggered when user releases one of the
* dial buttons.
* @param e the event
*/
public void mouseReleased(MouseEvent e)
{
dtmfHandler.stopSendingDtmfTone();
}
/**
* Paints the main background image to the background of this dial panel.
*
* @param g the <tt>Graphics</tt> object used for painting
*/
public void paintComponent(Graphics g)
{
// do the superclass behavior first
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
boolean isTextureBackground
= Boolean.parseBoolean(GuiActivator.getResources()
.getSettingsString("impl.gui.IS_CONTACT_LIST_TEXTURE_BG_ENABLED"));
BufferedImage bgImage
= ImageLoader.getImage(ImageLoader.MAIN_WINDOW_BACKGROUND);
// paint the image
if (bgImage != null)
{
if (isTextureBackground)
{
Rectangle rect
= new Rectangle(0, 0,
bgImage.getWidth(null),
bgImage.getHeight(null));
TexturePaint texture = new TexturePaint(bgImage, rect);
g2.setPaint(texture);
g2.fillRect(0, 0, this.getWidth(), this.getHeight());
}
else
{
g.setColor(new Color(
GuiActivator.getResources()
.getColor("contactListBackground")));
// paint the background with the choosen color
g.fillRect(0, 0, getWidth(), getHeight());
g2.drawImage(bgImage,
this.getWidth() - bgImage.getWidth(),
this.getHeight() - bgImage.getHeight(),
this);
}
}
}
/**
* Reloads dial buttons.
*/
public void loadSkin()
{
dialPadPanel.removeAll();
Image bgImage = ImageLoader.getImage(ImageLoader.DIAL_BUTTON_BG);
DTMFHandler.DTMFToneInfo[] availableTones = DTMFHandler.availableTones;
for (int i = 0; i < availableTones.length; i++)
{
DTMFHandler.DTMFToneInfo info = availableTones[i];
// we add only buttons having image
if(info.imageID == null)
continue;
JComponent c;
if (OSUtils.IS_MAC)
c = createMacOSXDialButton(
info.macImageID,
info.macImageRolloverID,
info.tone.getValue());
else
c = createDialButton(
bgImage, info.imageID, info.tone.getValue());
dialPadPanel.add(c);
}
}
}

@ -265,8 +265,9 @@ private void init()
TransparentPanel searchPanel
= new TransparentPanel(new BorderLayout(2, 0));
searchPanel.add(searchField);
searchPanel.add(searchField);
searchPanel.add(new DialPadButton(), BorderLayout.WEST);
searchPanel.add(createButtonPanel(), BorderLayout.EAST);
northPanel.add(accountStatusPanel, BorderLayout.CENTER);

@ -0,0 +1,21 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.gui.main.call;
/**
* The <tt>CallInterfaceListener</tt> is notified when the call interface has
* been started after the call was created.
*
* @author Yana Stamcheva
*/
public interface CallInterfaceListener
{
/**
* Indicates that the call interface was started.
*/
public void callInterfaceStarted();
}

@ -626,7 +626,23 @@ public static void enableDesktopRemoteControl( CallPeer callPeer,
* @param c the component, which indicates where should be shown the "call
* via" menu if needed
*/
public static void createCall(String callString, JComponent c)
public static void createCall( String callString,
JComponent c)
{
createCall(callString, c, null);
}
/**
* Creates a call to the given call string. The given component indicates
* where should be shown the "call via" menu if needed.
*
* @param callString the string to call
* @param c the component, which indicates where should be shown the "call
* via" menu if needed
*/
public static void createCall( String callString,
JComponent c,
CallInterfaceListener l)
{
callString = callString.trim();
@ -653,6 +669,9 @@ public static void createCall(String callString, JComponent c)
{
CallManager.createCall(
telephonyProviders.get(0), callString);
if (l != null)
l.callInterfaceStarted();
}
else if (telephonyProviders.size() > 1)
{
@ -660,12 +679,22 @@ else if (telephonyProviders.size() > 1)
= new ChooseCallAccountPopupMenu(
c,
callString,
telephonyProviders);
telephonyProviders,
l);
chooseAccountDialog
.setLocation(c.getLocation());
chooseAccountDialog.showPopupMenu();
}
else
{
new ErrorDialog(
null,
GuiActivator.getResources().getI18NString("service.gui.WARNING"),
GuiActivator.getResources().getI18NString(
"service.gui.NO_ONLINE_TELEPHONY_ACCOUNT"))
.showDialog();
}
}
/**

@ -46,6 +46,12 @@ public class ChooseCallAccountPopupMenu
*/
private final JComponent invoker;
/**
* The call interface listener, which would be notified once the call
* interface is created.
*/
private CallInterfaceListener callInterfaceListener;
/**
* Creates this dialog.
*
@ -62,6 +68,25 @@ public ChooseCallAccountPopupMenu(
OperationSetBasicTelephony.class);
}
/**
* Creates this dialog.
*
* @param invoker the invoker of this pop up menu
* @param contactToCall the contact to call
* @param telephonyProviders a list of all possible telephony providers
*/
public ChooseCallAccountPopupMenu(
JComponent invoker,
final String contactToCall,
List<ProtocolProviderService> telephonyProviders,
CallInterfaceListener l)
{
this(invoker, contactToCall, telephonyProviders,
OperationSetBasicTelephony.class);
callInterfaceListener = l;
}
/**
* Creates this dialog.
*
@ -180,6 +205,9 @@ else if (opSetClass.equals(
providerItem.getProtocolProvider(),
contactString);
if (callInterfaceListener != null)
callInterfaceListener.callInterfaceStarted();
ChooseCallAccountPopupMenu.this.setVisible(false);
}
});

@ -51,103 +51,135 @@ public class DTMFHandler
* All available tones and its properties like images for buttons, and
* sounds to be played during send.
*/
static final DTMFToneInfo[] availableTones = new DTMFToneInfo[]
public static final DTMFToneInfo[] availableTones = new DTMFToneInfo[]
{
new DTMFToneInfo(
DTMFTone.DTMF_1,
KeyEvent.VK_1,
'1',
ImageLoader.ONE_DIAL_BUTTON,
ImageLoader.ONE_DIAL_BUTTON_MAC,
ImageLoader.ONE_DIAL_BUTTON_MAC_ROLLOVER,
SoundProperties.DIAL_ONE),
new DTMFToneInfo(
DTMFTone.DTMF_2,
KeyEvent.VK_2,
'2',
ImageLoader.TWO_DIAL_BUTTON,
ImageLoader.TWO_DIAL_BUTTON_MAC,
ImageLoader.TWO_DIAL_BUTTON_MAC_ROLLOVER,
SoundProperties.DIAL_TWO),
new DTMFToneInfo(
DTMFTone.DTMF_3,
KeyEvent.VK_3,
'3',
ImageLoader.THREE_DIAL_BUTTON,
ImageLoader.THREE_DIAL_BUTTON_MAC,
ImageLoader.THREE_DIAL_BUTTON_MAC_ROLLOVER,
SoundProperties.DIAL_THREE),
new DTMFToneInfo(
DTMFTone.DTMF_4,
KeyEvent.VK_4,
'4',
ImageLoader.FOUR_DIAL_BUTTON,
ImageLoader.FOUR_DIAL_BUTTON_MAC,
ImageLoader.FOUR_DIAL_BUTTON_MAC_ROLLOVER,
SoundProperties.DIAL_FOUR),
new DTMFToneInfo(
DTMFTone.DTMF_5,
KeyEvent.VK_5,
'5',
ImageLoader.FIVE_DIAL_BUTTON,
ImageLoader.FIVE_DIAL_BUTTON_MAC,
ImageLoader.FIVE_DIAL_BUTTON_MAC_ROLLOVER,
SoundProperties.DIAL_FIVE),
new DTMFToneInfo(
DTMFTone.DTMF_6,
KeyEvent.VK_6,
'6',
ImageLoader.SIX_DIAL_BUTTON,
ImageLoader.SIX_DIAL_BUTTON_MAC,
ImageLoader.SIX_DIAL_BUTTON_MAC_ROLLOVER,
SoundProperties.DIAL_SIX),
new DTMFToneInfo(
DTMFTone.DTMF_7,
KeyEvent.VK_7,
'7',
ImageLoader.SEVEN_DIAL_BUTTON,
ImageLoader.SEVEN_DIAL_BUTTON_MAC,
ImageLoader.SEVEN_DIAL_BUTTON_MAC_ROLLOVER,
SoundProperties.DIAL_SEVEN),
new DTMFToneInfo(
DTMFTone.DTMF_8,
KeyEvent.VK_8,
'8',
ImageLoader.EIGHT_DIAL_BUTTON,
ImageLoader.EIGHT_DIAL_BUTTON_MAC,
ImageLoader.EIGHT_DIAL_BUTTON_MAC_ROLLOVER,
SoundProperties.DIAL_EIGHT),
new DTMFToneInfo(
DTMFTone.DTMF_9,
KeyEvent.VK_9,
'9',
ImageLoader.NINE_DIAL_BUTTON,
ImageLoader.NINE_DIAL_BUTTON_MAC,
ImageLoader.NINE_DIAL_BUTTON_MAC_ROLLOVER,
SoundProperties.DIAL_NINE),
new DTMFToneInfo(
DTMFTone.DTMF_A,
KeyEvent.VK_A,
'a',
null,
null,
null,
null),
new DTMFToneInfo(
DTMFTone.DTMF_B,
KeyEvent.VK_B,
'b',
null,
null,
null,
null),
new DTMFToneInfo(
DTMFTone.DTMF_C,
KeyEvent.VK_C,
'c',
null,
null,
null,
null),
new DTMFToneInfo(
DTMFTone.DTMF_D,
KeyEvent.VK_D,
'd',
null,
null,
null,
null),
new DTMFToneInfo(
DTMFTone.DTMF_STAR,
KeyEvent.VK_ASTERISK,
'*',
ImageLoader.STAR_DIAL_BUTTON,
ImageLoader.STAR_DIAL_BUTTON_MAC,
ImageLoader.STAR_DIAL_BUTTON_MAC_ROLLOVER,
SoundProperties.DIAL_STAR),
new DTMFToneInfo(
DTMFTone.DTMF_0,
KeyEvent.VK_0,
'0',
ImageLoader.ZERO_DIAL_BUTTON,
ImageLoader.ZERO_DIAL_BUTTON_MAC,
ImageLoader.ZERO_DIAL_BUTTON_MAC_ROLLOVER,
SoundProperties.DIAL_ZERO),
new DTMFToneInfo(
DTMFTone.DTMF_SHARP,
KeyEvent.VK_NUMBER_SIGN,
'#',
ImageLoader.DIEZ_DIAL_BUTTON,
ImageLoader.DIEZ_DIAL_BUTTON_MAC,
ImageLoader.DIEZ_DIAL_BUTTON_MAC_ROLLOVER,
SoundProperties.DIAL_DIEZ)
};
@ -167,11 +199,23 @@ public DTMFHandler(CallPanel callContainer)
keyManager.addKeyEventDispatcher(this);
}
/**
* Creates DTMF handler for a call.
* @param callContainer the <tt>CallContainer</tt>, where this handler is
* registered
*/
public DTMFHandler()
{
KeyboardFocusManager keyManager
= KeyboardFocusManager.getCurrentKeyboardFocusManager();
keyManager.addKeyEventDispatcher(this);
}
/**
* Add parent on which we listen for key entering.
* @param w
*/
void addParent(Window w)
public void addParent(Window w)
{
parents.add(w);
}
@ -233,7 +277,7 @@ else if(e.getID() == KeyEvent.KEY_RELEASED)
*
* @param toneValue the value of the DTMF tone to send.
*/
void startSendingDtmfTone(String toneValue)
public void startSendingDtmfTone(String toneValue)
{
for (int i = 0; i < availableTones.length; i++)
{
@ -266,8 +310,35 @@ private synchronized void startSendingDtmfTone(DTMFToneInfo info)
currentlyPlayingAudio.playInLoop(10);
}
Iterator<? extends CallPeer> callPeers
= callContainer.getCurrentCallRenderer().getCall().getCallPeers();
if (callContainer != null)
startSendingDtmfTone(
callContainer.getCurrentCallRenderer().getCall(),
info);
else
{
Collection<Call> activeCalls = CallManager.getActiveCalls();
if (activeCalls != null)
{
Iterator<Call> callsIter = activeCalls.iterator();
while (callsIter.hasNext())
{
startSendingDtmfTone(callsIter.next(), info);
}
}
}
}
/**
* Sends a DTMF tone to the current DTMF operation set of the given call.
*
* @param call The call to which we send DTMF-s.
* @param info The DTMF tone to send.
*/
private void startSendingDtmfTone(Call call, DTMFToneInfo info)
{
Iterator<? extends CallPeer> callPeers = call.getCallPeers();
try
{
@ -299,15 +370,40 @@ private synchronized void startSendingDtmfTone(DTMFToneInfo info)
/**
* Stop sending DTMF tone.
*/
synchronized void stopSendingDtmfTone()
public synchronized void stopSendingDtmfTone()
{
if(currentlyPlayingAudio != null)
currentlyPlayingAudio.stop();
currentlyPlayingAudio = null;
Iterator<? extends CallPeer> callPeers
= callContainer.getCurrentCallRenderer().getCall().getCallPeers();
if (callContainer != null)
stopSendingDtmfTone(
callContainer.getCurrentCallRenderer().getCall());
else
{
Collection<Call> activeCalls = CallManager.getActiveCalls();
if (activeCalls != null)
{
Iterator<Call> callsIter = activeCalls.iterator();
while (callsIter.hasNext())
{
stopSendingDtmfTone(callsIter.next());
}
}
}
}
/**
* Stops sending DTMF tone to the given call.
*
* @param call The call to which we send DTMF-s.
*/
private void stopSendingDtmfTone(Call call)
{
Iterator<? extends CallPeer> callPeers = call.getCallPeers();
try
{
@ -332,32 +428,42 @@ synchronized void stopSendingDtmfTone()
/**
* DTMF extended information.
*/
static class DTMFToneInfo
public static class DTMFToneInfo
{
/**
* The tone itself
*/
DTMFTone tone;
public DTMFTone tone;
/**
* The key code when entered from keyboard.
*/
int keyCode;
public int keyCode;
/**
* The char associated with this DTMF tone.
*/
char keyChar;
public char keyChar;
/**
* The image to display in buttons sending DTMFs.
*/
ImageID imageID;
public ImageID imageID;
/**
* The image to display on Mac buttons.
*/
public ImageID macImageID;
/**
* The id of the image to display on Mac buttons on rollover.
*/
public ImageID macImageRolloverID;
/**
* The sound to play during send of this tone.
*/
String sound;
public String sound;
/**
* Creates DTMF extended info.
@ -365,16 +471,20 @@ static class DTMFToneInfo
* @param keyCode its key code.
* @param keyChar the char associated with the DTMF
* @param imageID the image if any.
* @param macImageID the Mac image if any.
* @param sound the sound if any.
*/
public DTMFToneInfo(
DTMFTone tone, int keyCode, char keyChar,
ImageID imageID, String sound)
ImageID imageID, ImageID macImageID,
ImageID macImageRolloverID, String sound)
{
this.tone = tone;
this.keyCode = keyCode;
this.keyChar = keyChar;
this.imageID = imageID;
this.macImageID = macImageID;
this.macImageRolloverID = macImageRolloverID;
this.sound = sound;
}
}

@ -134,7 +134,7 @@ protected void customPaintBackground(Graphics g)
int dy = (c.getY() + c.getHeight()) / 2
- searchIcon.getIconHeight()/2;
g2.drawImage(searchIcon.getImage(), c.getX() + 5, dy + 1, null);
g2.drawImage(searchIcon.getImage(), 5, dy + 1, null);
if (c.getText() != null
&& c.getText().length() > 0

@ -397,6 +397,150 @@ public class ImageLoader
public static final ImageID STATUS_SELECTOR_BOX
= new ImageID("service.gui.buttons.STATUS_SELECTOR_BOX");
/**
* A dial button icon.
*/
public static final ImageID ONE_DIAL_BUTTON_MAC
= new ImageID("service.gui.buttons.ONE_DIAL_BUTTON_MAC");
/**
* A dial button icon.
*/
public static final ImageID TWO_DIAL_BUTTON_MAC
= new ImageID("service.gui.buttons.TWO_DIAL_BUTTON_MAC");
/**
* A dial button icon.
*/
public static final ImageID THREE_DIAL_BUTTON_MAC
= new ImageID("service.gui.buttons.THREE_DIAL_BUTTON_MAC");
/**
* A dial button icon.
*/
public static final ImageID FOUR_DIAL_BUTTON_MAC
= new ImageID("service.gui.buttons.FOUR_DIAL_BUTTON_MAC");
/**
* A dial button icon.
*/
public static final ImageID FIVE_DIAL_BUTTON_MAC
= new ImageID("service.gui.buttons.FIVE_DIAL_BUTTON_MAC");
/**
* A dial button icon.
*/
public static final ImageID SIX_DIAL_BUTTON_MAC
= new ImageID("service.gui.buttons.SIX_DIAL_BUTTON_MAC");
/**
* A dial button icon.
*/
public static final ImageID SEVEN_DIAL_BUTTON_MAC
= new ImageID("service.gui.buttons.SEVEN_DIAL_BUTTON_MAC");
/**
* A dial button icon.
*/
public static final ImageID EIGHT_DIAL_BUTTON_MAC
= new ImageID("service.gui.buttons.EIGHT_DIAL_BUTTON_MAC");
/**
* A dial button icon.
*/
public static final ImageID NINE_DIAL_BUTTON_MAC
= new ImageID("service.gui.buttons.NINE_DIAL_BUTTON_MAC");
/**
* A dial button icon.
*/
public static final ImageID STAR_DIAL_BUTTON_MAC
= new ImageID("service.gui.buttons.STAR_DIAL_BUTTON_MAC");
/**
* A dial button icon.
*/
public static final ImageID ZERO_DIAL_BUTTON_MAC
= new ImageID("service.gui.buttons.ZERO_DIAL_BUTTON_MAC");
/**
* A dial button icon.
*/
public static final ImageID DIEZ_DIAL_BUTTON_MAC
= new ImageID("service.gui.buttons.DIEZ_DIAL_BUTTON_MAC");
/**
* A dial button icon.
*/
public static final ImageID ONE_DIAL_BUTTON_MAC_ROLLOVER
= new ImageID("service.gui.buttons.ONE_DIAL_BUTTON_MAC_ROLLOVER");
/**
* A dial button icon.
*/
public static final ImageID TWO_DIAL_BUTTON_MAC_ROLLOVER
= new ImageID("service.gui.buttons.TWO_DIAL_BUTTON_MAC_ROLLOVER");
/**
* A dial button icon.
*/
public static final ImageID THREE_DIAL_BUTTON_MAC_ROLLOVER
= new ImageID("service.gui.buttons.THREE_DIAL_BUTTON_MAC_ROLLOVER");
/**
* A dial button icon.
*/
public static final ImageID FOUR_DIAL_BUTTON_MAC_ROLLOVER
= new ImageID("service.gui.buttons.FOUR_DIAL_BUTTON_MAC_ROLLOVER");
/**
* A dial button icon.
*/
public static final ImageID FIVE_DIAL_BUTTON_MAC_ROLLOVER
= new ImageID("service.gui.buttons.FIVE_DIAL_BUTTON_MAC_ROLLOVER");
/**
* A dial button icon.
*/
public static final ImageID SIX_DIAL_BUTTON_MAC_ROLLOVER
= new ImageID("service.gui.buttons.SIX_DIAL_BUTTON_MAC_ROLLOVER");
/**
* A dial button icon.
*/
public static final ImageID SEVEN_DIAL_BUTTON_MAC_ROLLOVER
= new ImageID("service.gui.buttons.SEVEN_DIAL_BUTTON_MAC_ROLLOVER");
/**
* A dial button icon.
*/
public static final ImageID EIGHT_DIAL_BUTTON_MAC_ROLLOVER
= new ImageID("service.gui.buttons.EIGHT_DIAL_BUTTON_MAC_ROLLOVER");
/**
* A dial button icon.
*/
public static final ImageID NINE_DIAL_BUTTON_MAC_ROLLOVER
= new ImageID("service.gui.buttons.NINE_DIAL_BUTTON_MAC_ROLLOVER");
/**
* A dial button icon.
*/
public static final ImageID STAR_DIAL_BUTTON_MAC_ROLLOVER
= new ImageID("service.gui.buttons.STAR_DIAL_BUTTON_MAC_ROLLOVER");
/**
* A dial button icon.
*/
public static final ImageID ZERO_DIAL_BUTTON_MAC_ROLLOVER
= new ImageID("service.gui.buttons.ZERO_DIAL_BUTTON_MAC_ROLLOVER");
/**
* A dial button icon.
*/
public static final ImageID DIEZ_DIAL_BUTTON_MAC_ROLLOVER
= new ImageID("service.gui.buttons.DIEZ_DIAL_BUTTON_MAC_ROLLOVER");
/**
* A dial button icon.
*/
@ -973,6 +1117,30 @@ public class ImageLoader
public static final ImageID TRANSPARENT_WINDOW_BUTTON
= new ImageID("service.gui.buttons.TRANSPARENT_WINDOW_BUTTON");
/**
* The dial button shown in contact list.
*/
public static final ImageID CONTACT_LIST_DIAL_BUTTON
= new ImageID("service.gui.buttons.CONTACT_LIST_DIAL_BUTTON");
/**
* The dial button shown in contact list.
*/
public static final ImageID CONTACT_LIST_DIAL_BUTTON_PRESSED
= new ImageID("service.gui.buttons.CONTACT_LIST_DIAL_BUTTON_PRESSED");
/**
* The dial pad call button background.
*/
public static final ImageID DIAL_PAD_CALL_BUTTON_BG
= new ImageID("service.gui.buttons.DIAL_PAD_CALL_BUTTON_BG");
/**
* The dial pad call button rollover background.
*/
public static final ImageID DIAL_PAD_CALL_BUTTON_ROLLOVER_BG
= new ImageID("service.gui.buttons.DIAL_PAD_CALL_BUTTON_ROLLOVER_BG");
/*
* =======================================================================
* ------------------------ EDIT TOOLBAR ICONS ---------------------------

@ -18,7 +18,7 @@
* @author Yana Stamcheva
* @author Lubomir Marinov
*/
public abstract class SIPCommDialog
public class SIPCommDialog
extends JDialog
{
/**
@ -416,5 +416,14 @@ public void dispose()
* @param escaped <tt>true</tt> if this dialog has been closed by pressing
* the Esc key; otherwise, <tt>false</tt>
*/
protected abstract void close(boolean escaped);
/**
* All functions implemented in this method will be invoked when user
* presses the Escape key.
* @param isEscaped indicates if this frame has been closed by pressing the
* Esc key
*/
protected void close(boolean isEscaped)
{
}
}

@ -64,28 +64,28 @@ public class SIPCommTextFieldUI
/**
* The start background gradient color.
*/
private final Color bgStartColor
private Color bgStartColor
= new Color(UtilActivator.getResources().getColor(
"service.gui.SEARCH_BACKGROUND"));
/**
* The end background gradient color.
*/
private final Color bgEndColor
private Color bgEndColor
= new Color(UtilActivator.getResources().getColor(
"service.gui.SEARCH_GRADIENT"));
/**
* The start background gradient color.
*/
private final Color bgBorderStartColor
private Color bgBorderStartColor
= new Color(UtilActivator.getResources().getColor(
"service.gui.SEARCH_BORDER"));
/**
* The end background gradient color.
*/
private final Color bgBorderEndColor
private Color bgBorderEndColor
= new Color(UtilActivator.getResources().getColor(
"service.gui.SEARCH_BORDER_GRADIENT"));
@ -264,8 +264,8 @@ protected Rectangle getDeleteButtonRect()
Rectangle rect = c.getBounds();
int dx = rect.x + rect.width - deleteButton.getWidth() - BUTTON_GAP - 5;
int dy = (rect.y + rect.height) / 2 - deleteButton.getHeight()/2;
int dx = rect.width - deleteButton.getWidth() - BUTTON_GAP - 5;
int dy = rect.height / 2 - deleteButton.getHeight()/2;
return new Rectangle( dx,
dy,
@ -297,7 +297,7 @@ protected Rectangle getVisibleEditorRect()
alloc.x += insets.left;
alloc.y += insets.top;
alloc.width -= insets.left + insets.right
+ deleteButton.getWidth();
+ getDeleteButtonRect().getWidth();
alloc.height -= insets.top + insets.bottom;
return alloc;
}
@ -305,6 +305,38 @@ protected Rectangle getVisibleEditorRect()
return null;
}
/**
* @param bgStartColor the bgStartColor to set
*/
public void setBgStartColor(Color bgStartColor)
{
this.bgStartColor = bgStartColor;
}
/**
* @param bgEndColor the bgEndColor to set
*/
public void setBgEndColor(Color bgEndColor)
{
this.bgEndColor = bgEndColor;
}
/**
* @param bgBorderStartColor the bgBorderStartColor to set
*/
public void setBgBorderStartColor(Color bgBorderStartColor)
{
this.bgBorderStartColor = bgBorderStartColor;
}
/**
* @param bgBorderEndColor the bgBorderEndColor to set
*/
public void setBgBorderEndColor(Color bgBorderEndColor)
{
this.bgBorderEndColor = bgBorderEndColor;
}
/**
* Reloads skin information.
*/

Loading…
Cancel
Save