|
|
@@ -0,0 +1,234 @@
|
|
|
+package org.leumasjaffe.charsheet.view.inventory;
|
|
|
+
|
|
|
+import java.awt.GridBagConstraints;
|
|
|
+import java.awt.GridBagLayout;
|
|
|
+
|
|
|
+import javax.swing.JPanel;
|
|
|
+
|
|
|
+import org.leumasjaffe.charsheet.model.inventory.DDItem;
|
|
|
+import org.leumasjaffe.format.StringHelper;
|
|
|
+
|
|
|
+import java.awt.Insets;
|
|
|
+import javax.swing.JLabel;
|
|
|
+import java.awt.Color;
|
|
|
+import java.awt.Font;
|
|
|
+import javax.swing.SwingConstants;
|
|
|
+import java.awt.Component;
|
|
|
+import java.awt.Dimension;
|
|
|
+
|
|
|
+import javax.swing.Box;
|
|
|
+import javax.swing.JTextField;
|
|
|
+
|
|
|
+class ItemInfoPanel extends JPanel {
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ */
|
|
|
+ private static final long serialVersionUID = 1L;
|
|
|
+
|
|
|
+ public ItemInfoPanel(final DDItem item) {
|
|
|
+ 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[]{1.0, 1.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[]{120, 0, 0, 0};
|
|
|
+ gbl_panel.rowHeights = new int[]{0, 0, 0, 0};
|
|
|
+ gbl_panel.columnWeights = new double[]{1.0, 0.0, 0.0, Double.MIN_VALUE};
|
|
|
+ gbl_panel.rowWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
|
|
|
+ panel.setLayout(gbl_panel);
|
|
|
+
|
|
|
+ JLabel lblName = new JLabel("ITEM NAME");
|
|
|
+ lblName.setOpaque(true);
|
|
|
+ lblName.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ lblName.setForeground(Color.WHITE);
|
|
|
+ lblName.setFont(new Font("Tahoma", Font.BOLD, 10));
|
|
|
+ lblName.setBackground(Color.BLACK);
|
|
|
+ GridBagConstraints gbc_lblName = new GridBagConstraints();
|
|
|
+ gbc_lblName.fill = GridBagConstraints.BOTH;
|
|
|
+ gbc_lblName.gridheight = 2;
|
|
|
+ gbc_lblName.insets = new Insets(0, 0, 0, 1);
|
|
|
+ gbc_lblName.gridx = 0;
|
|
|
+ gbc_lblName.gridy = 0;
|
|
|
+ panel.add(lblName, gbc_lblName);
|
|
|
+
|
|
|
+ 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, 1);
|
|
|
+ gbc_verticalStrut.fill = GridBagConstraints.HORIZONTAL;
|
|
|
+ gbc_verticalStrut.gridx = 1;
|
|
|
+ gbc_verticalStrut.gridy = 0;
|
|
|
+ panel.add(verticalStrut, gbc_verticalStrut);
|
|
|
+
|
|
|
+ JLabel lblWeight = new JLabel("WEIGHT");
|
|
|
+ lblWeight.setOpaque(true);
|
|
|
+ lblWeight.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ lblWeight.setForeground(Color.WHITE);
|
|
|
+ lblWeight.setFont(new Font("Tahoma", Font.BOLD, 8));
|
|
|
+ lblWeight.setBackground(Color.BLACK);
|
|
|
+ GridBagConstraints gbc_lblWeight = new GridBagConstraints();
|
|
|
+ gbc_lblWeight.fill = GridBagConstraints.HORIZONTAL;
|
|
|
+ gbc_lblWeight.insets = new Insets(0, 0, 0, 1);
|
|
|
+ gbc_lblWeight.gridx = 1;
|
|
|
+ gbc_lblWeight.gridy = 1;
|
|
|
+ panel.add(lblWeight, gbc_lblWeight);
|
|
|
+
|
|
|
+ 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, 1, 0);
|
|
|
+ gbc_lblPage.gridx = 2;
|
|
|
+ gbc_lblPage.gridy = 1;
|
|
|
+ panel.add(lblPage, gbc_lblPage);
|
|
|
+
|
|
|
+ JTextField txtName = new JTextField(item.getName());
|
|
|
+ txtName.setEditable(false);
|
|
|
+ txtName.setColumns(10);
|
|
|
+ GridBagConstraints gbc_txtName = new GridBagConstraints();
|
|
|
+ gbc_txtName.insets = new Insets(0, 0, 0, 0);
|
|
|
+ gbc_txtName.fill = GridBagConstraints.HORIZONTAL;
|
|
|
+ gbc_txtName.gridx = 0;
|
|
|
+ gbc_txtName.gridy = 2;
|
|
|
+ panel.add(txtName, gbc_txtName);
|
|
|
+
|
|
|
+ JTextField txtWeight = new JTextField(StringHelper.toString(item.getWeight()) + " lb.");
|
|
|
+ txtWeight.setEditable(false);
|
|
|
+ txtWeight.setColumns(10);
|
|
|
+ GridBagConstraints gbc_txtWeight = new GridBagConstraints();
|
|
|
+ gbc_txtWeight.insets = new Insets(0, 0, 0, 0);
|
|
|
+ gbc_txtWeight.fill = GridBagConstraints.HORIZONTAL;
|
|
|
+ gbc_txtWeight.gridx = 1;
|
|
|
+ gbc_txtWeight.gridy = 2;
|
|
|
+ panel.add(txtWeight, gbc_txtWeight);
|
|
|
+
|
|
|
+ JTextField txtPage = new JTextField(StringHelper.toString(item.getPage()));
|
|
|
+ txtPage.setEditable(false);
|
|
|
+ txtPage.setColumns(10);
|
|
|
+ GridBagConstraints gbc_txtPage = new GridBagConstraints();
|
|
|
+ gbc_txtPage.fill = GridBagConstraints.HORIZONTAL;
|
|
|
+ gbc_txtPage.gridx = 2;
|
|
|
+ gbc_txtPage.gridy = 2;
|
|
|
+ panel.add(txtPage, gbc_txtPage);
|
|
|
+
|
|
|
+ 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};
|
|
|
+ gbl_panel_1.rowHeights = new int[]{0, 0, 0};
|
|
|
+ gbl_panel_1.columnWeights = new double[]{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 lblPp = new JLabel("pp");
|
|
|
+ GridBagConstraints gbc_lblPp = new GridBagConstraints();
|
|
|
+ gbc_lblPp.fill = GridBagConstraints.HORIZONTAL;
|
|
|
+ gbc_lblPp.insets = new Insets(0, 0, 0, 1);
|
|
|
+ gbc_lblPp.gridx = 0;
|
|
|
+ gbc_lblPp.gridy = 0;
|
|
|
+ panel_1.add(lblPp, gbc_lblPp);
|
|
|
+ lblPp.setOpaque(true);
|
|
|
+ lblPp.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ lblPp.setForeground(Color.WHITE);
|
|
|
+ lblPp.setFont(new Font("Tahoma", Font.BOLD, 8));
|
|
|
+ lblPp.setBackground(Color.BLACK);
|
|
|
+
|
|
|
+ JLabel lblGp = new JLabel("gp");
|
|
|
+ GridBagConstraints gbc_lblGp = new GridBagConstraints();
|
|
|
+ gbc_lblGp.fill = GridBagConstraints.HORIZONTAL;
|
|
|
+ gbc_lblGp.insets = new Insets(0, 0, 0, 1);
|
|
|
+ gbc_lblGp.gridx = 1;
|
|
|
+ gbc_lblGp.gridy = 0;
|
|
|
+ panel_1.add(lblGp, gbc_lblGp);
|
|
|
+ lblGp.setOpaque(true);
|
|
|
+ lblGp.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ lblGp.setForeground(Color.WHITE);
|
|
|
+ lblGp.setFont(new Font("Tahoma", Font.BOLD, 8));
|
|
|
+ lblGp.setBackground(Color.BLACK);
|
|
|
+
|
|
|
+ JLabel lblSp = new JLabel("sp");
|
|
|
+ GridBagConstraints gbc_lblSp = new GridBagConstraints();
|
|
|
+ gbc_lblSp.fill = GridBagConstraints.HORIZONTAL;
|
|
|
+ gbc_lblSp.insets = new Insets(0, 0, 0, 1);
|
|
|
+ gbc_lblSp.gridx = 2;
|
|
|
+ gbc_lblSp.gridy = 0;
|
|
|
+ panel_1.add(lblSp, gbc_lblSp);
|
|
|
+ lblSp.setOpaque(true);
|
|
|
+ lblSp.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ lblSp.setForeground(Color.WHITE);
|
|
|
+ lblSp.setFont(new Font("Tahoma", Font.BOLD, 8));
|
|
|
+ lblSp.setBackground(Color.BLACK);
|
|
|
+
|
|
|
+ JLabel lblCp = new JLabel("cp");
|
|
|
+ GridBagConstraints gbc_lblCp = new GridBagConstraints();
|
|
|
+ gbc_lblCp.insets = new Insets(0, 0, 0, 1);
|
|
|
+ gbc_lblCp.fill = GridBagConstraints.HORIZONTAL;
|
|
|
+ gbc_lblCp.gridx = 3;
|
|
|
+ gbc_lblCp.gridy = 0;
|
|
|
+ panel_1.add(lblCp, gbc_lblCp);
|
|
|
+ lblCp.setOpaque(true);
|
|
|
+ lblCp.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
+ lblCp.setForeground(Color.WHITE);
|
|
|
+ lblCp.setFont(new Font("Tahoma", Font.BOLD, 8));
|
|
|
+ lblCp.setBackground(Color.BLACK);
|
|
|
+
|
|
|
+ JTextField txtPP = new JTextField(StringHelper.toString(item.getValue().getPp()));
|
|
|
+ GridBagConstraints gbc_txtPP = new GridBagConstraints();
|
|
|
+ gbc_txtPP.fill = GridBagConstraints.HORIZONTAL;
|
|
|
+ gbc_txtPP.insets = new Insets(0, 0, 0, 0);
|
|
|
+ gbc_txtPP.gridx = 0;
|
|
|
+ gbc_txtPP.gridy = 1;
|
|
|
+ panel_1.add(txtPP, gbc_txtPP);
|
|
|
+ txtPP.setEditable(false);
|
|
|
+ txtPP.setColumns(5);
|
|
|
+
|
|
|
+ JTextField txtGP = new JTextField(StringHelper.toString(item.getValue().getGp()));
|
|
|
+ GridBagConstraints gbc_txtGP = new GridBagConstraints();
|
|
|
+ gbc_txtGP.fill = GridBagConstraints.HORIZONTAL;
|
|
|
+ gbc_txtGP.insets = new Insets(0, 0, 0, 0);
|
|
|
+ gbc_txtGP.gridx = 1;
|
|
|
+ gbc_txtGP.gridy = 1;
|
|
|
+ panel_1.add(txtGP, gbc_txtGP);
|
|
|
+ txtGP.setEditable(false);
|
|
|
+ txtGP.setColumns(5);
|
|
|
+
|
|
|
+ JTextField txtSP = new JTextField(StringHelper.toString(item.getValue().getSp()));
|
|
|
+ GridBagConstraints gbc_txtSP = new GridBagConstraints();
|
|
|
+ gbc_txtSP.fill = GridBagConstraints.HORIZONTAL;
|
|
|
+ gbc_txtSP.insets = new Insets(0, 0, 0, 0);
|
|
|
+ gbc_txtSP.gridx = 2;
|
|
|
+ gbc_txtSP.gridy = 1;
|
|
|
+ panel_1.add(txtSP, gbc_txtSP);
|
|
|
+ txtSP.setEditable(false);
|
|
|
+ txtSP.setColumns(5);
|
|
|
+
|
|
|
+ JTextField txtCP = new JTextField(StringHelper.toString(item.getValue().getCp()));
|
|
|
+ GridBagConstraints gbc_txtCP = new GridBagConstraints();
|
|
|
+ gbc_txtCP.fill = GridBagConstraints.HORIZONTAL;
|
|
|
+ gbc_txtCP.gridx = 3;
|
|
|
+ gbc_txtCP.gridy = 1;
|
|
|
+ panel_1.add(txtCP, gbc_txtCP);
|
|
|
+ txtCP.setEditable(false);
|
|
|
+ txtCP.setColumns(5);
|
|
|
+ }
|
|
|
+}
|