Example usage for java.awt Cursor DEFAULT_CURSOR

List of usage examples for java.awt Cursor DEFAULT_CURSOR

Introduction

In this page you can find the example usage for java.awt Cursor DEFAULT_CURSOR.

Prototype

int DEFAULT_CURSOR

To view the source code for java.awt Cursor DEFAULT_CURSOR.

Click Source Link

Document

The default cursor type (gets set if no cursor is defined).

Usage

From source file:base.BasePlayer.AminoTable.java

void drawScreen(Graphics g) {
    if (!isEnabled()) {
        return;/*  ww w  . j  a v a  2 s .  co  m*/
    }

    buf.setColor(Color.black);
    buf.fillRect(0, 0, VariantHandler.tableScroll.getViewport().getWidth(),
            tablescroll.getViewport().getHeight());

    if (VariantHandler.writetofile.isSelected()) {
        buf.setColor(Color.white);
        if (FileRead.output != null && Main.drawCanvas.loading && Draw.variantcalculator) {
            buf.drawString("Writing results to " + FileRead.outputName, 10, 20);
        } else {
            buf.drawString("Press annotate to write results straight to file", 10, 20);
        }
        g.drawImage(bufImage, 0, tablescroll.getVerticalScrollBar().getValue(), null);
        return;
    }
    //Header Draw   

    genemutcount = 0;
    hoverVar = null;
    hoverSample = -1;
    headerHover = -1;
    geneHeaderHover = -1;

    if (!mouseDrag) {
        resizeColumn = -1;
    }
    firstrow = tablescroll.getVerticalScrollBar().getValue() / rowHeight - samplecount - listAdd
            - aminoarray.size();

    if (firstrow < 0) {
        firstrow = 0;
    }
    for (int i = 0; i < genearray.size(); i++) {
        dot = false;

        if ((i + 1 + samplecount + aminoarray.size() + listAdd) * rowHeight < tablescroll.getVerticalScrollBar()
                .getValue()) {

            continue;
        }

        if (i * rowHeight > tablescroll.getVerticalScrollBar().getValue()
                + tablescroll.getViewport().getHeight()) {
            break;
        }

        if (mouseY >= (rowHeight * (i + genemutcount + 1)) && mouseY < (rowHeight * (i + genemutcount + 2))) {
            hoverNode = genearray.get(i);
        }

        try {
            buf.setColor(Color.darkGray);
            buf.drawLine(4,
                    (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3,
                    this.getWidth(),
                    (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3);

            if (genearray.get(i).equals(hoverNode) || genearray.get(i).equals(selectedNode)) {
                buf.setColor(Color.yellow);
            } else {
                buf.setColor(Color.white);
            }
            textWidth = (int) fm.getStringBounds("" + (i + 1) + ".  " + genearray.get(i).getName(), buf)
                    .getWidth();
            if (genearray.get(i).intergenic) {
                if (genearray.get(i).varnodes.get(0).getTranscripts() == null) {
                    buf.drawString((i + 1) + ".  " + genearray.get(i).getName(), 5,
                            (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                    + rowHeight);

                } else if (genearray.get(i).varnodes.get(0).getTranscripts().size() == 2) {

                    buf.drawString(
                            (i + 1) + ".  " + genearray.get(i).getName() + " ... "
                                    + genearray.get(i).varnodes.get(0).getTranscripts().get(1).getGenename(),
                            5, (rowHeight * (i + 1 + genemutcount))
                                    - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
                } else if (genearray.get(i).varnodes.get(0).getPosition() < genearray.get(i).getStart()) {
                    buf.drawString((i + 1) + ".  " + " ... " + genearray.get(i).getName(), 5,
                            (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                    + rowHeight);

                } else {
                    buf.drawString((i + 1) + ".  " + genearray.get(i).getName() + " ... ", 5,
                            (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                    + rowHeight);

                }
            } else {
                buf.drawString((i + 1) + ".  " + genearray.get(i).getName(), 5,
                        (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                + rowHeight);
            }
            buf.setColor(Color.black);
            buf.fillRect((int) (headerlengths[1][0] + 1),
                    (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4,
                    (int) (headerlengths[1][1]), rowHeight - 1);

            if (genearray.get(i).equals(hoverNode) || genearray.get(i).equals(selectedNode)) {
                buf.setColor(Color.yellow);
            } else {
                buf.setColor(Color.white);
            }

            mutcountbuffer = new StringBuffer("" + genearray.get(i).mutations + " (");
            buf.drawString(mutcountbuffer.toString(), (int) (headerlengths[1][0] + 5),
                    (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                            + rowHeight);

            if (genearray.get(i).nonsense > 0) {
                buf.setColor(Color.red);
                textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
                buf.drawString("" + genearray.get(i).nonsense, (int) (headerlengths[1][0]) + 5 + textWidth,
                        (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                + rowHeight);
                mutcountbuffer.append(genearray.get(i).nonsense);
                dot = true;
            }
            if (genearray.get(i).missense > 0) {

                if (dot) {
                    buf.setColor(Color.white);
                    textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
                    buf.drawString(", ", (int) (headerlengths[1][0]) + 5 + textWidth,
                            (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                    + rowHeight);
                    mutcountbuffer.append(", ");
                }

                textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
                buf.setColor(Color.yellow);
                buf.drawString("" + genearray.get(i).missense, (int) (headerlengths[1][0]) + 5 + textWidth,
                        (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                + rowHeight);
                mutcountbuffer.append(genearray.get(i).missense);
                dot = true;
            }
            if (genearray.get(i).synonymous > 0) {

                if (dot) {
                    buf.setColor(Color.white);
                    textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
                    buf.drawString(", ", (int) (headerlengths[1][0]) + 5 + textWidth,
                            (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                    + rowHeight);
                    mutcountbuffer.append(", ");
                }
                textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
                buf.setColor(Color.green);
                buf.drawString("" + genearray.get(i).synonymous, (int) (headerlengths[1][0]) + 5 + textWidth,
                        (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                + rowHeight);
                mutcountbuffer.append(genearray.get(i).synonymous);
                dot = true;
            }
            if (genearray.get(i).utr > 0) {

                if (dot) {
                    buf.setColor(Color.white);
                    textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
                    buf.drawString(", ", (int) (headerlengths[1][0]) + 5 + textWidth,
                            (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                    + rowHeight);
                    mutcountbuffer.append(", ");
                }
                buf.setColor(Color.lightGray);
                textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
                buf.drawString("" + genearray.get(i).utr, (int) (headerlengths[1][0]) + 5 + textWidth,
                        (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                + rowHeight);
                mutcountbuffer.append(genearray.get(i).utr);
                dot = true;
            }
            if (genearray.get(i).intronic > 0) {

                if (dot) {
                    buf.setColor(Color.white);
                    textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
                    buf.drawString(", ", (int) (headerlengths[1][0]) + 5 + textWidth,
                            (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                    + rowHeight);
                    mutcountbuffer.append(", ");
                }
                buf.setColor(Color.gray);
                textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
                buf.drawString("" + genearray.get(i).intronic, (int) (headerlengths[1][0]) + 5 + textWidth,
                        (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                + rowHeight);
                mutcountbuffer.append(genearray.get(i).intronic);
                dot = true;
            }
            if (genearray.get(i).intergenic) {

                buf.setColor(Color.gray);
                textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
                buf.drawString("" + genearray.get(i).mutations, (int) (headerlengths[1][0]) + 5 + textWidth,
                        (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                + rowHeight);
                mutcountbuffer.append("" + genearray.get(i).mutations);
            }
            buf.setColor(Color.white);
            textWidth = (int) fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth();
            buf.drawString(") ", (int) (headerlengths[1][0]) + 5 + textWidth,
                    (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                            + rowHeight);

            buf.setColor(Color.gray);
            textWidth = (int) fm.getStringBounds(mutcountbuffer.toString() + ") ", buf).getWidth();
            if (genearray.get(i).samples.size() == 1) {
                buf.drawString(" 1 sample", (int) (headerlengths[1][0]) + 5 + textWidth,
                        (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                + rowHeight);

            } else {
                buf.drawString(" " + genearray.get(i).samples.size() + " samples",
                        (int) (headerlengths[1][0]) + 5 + textWidth, (rowHeight * (i + 1 + genemutcount))
                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
            }
            buf.setColor(Color.black);
            buf.fillRect((int) (headerlengths[2][0]) + 1,
                    (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4,
                    this.getWidth(), rowHeight - 1);

            if (genearray.get(i).equals(hoverNode) || genearray.get(i).equals(selectedNode)) {
                buf.setColor(Color.yellow);
            } else {
                buf.setColor(Color.white);
            }
            if (genearray.get(i).intergenic) {
                if (genearray.get(i).varnodes.get(0).getTranscripts() == null) {
                    buf.drawString(genearray.get(i).getChrom(), (int) (headerlengths[2][0]) + 5,
                            (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                    + rowHeight);

                } else if (genearray.get(i).varnodes.get(0).getTranscripts().size() == 2) {
                    buf.drawString(
                            genearray.get(i).getChrom() + ":"
                                    + MethodLibrary.formatNumber(genearray.get(i).getEnd()) + "-"
                                    + MethodLibrary.formatNumber(genearray.get(i).varnodes.get(0)
                                            .getTranscripts().get(1).getStart()),
                            (int) (headerlengths[2][0]) + 5, (rowHeight * (i + 1 + genemutcount))
                                    - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
                } else if (genearray.get(i).varnodes.get(0).getPosition() < genearray.get(i).getStart()) {
                    buf.drawString(
                            genearray.get(i).getChrom() + ":1-"
                                    + MethodLibrary.formatNumber(genearray.get(i).varnodes.get(0)
                                            .getTranscripts().get(1).getStart()),
                            (int) (headerlengths[2][0]) + 5, (rowHeight * (i + 1 + genemutcount))
                                    - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                } else {
                    buf.drawString(
                            genearray.get(i).getChrom() + ":"
                                    + MethodLibrary.formatNumber(genearray.get(i).getEnd()) + "-end",
                            (int) (headerlengths[2][0]) + 5, (rowHeight * (i + 1 + genemutcount))
                                    - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                }
            } else {
                buf.drawString(
                        genearray.get(i).getChrom() + ":"
                                + MethodLibrary.formatNumber(genearray.get(i).getStart()) + "-"
                                + MethodLibrary.formatNumber(genearray.get(i).getEnd()),
                        (int) (headerlengths[2][0]) + 5, (rowHeight * (i + 1 + genemutcount))
                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
            }
            buf.setColor(Color.black);
            buf.fillRect((int) (headerlengths[3][0]) + 1,
                    (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4,
                    this.getWidth(), rowHeight - 1);

            if (genearray.get(i).equals(hoverNode) || genearray.get(i).equals(selectedNode)) {

                buf.setColor(Color.yellow);
            } else {
                buf.setColor(Color.white);
            }
            if (genearray.get(i).intergenic) {
                if (genearray.get(i).varnodes.get(0).getTranscripts() == null) {
                    buf.drawString("-", (int) (headerlengths[3][0]) + 5, (rowHeight * (i + 1 + genemutcount))
                            - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                } else if (genearray.get(i).varnodes.get(0).getTranscripts().size() == 2) {
                    buf.drawString(
                            genearray.get(i).getDescription() + ";"
                                    + genearray.get(i).varnodes.get(0).getTranscripts().get(1).getGene()
                                            .getDescription(),
                            (int) (headerlengths[3][0]) + 5, (rowHeight * (i + 1 + genemutcount))
                                    - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                }
            } else {
                buf.drawString(genearray.get(i).getDescription(), (int) (headerlengths[3][0]) + 5,
                        (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue()
                                + rowHeight);
            }
            buf.setColor(Color.darkGray);
            buf.drawLine(3, rowHeight + 3, 3,
                    (rowHeight * (i + genemutcount + 2)) - tablescroll.getVerticalScrollBar().getValue() + 3);

            for (int r = 0; r < headerlengths.length; r++) {
                buf.drawLine((int) (headerlengths[r][0]),
                        (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue()
                                + 4,
                        (int) (headerlengths[r][0]), (rowHeight * (i + genemutcount + 2))
                                - tablescroll.getVerticalScrollBar().getValue() + 3);
            }

            if (selectedNode != null && selectedNode.equals(genearray.get(i))) {

                hoverSample = -1;
                genemutcount = aminoarray.size() + 1;
                listAdd = 1;
                //      buf.drawLine(10, (rowHeight*(i+listAdd+2))-tablescroll.getVerticalScrollBar().getValue()+3, this.getWidth(), (rowHeight*(i+listAdd+2))-tablescroll.getVerticalScrollBar().getValue()+3);   
                drawGeneheader(
                        (rowHeight * (i + listAdd + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3);

                for (int s = 0; s < aminoarray.size(); s++) {

                    buf.setColor(Color.darkGray);
                    buf.drawLine(21,
                            (rowHeight * (i + s + listAdd + 3)) - tablescroll.getVerticalScrollBar().getValue()
                                    + 3,
                            this.getWidth(), (rowHeight * (i + s + listAdd + 3))
                                    - tablescroll.getVerticalScrollBar().getValue() + 3);
                    if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]).equals("nonsense")) {

                        textcolor = Color.red;
                    } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]).equals("missense")) {

                        textcolor = Color.yellow;
                    } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]).equals("synonymous")) {
                        textcolor = Color.green;
                    } else if (aminoarray.get(s).getRow()[3].contains("UTR")) {
                        textcolor = Color.lightGray;
                    } else {

                        textcolor = Color.gray;
                    }
                    buf.setColor(textcolor);
                    if (mouseY >= (rowHeight * (i + s + listAdd + 2))
                            && mouseY < (rowHeight * (i + s + listAdd + 3))) {
                        hoverNode = null;
                        hoverVar = aminoarray.get(s).getNode();
                        hoverString = aminoarray.get(s).getRow();
                        buf.setColor(Color.white);
                        hoverSample = -1;

                        if (aminoarray.get(s).getRow()[1].equals("1")) {
                            for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {
                                if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                        .equals(aminoarray.get(s).getRow()[5])) {

                                    hoverSample = aminoarray.get(s).getNode().vars.get(v).getValue().get(0)
                                            .getSample().getIndex();
                                    hoverSampleNode = aminoarray.get(s).getNode().vars.get(v).getValue().get(0);
                                    hoverBase = aminoarray.get(s).getRow()[5];
                                    break;
                                }
                            }
                        }
                        //      hoverSample = -1;

                    }

                    if (!aminoarray.get(s).getRow()[1].equals("1")) {
                        buf.drawString("Multiple", 24, (rowHeight * (i + s + listAdd + 2))
                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                    } else {
                        for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {

                            if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                    .equals(aminoarray.get(s).getRow()[5])) {

                                buf.drawString(
                                        aminoarray.get(s).getNode().vars.get(v).getValue().get(0).getSample()
                                                .getName(),
                                        24, (rowHeight * (i + s + listAdd + 2))
                                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
                                break;
                            }
                        }
                    }

                    if (hoverVar != null && hoverString.equals(aminoarray.get(s).getRow())) {
                        //TODO
                        textcolor = Color.white;

                    }

                    for (int h = 1; h < 4; h++) {
                        buf.setColor(Color.black);
                        buf.fillRect((int) geneheader.get(h)[1] + 10,
                                (rowHeight * (i + s + listAdd + 2))
                                        - tablescroll.getVerticalScrollBar().getValue() + 4,
                                (int) geneheader.get(h)[2], rowHeight - 1);
                        buf.setColor(textcolor);
                        if (h == 3) {
                            if (aminoarray.get(s).getRow()[5].length() == 1) {
                                buf.drawString(
                                        Main.getBase.get(aminoarray.get(s).getNode().getRefBase()) + ">"
                                                + aminoarray.get(s).getRow()[5],
                                        (int) geneheader.get(h)[1] + 14, (rowHeight * (i + s + listAdd + 2))
                                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
                            } else {
                                buf.drawString(aminoarray.get(s).getRow()[5], (int) geneheader.get(h)[1] + 14,
                                        (rowHeight * (i + s + listAdd + 2))
                                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                            }
                            buf.setColor(Color.black);
                            buf.fillRect((int) geneheader.get(4)[1] + 10,
                                    (rowHeight * (i + s + listAdd + 2))
                                            - tablescroll.getVerticalScrollBar().getValue() + 4,
                                    (int) geneheader.get(4)[2], rowHeight - 1);
                            buf.setColor(textcolor);
                            buf.drawString(aminoarray.get(s).getRow()[h], (int) geneheader.get(4)[1] + 14,
                                    (rowHeight * (i + s + listAdd + 2))
                                            - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                        } else {

                            buf.drawString(aminoarray.get(s).getRow()[h], (int) geneheader.get(h)[1] + 14,
                                    (rowHeight * (i + s + listAdd + 2))
                                            - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                        }
                    }

                    if (aminoarray.get(s).getRow()[1].equals("1")) {
                        buf.setColor(Color.black);
                        buf.fillRect((int) geneheader.get(5)[1] + 10,
                                (rowHeight * (i + s + listAdd + 2))
                                        - tablescroll.getVerticalScrollBar().getValue() + 4,
                                (int) geneheader.get(5)[2], rowHeight - 1);
                        buf.setColor(textcolor);

                        for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {
                            if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                    .equals(aminoarray.get(s).getRow()[5])) {
                                if (aminoarray.get(s).getNode().vars.get(v).getValue().get(0).isHomozygous()) {
                                    buf.drawString(
                                            "Hom (" + aminoarray.get(s).getNode().vars.get(v).getValue().get(0)
                                                    .getCalls() + "/"
                                                    + aminoarray.get(s).getNode().vars.get(v).getValue().get(0)
                                                            .getCoverage()
                                                    + ")",
                                            (int) geneheader.get(5)[1] + 14,
                                            (rowHeight * (i + s + listAdd + 2))
                                                    - tablescroll.getVerticalScrollBar().getValue()
                                                    + rowHeight);
                                    if (Control.controlData.controlsOn) {
                                        cases = 2;
                                        casefreq = 2 / (double) (Main.varsamples * 2 - 2);
                                    }
                                } else {
                                    buf.drawString(
                                            "Het (" + aminoarray.get(s).getNode().vars.get(v).getValue().get(0)
                                                    .getCalls() + "/"
                                                    + aminoarray.get(s).getNode().vars.get(v).getValue().get(0)
                                                            .getCoverage()
                                                    + ")",
                                            (int) geneheader.get(5)[1] + 14,
                                            (rowHeight * (i + s + listAdd + 2))
                                                    - tablescroll.getVerticalScrollBar().getValue()
                                                    + rowHeight);
                                    if (Control.controlData.controlsOn) {
                                        cases = 1;
                                        casefreq = 1 / (double) (Main.varsamples * 2 - 1);
                                    }

                                }
                                buf.setColor(Color.black);
                                buf.fillRect((int) geneheader.get(6)[1] + 10,
                                        (rowHeight * (i + s + listAdd + 2))
                                                - tablescroll.getVerticalScrollBar().getValue() + 4,
                                        this.getWidth(), rowHeight - 1);
                                buf.setColor(textcolor);
                                buf.drawString(
                                        "" + aminoarray.get(s).getNode().vars.get(v).getValue().get(0)
                                                .getQuality(),
                                        (int) geneheader.get(6)[1] + 14, (rowHeight * (i + s + listAdd + 2))
                                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);

                            }
                        }
                    } else {
                        //TODO piirra mustat boksit
                        buf.setColor(Color.black);
                        buf.fillRect((int) geneheader.get(5)[1] + 10,
                                (rowHeight * (i + s + listAdd + 2))
                                        - tablescroll.getVerticalScrollBar().getValue() + 4,
                                this.getWidth(), rowHeight - 1);

                        if (Control.controlData.controlsOn) {
                            cases = 0;

                            for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {
                                if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                        .equals(aminoarray.get(s).getRow()[5])) {
                                    for (int j = 0; j < aminoarray.get(s).getNode().vars.get(v).getValue()
                                            .size(); j++) {
                                        if (aminoarray.get(s).getNode().vars.get(v).getValue()
                                                .get(j).alleles != null) {
                                            continue;
                                        }
                                        if (aminoarray.get(s).getNode().vars.get(v).getValue().get(j)
                                                .isHomozygous()) {
                                            cases += 2;
                                        } else {
                                            cases += 1;
                                        }
                                    }
                                }
                            }
                            casefreq = cases / (double) (Main.varsamples * 2 - cases);

                        }
                    }
                    buf.setColor(textcolor);
                    buf.drawString(aminoarray.get(s).getRow()[4], (int) geneheader.get(7)[1] + 14,
                            (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue()
                                    + rowHeight);
                    //      buf.setColor(Color.black);

                    if (Control.controlData.controlsOn) {
                        buf.setColor(textcolor);

                        for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {
                            if (aminoarray.get(s).getNode().vars.get(v).getKey()
                                    .equals(aminoarray.get(s).getRow()[5])) {
                                vararray = aminoarray.get(s).getNode().vars.get(v).getValue();
                                controlarray = new SampleNode[Control.controlData.fileArray.size()];
                                if (vararray.get(vararray.size() - 1).alleles != null) {

                                    for (int e = vararray.size() - 1; e > 0; e--) {

                                        if (vararray.get(e).alleles == null) {
                                            break;
                                        }

                                        controlarray[vararray.get(e).getControlSample().getIndex()] = vararray
                                                .get(e);

                                    }
                                }

                                for (int e = 0; e < controlarray.length; e++) {
                                    if (Control.controlData.fileArray.get(e).controlOn) {
                                        if (controlarray[e] == null) {
                                            buf.setColor(Color.black);
                                            buf.fillRect(
                                                    (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 11,
                                                    (rowHeight * (i + s + listAdd + 2))
                                                            - tablescroll.getVerticalScrollBar().getValue() + 4,
                                                    this.getWidth(), rowHeight - 1);
                                            buf.setColor(textcolor);
                                            buf.drawString("0",
                                                    (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 14,
                                                    (rowHeight * (i + s + listAdd + 2))
                                                            - tablescroll.getVerticalScrollBar().getValue()
                                                            + rowHeight);
                                            buf.setColor(Color.black);
                                            buf.fillRect(
                                                    (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1]
                                                            + 11,
                                                    (rowHeight * (i + s + listAdd + 2))
                                                            - tablescroll.getVerticalScrollBar().getValue() + 4,
                                                    this.getWidth(), rowHeight - 1);
                                            buf.setColor(textcolor);
                                            buf.drawString("-",
                                                    (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1]
                                                            + 14,
                                                    (rowHeight * (i + s + listAdd + 2))
                                                            - tablescroll.getVerticalScrollBar().getValue()
                                                            + rowHeight);

                                        } else {
                                            buf.setColor(Color.black);
                                            buf.fillRect(
                                                    (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 11,
                                                    (rowHeight * (i + s + listAdd + 2))
                                                            - tablescroll.getVerticalScrollBar().getValue() + 4,
                                                    this.getWidth(), rowHeight - 1);
                                            buf.setColor(textcolor);
                                            buf.drawString(
                                                    "" + MethodLibrary.round(controlarray[e].alleles
                                                            / (double) controlarray[e].allelenumber, 5),
                                                    (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 14,
                                                    (rowHeight * (i + s + listAdd + 2))
                                                            - tablescroll.getVerticalScrollBar().getValue()
                                                            + rowHeight);
                                            buf.setColor(Color.black);
                                            buf.fillRect(
                                                    (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1]
                                                            + 11,
                                                    (rowHeight * (i + s + listAdd + 2))
                                                            - tablescroll.getVerticalScrollBar().getValue() + 4,
                                                    this.getWidth(), rowHeight - 1);
                                            buf.setColor(textcolor);

                                            buf.drawString(
                                                    "" + MethodLibrary.round(casefreq / (controlarray[e].alleles
                                                            / (double) (controlarray[e].allelenumber
                                                                    - controlarray[e].alleles)),
                                                            2) + " (p="
                                                            + MethodLibrary.round(
                                                                    fe.getRightTailedP(cases,
                                                                            Main.varsamples * 2 - cases,
                                                                            controlarray[e].alleles,
                                                                            controlarray[e].allelenumber
                                                                                    - controlarray[e].alleles),
                                                                    2)
                                                            + ")",
                                                    (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1]
                                                            + 14,
                                                    (rowHeight * (i + s + listAdd + 2))
                                                            - tablescroll.getVerticalScrollBar().getValue()
                                                            + rowHeight);

                                        }
                                    } else {
                                        buf.setColor(Color.black);
                                        buf.fillRect(
                                                (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 11,
                                                (rowHeight * (i + s + listAdd + 2))
                                                        - tablescroll.getVerticalScrollBar().getValue() + 4,
                                                this.getWidth(), rowHeight - 1);
                                        buf.setColor(Color.darkGray);
                                        buf.drawString("Apply controls",
                                                (int) geneheader.get(this.geneheaderlength + e * 2)[1] + 14,
                                                (rowHeight * (i + s + listAdd + 2))
                                                        - tablescroll.getVerticalScrollBar().getValue()
                                                        + rowHeight);
                                        buf.setColor(Color.black);
                                        buf.fillRect(
                                                (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1] + 11,
                                                (rowHeight * (i + s + listAdd + 2))
                                                        - tablescroll.getVerticalScrollBar().getValue() + 4,
                                                this.getWidth(), rowHeight - 1);
                                        buf.setColor(Color.darkGray);
                                        buf.drawString("-",
                                                (int) geneheader.get(this.geneheaderlength + e * 2 + 1)[1] + 14,
                                                (rowHeight * (i + s + listAdd + 2))
                                                        - tablescroll.getVerticalScrollBar().getValue()
                                                        + rowHeight);
                                    }
                                }
                            }
                        }
                    } else {
                        buf.setColor(Color.darkGray);

                        for (int e = geneheaderlength; e < geneheader.size(); e++) {
                            if (geneheader.get(e)[0] instanceof ControlFile) {
                                buf.drawString("Apply controls", (int) geneheader.get(e)[1] + 14,
                                        (rowHeight * (i + s + listAdd + 2))
                                                - tablescroll.getVerticalScrollBar().getValue() + rowHeight);
                            }
                        }
                        buf.setColor(Color.lightGray);
                    }
                    vararray = null;
                    //if(Main.bedCanvas.bedOn) {               

                    for (int a = 0; a < aminoarray.size(); a++) {

                        bedarray = MethodLibrary.makeTrackArray(aminoarray.get(a).getNode(),
                                aminoarray.get(a).getRow()[5]);
                        if (bedarray != null) {
                            for (int b = 0; b < bedarray.length; b++) {
                                buf.setColor(Color.black);
                                if (b == bedarray.length - 1) {
                                    buf.fillRect(
                                            (int) geneheader.get(geneheaderlength
                                                    + Control.controlData.fileArray.size() * 2 + b)[1] + 12,
                                            (rowHeight * (i + a + listAdd + 2))
                                                    - tablescroll.getVerticalScrollBar().getValue() + 4,
                                            this.getWidth() - (int) geneheader.get(geneheaderlength
                                                    + Control.controlData.fileArray.size() * 2 + b)[1],
                                            rowHeight - 1);
                                } else {
                                    buf.fillRect(
                                            (int) geneheader.get(geneheaderlength
                                                    + Control.controlData.fileArray.size() * 2 + b)[1] + 12,
                                            (rowHeight * (i + a + listAdd + 2))
                                                    - tablescroll.getVerticalScrollBar().getValue() + 4,
                                            (int) geneheader.get(geneheaderlength
                                                    + Control.controlData.fileArray.size() * 2 + b)[2],
                                            rowHeight - 1);
                                }
                                buf.setColor(Color.white);
                                if (bedarray[b] != null) {
                                    buf.drawString(bedarray[b].toString(),
                                            (int) geneheader.get(geneheaderlength
                                                    + Control.controlData.fileArray.size() * 2 + b)[1] + 14,
                                            (rowHeight * (i + a + listAdd + 2))
                                                    - tablescroll.getVerticalScrollBar().getValue()
                                                    + rowHeight);

                                }
                            }
                        }
                    }

                    /*if(c < header.size()-1-Main.bedCanvas.bedTrack.size()) {
                       buf.setColor(Color.black);
                       buf.fillRect((int)header.get(c+1)[1]+1, (rowHeight*(i+genemutcount+1))-tablescroll.getVerticalScrollBar().getValue()+4, (int)header.get(c)[2], rowHeight-1);   
                                 
                    }*/
                    //   }

                    buf.setColor(Color.darkGray);
                    for (int j = 0; j < geneheader.size(); j++) {

                        buf.drawLine((int) geneheader.get(j)[1] + 11,
                                (rowHeight * (i + s + listAdd + 2))
                                        - tablescroll.getVerticalScrollBar().getValue() + 4,
                                (int) geneheader.get(j)[1] + 11, (rowHeight * (i + s + listAdd + 3))
                                        - tablescroll.getVerticalScrollBar().getValue() + 3);
                    }
                    if (selectedVar != null && selectedString.equals(aminoarray.get(s).getRow())
                            && Integer.parseInt(selectedString[1]) > 1) {
                        pointer = 0;
                        //TODO

                        for (int v = 0; v < aminoarray.get(s).getNode().vars.size(); v++) {
                            if (aminoarray.get(s).getNode().vars.get(v).getKey().equals(selectedString[5])) {

                                for (int l = 0; l < aminoarray.get(s).getNode().vars.get(v).getValue()
                                        .size(); l++) {
                                    if (aminoarray.get(s).getNode().vars.get(v).getValue()
                                            .get(l).alleles != null) {
                                        break;
                                    }
                                    if (aminoarray.get(s).getNode().vars.get(v).getValue().get(l)
                                            .getSample().annotation) {
                                        continue;
                                    }
                                    if (mouseY > (rowHeight * (i + s + pointer + 4))
                                            && mouseY < (rowHeight * (i + s + pointer + 5))) {
                                        textcolor = Color.white;

                                        hoverVar = aminoarray.get(s).getNode();
                                        hoverString = aminoarray.get(s).getRow();
                                        hoverSample = aminoarray.get(s).getNode().vars.get(v).getValue().get(l)
                                                .getSample().getIndex();
                                        hoverSampleNode = aminoarray.get(s).getNode().vars.get(v).getValue()
                                                .get(l);
                                        hoverBase = aminoarray.get(s).getRow()[5];
                                    } else {
                                        textcolor = Color.lightGray;
                                    }

                                    //   if(aminoarray.get(s).getNode().getSamples().get(l).getVariation().equals(selectedString[5])) {                           
                                    buf.setColor(textcolor);
                                    buf.drawString(
                                            aminoarray.get(s).getNode().vars.get(v).getValue().get(l)
                                                    .getSample().getName(),
                                            30,
                                            (rowHeight * (i + s + pointer + 4))
                                                    - tablescroll.getVerticalScrollBar().getValue()
                                                    + rowHeight);
                                    pointer++;
                                    //   }   

                                    buf.setColor(Color.black);
                                    buf.fillRect((int) geneheader.get(5)[1] + 10,
                                            (rowHeight * (i + s + pointer + 3))
                                                    - tablescroll.getVerticalScrollBar().getValue() + 4,
                                            this.getWidth(), rowHeight - 1);
                                    buf.setColor(textcolor);
                                    if (aminoarray.get(s).getNode().vars.get(v).getValue().get(l)
                                            .isHomozygous()) {
                                        buf.drawString(
                                                "Hom (" + aminoarray.get(s).getNode().vars.get(v).getValue()
                                                        .get(l).getCalls() + "/"
                                                        + aminoarray.get(s).getNode().vars.get(v).getValue()
                                                                .get(l).getCoverage()
                                                        + ")",
                                                (int) geneheader.get(5)[1] + 14,
                                                (rowHeight * (i + s + pointer + 3))
                                                        - tablescroll.getVerticalScrollBar().getValue()
                                                        + rowHeight);

                                    } else {
                                        buf.drawString(
                                                "Het (" + aminoarray.get(s).getNode().vars.get(v).getValue()
                                                        .get(l).getCalls() + "/"
                                                        + aminoarray.get(s).getNode().vars.get(v).getValue()
                                                                .get(l).getCoverage()
                                                        + ")",
                                                (int) geneheader.get(5)[1] + 14,
                                                (rowHeight * (i + s + pointer + 3))
                                                        - tablescroll.getVerticalScrollBar().getValue()
                                                        + rowHeight);
                                    }
                                    buf.setColor(Color.black);
                                    buf.fillRect((int) geneheader.get(6)[1] + 10,
                                            (rowHeight * (i + s + pointer + 3))
                                                    - tablescroll.getVerticalScrollBar().getValue() + 4,
                                            this.getWidth(), rowHeight - 1);
                                    buf.setColor(textcolor);
                                    buf.drawString(
                                            "" + aminoarray.get(s).getNode().vars
                                                    .get(v).getValue().get(l).getQuality(),
                                            (int) geneheader.get(6)[1] + 14,
                                            (rowHeight * (i + s + pointer + 3))
                                                    - tablescroll.getVerticalScrollBar().getValue()
                                                    + rowHeight);
                                    buf.setColor(Color.darkGray);
                                    for (int j = 5; j < 7; j++) {

                                        buf.drawLine((int) geneheader.get(j)[1] + 11,
                                                (rowHeight * (i + s + pointer + 3))
                                                        - tablescroll.getVerticalScrollBar().getValue(),
                                                (int) geneheader.get(j)[1] + 11,
                                                (rowHeight * (i + s + pointer + 3))
                                                        - tablescroll.getVerticalScrollBar().getValue()
                                                        + rowHeight + 2);
                                    }
                                }
                            }

                        }
                        listAdd = Integer.parseInt(selectedString[1]) + 1;
                        genemutcount = aminoarray.size() + listAdd;
                        buf.setColor(Color.darkGray);
                        buf.drawLine(21,
                                (rowHeight * (i + s + listAdd + 3))
                                        - tablescroll.getVerticalScrollBar().getValue() + 3,
                                this.getWidth(), (rowHeight * (i + s + listAdd + 3))
                                        - tablescroll.getVerticalScrollBar().getValue() + 3);

                    }

                }
            }
        } catch (Exception e) {
            ErrorLog.addError(e.getStackTrace());
            e.printStackTrace();
        }

    }
    buf.setColor(Color.darkGray);
    buf.drawLine(4,
            (rowHeight * (genearray.size() + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue()
                    + 3,
            this.getWidth(), (rowHeight * (genearray.size() + genemutcount + 1))
                    - tablescroll.getVerticalScrollBar().getValue() + 3);

    drawHeader();
    if (headerHover == -1 && geneHeaderHover == -1) {

        setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    } else {
        if (resizeColumn == -1) {
            setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        } else {
            setCursor(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR));
        }
    }

    g.drawImage(bufImage, 0, tablescroll.getVerticalScrollBar().getValue(), null);

}

From source file:org.openmicroscopy.shoola.agents.treeviewer.view.TreeViewerComponent.java

/**
 * Implemented as specified by the {@link TreeViewer} interface.
 * @see TreeViewer#onDataObjectSave(DataObject, DataObject, int)
 *//*from  w  ww  .  j ava2  s. co m*/
public void onDataObjectSave(DataObject data, DataObject parent, int operation) {
    int state = model.getState();
    if (operation == REMOVE_OBJECT && state != SAVE)
        throw new IllegalStateException("This method can only be " + "invoked in the SAVE state");
    switch (state) {
    case DISCARDED:
        throw new IllegalStateException("This method cannot be " + "invoked in the DISCARDED state");
    }
    if (data == null)
        throw new IllegalArgumentException("No data object. ");
    switch (operation) {
    case CREATE_OBJECT:
    case UPDATE_OBJECT:
    case REMOVE_OBJECT:
        break;
    default:
        throw new IllegalArgumentException("Save operation not " + "supported.");
    }
    //removeEditor(); //remove the currently selected editor.
    if (operation == REMOVE_OBJECT) {
        model.setState(READY);
        fireStateChange();
    }
    view.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    Browser browser = null;
    if (operation == CREATE_OBJECT) {
        if (parent == null) {
            if ((data instanceof ProjectData) || (data instanceof DatasetData))
                browser = model.getBrowser(Browser.PROJECTS_EXPLORER);
            else if (data instanceof ScreenData)
                browser = model.getBrowser(Browser.SCREENS_EXPLORER);
            else if (data instanceof TagAnnotationData)
                browser = model.getBrowser(Browser.TAGS_EXPLORER);
        }
        if (browser != null) {
            model.setSelectedBrowser(browser);
            view.addBrowser(browser);
            removeEditor();
        }
    }
    browser = model.getSelectedBrowser();
    if (browser != null && operation != UPDATE_OBJECT)
        browser.refreshTree(null, null);
    if (operation == REMOVE_OBJECT || operation == CREATE_OBJECT) {
        DataBrowserFactory.discardAll();
        view.removeAllFromWorkingPane();
    }
    if (operation == UPDATE_OBJECT && browser != null) {
        browser.accept(new UpdateVisitor(browser, data));
        browser.getUI().repaint();
    }
    setStatus(false, "", true);
    view.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

From source file:org.openmicroscopy.shoola.agents.treeviewer.view.TreeViewerComponent.java

/**
 * Implemented as specified by the {@link TreeViewer} interface.
 * @see TreeViewer#onOrphanDataObjectCreated(DataObject, int)
 *///w  ww . j a v  a2 s  .  c o m
public void onOrphanDataObjectCreated(DataObject data) {
    view.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    Browser browser = model.getSelectedBrowser();
    if (browser != null)
        browser.onOrphanDataObjectCreated(data);

    setStatus(false, "", true);
    view.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

From source file:pl.edu.icm.visnow.geometries.viewer3d.Display3DPanel.java

public void setPick3DActive(boolean pick3DActive) {

    if (!pick3DActive) {
        this.removeChild(pickObject.getOutObject());
        setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    } else {/*from  ww  w . j a va 2s.  c  om*/
        this.addChild(pickObject.getOutObject());
        //            setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); // not needed?
        initializeOnceCrosshairCursor();
        setCursor(crosshairCursor);
    }

    this.pickObject.setActive(pick3DActive);

}

From source file:org.openmicroscopy.shoola.agents.treeviewer.view.TreeViewerComponent.java

/**
 * Implemented as specified by the {@link TreeViewer} interface.
 * @see TreeViewer#onDataObjectSave(List, int)
 *///from   w  w w .j  a v  a2  s.  c om
public void onDataObjectSave(List data, int operation) {
    int state = model.getState();
    if (operation == REMOVE_OBJECT && state != SAVE)
        throw new IllegalStateException("This method can only be " + "invoked in the SAVE state");
    switch (state) {
    case DISCARDED:
        throw new IllegalStateException("This method cannot be " + "invoked in the DISCARDED state");
    }
    if (data == null)
        throw new IllegalArgumentException("No data object. ");
    switch (operation) {
    case CREATE_OBJECT:
    case UPDATE_OBJECT:
    case REMOVE_OBJECT:
        break;
    default:
        throw new IllegalArgumentException("Save operation not " + "supported.");
    }
    //removeEditor(); //remove the currently selected editor.
    if (operation == REMOVE_OBJECT) {
        model.setState(READY);
        fireStateChange();
    }
    view.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    setStatus(false, "", true);
    view.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

From source file:org.openmicroscopy.shoola.agents.treeviewer.view.TreeViewerComponent.java

/**
 * Implemented as specified by the {@link TreeViewer} interface.
 * @see TreeViewer#clearFoundResults()//from  w w  w. j  a  v a  2s.  c o  m
 */
public void clearFoundResults() {
    switch (model.getState()) {
    case DISCARDED:
    case SAVE:
        return;
    }
    Browser browser = model.getSelectedBrowser();
    view.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    if (browser != null) {
        browser.accept(new ClearVisitor());
        browser.setFoundInBrowser(null);
    }
    view.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}

From source file:com.mirth.connect.client.ui.browsers.message.MessageBrowser.java

/**
 * An action for when a row is selected in the table
 *///from   w  w  w . j  a  va2 s  .  c  o m
private void MessageListSelected(ListSelectionEvent evt) {
    if (!evt.getValueIsAdjusting()) {
        int row = getSelectedMessageIndex();

        if (row >= 0) {
            // Cancel all pretty printing tasks
            for (Future<Void> worker : prettyPrintWorkers) {
                worker.cancel(true);
            }
            prettyPrintWorkers.clear();

            parent.setVisibleTasks(parent.messageTasks, parent.messagePopupMenu, 6, 6, true);
            parent.setVisibleTasks(parent.messageTasks, parent.messagePopupMenu, 7, -1, isChannelDeployed);

            this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

            // Get the table node
            MessageBrowserTableNode messageNode = (MessageBrowserTableNode) messageTreeTable.getPathForRow(row)
                    .getLastPathComponent();

            if (messageNode.isNodeActive()) {
                // Get the messageId from the message node
                Long messageId = messageNode.getMessageId();
                // Get the metaDataId from the message node
                Integer metaDataId = messageNode.getMetaDataId();

                // Attempt to get the message from the message cache
                Message message = messageCache.get(messageId);
                List<Attachment> attachments = attachmentCache.get(messageId);

                // If the message is not in the cache, retrieve it from the server
                if (message == null) {
                    try {
                        message = parent.mirthClient.getMessageContent(channelId, messageId,
                                selectedMetaDataIds);
                        // If the message was not found (ie. it may have been deleted during the request), do nothing
                        if (message == null || message.getConnectorMessages().size() == 0) {
                            clearDescription(
                                    "Could not retrieve message content. The message may have been deleted.");
                            this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                            return;
                        }

                        attachments = parent.mirthClient.getAttachmentsByMessageId(channelId, messageId, false);
                    } catch (Throwable t) {
                        if (t.getMessage().contains("Java heap space")) {
                            parent.alertError(parent,
                                    "There was an out of memory error when trying to retrieve message content.\nIncrease your heap size and try again.");
                        } else if (t instanceof RequestAbortedException) {
                            // The client is no longer waiting for the message content request
                        } else {
                            parent.alertThrowable(parent, t);
                        }
                        this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                        return;
                    }
                    // Add the retrieved message to the message cache
                    messageCache.put(messageId, message);
                    attachmentCache.put(messageId, attachments);
                }

                ConnectorMessage connectorMessage = message.getConnectorMessages().get(metaDataId);

                if (connectorMessage != null) {
                    // Update the message tabs
                    updateDescriptionMessages(connectorMessage);
                    // Update the mappings tab
                    updateDescriptionMappings(connectorMessage);
                    // Update the attachments tab
                    updateAttachmentsTable(messageId);
                    // Update the errors tab
                    updateDescriptionErrors(connectorMessage);
                    // Show relevant tabs. Not using errorCode here just in case for some reason there are errors even though errorCode is 0
                    updateDescriptionTabs(connectorMessage.getProcessingError() != null
                            || connectorMessage.getPostProcessorError() != null
                            || connectorMessage.getResponseError() != null, attachments.size() > 0);
                    updateMessageRadioGroup();

                    if (attachmentTable == null || attachmentTable.getSelectedRow() == -1
                            || descriptionTabbedPane.indexOfTab("Attachments") == -1) {
                        parent.setVisibleTasks(parent.messageTasks, parent.messagePopupMenu, 9, 10, false);
                    }
                }
            } else {
                clearDescription(null);
            }

            this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));

        }
    }
}

From source file:org.openmicroscopy.shoola.agents.treeviewer.view.TreeViewerComponent.java

/**
 * Implemented as specified by the {@link TreeViewer} interface.
 * @see TreeViewer#setExistingObjects(List)
 *//*from   ww  w . ja  v a 2  s .  c om*/
public void setExistingObjects(List objects) {
    if (model.getState() != LOADING_DATA)
        throw new IllegalStateException("This method cannot be invoked in the LOADING_DATA state.");
    setStatus(false, "", true);
    view.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    model.setState(READY);
    if (CollectionUtils.isEmpty(objects))
        return;
    Browser b = model.getSelectedBrowser();
    List<Object> available = new ArrayList<Object>();
    List<Object> immutable = new ArrayList<Object>();
    Set selected = null;
    if (b != null) {
        TreeImageDisplay[] values = b.getSelectedDisplays();
        if (values != null && values.length > 0) {
            // Only modify the first group from the list of groups
            Object value = values[0].getUserObject();
            if (value instanceof GroupData) {
                long groupId = ((GroupData) value).getId();
                ExperimenterData currentUser = model.getExperimenter();
                selected = new HashSet<ExperimenterData>();
                long userID = currentUser.getId();
                long id;
                List<Long> ids = new ArrayList<Long>();
                for (ExperimenterData experimenter : (List<ExperimenterData>) objects) {
                    id = experimenter.getId();
                    if (experimenter.isMemberOfGroup(groupId)) {
                        ids.add(id);
                        selected.add(experimenter);
                        //Cannot move guest or root
                        if ((model.isSystemUser(id, GroupData.GUEST)
                                && model.isSystemGroup(groupId, GroupData.GUEST))) {
                            immutable.add(experimenter);
                        } else if (model.isSystemGroup(groupId, GroupData.SYSTEM)) {
                            if (model.isSystemUser(id, GroupData.SYSTEM) || id == userID) {
                                immutable.add(experimenter);
                            }
                        }
                    }
                    if (!ids.contains(experimenter.getId())) {
                        available.add(experimenter);
                    }
                }
            }
        } else {
            available.addAll(objects);
        }
    }
    fireStateChange();
    SelectionWizard d = new SelectionWizard(view, available, selected, objects.get(0).getClass(),
            TreeViewerAgent.getUserDetails());
    d.setImmutableElements(immutable);
    IconManager icons = IconManager.getInstance();
    String title = "User Selection";
    String text = "Select the Users who should be in the selected group.";
    Icon icon = icons.getIcon(IconManager.OWNER_48);
    d.setTitle(title, text, icon);
    d.addPropertyChangeListener(controller);
    UIUtilities.centerAndShow(d);
}

From source file:erigo.ctstream.CTstream.java

/**
 * //from  ww w .  j av  a 2  s . c o m
 * mouseMoved
 * 
 * Implement the mouseMoved method defined by interface MouseMotionListener.
 * 
 * This method is part of our homemade window manager; specifically, this method
 * handles setting the appropriate mouse cursor based on where the user has
 * positioned the mouse on the JFrame window.
 * 
 * Why have we implemented our own window manager?  Since translucent panels
 * can only be contained within undecorated Frames (see comments in the top
 * header above) and since undecorated Frames don't support moving/resizing,
 * we implement our own basic "window manager" by catching mouse move and drag
 * events.
 * 
 * @author John P. Wilson
 * @see java.awt.event.MouseMotionListener#mouseMoved(java.awt.event.MouseEvent)
 */
@Override
public void mouseMoved(MouseEvent mouseEventI) {
    // System.err.println("mouseMoved: " + mouseEventI.getX() + "," + mouseEventI.getY());
    mouseCommandMode = NO_COMMAND;
    // Set mouse Cursor based on the current mouse position
    int commandMode = getGUIFrameCommandMode(mouseEventI.getPoint());
    switch (commandMode) {
    case NO_COMMAND:
        guiFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        break;
    case MOVE_FRAME:
        guiFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        break;
    case RESIZE_FRAME_NW:
        guiFrame.setCursor(new Cursor(Cursor.NW_RESIZE_CURSOR));
        break;
    case RESIZE_FRAME_N:
        guiFrame.setCursor(new Cursor(Cursor.N_RESIZE_CURSOR));
        break;
    case RESIZE_FRAME_NE:
        guiFrame.setCursor(new Cursor(Cursor.NE_RESIZE_CURSOR));
        break;
    case RESIZE_FRAME_E:
        guiFrame.setCursor(new Cursor(Cursor.E_RESIZE_CURSOR));
        break;
    case RESIZE_FRAME_SE:
        guiFrame.setCursor(new Cursor(Cursor.SE_RESIZE_CURSOR));
        break;
    case RESIZE_FRAME_S:
        guiFrame.setCursor(new Cursor(Cursor.S_RESIZE_CURSOR));
        break;
    case RESIZE_FRAME_SW:
        guiFrame.setCursor(new Cursor(Cursor.SW_RESIZE_CURSOR));
        break;
    case RESIZE_FRAME_W:
        guiFrame.setCursor(new Cursor(Cursor.W_RESIZE_CURSOR));
        break;
    default:
        guiFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
        break;
    }
}

From source file:org.jab.docsearch.DocSearch.java

/**
 * Load properties file.//ww w. jav  a2s  .c o m
 *
 * @param propertiesFile
 *            Properties file
 * @return Properties
 */
private Properties loadProperties(String propertiesFile) {
    logger.debug("loadProperties('" + propertiesFile + "') entered");

    // cursor "wait"
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    // read property file
    Properties props = new Properties();
    FileInputStream fileIn = null;
    try {
        File propsFile = new File(propertiesFile);
        if (propsFile.isFile()) {
            fileIn = new FileInputStream(propsFile);
            props.load(fileIn);
        } else {
            logger.error("loadProperties() " + propertiesFile + " isn't a file!");
        }
    } catch (IOException ioe) {
        logger.fatal("loadProperties() failed", ioe);
        showMessage(dsErrLdgFi, "\n" + propertiesFile + "\n\n : " + ioe.toString());
    } finally {
        IOUtils.closeQuietly(fileIn);
    }

    // cursor "default"
    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));

    return props;
}