<commit_before>/*
 * Copyright 2016 Crown Copyright
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package stroom.streamstore.client.presenter;

import com.google.gwt.cell.client.TextCell;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.cellview.client.Column;
import com.google.inject.Inject;
import com.google.web.bindery.event.shared.EventBus;
import com.gwtplatform.mvp.client.MyPresenterWidget;
import stroom.cell.info.client.InfoColumn;
import stroom.data.grid.client.DataGridView;
import stroom.data.grid.client.DataGridViewImpl;
import stroom.data.grid.client.EndColumn;
import stroom.data.grid.client.OrderByColumn;
import stroom.dispatch.client.ClientDispatchAsync;
import stroom.entity.client.presenter.HasRead;
import stroom.entity.shared.BaseEntity;
import stroom.entity.shared.Folder;
import stroom.entity.shared.ResultList;
import stroom.entity.shared.SummaryDataRow;
import stroom.feed.shared.Feed;
import stroom.pipeline.shared.PipelineEntity;
import stroom.streamstore.shared.StreamStatus;
import stroom.streamtask.shared.FindStreamTaskCriteria;
import stroom.streamtask.shared.TaskStatus;
import stroom.util.shared.ModelStringUtil;
import stroom.widget.popup.client.event.ShowPopupEvent;
import stroom.widget.popup.client.presenter.PopupPosition;
import stroom.widget.popup.client.presenter.PopupView.PopupType;
import stroom.widget.tooltip.client.presenter.TooltipPresenter;
import stroom.widget.tooltip.client.presenter.TooltipUtil;
import stroom.widget.util.client.MultiSelectionModel;

public class StreamTaskSummaryPresenter extends MyPresenterWidget<DataGridView<SummaryDataRow>>
        implements HasRead<BaseEntity> {
    private EntityServiceFindSummaryActionDataProvider<FindStreamTaskCriteria> dataProvider;
//    private final InterceptingSelectionChangeHandler interceptingSelectionChangeHandler = new InterceptingSelectionChangeHandler();

    @Inject
    public StreamTaskSummaryPresenter(final EventBus eventBus, final ClientDispatchAsync dispatcher,
                                      final TooltipPresenter tooltipPresenter) {
        super(eventBus, new DataGridViewImpl<SummaryDataRow>(false));

        // Info column.
        final InfoColumn<SummaryDataRow> infoColumn = new InfoColumn<SummaryDataRow>() {
            @Override
            protected void showInfo(final SummaryDataRow row, final int x, final int y) {
                final StringBuilder html = new StringBuilder();

                TooltipUtil.addHeading(html, "Key Data");
                TooltipUtil.addRowData(html, "Pipeline", row.getLabel().get(FindStreamTaskCriteria.SUMMARY_POS_PIPELINE)
                        + " (" + row.getKey().get(FindStreamTaskCriteria.SUMMARY_POS_PIPELINE) + ")");
                TooltipUtil.addRowData(html, "Feed", row.getLabel().get(FindStreamTaskCriteria.SUMMARY_POS_FEED) + " ("
                        + row.getKey().get(FindStreamTaskCriteria.SUMMARY_POS_FEED) + ")");
                TooltipUtil.addRowData(html, "Priority", row.getKey().get(FindStreamTaskCriteria.SUMMARY_POS_PRIORITY));
                TooltipUtil.addRowData(html, "Status",
                        TaskStatus.PRIMITIVE_VALUE_CONVERTER
                                .fromPrimitiveValue(<commit_msg>Issue #125 : Fixed display of active tasks which was broken by changes to the task summary table selection model.<commit_after>/*
 * Copyright 2016 Crown Copyright
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package stroom.streamstore.client.presenter;

import com.google.gwt.cell.client.TextCell;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.cellview.client.Column;
import com.google.inject.Inject;
import com.google.web.bindery.event.shared.EventBus;
import com.gwtplatform.mvp.client.MyPresenterWidget;
import stroom.cell.info.client.InfoColumn;
import stroom.data.grid.client.DataGridView;
import stroom.data.grid.client.DataGridViewImpl;
import stroom.data.grid.client.EndColumn;
import stroom.data.grid.client.OrderByColumn;
import stroom.dispatch.client.ClientDispatchAsync;
import stroom.entity.client.presenter.HasRead;
import stroom.entity.shared.BaseEntity;
import stroom.entity.shared.Folder;
import stroom.entity.shared.ResultList;
import stroom.entity.shared.SummaryDataRow;
import stroom.feed.shared.Feed;
import stroom.pipeline.shared.PipelineEntity;
import stroom.streamstore.shared.StreamStatus;
import stroom.streamtask.shared.FindStreamTaskCriteria;
import stroom.streamtask.shared.TaskStatus;
import stroom.util.shared.ModelStringUtil;
import stroom.widget.popup.client.event.ShowPopupEvent;
import stroom.widget.popup.client.presenter.PopupPosition;
import stroom.widget.popup.client.presenter.PopupView.PopupType;
import stroom.widget.tooltip.client.presenter.TooltipPresenter;
import stroom.widget.tooltip.client.presenter.TooltipUtil;
import stroom.widget.util.client.MultiSelectionModel;

public class StreamTaskSummaryPresenter extends MyPresenterWidget<DataGridView<SummaryDataRow>>
        implements HasRead<BaseEntity> {
    private EntityServiceFindSummaryActionDataProvider<FindStreamTaskCriteria> dataProvider;
//    private final InterceptingSelectionChangeHandler interceptingSelectionChangeHandler = new InterceptingSelectionChangeHandler();

    @Inject
    public StreamTaskSummaryPresenter(final EventBus eventBus, final ClientDispatchAsync dispatcher,
                                      final TooltipPresenter tooltipPresenter) {
        super(eventBus, new DataGridViewImpl<SummaryDataRow>(true, false));

        // Info column.
        final InfoColumn<SummaryDataRow> infoColumn = new InfoColumn<SummaryDataRow>() {
            @Override
            protected void showInfo(final SummaryDataRow row, final int x, final int y) {
                final StringBuilder html = new StringBuilder();

                TooltipUtil.addHeading(html, "Key Data");
                TooltipUtil.addRowData(html, "Pipeline", row.getLabel().get(FindStreamTaskCriteria.SUMMARY_POS_PIPELINE)
                        + " (" + row.getKey().get(FindStreamTaskCriteria.SUMMARY_POS_PIPELINE) + ")");
                TooltipUtil.addRowData(html, "Feed", row.getLabel().get(FindStreamTaskCriteria.SUMMARY_POS_FEED) + " ("
                        + row.getKey().get(FindStreamTaskCriteria.SUMMARY_POS_FEED) + ")");
                TooltipUtil.addRowData(html, "Priority", row.getKey().get(FindStreamTaskCriteria.SUMMARY_POS_PRIORITY));
                TooltipUtil.addRowData(html, "Status",
                        TaskStatus.PRIMITIVE_VALUE_CONVERTER
                                .fromPrimitiveValue(
{'fraction_non_alphanumeric': 0.08855799373040753, 'fraction_numerical': 0.0024817136886102404, 'mean_word_length': 4.084329349269589, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6821824', 'n_tokens_mistral': 2097, 'n_tokens_neox': 2059, 'n_words': 448}