List of usage examples for java.awt Cursor DEFAULT_CURSOR
int DEFAULT_CURSOR
To view the source code for java.awt Cursor DEFAULT_CURSOR.
Click Source Link
From source file:simMPLS.ui.simulator.JVentanaHija.java
/** * Este mtodo se llama cuando se presiona un botn del ratn en el panel de * simulacin. Si se hace sobre un elemento de la topologa, lo marca como * seleccionado./*from w w w.j a va 2 s . c om*/ * When the mouse button is pressed on a node * @since 1.0 * @param evt El evento que provoca la llamada. */ private void clicEnPanelSimulacion(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_clicEnPanelSimulacion if (evt.getButton() == MouseEvent.BUTTON1) { TTopology topo = escenario.getTopology(); TTopologyElement et = topo.obtenerElementoEnPosicion(evt.getPoint()); if (et != null) { this.setCursor(new Cursor(Cursor.HAND_CURSOR)); if (et.getElementType() == TTopologyElement.NODO) { TNode nt = (TNode) et; nodoSeleccionado = nt; if (nodoSeleccionado != null) { nodoSeleccionado.setStatus(TNode.SELECCIONADO); this.escenario.setModified(true); } } } else { this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); this.setToolTipText(null); } panelSimulacion.repaint(); } }
From source file:com.josescalia.tumblr.form.PreferenceForm.java
private void btnCleanLogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCleanLogActionPerformed frame = (MainFrame) this.getTopLevelAncestor(); if (UIAlert.showConfirm(this, "Are you sure ?") == JOptionPane.OK_OPTION) { logger.info("deleting log file"); //busy cursor and progress bar frame.setCursor(new Cursor(Cursor.WAIT_CURSOR)); frame.startProgressBar("Deleting"); //background process new SwingWorker<String, String>() { @Override//from ww w .j a va 2 s .c o m protected String doInBackground() throws Exception { int successDeleteCount = 0; int failedDeleteCount = 0; for (File file : logFile.getFileList()) { logger.info(file.getName()); if (!file.getName().equalsIgnoreCase(Bootstrap.applicationLog) && !file.getName().equalsIgnoreCase(Bootstrap.applicationErrorLog)) { if (file.delete()) { successDeleteCount++; } else { failedDeleteCount++; } } } return "Done\n " + successDeleteCount + " log file(s) deleted\n" + failedDeleteCount + " log file(s) not deleted"; } @Override protected void done() { try { UIAlert.showInformation(null, get()); } catch (InterruptedException e) { logger.error(e); } catch (ExecutionException e) { logger.error(e); } setupLogFileInfo(); frame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); frame.stopProgressBar(""); } }.execute(); } }
From source file:com.josescalia.tumblr.form.PreferenceForm.java
private void btnSelectLFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSelectLFActionPerformed this.setCursor(new Cursor(Cursor.WAIT_CURSOR)); LookAndFeelDialog dlg = new LookAndFeelDialog(null, true); dlg.showDialog();// w w w. j ava 2 s . c o m dlg.setVisible(true); this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); String lAndF = dlg.getLookAndFeel().getLookAndFeelValue(); if (lAndF != null) { txtAppLookAndFeel.setText(lAndF); } }
From source file:com.josescalia.tumblr.form.PreferenceForm.java
private void btnDeleteCacheActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteCacheActionPerformed frame = (MainFrame) this.getTopLevelAncestor(); if (UIAlert.showConfirm(this, "Are you sure ?") == JOptionPane.OK_OPTION) { logger.info("deleting cache"); //busy cursor and frame progress bar frame.setCursor(new Cursor(Cursor.WAIT_CURSOR)); frame.startProgressBar("Deleting"); new SwingWorker<String, String>() { @Override//from w w w .ja v a 2s . c o m protected String doInBackground() throws Exception { int successDeleteCount = 0; int failedDeleteCount = 0; for (File file : cacheFile.getFileList()) { if (!file.getName().contains("ImageNotFound")) { logger.info("deleting file " + file.getName()); if (file.delete()) { successDeleteCount++; } else { failedDeleteCount++; } } } return "Done\n " + successDeleteCount + " cache file(s) deleted\n" + failedDeleteCount + " cache file(s) not deleted"; } @Override protected void done() { try { UIAlert.showInformation(null, get()); getCacheFileInfo(); } catch (InterruptedException e) { logger.error(e); } catch (ExecutionException e) { logger.error(e); } frame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); frame.stopProgressBar(""); } }.execute(); } }
From source file:base.BasePlayer.ClusterTable.java
void drawScreen(Graphics g) { try {/*w w w.ja v a 2 s . c o m*/ buf.setColor(Color.black); buf.fillRect(0, 0, this.getWidth(), tablescroll.getViewport().getHeight()); genemutcount = 0; hoverVar = null; hoverSample = -1; headerHover = -1; geneHeaderHover = -1; if (!mouseDrag) { resizeColumn = -1; } if (Main.drawCanvas.clusterNodes != null) { firstrow = tablescroll.getVerticalScrollBar().getValue() / rowHeight - 1 - Main.drawCanvas.clusterNodes.size(); if (firstrow < 0) { firstrow = 0; } for (int i = 0; i < Main.drawCanvas.clusterNodes.size(); i++) { dot = false; if ((i + 1 + samplecount + Main.drawCanvas.clusterNodes.size()) * 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 = Main.drawCanvas.clusterNodes.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); buf.setColor(linecolor); cluster = Main.drawCanvas.clusterNodes.get(i); if (cluster.varnodes.get(0).getTranscripts() != null) { if (!chrom.equals(cluster.varnodes.get(0).getTranscripts().get(0).getChrom())) { chrom = cluster.varnodes.get(0).getTranscripts().get(0).getChrom(); } } else { if (!chrom.equals(cluster.varnodes.get(0).getExons().get(0).transcript.getChrom())) { chrom = cluster.varnodes.get(0).getExons().get(0).transcript.getChrom(); } } for (int c = 0; c < header.size(); c++) { if (Main.drawCanvas.clusterNodes.get(i).equals(hoverNode) || Main.drawCanvas.clusterNodes.get(i).equals(selectedNode)) { buf.setColor(Color.yellow); } else { buf.setColor(Color.white); } if (c == 0) { buf.drawString("" + cluster.ID, (int) header.get(c)[1] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else if (c == 1) { buf.drawString("" + cluster.nodecount, (int) header.get(c)[1] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else if (c == 2) { buf.drawString("" + cluster.width, (int) header.get(c)[1] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else if (c == 3) { buf.drawString( chrom + ":" + MethodLibrary.formatNumber(cluster.varnodes.get(0).getPosition()), (int) header.get(c)[1] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else if (c == 4) { buf.drawString( "" + MethodLibrary.round((cluster.nodecount / (double) cluster.width), 4), (int) header.get(c)[1] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else if (c == 5) { if (cluster.varnodes.get(0).getExons() != null) { if (cluster.varnodes.get(0).coding) { buf.setColor(Color.red); buf.drawString( cluster.varnodes.get(0).getExons().get(0).getTranscript() .getGenename() + " (Coding)", (int) header.get(c)[1] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.setColor(Color.lightGray); buf.drawString( cluster.varnodes.get(0).getExons().get(0).getTranscript() .getGenename() + " (UTR)", (int) header.get(c)[1] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } else if (cluster.varnodes.get(0).isInGene()) { buf.setColor(Color.lightGray); buf.drawString( cluster.varnodes.get(0).getTranscripts().get(0).getGenename() + " (Intronic)", (int) header.get(c)[1] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.setColor(Color.gray); if (!cluster.varnodes.get(0).getTranscripts().get(0) .equals(cluster.varnodes.get(0).getTranscripts().get(1))) { buf.drawString( cluster.varnodes.get(0).getTranscripts().get(0).getGenename() + " ... " + cluster.varnodes .get(0).getTranscripts().get(1).getGenename(), (int) header.get(c)[1] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { if (cluster.varnodes.get(0).getTranscripts().get(0) .getEnd() > cluster.varnodes.get(0).getPosition()) { buf.drawString( " ... " + cluster.varnodes .get(0).getTranscripts().get(0).getGenename(), (int) header.get(c)[1] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.drawString( cluster.varnodes.get(0).getTranscripts().get(0).getGenename() + " ... ", (int) header.get(c)[1] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } } } else if (c == 6) { if (cluster.varnodes.get(0).getBedHits() != null) { bedarray = MethodLibrary.makeTrackArray(cluster.varnodes.get(0), null); for (int b = 0; b < bedarray.length; b++) { buf.setColor(Color.black); if (b == bedarray.length - 1) { buf.fillRect((int) header.get(c + b)[1] + 1, (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth() - (int) header.get(c + b)[1], rowHeight - 1); } else { buf.fillRect((int) header.get(c + b)[1] + 1, (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, (int) header.get(c + b)[2], rowHeight - 1); } buf.setColor(Color.white); if (bedarray[b] != null) { buf.drawString(bedarray[b].toString(), (int) header.get(c + b)[1] + 5, (rowHeight * (i + 1 + genemutcount)) - 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 + 1)[2], rowHeight - 1); } } buf.setColor(Color.darkGray); buf.drawLine(3, rowHeight + 3, 3, (rowHeight * (i + genemutcount + 2)) - tablescroll.getVerticalScrollBar().getValue() + 3); for (int r = 0; r < header.size(); r++) { buf.drawLine((int) header.get(r)[1], (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, (int) header.get(r)[1], (rowHeight * (i + genemutcount + 2)) - tablescroll.getVerticalScrollBar().getValue() + 3); } if (selectedNode != null && selectedNode.equals(cluster)) { hoverSample = -1; genemutcount = aminoarray.size() + 1; listAdd = 1; buf.drawLine(20, (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 (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); 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(); break; } } } else { if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]) .equals("nonsense")) { buf.setColor(Color.red); } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]) .equals("missense")) { buf.setColor(Color.yellow); } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]) .equals("synonymous")) { buf.setColor(Color.green); } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]) .equals("UTR")) { buf.setColor(Color.lightGray); } else { buf.setColor(Color.gray); } } 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; } else { 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; } } 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); 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(4)[1] + 10, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), 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(4)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); if (Control.controlData.controlsOn) { cases = 2; casefreq = 2 / (double) (Main.varsamples * 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(4)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); if (Control.controlData.controlsOn) { cases = 1; casefreq = 1 / (double) (Main.varsamples * 2); } } buf.setColor(Color.black); buf.fillRect((int) geneheader.get(5)[1] + 1, (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(5)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } } 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])) { if (aminoarray.get(s).getNode().vars.get(v).getValue().get(0) .isHomozygous()) { cases += Integer.parseInt(aminoarray.get(s).getRow()[1]) * 2; } else { cases += Integer.parseInt(aminoarray.get(s).getRow()[1]); } } } casefreq = cases / (double) (Main.varsamples * 2); } buf.setColor(textcolor); buf.drawString(aminoarray.get(s).getRow()[4], (int) geneheader.get(6)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); 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, 2), (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), 2) + " (p=" + MethodLibrary.round( VariantHandler.table.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); } } } } } 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) { //hoverSample = -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 (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(); } 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(4)[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(4)[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(4)[1] + 14, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } 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); buf.drawString( "" + aminoarray.get(s).getNode().vars.get(v).getValue() .get(l).getQuality(), (int) geneheader.get(5)[1] + 14, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.darkGray); for (int j = 4; 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 * (Main.drawCanvas.clusterNodes.size() + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3, this.getWidth(), (rowHeight * (Main.drawCanvas.clusterNodes.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); } catch (Exception e) { e.printStackTrace(); } }
From source file:base.BasePlayer.BedTable.java
void drawScreen(Graphics g) { try {//from w w w. java2 s . co m buf.setColor(Color.black); buf.fillRect(0, 0, this.getWidth(), this.getHeight()); if (width != this.getWidth()) { width = this.getWidth(); createPolygon(); resizeTable(); } genemutcount = 0; if (!bedtrack.intersect) { buf.setColor(Color.white); buf.drawString("Press play on bed track to annotate variants", 5, 40); } else if (getTableSize() > 0) { hoverVar = null; hoverSample = -1; headerHover = -1; geneHeaderHover = -1; if (!mouseDrag) { resizeColumn = -1; } if (aminoarray == null) { aminoarray = new ArrayList<AminoEntry>(); } firstrow = tablescroll.getVerticalScrollBar().getValue() / rowHeight - samplecount - listAdd - aminoarray.size(); if (firstrow < 0) { firstrow = 0; } for (int i = firstrow; i < bedarray.size(); i++) { dot = false; if ((i + 1 + samplecount + listAdd + aminoarray.size()) * 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 = bedarray.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 (bedarray.get(i).equals(hoverNode) || bedarray.get(i).equals(selectedNode)) { buf.setColor(Color.yellow); } else { buf.setColor(Color.white); } if (bedarray.get(i).getTrack().hasvalues) { buf.drawString( (i + 1) + ". " + MethodLibrary.shortString(bedarray.get(i).name, 10) + "=" + MethodLibrary.round(bedarray.get(i).value, 3), 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.drawString((i + 1) + ". " + MethodLibrary.shortString(bedarray.get(i).name, 10), 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } buf.setColor(Color.black); buf.fillRect( headerlengths[1][0] + 1, (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, headerlengths[1][1], rowHeight - 1); if (bedarray.get(i).equals(hoverNode) || bedarray.get(i).equals(selectedNode)) { buf.setColor(Color.yellow); } else { buf.setColor(Color.white); } mutcountbuffer = new StringBuffer("" + bedarray.get(i).mutations + " "); buf.drawString(mutcountbuffer.toString(), headerlengths[1][0] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); // lastpos = Integer.toString(bedarray.get(i).mutations).length() +2; //TODO textWidth = (int)fm.getStringBounds("", buf).getWidth(); // textWidth = (int)fm.getStringBounds(mutcountbuffer.toString(), buf).getWidth(); // buf.drawString(" ", 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(); // buf.drawString(" " +bedarray.get(i).varnodes.size() +" samples", headerlengths[1][0]+5+textWidth, (rowHeight*(i+1+genemutcount))-tablescroll.getVerticalScrollBar().getValue()+rowHeight); buf.setColor(Color.black); buf.fillRect( headerlengths[2][0] + 1, (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); if (bedarray.get(i).equals(hoverNode) || bedarray.get(i).equals(selectedNode)) { buf.setColor(Color.yellow); } else { buf.setColor(Color.white); } buf.drawString( bedarray.get(i).getChrom() + ":" + MethodLibrary.formatNumber(bedarray.get(i).getPosition() + 1) + "-" + MethodLibrary.formatNumber( bedarray.get(i).getPosition() + 1 + bedarray.get(i).getLength()), headerlengths[2][0] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.black); buf.fillRect( headerlengths[3][0] + 1, (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); if (bedarray.get(i).equals(hoverNode) || bedarray.get(i).equals(selectedNode)) { buf.setColor(Color.yellow); } else { buf.setColor(Color.white); } buf.drawString(MethodLibrary.formatNumber(bedarray.get(i).getLength()), headerlengths[3][0] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.black); buf.fillRect( headerlengths[4][0] + 1, (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); if (bedarray.get(i).equals(hoverNode) || bedarray.get(i).equals(selectedNode)) { buf.setColor(Color.yellow); } else { buf.setColor(Color.white); } buf.drawString("" + MethodLibrary .round((bedarray.get(i).mutations / (double) bedarray.get(i).getLength()) * 100, 4), headerlengths[4][0] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.black); buf.fillRect( headerlengths[5][0] + 1, (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), rowHeight - 1); if (bedarray.get(i).equals(hoverNode) || bedarray.get(i).equals(selectedNode)) { buf.setColor(Color.yellow); } else { buf.setColor(Color.white); } firstvisible = 0; if (bedarray.get(i).varnodes != null) { for (int f = 0; f < bedarray.get(i).varnodes.size(); f++) { if (!Main.drawCanvas.hideNode(bedarray.get(i).varnodes.get(f))) { firstvisible = f; break; } } if (bedarray.get(i).varnodes.get(firstvisible).getExons() != null) { if (bedarray.get(i).varnodes.get(firstvisible).coding) { buf.setColor(Color.red); buf.drawString( bedarray.get(i).varnodes.get(firstvisible).getExons().get(0) .getTranscript().getGenename() + " (Coding)", headerlengths[5][0] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.setColor(Color.lightGray); buf.drawString( bedarray.get(i).varnodes.get(firstvisible).getExons().get(0) .getTranscript().getGenename() + " (UTR)", headerlengths[5][0] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } else if (bedarray.get(i).varnodes.get(firstvisible).isInGene()) { buf.setColor(Color.lightGray); buf.drawString( bedarray.get(i).varnodes.get(firstvisible).getTranscripts().get(0) .getGenename() + " (Intronic)", headerlengths[5][0] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.setColor(Color.gray); if (!bedarray.get(i).varnodes.get(firstvisible).getTranscripts().get(0).equals( bedarray.get(i).varnodes.get(firstvisible).getTranscripts().get(1))) { buf.drawString( bedarray.get(i).varnodes.get(firstvisible).getTranscripts().get(0) .getGenename() + " ... " + bedarray.get(i).varnodes.get(firstvisible).getTranscripts() .get(1).getGenename(), headerlengths[5][0] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { if (bedarray.get(i).varnodes.get(firstvisible).getTranscripts().get(0) .getEnd() > bedarray.get(i).varnodes.get(firstvisible).getPosition()) { buf.drawString( " ... " + bedarray.get(i).varnodes.get(firstvisible) .getTranscripts().get(0).getGenename(), headerlengths[5][0] + 5, (rowHeight * (i + 1 + genemutcount)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } else { buf.drawString( bedarray.get(i).varnodes.get(firstvisible).getTranscripts().get(0) .getGenename() + " ... ", headerlengths[5][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(headerlengths[r][0], (rowHeight * (i + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 4, headerlengths[r][0], (rowHeight * (i + genemutcount + 2)) - tablescroll.getVerticalScrollBar().getValue() + 3); } if (selectedNode != null && selectedNode.equals(bedarray.get(i))) { hoverSample = -1; genemutcount = aminoarray.size() + 1; listAdd = 1; buf.drawLine(20, (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 (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); 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(); break; } } } else { if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]) .equals("nonsense")) { buf.setColor(Color.red); } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]) .equals("missense")) { buf.setColor(Color.yellow); } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]) .equals("synonymous")) { buf.setColor(Color.green); } else if (MethodLibrary.aminoEffect(aminoarray.get(s).getRow()[3]) .equals("UTR")) { buf.setColor(Color.lightGray); } else { buf.setColor(Color.gray); } } 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; } else { 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; } } 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); 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(4)[1] + 10, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth(), 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(4)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); if (Control.controlData.controlsOn) { cases = 2; casefreq = 2 / (double) (Main.varsamples * 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(4)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); if (Control.controlData.controlsOn) { cases = 1; casefreq = 1 / (double) (Main.varsamples * 2); } } buf.setColor(Color.black); buf.fillRect((int) geneheader.get(5)[1] + 1, (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(5)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } } } 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])) { if (aminoarray.get(s).getNode().vars.get(v).getValue().get(0) .isHomozygous()) { cases += Integer.parseInt(aminoarray.get(s).getRow()[1]) * 2; } else { cases += Integer.parseInt(aminoarray.get(s).getRow()[1]); } } } casefreq = cases / (double) (Main.varsamples * 2); } buf.setColor(textcolor); buf.drawString(aminoarray.get(s).getRow()[4], (int) geneheader.get(6)[1] + 14, (rowHeight * (i + s + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); 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, 2), (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), 2) + " (p=" + MethodLibrary.round( VariantHandler.table.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++) { StringBuffer[] bedarraytemp = MethodLibrary.makeTrackArray( aminoarray.get(a).getNode(), aminoarray.get(a).getRow()[5]); if (bedarraytemp != null) { int h = 0; for (int b = 0; b < bedarraytemp.length; b++) { if (b == bedtrack.trackIndex) { continue; } buf.setColor(Color.black); if (b == bedarraytemp.length - 1) { buf.fillRect( (int) geneheader.get(geneheaderlength + Control.controlData.fileArray.size() * 2 + h)[1] + 12, (rowHeight * (i + a + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, this.getWidth() - (int) geneheader.get(geneheaderlength + Control.controlData.fileArray.size() * 2 + h)[1], rowHeight - 1); } else { buf.fillRect( (int) geneheader.get(geneheaderlength + Control.controlData.fileArray.size() * 2 + h)[1] + 12, (rowHeight * (i + a + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + 4, (int) geneheader.get(geneheaderlength + Control.controlData.fileArray.size() * 2 + h)[2], rowHeight - 1); } buf.setColor(Color.white); if (bedarraytemp[b] != null) { buf.drawString(bedarraytemp[b].toString(), (int) geneheader.get(geneheaderlength + Control.controlData.fileArray.size() * 2 + h)[1] + 14, (rowHeight * (i + a + listAdd + 2)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } h++; // buf.drawLine((int)geneheader.get(geneheaderlength+Control.controlData.fileArray.size()*2+h)[1], (rowHeight*(i+a+listAdd+2))-tablescroll.getVerticalScrollBar().getValue()+4, (int)geneheader.get(geneheaderlength+Control.controlData.fileArray.size()*2+h)[1], (rowHeight*(i+a+listAdd+2))-tablescroll.getVerticalScrollBar().getValue()+10); } } } } buf.setColor(Color.darkGray); for (int j = 0; j < geneheader.size(); j++) { buf.drawLine((int) geneheader.get(j)[1] + 11, (rowHeight * (i + 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) { //hoverSample = -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 (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(); } 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(4)[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(4)[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(4)[1] + 14, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); } 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); buf.drawString( "" + aminoarray.get(s).getNode().vars.get(v).getValue() .get(l).getQuality(), (int) geneheader.get(5)[1] + 14, (rowHeight * (i + s + pointer + 3)) - tablescroll.getVerticalScrollBar().getValue() + rowHeight); buf.setColor(Color.darkGray); for (int j = 4; 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 * (bedarray.size() + genemutcount + 1)) - tablescroll.getVerticalScrollBar().getValue() + 3, this.getWidth(), (rowHeight * (bedarray.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); } catch (Exception e) { e.printStackTrace(); } }
From source file:neg.JRViewerFactura.java
void btnPrintActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnPrintActionPerformed {//GEN-HEADEREND:event_btnPrintActionPerformed // Add your handling code here: Thread thread = new Thread(new Runnable() { public void run() { try { btnPrint.setEnabled(false); JRViewerFactura.this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); JasperPrintManager.printReport(jasperPrint, true); } catch (Exception ex) { if (log.isErrorEnabled()) log.error("Print error.", ex); JOptionPane.showMessageDialog(JRViewerFactura.this, getBundleString("error.printing")); } finally { JRViewerFactura.this.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); btnPrint.setEnabled(true); }//from w w w .j ava2 s. c o m } }); thread.start(); }
From source file:mondrian.gui.Workbench.java
private void openSchemaFrame(File file, boolean newFile) { try {/*from w w w . j a v a2 s. c o m*/ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (!newFile) { // check if file not already open if (checkFileOpen(file)) { return; } // check if schema file exists if (!file.exists()) { JOptionPane.showMessageDialog(this, getResourceConverter().getFormattedString("workbench.open.schema.not.found", "{0} File not found.", file.getAbsolutePath()), getResourceConverter().getString("workbench.open.schema.not.found.title", "Alert"), JOptionPane.WARNING_MESSAGE); return; } // check if file is writable if (!file.canWrite()) { JOptionPane.showMessageDialog(this, getResourceConverter().getFormattedString("workbench.open.schema.not.writeable", "{0} is not writeable.", file.getAbsolutePath()), getResourceConverter().getString("workbench.open.schema.not.writeable.title", "Alert"), JOptionPane.WARNING_MESSAGE); return; } checkSchemaFile(file); } final JInternalFrame schemaFrame = new JInternalFrame(); schemaFrame.setTitle(getResourceConverter().getFormattedString("workbench.open.schema.title", "Schema - {0}", file.getName())); getNewJdbcMetadata(); schemaFrame.getContentPane().add(new SchemaExplorer(this, file, jdbcMetaData, newFile, schemaFrame)); String errorOpening = ((SchemaExplorer) schemaFrame.getContentPane().getComponent(0)).getErrMsg(); if (errorOpening != null) { JOptionPane.showMessageDialog(this, getResourceConverter().getFormattedString("workbench.open.schema.error", "Error opening schema - {0}.", errorOpening), getResourceConverter().getString("workbench.open.schema.error.title", "Error"), JOptionPane.ERROR_MESSAGE); schemaFrame.setClosed(true); return; } schemaFrame.setBounds(0, 0, 1000, 650); schemaFrame.setClosable(true); schemaFrame.setIconifiable(true); schemaFrame.setMaximizable(true); schemaFrame.setResizable(true); schemaFrame.setVisible(true); desktopPane.add(schemaFrame, javax.swing.JLayeredPane.DEFAULT_LAYER); schemaFrame.show(); schemaFrame.setMaximum(true); displayWarningOnFailedConnection(); final javax.swing.JMenuItem schemaMenuItem = new javax.swing.JMenuItem(); schemaMenuItem.setText(windowMenuMapIndex++ + " " + file.getName()); schemaMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { if (schemaFrame.isIcon()) { schemaFrame.setIcon(false); } else { schemaFrame.setSelected(true); } } catch (Exception ex) { LOGGER.error("schemaMenuItem", ex); } } }); windowMenu.add(schemaMenuItem, 0); windowMenu.setEnabled(true); windowMenu.add(jSeparator3, -1); windowMenu.add(cascadeMenuItem, -1); windowMenu.add(tileMenuItem, -1); windowMenu.add(minimizeMenuItem, -1); windowMenu.add(maximizeMenuItem, -1); windowMenu.add(closeAllMenuItem, -1); // add the file details in menu map schemaWindowMap.put(schemaFrame, schemaMenuItem); updateMDXCatalogList(); schemaFrame.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); schemaFrame.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosing(InternalFrameEvent e) { if (schemaFrame.getContentPane().getComponent(0) instanceof SchemaExplorer) { SchemaExplorer se = (SchemaExplorer) schemaFrame.getContentPane().getComponent(0); int response = confirmFrameClose(schemaFrame, se); if (response == 3) { // not dirty if (se.isNewFile()) { se.getSchemaFile().delete(); } // default case for no save and not dirty schemaWindowMap.remove(schemaFrame); updateMDXCatalogList(); schemaFrame.dispose(); windowMenu.remove(schemaMenuItem); } } } }); schemaFrame.setFocusable(true); schemaFrame.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent e) { if (schemaFrame.getContentPane().getComponent(0) instanceof SchemaExplorer) { SchemaExplorer se = (SchemaExplorer) schemaFrame.getContentPane().getComponent(0); // update view menu based on schemaframe who gained // focus viewXmlMenuItem.setSelected(se.isEditModeXML()); } } public void focusLost(FocusEvent e) { if (schemaFrame.getContentPane().getComponent(0) instanceof SchemaExplorer) { SchemaExplorer se = (SchemaExplorer) schemaFrame.getContentPane().getComponent(0); // update view menu based on viewXmlMenuItem.setSelected(se.isEditModeXML()); } } }); viewXmlMenuItem.setSelected(false); } catch (Exception ex) { LOGGER.error("openSchemaFrame", ex); } finally { setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }
From source file:edu.harvard.i2b2.previousquery.ui.PreviousQueryPanel.java
public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equalsIgnoreCase("Rename ...")) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree1.getSelectionPath().getLastPathComponent(); if (node.getUserObject().getClass().getSimpleName().equalsIgnoreCase("QueryMasterData")) { QueryMasterData ndata = (QueryMasterData) node.getUserObject(); Object inputValue = JOptionPane.showInputDialog(this, "Rename this query to: ", "Rename Query Dialog", JOptionPane.PLAIN_MESSAGE, null, null, ndata.name().substring(0, ndata.name().indexOf("[") - 1)); if (inputValue != null) { String newQueryName = (String) inputValue; String requestXml = ndata.writeRenameQueryXML(newQueryName); setCursor(new Cursor(Cursor.WAIT_CURSOR)); String response = null; if (System.getProperty("webServiceMethod").equals("SOAP")) { // TO DO // response = // QueryListNamesClient.sendQueryRequestSOAP(requestXml); } else { response = QueryListNamesClient.sendQueryRequestREST(requestXml); }/* www . j av a2 s. c om*/ if (response.equalsIgnoreCase("CellDown")) { final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Trouble with connection to the remote server, " + "this is often a network error, please try again", "Network Error", JOptionPane.INFORMATION_MESSAGE); } }); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); return; } if (response != null) { JAXBUtil jaxbUtil = PreviousQueryJAXBUtil.getJAXBUtil(); try { JAXBElement jaxbElement = jaxbUtil.unMashallFromString(response); ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue(); StatusType statusType = messageType.getResponseHeader().getResultStatus().getStatus(); String status = statusType.getType(); if (status.equalsIgnoreCase("DONE")) { // XMLGregorianCalendar cldr = // //queryMasterType.getCreateDate(); Calendar cldr = Calendar.getInstance(Locale.getDefault()); ndata.name(newQueryName + " [" + addZero(cldr.get(Calendar.MONTH) + 1) + "-" + addZero(cldr.get(Calendar.DAY_OF_MONTH)) + "-" + addZero(cldr.get(Calendar.YEAR)) + " ]" + " [" + ndata.userId() + "]"); // ndata.name(newQueryName + " [" + // ndata.userId() // + "]"); node.setUserObject(ndata); // DefaultMutableTreeNode parent = // (DefaultMutableTreeNode) node.getParent(); jTree1.repaint(); } } catch (Exception ex) { ex.printStackTrace(); } } } } else if (node.getUserObject().getClass().getSimpleName().equalsIgnoreCase("QueryResultData")) { QueryResultData rdata = (QueryResultData) node.getUserObject(); // if(!rdata.type().equalsIgnoreCase("PatientSet")) { // return; // } Object inputValue1 = JOptionPane.showInputDialog(this, "Rename this to: ", "Renaming Dialog", JOptionPane.PLAIN_MESSAGE, null, null, rdata.name()); // .substring(0, rdata.name().lastIndexOf("[") - 1)); if (inputValue1 != null) { String newQueryName = (String) inputValue1; String requestXml = rdata.writeRenameQueryXML(newQueryName); setCursor(new Cursor(Cursor.WAIT_CURSOR)); String response = null; if (System.getProperty("webServiceMethod").equals("SOAP")) { // TO DO // response = // QueryListNamesClient.sendQueryRequestSOAP(requestXml); } else { response = QueryListNamesClient.sendQueryRequestREST(requestXml); } if (response.equalsIgnoreCase("CellDown")) { final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Trouble with connection to the remote server, " + "this is often a network error, please try again", "Network Error", JOptionPane.INFORMATION_MESSAGE); } }); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); return; } if (response != null) { JAXBUtil jaxbUtil = PreviousQueryJAXBUtil.getJAXBUtil(); try { JAXBElement jaxbElement = jaxbUtil.unMashallFromString(response); ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue(); StatusType statusType = messageType.getResponseHeader().getResultStatus().getStatus(); String status = statusType.getType(); if (status.equalsIgnoreCase("DONE")) { rdata.name(newQueryName);// + " [" + // rdata.userId() // + "]"); node.setUserObject(rdata); // DefaultMutableTreeNode parent = // (DefaultMutableTreeNode) node.getParent(); jTree1.repaint(); } else { final String tmp = response; final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Error message delivered from the remote server, " + "you may wish to retry your last action", "Server Error", JOptionPane.INFORMATION_MESSAGE); log.error(tmp); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); return; } } catch (Exception ex) { ex.printStackTrace(); } } } } setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } else if (e.getActionCommand().equalsIgnoreCase("Cancel")) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree1.getSelectionPath().getLastPathComponent(); if (node.getUserObject().getClass().getSimpleName().equalsIgnoreCase("QueryMasterData")) { DefaultMutableTreeNode node1 = (DefaultMutableTreeNode) node.getFirstChild(); if (node1.getUserObject().getClass().getSimpleName().equalsIgnoreCase("QueryMasterData")) { final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Please expand this node then try to cancel it.", "Message", JOptionPane.INFORMATION_MESSAGE); } }); return; } QueryInstanceData rdata = (QueryInstanceData) node1.getUserObject(); String requestXml = rdata.writeCancelQueryXML(); setCursor(new Cursor(Cursor.WAIT_CURSOR)); String response = null; if (System.getProperty("webServiceMethod").equals("SOAP")) { // TO DO // response = // QueryListNamesClient.sendQueryRequestSOAP(requestXml); } else { response = QueryListNamesClient.sendQueryRequestREST(requestXml); } if (response.equalsIgnoreCase("CellDown")) { final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Trouble with connection to the remote server, " + "this is often a network error, please try again", "Network Error", JOptionPane.INFORMATION_MESSAGE); } }); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); return; } if (response != null) { JAXBUtil jaxbUtil = PreviousQueryJAXBUtil.getJAXBUtil(); try { JAXBElement jaxbElement = jaxbUtil.unMashallFromString(response); ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue(); StatusType statusType = messageType.getResponseHeader().getResultStatus().getStatus(); String status = statusType.getType(); final JPanel parent = this; if (status.equalsIgnoreCase("DONE")) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "The query is finished.", "Message", JOptionPane.INFORMATION_MESSAGE); // log.error(tmp); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); rdata.name(rdata.name().substring(0, rdata.name().indexOf("-")));// + " [" + // rdata // .userId() // + "]"); node.setUserObject(rdata); // DefaultMutableTreeNode parent = // (DefaultMutableTreeNode) node.getParent(); jTree1.repaint(); } else { final String tmp = response; // final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Error message delivered from the remote server, " + "you may wish to retry your last action", "Server Error", JOptionPane.INFORMATION_MESSAGE); log.error(tmp); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); return; } } catch (Exception ex) { ex.printStackTrace(); } // } } } else if (node.getUserObject().getClass().getSimpleName().equalsIgnoreCase("QueryInstanceData")) { QueryInstanceData rdata = (QueryInstanceData) node.getUserObject(); String requestXml = rdata.writeCancelQueryXML(); setCursor(new Cursor(Cursor.WAIT_CURSOR)); String response = null; if (System.getProperty("webServiceMethod").equals("SOAP")) { // TO DO // response = // QueryListNamesClient.sendQueryRequestSOAP(requestXml); } else { response = QueryListNamesClient.sendQueryRequestREST(requestXml); } if (response.equalsIgnoreCase("CellDown")) { final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Trouble with connection to the remote server, " + "this is often a network error, please try again", "Network Error", JOptionPane.INFORMATION_MESSAGE); } }); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); return; } if (response != null) { JAXBUtil jaxbUtil = PreviousQueryJAXBUtil.getJAXBUtil(); try { JAXBElement jaxbElement = jaxbUtil.unMashallFromString(response); ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue(); StatusType statusType = messageType.getResponseHeader().getResultStatus().getStatus(); String status = statusType.getType(); final JPanel parent = this; if (status.equalsIgnoreCase("DONE")) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "The query is finished.", "Message", JOptionPane.INFORMATION_MESSAGE); // log.error(tmp); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); rdata.name(rdata.name().substring(0, rdata.name().indexOf("-")));// + " [" + // rdata // .userId() // + "]"); node.setUserObject(rdata); // DefaultMutableTreeNode parent = // (DefaultMutableTreeNode) node.getParent(); jTree1.repaint(); } else { final String tmp = response; // final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Error message delivered from the remote server, " + "you may wish to retry your last action", "Server Error", JOptionPane.INFORMATION_MESSAGE); log.error(tmp); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); return; } } catch (Exception ex) { ex.printStackTrace(); } // } } } else { final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Cancel action is not supported on this level", "Message", JOptionPane.INFORMATION_MESSAGE); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } }); } setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } else if (e.getActionCommand().equalsIgnoreCase("Delete")) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) jTree1.getSelectionPath().getLastPathComponent(); QueryMasterData ndata = (QueryMasterData) node.getUserObject(); Object selectedValue = JOptionPane.showConfirmDialog(this, "Delete Query \"" + ndata.name() + "\"?", "Delete Query Dialog", JOptionPane.YES_NO_OPTION); if (selectedValue.equals(JOptionPane.YES_OPTION)) { System.out.println("delete " + ndata.name()); String requestXml = ndata.writeDeleteQueryXML(); // System.out.println(requestXml); setCursor(new Cursor(Cursor.WAIT_CURSOR)); String response = null; if (System.getProperty("webServiceMethod").equals("SOAP")) { // TO DO // response = // QueryListNamesClient.sendQueryRequestSOAP(requestXml); } else { response = QueryListNamesClient.sendQueryRequestREST(requestXml); } if (response.equalsIgnoreCase("CellDown")) { final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Trouble with connection to the remote server, " + "this is often a network error, please try again", "Network Error", JOptionPane.INFORMATION_MESSAGE); } }); setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); return; } if (response != null) { JAXBUtil jaxbUtil = PreviousQueryJAXBUtil.getJAXBUtil(); try { JAXBElement jaxbElement = jaxbUtil.unMashallFromString(response); ResponseMessageType messageType = (ResponseMessageType) jaxbElement.getValue(); StatusType statusType = messageType.getResponseHeader().getResultStatus().getStatus(); String status = statusType.getType(); if (status.equalsIgnoreCase("DONE")) { treeModel.removeNodeFromParent(node); // jTree1.repaint(); } } catch (Exception ex) { ex.printStackTrace(); } } setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); } } else if (e.getActionCommand().equalsIgnoreCase("Refresh All")) { String status = ""; if (isManager) { status = loadPreviousQueries("all users"); } else { status = loadPreviousQueries(UserInfoBean.getInstance().getUserName()); } if (status.equalsIgnoreCase("")) { reset(200, false, false); } else if (status.equalsIgnoreCase("CellDown")) { final JPanel parent = this; java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JOptionPane.showMessageDialog(parent, "Trouble with connection to the remote server, " + "this is often a network error, please try again", "Network Error", JOptionPane.INFORMATION_MESSAGE); } }); } } }
From source file:de.codesourcery.jasm16.ide.ui.views.SourceCodeView.java
protected final void clearUnderlineHighlight() { final Runnable r = new Runnable() { @Override/*from w ww. jav a 2 s .c om*/ public void run() { if (currentUnderlineHighlight != null) { editorPane.getHighlighter().removeHighlight(currentUnderlineHighlight); currentUnderlineHighlight = null; editorPane.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); editorPane.repaint(); } } }; UIUtils.invokeLater(r); }