org.caleydo.view.enroute.correlation.wilcoxon.WilcoxonManualSourceDataCellPage.java Source code

Java tutorial

Introduction

Here is the source code for org.caleydo.view.enroute.correlation.wilcoxon.WilcoxonManualSourceDataCellPage.java

Source

/*******************************************************************************
 * Caleydo - Visualization for Molecular Biology - http://caleydo.org
 * Copyright (c) The Caleydo Team. All rights reserved.
 * Licensed under the new BSD license, available at http://caleydo.org/license
 *******************************************************************************/
package org.caleydo.view.enroute.correlation.wilcoxon;

import java.util.List;

import org.caleydo.core.event.EventPublisher;
import org.caleydo.core.util.color.Color;
import org.caleydo.view.enroute.correlation.AManualDataClassificationPage;
import org.caleydo.view.enroute.correlation.CellSelectionValidators;
import org.caleydo.view.enroute.correlation.DataCellInfo;
import org.caleydo.view.enroute.correlation.IDataClassifier;
import org.caleydo.view.enroute.correlation.ShowOverlayEvent;
import org.caleydo.view.enroute.correlation.UpdateDataCellSelectionValidatorEvent;
import org.eclipse.jface.dialogs.PageChangedEvent;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.wizard.IWizardPage;

import com.google.common.base.Predicate;
import com.google.common.base.Predicates;

/**
 * @author Christian
 *
 */
public class WilcoxonManualSourceDataCellPage extends AManualDataClassificationPage {

    /**
     * @param pageName
     * @param title
     * @param titleImage
     * @param categoryColors
     */
    protected WilcoxonManualSourceDataCellPage(String pageName, String title, ImageDescriptor titleImage,
            List<Color> categoryColors) {
        super(pageName, title, titleImage, categoryColors,
                "Select the data block that you want to compare in the enRoute view.",
                "Restriction: Make sure to select numerical (not categorical) data blocks.");
    }

    @Override
    public void pageChanged(PageChangedEvent event) {
        if (event.getSelectedPage() == getNextPage()) {
            WilcoxonRankSumTestWizard wizard = (WilcoxonRankSumTestWizard) getWizard();
            wizard.setSourceInfo(info);
            IDataClassifier classifier = classificationWidget.getClassifier();
            wizard.setSourceClassifier(classifier);

        } else if (event.getSelectedPage() == this) {
            Predicate<DataCellInfo> validator = Predicates.and(CellSelectionValidators.nonEmptyCellValidator(),
                    CellSelectionValidators.numericalValuesValidator());
            UpdateDataCellSelectionValidatorEvent e = new UpdateDataCellSelectionValidatorEvent(validator);
            EventPublisher.trigger(e);
        }

    }

    @Override
    protected void dataCellChanged(DataCellInfo info) {
        super.dataCellChanged(info);
        EventPublisher.trigger(
                new ShowOverlayEvent(info, classificationWidget.getClassifier().getOverlayProvider(), true));
    }

    @Override
    public void on(IDataClassifier data) {
        EventPublisher.trigger(new ShowOverlayEvent(info, data.getOverlayProvider(), true));
    }

    @Override
    public IWizardPage getNextPage() {
        return ((WilcoxonRankSumTestWizard) getWizard()).getManualTargetDataCellPage();
    }

    @Override
    public IWizardPage getPreviousPage() {
        return ((WilcoxonRankSumTestWizard) getWizard()).getMethodSelectionPage();
    }

}