<commit_before>package devopsdistilled.operp.client.items.panes;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.inject.Inject;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;

import net.miginfocom.swing.MigLayout;
import devopsdistilled.operp.client.abstracts.SubTaskPane;
import devopsdistilled.operp.client.items.exceptions.EntityNameExistsException;
import devopsdistilled.operp.client.items.exceptions.NullFieldException;
import devopsdistilled.operp.client.items.panes.controllers.CreateManufacturerPaneController;
import devopsdistilled.operp.client.items.panes.models.observers.CreateManufacturerPaneModelObserver;
import devopsdistilled.operp.server.data.entity.items.Manufacturer;

public class CreateManufacturerPane extends SubTaskPane implements
		CreateManufacturerPaneModelObserver {

	@Inject
	private CreateManufacturerPaneController controller;

	private final JPanel pane;
	private final JTextField manufacturerNameField;

	public CreateManufacturerPane() {
		pane = new JPanel();
		pane.setLayout(new MigLayout("", "[][grow]", "[][]"));

		JLabel lblManufacturerName = new JLabel("Manufacturer Name");
		pane.add(lblManufacturerName, "cell 0 0,alignx trailing");

		manufacturerNameField = new JTextField();
		pane.add(manufacturerNameField, "cell 1 0,growx");
		manufacturerNameField.setColumns(10);

		JButton btnCancel = new JButton("Cancel");
		btnCancel.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				getDialog().dispose();
			}
		});
		pane.add(btnCancel, "flowx,cell 1 1");

		JButton btnCreate = new JButton("Create");
		btnCreate.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				Manufacturer manufacturer = new Manufacturer();
				String manufactuerName = manufacturerNameField.getText().trim();
				manufacturer.setManufacturerName(manufactuerName);

				try {
					controller.validate(manufacturer);
					manufacturer = controller.save(manufacturer);

				} catch (NullFieldException | EntityNameExistsException e1) {
					JOptionPane.showMessageDialog(getPane(), e1.getMessage());
				}
			}
		});
		pane.add(btnCreate, "cell 1 1");
	}

	@Override
	public JComponent getPane() {
		return pane;
	}

}
<commit_msg>Close "Create" dialog after creating<commit_after>package devopsdistilled.operp.client.items.panes;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.inject.Inject;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;

import net.miginfocom.swing.MigLayout;
import devopsdistilled.operp.client.abstracts.SubTaskPane;
import devopsdistilled.operp.client.items.exceptions.EntityNameExistsException;
import devopsdistilled.operp.client.items.exceptions.NullFieldException;
import devopsdistilled.operp.client.items.panes.controllers.CreateManufacturerPaneController;
import devopsdistilled.operp.client.items.panes.models.observers.CreateManufacturerPaneModelObserver;
import devopsdistilled.operp.server.data.entity.items.Manufacturer;

public class CreateManufacturerPane extends SubTaskPane implements
		CreateManufacturerPaneModelObserver {

	@Inject
	private CreateManufacturerPaneController controller;

	private final JPanel pane;
	private final JTextField manufacturerNameField;

	public CreateManufacturerPane() {
		pane = new JPanel();
		pane.setLayout(new MigLayout("", "[][grow]", "[][]"));

		JLabel lblManufacturerName = new JLabel("Manufacturer Name");
		pane.add(lblManufacturerName, "cell 0 0,alignx trailing");

		manufacturerNameField = new JTextField();
		pane.add(manufacturerNameField, "cell 1 0,growx");
		manufacturerNameField.setColumns(10);

		JButton btnCancel = new JButton("Cancel");
		btnCancel.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				getDialog().dispose();
			}
		});
		pane.add(btnCancel, "flowx,cell 1 1");

		JButton btnCreate = new JButton("Create");
		btnCreate.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				Manufacturer manufacturer = new Manufacturer();
				String manufactuerName = manufacturerNameField.getText().trim();
				manufacturer.setManufacturerName(manufactuerName);

				try {
					controller.validate(manufacturer);
					manufacturer = controller.save(manufacturer);

					getDialog().dispose();

				} catch (NullFieldException | EntityNameExistsException e1) {
					JOptionPane.showMessageDialog(getPane(), e1.getMessage());
				}
			}
		});
		pane.add(btnCreate, "cell 1 1");
	}

	@Override
	public JComponent getPane() {
		return pane;
	}

}

{'fraction_non_alphanumeric': 0.10468431771894093, 'fraction_numerical': 0.004887983706720978, 'mean_word_length': 5.75515818431912, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '684027', 'n_tokens_mistral': 1650, 'n_tokens_neox': 1472, 'n_words': 273}