Search in sources :

Example 1 with InvertedGradient

use of uk.ac.babraham.SeqMonk.Gradients.InvertedGradient in project SeqMonk by s-andrews.

the class HierarchicalClusterDialog method progressComplete.

public void progressComplete(String command, Object result) {
    clusterPanelGroup = new JPanel();
    clusterPanelGroup.setLayout(new BorderLayout());
    ColourGradient gradient = (ColourGradient) gradients.getSelectedItem();
    if (invertGradient.isSelected()) {
        gradient = new InvertedGradient(gradient);
    }
    if (negativeScale) {
        scaleBar = new GradientScaleBar(gradient, -2, 2);
    } else {
        scaleBar = new GradientScaleBar(gradient, 0, 2);
    }
    JPanel topBottomSplit = new JPanel();
    topBottomSplit.setLayout(new GridLayout(2, 1));
    topBottomSplit.add(new JPanel());
    topBottomSplit.add(scaleBar);
    clusterPanel = new HierarchicalClusterPanel(probes, stores, (ClusterPair) result, normalise, (ColourGradient) gradients.getSelectedItem());
    clusterPanelGroup.add(clusterPanel, BorderLayout.CENTER);
    clusterPanelGroup.add(topBottomSplit, BorderLayout.EAST);
    getContentPane().add(clusterPanelGroup, BorderLayout.CENTER);
    setLocationRelativeTo(SeqMonkApplication.getInstance());
    stateChanged(new ChangeEvent(clusterSlider));
    setVisible(true);
}
Also used : JPanel(javax.swing.JPanel) GradientScaleBar(uk.ac.babraham.SeqMonk.Displays.GradientScaleBar.GradientScaleBar) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout) ChangeEvent(javax.swing.event.ChangeEvent) InvertedGradient(uk.ac.babraham.SeqMonk.Gradients.InvertedGradient) ClusterPair(uk.ac.babraham.SeqMonk.DataTypes.Cluster.ClusterPair) ColourGradient(uk.ac.babraham.SeqMonk.Gradients.ColourGradient)

Example 2 with InvertedGradient

use of uk.ac.babraham.SeqMonk.Gradients.InvertedGradient in project SeqMonk by s-andrews.

the class HierarchicalClusterDialog method updateGradients.

private void updateGradients() {
    ColourGradient gradient = (ColourGradient) gradients.getSelectedItem();
    if (invertGradient.isSelected()) {
        gradient = new InvertedGradient(gradient);
    }
    if (clusterPanel != null) {
        clusterPanel.setGradient(gradient);
        scaleBar.setGradient(gradient);
    }
}
Also used : InvertedGradient(uk.ac.babraham.SeqMonk.Gradients.InvertedGradient) ColourGradient(uk.ac.babraham.SeqMonk.Gradients.ColourGradient)

Example 3 with InvertedGradient

use of uk.ac.babraham.SeqMonk.Gradients.InvertedGradient in project SeqMonk by s-andrews.

the class DisplayPreferences method setGradient.

public void setGradient(int gradientType) {
    if (equalsAny(new int[] { GRADIENT_GREYSCALE, GRADIENT_HOT_COLD, GRADIENT_RED_GREEN, GRADIENT_MAGENTA_GREEN, GRADIENT_RED_WHITE }, gradientType)) {
        currentGradientValue = gradientType;
        switch(gradientType) {
            case GRADIENT_GREYSCALE:
                currentGradient = new GreyscaleColourGradient();
                break;
            case GRADIENT_HOT_COLD:
                currentGradient = new HotColdColourGradient();
                break;
            case GRADIENT_RED_GREEN:
                currentGradient = new RedGreenColourGradient();
                break;
            case GRADIENT_MAGENTA_GREEN:
                currentGradient = new MagentaGreenColourGradient();
                break;
            case GRADIENT_RED_WHITE:
                currentGradient = new RedWhiteColourGradient();
                break;
        }
        if (invertGradient) {
            currentGradient = new InvertedGradient(currentGradient);
        }
        optionsChanged();
    } else {
        throw new IllegalArgumentException("Value " + gradientType + " is not a valid gradient type");
    }
}
Also used : HotColdColourGradient(uk.ac.babraham.SeqMonk.Gradients.HotColdColourGradient) GreyscaleColourGradient(uk.ac.babraham.SeqMonk.Gradients.GreyscaleColourGradient) RedGreenColourGradient(uk.ac.babraham.SeqMonk.Gradients.RedGreenColourGradient) InvertedGradient(uk.ac.babraham.SeqMonk.Gradients.InvertedGradient) MagentaGreenColourGradient(uk.ac.babraham.SeqMonk.Gradients.MagentaGreenColourGradient) RedWhiteColourGradient(uk.ac.babraham.SeqMonk.Gradients.RedWhiteColourGradient)

Example 4 with InvertedGradient

use of uk.ac.babraham.SeqMonk.Gradients.InvertedGradient in project SeqMonk by s-andrews.

the class DomainogramDialog method updateGradients.

private void updateGradients() {
    ColourGradient gradient = (ColourGradient) gradients.getSelectedItem();
    if (invertGradient.isSelected()) {
        gradient = new InvertedGradient(gradient);
    }
    for (int i = 0; i < chromosomeDomainPanels.length; i++) {
        // We skipped it
        if (chromosomeDomainPanels[i] == null)
            continue;
        chromosomeDomainPanels[i].setGradient(gradient);
    }
    scaleBar.setGradient(gradient);
}
Also used : InvertedGradient(uk.ac.babraham.SeqMonk.Gradients.InvertedGradient) ColourGradient(uk.ac.babraham.SeqMonk.Gradients.ColourGradient)

Example 5 with InvertedGradient

use of uk.ac.babraham.SeqMonk.Gradients.InvertedGradient in project SeqMonk by s-andrews.

the class CorrelationMatrix method updateGradients.

private void updateGradients() {
    ColourGradient gradient = (ColourGradient) gradients.getSelectedItem();
    if (invertGradient.isSelected()) {
        gradient = new InvertedGradient(gradient);
    }
    this.gradient = gradient;
    if (scaleBar != null) {
        scaleBar.setGradient(gradient);
        if (scaleBox.isSelected()) {
            scaleBar.setLimits(-1, 1);
        } else {
            scaleBar.setLimits(model.getMinCorrelation(), model.getMaxCorrelation());
        }
    }
    repaint();
}
Also used : InvertedGradient(uk.ac.babraham.SeqMonk.Gradients.InvertedGradient) ColourGradient(uk.ac.babraham.SeqMonk.Gradients.ColourGradient)

Aggregations

InvertedGradient (uk.ac.babraham.SeqMonk.Gradients.InvertedGradient)5 ColourGradient (uk.ac.babraham.SeqMonk.Gradients.ColourGradient)4 BorderLayout (java.awt.BorderLayout)1 GridLayout (java.awt.GridLayout)1 JPanel (javax.swing.JPanel)1 ChangeEvent (javax.swing.event.ChangeEvent)1 ClusterPair (uk.ac.babraham.SeqMonk.DataTypes.Cluster.ClusterPair)1 GradientScaleBar (uk.ac.babraham.SeqMonk.Displays.GradientScaleBar.GradientScaleBar)1 GreyscaleColourGradient (uk.ac.babraham.SeqMonk.Gradients.GreyscaleColourGradient)1 HotColdColourGradient (uk.ac.babraham.SeqMonk.Gradients.HotColdColourGradient)1 MagentaGreenColourGradient (uk.ac.babraham.SeqMonk.Gradients.MagentaGreenColourGradient)1 RedGreenColourGradient (uk.ac.babraham.SeqMonk.Gradients.RedGreenColourGradient)1 RedWhiteColourGradient (uk.ac.babraham.SeqMonk.Gradients.RedWhiteColourGradient)1