package editor.views;

import javax.swing.*;
import java.awt.*;
import java.util.HashMap;

/**
 * The AttributesPanelView is used to show all of the attributes of an XML
 * element in an editable form.
 * @see xml.Element
 */
public class AttributesPanelView extends JPanel {
    private JPanel attributesPanel;

    /**
     * Initialize the AttributesPanelView with no data
     */
    public AttributesPanelView() {
        setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
        add(new JLabel("Attributes"));

        attributesPanel = new JPanel();
        attributesPanel.setLayout(new GridLayout());
        attributesPanel.add(new JTextField("", 10));
        attributesPanel.add(new JTextField("", 10));
        add(attributesPanel);
    }
}

@@ -53,24 +53,52 @@
 java.awt.*;%0A
+import java.util.ArrayList;%0A
 import java.
@@ -332,16 +332,127 @@
 esPanel;
+%0A    private ArrayList%3CJTextField%3E attributeNameFields;%0A    private ArrayList%3CJTextField%3E attributeValueFields;
 %0A%0A    /*
@@ -551,16 +551,136 @@
 iew() %7B%0A
+        attributeNameFields = new ArrayList%3CJTextField%3E();%0A        attributeValueFields = new ArrayList%3CJTextField%3E();%0A%0A
         
@@ -871,35 +871,282 @@
        a
-ttributesPanel.add(
+ddAttribute();%0A        add(attributesPanel);%0A    %7D%0A%0A    /**%0A     * Add more space for another attribute to be added. This adds a field for%0A     * the attribute's name and another for its value.%0A     */%0A    public void addAttribute() %7B%0A        JTextField nameField = 
 new JTex
@@ -1151,33 +1151,32 @@
 extField(%22%22, 10)
-)
 ;%0A        attrib
@@ -1185,24 +1185,113 @@
 esPanel.add(
+nameField);%0A        attributeNameFields.add(nameField);%0A%0A        JTextField valueField = 
 new JTextFie
@@ -1300,17 +1300,16 @@
 (%22%22, 10)
-)
 ;%0A      
@@ -1303,36 +1303,32 @@
 , 10);%0A        a
-dd(a
 ttributesPanel);
@@ -1315,29 +1315,90 @@
    attributesPan
+el.add(valueField);%0A        attributeValueFields.add(valueFi
 el
+d
 );%0A    %7D%0A%7D%0A

Make number of attributes in editor variable