Tournament view some design changes and the remaining construction time and the round running time is shown.

This commit is contained in:
LevelX2 2014-05-01 19:28:33 +02:00
parent 57d1dc0f6d
commit 6d039e4262
3 changed files with 296 additions and 123 deletions

View file

@ -30,50 +30,55 @@
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<Component id="actionPanel" min="-2" max="-2" attributes="0"/> <Component id="actionPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jSplitPane2" pref="511" max="32767" attributes="0"/> <Component id="jSplitPane2" pref="454" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
</Layout> </Layout>
<SubComponents> <SubComponents>
<Container class="javax.swing.JPanel" name="actionPanel"> <Container class="javax.swing.JPanel" name="actionPanel">
<Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="e3" green="e3" id="Control Highlight" palette="2" red="e3" type="palette"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Arial" size="10" style="0"/>
</Property>
</Properties>
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0"> <Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="lblName" min="-2" max="-2" attributes="0"/> <Component id="lblName" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="lblState" min="-2" max="-2" attributes="0"/>
<Component id="txtName" pref="260" max="32767" attributes="0"/>
<Component id="txtTournamentState" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="lblType" min="-2" max="-2" attributes="0"/> <Component id="lblType" min="-2" max="-2" attributes="0"/>
</Group> <Component id="txtType" alignment="0" min="-2" pref="440" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="txtName" pref="175" max="32767" attributes="0"/>
<Component id="txtType" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="lblStartTime" min="-2" max="-2" attributes="0"/>
<Component id="lblTournamentState" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="txtTournamentState" max="32767" attributes="0"/>
<Component id="txtStartTime" pref="203" max="32767" attributes="0"/>
</Group>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0">
<Component id="txtEndTime" min="-2" pref="203" max="-2" attributes="0"/> <Component id="txtStartTime" min="-2" pref="220" max="-2" attributes="0"/>
<EmptySpace type="unrelated" pref="47" max="32767" attributes="0"/> <Component id="lblStartTime" min="-2" max="-2" attributes="0"/>
<Component id="btnQuitTournament" min="-2" pref="129" max="-2" attributes="0"/> </Group>
</Group> <EmptySpace max="-2" attributes="0"/>
<Group type="102" alignment="1" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="-2" pref="154" max="-2" attributes="0"/> <Component id="lblEndTime" min="-2" max="-2" attributes="0"/>
<Component id="btnCloseWindow" min="-2" pref="129" max="-2" attributes="0"/> <Component id="txtEndTime" max="32767" attributes="0"/>
</Group>
</Group> </Group>
</Group> </Group>
<EmptySpace pref="126" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="btnQuitTournament" max="32767" attributes="0"/>
<Component id="btnCloseWindow" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
@ -81,87 +86,128 @@
<DimensionLayout dim="1"> <DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="7" max="-2" attributes="0"/>
<Component id="lblName" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="lblType" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="txtType" min="-2" max="-2" attributes="0"/>
<Component id="btnQuitTournament" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="13" max="-2" attributes="0"/>
<Component id="btnCloseWindow" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Component id="txtName" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lblState" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblStartTime" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblEndTime" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="txtTournamentState" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="txtStartTime" alignment="3" max="32767" attributes="0"/>
<Component id="txtEndTime" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lblName" alignment="3" min="-2" pref="23" max="-2" attributes="0"/>
<Component id="txtName" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblStartTime" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtStartTime" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnQuitTournament" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtEndTime" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lblType" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtType" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="btnCloseWindow" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="lblTournamentState" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="txtTournamentState" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
</Layout> </Layout>
<SubComponents> <SubComponents>
<Component class="javax.swing.JLabel" name="lblName">
<Properties>
<Property name="horizontalAlignment" type="int" value="2"/>
<Property name="text" type="java.lang.String" value="Name:"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="txtName"> <Component class="javax.swing.JTextField" name="txtName">
<Properties> <Properties>
<Property name="editable" type="boolean" value="false"/> <Property name="editable" type="boolean" value="false"/>
<Property name="horizontalAlignment" type="int" value="2"/> <Property name="horizontalAlignment" type="int" value="2"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
<Property name="focusable" type="boolean" value="false"/> <Property name="focusable" type="boolean" value="false"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[50, 22]"/> <Dimension value="[50, 22]"/>
</Property> </Property>
<Property name="opaque" type="boolean" value="false"/>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties> </Properties>
</Component> <Events>
<Component class="javax.swing.JLabel" name="lblType"> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="txtNameActionPerformed"/>
<Properties> </Events>
<Property name="horizontalAlignment" type="int" value="2"/>
<Property name="text" type="java.lang.String" value="Type:"/>
</Properties>
</Component> </Component>
<Component class="javax.swing.JTextField" name="txtType"> <Component class="javax.swing.JTextField" name="txtType">
<Properties> <Properties>
<Property name="editable" type="boolean" value="false"/> <Property name="editable" type="boolean" value="false"/>
<Property name="horizontalAlignment" type="int" value="2"/> <Property name="horizontalAlignment" type="int" value="2"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
<Property name="focusable" type="boolean" value="false"/> <Property name="focusable" type="boolean" value="false"/>
</Properties> <Property name="opaque" type="boolean" value="false"/>
</Component> <Property name="requestFocusEnabled" type="boolean" value="false"/>
<Component class="javax.swing.JLabel" name="lblStartTime">
<Properties>
<Property name="text" type="java.lang.String" value="Start / end time:"/>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JTextField" name="txtStartTime"> <Component class="javax.swing.JTextField" name="txtStartTime">
<Properties> <Properties>
<Property name="editable" type="boolean" value="false"/> <Property name="editable" type="boolean" value="false"/>
<Property name="horizontalAlignment" type="int" value="0"/> <Property name="horizontalAlignment" type="int" value="0"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
<Property name="focusable" type="boolean" value="false"/> <Property name="focusable" type="boolean" value="false"/>
<Property name="opaque" type="boolean" value="false"/>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JTextField" name="txtEndTime"> <Component class="javax.swing.JTextField" name="txtEndTime">
<Properties> <Properties>
<Property name="editable" type="boolean" value="false"/> <Property name="editable" type="boolean" value="false"/>
<Property name="horizontalAlignment" type="int" value="0"/> <Property name="horizontalAlignment" type="int" value="0"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
<Property name="focusable" type="boolean" value="false"/> <Property name="focusable" type="boolean" value="false"/>
</Properties> <Property name="opaque" type="boolean" value="false"/>
</Component> <Property name="requestFocusEnabled" type="boolean" value="false"/>
<Component class="javax.swing.JLabel" name="lblTournamentState">
<Properties>
<Property name="text" type="java.lang.String" value="State:"/>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JTextField" name="txtTournamentState"> <Component class="javax.swing.JTextField" name="txtTournamentState">
<Properties> <Properties>
<Property name="editable" type="boolean" value="false"/> <Property name="editable" type="boolean" value="false"/>
<Property name="horizontalAlignment" type="int" value="0"/> <Property name="horizontalAlignment" type="int" value="0"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
<Property name="focusable" type="boolean" value="false"/> <Property name="focusable" type="boolean" value="false"/>
<Property name="opaque" type="boolean" value="false"/>
<Property name="requestFocusEnabled" type="boolean" value="false"/>
</Properties> </Properties>
<AuxValues> <AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value=""/> <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value=""/>
@ -185,10 +231,53 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCloseWindowActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnCloseWindowActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Component class="javax.swing.JLabel" name="lblName">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="10" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="Name:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lblType">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="10" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="Type:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lblState">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="10" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="State:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lblStartTime">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="10" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="Start time:"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lblEndTime">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="10" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="End time:"/>
</Properties>
</Component>
</SubComponents> </SubComponents>
</Container> </Container>
<Container class="javax.swing.JSplitPane" name="jSplitPane2"> <Container class="javax.swing.JSplitPane" name="jSplitPane2">
<Properties> <Properties>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="e3" green="e3" id="Control Highlight" palette="2" red="e3" type="palette"/>
</Property>
<Property name="resizeWeight" type="double" value="1.0"/> <Property name="resizeWeight" type="double" value="1.0"/>
<Property name="toolTipText" type="java.lang.String" value=""/> <Property name="toolTipText" type="java.lang.String" value=""/>
</Properties> </Properties>
@ -267,6 +356,9 @@
</SubComponents> </SubComponents>
</Container> </Container>
<Component class="mage.client.chat.ChatPanel" name="chatPanel1"> <Component class="mage.client.chat.ChatPanel" name="chatPanel1">
<Properties>
<Property name="startMessageDone" type="boolean" value="true"/>
</Properties>
<Constraints> <Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription"> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JSplitPaneSupportLayout$JSplitPaneConstraintsDescription">
<JSplitPaneConstraints position="right"/> <JSplitPaneConstraints position="right"/>

View file

@ -52,6 +52,7 @@ import mage.client.MageFrame;
import mage.client.chat.ChatPanel; import mage.client.chat.ChatPanel;
import mage.client.dialog.PreferencesDialog; import mage.client.dialog.PreferencesDialog;
import mage.client.util.ButtonColumn; import mage.client.util.ButtonColumn;
import mage.client.util.Format;
import mage.remote.Session; import mage.remote.Session;
import mage.view.RoundView; import mage.view.RoundView;
import mage.view.TournamentGameView; import mage.view.TournamentGameView;
@ -208,8 +209,19 @@ public class TournamentPanel extends javax.swing.JPanel {
firstInitDone = true; firstInitDone = true;
} }
switch (tournament.getTournamentState()) {
txtTournamentState.setText(tournament.getTournamentState()); case "Constructing":
String constructionTime = Format.getDuration(tournament.getConstructionTime() - (tournament.getServerTime().getTime() - tournament.getStepStartTime().getTime())/1000);
txtTournamentState.setText(new StringBuilder(tournament.getTournamentState()).append(" (").append(constructionTime).append(")").toString());
break;
case "Dueling":
String duelingTime = Format.getDuration((tournament.getServerTime().getTime() - tournament.getStepStartTime().getTime())/1000);
txtTournamentState.setText(new StringBuilder(tournament.getTournamentState()).append(" (").append(duelingTime).append(")").toString());
break;
default:
txtTournamentState.setText(tournament.getTournamentState());
break;
}
if (txtEndTime == null) { if (txtEndTime == null) {
return; return;
@ -263,17 +275,18 @@ public class TournamentPanel extends javax.swing.JPanel {
private void initComponents() { private void initComponents() {
actionPanel = new javax.swing.JPanel(); actionPanel = new javax.swing.JPanel();
lblName = new javax.swing.JLabel();
txtName = new javax.swing.JTextField(); txtName = new javax.swing.JTextField();
lblType = new javax.swing.JLabel();
txtType = new javax.swing.JTextField(); txtType = new javax.swing.JTextField();
lblStartTime = new javax.swing.JLabel();
txtStartTime = new javax.swing.JTextField(); txtStartTime = new javax.swing.JTextField();
txtEndTime = new javax.swing.JTextField(); txtEndTime = new javax.swing.JTextField();
lblTournamentState = new javax.swing.JLabel();
txtTournamentState = new javax.swing.JTextField(); txtTournamentState = new javax.swing.JTextField();
btnQuitTournament = new javax.swing.JButton(); btnQuitTournament = new javax.swing.JButton();
btnCloseWindow = new javax.swing.JButton(); btnCloseWindow = new javax.swing.JButton();
lblName = new javax.swing.JLabel();
lblType = new javax.swing.JLabel();
lblState = new javax.swing.JLabel();
lblStartTime = new javax.swing.JLabel();
lblEndTime = new javax.swing.JLabel();
jSplitPane2 = new javax.swing.JSplitPane(); jSplitPane2 = new javax.swing.JSplitPane();
jSplitPane1 = new javax.swing.JSplitPane(); jSplitPane1 = new javax.swing.JSplitPane();
jScrollPane1 = new javax.swing.JScrollPane(); jScrollPane1 = new javax.swing.JScrollPane();
@ -284,36 +297,49 @@ public class TournamentPanel extends javax.swing.JPanel {
setPreferredSize(new java.awt.Dimension(908, 580)); setPreferredSize(new java.awt.Dimension(908, 580));
lblName.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); actionPanel.setBackground(java.awt.SystemColor.controlHighlight);
lblName.setText("Name:"); actionPanel.setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N
txtName.setEditable(false); txtName.setEditable(false);
txtName.setHorizontalAlignment(javax.swing.JTextField.LEFT); txtName.setHorizontalAlignment(javax.swing.JTextField.LEFT);
txtName.setBorder(javax.swing.BorderFactory.createEtchedBorder());
txtName.setFocusable(false); txtName.setFocusable(false);
txtName.setMaximumSize(new java.awt.Dimension(50, 22)); txtName.setMaximumSize(new java.awt.Dimension(50, 22));
txtName.setOpaque(false);
lblType.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); txtName.setRequestFocusEnabled(false);
lblType.setText("Type:"); txtName.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtNameActionPerformed(evt);
}
});
txtType.setEditable(false); txtType.setEditable(false);
txtType.setHorizontalAlignment(javax.swing.JTextField.LEFT); txtType.setHorizontalAlignment(javax.swing.JTextField.LEFT);
txtType.setBorder(javax.swing.BorderFactory.createEtchedBorder());
txtType.setFocusable(false); txtType.setFocusable(false);
txtType.setOpaque(false);
lblStartTime.setText("Start / end time:"); txtType.setRequestFocusEnabled(false);
txtStartTime.setEditable(false); txtStartTime.setEditable(false);
txtStartTime.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtStartTime.setHorizontalAlignment(javax.swing.JTextField.CENTER);
txtStartTime.setBorder(javax.swing.BorderFactory.createEtchedBorder());
txtStartTime.setFocusable(false); txtStartTime.setFocusable(false);
txtStartTime.setOpaque(false);
txtStartTime.setRequestFocusEnabled(false);
txtEndTime.setEditable(false); txtEndTime.setEditable(false);
txtEndTime.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtEndTime.setHorizontalAlignment(javax.swing.JTextField.CENTER);
txtEndTime.setBorder(javax.swing.BorderFactory.createEtchedBorder());
txtEndTime.setFocusable(false); txtEndTime.setFocusable(false);
txtEndTime.setOpaque(false);
lblTournamentState.setText("State:"); txtEndTime.setRequestFocusEnabled(false);
txtTournamentState.setEditable(false); txtTournamentState.setEditable(false);
txtTournamentState.setHorizontalAlignment(javax.swing.JTextField.CENTER); txtTournamentState.setHorizontalAlignment(javax.swing.JTextField.CENTER);
txtTournamentState.setBorder(javax.swing.BorderFactory.createEtchedBorder());
txtTournamentState.setFocusable(false); txtTournamentState.setFocusable(false);
txtTournamentState.setOpaque(false);
txtTournamentState.setRequestFocusEnabled(false);
btnQuitTournament.setText("Quit Tournament"); btnQuitTournament.setText("Quit Tournament");
btnQuitTournament.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); btnQuitTournament.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
@ -331,59 +357,88 @@ public class TournamentPanel extends javax.swing.JPanel {
} }
}); });
lblName.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
lblName.setText("Name:");
lblType.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
lblType.setText("Type:");
lblState.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
lblState.setText("State:");
lblStartTime.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
lblStartTime.setText("Start time:");
lblEndTime.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
lblEndTime.setText("End time:");
javax.swing.GroupLayout actionPanelLayout = new javax.swing.GroupLayout(actionPanel); javax.swing.GroupLayout actionPanelLayout = new javax.swing.GroupLayout(actionPanel);
actionPanel.setLayout(actionPanelLayout); actionPanel.setLayout(actionPanelLayout);
actionPanelLayout.setHorizontalGroup( actionPanelLayout.setHorizontalGroup(
actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(actionPanelLayout.createSequentialGroup() .addGroup(actionPanelLayout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(lblName) .addComponent(lblName)
.addComponent(lblType)) .addComponent(lblState)
.addComponent(txtName, javax.swing.GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE)
.addComponent(txtTournamentState))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtName, javax.swing.GroupLayout.DEFAULT_SIZE, 175, Short.MAX_VALUE) .addComponent(lblType)
.addComponent(txtType)) .addComponent(txtType, javax.swing.GroupLayout.PREFERRED_SIZE, 440, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lblStartTime)
.addComponent(lblTournamentState))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(txtTournamentState)
.addComponent(txtStartTime, javax.swing.GroupLayout.DEFAULT_SIZE, 203, Short.MAX_VALUE))
.addGroup(actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(actionPanelLayout.createSequentialGroup() .addGroup(actionPanelLayout.createSequentialGroup()
.addGap(6, 6, 6) .addGroup(actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtEndTime, javax.swing.GroupLayout.PREFERRED_SIZE, 203, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtStartTime, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, 47, Short.MAX_VALUE) .addComponent(lblStartTime))
.addComponent(btnQuitTournament, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, actionPanelLayout.createSequentialGroup() .addGroup(actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(154, 154, 154) .addComponent(lblEndTime)
.addComponent(btnCloseWindow, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE))) .addComponent(txtEndTime))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 126, Short.MAX_VALUE)
.addGroup(actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(btnQuitTournament, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnCloseWindow, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap()) .addContainerGap())
); );
actionPanelLayout.setVerticalGroup( actionPanelLayout.setVerticalGroup(
actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(actionPanelLayout.createSequentialGroup() .addGroup(actionPanelLayout.createSequentialGroup()
.addContainerGap() .addGroup(actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(actionPanelLayout.createSequentialGroup()
.addComponent(lblName, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(7, 7, 7)
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblName))
.addComponent(lblStartTime) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, actionPanelLayout.createSequentialGroup()
.addComponent(txtStartTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()
.addComponent(btnQuitTournament) .addComponent(lblType)))
.addComponent(txtEndTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(actionPanelLayout.createSequentialGroup()
.addGroup(actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lblType) .addGroup(actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnCloseWindow) .addComponent(btnQuitTournament))
.addComponent(lblTournamentState) .addGap(13, 13, 13)
.addComponent(txtTournamentState, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(btnCloseWindow))
.addGap(0, 0, Short.MAX_VALUE)) .addGroup(actionPanelLayout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblState)
.addComponent(lblStartTime)
.addComponent(lblEndTime))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(actionPanelLayout.createSequentialGroup()
.addComponent(txtTournamentState, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(actionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtStartTime)
.addComponent(txtEndTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addContainerGap())
); );
jSplitPane2.setBackground(java.awt.SystemColor.controlHighlight);
jSplitPane2.setResizeWeight(1.0); jSplitPane2.setResizeWeight(1.0);
jSplitPane2.setToolTipText(""); jSplitPane2.setToolTipText("");
@ -407,6 +462,8 @@ public class TournamentPanel extends javax.swing.JPanel {
jSplitPane1.setBottomComponent(jScrollPane2); jSplitPane1.setBottomComponent(jScrollPane2);
jSplitPane2.setLeftComponent(jSplitPane1); jSplitPane2.setLeftComponent(jSplitPane1);
chatPanel1.setStartMessageDone(true);
jSplitPane2.setRightComponent(chatPanel1); jSplitPane2.setRightComponent(chatPanel1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
@ -421,7 +478,8 @@ public class TournamentPanel extends javax.swing.JPanel {
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addComponent(actionPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(actionPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSplitPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 511, Short.MAX_VALUE)) .addComponent(jSplitPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 454, Short.MAX_VALUE)
.addContainerGap())
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
@ -436,6 +494,10 @@ public class TournamentPanel extends javax.swing.JPanel {
}//GEN-LAST:event_btnQuitTournamentActionPerformed }//GEN-LAST:event_btnQuitTournamentActionPerformed
private void txtNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNameActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_txtNameActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel actionPanel; private javax.swing.JPanel actionPanel;
@ -446,9 +508,10 @@ public class TournamentPanel extends javax.swing.JPanel {
private javax.swing.JScrollPane jScrollPane2; private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JSplitPane jSplitPane1; private javax.swing.JSplitPane jSplitPane1;
private javax.swing.JSplitPane jSplitPane2; private javax.swing.JSplitPane jSplitPane2;
private javax.swing.JLabel lblEndTime;
private javax.swing.JLabel lblName; private javax.swing.JLabel lblName;
private javax.swing.JLabel lblStartTime; private javax.swing.JLabel lblStartTime;
private javax.swing.JLabel lblTournamentState; private javax.swing.JLabel lblState;
private javax.swing.JLabel lblType; private javax.swing.JLabel lblType;
private javax.swing.JTable tableMatches; private javax.swing.JTable tableMatches;
private javax.swing.JTable tablePlayers; private javax.swing.JTable tablePlayers;

View file

@ -50,7 +50,9 @@ public class TournamentView implements Serializable {
private final Date startTime; private final Date startTime;
private final Date endTime; private final Date endTime;
private final Date stepStartTime;
private final Date serverTime;
private final int constructionTime;
private final boolean watchingAllowed; private final boolean watchingAllowed;
private final List<RoundView> rounds = new ArrayList<>(); private final List<RoundView> rounds = new ArrayList<>();
@ -60,10 +62,14 @@ public class TournamentView implements Serializable {
public TournamentView(Tournament tournament) { public TournamentView(Tournament tournament) {
tournamentName = tournament.getOptions().getName(); tournamentName = tournament.getOptions().getName();
tournamentType = tournament.getOptions().getTournamentType();
tournamentType = new StringBuilder(tournament.getOptions().getTournamentType()).append(" ").append(tournament.getNumberRounds()).append(" rounds").toString();
startTime = tournament.getStartTime(); startTime = tournament.getStartTime();
endTime = tournament.getEndTime(); endTime = tournament.getEndTime();
stepStartTime = tournament.getStepStartTime();
constructionTime = tournament.getOptions().getLimitedOptions().getConstructionTime();
watchingAllowed = tournament.getOptions().isWatchingAllowed(); watchingAllowed = tournament.getOptions().isWatchingAllowed();
serverTime = new Date();
tournamentState = tournament.getTournamentState(); tournamentState = tournament.getTournamentState();
for (TournamentPlayer player: tournament.getPlayers()) { for (TournamentPlayer player: tournament.getPlayers()) {
@ -110,4 +116,16 @@ public class TournamentView implements Serializable {
return tournamentState; return tournamentState;
} }
public Date getStepStartTime() {
return stepStartTime;
}
public int getConstructionTime() {
return constructionTime;
}
public Date getServerTime() {
return serverTime;
}
} }