public GetDataBySubjectPanel(JFrame frame, QueryDefinition query) throws Exception {
		super(frame, query, new GetDataBySubject(query.getDocument()));
		
		JTabbedPane panel = new JTabbedPane();

		//
		// Defines the "Subject IDs" tab.
		/////////////////////////////
		ItemSet<SubjectID> subItems = new ItemSet<SubjectID>() {

			@Override
			public void add(SubjectID item) {
				GetDataBySubjectPanel.this.getRequest().addSubject(item);
				stateChanged(new GetDatabySubjectPanelChangeEvent(GetDataBySubjectPanel.this));
			}

			@Override
			public void remove(SubjectID item) {
				GetDataBySubjectPanel.this.getRequest().removeSubject(item);
				stateChanged(new GetDatabySubjectPanelChangeEvent(GetDataBySubjectPanel.this));
			}

			@Override
			public int size() {
				return GetDataBySubjectPanel.this.getRequest().getSubjectCount();
			}

			@Override
			public SubjectID get(int index) {
				return GetDataBySubjectPanel.this.getRequest().getSubject(index);
			}

			@Override
			public void set(int index, String name, Object value) {
				SubjectID id = this.get(index);
				if(name.equals("Contributor")) {
					id.setContributor((Contributor) value);
				} else if(name.equals("Value")) {
					id.setValue((String) value);
				}
				GetDataBySubjectPanel.this.getRequest().notifyChange();
				stateChanged(new GetDatabySubjectPanelChangeEvent(GetDataBySubjectPanel.this));
			}
		};
		
		ItemTablePanel<SubjectID> subjectsPanel = new ItemTablePanel<SubjectID>(SubjectID.class, subItems);
		panel.add("Subject IDs", subjectsPanel);		
		
		//
		// Defines the "Parameters" tab.
		/////////////////////////////
		ItemSet<Parameter> paramItems = new ItemSet<Parameter>() {

			@Override
			public void add(Parameter item) {
				GetDataBySubjectPanel.this.getRequest().addParameter(item);
				stateChanged(new GetDatabySubjectPanelChangeEvent(GetDataBySubjectPanel.this));
			}

			@Override
			public void remove(Parameter item) {
				GetDataBySubjectPanel.this.getRequest().removeParameters(item);
				stateChanged(new GetDatabySubjectPanelChangeEvent(GetDataBySubjectPanel.this));
			}

			@Override
			public int size() {
				return GetDataBySubjectPanel.this.getRequest().getParameterCount();
			}

			@Override
			public Parameter get(int index) {
				return GetDataBySubjectPanel.this.getRequest().getParameter(index);
			}			
			
			@Override
			public void set(int index, String name, Object value) {
				Parameter id = this.get(index);
				if(name.equals("Name")) {
					id.setName((String) value);
				} else if(name.equals("Value")) {
					id.setValue((String) value);
				}
				GetDataBySubjectPanel.this.getRequest().notifyChange();
				stateChanged(new GetDatabySubjectPanelChangeEvent(GetDataBySubjectPanel.this));
			}
		};

		ItemTablePanel<Parameter> paramsPanel = new ItemTablePanel<Parameter>(Parameter.class, paramItems);
		panel.add("Parameters", paramsPanel);		

		//
		// Defines the "Logs" tab.
		/////////////////////////////
		ItemSet<LogEntry> logItems = new ItemSet<LogEntry>() {

			@Override
			public void add(LogEntry item) {
				GetDataBySubjectPanel.this.getRequest().addLog(item);
				stateChanged(new GetDatabySubjectPanelChangeEvent(GetDataBySubjectPanel.this));
			}

			@Override
			public void remove(LogEntry item) {
				GetDataBySubjectPanel.this.getRequest().removeLog(item);
				stateChanged(new GetDatabySubjectPanelChangeEvent(GetDataBySubjectPanel.this));
			}

			@Override
			public int size() {
				return GetDataBySubjectPanel.this.getRequest().getLogCount();
			}

			@Override
			public LogEntry get(int index) {
				return GetDataBySubjectPanel.this.getRequest().getLog(index);
			}			

			@Override
			public void set(int index, String name, Object value) {
				LogEntry id = this.get(index);
				if(name.equals("Value")) {
					id.setValue((String) value);
				}
				GetDataBySubjectPanel.this.getRequest().notifyChange();
				stateChanged(new GetDatabySubjectPanelChangeEvent(GetDataBySubjectPanel.this));
			}
		};
		
		ItemTablePanel<LogEntry> logPanel = new ItemTablePanel<LogEntry>(LogEntry.class, logItems);
		panel.add("Logs", logPanel);		
		
		//
		// Defines the "other" tab.
		/////////////////////////////
		
		JPanel otherPanel = new JPanel();
		otherPanel.setLayout(new GridBagLayout());
		GridBagConstraints cMain = new GridBagConstraints();
		cMain.fill = GridBagConstraints.HORIZONTAL;
		cMain.anchor = GridBagConstraints.PAGE_START;
		cMain.gridx = 0;
		cMain.gridy = 0;

		JPanel trxIdPanel = new JPanel();
		GridBagConstraints c = new GridBagConstraints();
		trxIdPanel.setLayout(new GridBagLayout());
		otherPanel.add(trxIdPanel, cMain);
		
		panel.add("Other", otherPanel);
		
		trxIdPanel.setBorder(BorderFactory.createTitledBorder("Transaction ID"));
		
		this.btnGroup = new ButtonGroup();
		
		ActionListener btnActions = new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				if(GetDataBySubjectPanel.this.rdoBtnStatic.isSelected()) {
					GetDataBySubjectPanel.this.trxIdTextField.setEditable(true);
					GetDataBySubjectPanel.this.trxIdTextField.grabFocus();
					GetDataBySubjectPanel.this.getRequest().setTransactionIDMode(TransactionMode.Static);
				} else if(GetDataBySubjectPanel.this.rdoBtnRandom.isSelected()) {
					GetDataBySubjectPanel.this.trxIdTextField.setEditable(false);
					GetDataBySubjectPanel.this.getRequest().setTransactionIDMode(TransactionMode.Random);
				} else if(GetDataBySubjectPanel.this.rdoBtnNone.isSelected()) {
					GetDataBySubjectPanel.this.trxIdTextField.setEditable(false);
					GetDataBySubjectPanel.this.getRequest().setTransactionIDMode(TransactionMode.None);
				}
			}
		};
		
		this.rdoBtnNone = new JRadioButton("None", true);
		this.rdoBtnNone.addActionListener(btnActions);
		this.btnGroup.add(this.rdoBtnNone);

		c.fill = GridBagConstraints.HORIZONTAL;
		c.anchor = GridBagConstraints.NORTHWEST;
		c.gridx = 0;
		c.gridy = 0;
		
		trxIdPanel.add(this.rdoBtnNone, c);

		this.rdoBtnRandom = new JRadioButton("Random");
		this.rdoBtnRandom.addActionListener(btnActions);
		this.btnGroup.add(this.rdoBtnRandom);

		c.gridx = 0;
		c.gridy = 1;
		
		trxIdPanel.add(this.rdoBtnRandom, c);
		
		this.rdoBtnStatic = new JRadioButton("Static");
		this.rdoBtnStatic.addActionListener(btnActions);
		this.btnGroup.add(this.rdoBtnStatic);

		c.gridx = 0;
		c.gridy = 2;

		trxIdPanel.add(this.rdoBtnStatic, c);

		this.trxIdTextField = new JTextField();
		this.trxIdTextField.addActionListener(this);
		this.trxIdTextField.setEditable(false);
		
		c.fill = GridBagConstraints.HORIZONTAL;
		c.weightx = 0.5;
		c.gridx = 1;
		c.gridy = 2;
				
		trxIdPanel.add(this.trxIdTextField, c);

		JPanel bufferPanel = new JPanel();
		cMain.gridx = 0;
		cMain.gridy = 1;
		cMain.weightx = 1;
		cMain.weighty = 1;
		otherPanel.add(bufferPanel, cMain);
		
		this.trxIdTextField.getDocument().addDocumentListener(new DocumentListener() {

			@Override
			public void changedUpdate(DocumentEvent arg0) {
				String text = GetDataBySubjectPanel.this.trxIdTextField.getText();
				GetDataBySubjectPanel.this.getRequest().setTransactionId(text);
				stateChanged(null);
			}

			@Override
			public void insertUpdate(DocumentEvent arg0) {
				this.changedUpdate(arg0);
			}

			@Override
			public void removeUpdate(DocumentEvent arg0) {
				this.changedUpdate(arg0);
			}				
		});

		this.addFirstTab("Fields", panel);
	}