package ryhma57.gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;

/**
 * This component will contain the references.
 * It is currently under construction.
 */
public class ListView extends JPanel {
    private final Application app;
    private int length;

    public void createRow(String id, String name) {
        GridBagConstraints c = new GridBagConstraints();
        c.fill = GridBagConstraints.NONE;
        c.gridx = 0;
        c.gridy = this.length++;
        c.gridwidth = 1;
        c.weightx = c.weighty = 0.0;
        c.ipadx = c.ipady = 10;
        c.anchor = GridBagConstraints.WEST;

        JLabel idLabel = new JLabel(id);
        JLabel nameLabel = new JLabel(name);
        idLabel.setHorizontalAlignment(SwingConstants.LEFT);
        nameLabel.setHorizontalAlignment(SwingConstants.LEFT);
        this.add(idLabel, c);
        c.gridx = 1;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.gridwidth = 3;
        c.weightx = 1.0;
        this.add(nameLabel, c);
        this.revalidate();
    }

    public ListView(Application app) {
        this.app = app;
        this.length = 0;
        this.setLayout(new GridBagLayout());

        createRow("test2010", "This is test reference");
    }
}

@@ -592,117 +592,937 @@
 th;%0A
-%0A    public void createRow(String id, String name) %7B%0A        GridBagConstraints c = new GridBagConstraints();
+    private JLabel placeholder;%0A%0A    public ListView(Application app) %7B%0A        this.app = app;%0A        this.length = 0;%0A        this.setLayout(new GridBagLayout());%0A%0A        createPlaceHolder();%0A    %7D%0A%0A    public final void createPlaceHolder() %7B%0A        GridBagConstraints c = new GridBagConstraints();%0A        c.fill = GridBagConstraints.NONE;%0A        c.gridx = 0;%0A        c.gridy = this.length++;%0A        c.gridwidth = 2;%0A        c.weightx = c.weighty = 1.0;%0A        c.ipadx = c.ipady = 10;%0A        c.anchor = GridBagConstraints.CENTER;%0A%0A        this.placeholder = new JLabel(%22No references created%22);%0A        this.add(this.placeholder, c);%0A        this.revalidate();%0A    %7D%0A%0A    public void createRow(String id, String name) %7B%0A        GridBagConstraints c = new GridBagConstraints();%0A%0A        /* Remove the placeholder */%0A        if(this.placeholder.getParent() == this) %7B%0A            this.remove(this.placeholder);%0A        %7D%0A
 %0A   
@@ -1843,132 +1843,8 @@
 e);%0A
-        idLabel.setHorizontalAlignment(SwingConstants.LEFT);%0A        nameLabel.setHorizontalAlignment(SwingConstants.LEFT);%0A
     
@@ -2056,205 +2056,7 @@
    %7D
-%0A%0A    public ListView(Application app) %7B%0A        this.app = app;%0A        this.length = 0;%0A        this.setLayout(new GridBagLayout());%0A%0A        createRow(%22test2010%22, %22This is test reference%22);%0A    %7D
 %0A%7D%0A

Add placeholder to the list.