<commit_before>package com.im.lac.portal.webapp;

import com.im.lac.portal.service.DatasetInputStreamFormat;
import com.im.lac.portal.service.PrototypeServiceMock;
import com.im.lac.wicket.semantic.SemanticModalPanel;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
import org.apache.wicket.markup.html.form.Form;

import javax.inject.Inject;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;

public class UploadFilePanel extends SemanticModalPanel {

    @Inject
    private PrototypeServiceMock prototypeServiceMock;

    public UploadFilePanel(String id, String modalElementWicketId) {
        super(id, modalElementWicketId);
        addForm();
    }

    private void addForm() {
        Form form = new Form("form");
        form.setOutputMarkupId(true);
        getModalRootComponent().add(form);

        final AjaxSubmitLink submit = new AjaxSubmitLink("save") {

            @Override
            protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            }
        };
        submit.setOutputMarkupId(true);
        form.add(submit);

        AjaxLink cancelAction = new AjaxLink("cancel") {

            @Override
            public void onClick(AjaxRequestTarget ajaxRequestTarget) {
                hideModal();
            }
        };
        form.add(cancelAction);

        FileUploadPanel fileUploadPanel = new FileUploadPanel("upload", true);
        fileUploadPanel.setCallbackHandler(new FileUploadPanel.CallbackHandler() {

            @Override
            public void onUpload(String clientFileName, InputStream inputStream, AjaxRequestTarget target) throws IOException {
                Map<String, Class> properties = new HashMap<String, Class>();
                properties.put("set", Integer.class);
                prototypeServiceMock.createDataset(DatasetInputStreamFormat.SDF, inputStream, properties);
            }

            @Override<commit_msg>Upload SDF file.<commit_after>package com.im.lac.portal.webapp;

import com.im.lac.portal.service.DatasetInputStreamFormat;
import com.im.lac.portal.service.PrototypeServiceMock;
import com.im.lac.wicket.semantic.SemanticModalPanel;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
import org.apache.wicket.markup.html.form.Form;

import javax.inject.Inject;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;

public class UploadFilePanel extends SemanticModalPanel {

    @Inject
    private PrototypeServiceMock prototypeServiceMock;

    public UploadFilePanel(String id, String modalElementWicketId) {
        super(id, modalElementWicketId);
        addForm();
    }

    private void addForm() {
        Form form = new Form("form");
        form.setOutputMarkupId(true);
        getModalRootComponent().add(form);

        final AjaxSubmitLink submit = new AjaxSubmitLink("save") {

            @Override
            protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            }
        };
        submit.setOutputMarkupId(true);
        form.add(submit);

        AjaxLink cancelAction = new AjaxLink("cancel") {

            @Override
            public void onClick(AjaxRequestTarget ajaxRequestTarget) {
                hideModal();
            }
        };
        form.add(cancelAction);

        FileUploadPanel fileUploadPanel = new FileUploadPanel("upload", true);
        fileUploadPanel.setCallbackHandler(new FileUploadPanel.CallbackHandler() {

            @Override
            public void onUpload(String clientFileName, InputStream inputStream, AjaxRequestTarget target) throws IOException {
                Map<String, Class> properties = new HashMap<String, Class>();
                prototypeServiceMock.createDataset(DatasetInputStreamFormat.SDF, inputStream, properties);
            }

            @Override
{'fraction_non_alphanumeric': 0.09250671222845985, 'fraction_numerical': 0.0, 'mean_word_length': 3.0176470588235293, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2895590', 'n_tokens_mistral': 1115, 'n_tokens_neox': 1091, 'n_words': 213}