OSX work.

git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@7637 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Derek DeMoro
2007-03-21 19:57:34 +00:00
committed by derek
parent 85272006ca
commit 0771ec62b7
2 changed files with 15 additions and 35 deletions

View File

@ -76,7 +76,14 @@ public class SearchService extends JPanel {
final JLabel lockLabel = new JLabel(); final JLabel lockLabel = new JLabel();
lockLabel.setHorizontalTextPosition(JLabel.LEFT); lockLabel.setHorizontalTextPosition(JLabel.LEFT);
lockLabel.setIcon(SparkRes.getImageIcon(SparkRes.LOCK_16x16)); lockLabel.setIcon(SparkRes.getImageIcon(SparkRes.LOCK_16x16));
add(lockLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0)); if (Spark.isMac()) {
add(lockLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 15), 0, 0));
}
else {
add(lockLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
}
lockLabel.setToolTipText(Res.getString("message.spark.secure")); lockLabel.setToolTipText(Res.getString("message.spark.secure"));
} }
@ -121,7 +128,7 @@ public class SearchService extends JPanel {
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (newSearch) { if (newSearch) {
findField.setText(""); findField.setText("");
findField.getTextComponent().setForeground((Color)UIManager.get("TextField.foreground")); findField.getTextComponent().setForeground((Color) UIManager.get("TextField.foreground"));
newSearch = false; newSearch = false;
} }
} }
@ -167,7 +174,7 @@ public class SearchService extends JPanel {
newSearch = true; newSearch = true;
findField.requestFocus(); findField.requestFocus();
findField.getTextComponent().setForeground((Color)UIManager.get("TextField.lightforeground")); findField.getTextComponent().setForeground((Color) UIManager.get("TextField.lightforeground"));
findField.setIcon(searchable.getIcon()); findField.setIcon(searchable.getIcon());
findField.setText(searchable.getDefaultText()); findField.setText(searchable.getDefaultText());
findField.setToolTipText(searchable.getToolTip()); findField.setToolTipText(searchable.getToolTip());
@ -178,17 +185,17 @@ public class SearchService extends JPanel {
} }
public void focusLost(FocusEvent e) { public void focusLost(FocusEvent e) {
findField.getTextComponent().setForeground((Color)UIManager.get("TextField.lightforeground")); findField.getTextComponent().setForeground((Color) UIManager.get("TextField.lightforeground"));
findField.setText(searchable.getDefaultText()); findField.setText(searchable.getDefaultText());
} }
}); });
} }
public void paintComponent(Graphics g) { public void paintComponent(Graphics g) {
double scaleX = getWidth() / (double)backgroundImage.getWidth(null); double scaleX = getWidth() / (double) backgroundImage.getWidth(null);
double scaleY = getHeight() / (double)backgroundImage.getHeight(null); double scaleY = getHeight() / (double) backgroundImage.getHeight(null);
AffineTransform xform = AffineTransform.getScaleInstance(scaleX, scaleY); AffineTransform xform = AffineTransform.getScaleInstance(scaleX, scaleY);
((Graphics2D)g).drawImage(backgroundImage, xform, this); ((Graphics2D) g).drawImage(backgroundImage, xform, this);
} }
protected IconTextField getFindField() { protected IconTextField getFindField() {

View File

@ -46,35 +46,8 @@ public class GrowlMessageListener implements GlobalMessageListener {
public void messageReceived(final ChatRoom chatRoom, final Message message) { public void messageReceived(final ChatRoom chatRoom, final Message message) {
final ChatFrame chatFrame = SparkManager.getChatManager().getChatContainer().getChatFrame(); final ChatFrame chatFrame = SparkManager.getChatManager().getChatContainer().getChatFrame();
if (chatFrame.isVisible() && (chatFrame.getState() == Frame.ICONIFIED || !chatFrame.isInFocus())) { if (!chatFrame.isVisible() || !chatFrame.isInFocus()) {
startFlashing(message); startFlashing(message);
return;
}
if (!chatFrame.isVisible() && SparkManager.getMainWindow().isFocused()) {
}
else if (chatFrame.isVisible() && !chatFrame.isInFocus()) {
startFlashing(message);
}
else if (chatFrame.isVisible() && chatFrame.getState() == Frame.ICONIFIED) {
startFlashing(message);
}
// Handle when chat frame is visible but the Contact List is not.
else if (chatFrame.isVisible() && !SparkManager.getMainWindow().isVisible() && !chatFrame.isInFocus()) {
startFlashing(message);
}
else if (!chatFrame.isVisible()) {
// If the ContactList is in the tray, we need better notification by flashing
// the chatframe.
if (!SparkManager.getMainWindow().isVisible()) {
startFlashing(message);
}
else if (chatFrame.getState() == Frame.ICONIFIED) {
startFlashing(message);
}
} }
} }