<commit_before>package org.jboss.as.console.client.domain.groups;

import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import org.jboss.as.console.client.Console;
import org.jboss.as.console.client.domain.model.ServerGroupRecord;
import org.jboss.as.console.client.shared.help.FormHelpPanel;
import org.jboss.as.console.client.widgets.forms.FormToolStrip;
import org.jboss.ballroom.client.widgets.forms.ComboBoxItem;
import org.jboss.ballroom.client.widgets.forms.Form;
import org.jboss.ballroom.client.widgets.forms.TextItem;
import org.jboss.ballroom.client.widgets.tables.DefaultCellTable;
import org.jboss.dmr.client.ModelNode;

import java.util.List;
import java.util.Map;

/**
 * @author <NAME>
 * @date 10/27/11
 */
public class ServerGroupDetails {

    private Form<ServerGroupRecord> form;
    private ComboBoxItem socketBindingItem;
    private ServerGroupPresenter presenter;

    public ServerGroupDetails(ServerGroupPresenter presenter) {
        this.presenter = presenter;
    }

    Widget asWidget() {

        VerticalPanel layout = new VerticalPanel();

        form = new Form<ServerGroupRecord>(ServerGroupRecord.class);
        form.setNumColumns(2);

        FormToolStrip<ServerGroupRecord> toolstrip = new FormToolStrip<ServerGroupRecord>(
                form,
                new FormToolStrip.FormCallback<ServerGroupRecord>() {
                    @Override
                    public void onSave(Map<String, Object> changeset) {
                        presenter.onSaveChanges(form.getEditedEntity(), changeset);
                    }

                    @Override
                    public void onDelete(ServerGroupRecord entity) {
                        presenter.onDeleteGroup(entity);
                    }
                }
        );

        toolstrip.providesDeleteOp(false);

        TextItem nameItem = new TextItem("groupName", "Name");
        TextItem profileItem = new TextItem("profileName", Console.CONSTANTS.common_label_profile());
        socketBindingItem = new ComboBoxItem("socketBinding", Console.CONSTANTS.common_label_socketBinding());
        socketBindingItem.setDefaultToFirstOption(true);

        form.setFields(nameItem, profileItem, socketBindingItem);

        final FormHelpPanel helpPanel = new FormHelpPanel(
                new FormHelpPanel.AddressCallback() {
                    @Override
                    public ModelNode getAddress() {
                        ModelNode address = new ModelNode();
                        address.add("server-group", "*");
                        return address;
                    }
                }, form
        );

        layout.add(toolstrip.asWidget());
        layout.add(helpPanel.asWidget());
        layout.add(form.asWidget());

        return layout;
    }

    public void setSocketBindings(List<String> result) {<commit_msg>server group view is disabled by default (like all the others)<commit_after>package org.jboss.as.console.client.domain.groups;

import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import org.jboss.as.console.client.Console;
import org.jboss.as.console.client.domain.model.ServerGroupRecord;
import org.jboss.as.console.client.shared.help.FormHelpPanel;
import org.jboss.as.console.client.widgets.forms.FormToolStrip;
import org.jboss.ballroom.client.widgets.forms.ComboBoxItem;
import org.jboss.ballroom.client.widgets.forms.Form;
import org.jboss.ballroom.client.widgets.forms.TextItem;
import org.jboss.ballroom.client.widgets.tables.DefaultCellTable;
import org.jboss.dmr.client.ModelNode;

import java.util.List;
import java.util.Map;

/**
 * @author <NAME>
 * @date 10/27/11
 */
public class ServerGroupDetails {

    private Form<ServerGroupRecord> form;
    private ComboBoxItem socketBindingItem;
    private ServerGroupPresenter presenter;

    public ServerGroupDetails(ServerGroupPresenter presenter) {
        this.presenter = presenter;
    }

    Widget asWidget() {

        VerticalPanel layout = new VerticalPanel();

        form = new Form<ServerGroupRecord>(ServerGroupRecord.class);
        form.setNumColumns(2);

        FormToolStrip<ServerGroupRecord> toolstrip = new FormToolStrip<ServerGroupRecord>(
                form,
                new FormToolStrip.FormCallback<ServerGroupRecord>() {
                    @Override
                    public void onSave(Map<String, Object> changeset) {
                        presenter.onSaveChanges(form.getEditedEntity(), changeset);
                    }

                    @Override
                    public void onDelete(ServerGroupRecord entity) {
                        presenter.onDeleteGroup(entity);
                    }
                }
        );

        toolstrip.providesDeleteOp(false);

        TextItem nameItem = new TextItem("groupName", "Name");
        TextItem profileItem = new TextItem("profileName", Console.CONSTANTS.common_label_profile());
        socketBindingItem = new ComboBoxItem("socketBinding", Console.CONSTANTS.common_label_socketBinding());
        socketBindingItem.setDefaultToFirstOption(true);

        form.setFields(nameItem, profileItem, socketBindingItem);

        final FormHelpPanel helpPanel = new FormHelpPanel(
                new FormHelpPanel.AddressCallback() {
                    @Override
                    public ModelNode getAddress() {
                        ModelNode address = new ModelNode();
                        address.add("server-group", "*");
                        return address;
                    }
                }, form
        );

        layout.add(toolstrip.asWidget());
        layout.add(helpPanel.asWidget());
        layout.add(form.asWidget());

        form.setEnabled(false);

        return layout;
    }

    public void setSocketBindings(List<String> result) {
{'fraction_non_alphanumeric': 0.09700476514635807, 'fraction_numerical': 0.002382573179033356, 'mean_word_length': 2.4652122641509435, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, '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': '4673729', 'n_tokens_mistral': 1627, 'n_tokens_neox': 1520, 'n_words': 265}