mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
* Main lobby - Separated user talk from system messages by using two tabs in chat area to switch.
This commit is contained in:
parent
e678577720
commit
3a7983a0d0
15 changed files with 680 additions and 324 deletions
|
|
@ -83,7 +83,7 @@ import mage.cards.repository.CardCriteria;
|
|||
import mage.cards.repository.CardInfo;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.chat.ChatPanel;
|
||||
import mage.client.chat.ChatPanelBasic;
|
||||
import mage.client.components.MageComponents;
|
||||
import mage.client.components.MageDesktopManager;
|
||||
import mage.client.components.MageJDesktop;
|
||||
|
|
@ -165,7 +165,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
private static boolean grayMode = false;
|
||||
private static boolean fullscreenMode = false;
|
||||
|
||||
private static final Map<UUID, ChatPanel> chats = new HashMap<>();
|
||||
private static final Map<UUID, ChatPanelBasic> chats = new HashMap<>();
|
||||
private static final Map<UUID, GamePanel> games = new HashMap<>();
|
||||
private static final Map<UUID, DraftPanel> drafts = new HashMap<>();
|
||||
private static final MageUI ui = new MageUI();
|
||||
|
|
@ -373,7 +373,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
private void setWindowTitle() {
|
||||
setTitle(TITLE_NAME + " Client: "
|
||||
+ (version == null ? "<not available>" : version.toString()) + " Server: "
|
||||
+ ((session != null && session.isConnected()) ? session.getVersionInfo() : "<not connected>"));
|
||||
+ ((session != null && session.isConnected()) ? session.getVersionInfo() : "<not connected>"));
|
||||
}
|
||||
|
||||
private void addTooltipContainer() {
|
||||
|
|
@ -1250,11 +1250,11 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
return ui;
|
||||
}
|
||||
|
||||
public static ChatPanel getChat(UUID chatId) {
|
||||
public static ChatPanelBasic getChat(UUID chatId) {
|
||||
return chats.get(chatId);
|
||||
}
|
||||
|
||||
public static void addChat(UUID chatId, ChatPanel chatPanel) {
|
||||
public static void addChat(UUID chatId, ChatPanelBasic chatPanel) {
|
||||
chats.put(chatId, chatPanel);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="txtMessage" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPaneTxt" pref="193" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="jScrollPaneTxt" pref="175" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||
<Component id="txtMessage" min="-2" pref="30" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPaneTxt">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="null"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="mage.client.components.ColorPane" name="txtConversation">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
|
||||
<EmptyBorder/>
|
||||
</Border>
|
||||
</Property>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="Arial" size="14" style="0"/>
|
||||
</Property>
|
||||
<Property name="focusCycleRoot" type="boolean" value="false"/>
|
||||
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
|
||||
<Insets value="[2, 2, 2, 2]"/>
|
||||
</Property>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JTextField" name="txtMessage">
|
||||
<Events>
|
||||
<EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="txtMessageKeyTyped"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
|
@ -35,82 +35,65 @@ package mage.client.chat;
|
|||
|
||||
import java.awt.Color;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import javax.swing.table.JTableHeader;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
import mage.client.MageFrame;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_USERS_COLUMNS_ORDER;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_USERS_COLUMNS_WIDTH;
|
||||
import mage.client.util.MageTableRowSorter;
|
||||
import mage.client.util.gui.TableUtil;
|
||||
import mage.client.util.gui.countryBox.CountryCellRenderer;
|
||||
import mage.remote.MageRemoteException;
|
||||
import mage.remote.Session;
|
||||
import mage.view.ChatMessage.MessageColor;
|
||||
import mage.view.ChatMessage.MessageType;
|
||||
import mage.view.RoomUsersView;
|
||||
import mage.view.UsersView;
|
||||
import org.mage.card.arcane.ManaSymbols;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com, nantuko
|
||||
*/
|
||||
public class ChatPanel extends javax.swing.JPanel {
|
||||
public class ChatPanelBasic extends javax.swing.JPanel {
|
||||
|
||||
private UUID chatId;
|
||||
private Session session;
|
||||
private final List<String> players = new ArrayList<>();
|
||||
private final UserTableModel userTableModel;
|
||||
protected UUID chatId;
|
||||
protected Session session;
|
||||
/**
|
||||
* Chat message color for opponents.
|
||||
*/
|
||||
private static final String OPPONENT_COLOR = "#FF7F50";
|
||||
protected static final String OPPONENT_COLOR = "#FF7F50";
|
||||
/**
|
||||
* Chat message color for client player.
|
||||
*/
|
||||
private static final String MY_COLOR = "#7FFFD4";
|
||||
protected static final String MY_COLOR = "#7FFFD4";
|
||||
/**
|
||||
* Chat message color for timestamps.
|
||||
*/
|
||||
private static final String TIMESTAMP_COLOR = "#CCCC33";
|
||||
protected static final String TIMESTAMP_COLOR = "#CCCC33";
|
||||
/**
|
||||
* Chat message color for messages.
|
||||
*/
|
||||
private static final String MESSAGE_COLOR = "White";
|
||||
protected static final String MESSAGE_COLOR = "White";
|
||||
/**
|
||||
* Chat message color for personal infos.
|
||||
*/
|
||||
private static final String USER_INFO_COLOR = "Yellow";
|
||||
protected static final String USER_INFO_COLOR = "Yellow";
|
||||
/**
|
||||
* Chat message color for status infos.
|
||||
*/
|
||||
private static final String STATUS_COLOR = "#FFCC33";
|
||||
protected static final String STATUS_COLOR = "#FFCC33";
|
||||
/**
|
||||
* Alpha value for transparency (255 = not transparent)
|
||||
*/
|
||||
private static final int ALPHA = 80;
|
||||
public static final int CHAT_ALPHA = 80;
|
||||
/**
|
||||
* This will be a chat that will be connected to {this} and will handle
|
||||
* redirected messages; Mostly used to redirect user messages to another
|
||||
* window.
|
||||
*/
|
||||
private ChatPanel connectedChat;
|
||||
protected ChatPanelBasic connectedChat;
|
||||
/**
|
||||
* Parent chat this chat connected to. Used to send messages using parent
|
||||
* chat as it is the only one connected to server.
|
||||
*/
|
||||
private ChatPanel parentChatRef;
|
||||
protected ChatPanelBasic parentChatRef;
|
||||
/**
|
||||
* Selected extended view mode.
|
||||
*/
|
||||
private VIEW_MODE extendedViewMode = VIEW_MODE.NONE;
|
||||
protected VIEW_MODE extendedViewMode = VIEW_MODE.NONE;
|
||||
|
||||
public enum VIEW_MODE {
|
||||
|
||||
|
|
@ -120,57 +103,31 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
* Controls the output start messages as the chat panel is created
|
||||
*
|
||||
*/
|
||||
private ChatType chatType = ChatType.DEFAULT;
|
||||
|
||||
private static final int[] defaultColumnsWidth = {20, 100, 100, 80, 80};
|
||||
protected ChatType chatType = ChatType.DEFAULT;
|
||||
|
||||
public enum ChatType {
|
||||
|
||||
DEFAULT, GAME, TABLES, TOURNAMENT
|
||||
}
|
||||
private boolean startMessageDone = false;
|
||||
protected boolean startMessageDone = false;
|
||||
|
||||
/**
|
||||
* Creates new form ChatPanel
|
||||
*/
|
||||
public ChatPanel() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param addPlayersTab if true, adds chat/players tabs
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* Creates new form ChatPanel
|
||||
*
|
||||
* @param addPlayersTab
|
||||
*/
|
||||
public ChatPanel(boolean addPlayersTab) {
|
||||
userTableModel = new UserTableModel();
|
||||
public ChatPanelBasic() {
|
||||
initComponents();
|
||||
setBackground(new Color(0, 0, 0, ALPHA));
|
||||
jTablePlayers.setBackground(new Color(0, 0, 0, ALPHA));
|
||||
jTablePlayers.setForeground(Color.white);
|
||||
jTablePlayers.setRowSorter(new MageTableRowSorter(userTableModel));
|
||||
|
||||
TableUtil.setColumnWidthAndOrder(jTablePlayers, defaultColumnsWidth, KEY_USERS_COLUMNS_WIDTH, KEY_USERS_COLUMNS_ORDER);
|
||||
jTablePlayers.setDefaultRenderer(Icon.class, new CountryCellRenderer());
|
||||
setBackground(new Color(0, 0, 0, CHAT_ALPHA));
|
||||
|
||||
if (jScrollPaneTxt != null) {
|
||||
jScrollPaneTxt.setBackground(new Color(0, 0, 0, ALPHA));
|
||||
jScrollPaneTxt.getViewport().setBackground(new Color(0, 0, 0, ALPHA));
|
||||
}
|
||||
if (jScrollPanePlayers != null) {
|
||||
jScrollPanePlayers.setBackground(new Color(0, 0, 0, ALPHA));
|
||||
jScrollPanePlayers.getViewport().setBackground(new Color(0, 0, 0, ALPHA));
|
||||
}
|
||||
if (!addPlayersTab) {
|
||||
simplifyComponents();
|
||||
jScrollPaneTxt.setBackground(new Color(0, 0, 0, CHAT_ALPHA));
|
||||
jScrollPaneTxt.getViewport().setBackground(new Color(0, 0, 0, CHAT_ALPHA));
|
||||
}
|
||||
}
|
||||
|
||||
public void cleanUp() {
|
||||
TableUtil.saveColumnWidthAndOrderToPrefs(jTablePlayers, KEY_USERS_COLUMNS_WIDTH, KEY_USERS_COLUMNS_ORDER);
|
||||
|
||||
}
|
||||
|
||||
public ChatType getChatType() {
|
||||
|
|
@ -254,7 +211,7 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
this.txtConversation.append(text.toString());
|
||||
}
|
||||
|
||||
private String getColoredText(String color, String text) {
|
||||
protected String getColoredText(String color, String text) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("<font color='");
|
||||
sb.append(color);
|
||||
|
|
@ -268,23 +225,23 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
return txtConversation.getText();
|
||||
}
|
||||
|
||||
public ChatPanel getConnectedChat() {
|
||||
public ChatPanelBasic getConnectedChat() {
|
||||
return connectedChat;
|
||||
}
|
||||
|
||||
public void setConnectedChat(ChatPanel connectedChat) {
|
||||
public void setConnectedChat(ChatPanelBasic connectedChat) {
|
||||
this.connectedChat = connectedChat;
|
||||
}
|
||||
|
||||
public void setParentChat(ChatPanel parentChatRef) {
|
||||
public void setParentChat(ChatPanelBasic parentChatRef) {
|
||||
this.parentChatRef = parentChatRef;
|
||||
}
|
||||
|
||||
public ChatPanel getParentChatRef() {
|
||||
public ChatPanelBasic getParentChatRef() {
|
||||
return parentChatRef;
|
||||
}
|
||||
|
||||
public void setParentChatRef(ChatPanel parentChatRef) {
|
||||
public void setParentChatRef(ChatPanelBasic parentChatRef) {
|
||||
this.parentChatRef = parentChatRef;
|
||||
}
|
||||
|
||||
|
|
@ -303,104 +260,14 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
case GAME:
|
||||
case TABLES:
|
||||
case DEFAULT:
|
||||
alpha = ALPHA;
|
||||
alpha = CHAT_ALPHA;
|
||||
}
|
||||
this.txtConversation.setExtBackgroundColor(new Color(0, 0, 0, alpha)); // Alpha = 255 not transparent
|
||||
// this.txtConversation.setBackground(new Color(0, 0, 0, 0));
|
||||
// this.txtConversation.setForeground(new Color(255, 255, 255));
|
||||
this.txtConversation.setSelectionColor(Color.LIGHT_GRAY);
|
||||
this.jScrollPaneTxt.setOpaque(alpha == 255);
|
||||
this.jScrollPaneTxt.getViewport().setOpaque(!chatType.equals(ChatType.TABLES));
|
||||
}
|
||||
|
||||
public void setSplitDividerLocation(int location) {
|
||||
if (jSplitPane1 != null) {
|
||||
jSplitPane1.setDividerLocation(location);
|
||||
}
|
||||
}
|
||||
|
||||
public int getSplitDividerLocation() {
|
||||
if (jSplitPane1 == null) {
|
||||
return 0;
|
||||
}
|
||||
return this.jSplitPane1.getDividerLocation();
|
||||
}
|
||||
|
||||
class UserTableModel extends AbstractTableModel {
|
||||
|
||||
private final String[] columnNames = new String[]{"Loc", "Players", "Info", "Games", "Connection"};
|
||||
private UsersView[] players = new UsersView[0];
|
||||
|
||||
public void loadData(Collection<RoomUsersView> roomUserInfoList) throws MageRemoteException {
|
||||
RoomUsersView roomUserInfo = roomUserInfoList.iterator().next();
|
||||
this.players = roomUserInfo.getUsersView().toArray(new UsersView[0]);
|
||||
JTableHeader th = jTablePlayers.getTableHeader();
|
||||
TableColumnModel tcm = th.getColumnModel();
|
||||
|
||||
tcm.getColumn(jTablePlayers.convertColumnIndexToView(1)).setHeaderValue("Players (" + this.players.length + ")");
|
||||
tcm.getColumn(jTablePlayers.convertColumnIndexToView(3)).setHeaderValue(
|
||||
"Games " + roomUserInfo.getNumberActiveGames()
|
||||
+ (roomUserInfo.getNumberActiveGames() != roomUserInfo.getNumberGameThreads() ? " (T:" + roomUserInfo.getNumberGameThreads() : " (")
|
||||
+ " limit: " + roomUserInfo.getNumberMaxGames() + ")");
|
||||
th.repaint();
|
||||
this.fireTableDataChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return players.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return columnNames.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int arg0, int arg1) {
|
||||
switch (arg1) {
|
||||
case 0:
|
||||
return players[arg0].getFlagName();
|
||||
case 1:
|
||||
return players[arg0].getUserName();
|
||||
case 2:
|
||||
return players[arg0].getInfoState();
|
||||
case 3:
|
||||
return players[arg0].getInfoGames();
|
||||
case 4:
|
||||
return players[arg0].getInfoPing();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName(int columnIndex) {
|
||||
String colName = "";
|
||||
|
||||
if (columnIndex <= getColumnCount()) {
|
||||
colName = columnNames[columnIndex];
|
||||
}
|
||||
|
||||
return colName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getColumnClass(int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
return Icon.class;
|
||||
default:
|
||||
return String.class;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
this.txtConversation.setText("");
|
||||
}
|
||||
|
|
@ -414,18 +281,10 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jSplitPane1 = new javax.swing.JSplitPane();
|
||||
jScrollPaneTxt = new javax.swing.JScrollPane();
|
||||
txtConversation = new mage.client.components.ColorPane();
|
||||
jScrollPanePlayers = new javax.swing.JScrollPane();
|
||||
jTablePlayers = new javax.swing.JTable();
|
||||
txtMessage = new javax.swing.JTextField();
|
||||
|
||||
jSplitPane1.setBorder(null);
|
||||
jSplitPane1.setDividerSize(10);
|
||||
jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
||||
jSplitPane1.setResizeWeight(0.25);
|
||||
|
||||
jScrollPaneTxt.setBorder(null);
|
||||
|
||||
txtConversation.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
|
||||
|
|
@ -435,25 +294,6 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
txtConversation.setOpaque(false);
|
||||
jScrollPaneTxt.setViewportView(txtConversation);
|
||||
|
||||
jSplitPane1.setRightComponent(jScrollPaneTxt);
|
||||
|
||||
jScrollPanePlayers.setBorder(null);
|
||||
|
||||
jTablePlayers.setModel(this.userTableModel);
|
||||
jTablePlayers.setToolTipText("Connected players");
|
||||
jTablePlayers.setAutoscrolls(false);
|
||||
jTablePlayers.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
|
||||
jTablePlayers.setFocusable(false);
|
||||
jTablePlayers.setGridColor(new java.awt.Color(255, 255, 255));
|
||||
jTablePlayers.setOpaque(false);
|
||||
jTablePlayers.setRequestFocusEnabled(false);
|
||||
jTablePlayers.setRowSelectionAllowed(false);
|
||||
jTablePlayers.setUpdateSelectionOnSort(false);
|
||||
jTablePlayers.setVerifyInputWhenFocusTarget(false);
|
||||
jScrollPanePlayers.setViewportView(jTablePlayers);
|
||||
|
||||
jSplitPane1.setTopComponent(jScrollPanePlayers);
|
||||
|
||||
txtMessage.addKeyListener(new java.awt.event.KeyAdapter() {
|
||||
public void keyTyped(java.awt.event.KeyEvent evt) {
|
||||
txtMessageKeyTyped(evt);
|
||||
|
|
@ -464,36 +304,22 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtMessage, javax.swing.GroupLayout.DEFAULT_SIZE, 203, Short.MAX_VALUE)
|
||||
.addComponent(jSplitPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
|
||||
.addComponent(txtMessage)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addComponent(jScrollPaneTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE)
|
||||
.addGap(0, 0, 0))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 288, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPaneTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(txtMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addComponent(txtMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, 0))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void simplifyComponents() {
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(txtMessage, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE)
|
||||
.addComponent(jScrollPaneTxt, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 168, Short.MAX_VALUE));
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(jScrollPaneTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(txtMessage, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)));
|
||||
jTablePlayers = null;
|
||||
jScrollPanePlayers = null;
|
||||
}
|
||||
|
||||
private void txtMessageKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtMessageKeyTyped
|
||||
public void handleKeyTyped(java.awt.event.KeyEvent evt) {
|
||||
if (evt.getKeyChar() == KeyEvent.VK_ENTER) {
|
||||
if (parentChatRef != null) {
|
||||
parentChatRef.session.sendChatMessage(parentChatRef.chatId, this.txtMessage.getText());
|
||||
|
|
@ -503,20 +329,14 @@ public class ChatPanel extends javax.swing.JPanel {
|
|||
this.txtMessage.setText("");
|
||||
this.txtMessage.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
private void txtMessageKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtMessageKeyTyped
|
||||
handleKeyTyped(evt);
|
||||
}//GEN-LAST:event_txtMessageKeyTyped
|
||||
|
||||
public void setRoomUserInfo(List<Collection<RoomUsersView>> view) {
|
||||
try {
|
||||
userTableModel.loadData(view.get(0));
|
||||
} catch (Exception ex) {
|
||||
this.players.clear();
|
||||
}
|
||||
}
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JScrollPane jScrollPanePlayers;
|
||||
private javax.swing.JScrollPane jScrollPaneTxt;
|
||||
private javax.swing.JSplitPane jSplitPane1;
|
||||
private javax.swing.JTable jTablePlayers;
|
||||
private mage.client.components.ColorPane txtConversation;
|
||||
private javax.swing.JTextField txtMessage;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.client.chat;
|
||||
|
||||
import static mage.client.chat.ChatPanelBasic.TIMESTAMP_COLOR;
|
||||
import mage.client.components.ColorPane;
|
||||
import mage.view.ChatMessage;
|
||||
import org.mage.card.arcane.ManaSymbols;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class ChatPanelSeparated extends ChatPanelBasic {
|
||||
|
||||
private ColorPane systemMessagesPane = null;
|
||||
|
||||
/**
|
||||
* Display message in the chat. Use different colors for timestamp, username
|
||||
* and message.
|
||||
*
|
||||
* @param username message sender
|
||||
* @param message message itself
|
||||
* @param time timestamp
|
||||
* @param messageType
|
||||
* @param color Preferred color. Not used.
|
||||
*/
|
||||
@Override
|
||||
public void receiveMessage(String username, String message, String time, ChatMessage.MessageType messageType, ChatMessage.MessageColor color) {
|
||||
switch (messageType) {
|
||||
case TALK:
|
||||
case WHISPER:
|
||||
case USER_INFO:
|
||||
super.receiveMessage(username, message, time, messageType, color);
|
||||
return;
|
||||
}
|
||||
StringBuilder text = new StringBuilder();
|
||||
if (time != null) {
|
||||
text.append(getColoredText(TIMESTAMP_COLOR, time + ": "));
|
||||
}
|
||||
String userColor;
|
||||
String textColor;
|
||||
String userSeparator = " ";
|
||||
switch (messageType) {
|
||||
case STATUS: // a message to all chat user
|
||||
textColor = STATUS_COLOR;
|
||||
userColor = STATUS_COLOR;
|
||||
break;
|
||||
case USER_INFO: // a personal message
|
||||
textColor = USER_INFO_COLOR;
|
||||
userColor = USER_INFO_COLOR;
|
||||
break;
|
||||
default:
|
||||
if (parentChatRef != null) {
|
||||
userColor = parentChatRef.session.getUserName().equals(username) ? MY_COLOR : OPPONENT_COLOR;
|
||||
} else {
|
||||
userColor = session.getUserName().equals(username) ? MY_COLOR : OPPONENT_COLOR;
|
||||
}
|
||||
textColor = MESSAGE_COLOR;
|
||||
userSeparator = ": ";
|
||||
}
|
||||
if (color.equals(ChatMessage.MessageColor.ORANGE)) {
|
||||
textColor = "Orange";
|
||||
}
|
||||
if (color.equals(ChatMessage.MessageColor.YELLOW)) {
|
||||
textColor = "Yellow";
|
||||
}
|
||||
if (username != null && !username.isEmpty()) {
|
||||
text.append(getColoredText(userColor, username + userSeparator));
|
||||
}
|
||||
text.append(getColoredText(textColor, ManaSymbols.replaceSymbolsWithHTML(message, ManaSymbols.Type.PAY)));
|
||||
this.systemMessagesPane.append(text.toString());
|
||||
}
|
||||
|
||||
public ColorPane getSystemMessagesPane() {
|
||||
return systemMessagesPane;
|
||||
}
|
||||
|
||||
public void setSystemMessagesPane(ColorPane systemMessagesPane) {
|
||||
this.systemMessagesPane = systemMessagesPane;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -28,13 +28,13 @@
|
|||
<Component id="btnMoveDown" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnMoveUp" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="326" max="32767" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="btnStart" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="btnCancel" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jSplitPane1" alignment="0" pref="644" max="32767" attributes="0"/>
|
||||
<Component id="jSplitPane1" alignment="0" pref="500" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
|
|
@ -91,9 +91,10 @@
|
|||
</Component>
|
||||
<Container class="javax.swing.JSplitPane" name="jSplitPane1">
|
||||
<Properties>
|
||||
<Property name="dividerLocation" type="int" value="320"/>
|
||||
<Property name="dividerLocation" type="int" value="300"/>
|
||||
<Property name="dividerSize" type="int" value="3"/>
|
||||
<Property name="resizeWeight" type="double" value="1.0"/>
|
||||
<Property name="toolTipText" type="java.lang.String" value=""/>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
|
||||
|
|
@ -122,10 +123,7 @@
|
|||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="mage.client.chat.ChatPanel" name="chatPanel">
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new mage.client.chat.ChatPanel(false);"/>
|
||||
</AuxValues>
|
||||
<Component class="mage.client.chat.ChatPanelBasic" name="chatPanel">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="right"/>
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ import javax.swing.Icon;
|
|||
import javax.swing.SwingWorker;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.chat.ChatPanel;
|
||||
import mage.client.chat.ChatPanelBasic;
|
||||
import mage.client.components.MageComponents;
|
||||
import mage.client.components.tray.MageTray;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_TABLE_WAITING_COLUMNS_ORDER;
|
||||
|
|
@ -86,7 +86,7 @@ public class TableWaitingDialog extends MageDialog {
|
|||
this.setSize(prefWidth, prefHeight);
|
||||
}
|
||||
|
||||
chatPanel.useExtendedView(ChatPanel.VIEW_MODE.NONE);
|
||||
chatPanel.useExtendedView(ChatPanelBasic.VIEW_MODE.NONE);
|
||||
tableSeats.createDefaultColumnsFromModel();
|
||||
TableUtil.setColumnWidthAndOrder(tableSeats, defaultColumnsWidth, KEY_TABLE_WAITING_COLUMNS_WIDTH, KEY_TABLE_WAITING_COLUMNS_ORDER);
|
||||
tableSeats.setDefaultRenderer(Icon.class, new CountryCellRenderer());
|
||||
|
|
@ -183,7 +183,7 @@ public class TableWaitingDialog extends MageDialog {
|
|||
jSplitPane1 = new javax.swing.JSplitPane();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
tableSeats = new javax.swing.JTable();
|
||||
chatPanel = new mage.client.chat.ChatPanel(false);
|
||||
chatPanel = new mage.client.chat.ChatPanelBasic();
|
||||
|
||||
setResizable(true);
|
||||
setTitle("Waiting for players");
|
||||
|
|
@ -219,9 +219,10 @@ public class TableWaitingDialog extends MageDialog {
|
|||
}
|
||||
});
|
||||
|
||||
jSplitPane1.setDividerLocation(320);
|
||||
jSplitPane1.setDividerLocation(300);
|
||||
jSplitPane1.setDividerSize(3);
|
||||
jSplitPane1.setResizeWeight(1.0);
|
||||
jSplitPane1.setToolTipText("");
|
||||
|
||||
tableSeats.setModel(tableWaitModel);
|
||||
tableSeats.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
||||
|
|
@ -239,12 +240,12 @@ public class TableWaitingDialog extends MageDialog {
|
|||
.addComponent(btnMoveDown)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnMoveUp)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 326, Short.MAX_VALUE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(btnStart)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(btnCancel)
|
||||
.addContainerGap())
|
||||
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 644, Short.MAX_VALUE)
|
||||
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 500, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
|
|
@ -308,7 +309,7 @@ public class TableWaitingDialog extends MageDialog {
|
|||
private javax.swing.JButton btnMoveDown;
|
||||
private javax.swing.JButton btnMoveUp;
|
||||
private javax.swing.JButton btnStart;
|
||||
private mage.client.chat.ChatPanel chatPanel;
|
||||
private mage.client.chat.ChatPanelBasic chatPanel;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JSplitPane jSplitPane1;
|
||||
private javax.swing.JTable tableSeats;
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ import java.util.concurrent.Executors;
|
|||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.chat.ChatPanel;
|
||||
import mage.client.chat.ChatPanelBasic;
|
||||
import mage.client.components.MageTextArea;
|
||||
import mage.client.dialog.MageDialog;
|
||||
import mage.client.util.audio.AudioManager;
|
||||
|
|
@ -71,7 +71,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
private Session session;
|
||||
private FeedbackMode mode;
|
||||
private MageDialog connectedDialog;
|
||||
private ChatPanel connectedChatPanel;
|
||||
private ChatPanelBasic connectedChatPanel;
|
||||
private int lastMessageId;
|
||||
|
||||
private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
|
||||
|
|
@ -323,7 +323,7 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
|||
return this.mode;
|
||||
}
|
||||
|
||||
public void setConnectedChatPanel(ChatPanel chatPanel) {
|
||||
public void setConnectedChatPanel(ChatPanelBasic chatPanel) {
|
||||
this.connectedChatPanel = chatPanel;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ import mage.cards.action.ActionCallback;
|
|||
import mage.choices.Choice;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.cards.BigCard;
|
||||
import mage.client.chat.ChatPanel;
|
||||
import mage.client.chat.ChatPanelBasic;
|
||||
import mage.client.combat.CombatManager;
|
||||
import mage.client.components.HoverButton;
|
||||
import mage.client.components.MageComponents;
|
||||
|
|
@ -1204,12 +1204,12 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
btnSkipForward = new javax.swing.JButton();
|
||||
btnPreviousPlay = new javax.swing.JButton();
|
||||
pnlBattlefield = new javax.swing.JPanel();
|
||||
gameChatPanel = new mage.client.chat.ChatPanel();
|
||||
gameChatPanel.useExtendedView(ChatPanel.VIEW_MODE.GAME);
|
||||
userChatPanel = new mage.client.chat.ChatPanel();
|
||||
gameChatPanel = new mage.client.chat.ChatPanelBasic();
|
||||
gameChatPanel.useExtendedView(ChatPanelBasic.VIEW_MODE.GAME);
|
||||
userChatPanel = new mage.client.chat.ChatPanelBasic();
|
||||
userChatPanel.setParentChat(gameChatPanel);
|
||||
userChatPanel.useExtendedView(ChatPanel.VIEW_MODE.CHAT);
|
||||
userChatPanel.setChatType(ChatPanel.ChatType.GAME);
|
||||
userChatPanel.useExtendedView(ChatPanelBasic.VIEW_MODE.CHAT);
|
||||
userChatPanel.setChatType(ChatPanelBasic.ChatType.GAME);
|
||||
gameChatPanel.setConnectedChat(userChatPanel);
|
||||
gameChatPanel.disableInput();
|
||||
gameChatPanel.setMinimumSize(new java.awt.Dimension(100, 48));
|
||||
|
|
@ -2125,9 +2125,9 @@ public final class GamePanel extends javax.swing.JPanel {
|
|||
|
||||
private javax.swing.JButton btnStopWatching;
|
||||
|
||||
private mage.client.chat.ChatPanel gameChatPanel;
|
||||
private mage.client.chat.ChatPanelBasic gameChatPanel;
|
||||
private mage.client.game.FeedbackPanel feedbackPanel;
|
||||
private mage.client.chat.ChatPanel userChatPanel;
|
||||
private mage.client.chat.ChatPanelBasic userChatPanel;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
private javax.swing.JPanel jPanel3;
|
||||
private javax.swing.JSplitPane jSplitPane0;
|
||||
|
|
|
|||
|
|
@ -33,9 +33,7 @@ import javax.swing.JOptionPane;
|
|||
import javax.swing.SwingUtilities;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.chat.ChatPanel;
|
||||
import static mage.client.chat.ChatPanel.ChatType.TABLES;
|
||||
import static mage.client.chat.ChatPanel.ChatType.TOURNAMENT;
|
||||
import mage.client.chat.ChatPanelBasic;
|
||||
import mage.client.constants.Constants.DeckEditorMode;
|
||||
import mage.client.draft.DraftPanel;
|
||||
import mage.client.game.GamePanel;
|
||||
|
|
@ -116,9 +114,9 @@ public class CallbackClientImpl implements CallbackClient {
|
|||
break;
|
||||
case "chatMessage": {
|
||||
ChatMessage message = (ChatMessage) callback.getData();
|
||||
ChatPanel panel = MageFrame.getChat(callback.getObjectId());
|
||||
ChatPanelBasic panel = MageFrame.getChat(callback.getObjectId());
|
||||
if (panel != null) {
|
||||
// play the to the message connected sound
|
||||
// play the sound related to the message
|
||||
if (message.getSoundToPlay() != null) {
|
||||
switch (message.getSoundToPlay()) {
|
||||
case PlayerLeft:
|
||||
|
|
@ -383,9 +381,9 @@ public class CallbackClientImpl implements CallbackClient {
|
|||
});
|
||||
}
|
||||
|
||||
private void createChatStartMessage(ChatPanel chatPanel) {
|
||||
private void createChatStartMessage(ChatPanelBasic chatPanel) {
|
||||
chatPanel.setStartMessageDone(true);
|
||||
ChatPanel usedPanel = chatPanel;
|
||||
ChatPanelBasic usedPanel = chatPanel;
|
||||
if (chatPanel.getConnectedChat() != null) {
|
||||
usedPanel = chatPanel.getConnectedChat();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,99 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jSplitPane1" alignment="0" pref="350" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<Component id="jSplitPane1" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JSplitPane" name="jSplitPane1">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="null"/>
|
||||
</Property>
|
||||
<Property name="dividerSize" type="int" value="10"/>
|
||||
<Property name="orientation" type="int" value="0"/>
|
||||
<Property name="resizeWeight" type="double" value="0.25"/>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPanePlayers">
|
||||
<Properties>
|
||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
||||
<Border info="null"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
||||
</AuxValues>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="top"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JTable" name="jTablePlayers">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
|
||||
<Connection code="this.userTableModel" type="code"/>
|
||||
</Property>
|
||||
<Property name="toolTipText" type="java.lang.String" value="Connected players"/>
|
||||
<Property name="autoscrolls" type="boolean" value="false"/>
|
||||
<Property name="cursor" type="java.awt.Cursor" editor="org.netbeans.modules.form.editors2.CursorEditor">
|
||||
<Color id="Standardcursor"/>
|
||||
</Property>
|
||||
<Property name="focusable" type="boolean" value="false"/>
|
||||
<Property name="gridColor" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
||||
<Color blue="ff" green="ff" red="ff" type="rgb"/>
|
||||
</Property>
|
||||
<Property name="opaque" type="boolean" value="false"/>
|
||||
<Property name="requestFocusEnabled" type="boolean" value="false"/>
|
||||
<Property name="rowSelectionAllowed" type="boolean" value="false"/>
|
||||
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
|
||||
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>
|
||||
</Property>
|
||||
<Property name="updateSelectionOnSort" type="boolean" value="false"/>
|
||||
<Property name="verifyInputWhenFocusTarget" type="boolean" value="false"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Container class="javax.swing.JTabbedPane" name="jTabbedPaneText">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="right"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
|
@ -0,0 +1,278 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ChatPanel.java
|
||||
*
|
||||
* Created on 15-Dec-2009, 11:04:31 PM
|
||||
*/
|
||||
package mage.client.table;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import javax.swing.table.JTableHeader;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
import mage.client.chat.ChatPanelBasic;
|
||||
import static mage.client.chat.ChatPanelBasic.CHAT_ALPHA;
|
||||
import mage.client.chat.ChatPanelSeparated;
|
||||
import mage.client.components.ColorPane;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_USERS_COLUMNS_ORDER;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_USERS_COLUMNS_WIDTH;
|
||||
import mage.client.util.MageTableRowSorter;
|
||||
import mage.client.util.gui.TableUtil;
|
||||
import mage.client.util.gui.countryBox.CountryCellRenderer;
|
||||
import mage.remote.MageRemoteException;
|
||||
import mage.view.RoomUsersView;
|
||||
import mage.view.UsersView;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com, nantuko
|
||||
*/
|
||||
public class PlayersChatPanel extends javax.swing.JPanel {
|
||||
|
||||
private final List<String> players = new ArrayList<>();
|
||||
private final UserTableModel userTableModel;
|
||||
private final ChatPanelSeparated userChatPanel;
|
||||
private final ColorPane systemMessagesPane;
|
||||
private static final int[] defaultColumnsWidth = {20, 100, 100, 80, 80};
|
||||
|
||||
|
||||
/*
|
||||
* Creates new form ChatPanel
|
||||
*
|
||||
*/
|
||||
public PlayersChatPanel() {
|
||||
userTableModel = new UserTableModel(); // needs to be set before initComponents();
|
||||
|
||||
initComponents();
|
||||
setBackground(new Color(0, 0, 0, CHAT_ALPHA));
|
||||
|
||||
jTablePlayers.setBackground(new Color(0, 0, 0, CHAT_ALPHA));
|
||||
jTablePlayers.setForeground(Color.white);
|
||||
jTablePlayers.setRowSorter(new MageTableRowSorter(userTableModel));
|
||||
|
||||
TableUtil.setColumnWidthAndOrder(jTablePlayers, defaultColumnsWidth, KEY_USERS_COLUMNS_WIDTH, KEY_USERS_COLUMNS_ORDER);
|
||||
jTablePlayers.setDefaultRenderer(Icon.class, new CountryCellRenderer());
|
||||
|
||||
systemMessagesPane = new ColorPane();
|
||||
|
||||
userChatPanel = new ChatPanelSeparated();
|
||||
userChatPanel.setSystemMessagesPane(systemMessagesPane);
|
||||
|
||||
if (jTabbedPaneText != null) {
|
||||
jTabbedPaneText.setBackground(new Color(0, 0, 0, CHAT_ALPHA));
|
||||
if (userChatPanel != null) {
|
||||
userChatPanel.setBackground(new Color(0, 0, 0, CHAT_ALPHA));
|
||||
jTabbedPaneText.addTab("Talk", userChatPanel);
|
||||
}
|
||||
if (systemMessagesPane != null) {
|
||||
systemMessagesPane.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
|
||||
systemMessagesPane.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
|
||||
systemMessagesPane.setFocusCycleRoot(false);
|
||||
systemMessagesPane.setMargin(new java.awt.Insets(2, 2, 2, 2));
|
||||
systemMessagesPane.setOpaque(false);
|
||||
systemMessagesPane.setExtBackgroundColor(new Color(0, 0, 0, CHAT_ALPHA)); // Alpha = 255 not transparent
|
||||
systemMessagesPane.setSelectionColor(Color.LIGHT_GRAY);
|
||||
jTabbedPaneText.addTab("System", systemMessagesPane);
|
||||
|
||||
}
|
||||
}
|
||||
if (jScrollPanePlayers != null) {
|
||||
|
||||
jScrollPanePlayers.setBackground(new Color(0, 0, 0, CHAT_ALPHA));
|
||||
jScrollPanePlayers.getViewport().setBackground(new Color(0, 0, 0, CHAT_ALPHA));
|
||||
}
|
||||
}
|
||||
|
||||
public ChatPanelBasic getUserChatPanel() {
|
||||
return userChatPanel;
|
||||
}
|
||||
|
||||
public void cleanUp() {
|
||||
TableUtil.saveColumnWidthAndOrderToPrefs(jTablePlayers, KEY_USERS_COLUMNS_WIDTH, KEY_USERS_COLUMNS_ORDER);
|
||||
userChatPanel.cleanUp();
|
||||
}
|
||||
|
||||
public void setSplitDividerLocation(int location) {
|
||||
if (jSplitPane1 != null) {
|
||||
jSplitPane1.setDividerLocation(location);
|
||||
}
|
||||
}
|
||||
|
||||
public int getSplitDividerLocation() {
|
||||
if (jSplitPane1 == null) {
|
||||
return 0;
|
||||
}
|
||||
return this.jSplitPane1.getDividerLocation();
|
||||
}
|
||||
|
||||
class UserTableModel extends AbstractTableModel {
|
||||
|
||||
private final String[] columnNames = new String[]{"Loc", "Players", "Info", "Games", "Connection"};
|
||||
private UsersView[] players = new UsersView[0];
|
||||
|
||||
public void loadData(Collection<RoomUsersView> roomUserInfoList) throws MageRemoteException {
|
||||
RoomUsersView roomUserInfo = roomUserInfoList.iterator().next();
|
||||
this.players = roomUserInfo.getUsersView().toArray(new UsersView[0]);
|
||||
JTableHeader th = jTablePlayers.getTableHeader();
|
||||
TableColumnModel tcm = th.getColumnModel();
|
||||
|
||||
tcm.getColumn(jTablePlayers.convertColumnIndexToView(1)).setHeaderValue("Players (" + this.players.length + ")");
|
||||
tcm.getColumn(jTablePlayers.convertColumnIndexToView(3)).setHeaderValue(
|
||||
"Games " + roomUserInfo.getNumberActiveGames()
|
||||
+ (roomUserInfo.getNumberActiveGames() != roomUserInfo.getNumberGameThreads() ? " (T:" + roomUserInfo.getNumberGameThreads() : " (")
|
||||
+ " limit: " + roomUserInfo.getNumberMaxGames() + ")");
|
||||
th.repaint();
|
||||
this.fireTableDataChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return players.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return columnNames.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int arg0, int arg1) {
|
||||
switch (arg1) {
|
||||
case 0:
|
||||
return players[arg0].getFlagName();
|
||||
case 1:
|
||||
return players[arg0].getUserName();
|
||||
case 2:
|
||||
return players[arg0].getInfoState();
|
||||
case 3:
|
||||
return players[arg0].getInfoGames();
|
||||
case 4:
|
||||
return players[arg0].getInfoPing();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnName(int columnIndex) {
|
||||
String colName = "";
|
||||
|
||||
if (columnIndex <= getColumnCount()) {
|
||||
colName = columnNames[columnIndex];
|
||||
}
|
||||
|
||||
return colName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class getColumnClass(int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
return Icon.class;
|
||||
default:
|
||||
return String.class;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
jSplitPane1 = new javax.swing.JSplitPane();
|
||||
jScrollPanePlayers = new javax.swing.JScrollPane();
|
||||
jTablePlayers = new javax.swing.JTable();
|
||||
jTabbedPaneText = new javax.swing.JTabbedPane();
|
||||
|
||||
jSplitPane1.setBorder(null);
|
||||
jSplitPane1.setDividerSize(10);
|
||||
jSplitPane1.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
||||
jSplitPane1.setResizeWeight(0.25);
|
||||
|
||||
jScrollPanePlayers.setBorder(null);
|
||||
|
||||
jTablePlayers.setModel(this.userTableModel);
|
||||
jTablePlayers.setToolTipText("Connected players");
|
||||
jTablePlayers.setAutoscrolls(false);
|
||||
jTablePlayers.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
|
||||
jTablePlayers.setFocusable(false);
|
||||
jTablePlayers.setGridColor(new java.awt.Color(255, 255, 255));
|
||||
jTablePlayers.setOpaque(false);
|
||||
jTablePlayers.setRequestFocusEnabled(false);
|
||||
jTablePlayers.setRowSelectionAllowed(false);
|
||||
jTablePlayers.setUpdateSelectionOnSort(false);
|
||||
jTablePlayers.setVerifyInputWhenFocusTarget(false);
|
||||
jScrollPanePlayers.setViewportView(jTablePlayers);
|
||||
|
||||
jSplitPane1.setTopComponent(jScrollPanePlayers);
|
||||
jSplitPane1.setRightComponent(jTabbedPaneText);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 350, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||
.addComponent(jSplitPane1)
|
||||
.addGap(0, 0, 0))
|
||||
);
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
public void setRoomUserInfo(List<Collection<RoomUsersView>> view) {
|
||||
try {
|
||||
userTableModel.loadData(view.get(0));
|
||||
} catch (Exception ex) {
|
||||
this.players.clear();
|
||||
}
|
||||
}
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JScrollPane jScrollPanePlayers;
|
||||
private javax.swing.JSplitPane jSplitPane1;
|
||||
private javax.swing.JTabbedPane jTabbedPaneText;
|
||||
private javax.swing.JTable jTablePlayers;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
|
|
@ -503,7 +503,7 @@
|
|||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jButton1" min="-2" pref="65" max="-2" attributes="0"/>
|
||||
<Component id="jButtonNext" min="-2" pref="65" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
|
|
@ -516,7 +516,7 @@
|
|||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jButton1" alignment="3" min="-2" pref="17" max="-2" attributes="0"/>
|
||||
<Component id="jButtonNext" alignment="3" min="-2" pref="17" max="-2" attributes="0"/>
|
||||
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
|
|
@ -540,7 +540,7 @@
|
|||
<Property name="text" type="java.lang.String" value="You are playing Mage version 0.7.5. Welcome! -- Mage dev team --"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JButton" name="jButton1">
|
||||
<Component class="javax.swing.JButton" name="jButtonNext">
|
||||
<Properties>
|
||||
<Property name="text" type="java.lang.String" value="Next"/>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
|
|
@ -554,7 +554,7 @@
|
|||
</Property>
|
||||
</Properties>
|
||||
<Events>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
|
||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonNextActionPerformed"/>
|
||||
</Events>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
|
|
@ -570,21 +570,6 @@
|
|||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="mage.client.chat.ChatPanel" name="chatPanel">
|
||||
<Properties>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[100, 43]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new mage.client.chat.ChatPanel(true);"/>
|
||||
</AuxValues>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="right"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="jPanel3">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
|
|
@ -595,7 +580,7 @@
|
|||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jSplitPane2" alignment="0" pref="798" max="32767" attributes="0"/>
|
||||
<Component id="jSplitPane2" alignment="0" pref="810" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
|
|
@ -679,7 +664,14 @@
|
|||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="mage.client.table.PlayersChatPanel" name="chatPanelMain">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="right"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
</Form>
|
||||
|
|
@ -69,7 +69,7 @@ import javax.swing.SwingWorker;
|
|||
import javax.swing.table.AbstractTableModel;
|
||||
import mage.cards.decks.importer.DeckImporterUtil;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.chat.ChatPanel;
|
||||
import mage.client.chat.ChatPanelBasic;
|
||||
import mage.client.components.MageComponents;
|
||||
import mage.client.dialog.JoinTableDialog;
|
||||
import mage.client.dialog.NewTableDialog;
|
||||
|
|
@ -143,16 +143,16 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
|
||||
tableCompleted.setRowSorter(new MageTableRowSorter(matchesModel));
|
||||
|
||||
chatPanel.useExtendedView(ChatPanel.VIEW_MODE.NONE);
|
||||
chatPanel.setBorder(null);
|
||||
chatPanel.setChatType(ChatPanel.ChatType.TABLES);
|
||||
chatPanelMain.getUserChatPanel().useExtendedView(ChatPanelBasic.VIEW_MODE.NONE);
|
||||
chatPanelMain.getUserChatPanel().setBorder(null);
|
||||
chatPanelMain.getUserChatPanel().setChatType(ChatPanelBasic.ChatType.TABLES);
|
||||
|
||||
filterButtons = new JToggleButton[]{btnStateWaiting, btnStateActive, btnStateFinished,
|
||||
btnTypeMatch, btnTypeTourneyConstructed, btnTypeTourneyLimited,
|
||||
btnFormatBlock, btnFormatStandard, btnFormatModern, btnFormatLegacy, btnFormatVintage, btnFormatCommander, btnFormatTinyLeader, btnFormatLimited, btnFormatOther,
|
||||
btnSkillBeginner, btnSkillCasual, btnSkillSerious};
|
||||
|
||||
JComponent[] components = new JComponent[]{chatPanel, jSplitPane1, jScrollPane1, jScrollPane2, topPanel, jPanel3};
|
||||
JComponent[] components = new JComponent[]{chatPanelMain, jSplitPane1, jScrollPane1, jScrollPane2, topPanel, jPanel3};
|
||||
for (JComponent component : components) {
|
||||
component.setOpaque(false);
|
||||
}
|
||||
|
|
@ -274,7 +274,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
|
||||
public void cleanUp() {
|
||||
saveSettings();
|
||||
chatPanel.cleanUp();
|
||||
chatPanelMain.cleanUp();
|
||||
}
|
||||
|
||||
private void saveDividerLocations() {
|
||||
|
|
@ -284,7 +284,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
PreferencesDialog.saveValue(PreferencesDialog.KEY_MAGE_PANEL_LAST_SIZE, sb);
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_1, Integer.toString(this.jSplitPane1.getDividerLocation()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_2, Integer.toString(this.jSplitPane2.getDividerLocation()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_3, Integer.toString(chatPanel.getSplitDividerLocation()));
|
||||
PreferencesDialog.saveValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_3, Integer.toString(chatPanelMain.getSplitDividerLocation()));
|
||||
}
|
||||
|
||||
private void restoreSettings() {
|
||||
|
|
@ -333,8 +333,8 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
location = PreferencesDialog.getCachedValue(PreferencesDialog.KEY_TABLES_DIVIDER_LOCATION_3, null);
|
||||
if (location != null && chatPanel != null) {
|
||||
chatPanel.setSplitDividerLocation(Integer.parseInt(location));
|
||||
if (location != null && chatPanelMain != null) {
|
||||
chatPanelMain.setSplitDividerLocation(Integer.parseInt(location));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -376,7 +376,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
updateTablesTask.execute();
|
||||
}
|
||||
if (updatePlayersTask == null || updatePlayersTask.isDone()) {
|
||||
updatePlayersTask = new UpdatePlayersTask(session, roomId, this.chatPanel);
|
||||
updatePlayersTask = new UpdatePlayersTask(session, roomId, this.chatPanelMain);
|
||||
updatePlayersTask.execute();
|
||||
}
|
||||
if (this.btnStateFinished.isSelected()) {
|
||||
|
|
@ -426,7 +426,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
MageFrame.getDesktop().add(joinTableDialog, JLayeredPane.MODAL_LAYER);
|
||||
}
|
||||
if (chatRoomId != null) {
|
||||
this.chatPanel.connect(chatRoomId);
|
||||
this.chatPanelMain.getUserChatPanel().connect(chatRoomId);
|
||||
startTasks();
|
||||
this.setVisible(true);
|
||||
this.repaint();
|
||||
|
|
@ -461,7 +461,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
} else {
|
||||
this.jPanel2.setVisible(true);
|
||||
this.jLabel2.setText(serverMessages.get(0));
|
||||
this.jButton1.setVisible(serverMessages.size() > 1);
|
||||
this.jButtonNext.setVisible(serverMessages.size() > 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -473,7 +473,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
stopTasks();
|
||||
this.chatPanel.disconnect();
|
||||
this.chatPanelMain.getUserChatPanel().disconnect();
|
||||
|
||||
Component c = this.getParent();
|
||||
while (c != null && !(c instanceof TablesPane)) {
|
||||
|
|
@ -484,8 +484,8 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
}
|
||||
}
|
||||
|
||||
public ChatPanel getChatPanel() {
|
||||
return this.chatPanel;
|
||||
public ChatPanelBasic getChatPanel() {
|
||||
return chatPanelMain.getUserChatPanel();
|
||||
}
|
||||
|
||||
private void setTableFilter() {
|
||||
|
|
@ -628,15 +628,15 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
jPanel2 = new javax.swing.JPanel();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
jButton1 = new javax.swing.JButton();
|
||||
jButtonNext = new javax.swing.JButton();
|
||||
jSplitPane1 = new javax.swing.JSplitPane();
|
||||
chatPanel = new mage.client.chat.ChatPanel(true);
|
||||
jPanel3 = new javax.swing.JPanel();
|
||||
jSplitPane2 = new javax.swing.JSplitPane();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
tableTables = new javax.swing.JTable();
|
||||
jScrollPane2 = new javax.swing.JScrollPane();
|
||||
tableCompleted = new javax.swing.JTable();
|
||||
chatPanelMain = new mage.client.table.PlayersChatPanel();
|
||||
|
||||
topPanel.setBackground(java.awt.Color.white);
|
||||
topPanel.setOpaque(false);
|
||||
|
|
@ -1022,13 +1022,13 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
|
||||
jLabel2.setText("You are playing Mage version 0.7.5. Welcome! -- Mage dev team --");
|
||||
|
||||
jButton1.setText("Next");
|
||||
jButton1.setMaximumSize(new java.awt.Dimension(55, 25));
|
||||
jButton1.setMinimumSize(new java.awt.Dimension(55, 25));
|
||||
jButton1.setPreferredSize(new java.awt.Dimension(55, 25));
|
||||
jButton1.addActionListener(new java.awt.event.ActionListener() {
|
||||
jButtonNext.setText("Next");
|
||||
jButtonNext.setMaximumSize(new java.awt.Dimension(55, 25));
|
||||
jButtonNext.setMinimumSize(new java.awt.Dimension(55, 25));
|
||||
jButtonNext.setPreferredSize(new java.awt.Dimension(55, 25));
|
||||
jButtonNext.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jButton1ActionPerformed(evt);
|
||||
jButtonNextActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -1037,7 +1037,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
jPanel2Layout.setHorizontalGroup(
|
||||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jButtonNext, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jLabel1)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
|
|
@ -1048,7 +1048,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jButtonNext, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel2)
|
||||
.addComponent(jLabel1))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
|
|
@ -1058,9 +1058,6 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
jSplitPane1.setDividerSize(10);
|
||||
jSplitPane1.setResizeWeight(1.0);
|
||||
|
||||
chatPanel.setMinimumSize(new java.awt.Dimension(100, 43));
|
||||
jSplitPane1.setRightComponent(chatPanel);
|
||||
|
||||
jSplitPane2.setBorder(null);
|
||||
jSplitPane2.setDividerSize(10);
|
||||
jSplitPane2.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
|
||||
|
|
@ -1085,7 +1082,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
jPanel3.setLayout(jPanel3Layout);
|
||||
jPanel3Layout.setHorizontalGroup(
|
||||
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jSplitPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 798, Short.MAX_VALUE)
|
||||
.addComponent(jSplitPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 810, Short.MAX_VALUE)
|
||||
);
|
||||
jPanel3Layout.setVerticalGroup(
|
||||
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
|
|
@ -1093,6 +1090,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
);
|
||||
|
||||
jSplitPane1.setLeftComponent(jPanel3);
|
||||
jSplitPane1.setRightComponent(chatPanelMain);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
|
|
@ -1154,7 +1152,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
newTableDialog.showDialog(roomId);
|
||||
}//GEN-LAST:event_btnNewTableActionPerformed
|
||||
|
||||
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
|
||||
private void jButtonNextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNextActionPerformed
|
||||
synchronized (this) {
|
||||
if (messages != null && !messages.isEmpty()) {
|
||||
currentMessage++;
|
||||
|
|
@ -1164,7 +1162,7 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
this.jLabel2.setText(messages.get(currentMessage));
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_jButton1ActionPerformed
|
||||
}//GEN-LAST:event_jButtonNextActionPerformed
|
||||
|
||||
private void btnFilterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFilterActionPerformed
|
||||
setTableFilter();
|
||||
|
|
@ -1206,10 +1204,10 @@ public class TablesPanel extends javax.swing.JPanel {
|
|||
private javax.swing.JToggleButton btnTypeMatch;
|
||||
private javax.swing.JToggleButton btnTypeTourneyConstructed;
|
||||
private javax.swing.JToggleButton btnTypeTourneyLimited;
|
||||
private mage.client.chat.ChatPanel chatPanel;
|
||||
private mage.client.table.PlayersChatPanel chatPanelMain;
|
||||
private javax.swing.JToolBar filterBar1;
|
||||
private javax.swing.JToolBar filterBar2;
|
||||
private javax.swing.JButton jButton1;
|
||||
private javax.swing.JButton jButtonNext;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JPanel jPanel2;
|
||||
|
|
@ -1413,11 +1411,11 @@ class UpdatePlayersTask extends SwingWorker<Void, Collection<RoomUsersView>> {
|
|||
|
||||
private final Session session;
|
||||
private final UUID roomId;
|
||||
private final ChatPanel chat;
|
||||
private final PlayersChatPanel chat;
|
||||
|
||||
private static final Logger logger = Logger.getLogger(UpdatePlayersTask.class);
|
||||
|
||||
UpdatePlayersTask(Session session, UUID roomId, ChatPanel chat) {
|
||||
UpdatePlayersTask(Session session, UUID roomId, PlayersChatPanel chat) {
|
||||
this.session = session;
|
||||
this.roomId = roomId;
|
||||
this.chat = chat;
|
||||
|
|
|
|||
|
|
@ -349,10 +349,7 @@
|
|||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="mage.client.chat.ChatPanel" name="chatPanel1">
|
||||
<Properties>
|
||||
<Property name="startMessageDone" type="boolean" value="true"/>
|
||||
</Properties>
|
||||
<Component class="mage.client.chat.ChatPanelBasic" name="chatPanel1">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
|
||||
<JSplitPaneConstraints position="right"/>
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ import javax.swing.JOptionPane;
|
|||
import javax.swing.SwingWorker;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.chat.ChatPanel;
|
||||
import mage.client.chat.ChatPanelBasic;
|
||||
import mage.client.dialog.PreferencesDialog;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_TOURNAMENT_MATCH_COLUMNS_ORDER;
|
||||
import static mage.client.dialog.PreferencesDialog.KEY_TOURNAMENT_MATCH_COLUMNS_WIDTH;
|
||||
|
|
@ -105,8 +105,8 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
tableMatches.createDefaultColumnsFromModel();
|
||||
TableUtil.setColumnWidthAndOrder(tableMatches, defaultColumnsWidthMatches, KEY_TOURNAMENT_MATCH_COLUMNS_WIDTH, KEY_TOURNAMENT_MATCH_COLUMNS_ORDER);
|
||||
|
||||
chatPanel1.useExtendedView(ChatPanel.VIEW_MODE.NONE);
|
||||
chatPanel1.setChatType(ChatPanel.ChatType.TOURNAMENT);
|
||||
chatPanel1.useExtendedView(ChatPanelBasic.VIEW_MODE.NONE);
|
||||
chatPanel1.setChatType(ChatPanelBasic.ChatType.TOURNAMENT);
|
||||
|
||||
Action action = new AbstractAction() {
|
||||
@Override
|
||||
|
|
@ -317,7 +317,7 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
tablePlayers = new javax.swing.JTable();
|
||||
jScrollPane2 = new javax.swing.JScrollPane();
|
||||
tableMatches = new javax.swing.JTable();
|
||||
chatPanel1 = new mage.client.chat.ChatPanel();
|
||||
chatPanel1 = new mage.client.chat.ChatPanelBasic();
|
||||
|
||||
setPreferredSize(new java.awt.Dimension(908, 580));
|
||||
|
||||
|
|
@ -484,8 +484,6 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
jSplitPane1.setBottomComponent(jScrollPane2);
|
||||
|
||||
jSplitPane2.setLeftComponent(jSplitPane1);
|
||||
|
||||
chatPanel1.setStartMessageDone(true);
|
||||
jSplitPane2.setRightComponent(chatPanel1);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
|
|
@ -524,7 +522,7 @@ public class TournamentPanel extends javax.swing.JPanel {
|
|||
private javax.swing.JPanel actionPanel;
|
||||
private javax.swing.JButton btnCloseWindow;
|
||||
private javax.swing.JButton btnQuitTournament;
|
||||
private mage.client.chat.ChatPanel chatPanel1;
|
||||
private mage.client.chat.ChatPanelBasic chatPanel1;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JScrollPane jScrollPane2;
|
||||
private javax.swing.JSplitPane jSplitPane1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue