- Showing a tooltip over the call button in the search field.

- Hiding the call button in the search field when there're no available providers
(part of issue #816 Calling certain numbers/contacts that are not in the user list is possible only if the full address/name is typed)
cusax-fix
Yana Stamcheva 16 years ago
parent 2aeb90331b
commit 3503e4127d

@ -74,7 +74,6 @@ service.gui.BRB_MESSAGE=I'm gone right now, but I'll be back.
service.gui.BROWSE=Browse
service.gui.BUSY_MESSAGE=Sorry, I'm busy right now.
service.gui.CALL=Call
service.gui.CALL_ANY_NUMBER=Call any number you typed
service.gui.CALL_CONTACT=Call contact
service.gui.CALL_HISTORY_TOOL_TIP=Click here to show call history
service.gui.CALL_VIA=Call via:

@ -35,19 +35,20 @@ public class SearchFieldUI
private Image callIcon;
/**
* The rollover icon of the call button.
* The roll over icon of the call button.
*/
private Image callRolloverIcon;
/**
* The call button in the search field.
* Indicates if the mouse is currently over the call button.
*/
private SIPCommButton callButton;
private boolean isCallMouseOver = false;
/**
* Indicates if the mouse is currently over the call button.
* The call button tool tip string.
*/
private boolean isCallMouseOver = false;
private final String callString
= GuiActivator.getResources().getI18NString("service.gui.CALL");
/**
* Creates a <tt>SIPCommTextFieldUI</tt>.
@ -63,13 +64,6 @@ public SearchFieldUI()
callRolloverIcon = UtilActivator.getResources()
.getImage("service.gui.buttons.SEARCH_CALL_ROLLOVER_ICON")
.getImage();
callButton = new SIPCommButton(callIcon, callRolloverIcon);
callButton.setToolTipText(GuiActivator.getResources()
.getI18NString("service.gui.CALL_ANY_NUMBER"));
callButton.setSize (callRolloverIcon.getWidth(null),
callRolloverIcon.getHeight(null));
}
/**
@ -123,7 +117,8 @@ protected void customPaintBackground(Graphics g)
dy = callRect.y;
if (c.getText() != null
&& c.getText().length() > 0)
&& c.getText().length() > 0
&& CallManager.getTelephonyProviders().size() > 0)
{
if (isCallMouseOver)
g2.drawImage(callRolloverIcon, dx, dy, null);
@ -151,7 +146,8 @@ protected Rectangle getVisibleEditorRect()
if ((rect.width > 0) && (rect.height > 0))
{
rect.x += searchIcon.getIconWidth() + 8;
rect.width -= searchIcon.getIconWidth() + callButton.getWidth() + 15;
rect.width -= searchIcon.getIconWidth()
+ callRolloverIcon.getWidth(null) + 15;
return rect;
}
return null;
@ -237,17 +233,26 @@ private void updateCallIcon(MouseEvent evt)
if (callButtonRect.contains(x, y))
{
JTextComponent c = getComponent();
String searchText = c.getText();
if (searchText == null)
return;
// Show a tool tip over the call button.
getComponent().setToolTipText(callString + " " + searchText);
ToolTipManager.sharedInstance().mouseEntered(
new MouseEvent(getComponent(), 0, x, y,
x, y, // X-Y of the mouse for the tool tip
0, false));
// Update the default cursor.
isCallMouseOver = true;
getComponent().setCursor(Cursor.getDefaultCursor());
// Perform call action when the call button is clicked.
if (evt.getID() == MouseEvent.MOUSE_CLICKED)
{
JTextComponent c = getComponent();
String searchText = c.getText();
if (searchText == null)
return;
List<ProtocolProviderService> telephonyProviders
= CallManager.getTelephonyProviders();
@ -271,7 +276,17 @@ else if (telephonyProviders.size() > 1)
}
}
else
{
// Remove the call button tool tip when the mouse exits the call
// button area.
getComponent().setToolTipText("");
ToolTipManager.sharedInstance().mouseExited(
new MouseEvent(getComponent(), 0, x, y,
x, y, // X-Y of the mouse for the tool tip
0, false));
isCallMouseOver = false;
}
getComponent().repaint();
}
@ -286,12 +301,12 @@ protected Rectangle getCallButtonRect()
Component c = getComponent();
Rectangle rect = c.getBounds();
int dx = getDeleteButtonRect().x - callButton.getWidth() - 2;
int dy = (rect.y + rect.height) / 2 - callButton.getHeight()/2;
int dx = getDeleteButtonRect().x - callRolloverIcon.getWidth(null) - 2;
int dy = (rect.y + rect.height) / 2 - callRolloverIcon.getHeight(null)/2;
return new Rectangle( dx,
dy,
callButton.getWidth(),
callButton.getHeight());
callRolloverIcon.getWidth(null),
callRolloverIcon.getHeight(null));
}
}

Loading…
Cancel
Save