Browse Source

Added DDWeapon and DDArmor extension types for DDItem, these are member variables that are only not null if the item is of the appropriate type.
Filled out ShieldPanel, ArmorPanel. Created WeaponPanel for weapons.
Removed Page number for ItemPanel, will be put into the info popup instead.

Sam Jaffe 9 years ago
parent
commit
f4589ebfc3

+ 35 - 8
resources/Potato.json

@@ -51,17 +51,44 @@
   },
   
   "inventory":{
-    "equipment":{
-      
-    },
     "items":[
       {
-        "name":"Example",
+        "name":"MWK Quarterstaff",
+        "count":1,
+        "value":{"pp":0,"gp":600,"sp":0,"cp":0},
+        "page":"???",
+        "slot":"TWO_HANDS",
+        "weapon":{
+          "attackBonus":1,
+          "damageBonus":0,
+          "damage":"1d6",
+          "criticalThreat":20,
+          "criticalDamage":2,
+          "range":"Melee",
+          "type":"Bludgeoning"
+        }
+      },
+      {
+        "name":"+1 Full Plate Armor",
         "count":1,
-        "value":{"pp":0,"gp":2,"sp":0,"cp":0},
-        "page":"EX001",
-        "slot":"NONE"
+        "value":{"pp":0,"gp":2650,"sp":0,"cp":0},
+        "page":"???",
+        "slot":"BODY",
+        "weight":50,
+        "armor":{
+          "bonus":9,
+          "type":"Heavy",
+          "maxDex":1,
+          "checkPenalty":-5,
+          "spellFailure":35,
+          "speed":15
+        }
       }
-    ]
+    ],
+    "equipment":{
+      "BODY":"+1 Full Plate Armor",
+      "MAIN_HAND":"MWK Quarterstaff",
+      "OFF_HAND":"MWK Quarterstaff"
+    }
   }
 }

+ 13 - 0
src/org/leumasjaffe/charsheet/model/equip/DDArmor.java

@@ -0,0 +1,13 @@
+package org.leumasjaffe.charsheet.model.equip;
+
+import lombok.AccessLevel;
+import lombok.Data;
+import lombok.experimental.FieldDefaults;
+
+@Data
+@FieldDefaults(level=AccessLevel.PRIVATE)
+public class DDArmor {
+	public static enum Type { Light, Medium, Heavy }
+	int bonus, maxDex, speed, spellFailure, checkPenalty;
+	Type type;
+}

+ 0 - 77
src/org/leumasjaffe/charsheet/model/equip/DDEquipment.java

@@ -1,77 +0,0 @@
-package org.leumasjaffe.charsheet.model.equip;
-
-import java.util.Collections;
-import java.util.EnumMap;
-import java.util.Map;
-
-import com.fasterxml.jackson.annotation.JsonValue;
-
-import lombok.AccessLevel;
-import lombok.Data;
-import lombok.experimental.FieldDefaults;
-
-@Data
-@FieldDefaults(level=AccessLevel.PRIVATE)
-public class DDEquipment {
-	Map<EquipmentSlot, DDItem> equipment = new EnumMap<>(EquipmentSlot.class);
-	
-	@JsonValue
-	Map<EquipmentSlot, String> getSerializable() {
-		Map<EquipmentSlot, String> m = new EnumMap<>(EquipmentSlot.class);
-		equipment.entrySet().stream().forEach( e -> m.put(e.getKey(), e.getValue().getName()));
-		return m;
-	}
-	
-	public Map<EquipmentSlot, DDItem> getEquipment() {
-		return Collections.unmodifiableMap(equipment);
-	}
-	
-	public boolean canEquip( final DDItem item ) {
-		return canEquip( item.getSlot() );
-	}
-	
-	private boolean canEquip( final EquipmentSlot slot ) {
-		switch ( slot ) {
-		case NONE: return false;
-		case TWO_HANDS: return canEquip( EquipmentSlot.MAIN_HAND ) && 
-				canEquip( EquipmentSlot.OFF_HAND );
-		case ONE_HAND: return canEquip( EquipmentSlot.MAIN_HAND ) || 
-				canEquip( EquipmentSlot.OFF_HAND );
-		case RING: return canEquip( EquipmentSlot.RING1 ) || 
-				canEquip( EquipmentSlot.RING2 );
-		default:
-			return equipment.containsKey(slot);
-		}
-	}
-	
-	public void equip( final EquipmentSlot slot, final DDItem item ) {
-		switch ( slot ) {
-		case NONE:
-		case ONE_HAND:
-		case RING:
-			throw new IllegalArgumentException("Cannot equip directly to slot:" + slot);
-		case TWO_HANDS: 
-			equip( EquipmentSlot.MAIN_HAND, item ); 
-			equip( EquipmentSlot.OFF_HAND, item );
-			break;
-		default:
-			equipment.put(slot, item);
-			break;
-		}
-	}
-	
-	public void unequip( final EquipmentSlot slot ) {
-		switch ( slot ) {
-		case NONE:
-		case ONE_HAND:
-		case RING:
-			throw new IllegalArgumentException("Cannot unequip directly to slot:" + slot);
-		case TWO_HANDS: 
-			unequip( EquipmentSlot.MAIN_HAND ); 
-			unequip( EquipmentSlot.OFF_HAND );
-			break;
-		default:
-			equipment.remove(slot);
-		}
-	}
-}

+ 79 - 2
src/org/leumasjaffe/charsheet/model/equip/DDInventory.java

@@ -1,7 +1,14 @@
 package org.leumasjaffe.charsheet.model.equip;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.EnumMap;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import com.fasterxml.jackson.annotation.JsonGetter;
+import com.fasterxml.jackson.annotation.JsonSetter;
 
 import lombok.AccessLevel;
 import lombok.Data;
@@ -12,11 +19,81 @@ import lombok.experimental.FieldDefaults;
 @FieldDefaults(level=AccessLevel.PRIVATE, makeFinal=true)
 public class DDInventory {
 	
-	@NonNull DDEquipment equipment;
 	@NonNull List<DDItem> items;
+	@NonNull Map<EquipmentSlot, DDItem> equipment;
 	
 	public DDInventory() {
 		items = new ArrayList<>();
-		equipment = new DDEquipment();
+		equipment = new EnumMap<>(EquipmentSlot.class);
+	}
+	
+	@JsonSetter("equipment")
+	private void setEquipmentSerial(final Map<EquipmentSlot, String> serial) {
+		final Map<String, DDItem> named = items.stream().collect(
+				Collectors.toMap(DDItem::getName, i -> i));
+		serial.entrySet().stream().forEach(
+				e -> equipment.put(e.getKey(), named.get(e.getValue())));
+	}
+	
+	@JsonGetter("equipment")
+	private Map<EquipmentSlot, String> getEquipmentSerial() {
+		final Map<EquipmentSlot, String> m = new EnumMap<>(EquipmentSlot.class);
+		equipment.entrySet().stream().forEach( 
+				e -> m.put(e.getKey(), e.getValue().getName())
+				);
+		return m;
+	}
+	
+	public Map<EquipmentSlot, DDItem> getEquipment() {
+		return Collections.unmodifiableMap(equipment);
+	}
+	
+	public boolean canEquip( final DDItem item ) {
+		return canEquip( item.getSlot() );
+	}
+	
+	private boolean canEquip( final EquipmentSlot slot ) {
+		switch ( slot ) {
+		case NONE: return false;
+		case TWO_HANDS: return canEquip( EquipmentSlot.MAIN_HAND ) && 
+				canEquip( EquipmentSlot.OFF_HAND );
+		case ONE_HAND: return canEquip( EquipmentSlot.MAIN_HAND ) || 
+				canEquip( EquipmentSlot.OFF_HAND );
+		case RING: return canEquip( EquipmentSlot.RING1 ) || 
+				canEquip( EquipmentSlot.RING2 );
+		default:
+			return equipment.containsKey(slot);
+		}
+	}
+	
+	public void equip( final EquipmentSlot slot, final DDItem item ) {
+		switch ( slot ) {
+		case NONE:
+		case ONE_HAND:
+		case RING:
+			throw new IllegalArgumentException("Cannot equip directly to slot:" + slot);
+		case TWO_HANDS: 
+			equip( EquipmentSlot.MAIN_HAND, item ); 
+			equip( EquipmentSlot.OFF_HAND, item );
+			break;
+		default:
+			equipment.put(slot, item);
+			break;
+		}
+	}
+	
+	public void unequip( final EquipmentSlot slot ) {
+		switch ( slot ) {
+		case NONE:
+		case ONE_HAND:
+		case RING:
+			throw new IllegalArgumentException("Cannot unequip directly to slot:" + slot);
+		case TWO_HANDS: 
+			unequip( EquipmentSlot.MAIN_HAND ); 
+			unequip( EquipmentSlot.OFF_HAND );
+			break;
+		default:
+			equipment.remove(slot);
+		}
 	}
 }

+ 29 - 0
src/org/leumasjaffe/charsheet/model/equip/DDItem.java

@@ -1,9 +1,16 @@
 package org.leumasjaffe.charsheet.model.equip;
 
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
 import org.leumasjaffe.charsheet.model.Money;
 import org.leumasjaffe.charsheet.model.observable.IntValue;
 import org.leumasjaffe.charsheet.model.observable.StringValue;
 
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+
 import lombok.AccessLevel;
 import lombok.AllArgsConstructor;
 import lombok.Data;
@@ -20,4 +27,26 @@ public class DDItem {
 	Money value = new Money(0, 0, 0, 0);
 	StringValue page = new StringValue();
 	EquipmentSlot slot = EquipmentSlot.NONE;
+	DDWeapon weapon = null;
+	DDArmor armor = null;
+	Map<String, Object> properties = new HashMap<>();
+	
+	public boolean isWeapon() { return weapon != null; }
+	public boolean isArmor() { return armor != null; }
+	
+	@SuppressWarnings("unchecked")
+	public <T> T getProperty(final String key) {
+		return (T) properties.get(key);
+	}
+	
+	@JsonAnySetter 
+	public void setProperty(final String key, final Object prop) {
+		if ( properties == null ) { properties = new HashMap<>(); }
+		properties.put(key, prop);
+	}
+	
+	@JsonAnyGetter 
+	private Map<String, Object> getProperties() { 
+		return Collections.unmodifiableMap(properties);
+	}
 }

+ 22 - 0
src/org/leumasjaffe/charsheet/model/equip/DDWeapon.java

@@ -0,0 +1,22 @@
+package org.leumasjaffe.charsheet.model.equip;
+
+import lombok.AccessLevel;
+import lombok.Data;
+import lombok.experimental.FieldDefaults;
+
+@Data
+@FieldDefaults(level=AccessLevel.PRIVATE)
+public class DDWeapon {
+	public static enum Type { Piercing, Bludgeoning, Slashing }
+	int attackBonus;
+	String damage;
+	int damageBonus;
+	int criticalThreat;
+	int criticalDamage;
+	Range range;
+	Type type;
+	
+	public boolean hasCriticalThreat() {
+		return criticalThreat != 20 && criticalThreat != 0;
+	}
+}

+ 9 - 7
src/org/leumasjaffe/charsheet/model/equip/EquipmentSlot.java

@@ -3,18 +3,20 @@ package org.leumasjaffe.charsheet.model.equip;
 public enum EquipmentSlot {
 	HEAD,
 	FACE,
-	TORSO,
-	BECK,
-	THROAT,
+	NECK,
+	TORSO, // Vest/Vestment/Shirt
+	BODY, // Robe/Armor
+	WAIST,
+	SHOULDER,
 	ARM,
 	HAND,
 	RING, RING1, RING2,
-	BODY,
-	WAIST,
-	LEGS,
-	MAIN_HAND,
+	FEET,
+		
+	MAIN_HAND, // Weapons
 	OFF_HAND,
 	ONE_HAND,
 	TWO_HANDS,
+	
 	NONE
 }

+ 47 - 0
src/org/leumasjaffe/charsheet/model/equip/Range.java

@@ -0,0 +1,47 @@
+package org.leumasjaffe.charsheet.model.equip;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+
+import lombok.AccessLevel;
+import lombok.NonNull;
+import lombok.RequiredArgsConstructor;
+import lombok.experimental.FieldDefaults;
+
+public interface Range {
+	public static final Range Melee = new Basic("Melee");
+	
+	@JsonCreator
+	public static Range select(final String name) {
+		switch (name.toLowerCase()) {
+		case "melee": return Melee;
+		}
+		throw new IllegalArgumentException("Unrecognized Range constant: " + name);
+	}
+	
+	@JsonCreator
+	public static Range create(final int range) {
+		return new WithDistance(range);
+	}
+	
+	@RequiredArgsConstructor
+	@FieldDefaults(level=AccessLevel.PRIVATE, makeFinal=true)
+	public static class Basic implements Range {
+		@NonNull String name;
+		
+		public String toString() {
+			return name;
+		}
+	}
+	
+	@RequiredArgsConstructor
+	@FieldDefaults(level=AccessLevel.PRIVATE, makeFinal=true)
+	public static class WithDistance implements Range {
+		int range;
+		
+		public String toString() {
+			final StringBuilder str = new StringBuilder();
+			str.append(range).append(" ft.");
+			return str.toString();
+		}
+	}
+}

+ 25 - 1
src/org/leumasjaffe/charsheet/view/EquipmentTab.java

@@ -11,8 +11,13 @@ import java.awt.Insets;
 
 import org.jdesktop.swingx.VerticalLayout;
 import org.leumasjaffe.charsheet.model.DDCharacter;
+import org.leumasjaffe.charsheet.model.equip.DDInventory;
 import org.leumasjaffe.charsheet.model.equip.DDItem;
+import org.leumasjaffe.charsheet.model.equip.EquipmentSlot;
+import org.leumasjaffe.charsheet.view.inventory.ArmorPanel;
 import org.leumasjaffe.charsheet.view.inventory.ItemPanel;
+import org.leumasjaffe.charsheet.view.inventory.ShieldPanel;
+import org.leumasjaffe.charsheet.view.inventory.WeaponPanel;
 
 import java.awt.Color;
 import javax.swing.JLabel;
@@ -89,9 +94,28 @@ public class EquipmentTab extends JPanel {
 	public void setModel(DDCharacter model) {
 		equipment.removeAll();
 		inventory.removeAll();
-		for ( DDItem item : model.getInventory().getItems() ) {
+		
+		final DDInventory inv = model.getInventory();
+		for ( final DDItem item : inv.getItems() ) {
 			inventory.add(new ItemPanel(item));
 		}
+		
+		final DDItem armor = inv.getEquipment().get(EquipmentSlot.BODY);
+		if ( armor != null ) {
+			equipment.add(new ArmorPanel(armor));
+		}
+		
+		final DDItem main = inv.getEquipment().get(EquipmentSlot.MAIN_HAND);
+		final DDItem off = inv.getEquipment().get(EquipmentSlot.OFF_HAND);
+		if ( off != null && off.isArmor() ) {
+			equipment.add(new ShieldPanel(off));
+		}
+		if ( main != null ) {
+			equipment.add(new WeaponPanel(main));
+		}
+		if ( off != null && ( off != main || ( off.getSlot() == EquipmentSlot.ONE_HAND && off.getCount().value() > 1 ) ) ) {
+			equipment.add(new WeaponPanel(off));
+		}
 	}
 
 }

+ 5 - 0
src/org/leumasjaffe/charsheet/view/StringHelper.java

@@ -22,4 +22,9 @@ public class StringHelper {
 		if ( i > 0 ) { return "+" + i; }
 		else { return toString(i); }
 	}
+	
+	public static String toSignedString(int i, int ignore) {
+		if ( i == ignore ) { return ""; }
+		else { return toSignedString(i); }
+	}
 }

+ 17 - 8
src/org/leumasjaffe/charsheet/view/inventory/ArmorPanel.java

@@ -10,6 +10,10 @@ import java.awt.Dimension;
 import java.awt.Font;
 import java.awt.Color;
 import javax.swing.SwingConstants;
+
+import org.leumasjaffe.charsheet.model.equip.DDItem;
+import org.leumasjaffe.charsheet.view.StringHelper;
+
 import java.awt.Component;
 import javax.swing.Box;
 
@@ -28,7 +32,7 @@ public class ArmorPanel extends JPanel {
 	private JTextField weightField;
 	private JTextField propField;
 
-	public ArmorPanel(String string) {
+	public ArmorPanel(DDItem item) {
 		setPreferredSize(new Dimension(280, 70));
 		GridBagLayout gridBagLayout = new GridBagLayout();
 		gridBagLayout.columnWidths = new int[]{0, 0};
@@ -114,7 +118,7 @@ public class ArmorPanel extends JPanel {
 		gbc_lblMaxDex.gridy = 1;
 		panel.add(lblMaxDex, gbc_lblMaxDex);
 		
-		armorNameField = new JTextField();
+		armorNameField = new JTextField(item.getName());
 		GridBagConstraints gbc_armorNameField = new GridBagConstraints();
 		gbc_armorNameField.insets = new Insets(0, 0, 0, 0);
 		gbc_armorNameField.fill = GridBagConstraints.HORIZONTAL;
@@ -123,7 +127,7 @@ public class ArmorPanel extends JPanel {
 		panel.add(armorNameField, gbc_armorNameField);
 		armorNameField.setColumns(10);
 		
-		armorTypeField = new JTextField();
+		armorTypeField = new JTextField(item.getArmor().getType().toString());
 		GridBagConstraints gbc_armorTypeField = new GridBagConstraints();
 		gbc_armorTypeField.insets = new Insets(0, 0, 0, 0);
 		gbc_armorTypeField.fill = GridBagConstraints.HORIZONTAL;
@@ -132,7 +136,8 @@ public class ArmorPanel extends JPanel {
 		panel.add(armorTypeField, gbc_armorTypeField);
 		armorTypeField.setColumns(10);
 		
-		armorBonusField = new JTextField();
+		armorBonusField = new JTextField(StringHelper.toSignedString(item.getArmor().getBonus()));
+		armorBonusField.setHorizontalAlignment(SwingConstants.CENTER);
 		GridBagConstraints gbc_armorBonusField = new GridBagConstraints();
 		gbc_armorBonusField.insets = new Insets(0, 0, 0, 0);
 		gbc_armorBonusField.fill = GridBagConstraints.HORIZONTAL;
@@ -141,7 +146,8 @@ public class ArmorPanel extends JPanel {
 		panel.add(armorBonusField, gbc_armorBonusField);
 		armorBonusField.setColumns(10);
 		
-		armorDexField = new JTextField();
+		armorDexField = new JTextField(StringHelper.toSignedString(item.getArmor().getMaxDex()));
+		armorDexField.setHorizontalAlignment(SwingConstants.CENTER);
 		GridBagConstraints gbc_armorDexField = new GridBagConstraints();
 		gbc_armorDexField.fill = GridBagConstraints.HORIZONTAL;
 		gbc_armorDexField.gridx = 3;
@@ -227,7 +233,8 @@ public class ArmorPanel extends JPanel {
 		gbc_lblSpecialProperties.gridy = 0;
 		panel_1.add(lblSpecialProperties, gbc_lblSpecialProperties);
 		
-		checkField = new JTextField();
+		checkField = new JTextField(StringHelper.toString(item.getArmor().getCheckPenalty()));
+		checkField.setHorizontalAlignment(SwingConstants.CENTER);
 		GridBagConstraints gbc_checkField = new GridBagConstraints();
 		gbc_checkField.insets = new Insets(0, 0, 0, 0);
 		gbc_checkField.fill = GridBagConstraints.HORIZONTAL;
@@ -236,7 +243,8 @@ public class ArmorPanel extends JPanel {
 		panel_1.add(checkField, gbc_checkField);
 		checkField.setColumns(10);
 		
-		spellField = new JTextField();
+		spellField = new JTextField(StringHelper.toString(item.getArmor().getSpellFailure()) + "%");
+		spellField.setHorizontalAlignment(SwingConstants.CENTER);
 		GridBagConstraints gbc_spellField = new GridBagConstraints();
 		gbc_spellField.insets = new Insets(0, 0, 0, 0);
 		gbc_spellField.fill = GridBagConstraints.HORIZONTAL;
@@ -245,7 +253,8 @@ public class ArmorPanel extends JPanel {
 		panel_1.add(spellField, gbc_spellField);
 		spellField.setColumns(10);
 		
-		speedField = new JTextField();
+		speedField = new JTextField(StringHelper.toString(item.getArmor().getSpeed()));
+		speedField.setHorizontalAlignment(SwingConstants.CENTER);
 		GridBagConstraints gbc_speedField = new GridBagConstraints();
 		gbc_speedField.insets = new Insets(0, 0, 0, 0);
 		gbc_speedField.fill = GridBagConstraints.HORIZONTAL;

+ 27 - 0
src/org/leumasjaffe/charsheet/view/inventory/EquipmentInfoMenu.java

@@ -0,0 +1,27 @@
+package org.leumasjaffe.charsheet.view.inventory;
+
+import javax.swing.JPopupMenu;
+
+import org.leumasjaffe.charsheet.model.equip.DDItem;
+
+import javax.swing.JMenuItem;
+
+public class EquipmentInfoMenu extends JPopupMenu {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public EquipmentInfoMenu(DDItem item) {
+		
+		JMenuItem mntmInfo = new JMenuItem("Info");
+		add(mntmInfo);
+		
+		JMenuItem mntmEquip = new JMenuItem("Unequip");
+		add(mntmEquip);
+		
+		JMenuItem mntmRemove = new JMenuItem("Remove");
+		add(mntmRemove);
+	}
+
+}

+ 5 - 24
src/org/leumasjaffe/charsheet/view/inventory/ItemPanel.java

@@ -27,14 +27,13 @@ public class ItemPanel extends JPanel {
 	private JTextField weightField;
 	private JTextField countField;
 	private JTextField valueField;
-	private JTextField pageField;
 
 	public ItemPanel(DDItem item) {
 		setPreferredSize(new Dimension(280, 40));
 		GridBagLayout gbl_panel = new GridBagLayout();
-		gbl_panel.columnWidths = new int[]{0, 0, 0, 0, 0, 0};
+		gbl_panel.columnWidths = new int[]{120, 0, 0, 0, 0};
 		gbl_panel.rowHeights = new int[]{0, 0, 0, 0};
-		gbl_panel.columnWeights = new double[]{1.0, 1.0, 1.0, 1.0, 1.0, Double.MIN_VALUE};
+		gbl_panel.columnWeights = new double[]{1.0, 1.0, 1.0, 1.0, Double.MIN_VALUE};
 		gbl_panel.rowWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
 		setLayout(gbl_panel);
 		
@@ -101,19 +100,6 @@ public class ItemPanel extends JPanel {
 		gbc_lblValue.gridy = 1;
 		add(lblValue, gbc_lblValue);
 		
-		JLabel lblPage = new JLabel("PAGE");
-		lblPage.setOpaque(true);
-		lblPage.setHorizontalAlignment(SwingConstants.CENTER);
-		lblPage.setForeground(Color.WHITE);
-		lblPage.setFont(new Font("Tahoma", Font.BOLD, 8));
-		lblPage.setBackground(Color.BLACK);
-		GridBagConstraints gbc_lblPage = new GridBagConstraints();
-		gbc_lblPage.fill = GridBagConstraints.HORIZONTAL;
-		gbc_lblPage.insets = new Insets(0, 0, 0, 1);
-		gbc_lblPage.gridx = 4;
-		gbc_lblPage.gridy = 1;
-		add(lblPage, gbc_lblPage);
-		
 		nameField = new JTextField(item.getName());
 		GridBagConstraints gbc_nameField = new GridBagConstraints();
 		gbc_nameField.insets = new Insets(0, 0, 0, 0);
@@ -124,6 +110,7 @@ public class ItemPanel extends JPanel {
 		nameField.setColumns(10);
 		
 		countField = new JTextField(Integer.toString(item.getCount().value()));
+		countField.setHorizontalAlignment(SwingConstants.CENTER);
 		GridBagConstraints gbc_countField = new GridBagConstraints();
 		gbc_countField.insets = new Insets(0, 0, 0, 0);
 		gbc_countField.fill = GridBagConstraints.HORIZONTAL;
@@ -133,6 +120,7 @@ public class ItemPanel extends JPanel {
 		countField.setColumns(10);
 		
 		weightField = new JTextField();
+		weightField.setHorizontalAlignment(SwingConstants.CENTER);
 		GridBagConstraints gbc_weightField = new GridBagConstraints();
 		gbc_weightField.insets = new Insets(0, 0, 0, 0);
 		gbc_weightField.fill = GridBagConstraints.HORIZONTAL;
@@ -142,6 +130,7 @@ public class ItemPanel extends JPanel {
 		weightField.setColumns(10);
 		
 		valueField = new JTextField(item.getValue().toString());
+		valueField.setHorizontalAlignment(SwingConstants.CENTER);
 		GridBagConstraints gbc_valueField = new GridBagConstraints();
 		gbc_valueField.insets = new Insets(0, 0, 0, 0);
 		gbc_valueField.fill = GridBagConstraints.HORIZONTAL;
@@ -150,14 +139,6 @@ public class ItemPanel extends JPanel {
 		add(valueField, gbc_valueField);
 		valueField.setColumns(10);
 		
-		pageField = new JTextField(item.getPage().value());
-		GridBagConstraints gbc_pageField = new GridBagConstraints();
-		gbc_pageField.fill = GridBagConstraints.HORIZONTAL;
-		gbc_pageField.gridx = 4;
-		gbc_pageField.gridy = 2;
-		add(pageField, gbc_pageField);
-		pageField.setColumns(10);
-		
 		addMouseListener(new PopClickListener(new ItemInfoMenu(item)));
 	}
 

+ 13 - 5
src/org/leumasjaffe/charsheet/view/inventory/ShieldPanel.java

@@ -10,6 +10,10 @@ import java.awt.Dimension;
 import java.awt.Font;
 import java.awt.Color;
 import javax.swing.SwingConstants;
+
+import org.leumasjaffe.charsheet.model.equip.DDItem;
+import org.leumasjaffe.charsheet.view.StringHelper;
+
 import java.awt.Component;
 import javax.swing.Box;
 
@@ -25,7 +29,7 @@ public class ShieldPanel extends JPanel {
 	private JTextField spellField;
 	private JTextField propField;
 
-	public ShieldPanel(String string) {
+	public ShieldPanel(DDItem shield) {
 		setPreferredSize(new Dimension(280, 70));
 		GridBagLayout gridBagLayout = new GridBagLayout();
 		gridBagLayout.columnWidths = new int[]{0, 0};
@@ -111,7 +115,7 @@ public class ShieldPanel extends JPanel {
 		lblCheckPenalty.setBackground(Color.BLACK);
 		lblCheckPenalty.setFont(new Font("Tahoma", Font.BOLD, 8));
 		
-		nameField = new JTextField();
+		nameField = new JTextField(shield.getName());
 		GridBagConstraints gbc_nameField = new GridBagConstraints();
 		gbc_nameField.insets = new Insets(0, 0, 0, 0);
 		gbc_nameField.fill = GridBagConstraints.HORIZONTAL;
@@ -120,7 +124,8 @@ public class ShieldPanel extends JPanel {
 		panel.add(nameField, gbc_nameField);
 		nameField.setColumns(10);
 		
-		armorBonusField = new JTextField();
+		armorBonusField = new JTextField(StringHelper.toSignedString(shield.getArmor().getBonus()));
+		armorBonusField.setHorizontalAlignment(SwingConstants.CENTER);
 		GridBagConstraints gbc_armorBonusField = new GridBagConstraints();
 		gbc_armorBonusField.insets = new Insets(0, 0, 0, 0);
 		gbc_armorBonusField.fill = GridBagConstraints.HORIZONTAL;
@@ -130,6 +135,7 @@ public class ShieldPanel extends JPanel {
 		armorBonusField.setColumns(10);
 		
 		weightField = new JTextField();
+		weightField.setHorizontalAlignment(SwingConstants.CENTER);
 		GridBagConstraints gbc_weightField = new GridBagConstraints();
 		gbc_weightField.insets = new Insets(0, 0, 0, 0);
 		gbc_weightField.fill = GridBagConstraints.HORIZONTAL;
@@ -138,7 +144,8 @@ public class ShieldPanel extends JPanel {
 		panel.add(weightField, gbc_weightField);
 		weightField.setColumns(10);
 		
-		checkField = new JTextField();
+		checkField = new JTextField(StringHelper.toString(shield.getArmor().getCheckPenalty()));
+		checkField.setHorizontalAlignment(SwingConstants.CENTER);
 		GridBagConstraints gbc_checkField = new GridBagConstraints();
 		gbc_checkField.fill = GridBagConstraints.HORIZONTAL;
 		gbc_checkField.gridx = 3;
@@ -185,7 +192,8 @@ public class ShieldPanel extends JPanel {
 		gbc_lblSpecialProperties.gridy = 0;
 		panel_1.add(lblSpecialProperties, gbc_lblSpecialProperties);
 		
-		spellField = new JTextField();
+		spellField = new JTextField(StringHelper.toString(shield.getArmor().getSpellFailure()));
+		spellField.setHorizontalAlignment(SwingConstants.CENTER);
 		GridBagConstraints gbc_spellField = new GridBagConstraints();
 		gbc_spellField.insets = new Insets(0, 0, 0, 0);
 		gbc_spellField.fill = GridBagConstraints.HORIZONTAL;

+ 245 - 0
src/org/leumasjaffe/charsheet/view/inventory/WeaponPanel.java

@@ -0,0 +1,245 @@
+package org.leumasjaffe.charsheet.view.inventory;
+
+import javax.swing.JPanel;
+import java.awt.GridBagLayout;
+import java.awt.GridBagConstraints;
+import java.awt.Insets;
+import javax.swing.JLabel;
+import javax.swing.JTextField;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Color;
+import javax.swing.SwingConstants;
+
+import org.leumasjaffe.charsheet.model.equip.DDItem;
+import org.leumasjaffe.charsheet.model.equip.DDWeapon;
+import org.leumasjaffe.charsheet.view.StringHelper;
+
+import java.awt.Component;
+import javax.swing.Box;
+
+public class WeaponPanel extends JPanel {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	private JTextField nameField;
+	private JTextField attackBonusField;
+	private JTextField damageField;
+	private JTextField criticalField;
+	private JTextField rangeField;
+	private JTextField propField;
+	private JTextField typeField;
+
+	public WeaponPanel(final DDItem item) {
+		final DDWeapon weapon = item.getWeapon();
+		
+		setPreferredSize(new Dimension(280, 70));
+		GridBagLayout gridBagLayout = new GridBagLayout();
+		gridBagLayout.columnWidths = new int[]{0, 0};
+		gridBagLayout.rowHeights = new int[]{0, 0, 0};
+		gridBagLayout.columnWeights = new double[]{1.0, Double.MIN_VALUE};
+		gridBagLayout.rowWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
+		setLayout(gridBagLayout);
+		
+		JPanel panel = new JPanel();
+		GridBagConstraints gbc_panel = new GridBagConstraints();
+		gbc_panel.insets = new Insets(0, 0, 0, 0);
+		gbc_panel.fill = GridBagConstraints.BOTH;
+		gbc_panel.gridx = 0;
+		gbc_panel.gridy = 0;
+		add(panel, gbc_panel);
+		GridBagLayout gbl_panel = new GridBagLayout();
+		gbl_panel.columnWidths = new int[]{100, 0, 0, 0, 0};
+		gbl_panel.rowHeights = new int[]{0, 0, 0, 0};
+		gbl_panel.columnWeights = new double[]{1.0, 1.0, 1.0, 1.0, Double.MIN_VALUE};
+		gbl_panel.rowWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
+		panel.setLayout(gbl_panel);
+		
+		JLabel lblWeapon = new JLabel("WEAPON");
+		lblWeapon.setHorizontalAlignment(SwingConstants.CENTER);
+		lblWeapon.setForeground(Color.WHITE);
+		lblWeapon.setOpaque(true);
+		lblWeapon.setBackground(Color.BLACK);
+		lblWeapon.setFont(new Font("Tahoma", Font.BOLD, 10));
+		GridBagConstraints gbc_lblWeapon = new GridBagConstraints();
+		gbc_lblWeapon.fill = GridBagConstraints.BOTH;
+		gbc_lblWeapon.insets = new Insets(0, 0, 0, 1);
+		gbc_lblWeapon.gridheight = 2;
+		gbc_lblWeapon.gridx = 0;
+		gbc_lblWeapon.gridy = 0;
+		panel.add(lblWeapon, gbc_lblWeapon);
+		
+		Component verticalStrut = Box.createVerticalStrut(20);
+		verticalStrut.setMinimumSize(new Dimension(0, 10));
+		verticalStrut.setMaximumSize(new Dimension(32767, 10));
+		verticalStrut.setPreferredSize(new Dimension(0, 10));
+		GridBagConstraints gbc_verticalStrut = new GridBagConstraints();
+		gbc_verticalStrut.insets = new Insets(0, 0, 0, 0);
+		gbc_verticalStrut.gridx = 2;
+		gbc_verticalStrut.gridy = 0;
+		panel.add(verticalStrut, gbc_verticalStrut);
+		
+		JLabel lblAtkBonus = new JLabel("ATTACK BONUS");
+		lblAtkBonus.setHorizontalAlignment(SwingConstants.CENTER);
+		lblAtkBonus.setForeground(Color.WHITE);
+		lblAtkBonus.setOpaque(true);
+		lblAtkBonus.setBackground(Color.BLACK);
+		lblAtkBonus.setFont(new Font("Tahoma", Font.BOLD, 8));
+		GridBagConstraints gbc_lblAtkBonus = new GridBagConstraints();
+		gbc_lblAtkBonus.fill = GridBagConstraints.HORIZONTAL;
+		gbc_lblAtkBonus.insets = new Insets(0, 0, 0, 1);
+		gbc_lblAtkBonus.gridx = 1;
+		gbc_lblAtkBonus.gridy = 1;
+		panel.add(lblAtkBonus, gbc_lblAtkBonus);
+		
+		JLabel lblDamage = new JLabel("DAMAGE");
+		lblDamage.setHorizontalAlignment(SwingConstants.CENTER);
+		lblDamage.setForeground(Color.WHITE);
+		lblDamage.setOpaque(true);
+		lblDamage.setBackground(Color.BLACK);
+		lblDamage.setFont(new Font("Tahoma", Font.BOLD, 8));
+		GridBagConstraints gbc_lblDamage = new GridBagConstraints();
+		gbc_lblDamage.fill = GridBagConstraints.HORIZONTAL;
+		gbc_lblDamage.insets = new Insets(0, 0, 0, 1);
+		gbc_lblDamage.gridx = 2;
+		gbc_lblDamage.gridy = 1;
+		panel.add(lblDamage, gbc_lblDamage);
+		
+		JLabel lblCritical = new JLabel("CRITICAL");
+		GridBagConstraints gbc_lblCritical = new GridBagConstraints();
+		gbc_lblCritical.fill = GridBagConstraints.HORIZONTAL;
+		gbc_lblCritical.insets = new Insets(0, 0, 0, 1);
+		gbc_lblCritical.gridx = 3;
+		gbc_lblCritical.gridy = 1;
+		panel.add(lblCritical, gbc_lblCritical);
+		lblCritical.setHorizontalAlignment(SwingConstants.CENTER);
+		lblCritical.setForeground(Color.WHITE);
+		lblCritical.setOpaque(true);
+		lblCritical.setBackground(Color.BLACK);
+		lblCritical.setFont(new Font("Tahoma", Font.BOLD, 8));
+		
+		nameField = new JTextField(item.getName());
+		GridBagConstraints gbc_nameField = new GridBagConstraints();
+		gbc_nameField.insets = new Insets(0, 0, 0, 0);
+		gbc_nameField.fill = GridBagConstraints.HORIZONTAL;
+		gbc_nameField.gridx = 0;
+		gbc_nameField.gridy = 2;
+		panel.add(nameField, gbc_nameField);
+		nameField.setColumns(10);
+		
+		attackBonusField = new JTextField(StringHelper.toSignedString(weapon.getAttackBonus()));
+		attackBonusField.setHorizontalAlignment(SwingConstants.CENTER);
+		GridBagConstraints gbc_attackBonusField = new GridBagConstraints();
+		gbc_attackBonusField.insets = new Insets(0, 0, 0, 0);
+		gbc_attackBonusField.fill = GridBagConstraints.HORIZONTAL;
+		gbc_attackBonusField.gridx = 1;
+		gbc_attackBonusField.gridy = 2;
+		panel.add(attackBonusField, gbc_attackBonusField);
+		attackBonusField.setColumns(10);
+		
+		damageField = new JTextField(weapon.getDamage() + StringHelper.toSignedString(weapon.getDamageBonus(), 0));
+		damageField.setHorizontalAlignment(SwingConstants.CENTER);
+		GridBagConstraints gbc_damageField = new GridBagConstraints();
+		gbc_damageField.insets = new Insets(0, 0, 0, 0);
+		gbc_damageField.fill = GridBagConstraints.HORIZONTAL;
+		gbc_damageField.gridx = 2;
+		gbc_damageField.gridy = 2;
+		panel.add(damageField, gbc_damageField);
+		damageField.setColumns(10);
+		
+		final StringBuilder critStr = new StringBuilder();
+		if (weapon.hasCriticalThreat()) { critStr.append(weapon.getCriticalThreat()).append("-20/"); }
+		critStr.append('x').append(weapon.getCriticalDamage());
+		criticalField = new JTextField(critStr.toString());
+		criticalField.setHorizontalAlignment(SwingConstants.CENTER);
+		GridBagConstraints gbc_criticalField = new GridBagConstraints();
+		gbc_criticalField.fill = GridBagConstraints.HORIZONTAL;
+		gbc_criticalField.gridx = 3;
+		gbc_criticalField.gridy = 2;
+		panel.add(criticalField, gbc_criticalField);
+		criticalField.setColumns(10);
+		
+		JPanel panel_1 = new JPanel();
+		GridBagConstraints gbc_panel_1 = new GridBagConstraints();
+		gbc_panel_1.fill = GridBagConstraints.BOTH;
+		gbc_panel_1.gridx = 0;
+		gbc_panel_1.gridy = 1;
+		add(panel_1, gbc_panel_1);
+		GridBagLayout gbl_panel_1 = new GridBagLayout();
+		gbl_panel_1.columnWidths = new int[]{0, 0, 0, 0};
+		gbl_panel_1.rowHeights = new int[]{0, 0, 0};
+		gbl_panel_1.columnWeights = new double[]{1.0, 1.0, 1.0, Double.MIN_VALUE};
+		gbl_panel_1.rowWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
+		panel_1.setLayout(gbl_panel_1);
+		
+		JLabel lblRange = new JLabel("RANGE");
+		lblRange.setHorizontalAlignment(SwingConstants.CENTER);
+		lblRange.setForeground(Color.WHITE);
+		lblRange.setOpaque(true);
+		lblRange.setBackground(Color.BLACK);
+		lblRange.setFont(new Font("Tahoma", Font.BOLD, 8));
+		GridBagConstraints gbc_lblRange = new GridBagConstraints();
+		gbc_lblRange.fill = GridBagConstraints.BOTH;
+		gbc_lblRange.insets = new Insets(0, 0, 0, 1);
+		gbc_lblRange.gridx = 0;
+		gbc_lblRange.gridy = 0;
+		panel_1.add(lblRange, gbc_lblRange);
+		
+		JLabel lblType = new JLabel("TYPE");
+		lblType.setOpaque(true);
+		lblType.setHorizontalAlignment(SwingConstants.CENTER);
+		lblType.setForeground(Color.WHITE);
+		lblType.setFont(new Font("Tahoma", Font.BOLD, 8));
+		lblType.setBackground(Color.BLACK);
+		GridBagConstraints gbc_lblType = new GridBagConstraints();
+		gbc_lblType.fill = GridBagConstraints.HORIZONTAL;
+		gbc_lblType.insets = new Insets(0, 0, 0, 1);
+		gbc_lblType.gridx = 1;
+		gbc_lblType.gridy = 0;
+		panel_1.add(lblType, gbc_lblType);
+		
+		JLabel lblSpecialProperties = new JLabel("SPECIAL PROPERTIES");
+		lblSpecialProperties.setHorizontalAlignment(SwingConstants.CENTER);
+		lblSpecialProperties.setForeground(Color.WHITE);
+		lblSpecialProperties.setOpaque(true);
+		lblSpecialProperties.setBackground(Color.BLACK);
+		lblSpecialProperties.setFont(new Font("Tahoma", Font.BOLD, 8));
+		GridBagConstraints gbc_lblSpecialProperties = new GridBagConstraints();
+		gbc_lblSpecialProperties.fill = GridBagConstraints.BOTH;
+		gbc_lblSpecialProperties.insets = new Insets(0, 0, 0, 1);
+		gbc_lblSpecialProperties.gridx = 2;
+		gbc_lblSpecialProperties.gridy = 0;
+		panel_1.add(lblSpecialProperties, gbc_lblSpecialProperties);
+		
+		rangeField = new JTextField(StringHelper.toString(weapon.getRange().toString()));
+		rangeField.setHorizontalAlignment(SwingConstants.CENTER);
+		GridBagConstraints gbc_rangeField = new GridBagConstraints();
+		gbc_rangeField.insets = new Insets(0, 0, 0, 0);
+		gbc_rangeField.fill = GridBagConstraints.HORIZONTAL;
+		gbc_rangeField.gridx = 0;
+		gbc_rangeField.gridy = 1;
+		panel_1.add(rangeField, gbc_rangeField);
+		rangeField.setColumns(10);
+		
+		typeField = new JTextField(item.getWeapon().getType().toString());
+		typeField.setHorizontalAlignment(SwingConstants.CENTER);
+		typeField.setColumns(10);
+		GridBagConstraints gbc_typeField = new GridBagConstraints();
+		gbc_typeField.insets = new Insets(0, 0, 0, 0);
+		gbc_typeField.fill = GridBagConstraints.HORIZONTAL;
+		gbc_typeField.gridx = 1;
+		gbc_typeField.gridy = 1;
+		panel_1.add(typeField, gbc_typeField);
+		
+		propField = new JTextField();
+		GridBagConstraints gbc_propField = new GridBagConstraints();
+		gbc_propField.fill = GridBagConstraints.HORIZONTAL;
+		gbc_propField.gridx = 2;
+		gbc_propField.gridy = 1;
+		panel_1.add(propField, gbc_propField);
+		propField.setColumns(10);
+		// TODO Auto-generated constructor stub
+	}
+
+}