mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
first step on ChatWindow-Toolbar
git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@12276 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
committed by
wolf.posdorfer
parent
cac0921063
commit
ef6b225870
@ -325,6 +325,8 @@ public class SparkRes {
|
||||
public static final String TASK_DELETE_IMAGE = "TASK_DELETE_IMAGE";
|
||||
public static final String TRANSPORT_ICON = "TRANSPORT_ICON";
|
||||
public static final String COLOR_ICON = "COLOR_ICON";
|
||||
public static final String SETTINGS_IMAGE_16x16 = "SETTINGS_IMAGE_16x16";
|
||||
public static final String SETTINGS_IMAGE_24x24 = "SETTINGS_IMAGE_24x24";
|
||||
|
||||
static ClassLoader cl = SparkRes.class.getClassLoader();
|
||||
|
||||
|
||||
@ -329,6 +329,8 @@ DIVIDER_IMAGE = images/divider.png
|
||||
LIGHTING_BOLT_IMAGE = images/lightning16.png
|
||||
HEADSET_IMAGE = images/headset.png
|
||||
BUZZ_IMAGE = images/bell.png
|
||||
SETTINGS_IMAGE_16x16 = images/settings16x16.png
|
||||
SETTINGS_IMAGE_24x24 = images/settings24x24.png
|
||||
|
||||
#Phone
|
||||
DIAL_PHONE_IMAGE_24x24 = images/phone_call.png
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
*/
|
||||
package org.jivesoftware.spark.ui;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.FlowLayout;
|
||||
@ -94,7 +95,10 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
|
||||
private final ChatToolBar toolbar;
|
||||
private final JScrollPane textScroller;
|
||||
private final JPanel bottomPanel;
|
||||
private final JPanel editorBar;
|
||||
|
||||
private final JPanel editorWrapperBar;
|
||||
private final JPanel editorBarRight;
|
||||
private final JPanel editorBarLeft;
|
||||
private JPanel chatWindowPanel;
|
||||
|
||||
private int unreadMessageCount;
|
||||
@ -129,7 +133,12 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
|
||||
|
||||
messageListeners = new ArrayList<MessageListener>();
|
||||
transcript = new ArrayList<Message>();
|
||||
editorBar = new JPanel(new FlowLayout(FlowLayout.LEFT, 1, 1));
|
||||
|
||||
editorWrapperBar = new JPanel(new BorderLayout());
|
||||
editorBarLeft = new JPanel(new FlowLayout(FlowLayout.LEFT, 1, 1));
|
||||
editorBarRight = new JPanel(new FlowLayout(FlowLayout.RIGHT, 1, 1));
|
||||
editorWrapperBar.add(editorBarLeft, BorderLayout.WEST);
|
||||
editorWrapperBar.add(editorBarRight, BorderLayout.EAST);
|
||||
fileDropListeners = new ArrayList<FileDropListener>();
|
||||
|
||||
transcriptWindowMouseListener = new MouseAdapter() {
|
||||
@ -240,17 +249,17 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
|
||||
splitPane.setLeftComponent(chatPanel);
|
||||
|
||||
// Add edit buttons to Chat Room
|
||||
editorBar.setOpaque(false);
|
||||
editorBarLeft.setOpaque(false);
|
||||
chatPanel.setOpaque(false);
|
||||
|
||||
|
||||
editorBar.add(new JSeparator(JSeparator.VERTICAL));
|
||||
editorBarLeft.add(new JSeparator(JSeparator.VERTICAL));
|
||||
|
||||
bottomPanel.setOpaque(false);
|
||||
splitPane.setOpaque(false);
|
||||
bottomPanel.setLayout(new GridBagLayout());
|
||||
bottomPanel.add(chatAreaButton, new GridBagConstraints(0, 1, 5, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 15));
|
||||
bottomPanel.add(editorBar, new GridBagConstraints(0, 0, 5, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0));
|
||||
bottomPanel.add(editorWrapperBar, new GridBagConstraints(0, 0, 5, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0));
|
||||
|
||||
// Set bottom panel border
|
||||
bottomPanel.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(197, 213, 230)));
|
||||
@ -672,9 +681,9 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
|
||||
* Disables the ChatRoom toolbar.
|
||||
*/
|
||||
public void disableToolbar() {
|
||||
final int count = editorBar.getComponentCount();
|
||||
final int count = editorBarLeft.getComponentCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
final Object o = editorBar.getComponent(i);
|
||||
final Object o = editorBarLeft.getComponent(i);
|
||||
if (o instanceof RolloverButton) {
|
||||
final RolloverButton rb = (RolloverButton)o;
|
||||
rb.setEnabled(false);
|
||||
@ -686,9 +695,9 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
|
||||
* Enable the ChatRoom toolbar.
|
||||
*/
|
||||
public void enableToolbar() {
|
||||
final int count = editorBar.getComponentCount();
|
||||
final int count = editorBarLeft.getComponentCount();
|
||||
for (int i = 0; i < count; i++) {
|
||||
final Object o = editorBar.getComponent(i);
|
||||
final Object o = editorBarLeft.getComponent(i);
|
||||
if (o instanceof RolloverButton) {
|
||||
final RolloverButton rb = (RolloverButton)o;
|
||||
rb.setEnabled(true);
|
||||
@ -878,16 +887,6 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the button panel. The Button Panel contains all tool items
|
||||
* above the send field.
|
||||
*
|
||||
* @return the chat's button panel.
|
||||
*/
|
||||
public JPanel getSendFieldToolbar() {
|
||||
return editorBar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used for the top toolbar.
|
||||
*/
|
||||
@ -1026,7 +1025,17 @@ public abstract class ChatRoom extends BackgroundPanel implements ActionListener
|
||||
* @return the panel which contains the lower toolbar items.
|
||||
*/
|
||||
public JPanel getEditorBar() {
|
||||
return editorBar;
|
||||
return editorBarLeft;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the panel next to the editor bar<br>
|
||||
* for use with system buttons, like room controlling or toggle stay-on-top
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public JPanel getRoomControllerBar() {
|
||||
return editorBarRight;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -36,6 +36,7 @@ import java.util.regex.Pattern;
|
||||
import javax.swing.AbstractAction;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
@ -71,6 +72,7 @@ import org.jivesoftware.spark.plugin.ContextMenuListener;
|
||||
import org.jivesoftware.spark.ui.ChatContainer;
|
||||
import org.jivesoftware.spark.ui.ChatFrame;
|
||||
import org.jivesoftware.spark.ui.ChatRoom;
|
||||
import org.jivesoftware.spark.ui.ChatRoomListener;
|
||||
import org.jivesoftware.spark.ui.ChatRoomNotFoundException;
|
||||
import org.jivesoftware.spark.ui.GroupChatRoomTransferHandler;
|
||||
import org.jivesoftware.spark.ui.conferences.ConferenceUtils;
|
||||
@ -84,7 +86,7 @@ import org.jivesoftware.sparkimpl.settings.local.SettingsManager;
|
||||
/**
|
||||
* GroupChatRoom is the conference chat room UI used to have Multi-User Chats.
|
||||
*/
|
||||
public final class GroupChatRoom extends ChatRoom {
|
||||
public final class GroupChatRoom extends ChatRoom implements ChatRoomListener {
|
||||
private static final long serialVersionUID = 4469579438292227006L;
|
||||
|
||||
private MultiUserChat chat;
|
||||
@ -138,6 +140,7 @@ public final class GroupChatRoom extends ChatRoom {
|
||||
|
||||
// The Room Name is the same as the ChatRoom name
|
||||
roomname = chat.getRoom();
|
||||
ChatManager.getInstance().addChatRoomListener(this);
|
||||
|
||||
// We are just using a generic Group Chat.
|
||||
tabTitle = StringUtils.parseName(StringUtils.unescapeNode(roomname));
|
||||
@ -1332,4 +1335,37 @@ public final class GroupChatRoom extends ChatRoom {
|
||||
|
||||
return ChatManager.COLORS[index % ChatManager.COLORS.length];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void chatRoomOpened(ChatRoom room) {
|
||||
|
||||
if (room instanceof GroupChatRoom) {
|
||||
JPanel bar = room.getRoomControllerBar();
|
||||
JButton settings = new JButton(SparkRes.getImageIcon(SparkRes.SETTINGS_IMAGE_16x16));
|
||||
JButton thema = new JButton(SparkRes.getImageIcon(SparkRes.TYPING_TRAY));
|
||||
bar.add(thema);
|
||||
bar.add(settings);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void chatRoomLeft(ChatRoom room) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void chatRoomClosed(ChatRoom room) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void chatRoomActivated(ChatRoom room) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userHasJoined(ChatRoom room, String userid) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userHasLeft(ChatRoom room, String userid) {
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ public class InvitationPane {
|
||||
chatRoom.getBottomPanel().setVisible(true);
|
||||
|
||||
chatRoom.getScrollPaneForTranscriptWindow().setVisible(true);
|
||||
chatRoom.getSendFieldToolbar().setVisible(true);
|
||||
chatRoom.getEditorBar().setVisible(true);
|
||||
chatRoom.getChatInputEditor().setEnabled(true);
|
||||
chatRoom.getToolBar().setVisible(true);
|
||||
chatRoom.getVerticalSlipPane().setDividerLocation(0.8);
|
||||
@ -176,7 +176,7 @@ public class InvitationPane {
|
||||
chatRoom.getConferenceRoomInfo().setNicknameChangeAllowed(false);
|
||||
|
||||
chatRoom.getToolBar().setVisible(true);
|
||||
chatRoom.getSendFieldToolbar().setVisible(true);
|
||||
chatRoom.getEditorBar().setVisible(true);
|
||||
chatRoom.getChatInputEditor().setEnabled(true);
|
||||
|
||||
ChatContainer chatContainer = SparkManager.getChatManager().getChatContainer();
|
||||
|
||||
@ -398,7 +398,7 @@ public class UserInvitationPane {
|
||||
chatRoom.getBottomPanel().setVisible(true);
|
||||
|
||||
chatRoom.getScrollPaneForTranscriptWindow().setVisible(true);
|
||||
chatRoom.getSendFieldToolbar().setVisible(true);
|
||||
chatRoom.getEditorBar().setVisible(true);
|
||||
chatRoom.getChatInputEditor().setEnabled(true);
|
||||
chatRoom.getToolBar().setVisible(true);
|
||||
|
||||
@ -411,7 +411,7 @@ public class UserInvitationPane {
|
||||
chatRoom.getConferenceRoomInfo().setNicknameChangeAllowed(false);
|
||||
|
||||
chatRoom.getToolBar().setVisible(true);
|
||||
chatRoom.getSendFieldToolbar().setVisible(true);
|
||||
chatRoom.getEditorBar().setVisible(true);
|
||||
chatRoom.getChatInputEditor().setEnabled(true);
|
||||
|
||||
ChatContainer chatContainer = SparkManager.getChatManager().getChatContainer();
|
||||
|
||||
BIN
src/resources/images/settings16x16.png
Normal file
BIN
src/resources/images/settings16x16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 719 B |
BIN
src/resources/images/settings24x24.png
Normal file
BIN
src/resources/images/settings24x24.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
Reference in New Issue
Block a user