[Client]Move some unused files into "unusedFiles" directory.those files should probably be removed

This commit is contained in:
Nicolas 2013-11-28 13:28:49 +01:00
parent 9a68a2cea3
commit 6ad969f735
8 changed files with 13 additions and 12 deletions

View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JInternalFrameFormInfo">
<Properties>
<Property name="resizable" type="boolean" value="true"/>
<Property name="title" type="java.lang.String" value="Combat"/>
<Property name="normalBounds" type="java.awt.Rectangle" editor="org.netbeans.beaninfo.editors.RectangleEditor">
<Rectangle value="[400, 200, 410, 307]"/>
</Property>
<Property name="visible" type="boolean" value="true"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
<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"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,2,11,0,0,0,-33"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="combatArea">
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>

View file

@ -0,0 +1,151 @@
/*
* 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.
*/
/*
* CombatDialog.java
*
* Created on Feb 10, 2010, 3:35:02 PM
*/
//package mage.client.dialog;
package mage.client.unusedFiles;
import mage.client.cards.BigCard;
import mage.client.unusedFiles.CombatGroup;
import mage.view.CombatGroupView;
import javax.swing.*;
import java.awt.*;
import java.beans.PropertyVetoException;
import java.util.List;
import java.util.UUID;
import java.util.logging.Level;
import java.util.logging.Logger;
import mage.client.dialog.MageDialog;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class CombatDialog extends MageDialog {
private UUID gameId;
private BigCard bigCard;
private int lastX = 500;
private int lastY = 300;
/** Creates new form CombatDialog */
public CombatDialog() {
JPanel contentPane = new JPanel() {
private static final long serialVersionUID = -8283955788355547309L;
public void paintComponent(Graphics g) {
g.setColor(new Color(50, 50, 50, 100));
g.fillRect(0, 0, getWidth(), getHeight());
}
};
setContentPane(contentPane);
initComponents();
this.setModal(false);
combatArea.setOpaque(false);
jScrollPane1.setOpaque(false);
jScrollPane1.getViewport().setOpaque(false);
getRootPane().setOpaque(false);
//setDefaultCloseOperation(JInternalFrame.HIDE_ON_CLOSE);
}
public void init(UUID gameId, BigCard bigCard) {
this.gameId = gameId;
this.bigCard = bigCard;
}
public void showDialog(List<CombatGroupView> combat) {
combatArea.removeAll();
for (CombatGroupView group: combat) {
CombatGroup combatGroup = new CombatGroup();
combatGroup.init(gameId, bigCard);
combatGroup.update(group);
combatGroup.setVisible(true);
combatArea.add(combatGroup);
combatGroup.revalidate();
}
try {
this.setSelected(true);
} catch (PropertyVetoException ex) {
Logger.getLogger(CombatDialog.class.getName()).log(Level.SEVERE, null, ex);
}
pack();
this.revalidate();
this.repaint();
if (!this.isVisible()) {
this.setVisible(true);
this.setLocation(lastX, lastY);
}
}
@Override
public void hideDialog() {
this.lastX = this.getX();
this.lastY = this.getY();
super.hideDialog();
}
/** 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() {
jScrollPane1 = new javax.swing.JScrollPane();
combatArea = new javax.swing.JPanel();
setResizable(true);
setTitle("Combat");
setNormalBounds(new java.awt.Rectangle(400, 200, 410, 307));
setVisible(true);
getContentPane().setLayout(new java.awt.BorderLayout());
jScrollPane1.setViewportView(combatArea);
getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
pack();
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel combatArea;
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration//GEN-END:variables
}

View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.3" 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="lblDefender" alignment="0" pref="69" max="32767" attributes="0"/>
<Component id="blockers" alignment="0" min="-2" max="-2" attributes="2"/>
<Component id="attackers" alignment="0" min="-2" max="-2" attributes="2"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="lblDefender" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="blockers" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="attackers" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="mage.client.cards.Cards" name="blockers">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new java.awt.Dimension(Config.dimensions.frameWidth + 8, Config.dimensions.frameHeight + 25)" type="code"/>
</Property>
</Properties>
</Component>
<Component class="mage.client.cards.Cards" name="attackers">
<Properties>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new java.awt.Dimension(Config.dimensions.frameWidth + 8, Config.dimensions.frameHeight + 25)" type="code"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lblDefender">
<Properties>
<Property name="horizontalAlignment" type="int" value="0"/>
<Property name="text" type="java.lang.String" value="Defender"/>
</Properties>
</Component>
</SubComponents>
</Form>

View file

@ -0,0 +1,122 @@
/*
* 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.
*/
/*
* CombatGroup.java
*
* Created on Feb 10, 2010, 3:36:55 PM
*/
package mage.client.unusedFiles;
//package mage.client.game;
import mage.client.cards.BigCard;
import mage.client.util.Config;
import mage.view.CombatGroupView;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class CombatGroup extends javax.swing.JPanel {
private UUID gameId;
private BigCard bigCard;
/** Creates new form CombatGroup */
public CombatGroup() {
initComponents();
attackers.setDontDisplayTapped(true);
}
public void init(UUID gameId, BigCard bigCard) {
this.gameId = gameId;
this.bigCard = bigCard;
}
public void update(CombatGroupView combatGroup) {
this.lblDefender.setText(combatGroup.getDefenderName());
this.attackers.loadCards(combatGroup.getAttackers(), bigCard, gameId, null);
// attackers.setPreferredSize(new Dimension(Config.dimensions.frameWidth + 6, Config.dimensions.frameHeight + 6));
this.blockers.loadCards(combatGroup.getBlockers(), bigCard, gameId, null);
// blockers.setPreferredSize(new Dimension(Config.dimensions.frameWidth + 6, Config.dimensions.frameHeight + 6));
this.attackers.setVisible(true);
this.blockers.setVisible(true);
}
/** 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() {
blockers = new mage.client.cards.Cards();
attackers = new mage.client.cards.Cards();
lblDefender = new javax.swing.JLabel();
blockers.setPreferredSize(new java.awt.Dimension(Config.dimensions.frameWidth + 8, Config.dimensions.frameHeight + 25));
attackers.setPreferredSize(new java.awt.Dimension(Config.dimensions.frameWidth + 8, Config.dimensions.frameHeight + 25));
lblDefender.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
lblDefender.setText("Defender");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblDefender, javax.swing.GroupLayout.DEFAULT_SIZE, 69, Short.MAX_VALUE)
.addComponent(blockers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(attackers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(lblDefender)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(blockers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(attackers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private mage.client.cards.Cards attackers;
private mage.client.cards.Cards blockers;
private javax.swing.JLabel lblDefender;
// End of variables declaration//GEN-END:variables
}

View file

@ -0,0 +1,57 @@
package mage.client.unusedFiles;
//package mage.client.thread;
import java.awt.Component;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class DelayedViewerThread extends Thread {
private static DelayedViewerThread fInstance = new DelayedViewerThread();
public static DelayedViewerThread getInstance() {
return fInstance;
}
private final Map<Component, Long> delayedViewers;
protected DelayedViewerThread() {
delayedViewers = new HashMap<Component, Long>();
start();
}
public synchronized void show(Component component, long delay) {
delayedViewers.put(component, System.currentTimeMillis() + delay);
notify();
}
public synchronized void hide(Component component) {
delayedViewers.remove(component);
component.setVisible(false);
}
@Override
public synchronized void run() {
while (true) {
try {
if (delayedViewers.isEmpty()) {
wait();
}
final long time = System.currentTimeMillis();
for (Iterator<Component> it = delayedViewers.keySet().iterator(); it.hasNext();) {
Component component = it.next();
final long delayedTime = delayedViewers.get(component);
if (delayedTime <= time) {
component.setVisible(true);
it.remove();
}
}
wait(100);
} catch (final InterruptedException ex) {
System.out.println("Interrupted : " + ex.getMessage());
}
}
}
}

View file

@ -0,0 +1,156 @@
<?xml version="1.1" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<Properties>
<Property name="name" type="java.lang.String" value="Form" noResource="true"/>
</Properties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="2"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="true"/>
<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">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="lblLife" alignment="1" pref="42" max="32767" attributes="1"/>
<Component id="lblGrave" alignment="0" pref="42" max="32767" attributes="0"/>
<Component id="lblHand" alignment="0" pref="42" max="32767" attributes="0"/>
<Component id="lblLibrary" alignment="0" pref="42" max="32767" attributes="1"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="txtLife" alignment="1" pref="48" max="32767" attributes="2"/>
<Component id="txtLibrary" alignment="1" pref="48" max="32767" attributes="2"/>
<Component id="txtHand" alignment="1" pref="48" max="32767" attributes="2"/>
<Component id="btnGrave" alignment="1" pref="48" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Component id="btnPlayerName" alignment="0" pref="116" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="btnPlayerName" min="-2" pref="26" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="txtLife" min="-2" pref="14" max="-2" attributes="1"/>
<Component id="lblLife" alignment="1" min="-2" pref="14" max="-2" attributes="1"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="txtLibrary" min="-2" pref="14" max="-2" attributes="1"/>
<Component id="lblLibrary" alignment="1" max="32767" attributes="1"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="txtHand" pref="14" max="32767" attributes="1"/>
<Component id="lblHand" min="-2" max="-2" attributes="1"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="lblGrave" min="-2" max="-2" attributes="1"/>
<Component id="btnGrave" min="-2" pref="18" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="btnPlayerName">
<Properties>
<Property name="text" type="java.lang.String" value="Player Name" noResource="true"/>
<Property name="name" type="java.lang.String" value="btnPlayerName" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnPlayerNameActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="lblLife">
<Properties>
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="txtLife"/>
</Property>
<Property name="text" type="java.lang.String" value="Life:" noResource="true"/>
<Property name="name" type="java.lang.String" value="lblLife" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lblLibrary">
<Properties>
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="txtLibrary"/>
</Property>
<Property name="text" type="java.lang.String" value="Library:" noResource="true"/>
<Property name="name" type="java.lang.String" value="lblLibrary" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lblHand">
<Properties>
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="txtHand"/>
</Property>
<Property name="text" type="java.lang.String" value="Hand:" noResource="true"/>
<Property name="name" type="java.lang.String" value="lblHand" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="txtLife">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder/>
</Border>
</Property>
<Property name="name" type="java.lang.String" value="txtLife" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="txtLibrary">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder/>
</Border>
</Property>
<Property name="name" type="java.lang.String" value="txtLibrary" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="txtHand">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
<LineBorder/>
</Border>
</Property>
<Property name="name" type="java.lang.String" value="txtHand" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lblGrave">
<Properties>
<Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="btnGrave"/>
</Property>
<Property name="text" type="java.lang.String" value="Grave:" noResource="true"/>
<Property name="name" type="java.lang.String" value="lblGrave" noResource="true"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="btnGrave">
<Properties>
<Property name="name" type="java.lang.String" value="btnGrave" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnGraveActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Form>

View file

@ -0,0 +1,220 @@
/*
* 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.
*/
/*
* PlayerPanel.java
*
* Created on Nov 18, 2009, 3:01:31 PM
*/
package mage.client.unusedFiles;
//package mage.client.game;
import java.awt.Color;
import java.util.UUID;
import mage.client.MageFrame;
import mage.client.cards.BigCard;
import mage.client.dialog.ShowCardsDialog;
import mage.client.util.Config;
import mage.remote.Session;
import mage.view.PlayerView;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class PlayerPanel extends javax.swing.JPanel {
private UUID playerId;
private UUID gameId;
private Session session;
private PlayerView player;
private ShowCardsDialog graveyard;
private BigCard bigCard;
/** Creates new form PlayerPanel */
public PlayerPanel() {
initComponents();
}
public void init(UUID gameId, UUID playerId, BigCard bigCard) {
this.gameId = gameId;
this.playerId = playerId;
this.bigCard = bigCard;
session = MageFrame.getSession();
}
public void update(PlayerView player) {
this.player = player;
this.txtLife.setText(Integer.toString(player.getLife()));
this.txtHand.setText(Integer.toString(player.getHandCount()));
this.txtLibrary.setText(Integer.toString(player.getLibraryCount()));
this.btnGrave.setText(Integer.toString(player.getGraveyard().size()));
this.btnPlayerName.setText(player.getName());
if (player.isActive()) {
this.btnPlayerName.setBackground(Color.DARK_GRAY);
}
else if (player.hasLeft()) {
this.btnPlayerName.setBackground(Color.RED);
}
else {
this.btnPlayerName.setBackground(Color.LIGHT_GRAY);
}
}
/** 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() {
btnPlayerName = new javax.swing.JButton();
lblLife = new javax.swing.JLabel();
lblLibrary = new javax.swing.JLabel();
lblHand = new javax.swing.JLabel();
txtLife = new javax.swing.JLabel();
txtLibrary = new javax.swing.JLabel();
txtHand = new javax.swing.JLabel();
lblGrave = new javax.swing.JLabel();
btnGrave = new javax.swing.JButton();
setName("Form"); // NOI18N
btnPlayerName.setText("Player Name"); // NOI18N
btnPlayerName.setName("btnPlayerName"); // NOI18N
btnPlayerName.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnPlayerNameActionPerformed(evt);
}
});
lblLife.setLabelFor(txtLife);
lblLife.setText("Life:"); // NOI18N
lblLife.setName("lblLife"); // NOI18N
lblLibrary.setLabelFor(txtLibrary);
lblLibrary.setText("Library:"); // NOI18N
lblLibrary.setName("lblLibrary"); // NOI18N
lblHand.setLabelFor(txtHand);
lblHand.setText("Hand:"); // NOI18N
lblHand.setName("lblHand"); // NOI18N
txtLife.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
txtLife.setName("txtLife"); // NOI18N
txtLibrary.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
txtLibrary.setName("txtLibrary"); // NOI18N
txtHand.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
txtHand.setName("txtHand"); // NOI18N
lblGrave.setLabelFor(btnGrave);
lblGrave.setText("Grave:"); // NOI18N
lblGrave.setName("lblGrave"); // NOI18N
btnGrave.setName("btnGrave"); // NOI18N
btnGrave.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnGraveActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lblLife, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE)
.addComponent(lblGrave, javax.swing.GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE)
.addComponent(lblHand, javax.swing.GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE)
.addComponent(lblLibrary, javax.swing.GroupLayout.DEFAULT_SIZE, 42, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(txtLife, javax.swing.GroupLayout.DEFAULT_SIZE, 48, Short.MAX_VALUE)
.addComponent(txtLibrary, javax.swing.GroupLayout.DEFAULT_SIZE, 48, Short.MAX_VALUE)
.addComponent(txtHand, javax.swing.GroupLayout.DEFAULT_SIZE, 48, Short.MAX_VALUE)
.addComponent(btnGrave, javax.swing.GroupLayout.DEFAULT_SIZE, 48, Short.MAX_VALUE))
.addContainerGap())
.addComponent(btnPlayerName, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(btnPlayerName, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(txtLife, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblLife, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(txtLibrary, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lblLibrary, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(txtHand, javax.swing.GroupLayout.DEFAULT_SIZE, 14, Short.MAX_VALUE)
.addComponent(lblHand))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(lblGrave)
.addComponent(btnGrave, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
private void btnPlayerNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPlayerNameActionPerformed
session.sendPlayerUUID(gameId, playerId);
}//GEN-LAST:event_btnPlayerNameActionPerformed
private void btnGraveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGraveActionPerformed
if (graveyard == null) {
graveyard = new ShowCardsDialog();
}
graveyard.loadCards(player.getName() + " graveyard", player.getGraveyard(), bigCard, Config.dimensions, gameId, false);
}//GEN-LAST:event_btnGraveActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnGrave;
private javax.swing.JButton btnPlayerName;
private javax.swing.JLabel lblGrave;
private javax.swing.JLabel lblHand;
private javax.swing.JLabel lblLibrary;
private javax.swing.JLabel lblLife;
private javax.swing.JLabel txtHand;
private javax.swing.JLabel txtLibrary;
private javax.swing.JLabel txtLife;
// End of variables declaration//GEN-END:variables
}