mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
Fix NPE in ChatRoom
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@4946 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
@ -118,6 +118,7 @@ public final class InputDialog implements PropertyChangeListener {
|
||||
});
|
||||
|
||||
textArea.requestFocus();
|
||||
textArea.setWrapStyleWord(true);
|
||||
|
||||
|
||||
dialog.setVisible(true);
|
||||
|
||||
@ -25,6 +25,7 @@ public class PublicPlugin {
|
||||
private boolean readMeAvailable;
|
||||
private boolean smallIconAvailable;
|
||||
private boolean largeIconAvailable;
|
||||
private String minVersion;
|
||||
|
||||
private File pluginDir;
|
||||
|
||||
@ -131,4 +132,12 @@ public class PublicPlugin {
|
||||
public void setLargeIconAvailable(boolean largeIconAvailable) {
|
||||
this.largeIconAvailable = largeIconAvailable;
|
||||
}
|
||||
|
||||
public String getMinVersion() {
|
||||
return minVersion;
|
||||
}
|
||||
|
||||
public void setMinVersion(String minVersion) {
|
||||
this.minVersion = minVersion;
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,6 +54,7 @@ import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Frame;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
@ -179,6 +180,19 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
KeyStroke appleStroke = KeyStroke.getKeyStroke(Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), 0);
|
||||
String appleString = org.jivesoftware.spark.util.StringUtils.keyStroke2String(appleStroke);
|
||||
|
||||
// Handle Apple Key W
|
||||
this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(appleString + "w"), "appleStroke");
|
||||
this.getActionMap().put("appleStroke", new AbstractAction("appleStroke") {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
closeActiveRoom();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1213,6 +1227,10 @@ public class ChatContainer extends SparkTabbedPane implements MessageListener, C
|
||||
for (ChatRoom chatRoom : getStaleChatRooms()) {
|
||||
// Turn tab gray
|
||||
int index = indexOfComponent(chatRoom);
|
||||
if (index == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
SparkTab tab = getTabAt(index);
|
||||
|
||||
final JLabel titleLabel = tab.getTitleLabel();
|
||||
|
||||
@ -25,25 +25,6 @@ import org.jivesoftware.spark.util.log.Log;
|
||||
import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
|
||||
import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.Icon;
|
||||
@ -64,6 +45,25 @@ import javax.swing.event.DocumentListener;
|
||||
import javax.swing.text.BadLocationException;
|
||||
import javax.swing.text.Document;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The base implementation of all ChatRoom conversations. You would implement this class to have most types of Chat.
|
||||
*/
|
||||
@ -353,9 +353,14 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
|
||||
int chatLength = transcriptWindow.getDocument().getLength();
|
||||
transcriptWindow.setCaretPosition(chatLength);
|
||||
|
||||
try {
|
||||
JScrollBar sb = textScroller.getVerticalScrollBar();
|
||||
sb.setValue(sb.getMaximum());
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user