Browse Source

Adding the basics of the equipment tab

Sam Jaffe 9 years ago
parent
commit
ed033872ce

+ 5 - 0
pom.xml

@@ -42,5 +42,10 @@
   		<artifactId>jackson-datatype-jdk8</artifactId>
   		<version>2.7.3</version>
   	</dependency>
+  	<dependency>
+  		<groupId>org.swinglabs</groupId>
+  		<artifactId>swingx</artifactId>
+  		<version>1.6.1</version>
+  	</dependency>
   </dependencies>
 </project>

+ 2 - 2
src/org/leumasjaffe/charsheet/view/D20Sheet.java

@@ -44,7 +44,7 @@ public class D20Sheet extends JFrame {
 	List<ClassTab> classTabs = new ArrayList<>();
 	JPanel abilitiesTab;
 	JPanel skillTab;
-	JPanel equipmentTab;
+	EquipmentTab equipmentTab;
 	
 	public D20Sheet() {
 		// Set up local state variables
@@ -58,7 +58,7 @@ public class D20Sheet extends JFrame {
 		summaryTab = new SummaryTab();
 		abilitiesTab = new JPanel();
 		skillTab = new JPanel();
-		equipmentTab = new JPanel();
+		equipmentTab = new EquipmentTab();
 		
 		JMenuBar menuBar = new JMenuBar();
 		setJMenuBar(menuBar);

+ 71 - 0
src/org/leumasjaffe/charsheet/view/EquipmentTab.java

@@ -0,0 +1,71 @@
+package org.leumasjaffe.charsheet.view;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+import lombok.AccessLevel;
+import lombok.experimental.FieldDefaults;
+import java.awt.GridBagLayout;
+import javax.swing.JScrollPane;
+import java.awt.GridBagConstraints;
+import java.awt.Insets;
+
+import org.jdesktop.swingx.VerticalLayout;
+import org.leumasjaffe.charsheet.entity.DDCharacter;
+import org.leumasjaffe.charsheet.view.inventory.ArmorPanel;
+
+import java.awt.Color;
+
+@FieldDefaults(level=AccessLevel.PRIVATE, makeFinal=true)
+public class EquipmentTab extends JPanel {
+	public EquipmentTab() {
+		setOpaque(false);
+		GridBagLayout gridBagLayout = new GridBagLayout();
+		gridBagLayout.columnWidths = new int[]{0, 0, 0};
+		gridBagLayout.rowHeights = new int[]{0, 0};
+		gridBagLayout.columnWeights = new double[]{1.0, 1.0, Double.MIN_VALUE};
+		gridBagLayout.rowWeights = new double[]{1.0, Double.MIN_VALUE};
+		setLayout(gridBagLayout);
+		
+		JScrollPane scrollPane = new JScrollPane();
+		scrollPane.setOpaque(false);
+		GridBagConstraints gbc_scrollPane = new GridBagConstraints();
+		gbc_scrollPane.insets = new Insets(0, 0, 0, 5);
+		gbc_scrollPane.fill = GridBagConstraints.BOTH;
+		gbc_scrollPane.gridx = 0;
+		gbc_scrollPane.gridy = 0;
+		add(scrollPane, gbc_scrollPane);
+		
+		JPanel equipment = new JPanel();
+		equipment.setBackground(Color.WHITE);
+		scrollPane.setViewportView(equipment);
+		equipment.setLayout(new VerticalLayout(5));
+		
+		JScrollPane scrollPane_1 = new JScrollPane();
+		scrollPane_1.setOpaque(false);
+		GridBagConstraints gbc_scrollPane_1 = new GridBagConstraints();
+		gbc_scrollPane_1.fill = GridBagConstraints.BOTH;
+		gbc_scrollPane_1.gridx = 1;
+		gbc_scrollPane_1.gridy = 0;
+		add(scrollPane_1, gbc_scrollPane_1);
+		
+		JPanel inventory = new JPanel();
+		inventory.setBackground(Color.WHITE);
+		scrollPane_1.setViewportView(inventory);
+		inventory.setLayout(new VerticalLayout(5));
+		equipment.add(new ArmorPanel("Armor"));
+		equipment.add(new ArmorPanel("Shield"));
+		inventory.add(new ArmorPanel("<dummy>"));
+	}
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public void setModel(DDCharacter model) {
+		// TODO Auto-generated method stub
+		
+	}
+
+}

+ 272 - 0
src/org/leumasjaffe/charsheet/view/inventory/ArmorPanel.java

@@ -0,0 +1,272 @@
+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 java.awt.Component;
+import javax.swing.Box;
+
+public class ArmorPanel extends JPanel {
+	private JTextField armorNameField;
+	private JTextField armorTypeField;
+	private JTextField armorBonusField;
+	private JTextField armorDexField;
+	private JTextField checkField;
+	private JTextField spellField;
+	private JTextField speedField;
+	private JTextField weightField;
+	private JTextField propField;
+
+	public ArmorPanel(String string) {
+		setPreferredSize(new Dimension(300, 75));
+		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, 5, 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[]{0, 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 lblArmorprotectiveItem = new JLabel("ARMOR/PROTECTIVE ITEM");
+		lblArmorprotectiveItem.setHorizontalAlignment(SwingConstants.CENTER);
+		lblArmorprotectiveItem.setForeground(Color.WHITE);
+		lblArmorprotectiveItem.setOpaque(true);
+		lblArmorprotectiveItem.setBackground(Color.BLACK);
+		lblArmorprotectiveItem.setFont(new Font("Tahoma", Font.BOLD, 10));
+		GridBagConstraints gbc_lblArmorprotectiveItem = new GridBagConstraints();
+		gbc_lblArmorprotectiveItem.fill = GridBagConstraints.BOTH;
+		gbc_lblArmorprotectiveItem.insets = new Insets(0, 0, 0, 1);
+		gbc_lblArmorprotectiveItem.gridheight = 2;
+		gbc_lblArmorprotectiveItem.gridx = 0;
+		gbc_lblArmorprotectiveItem.gridy = 0;
+		panel.add(lblArmorprotectiveItem, gbc_lblArmorprotectiveItem);
+		
+		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 lblType = new JLabel("TYPE");
+		lblType.setHorizontalAlignment(SwingConstants.CENTER);
+		lblType.setForeground(Color.WHITE);
+		lblType.setOpaque(true);
+		lblType.setBackground(Color.BLACK);
+		lblType.setFont(new Font("Tahoma", Font.BOLD, 8));
+		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 = 1;
+		panel.add(lblType, gbc_lblType);
+		
+		JLabel lblAcBonus = new JLabel("AC BONUS");
+		lblAcBonus.setHorizontalAlignment(SwingConstants.CENTER);
+		lblAcBonus.setForeground(Color.WHITE);
+		lblAcBonus.setOpaque(true);
+		lblAcBonus.setBackground(Color.BLACK);
+		lblAcBonus.setFont(new Font("Tahoma", Font.BOLD, 8));
+		GridBagConstraints gbc_lblAcBonus = new GridBagConstraints();
+		gbc_lblAcBonus.fill = GridBagConstraints.HORIZONTAL;
+		gbc_lblAcBonus.insets = new Insets(0, 0, 0, 1);
+		gbc_lblAcBonus.gridx = 2;
+		gbc_lblAcBonus.gridy = 1;
+		panel.add(lblAcBonus, gbc_lblAcBonus);
+		
+		JLabel lblMaxDex = new JLabel("MAX DEX");
+		lblMaxDex.setHorizontalAlignment(SwingConstants.CENTER);
+		lblMaxDex.setForeground(Color.WHITE);
+		lblMaxDex.setOpaque(true);
+		lblMaxDex.setBackground(Color.BLACK);
+		lblMaxDex.setFont(new Font("Tahoma", Font.BOLD, 8));
+		GridBagConstraints gbc_lblMaxDex = new GridBagConstraints();
+		gbc_lblMaxDex.fill = GridBagConstraints.HORIZONTAL;
+		gbc_lblMaxDex.insets = new Insets(0, 0, 0, 1);
+		gbc_lblMaxDex.gridx = 3;
+		gbc_lblMaxDex.gridy = 1;
+		panel.add(lblMaxDex, gbc_lblMaxDex);
+		
+		armorNameField = new JTextField();
+		GridBagConstraints gbc_armorNameField = new GridBagConstraints();
+		gbc_armorNameField.insets = new Insets(0, 0, 0, 0);
+		gbc_armorNameField.fill = GridBagConstraints.HORIZONTAL;
+		gbc_armorNameField.gridx = 0;
+		gbc_armorNameField.gridy = 2;
+		panel.add(armorNameField, gbc_armorNameField);
+		armorNameField.setColumns(10);
+		
+		armorTypeField = new JTextField();
+		GridBagConstraints gbc_armorTypeField = new GridBagConstraints();
+		gbc_armorTypeField.insets = new Insets(0, 0, 0, 0);
+		gbc_armorTypeField.fill = GridBagConstraints.HORIZONTAL;
+		gbc_armorTypeField.gridx = 1;
+		gbc_armorTypeField.gridy = 2;
+		panel.add(armorTypeField, gbc_armorTypeField);
+		armorTypeField.setColumns(10);
+		
+		armorBonusField = new JTextField();
+		GridBagConstraints gbc_armorBonusField = new GridBagConstraints();
+		gbc_armorBonusField.insets = new Insets(0, 0, 0, 0);
+		gbc_armorBonusField.fill = GridBagConstraints.HORIZONTAL;
+		gbc_armorBonusField.gridx = 2;
+		gbc_armorBonusField.gridy = 2;
+		panel.add(armorBonusField, gbc_armorBonusField);
+		armorBonusField.setColumns(10);
+		
+		armorDexField = new JTextField();
+		GridBagConstraints gbc_armorDexField = new GridBagConstraints();
+		gbc_armorDexField.fill = GridBagConstraints.HORIZONTAL;
+		gbc_armorDexField.gridx = 3;
+		gbc_armorDexField.gridy = 2;
+		panel.add(armorDexField, gbc_armorDexField);
+		armorDexField.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, 0, 0};
+		gbl_panel_1.rowHeights = new int[]{0, 0, 0};
+		gbl_panel_1.columnWeights = new double[]{1.0, 1.0, 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 lblCheckPenalty = new JLabel("CHECK PENALTY");
+		lblCheckPenalty.setHorizontalAlignment(SwingConstants.CENTER);
+		lblCheckPenalty.setForeground(Color.WHITE);
+		lblCheckPenalty.setOpaque(true);
+		lblCheckPenalty.setBackground(Color.BLACK);
+		lblCheckPenalty.setFont(new Font("Tahoma", Font.BOLD, 8));
+		GridBagConstraints gbc_lblCheckPenalty = new GridBagConstraints();
+		gbc_lblCheckPenalty.fill = GridBagConstraints.BOTH;
+		gbc_lblCheckPenalty.insets = new Insets(0, 0, 0, 1);
+		gbc_lblCheckPenalty.gridx = 0;
+		gbc_lblCheckPenalty.gridy = 0;
+		panel_1.add(lblCheckPenalty, gbc_lblCheckPenalty);
+		
+		JLabel lblSpellFailure = new JLabel("SPELL FAILURE");
+		lblSpellFailure.setHorizontalAlignment(SwingConstants.CENTER);
+		lblSpellFailure.setForeground(Color.WHITE);
+		lblSpellFailure.setOpaque(true);
+		lblSpellFailure.setBackground(Color.BLACK);
+		lblSpellFailure.setFont(new Font("Tahoma", Font.BOLD, 8));
+		GridBagConstraints gbc_lblSpellFailure = new GridBagConstraints();
+		gbc_lblSpellFailure.fill = GridBagConstraints.BOTH;
+		gbc_lblSpellFailure.insets = new Insets(0, 0, 0, 1);
+		gbc_lblSpellFailure.gridx = 1;
+		gbc_lblSpellFailure.gridy = 0;
+		panel_1.add(lblSpellFailure, gbc_lblSpellFailure);
+		
+		JLabel lblSpeed = new JLabel("SPEED");
+		lblSpeed.setHorizontalAlignment(SwingConstants.CENTER);
+		lblSpeed.setForeground(Color.WHITE);
+		lblSpeed.setOpaque(true);
+		lblSpeed.setBackground(Color.BLACK);
+		lblSpeed.setFont(new Font("Tahoma", Font.BOLD, 8));
+		GridBagConstraints gbc_lblSpeed = new GridBagConstraints();
+		gbc_lblSpeed.fill = GridBagConstraints.BOTH;
+		gbc_lblSpeed.insets = new Insets(0, 0, 0, 1);
+		gbc_lblSpeed.gridx = 2;
+		gbc_lblSpeed.gridy = 0;
+		panel_1.add(lblSpeed, gbc_lblSpeed);
+		
+		JLabel lblWeight = new JLabel("WEIGHT");
+		lblWeight.setHorizontalAlignment(SwingConstants.CENTER);
+		lblWeight.setForeground(Color.WHITE);
+		lblWeight.setOpaque(true);
+		lblWeight.setBackground(Color.BLACK);
+		lblWeight.setFont(new Font("Tahoma", Font.BOLD, 8));
+		GridBagConstraints gbc_lblWeight = new GridBagConstraints();
+		gbc_lblWeight.fill = GridBagConstraints.BOTH;
+		gbc_lblWeight.insets = new Insets(0, 0, 0, 1);
+		gbc_lblWeight.gridx = 3;
+		gbc_lblWeight.gridy = 0;
+		panel_1.add(lblWeight, gbc_lblWeight);
+		
+		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 = 4;
+		gbc_lblSpecialProperties.gridy = 0;
+		panel_1.add(lblSpecialProperties, gbc_lblSpecialProperties);
+		
+		checkField = new JTextField();
+		GridBagConstraints gbc_checkField = new GridBagConstraints();
+		gbc_checkField.insets = new Insets(0, 0, 0, 0);
+		gbc_checkField.fill = GridBagConstraints.HORIZONTAL;
+		gbc_checkField.gridx = 0;
+		gbc_checkField.gridy = 1;
+		panel_1.add(checkField, gbc_checkField);
+		checkField.setColumns(10);
+		
+		spellField = new JTextField();
+		GridBagConstraints gbc_spellField = new GridBagConstraints();
+		gbc_spellField.insets = new Insets(0, 0, 0, 0);
+		gbc_spellField.fill = GridBagConstraints.HORIZONTAL;
+		gbc_spellField.gridx = 1;
+		gbc_spellField.gridy = 1;
+		panel_1.add(spellField, gbc_spellField);
+		spellField.setColumns(10);
+		
+		speedField = new JTextField();
+		GridBagConstraints gbc_speedField = new GridBagConstraints();
+		gbc_speedField.insets = new Insets(0, 0, 0, 0);
+		gbc_speedField.fill = GridBagConstraints.HORIZONTAL;
+		gbc_speedField.gridx = 2;
+		gbc_speedField.gridy = 1;
+		panel_1.add(speedField, gbc_speedField);
+		speedField.setColumns(10);
+		
+		weightField = new JTextField();
+		GridBagConstraints gbc_weightField = new GridBagConstraints();
+		gbc_weightField.insets = new Insets(0, 0, 0, 0);
+		gbc_weightField.fill = GridBagConstraints.HORIZONTAL;
+		gbc_weightField.gridx = 3;
+		gbc_weightField.gridy = 1;
+		panel_1.add(weightField, gbc_weightField);
+		weightField.setColumns(10);
+		
+		propField = new JTextField();
+		GridBagConstraints gbc_propField = new GridBagConstraints();
+		gbc_propField.fill = GridBagConstraints.HORIZONTAL;
+		gbc_propField.gridx = 4;
+		gbc_propField.gridy = 1;
+		panel_1.add(propField, gbc_propField);
+		propField.setColumns(10);
+		// TODO Auto-generated constructor stub
+	}
+
+}