<commit_before>package org.ovirt.engine.ui.webadmin.section.main.view.popup.cluster;

import com.google.gwt.text.shared.Parser;
import org.ovirt.engine.core.common.businessentities.gluster.GlusterHookStatus;
import org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook;
import org.ovirt.engine.ui.common.idhandler.ElementIdHandler;
import org.ovirt.engine.ui.common.idhandler.WithElementId;
import org.ovirt.engine.ui.common.view.popup.AbstractModelBoundPopupView;
import org.ovirt.engine.ui.common.widget.Align;
import org.ovirt.engine.ui.common.widget.dialog.SimpleDialogPanel;
import org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable;
import org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor;
import org.ovirt.engine.ui.common.widget.editor.generic.EntityModelLabelEditor;
import org.ovirt.engine.ui.common.widget.editor.generic.EntityModelRadioButtonEditor;
import org.ovirt.engine.ui.common.widget.editor.ListModelListBoxEditor;
import org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelLabelEditor;
import org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelTextAreaLabelEditor;
import org.ovirt.engine.ui.common.widget.renderer.EnumRenderer;
import org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer;
import org.ovirt.engine.ui.common.widget.table.column.EntityModelEnumColumn;
import org.ovirt.engine.ui.common.widget.table.column.EntityModelTextColumn;
import org.ovirt.engine.ui.uicommonweb.models.ListModel;
import org.ovirt.engine.ui.uicommonweb.models.clusters.GlusterHookResolveConflictsModel;
import org.ovirt.engine.ui.webadmin.ApplicationConstants;
import org.ovirt.engine.ui.webadmin.ApplicationResources;
import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster.GlusterHookResolveConflictsPopupPresenterWidget;

import com.google.gwt.core.client.GWT;
import com.google.gwt.editor.client.SimpleBeanEditorDriver;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.inject.Inject;

import java.text.ParseException;

public class GlusterHookResolveConflictsPopupView extends AbstractModelBoundPopupView<GlusterHookResolveConflictsModel> implements GlusterHookResolveConflictsPopupPresenterWidget.ViewDef {

    interface Driver extends SimpleBeanEditorDriver<GlusterHookResolveConflictsModel, GlusterHookResolveConflictsPopupView> {
    }

    interface ViewUiBinder extends UiBinder<SimpleDialogPanel, GlusterHookResolveConflictsPopupView> {
        ViewUiBinder uiBinder = GWT.create(ViewUiBinder.class);
    }

    interface ViewIdHandler extends ElementIdHandler<GlusterHookResolveConflictsPopupView> {
        ViewIdHandler idHandler = GWT.create(ViewIdHandler.class);
    }

    @UiField
    WidgetStyle style;

    @UiField
    @Ignore
    @WithElementId
    Label conflictReasonsLabel;

    @UiField
    @Ignore
    @WithElementId
    Label conflictReasonsContentDiffLabel;

    @UiField
    @Ignore
    @WithElementId
    Label conflictReasonsStatusDiffLabel;

    @UiField
    @Ignore
    @WithElementId
    Label conflictReasonsMissingHookLabel;

    @UiField
    @Ignore
    @WithElementId
    Label contentSourcesLabel;

    @UiField(provided = true)
    @Ignore
    @WithElementId
    EntityModelCellTable<ListModel> contentSourcesTable;

    @UiField
    @Path(value = "contentModel.content.entity")
    @WithElementId
    StringEntityModelTextAreaLabelEditor contentEditor;

    @UiField
    @Path(value = "contentModel.md5Checksum.entity")
    @WithElementId
    StringEntityModelLabelEditor checksumEditor;

    @UiField(provided = true)
    @Path(value = "contentModel.status.entity")
    @WithElementId
    EntityModelLabelEditor<GlusterHookStatus> statusEditor;

    @UiField
    @Ignore
    Label resolveHeaderLabel;

    @UiField
    @Ignore
    VerticalPanel resolveContentConflictPanel;

    @UiField(provided = true)
    @Path("resolveContentConflict.entity")
    @WithElementId
    EntityModelCheckBoxEditor resolveContentConflict;

    @UiField(provided = true)
    @Path(value = "serverHooksList.selectedItem")
    @WithElementId
    ListModelListBoxEditor<GlusterServerHook> useContentSourceEditor;

    @UiField
    @Ignore
    Label useContentSourceWarning;

    @UiField
    @Ignore
    VerticalPanel resolveStatusConflictPanel;

    @UiField(provided = true)
    @Path("resolveStatusConflict.entity")
    @WithElementId
    EntityModelCheckBoxEditor resolveStatusConflict;

    @UiField
    @Ignore
    Label hookStatusLabel;

    @UiField(provided = true)
    @Path("resolveStatusConflictEnable.entity")
    @WithElementId
    EntityModelRadioButtonEditor resolveStatusConflictEnable;

    @UiField(provided = true)
    @Path("resolveStatusConflictDisable.entity")
    @WithElementId
    EntityModelRadioButtonEditor resolveStatusConflictDisable;

    @UiField
    @Ignore
    VerticalPanel resolveMissingConflictPanel;

    @UiField(provided = true)
    @Path("resolveMissingConflict.entity")
    @WithElementId
    EntityModelCheckBoxEditor resolveMissingConflict;

    @UiField(provided = true)
    @Path("resolveMissingConflictCopy.entity")
    @WithElementId
    EntityModelRadioButtonEditor resolveMissingConflictCopyEditor;

    @UiField(provided = true)
    @Path("resolveMissingConflictRemove.entity")
    @WithElementId
    EntityModelRadioButtonEditor resolveMissingConflictRemoveEditor;

    @UiField
    @Ignore
    Label messageLabel;

    private final Driver driver = GWT.create(Driver.class);

    @Inject
    public GlusterHookResolveConflictsPopupView(EventBus eventBus, ApplicationResources resources, ApplicationConstants constants) {
        super(eventBus, resources);
        initEditors();
        initWidget(ViewUiBinder.uiBinder.createAndBindUi(this));
        ViewIdHandler.idHandler.generateAndSetIds(this);
        addStyles();
        localize(constants);
        initTableColumns(constants);
        driver.initialize(this);
    }

    private void initEditors() {
        contentSourcesTable = new EntityModelCellTable<ListModel>(false, true);

        statusEditor = new EntityModelLabelEditor<GlusterHookStatus>(new EnumRenderer<GlusterHookStatus>(), new Parser<GlusterHookStatus>() {
            @Override
            public GlusterHookStatus parse(CharSequence text) throws ParseException {
                return GlusterHookStatus.valueOf(text.toString().toUpperCase());
            }
        });

        resolveContentConflict = new EntityModelCheckBoxEditor(Align.RIGHT);
        useContentSourceEditor = new ListModelListBoxEditor<GlusterServerHook>(new NullSafeRenderer<GlusterServerHook>() {
            @Override
            protected String renderNullSafe(GlusterServerHook hook) {
                return hook.getServerName();
            }
        });

        resolveStatusConflict = new EntityModelCheckBoxEditor(Align.RIGHT);
        resolveStatusConflictEnable = new EntityModelRadioButtonEditor("status", Align.RIGHT); //$NON-NLS-1$
        resolveStatusConflictDisable = new EntityModelRadioButtonEditor("status", Align.RIGHT); //$NON-NLS-1$

        resolveMissingConflict = new EntityModelCheckBoxEditor(Align.RIGHT);
        resolveMissingConflictCopyEditor = new EntityModelRadioButtonEditor("missing_hook", Align.RIGHT); //$NON-NLS-1$
        resolveMissingConflictRemoveEditor = new EntityModelRadioButtonEditor("missing_hook", Align.RIGHT); //$NON-NLS-1$
    }
<commit_msg>webadmin:Fix for Gluster hook resolve conflicts popup not loading<commit_after>package org.ovirt.engine.ui.webadmin.section.main.view.popup.cluster;

import com.google.gwt.text.shared.Parser;
import org.ovirt.engine.core.common.businessentities.gluster.GlusterHookStatus;
import org.ovirt.engine.core.common.businessentities.gluster.GlusterServerHook;
import org.ovirt.engine.ui.common.idhandler.ElementIdHandler;
import org.ovirt.engine.ui.common.idhandler.WithElementId;
import org.ovirt.engine.ui.common.view.popup.AbstractModelBoundPopupView;
import org.ovirt.engine.ui.common.widget.Align;
import org.ovirt.engine.ui.common.widget.dialog.SimpleDialogPanel;
import org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable;
import org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor;
import org.ovirt.engine.ui.common.widget.editor.generic.EntityModelLabelEditor;
import org.ovirt.engine.ui.common.widget.editor.generic.EntityModelRadioButtonEditor;
import org.ovirt.engine.ui.common.widget.editor.ListModelListBoxEditor;
import org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelLabelEditor;
import org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelTextAreaLabelEditor;
import org.ovirt.engine.ui.common.widget.renderer.EnumRenderer;
import org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer;
import org.ovirt.engine.ui.common.widget.table.column.EntityModelEnumColumn;
import org.ovirt.engine.ui.common.widget.table.column.EntityModelTextColumn;
import org.ovirt.engine.ui.uicommonweb.models.ListModel;
import org.ovirt.engine.ui.uicommonweb.models.clusters.GlusterHookResolveConflictsModel;
import org.ovirt.engine.ui.webadmin.ApplicationConstants;
import org.ovirt.engine.ui.webadmin.ApplicationResources;
import org.ovirt.engine.ui.webadmin.section.main.presenter.popup.cluster.GlusterHookResolveConflictsPopupPresenterWidget;

import com.google.gwt.core.client.GWT;
import com.google.gwt.editor.client.SimpleBeanEditorDriver;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.inject.Inject;

import java.text.ParseException;

public class GlusterHookResolveConflictsPopupView extends AbstractModelBoundPopupView<GlusterHookResolveConflictsModel> implements GlusterHookResolveConflictsPopupPresenterWidget.ViewDef {

    interface Driver extends SimpleBeanEditorDriver<GlusterHookResolveConflictsModel, GlusterHookResolveConflictsPopupView> {
    }

    interface ViewUiBinder extends UiBinder<SimpleDialogPanel, GlusterHookResolveConflictsPopupView> {
        ViewUiBinder uiBinder = GWT.create(ViewUiBinder.class);
    }

    interface ViewIdHandler extends ElementIdHandler<GlusterHookResolveConflictsPopupView> {
        ViewIdHandler idHandler = GWT.create(ViewIdHandler.class);
    }

    @UiField
    WidgetStyle style;

    @UiField
    @Ignore
    @WithElementId
    Label conflictReasonsLabel;

    @UiField
    @Ignore
    @WithElementId
    Label conflictReasonsContentDiffLabel;

    @UiField
    @Ignore
    @WithElementId
    Label conflictReasonsStatusDiffLabel;

    @UiField
    @Ignore
    @WithElementId
    Label conflictReasonsMissingHookLabel;

    @UiField
    @Ignore
    @WithElementId
    Label contentSourcesLabel;

    @UiField(provided = true)
    @Ignore
    @WithElementId
    EntityModelCellTable<ListModel> contentSourcesTable;

    @UiField
    @Path(value = "contentModel.content.entity")
    @WithElementId
    StringEntityModelTextAreaLabelEditor contentEditor;

    @UiField
    @Path(value = "contentModel.md5Checksum.entity")
    @WithElementId
    StringEntityModelLabelEditor checksumEditor;

    @UiField(provided = true)
    @Path(value = "contentModel.status.entity")
    @WithElementId
    EntityModelLabelEditor<GlusterHookStatus> statusEditor;

    @UiField
    @Ignore
    Label resolveHeaderLabel;

    @UiField
    @Ignore
    VerticalPanel resolveContentConflictPanel;

    @UiField(provided = true)
    @Path("resolveContentConflict.entity")
    @WithElementId
    EntityModelCheckBoxEditor resolveContentConflict;

    @UiField(provided = true)
    @Path(value = "serverHooksList.selectedItem")
    @WithElementId
    ListModelListBoxEditor<GlusterServerHook> useContentSourceEditor;

    @UiField
    @Ignore
    Label useContentSourceWarning;

    @UiField
    @Ignore
    VerticalPanel resolveStatusConflictPanel;

    @UiField(provided = true)
    @Path("resolveStatusConflict.entity")
    @WithElementId
    EntityModelCheckBoxEditor resolveStatusConflict;

    @UiField
    @Ignore
    Label hookStatusLabel;

    @UiField(provided = true)
    @Path("resolveStatusConflictEnable.entity")
    @WithElementId
    EntityModelRadioButtonEditor resolveStatusConflictEnable;

    @UiField(provided = true)
    @Path("resolveStatusConflictDisable.entity")
    @WithElementId
    EntityModelRadioButtonEditor resolveStatusConflictDisable;

    @UiField
    @Ignore
    VerticalPanel resolveMissingConflictPanel;

    @UiField(provided = true)
    @Path("resolveMissingConflict.entity")
    @WithElementId
    EntityModelCheckBoxEditor resolveMissingConflict;

    @UiField(provided = true)
    @Path("resolveMissingConflictCopy.entity")
    @WithElementId
    EntityModelRadioButtonEditor resolveMissingConflictCopyEditor;

    @UiField(provided = true)
    @Path("resolveMissingConflictRemove.entity")
    @WithElementId
    EntityModelRadioButtonEditor resolveMissingConflictRemoveEditor;

    @UiField
    @Ignore
    Label messageLabel;

    private final Driver driver = GWT.create(Driver.class);

    @Inject
    public GlusterHookResolveConflictsPopupView(EventBus eventBus, ApplicationResources resources, ApplicationConstants constants) {
        super(eventBus, resources);
        initEditors();
        initWidget(ViewUiBinder.uiBinder.createAndBindUi(this));
        ViewIdHandler.idHandler.generateAndSetIds(this);
        addStyles();
        localize(constants);
        initTableColumns(constants);
        driver.initialize(this);
    }

    private void initEditors() {
        contentSourcesTable = new EntityModelCellTable<ListModel>(false, true);

        statusEditor = new EntityModelLabelEditor<GlusterHookStatus>(new EnumRenderer<GlusterHookStatus>(), new Parser<GlusterHookStatus>() {
            @Override
            public GlusterHookStatus parse(CharSequence text) throws ParseException {
                if(text == null || text.toString().isEmpty()) {
                    return null;
                }
                else {
                    return GlusterHookStatus.valueOf(text.toString().toUpperCase());
                }
            }
        });

        resolveContentConflict = new EntityModelCheckBoxEditor(Align.RIGHT);
        useContentSourceEditor = new ListModelListBoxEditor<GlusterServerHook>(new NullSafeRenderer<GlusterServerHook>() {
            @Override
            protected String renderNullSafe(GlusterServerHook hook) {
                return hook.getServerName();
            }
        });

        resolveStatusConflict = new EntityModelCheckBoxEditor(Align.RIGHT);
        resolveStatusConflictEnable = new EntityModelRadioButtonEditor("status", Align.RIGHT); //$NON-NLS-1$
        resolveStatusConflictDisable = new EntityModelRadioButtonEditor("status", Align.RIGHT); //$NON-NLS-1$

        resolveMissingConflict = new EntityModelCheckBoxEditor(Align.RIGHT);
        resolveMissingConflictCopyEditor = new EntityModelRadioButtonEditor("missing_hook", Align.RIGHT); //$NON-NLS-1$
        resolveMissingConflictRemoveEditor = new EntityModelRadioButtonEditor("missing_hook", Align.RIGHT); //$NON-NLS-1$
    }

{'fraction_non_alphanumeric': 0.08642930856553148, 'fraction_numerical': 0.0006449948400412797, 'mean_word_length': 4.4575853572685675, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '5666323', 'n_tokens_mistral': 4461, 'n_tokens_neox': 4344, 'n_words': 636}