<commit_before>package org.safehaus.kiskis.mgmt.ui.hive.query.components;

import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.terminal.Sizeable;
import com.vaadin.ui.AbstractSelect;
import com.vaadin.ui.Select;
import org.safehaus.kiskis.mgmt.api.hive.query.Config;
import org.safehaus.kiskis.mgmt.ui.hive.query.HiveQueryUI;

import java.util.List;

/**
 * Created by daralbaev on 11.05.14.
 */
public class QueryList extends Select {

    public QueryList() {

        setFilteringMode(AbstractSelect.Filtering.FILTERINGMODE_CONTAINS);
        setNullSelectionAllowed(false);

        this.setWidth("100%");
        this.setHeight(100, Sizeable.UNITS_PERCENTAGE);

        this.setImmediate(true);
        refreshDataSource();
    }

    public void refreshDataSource() {
        List<Config> list = HiveQueryUI.getManager().load();

        BeanItemContainer<Config> beans =
                new BeanItemContainer<>(Config.class);

        for (Config item : list) {
            beans.addBean(item);
        }

        setContainerDataSource(beans);
        setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
        setItemCaptionPropertyId("name");
    }
}<commit_msg>-m Adding Hive Query API SUBUTAI-673 SUBUTAI-664<commit_after>package org.safehaus.kiskis.mgmt.ui.hive.query.components;

import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.terminal.Sizeable;
import com.vaadin.ui.AbstractSelect;
import com.vaadin.ui.Select;
import org.safehaus.kiskis.mgmt.api.hive.query.Config;
import org.safehaus.kiskis.mgmt.ui.hive.query.HiveQueryUI;

import java.util.List;

/**
 * Created by daralbaev on 11.05.14.
 */
public class QueryList extends Select {

    public QueryList() {

        setFilteringMode(AbstractSelect.Filtering.FILTERINGMODE_CONTAINS);
        setNullSelectionAllowed(false);

        this.setWidth("100%");
        this.setHeight(100, Sizeable.UNITS_PERCENTAGE);

        this.setImmediate(true);
        refreshDataSource();
    }

    public void refreshDataSource() {
        List<Config> list = HiveQueryUI.getManager().load();

        BeanItemContainer<Config> beans =
                new BeanItemContainer<Config>(Config.class);

        for (Config item : list) {
            beans.addBean(item);
        }

        setContainerDataSource(beans);
        setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY);
        setItemCaptionPropertyId("name");
    }
}
{'fraction_non_alphanumeric': 0.11202976436544027, 'fraction_numerical': 0.012401818933443571, 'mean_word_length': 3.26056338028169, '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': '3116503', 'n_tokens_mistral': 800, 'n_tokens_neox': 752, 'n_words': 112}