📄 bsconfwindow.java
字号:
if (presenceStrs[0].equals(presence))
confBean.sendPresence(new BSPresenceInfo(null, true, BSPresenceInfo.SHOW_CHAT,
votingStr + presenceStrs[0]), roomJID);
else if (presenceStrs[1].equals(presence))
confBean.sendPresence(new BSPresenceInfo(null, true, BSPresenceInfo.SHOW_CHAT,
votingStr + presenceStrs[1]), roomJID);
else if (presenceStrs[2].equals(presence))
confBean.sendPresence(new BSPresenceInfo(null, true, null,
votingStr + presenceStrs[2]), roomJID);
else if (presenceStrs[3].equals(presence))
confBean.sendPresence(new BSPresenceInfo(null, true, null,
votingStr + presenceStrs[3]), roomJID);
else if (presenceStrs[4].equals(presence))
confBean.sendPresence(new BSPresenceInfo(null, true, null,
votingStr + presenceStrs[4]), roomJID);
else if (presenceStrs[5].equals(presence))
confBean.sendPresence(new BSPresenceInfo(null, true, BSPresenceInfo.SHOW_AWAY,
votingStr + presenceStrs[5]), roomJID);
else if (presenceStrs[6].equals(presence))
confBean.sendPresence(new BSPresenceInfo(null, true, BSPresenceInfo.SHOW_XA,
votingStr + presenceStrs[6]), roomJID);
else if (presenceStrs[7].equals(presence))
confBean.sendPresence(new BSPresenceInfo(null, true, BSPresenceInfo.SHOW_DND,
votingStr + presenceStrs[7]), roomJID);
}
/** <code>BSConfListener</code> function */
public void roomMessage(JID roomJID, String body) {
//if (!this.roomJID.toString().equalsIgnoreCase(roomJID.toString()))
// return;
if (!this.roomJID.getSimpleJID().equals(roomJID.getSimpleJID()))
return;
confTextPane.append(body + "\n", BSAutoScrollTextPane.PRESENCE_STYLE);
// stores msg to history
/*History.storeMessage(new JID(BSMainFrame.username, BSMainFrame.server, null),
roomJID, null, null, body);*/
if (alerts && presenceChanges) {
setNewMsg(true);
((BSConfWinManager)winMan).updateNewMessageFlags(this, true);
}
}
/** <code>BSConfListener</code> function */
public void groupMessage(JID fromAddress, String nick, String body) {
if (fromAddress == null) return;
//JID roomJID = new JID(fromAddress.getUsername(), fromAddress.getServer(), null);
JID roomJID = fromAddress.getSimpleJID();
//if (!this.roomJID.toString().equalsIgnoreCase(roomJID.toString()))
if (!this.roomJID.equals(roomJID))
return;
if (body.startsWith(SIGNATURE))
{
String parameters = body.substring(SIGNATURE.length());
// don't update the sender, there's no point!
if (myJID == null || !fromAddress.equals(myJID))
{
pluginSimView.update(parameters);
}
return;
}
// sets the chat thread
//if (fromAddress.toString().equalsIgnoreCase(myJID.toString()))
if (myJID != null && fromAddress.equals(myJID))
confTextPane.append("<" + nick + ">", BSAutoScrollTextPane.MY_NICK_STYLE);
else
confTextPane.append("<" + nick + ">", BSAutoScrollTextPane.BUDDY_NICK_STYLE);
confTextPane.append(" " + body + "\n", BSAutoScrollTextPane.REGULAR_STYLE);
// stores msg to history
History.storeMessage(new JID(BSMainFrame.username, BSMainFrame.server, null),
roomJID, nick, null, body);
//if (alerts && !fromAddress.toString().equalsIgnoreCase(myJID.toString())) {
if (myJID == null || (alerts && !fromAddress.equals(myJID))) {
setNewMsg(true);
((BSConfWinManager)winMan).updateNewMessageFlags(this, true);
}
}
/** <code>BSConfListener</code> function */
/*public void groupMessage(Message msg, String nick) {
if (fromAddress == null) return;
JID roomJID = new JID(fromAddress.getUsername(), fromAddress.getServer(), null);
if (!this.roomJID.toString().equalsIgnoreCase(roomJID.toString()))
return;
String body = msg.getBody();
String timeStamp = null;
String oobURL = null;
String oobDesc = null;
Enumeration extensions = msg.Extensions();
while (extensions.hasMoreElements()) {
Object o = extensions.nextElement();
if (o instanceof XDelay)
timeStamp = History.getTimeStamp((XDelay)o);
else if (o instanceof OOB) {
oobURL = ((OOB)o).getURL();
oobDesc = ((OOB)o).getDescription();
}
}
// sets the chat thread
if (fromAddress.toString().equalsIgnoreCase(myJID.toString()))
confTextPane.append("<" + nick + ">", BSAutoScrollTextPane.MY_NICK_STYLE);
else
confTextPane.append("<" + nick + ">", BSAutoScrollTextPane.BUDDY_NICK_STYLE);
if (timeStamp != null)
confTextPane.append(" [" + timeStamp + "]", BSAutoScrollTextPane.TIME_STAMP_STYLE);
if (body != null)
confTextPane.append(" " + body + "\n", BSAutoScrollTextPane.REGULAR_STYLE);
if (oobDesc != null)
confTextPane.append(" (" + oobDesc + " ", BSAutoScrollTextPane.URL_DESC_STYLE);
if (oobURL != null)
confTextPane.append(oobURL, BSAutoScrollTextPane.URL_STYLE);
confTextPane.append("\n", BSAutoScrollTextPane.REGULAR_STYLE);
// stores msg to history
History.storeMessage(new JID(BSMainFrame.username, BSMainFrame.server, null),
roomJID, nick, null, body);
if (alerts && !fromAddress.toString().equalsIgnoreCase(myJID.toString())) {
setNewMsg(true);
((BSConfWinManager)winMan).updateNewMessageFlags(this, true);
}
}*/
/** <code>BSConfListener</code> function */
public void privateMessage(JID fromAddress, String nick, String body) {
/*JID roomJID = new JID(fromAddress.getUsername(), fromAddress.getServer(), null);
if (this.roomJID.equalsIgnoreCase(roomJID))
confTextArea.append("[private] <" + nick + "> " + body + "\n");*/
((BSConfWinManager)winMan).openChatWindow(fromAddress, false, true);
}
/** <code>BSConfListener</code> function */
public void presenceChanged(JID fromAddress, String nick, BSPresenceInfo pi) {
if (fromAddress == null || pi == null) return;
if (!presenceChanges) return;
//JID roomJID = new JID(fromAddress.getUsername(), fromAddress.getServer(), null);
JID roomJID = fromAddress.getSimpleJID();
//if (!this.roomJID.toString().equalsIgnoreCase(roomJID.toString()))
if (!this.roomJID.equals(roomJID))
return;
String friendlyShow = pi.getFriendlyShow();
if (friendlyShow == null) friendlyShow = "";
String status = pi.getStatus();
if (status == null) status = "";
confTextPane.append(nick + " is now " + friendlyShow
+ " (" + status + ")\n",
BSAutoScrollTextPane.PRESENCE_STYLE);
//if (alerts && !fromAddress.toString().equalsIgnoreCase(myJID.toString())) {
if (myJID == null || (alerts && !fromAddress.equals(myJID))) {
setNewMsg(true);
((BSConfWinManager)winMan).updateNewMessageFlags(this, true);
}
}
/** <code>BSConfListener</code> function */
public void stateChanged(JID roomJID, int state) {
//if (this.roomJID.toString().equalsIgnoreCase(roomJID.toString()))
if (this.roomJID.equals(roomJID))
confTextPane.append(Integer.toString(state), BSAutoScrollTextPane.PRESENCE_STYLE);
}
/** <code>KeyListener</code> function - empty implementation */
public void keyReleased(java.awt.event.KeyEvent evt) { }
/** <code>KeyListener</code> function - empty implementation */
public void keyPressed(java.awt.event.KeyEvent evt) { }
/** <code>KeyListener</code> function - send message on ENTER */
public void keyTyped(java.awt.event.KeyEvent evt) {
if (newMsg) {
setNewMsg(false);
((BSConfWinManager)winMan).updateNewMessageFlags(this, false);
}
if (enterSends) {
if (evt.getKeyChar() == '\n') {
String msg = writeTextArea.getText();
if (msg.charAt(writeTextArea.getCaretPosition()-1) == '\n')
msg = msg.substring(0, writeTextArea.getCaretPosition()-1)
+ msg.substring(writeTextArea.getCaretPosition());
confBean.sendMessage(roomJID, msg);
writeTextArea.setText("");
}
}
}
/** <code>BSConfListener</code> function - empty implementation */
public void invitation(JID fromAddress, JID roomJID, String subject, String body) {
}
/** <code>BSConfListener</code> function */
public void error(JID roomJID, String errCode, String errMsg) {
}
/** <code>BSConfListener</code> function - called from winMan */
public void errorWM(JID roomJID, String errCode, String errMsg) {
JOptionPane.showMessageDialog(docked? ((BSConfWinManager)winMan).mainFrame : frame,
"Error " + errCode + ": " + errMsg + "!",
"Error",
JOptionPane.ERROR_MESSAGE);
}
/** <code>ChangeListener</code> function - events from JSlider*/
/*public void stateChanged(ChangeEvent evt) {
// if attention slider
if (evt.getSource() == attentionSlider) {
// if not just adjusting
if (!attentionSlider.getValueIsAdjusting()) {
if (!dontSendAttention)
sendPresence();
}
}
}*/
/** Removes itself from listening */
public void cancelListening() {
((BSConfWinManager)winMan).updateNewMessageFlags(this, false);
for (int i=0; i<countdowns.size(); i++)
((BSCountdown)countdowns.elementAt(i)).stop();
confBean.leaveRoom(roomJID);
if (confBean != null)
confBean.removeConfListener(this);
if (videoBean != null)
videoBean.removeVideoConferenceListener(this);
}
/** Called when myJID is set */
public void setMyJID(JID roomJID, JID myJID) {
//if (!this.roomJID.toString().equalsIgnoreCase(roomJID.toString())) return;
if (!this.roomJID.equals(roomJID)) return;
this.myJID = myJID;
}
public static final String SIGNATURE = "SIMLINKID529287584";
public void parameterChanged(SimLinkPlugin plugin)
{
String parameters = plugin.getPackedParameters();
pluginSimView.postPluginParameters(parameters);
confBean.sendMessage(roomJID, SIGNATURE + parameters);
}
public void booking(String url, String info)
{
if (url == null) return;
videoBean.open(url);
String msg = "[New FlashMeeting created]\n" + url +
"\nClick on the FlashMeeting button to join the meeting or enter URL in browser.";
videoBean.notifyAvailability(roomJID, msg, getBookingID());
//confBean.sendURLMessage(roomJID, "", url, "Join FlashMeeting");
}
public void launch(String url, String info)
{
if (url == null)
{
videoBean.requestBooking(this);
return;
}
videoBean.open(url);
confBean.sendMessage(roomJID, "[Joined FlashMeeting]\n" + url);
}
public void availability(String url, String info)
{
if (url != null)
{
Icon videoIcon = new ImageIcon(ClassLoader.getSystemResource("images/flashmeeting-active.gif"));
videoButton.setIcon(videoIcon);
}
}
public void authorization(Boolean canCreateBooking)
{
if (Boolean.TRUE.equals(canCreateBooking))
{
Icon videoIcon = new ImageIcon(ClassLoader.getSystemResource(
"images/flashmeeting-normal.gif"));
videoButton.setIcon(videoIcon);
}
videoBean.requestAvailability(this);
}
public String getBookingID()
{
return roomJID.toSimpleString().toLowerCase();
}
public String [] getBookingPeople()
{
return rosterTree.getUsers();
}
public String getBookingJID()
{
String jid = BSMainFrame.username + "@" + BSMainFrame.server;
return jid.toLowerCase();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -