rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
star.closePath(); g2.fill(star); cornerx = (float)alignedPositions[i] + left - 12; cornery = top + TICK_BOTTOM - 5; float xpoints1[] = {cornerx,cornerx+24.0f,cornerx+4.6f,cornerx+12.0f,cornerx+19.4f}; float ypoints1[] = {cornery,cornery,cornery+14.1f,cornery-8.7f,cornery+14.1f}; star.moveTo(xpoints1[0],ypoints1[0]); for (int index = 1; index < xpoints1.length; index++){ star.lineTo(xpoints1[index],ypoints1[index]); } star.closePath(); g2.fill(star); | triangle.closePath(); g2.fill(triangle); | public void paintComponent(Graphics g){ DPrimeTable dPrimeTable = theData.dpTable; if (Chromosome.getSize() < 2){ //if there zero or only one valid marker return; } Vector blocks = theData.blocks; Rectangle visRect = getVisibleRect(); //deal with zooming if (chartSize.getWidth() > (3*visRect.width)){ showWM = true; }else{ showWM = false; } boolean printValues = true; if (zoomLevel != 0 || Options.getPrintWhat() == LD_NONE){ printValues = false; } printWhat = Options.getPrintWhat(); Graphics2D g2 = (Graphics2D) g; Dimension size = getSize(); Dimension pref = getPreferredSize(); g2.setColor(BG_GREY); //if it's a big dataset, resize properly, if it's small make sure to fill whole background if (size.height < pref.height){ g2.fillRect(0,0,pref.width,pref.height); setSize(pref); }else{ g2.fillRect(0,0,size.width, size.height); } g2.setColor(Color.black); //okay so this dumb if block is to prevent the ugly repainting //bug when loading markers after the data are already being displayed, //results in a little off-centering for small datasets, but not too bad. if (!forExport){ if (!theData.infoKnown){ g2.translate((size.width - pref.width) / 2, (size.height - pref.height) / 2); } else { g2.translate((size.width - pref.width) / 2, 0); } } FontMetrics boxFontMetrics = g2.getFontMetrics(boxFont); int diamondX[] = new int[4]; int diamondY[] = new int[4]; Polygon diamond; double lineSpan = alignedPositions[alignedPositions.length-1] - alignedPositions[0]; long minpos = Chromosome.getMarker(0).getPosition(); long maxpos = Chromosome.getMarker(Chromosome.getSize()-1).getPosition(); double spanpos = maxpos - minpos; //See http://www.hapmap.org/cgi-perl/gbrowse/gbrowse_img //for more info on GBrowse img. int imgHeight = 0; if (Options.isGBrowseShown() && Chromosome.getDataChrom() != null && !Chromosome.getDataChrom().equalsIgnoreCase("none")){ g2.drawImage(gBrowseImage,H_BORDER-GBROWSE_MARGIN,V_BORDER,this); imgHeight = gBrowseImage.getHeight(this) + TRACK_GAP; // get height so we can shift everything down } left = H_BORDER; top = V_BORDER + imgHeight; // push the haplotype display down to make room for gbrowse image. if (forExport){ left -= exportStart * boxSize; } FontMetrics metrics; int ascent; g2.setFont(boldMarkerNameFont); metrics = g2.getFontMetrics(); ascent = metrics.getAscent(); //the following values are the bounds on the boxes we want to //display given that the current window is 'visRect' lowX = getBoundaryMarker(visRect.x-clickXShift-(visRect.y +visRect.height-clickYShift)) - 1; highX = getBoundaryMarker(visRect.x + visRect.width); lowY = getBoundaryMarker((visRect.x-clickXShift)+(visRect.y-clickYShift)) - 1; highY = getBoundaryMarker((visRect.x-clickXShift+visRect.width) + (visRect.y-clickYShift+visRect.height)); if (lowX < 0) { lowX = 0; } if (highX > Chromosome.getSize()-1){ highX = Chromosome.getSize()-1; } if (lowY < lowX+1){ lowY = lowX+1; } if (highY > Chromosome.getSize()){ highY = Chromosome.getSize(); } if (forExport){ lowX = exportStart; lowY = exportStart; highX = exportStop; highY = exportStop+1; } if (theData.trackExists){ //draw the analysis track above where the marker positions will be marked JFreeChart jfc = ChartFactory.createXYLineChart(null,null,null, theData.analysisTracks, PlotOrientation.VERTICAL,false,false,false); //customise the analysis track XYPlot xyp = (XYPlot)jfc.getPlot(); //no x axis, since it takes up too much space. xyp.getDomainAxis().setAxisLineVisible(false); xyp.getDomainAxis().setTickLabelsVisible(false); xyp.getDomainAxis().setTickMarksVisible(false); //x range must align with markers xyp.getDomainAxis().setRange(minpos,maxpos); //size of the axis and graph inset double axisWidth = xyp.getRangeAxis(). reserveSpace(g2,xyp,new Rectangle(0,TRACK_HEIGHT),RectangleEdge.LEFT,null).getLeft(); RectangleInsets insets = xyp.getInsets(); jfc.setBackgroundPaint(BG_GREY); BufferedImage bi = jfc.createBufferedImage( (int)(lineSpan + axisWidth + insets.getLeft() + insets.getRight()),TRACK_HEIGHT); //hide the axis in the margin so everything lines up. g2.drawImage(bi,(int)(left - axisWidth - insets.getLeft()),top,this); top += TRACK_HEIGHT + TRACK_GAP; } if (theData.infoKnown) { Color green = new Color(0, 127, 0); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); //// draw the marker locations g2.setStroke(thinnerStroke); g2.setColor(Color.white); g2.fill(new Rectangle2D.Double(left+1, top+1, lineSpan-1, TICK_HEIGHT-1)); g2.setColor(Color.black); g2.draw(new Rectangle2D.Double(left, top, lineSpan, TICK_HEIGHT)); for (int i = 0; i < Chromosome.getSize(); i++){ double pos = (Chromosome.getMarker(i).getPosition() - minpos) / spanpos; double xx = left + lineSpan*pos; // if we're zoomed, use the line color to indicate whether there is extra data available // (since the marker names are not displayed when zoomed) if (Chromosome.getMarker(i).getExtra() != null) g2.setColor(green); //draw tick g2.setStroke(thickerStroke); g2.draw(new Line2D.Double(xx, top, xx, top + TICK_HEIGHT)); if (Chromosome.getMarker(i).getExtra() != null) g2.setStroke(thickerStroke); else g2.setStroke(thinnerStroke); //draw connecting line g2.draw(new Line2D.Double(xx, top + TICK_HEIGHT, left + alignedPositions[i], top+TICK_BOTTOM)); if (theHV != null){ //draw a star with funny numbers which conform to the golden ratio and make a nice pentagram if (Chromosome.getMarker(i).getDisplayName().equals(theHV.getChosenMarker())){ float cornerx = (float)xx-12.0f; float cornery = top-2; float xpoints[] = {cornerx,cornerx+24.0f,cornerx+4.6f,cornerx+12.0f,cornerx+19.4f}; float ypoints[] = {cornery,cornery,cornery+14.1f,cornery-8.7f,cornery+14.1f}; GeneralPath star = new GeneralPath(GeneralPath.WIND_NON_ZERO,xpoints.length); star.moveTo(xpoints[0],ypoints[0]); for (int index = 1; index < xpoints.length; index++){ star.lineTo(xpoints[index],ypoints[index]); } star.closePath(); g2.fill(star); cornerx = (float)alignedPositions[i] + left - 12; cornery = top + TICK_BOTTOM - 5; float xpoints1[] = {cornerx,cornerx+24.0f,cornerx+4.6f,cornerx+12.0f,cornerx+19.4f}; float ypoints1[] = {cornery,cornery,cornery+14.1f,cornery-8.7f,cornery+14.1f}; star.moveTo(xpoints1[0],ypoints1[0]); for (int index = 1; index < xpoints1.length; index++){ star.lineTo(xpoints1[index],ypoints1[index]); } star.closePath(); g2.fill(star); } } g2.setColor(Color.black); } top += TICK_BOTTOM + TICK_HEIGHT; //// draw the marker names if (printMarkerNames){ widestMarkerName = metrics.stringWidth(Chromosome.getMarker(0).getDisplayName()); for (int x = 1; x < Chromosome.getSize(); x++) { int thiswide = metrics.stringWidth(Chromosome.getMarker(x).getDisplayName()); if (thiswide > widestMarkerName) widestMarkerName = thiswide; } g2.translate(left, top + widestMarkerName); g2.rotate(-Math.PI / 2.0); for (int x = 0; x < Chromosome.getSize(); x++) { if (theData.isInBlock[x]){ g2.setFont(boldMarkerNameFont); }else{ g2.setFont(markerNameFont); } if (Chromosome.getMarker(x).getExtra() != null) g2.setColor(green); g2.drawString(Chromosome.getMarker(x).getDisplayName(),(float)TEXT_GAP, (float)alignedPositions[x] + ascent/3); g2.setColor(Color.black); } g2.rotate(Math.PI / 2.0); g2.translate(-left, -(top + widestMarkerName)); // move everybody down top += widestMarkerName + TEXT_GAP; } g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } top += blockDispHeight; //// draw the marker numbers if (printMarkerNames){ g2.setFont(markerNumFont); metrics = g2.getFontMetrics(); ascent = metrics.getAscent(); for (int x = 0; x < Chromosome.getSize(); x++) { String mark = String.valueOf(Chromosome.realIndex[x] + 1); g2.drawString(mark, (float)(left + alignedPositions[x] - metrics.stringWidth(mark)/2), (float)(top + ascent)); } top += boxRadius/2; // give a little space between numbers and boxes } //clickxshift and clickyshift are used later to translate from x,y coords //to the pair of markers comparison at those coords if (!(theData.infoKnown)){ clickXShift = left + (size.width-pref.width)/2; clickYShift = top + (size.height - pref.height)/2; } else { clickXShift = left + (size.width-pref.width)/2; clickYShift = top; } // draw table column by column for (int x = lowX; x < highX; x++) { //always draw the fewest possible boxes if (lowY < x+1){ lowY = x+1; } for (int y = lowY; y < highY; y++) { if (dPrimeTable.getLDStats(x,y) == null){ continue; } double d = dPrimeTable.getLDStats(x,y).getDPrime(); double r = dPrimeTable.getLDStats(x,y).getRSquared(); //double l = dPrimeTable.getLDStats(x,y).getLOD(); Color boxColor = dPrimeTable.getLDStats(x,y).getColor(); // draw markers above int xx = left + (int)((alignedPositions[x] + alignedPositions[y])/2); int yy = top + (int)((alignedPositions[y] - alignedPositions[x]) / 2); diamondX[0] = xx; diamondY[0] = yy - boxRadius; diamondX[1] = xx + boxRadius; diamondY[1] = yy; diamondX[2] = xx; diamondY[2] = yy + boxRadius; diamondX[3] = xx - boxRadius; diamondY[3] = yy; diamond = new Polygon(diamondX, diamondY, 4); g2.setColor(boxColor); g2.fillPolygon(diamond); if(printValues){ g2.setFont(boxFont); ascent = boxFontMetrics.getAscent(); int val; if (printWhat == D_PRIME){ val = (int) (d * 100); }else if (printWhat == R_SQ){ val = (int) (r * 100); }else{ val = 100; } if (boxColor.getGreen() < 175 && boxColor.getBlue() < 175 && boxColor.getRed() < 175){ g2.setColor(Color.white); }else{ g2.setColor((val < 50) ? Color.gray : Color.black); } if (val != 100) { String valu = String.valueOf(val); int widf = boxFontMetrics.stringWidth(valu); g.drawString(valu, xx - widf/2, yy + ascent/2); } } } } //highlight blocks g2.setFont(markerNameFont); ascent = g2.getFontMetrics().getAscent(); //g.setColor(new Color(153,255,153)); g2.setColor(Color.black); //g.setColor(new Color(51,153,51)); for (int i = 0; i < blocks.size(); i++){ int[] theBlock = (int[])blocks.elementAt(i); int first = theBlock[0]; int last = theBlock[theBlock.length-1]; //big vee around whole thing g2.setStroke(fatStroke); g2.draw(new Line2D.Double(left + alignedPositions[first] - boxRadius, top, left + (alignedPositions[first] + alignedPositions[last])/2, top + (alignedPositions[last] - alignedPositions[first])/2 + boxRadius)); g2.draw(new Line2D.Double(left + (alignedPositions[first] + alignedPositions[last])/2, top + (alignedPositions[last] - alignedPositions[first])/2 + boxRadius, left + alignedPositions[last] + boxRadius, top)); for (int j = first; j < last; j++){ g2.setStroke(fatStroke); if (theData.isInBlock[j]){ g2.draw(new Line2D.Double(left+alignedPositions[j]-boxSize/2, top-blockDispHeight, left+alignedPositions[j+1]-boxSize/2, top-blockDispHeight)); }else{ g2.draw(new Line2D.Double(left + alignedPositions[j] + boxSize/2, top-blockDispHeight, left+alignedPositions[j+1]-boxSize/2, top-blockDispHeight)); g2.setStroke(dashedFatStroke); g2.draw(new Line2D.Double(left+alignedPositions[j] - boxSize/2, top-blockDispHeight, left+alignedPositions[j] + boxSize/2, top-blockDispHeight)); } } //cap off the end of the block g2.setStroke(fatStroke); g2.draw(new Line2D.Double(left+alignedPositions[last]-boxSize/2, top-blockDispHeight, left+alignedPositions[last]+boxSize/2, top-blockDispHeight)); //lines to connect to block display g2.setStroke(fatStroke); g2.draw(new Line2D.Double(left + alignedPositions[first]-boxSize/2, top-1, left+alignedPositions[first]-boxSize/2, top-blockDispHeight)); g2.draw(new Line2D.Double(left+alignedPositions[last]+boxSize/2, top-1, left+alignedPositions[last]+boxSize/2, top-blockDispHeight)); if (printMarkerNames){ String labelString = new String ("Block " + (i+1)); if (theData.infoKnown){ long blockSize = Chromosome.getMarker(last).getPosition() - Chromosome.getMarker(first).getPosition(); labelString += " (" + blockSize/1000 + " kb)"; } g2.drawString(labelString, (float)(left+alignedPositions[first]-boxSize/2+TEXT_GAP), (float)(top-boxSize/3)); } } g2.setStroke(thickerStroke); if (showWM && !forExport){ //dataset is big enough to require worldmap if (wmMaxWidth == 0){ wmMaxWidth = visRect.width/3; } double scalefactor; scalefactor = (double)(chartSize.width)/wmMaxWidth; double prefBoxSize = boxSize/(scalefactor*((double)wmMaxWidth/(double)(wmMaxWidth))); //stick WM_BD in the middle of the blank space at the top of the worldmap final int WM_BD_GAP = (int)(infoHeight/(scalefactor*2)); final int WM_BD_HEIGHT = 2; CompoundBorder wmBorder = new CompoundBorder(BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder()); if (noImage){ //first time through draw a worldmap if dataset is big: worldmap = new BufferedImage((int)(chartSize.width/scalefactor)+wmBorder.getBorderInsets(this).left*2, (int)(chartSize.height/scalefactor)+wmBorder.getBorderInsets(this).top*2, BufferedImage.TYPE_3BYTE_BGR); Graphics gw = worldmap.getGraphics(); Graphics2D gw2 = (Graphics2D)(gw); gw2.setColor(BG_GREY); gw2.fillRect(1,1,worldmap.getWidth()-1,worldmap.getHeight()-1); //make a pretty border gw2.setColor(Color.black); wmBorder.paintBorder(this,gw2,0,0,worldmap.getWidth(),worldmap.getHeight()); wmInteriorRect = wmBorder.getInteriorRectangle(this,0,0,worldmap.getWidth(), worldmap.getHeight()); float[] smallDiamondX = new float[4]; float[] smallDiamondY = new float[4]; GeneralPath gp; for (int x = 0; x < Chromosome.getSize()-1; x++){ for (int y = x+1; y < Chromosome.getSize(); y++){ if (dPrimeTable.getLDStats(x,y) == null){ continue; } double xx = ((alignedPositions[y] + alignedPositions[x])/(scalefactor*2)) + wmBorder.getBorderInsets(this).left; double yy = ((alignedPositions[y] - alignedPositions[x] + infoHeight*2)/(scalefactor*2)) + wmBorder.getBorderInsets(this).top; smallDiamondX[0] = (float)xx; smallDiamondY[0] = (float)(yy - prefBoxSize/2); smallDiamondX[1] = (float)(xx + prefBoxSize/2); smallDiamondY[1] = (float)yy; smallDiamondX[2] = (float)xx; smallDiamondY[2] = (float)(yy + prefBoxSize/2); smallDiamondX[3] = (float)(xx - prefBoxSize/2); smallDiamondY[3] = (float)yy; gp = new GeneralPath(GeneralPath.WIND_EVEN_ODD, smallDiamondX.length); gp.moveTo(smallDiamondX[0],smallDiamondY[0]); for (int i = 1; i < smallDiamondX.length; i++){ gp.lineTo(smallDiamondX[i], smallDiamondY[i]); } gp.closePath(); gw2.setColor(dPrimeTable.getLDStats(x,y).getColor()); gw2.fill(gp); } } noImage = false; } //draw block display in worldmap Graphics gw = worldmap.getGraphics(); Graphics2D gw2 = (Graphics2D)(gw); gw2.setColor(BG_GREY); gw2.fillRect(wmBorder.getBorderInsets(this).left, wmBorder.getBorderInsets(this).top+WM_BD_GAP, wmInteriorRect.width, WM_BD_HEIGHT); gw2.setColor(Color.black); boolean even = true; for (int i = 0; i < blocks.size(); i++){ int first = ((int[])blocks.elementAt(i))[0]; int last = ((int[])blocks.elementAt(i))[((int[])blocks.elementAt(i)).length-1]; int voffset; if (even){ voffset = 0; }else{ voffset = WM_BD_HEIGHT/2; } gw2.fillRect(wmBorder.getBorderInsets(this).left - (int)prefBoxSize/2 + (int)(alignedPositions[first]/scalefactor), wmBorder.getBorderInsets(this).top+voffset+WM_BD_GAP, (int)(prefBoxSize + (alignedPositions[last] - alignedPositions[first])/scalefactor), WM_BD_HEIGHT/2); even = !even; } wmResizeCorner = new Rectangle(visRect.x + worldmap.getWidth() - (worldmap.getWidth()-wmInteriorRect.width)/2, visRect.y + visRect.height - worldmap.getHeight(), (worldmap.getWidth()-wmInteriorRect.width)/2, (worldmap.getHeight() -wmInteriorRect.height)/2); g2.drawImage(worldmap,visRect.x, visRect.y + visRect.height - worldmap.getHeight(), this); wmInteriorRect.x = visRect.x + (worldmap.getWidth() - wmInteriorRect.width)/2; wmInteriorRect.y = visRect.y+visRect.height-worldmap.getHeight() + (worldmap.getHeight() - wmInteriorRect.height)/2; //draw the outline of the viewport g2.setColor(Color.black); double hRatio = wmInteriorRect.getWidth()/pref.getWidth(); double vRatio = wmInteriorRect.getHeight()/pref.getHeight(); int hBump = worldmap.getWidth()-wmInteriorRect.width; int vBump = worldmap.getHeight()-wmInteriorRect.height; //bump a few pixels to avoid drawing on the border g2.drawRect((int)(visRect.x*hRatio)+hBump/2+visRect.x, (int)(visRect.y*vRatio)+vBump/2+(visRect.y + visRect.height - worldmap.getHeight()), (int)(visRect.width*hRatio), (int)(visRect.height*vRatio)); } //see if the user has right-clicked to popup some marker info if(popupDrawRect != null){ //dumb bug where little datasets popup the box in the wrong place int smallDatasetSlopH = 0; int smallDatasetSlopV = 0; if (pref.getHeight() < visRect.height){ smallDatasetSlopV = (int)(visRect.height - pref.getHeight())/2; } if (pref.getWidth() < visRect.width){ smallDatasetSlopH = (int)(visRect.width - pref.getWidth())/2; } g2.setColor(Color.white); g2.fillRect(popupDrawRect.x+1-smallDatasetSlopH, popupDrawRect.y+1-smallDatasetSlopV, popupDrawRect.width-1, popupDrawRect.height-1); g2.setColor(Color.black); g2.drawRect(popupDrawRect.x-smallDatasetSlopH, popupDrawRect.y-smallDatasetSlopV, popupDrawRect.width, popupDrawRect.height); g.setFont(popupFont); for (int x = 0; x < displayStrings.size(); x++){ g.drawString((String)displayStrings.elementAt(x),popupDrawRect.x + popupLeftMargin-smallDatasetSlopH, popupDrawRect.y+((x+1)*metrics.getHeight())-smallDatasetSlopV); } } // draw the cached last right-click selection // The purpose of testing for empty string is just to avoid an 2-unit empty white box if (lastSelection != null){ if ((zoomLevel == 0) && (!lastSelection.equals("")) && (!forExport)) { g2.setFont(boxFont); // a bit extra on all side int last_descent = g2.getFontMetrics().getDescent(); int last_box_x = (visRect.x + LAST_SELECTION_LEFT) - 2; int last_box_y = (visRect.y - g2.getFontMetrics().getHeight() + LAST_SELECTION_TOP + last_descent) - 1 ; int last_box_width = g2.getFontMetrics().stringWidth(lastSelection) + 4; int last_box_height = g2.getFontMetrics().getHeight() + 2; g2.setColor(Color.white); g2.fillRect(last_box_x, last_box_y, last_box_width, last_box_height); g2.setColor(Color.black); g2.drawRect(last_box_x, last_box_y, last_box_width, last_box_height); g2.drawString(lastSelection, LAST_SELECTION_LEFT + visRect.x, LAST_SELECTION_TOP + visRect.y); } } //see if we're drawing a worldmap resize rect if (resizeWMRect != null){ g2.setColor(Color.black); g2.drawRect(resizeWMRect.x, resizeWMRect.y, resizeWMRect.width, resizeWMRect.height); } //see if we're drawing a block selector rect if (blockRect != null){ g2.setColor(Color.black); g2.setStroke(dashedThinStroke); g2.drawRect(blockRect.x, blockRect.y, blockRect.width, blockRect.height); } } |
putValue(ACTION_COMMAND_KEY, ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); | public DeleteSelectedAction() { super("Delete Selected", ASUtils.createJLFIcon("general/Delete", "Delete Selected", ArchitectFrame.getMainInstance().sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))); putValue(SHORT_DESCRIPTION, "Delete Selected"); putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)); // XXX: how to attach to components? setEnabled(false); } |
|
int colidx; if ( (colidx = tp.getSelectedColumnIndex()) >= 0) { | if (tp.getSelectedColumnIndex() >= 0) { /* OLD CODE: only deleted one column at a time... | public void actionPerformed(ActionEvent evt) { if (evt.getActionCommand().equals(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN)) { List items = pp.getSelectedItems(); if (items.size() > 1) { int decision = JOptionPane.showConfirmDialog(pp, "Are you sure you want to delete the " +items.size()+" selected items?", "Multiple Delete", JOptionPane.YES_NO_OPTION); if (decision == JOptionPane.NO_OPTION) { return; } } Iterator it = items.iterator(); while (it.hasNext()) { Selectable item = (Selectable) it.next(); if (item instanceof TablePane) { TablePane tp = (TablePane) item; int colidx; if ( (colidx = tp.getSelectedColumnIndex()) >= 0) { // a column in the selected table try { tp.getModel().removeColumn(colidx); // FIXME: loop inside here to support multiple column deletion? } catch (LockedColumnException ex) { JOptionPane.showMessageDialog((JComponent) item, ex.getMessage()); } } else { // the whole table pp.db.removeChild(tp.getModel()); if (logger.isDebugEnabled()) { logger.debug("removing element from tableNames set: " + tp.getModel().getTableName()); logger.debug("before delete: " + pp.tableNames.toArray()); } pp.tableNames.remove(tp.getModel().getTableName().toLowerCase()); if (logger.isDebugEnabled()) { logger.debug("after delete: " + pp.tableNames.toArray()); } } } else if (item instanceof Relationship) { Relationship r = (Relationship) item; SQLRelationship sr = r.getModel(); sr.getPkTable().removeExportedKey(sr); sr.getFkTable().removeImportedKey(sr); } else { JOptionPane.showMessageDialog((JComponent) item, "The selected item type is not recognised"); } } } else if (evt.getActionCommand().equals(ArchitectSwingConstants.ACTION_COMMAND_SRC_DBTREE)) { TreePath [] selections = dbt.getSelectionPaths(); if (selections.length > 1) { int decision = JOptionPane.showConfirmDialog(dbt, "Are you sure you want to delete the " +selections.length+" selected items?", "Multiple Delete", JOptionPane.YES_NO_OPTION); if (decision == JOptionPane.NO_OPTION) { return; } } Iterator it = Arrays.asList(selections).iterator(); while (it.hasNext()) { TreePath tp = (TreePath) it.next(); SQLObject so = (SQLObject) tp.getLastPathComponent(); if (so instanceof SQLTable) { SQLTable st = (SQLTable) so; pp.db.removeChild(st); pp.tableNames.remove(st.getTableName().toLowerCase()); } else if (so instanceof SQLColumn) { try { SQLColumn sc = (SQLColumn)so; SQLTable st = sc.getParentTable(); st.removeColumn(sc); } catch (LockedColumnException ex) { JOptionPane.showMessageDialog(dbt, ex.getMessage()); } } else if (so instanceof SQLRelationship) { SQLRelationship sr = (SQLRelationship) so; sr.getPkTable().removeExportedKey(sr); sr.getFkTable().removeImportedKey(sr); // FIXME: do we need to do some removeDependencies() stuff here? } else { JOptionPane.showMessageDialog(dbt, "The selected SQLObject type is not recognised: " + so.getClass().getName()); } } } else { // unknown action command source, do nothing } } |
tp.getModel().removeColumn(colidx); | tp.getModel().removeColumn(tp.getSelectedColumnIndex()); | public void actionPerformed(ActionEvent evt) { if (evt.getActionCommand().equals(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN)) { List items = pp.getSelectedItems(); if (items.size() > 1) { int decision = JOptionPane.showConfirmDialog(pp, "Are you sure you want to delete the " +items.size()+" selected items?", "Multiple Delete", JOptionPane.YES_NO_OPTION); if (decision == JOptionPane.NO_OPTION) { return; } } Iterator it = items.iterator(); while (it.hasNext()) { Selectable item = (Selectable) it.next(); if (item instanceof TablePane) { TablePane tp = (TablePane) item; int colidx; if ( (colidx = tp.getSelectedColumnIndex()) >= 0) { // a column in the selected table try { tp.getModel().removeColumn(colidx); // FIXME: loop inside here to support multiple column deletion? } catch (LockedColumnException ex) { JOptionPane.showMessageDialog((JComponent) item, ex.getMessage()); } } else { // the whole table pp.db.removeChild(tp.getModel()); if (logger.isDebugEnabled()) { logger.debug("removing element from tableNames set: " + tp.getModel().getTableName()); logger.debug("before delete: " + pp.tableNames.toArray()); } pp.tableNames.remove(tp.getModel().getTableName().toLowerCase()); if (logger.isDebugEnabled()) { logger.debug("after delete: " + pp.tableNames.toArray()); } } } else if (item instanceof Relationship) { Relationship r = (Relationship) item; SQLRelationship sr = r.getModel(); sr.getPkTable().removeExportedKey(sr); sr.getFkTable().removeImportedKey(sr); } else { JOptionPane.showMessageDialog((JComponent) item, "The selected item type is not recognised"); } } } else if (evt.getActionCommand().equals(ArchitectSwingConstants.ACTION_COMMAND_SRC_DBTREE)) { TreePath [] selections = dbt.getSelectionPaths(); if (selections.length > 1) { int decision = JOptionPane.showConfirmDialog(dbt, "Are you sure you want to delete the " +selections.length+" selected items?", "Multiple Delete", JOptionPane.YES_NO_OPTION); if (decision == JOptionPane.NO_OPTION) { return; } } Iterator it = Arrays.asList(selections).iterator(); while (it.hasNext()) { TreePath tp = (TreePath) it.next(); SQLObject so = (SQLObject) tp.getLastPathComponent(); if (so instanceof SQLTable) { SQLTable st = (SQLTable) so; pp.db.removeChild(st); pp.tableNames.remove(st.getTableName().toLowerCase()); } else if (so instanceof SQLColumn) { try { SQLColumn sc = (SQLColumn)so; SQLTable st = sc.getParentTable(); st.removeColumn(sc); } catch (LockedColumnException ex) { JOptionPane.showMessageDialog(dbt, ex.getMessage()); } } else if (so instanceof SQLRelationship) { SQLRelationship sr = (SQLRelationship) so; sr.getPkTable().removeExportedKey(sr); sr.getFkTable().removeImportedKey(sr); // FIXME: do we need to do some removeDependencies() stuff here? } else { JOptionPane.showMessageDialog(dbt, "The selected SQLObject type is not recognised: " + so.getClass().getName()); } } } else { // unknown action command source, do nothing } } |
SQLColumn sc = (SQLColumn)so; SQLTable st = sc.getParentTable(); | public void actionPerformed(ActionEvent evt) { if (evt.getActionCommand().equals(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN)) { List items = pp.getSelectedItems(); if (items.size() > 1) { int decision = JOptionPane.showConfirmDialog(pp, "Are you sure you want to delete the " +items.size()+" selected items?", "Multiple Delete", JOptionPane.YES_NO_OPTION); if (decision == JOptionPane.NO_OPTION) { return; } } Iterator it = items.iterator(); while (it.hasNext()) { Selectable item = (Selectable) it.next(); if (item instanceof TablePane) { TablePane tp = (TablePane) item; int colidx; if ( (colidx = tp.getSelectedColumnIndex()) >= 0) { // a column in the selected table try { tp.getModel().removeColumn(colidx); // FIXME: loop inside here to support multiple column deletion? } catch (LockedColumnException ex) { JOptionPane.showMessageDialog((JComponent) item, ex.getMessage()); } } else { // the whole table pp.db.removeChild(tp.getModel()); if (logger.isDebugEnabled()) { logger.debug("removing element from tableNames set: " + tp.getModel().getTableName()); logger.debug("before delete: " + pp.tableNames.toArray()); } pp.tableNames.remove(tp.getModel().getTableName().toLowerCase()); if (logger.isDebugEnabled()) { logger.debug("after delete: " + pp.tableNames.toArray()); } } } else if (item instanceof Relationship) { Relationship r = (Relationship) item; SQLRelationship sr = r.getModel(); sr.getPkTable().removeExportedKey(sr); sr.getFkTable().removeImportedKey(sr); } else { JOptionPane.showMessageDialog((JComponent) item, "The selected item type is not recognised"); } } } else if (evt.getActionCommand().equals(ArchitectSwingConstants.ACTION_COMMAND_SRC_DBTREE)) { TreePath [] selections = dbt.getSelectionPaths(); if (selections.length > 1) { int decision = JOptionPane.showConfirmDialog(dbt, "Are you sure you want to delete the " +selections.length+" selected items?", "Multiple Delete", JOptionPane.YES_NO_OPTION); if (decision == JOptionPane.NO_OPTION) { return; } } Iterator it = Arrays.asList(selections).iterator(); while (it.hasNext()) { TreePath tp = (TreePath) it.next(); SQLObject so = (SQLObject) tp.getLastPathComponent(); if (so instanceof SQLTable) { SQLTable st = (SQLTable) so; pp.db.removeChild(st); pp.tableNames.remove(st.getTableName().toLowerCase()); } else if (so instanceof SQLColumn) { try { SQLColumn sc = (SQLColumn)so; SQLTable st = sc.getParentTable(); st.removeColumn(sc); } catch (LockedColumnException ex) { JOptionPane.showMessageDialog(dbt, ex.getMessage()); } } else if (so instanceof SQLRelationship) { SQLRelationship sr = (SQLRelationship) so; sr.getPkTable().removeExportedKey(sr); sr.getFkTable().removeImportedKey(sr); // FIXME: do we need to do some removeDependencies() stuff here? } else { JOptionPane.showMessageDialog(dbt, "The selected SQLObject type is not recognised: " + so.getClass().getName()); } } } else { // unknown action command source, do nothing } } |
|
JOptionPane.showMessageDialog(dbt, ex.getMessage()); | int decision = JOptionPane.showConfirmDialog(dbt, "Could not delete the column " + sc.getName() + " because it is part of a relationship key. Continue" + " deleting of other selected items?", "Column is Locked", JOptionPane.YES_NO_OPTION); if (decision == JOptionPane.NO_OPTION) { return; } | public void actionPerformed(ActionEvent evt) { if (evt.getActionCommand().equals(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN)) { List items = pp.getSelectedItems(); if (items.size() > 1) { int decision = JOptionPane.showConfirmDialog(pp, "Are you sure you want to delete the " +items.size()+" selected items?", "Multiple Delete", JOptionPane.YES_NO_OPTION); if (decision == JOptionPane.NO_OPTION) { return; } } Iterator it = items.iterator(); while (it.hasNext()) { Selectable item = (Selectable) it.next(); if (item instanceof TablePane) { TablePane tp = (TablePane) item; int colidx; if ( (colidx = tp.getSelectedColumnIndex()) >= 0) { // a column in the selected table try { tp.getModel().removeColumn(colidx); // FIXME: loop inside here to support multiple column deletion? } catch (LockedColumnException ex) { JOptionPane.showMessageDialog((JComponent) item, ex.getMessage()); } } else { // the whole table pp.db.removeChild(tp.getModel()); if (logger.isDebugEnabled()) { logger.debug("removing element from tableNames set: " + tp.getModel().getTableName()); logger.debug("before delete: " + pp.tableNames.toArray()); } pp.tableNames.remove(tp.getModel().getTableName().toLowerCase()); if (logger.isDebugEnabled()) { logger.debug("after delete: " + pp.tableNames.toArray()); } } } else if (item instanceof Relationship) { Relationship r = (Relationship) item; SQLRelationship sr = r.getModel(); sr.getPkTable().removeExportedKey(sr); sr.getFkTable().removeImportedKey(sr); } else { JOptionPane.showMessageDialog((JComponent) item, "The selected item type is not recognised"); } } } else if (evt.getActionCommand().equals(ArchitectSwingConstants.ACTION_COMMAND_SRC_DBTREE)) { TreePath [] selections = dbt.getSelectionPaths(); if (selections.length > 1) { int decision = JOptionPane.showConfirmDialog(dbt, "Are you sure you want to delete the " +selections.length+" selected items?", "Multiple Delete", JOptionPane.YES_NO_OPTION); if (decision == JOptionPane.NO_OPTION) { return; } } Iterator it = Arrays.asList(selections).iterator(); while (it.hasNext()) { TreePath tp = (TreePath) it.next(); SQLObject so = (SQLObject) tp.getLastPathComponent(); if (so instanceof SQLTable) { SQLTable st = (SQLTable) so; pp.db.removeChild(st); pp.tableNames.remove(st.getTableName().toLowerCase()); } else if (so instanceof SQLColumn) { try { SQLColumn sc = (SQLColumn)so; SQLTable st = sc.getParentTable(); st.removeColumn(sc); } catch (LockedColumnException ex) { JOptionPane.showMessageDialog(dbt, ex.getMessage()); } } else if (so instanceof SQLRelationship) { SQLRelationship sr = (SQLRelationship) so; sr.getPkTable().removeExportedKey(sr); sr.getFkTable().removeImportedKey(sr); // FIXME: do we need to do some removeDependencies() stuff here? } else { JOptionPane.showMessageDialog(dbt, "The selected SQLObject type is not recognised: " + so.getClass().getName()); } } } else { // unknown action command source, do nothing } } |
logger.debug("delete action came from unknown source, so we do nothing."); | public void actionPerformed(ActionEvent evt) { if (evt.getActionCommand().equals(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN)) { List items = pp.getSelectedItems(); if (items.size() > 1) { int decision = JOptionPane.showConfirmDialog(pp, "Are you sure you want to delete the " +items.size()+" selected items?", "Multiple Delete", JOptionPane.YES_NO_OPTION); if (decision == JOptionPane.NO_OPTION) { return; } } Iterator it = items.iterator(); while (it.hasNext()) { Selectable item = (Selectable) it.next(); if (item instanceof TablePane) { TablePane tp = (TablePane) item; int colidx; if ( (colidx = tp.getSelectedColumnIndex()) >= 0) { // a column in the selected table try { tp.getModel().removeColumn(colidx); // FIXME: loop inside here to support multiple column deletion? } catch (LockedColumnException ex) { JOptionPane.showMessageDialog((JComponent) item, ex.getMessage()); } } else { // the whole table pp.db.removeChild(tp.getModel()); if (logger.isDebugEnabled()) { logger.debug("removing element from tableNames set: " + tp.getModel().getTableName()); logger.debug("before delete: " + pp.tableNames.toArray()); } pp.tableNames.remove(tp.getModel().getTableName().toLowerCase()); if (logger.isDebugEnabled()) { logger.debug("after delete: " + pp.tableNames.toArray()); } } } else if (item instanceof Relationship) { Relationship r = (Relationship) item; SQLRelationship sr = r.getModel(); sr.getPkTable().removeExportedKey(sr); sr.getFkTable().removeImportedKey(sr); } else { JOptionPane.showMessageDialog((JComponent) item, "The selected item type is not recognised"); } } } else if (evt.getActionCommand().equals(ArchitectSwingConstants.ACTION_COMMAND_SRC_DBTREE)) { TreePath [] selections = dbt.getSelectionPaths(); if (selections.length > 1) { int decision = JOptionPane.showConfirmDialog(dbt, "Are you sure you want to delete the " +selections.length+" selected items?", "Multiple Delete", JOptionPane.YES_NO_OPTION); if (decision == JOptionPane.NO_OPTION) { return; } } Iterator it = Arrays.asList(selections).iterator(); while (it.hasNext()) { TreePath tp = (TreePath) it.next(); SQLObject so = (SQLObject) tp.getLastPathComponent(); if (so instanceof SQLTable) { SQLTable st = (SQLTable) so; pp.db.removeChild(st); pp.tableNames.remove(st.getTableName().toLowerCase()); } else if (so instanceof SQLColumn) { try { SQLColumn sc = (SQLColumn)so; SQLTable st = sc.getParentTable(); st.removeColumn(sc); } catch (LockedColumnException ex) { JOptionPane.showMessageDialog(dbt, ex.getMessage()); } } else if (so instanceof SQLRelationship) { SQLRelationship sr = (SQLRelationship) so; sr.getPkTable().removeExportedKey(sr); sr.getFkTable().removeImportedKey(sr); // FIXME: do we need to do some removeDependencies() stuff here? } else { JOptionPane.showMessageDialog(dbt, "The selected SQLObject type is not recognised: " + so.getClass().getName()); } } } else { // unknown action command source, do nothing } } |
|
public double chsoneCalculate(double[] bins, double[] ebins, int nbins, int knstrn) throws CheckDataException{ | public double chsoneCalculate(double[] bins, double[] ebins, int nbins, int knstrn){ | public double chsoneCalculate(double[] bins, double[] ebins, int nbins, int knstrn) throws CheckDataException{ double prob, df, chsq, temp; df = nbins - knstrn ; chsq = 0.0 ; for (int j = 1 ; j <= nbins ; j ++ ) { if (ebins [j ]<= 0.0 ) throw new CheckDataException("Bad expected number in chsone" ); temp = bins[j]- ebins[j]; chsq += temp * temp / ebins [j]; } prob = MathUtil.gammq (0.5 * df, 0.5 * chsq ); return prob; //this._chisq = chsq; } |
if (ebins [j ]<= 0.0 ) throw new CheckDataException("Bad expected number in chsone" ); temp = bins[j]- ebins[j]; chsq += temp * temp / ebins [j]; | if (ebins [j ]<= 0.0 ){ chsq=0; }else{ temp = bins[j]- ebins[j]; chsq += temp * temp / ebins [j]; } | public double chsoneCalculate(double[] bins, double[] ebins, int nbins, int knstrn) throws CheckDataException{ double prob, df, chsq, temp; df = nbins - knstrn ; chsq = 0.0 ; for (int j = 1 ; j <= nbins ; j ++ ) { if (ebins [j ]<= 0.0 ) throw new CheckDataException("Bad expected number in chsone" ); temp = bins[j]- ebins[j]; chsq += temp * temp / ebins [j]; } prob = MathUtil.gammq (0.5 * df, 0.5 * chsq ); return prob; //this._chisq = chsq; } |
double obsHET = het/(het+hom+0.0); | double obsHET; if (het+hom == 0){ obsHET = 0; }else{ obsHET = het/(het+hom+0.0); } | private double getObsHET(int het, int hom){ double obsHET = het/(het+hom+0.0); return obsHET; } |
try{ | private double getPValue(Hashtable parentHom, int parentHet){ //ie: 11 13 31 33 -> homA =1 homB = 1 parentHet=2 int homA=0, homB=0, num; double pvalue=0; Enumeration enu = parentHom.elements(); while(enu.hasMoreElements()){ num = Integer.parseInt((String)enu.nextElement()); if(homA>0) homB = num; else homA = num; } //caculate p value from homA, parentHet and homB // using hw //System.out.println("homA="+homA+" homB="+homB+" parentHet="+parentHet); //HW hw = new HW((double)homA, (double)parentHet, (double)homB); try{ //hw.caculate(); pvalue = hwCalculate((double)homA, (double)parentHet, (double)homB); } catch(CheckDataException e){ System.out.println("input data error in caculating p value"); System.out.println(e.getMessage()); } return pvalue; } |
|
} catch(CheckDataException e){ System.out.println("input data error in caculating p value"); System.out.println(e.getMessage()); } | private double getPValue(Hashtable parentHom, int parentHet){ //ie: 11 13 31 33 -> homA =1 homB = 1 parentHet=2 int homA=0, homB=0, num; double pvalue=0; Enumeration enu = parentHom.elements(); while(enu.hasMoreElements()){ num = Integer.parseInt((String)enu.nextElement()); if(homA>0) homB = num; else homA = num; } //caculate p value from homA, parentHet and homB // using hw //System.out.println("homA="+homA+" homB="+homB+" parentHet="+parentHet); //HW hw = new HW((double)homA, (double)parentHet, (double)homB); try{ //hw.caculate(); pvalue = hwCalculate((double)homA, (double)parentHet, (double)homB); } catch(CheckDataException e){ System.out.println("input data error in caculating p value"); System.out.println(e.getMessage()); } return pvalue; } |
|
double preHet = 1.0 - (sumsq/((sum*sum)+0.0)); | double preHet; if (sum == 0){ preHet = 0; }else{ preHet = 1.0 - (sumsq/((sum*sum)+0.0)); } | private double getPreHET(Hashtable count){ int sumsq=0, sum=0, num=0; Enumeration enu = count.elements(); while(enu.hasMoreElements()){ num = Integer.parseInt((String)enu.nextElement()); sumsq += num*num; sum += num; } double preHet = 1.0 - (sumsq/((sum*sum)+0.0)); return preHet; } |
private double hwCalculate(double obsAA, double obsAB, double obsBB) throws CheckDataException{ | private double hwCalculate(double obsAA, double obsAB, double obsBB){ | private double hwCalculate(double obsAA, double obsAB, double obsBB) throws CheckDataException{ double obs[]={0.0, obsAA, obsAB, obsBB}; double expect[]={0.0, 0.0, 0.0, 0.0}; double sum_obs; //double csq, df, sum_expect; double prob, p, start, end; double best_prob =-1.0; double best_p=0; sum_obs = obs [1 ]+ obs [2 ]+ obs [3 ]; for (p = 0.01 ; p <= .99 ; p += .01 ) { expect [1 ]= sum_obs * p * p ; expect [2 ]= sum_obs * 2.0 * p * (1.0 - p); expect [3 ]= sum_obs * (1.0 - p) * (1.0 - p); //Chsone chsone = new Chsone(obs , expect , 3 , 1); //chsone.caculate(); //prob = chsone.getPvalue(); prob = chsoneCalculate(obs,expect,3,1); if (prob > best_prob ) { best_prob = prob ; best_p = p ; } } start = (best_p - .025 > .001)? (best_p - .025): .001 ; end = (best_p + .025 < .999)? (best_p + .025): .999 ; for (p = start ; p <= end ; p += .001 ) { expect [1 ]= sum_obs * p * p ; expect [2 ]= sum_obs * 2.0 * p * (1.0 - p) ; expect [3 ]= sum_obs * (1.0 - p) * (1.0 - p) ; //Chsone chsone = new Chsone(obs , expect , 3 , 1); //chsone.caculate(); //prob = chsone.getPvalue(); prob = chsoneCalculate(obs,expect,3,1); if (prob > best_prob ) { best_prob = prob ; best_p = p ; } } p = best_p ; expect [1 ]= sum_obs * p * p ; expect [2 ]= sum_obs * 2.0 * p * (1.0 - p); expect [3 ]= sum_obs * (1.0 - p) * (1.0 - p); //Chsone chsone = new Chsone(obs , expect , 3 , 1); //chsone.caculate(); //this._p = chsone.getPvalue(); //return chsone.getPvalue(); return chsoneCalculate(obs,expect,3,1); } |
InputStream in = new FileInputStream(name); XMLParser parser = new XMLParser(); Script script = parser.parse(in); script = script.compile(); assertTrue("Parsed a Script", script instanceof Script); StringWriter buffer = new StringWriter(); script.run(parser.getContext(), XMLOutput.createXMLOutput(buffer)); String text = buffer.toString().trim(); if (log.isDebugEnabled()) { log.debug("Evaluated script as..."); log.debug(text); } | Document document = parseUnitTest(name); | public void runUnitTest(String name) throws Exception { // parse script InputStream in = new FileInputStream(name); XMLParser parser = new XMLParser(); Script script = parser.parse(in); script = script.compile(); assertTrue("Parsed a Script", script instanceof Script); StringWriter buffer = new StringWriter(); script.run(parser.getContext(), XMLOutput.createXMLOutput(buffer)); String text = buffer.toString().trim(); if (log.isDebugEnabled()) { log.debug("Evaluated script as..."); log.debug(text); } // now lets parse the output Document document = DocumentHelper.parseText( text ); List failures = document.selectNodes( "/*/fail" ); for ( Iterator iter = failures.iterator(); iter.hasNext(); ) { Node node = (Node) iter.next(); fail( node.getStringValue() ); } } |
Document document = DocumentHelper.parseText( text ); | public void runUnitTest(String name) throws Exception { // parse script InputStream in = new FileInputStream(name); XMLParser parser = new XMLParser(); Script script = parser.parse(in); script = script.compile(); assertTrue("Parsed a Script", script instanceof Script); StringWriter buffer = new StringWriter(); script.run(parser.getContext(), XMLOutput.createXMLOutput(buffer)); String text = buffer.toString().trim(); if (log.isDebugEnabled()) { log.debug("Evaluated script as..."); log.debug(text); } // now lets parse the output Document document = DocumentHelper.parseText( text ); List failures = document.selectNodes( "/*/fail" ); for ( Iterator iter = failures.iterator(); iter.hasNext(); ) { Node node = (Node) iter.next(); fail( node.getStringValue() ); } } |
|
TableSorter sorter = new TableSorter(new BasicTableModel(colNames, data)); | tableModel = new BasicTableModel(colNames,data); TableSorter sorter = new TableSorter(tableModel); | public IndividualDialog (HaploView h, String title) { super(h,title); JPanel contents = new JPanel(); JTable table; contents.setLayout(new BoxLayout(contents,BoxLayout.Y_AXIS)); Vector people = h.theData.getPedFile().getAllIndividuals(); Vector excludedPeople = h.theData.getPedFile().getAxedPeople(); Vector colNames = new Vector(); colNames.add("FamilyID"); colNames.add("IndividualID"); colNames.add("Geno%"); Vector data = new Vector(); for (int i=0; i<excludedPeople.size(); i++){ Vector tmpVecB = new Vector(); Individual axedInd = (Individual)excludedPeople.get(i); tmpVecB.add(axedInd.getFamilyID()); tmpVecB.add(axedInd.getIndividualID()); tmpVecB.add(new Double(nf.format(axedInd.getGenoPC()*100))); data.add(tmpVecB); } for(int i=0;i<people.size();i++) { Vector tmpVec = new Vector(); Individual currentInd = (Individual)people.get(i); tmpVec.add(currentInd.getFamilyID()); tmpVec.add(currentInd.getIndividualID()); tmpVec.add(new Double(nf.format(currentInd.getGenoPC()*100))); data.add(tmpVec); } TableSorter sorter = new TableSorter(new BasicTableModel(colNames, data)); table = new JTable(sorter); sorter.setTableHeader(table.getTableHeader()); IndividualCellRenderer renderer = new IndividualCellRenderer(); try{ table.setDefaultRenderer(Class.forName("java.lang.Double"), renderer); table.setDefaultRenderer(Class.forName("java.lang.Integer"), renderer); table.setDefaultRenderer(Class.forName("java.lang.Long"), renderer); table.setDefaultRenderer(Class.forName("java.lang.String"),renderer); }catch (Exception e){ } table.getColumnModel().getColumn(2).setPreferredWidth(30); JScrollPane tableScroller = new JScrollPane(table); int tableHeight = (table.getRowHeight()+table.getRowMargin())*(table.getRowCount()+2); if (tableHeight > 300){ tableScroller.setPreferredSize(new Dimension(400, 300)); }else{ tableScroller.setPreferredSize(new Dimension(400, tableHeight)); } tableScroller.setBorder(BorderFactory.createEmptyBorder(2,5,2,5)); contents.add(tableScroller); JPanel buttonPanel = new JPanel(); JButton exportButton = new JButton("Export to File"); exportButton.addActionListener(this); JButton okButton = new JButton("Close"); okButton.addActionListener(this); buttonPanel.add(exportButton); buttonPanel.add(okButton); contents.add(buttonPanel); setContentPane(contents); this.setLocation(this.getParent().getX() + 100, this.getParent().getY() + 100); this.setModal(true); } |
System.out.println("Ignoring SQLException. Assuming it means the table we tried to drop didn't exist."); | System.out.println("Ignoring SQLException. Assume "+tableName+" didn't exist."); | private static void dropTableNoFail(Connection con, String tableName) throws SQLException { Statement stmt = null; try { stmt = con.createStatement(); stmt.executeUpdate("DROP TABLE "+tableName); } catch (SQLException e) { System.out.println("Ignoring SQLException. Assuming it means the table we tried to drop didn't exist."); e.printStackTrace(); } finally { if (stmt != null) stmt.close(); } } |
Connection con = mydb.getConnection(); Statement stmt = con.createStatement(); | Connection con = null; Statement stmt = null; | public static void oneTimeSetUp() throws Exception { System.out.println("TestSQLColumn.oneTimeSetUp()"); SQLDatabase mydb = new SQLDatabase(getDataSource()); Connection con = mydb.getConnection(); Statement stmt = con.createStatement(); dropTableNoFail(con, "SQL_COLUMN_TEST_1PK"); dropTableNoFail(con, "SQL_COLUMN_TEST_3PK"); dropTableNoFail(con, "SQL_COLUMN_TEST_0PK"); stmt.executeUpdate("CREATE TABLE SQL_COLUMN_TEST_1PK (\n" + " cow numeric(11) CONSTRAINT test1pk PRIMARY KEY,\n" + " moo varchar(10),\n" + " foo char(10))"); stmt.executeUpdate("CREATE TABLE SQL_COLUMN_TEST_3PK (\n" + " cow numeric(11) NOT NULL,\n" + " moo varchar(10) NOT NULL,\n" + " foo char(10) NOT NULL,\n" + " CONSTRAINT test3pk PRIMARY KEY (cow, moo, foo))"); stmt.executeUpdate("CREATE TABLE SQL_COLUMN_TEST_0PK (\n" + " cow numeric(11),\n" + " moo varchar(10),\n" + " foo char(10))"); stmt.close(); //mydb.disconnect(); FIXME: this should be uncommented when bug 1005 is fixed } |
dropTableNoFail(con, "SQL_COLUMN_TEST_1PK"); dropTableNoFail(con, "SQL_COLUMN_TEST_3PK"); dropTableNoFail(con, "SQL_COLUMN_TEST_0PK"); stmt.executeUpdate("CREATE TABLE SQL_COLUMN_TEST_1PK (\n" + " cow numeric(11) CONSTRAINT test1pk PRIMARY KEY,\n" + " moo varchar(10),\n" + " foo char(10))"); stmt.executeUpdate("CREATE TABLE SQL_COLUMN_TEST_3PK (\n" + " cow numeric(11) NOT NULL,\n" + " moo varchar(10) NOT NULL,\n" + " foo char(10) NOT NULL,\n" + " CONSTRAINT test3pk PRIMARY KEY (cow, moo, foo))"); stmt.executeUpdate("CREATE TABLE SQL_COLUMN_TEST_0PK (\n" + " cow numeric(11),\n" + " moo varchar(10),\n" + " foo char(10))"); stmt.close(); | try { con = mydb.getConnection(); stmt = con.createStatement(); dropTableNoFail(con, "SQL_COLUMN_TEST_1PK"); dropTableNoFail(con, "SQL_COLUMN_TEST_3PK"); dropTableNoFail(con, "SQL_COLUMN_TEST_0PK"); stmt.executeUpdate("CREATE TABLE SQL_COLUMN_TEST_1PK (\n" + " cow numeric(11) CONSTRAINT test1pk PRIMARY KEY,\n" + " moo varchar(10),\n" + " foo char(10))"); stmt.executeUpdate("CREATE TABLE SQL_COLUMN_TEST_3PK (\n" + " cow numeric(11) NOT NULL,\n" + " moo varchar(10) NOT NULL,\n" + " foo char(10) NOT NULL,\n" + " CONSTRAINT test3pk PRIMARY KEY (cow, moo, foo))"); stmt.executeUpdate("CREATE TABLE SQL_COLUMN_TEST_0PK (\n" + " cow numeric(11),\n" + " moo varchar(10),\n" + " foo char(10))"); } finally { if (stmt != null) stmt.close(); } | public static void oneTimeSetUp() throws Exception { System.out.println("TestSQLColumn.oneTimeSetUp()"); SQLDatabase mydb = new SQLDatabase(getDataSource()); Connection con = mydb.getConnection(); Statement stmt = con.createStatement(); dropTableNoFail(con, "SQL_COLUMN_TEST_1PK"); dropTableNoFail(con, "SQL_COLUMN_TEST_3PK"); dropTableNoFail(con, "SQL_COLUMN_TEST_0PK"); stmt.executeUpdate("CREATE TABLE SQL_COLUMN_TEST_1PK (\n" + " cow numeric(11) CONSTRAINT test1pk PRIMARY KEY,\n" + " moo varchar(10),\n" + " foo char(10))"); stmt.executeUpdate("CREATE TABLE SQL_COLUMN_TEST_3PK (\n" + " cow numeric(11) NOT NULL,\n" + " moo varchar(10) NOT NULL,\n" + " foo char(10) NOT NULL,\n" + " CONSTRAINT test3pk PRIMARY KEY (cow, moo, foo))"); stmt.executeUpdate("CREATE TABLE SQL_COLUMN_TEST_0PK (\n" + " cow numeric(11),\n" + " moo varchar(10),\n" + " foo char(10))"); stmt.close(); //mydb.disconnect(); FIXME: this should be uncommented when bug 1005 is fixed } |
if (!SwingUtilities.isEventDispatchThread()) return; | public void dbChildrenInserted(SQLObjectEvent e) { if (logger.isDebugEnabled()) { if (e.getSQLSource() instanceof SQLRelationship) { SQLRelationship r = (SQLRelationship) e.getSQLSource(); logger.debug("dbChildrenInserted SQLObjectEvent: "+e +"; pk path="+Arrays.asList(getPkPathToRelationship(r)) +"; fk path="+Arrays.asList(getFkPathToRelationship(r))); } else { logger.debug("dbChildrenInserted SQLObjectEvent: "+e +"; tree path="+Arrays.asList(getPathToNode(e.getSQLSource()))); } } try { SQLObject[] newEventSources = e.getChildren(); for (int i = 0; i < newEventSources.length; i++) { ArchitectUtils.listenToHierarchy(this, newEventSources[i]); } } catch (ArchitectException ex) { logger.error("Error listening to added object", ex); } // relationships have two parents (pktable and fktable) so we need to fire two TMEs if (e.getSQLSource() instanceof SQLRelationship) { TreeModelEvent tme = new TreeModelEvent (this, getPkPathToRelationship((SQLRelationship) e.getSQLSource()), e.getChangedIndices(), e.getChildren()); fireTreeNodesInserted(tme); tme = new TreeModelEvent (this, getFkPathToRelationship((SQLRelationship) e.getSQLSource()), e.getChangedIndices(), e.getChildren()); fireTreeNodesInserted(tme); } else { TreeModelEvent tme = new TreeModelEvent (this, getPathToNode(e.getSQLSource()), e.getChangedIndices(), e.getChildren()); fireTreeNodesInserted(tme); } } |
|
if (!SwingUtilities.isEventDispatchThread()) return; | public void dbChildrenRemoved(SQLObjectEvent e) { if (logger.isDebugEnabled()) logger.debug("dbChildrenRemoved SQLObjectEvent: "+e); try { SQLObject[] oldEventSources = e.getChildren(); for (int i = 0; i < oldEventSources.length; i++) { ArchitectUtils.unlistenToHierarchy(this, oldEventSources[i]); } } catch (ArchitectException ex) { logger.error("Error unlistening to removed object", ex); } if (e.getSQLSource() instanceof SQLRelationship) { TreeModelEvent tme = new TreeModelEvent (this, getPkPathToRelationship((SQLRelationship) e.getSQLSource()), e.getChangedIndices(), e.getChildren()); fireTreeNodesRemoved(tme); tme = new TreeModelEvent (this, getFkPathToRelationship((SQLRelationship) e.getSQLSource()), e.getChangedIndices(), e.getChildren()); fireTreeNodesRemoved(tme); } else { TreeModelEvent tme = new TreeModelEvent (this, getPathToNode(e.getSQLSource()), e.getChangedIndices(), e.getChildren()); fireTreeNodesRemoved(tme); } } |
|
if (!SwingUtilities.isEventDispatchThread()) return; | public void dbObjectChanged(SQLObjectEvent e) { if (logger.isDebugEnabled()) logger.debug("dbObjectChanged SQLObjectEvent: "+e); SQLObject source = e.getSQLSource(); if (source instanceof SQLRelationship) { SQLRelationship r = (SQLRelationship) source; fireTreeNodesChanged(new TreeModelEvent(this, getPkPathToRelationship(r))); fireTreeNodesChanged(new TreeModelEvent(this, getFkPathToRelationship(r))); } else { fireTreeNodesChanged(new TreeModelEvent(this, getPathToNode(source))); } } |
|
throw new UnsupportedOperationException("not yet"); | if (!SwingUtilities.isEventDispatchThread()) return; try { ArchitectUtils.listenToHierarchy(this, e.getSQLSource()); TreeModelEvent tme = new TreeModelEvent(this, getPathToNode(e.getSQLSource())); fireTreeStructureChanged(tme); } catch (ArchitectException ex) { logger.error("Couldn't listen to hierarchy rooted at "+e.getSQLSource(), ex); } | public void dbStructureChanged(SQLObjectEvent e) { throw new UnsupportedOperationException("not yet"); } |
setSelectionPath(p); | if (!isTargetDatabaseChild(p)) { setSelectionPath(p); } | private void maybeShowPopup(MouseEvent e) { if (e.isPopupTrigger()) { TreePath p = getPathForLocation(e.getX(), e.getY()); popup = refreshMenu(p); setSelectionPath(p); popup.show(e.getComponent(), e.getX(), e.getY()); } } |
newMenu.add(popupProperties); | newMenu.add(popupProperties); } else if (isTargetDatabaseChild(p)) { ArchitectFrame af = ArchitectFrame.getMainInstance(); JMenuItem mi; mi = new JMenuItem(); mi.setAction(af.editColumnAction); mi.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_DBTREE); newMenu.add(mi); if(p.getLastPathComponent().getClass() == ca.sqlpower.architect.SQLColumn.class) { mi.setEnabled(true); } else { mi.setEnabled(false); } mi = new JMenuItem(); mi.setAction(af.insertColumnAction); mi.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_DBTREE); newMenu.add(mi); if(p.getLastPathComponent().getClass() == ca.sqlpower.architect.SQLTable.class || p.getLastPathComponent().getClass() == ca.sqlpower.architect.SQLColumn.class) { mi.setEnabled(true); } else { mi.setEnabled(false); } newMenu.addSeparator(); mi = new JMenuItem(); mi.setAction(af.editTableAction); mi.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_DBTREE); newMenu.add(mi); if(p.getLastPathComponent().getClass() == ca.sqlpower.architect.SQLTable.class || p.getLastPathComponent().getClass() == ca.sqlpower.architect.SQLColumn.class) { mi.setEnabled(true); } else { mi.setEnabled(false); } mi = new JMenuItem(); mi.setAction(af.editRelationshipAction); mi.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_DBTREE); newMenu.add(mi); if(p.getLastPathComponent().getClass() == ca.sqlpower.architect.SQLRelationship.class) { mi.setEnabled(true); } else { mi.setEnabled(false); } mi = new JMenuItem(); mi.setAction(af.deleteSelectedAction); mi.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_DBTREE); newMenu.add(mi); if(p.getLastPathComponent().getClass() == ca.sqlpower.architect.SQLTable.class || p.getLastPathComponent().getClass() == ca.sqlpower.architect.SQLColumn.class || p.getLastPathComponent().getClass() == ca.sqlpower.architect.SQLRelationship.class) { mi.setEnabled(true); } else { mi.setEnabled(false); } | protected JPopupMenu refreshMenu(TreePath p) { logger.debug("refreshMenu is being called."); JPopupMenu newMenu = new JPopupMenu(); if (isTargetDatabaseNode(p)) { // two menu items: "Set Target Database" and "Connection Properties newMenu.add(popupDBCSMenu = new JMenu("Set Target Database")); if (ArchitectFrame.getMainInstance().getUserSettings().getConnections().size() == 0) { // disable if there's no connections in user settings yet (annoying, but less confusing) popupDBCSMenu.setEnabled(false); } else { // populate Iterator it = ArchitectFrame.getMainInstance().getUserSettings().getConnections().iterator(); while(it.hasNext()) { DBConnectionSpec dbcs = (DBConnectionSpec) it.next(); popupDBCSMenu.add(new JMenuItem(new setTargetDBCSAction(dbcs))); } } JMenuItem popupProperties = new JMenuItem(new DBCSPropertiesAction()); newMenu.add(popupProperties); } else if (p != null) { // clicked on DBCS item in DBTree JMenuItem popupProperties = new JMenuItem(new DBCSPropertiesAction()); newMenu.add(popupProperties); } else { // p == null, background click newMenu.add(popupDBCSMenu = new JMenu("Add Connection")); popupDBCSMenu.add(new JMenuItem(newDBCSAction)); popupDBCSMenu.addSeparator(); // populate Iterator it = ArchitectFrame.getMainInstance().getUserSettings().getConnections().iterator(); while(it.hasNext()) { DBConnectionSpec dbcs = (DBConnectionSpec) it.next(); popupDBCSMenu.add(new JMenuItem(new AddDBCSAction(dbcs))); } } // add in Show Listeners if debug is enabled if (logger.isDebugEnabled()) { newMenu.addSeparator(); JMenuItem showListeners = new JMenuItem("Show Listeners"); showListeners.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SQLObject so = (SQLObject) getLastSelectedPathComponent(); if (so != null) { JOptionPane.showMessageDialog(DBTree.this, new JScrollPane(new JList(new java.util.Vector(so.getSQLObjectListeners())))); } } }); newMenu.add(showListeners); } return newMenu; } |
registerTag("param", ParamTag.class); | public XMLTagLibrary() { registerTag("out", ExprTag.class); registerTag("if", IfTag.class); registerTag("forEach", ForEachTag.class); registerTag("parse", ParseTag.class); registerTag("set", SetTag.class); registerTag("transform", TransformTag.class); // extensions to JSTL registerTag("expr", ExprTag.class); registerTag("element", ElementTag.class); registerTag("attribute", AttributeTag.class); registerTag("copy", CopyTag.class); registerTag("copyOf", CopyOfTag.class); } |
|
fc.setSelctedFile(null); | fc.setSelectedFile(null); | void saveHapsToText(){ fc.setSelctedFile(null); try{ fc.setSelectedFile(null); int returnVal = fc.showSaveDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { new TextMethods().saveHapsToText(finishedHaplos, fc.getSelectedFile()); } }catch (IOException ioexec){ JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } } |
"New Connection", ArchitectPanelBuilder.OK_BUTTON_LABEL, | "Connection Properties", ArchitectPanelBuilder.OK_BUTTON_LABEL, | public void actionPerformed(ActionEvent e) { TreePath p = getSelectionPath(); if (p == null) { return; } Object [] pathArray = p.getPath(); int ii = 0; SQLDatabase sd = null; while (ii < pathArray.length && sd == null) { if (pathArray[ii] instanceof SQLDatabase) { sd = (SQLDatabase) pathArray[ii]; } ii++; } if (sd != null) { final DBCSPanel dbcsPanel = new DBCSPanel(); ArchitectDataSource dbcs = sd.getDataSource(); dbcsPanel.setDbcs(new ArchitectDataSource()); DBCS_OkAction okButton = new DBCS_OkAction(dbcsPanel,true); Action cancelAction = new AbstractAction() { public void actionPerformed(ActionEvent evt) { dbcsPanel.discardChanges(); } }; JDialog d = ArchitectPanelBuilder.createArchitectPanelDialog( dbcsPanel,ArchitectFrame.getMainInstance(), "New Connection", ArchitectPanelBuilder.OK_BUTTON_LABEL, okButton, cancelAction); okButton.setConnectionDialog(d); d.pack(); d.setLocationRelativeTo(ArchitectFrame.getMainInstance()); d.setVisible(true); logger.debug("Setting existing DBCS on panel: "+dbcs); edittingDB = sd; dbcsPanel.setDbcs(dbcs); } } |
analysisPositions = new Vector(); analysisValues = new Vector(); | public void readAnalysisTrack(File inFile) throws HaploViewException, IOException{ if (!inFile.exists()){ throw new HaploViewException("File " + inFile.getName() + " doesn't exist!"); } BufferedReader in = new BufferedReader(new FileReader(inFile)); String currentLine; int lineCount = 0; while ((currentLine = in.readLine()) != null){ lineCount ++; StringTokenizer st = new StringTokenizer(currentLine); if (st.countTokens() == 1){ //complain if we have only one col throw new HaploViewException("File error on line " + lineCount + " in " + inFile.getName()); }else if (st.countTokens() == 0){ //skip blank lines continue; } Double pos, val; try{ pos = new Double(st.nextToken()); val = new Double(st.nextToken()); }catch (NumberFormatException nfe) { throw new HaploViewException("Format error on line " + lineCount + " in " + inFile.getName()); } analysisPositions.add(pos); analysisValues.add(val); trackExists = true; } } |
|
dbType.setSelectedIndex(3); | dbType.setSelectedIndex(4); | protected void setup() { GenericDDLGenerator ddlg = project.getDDLGenerator(); setLayout(new FormLayout()); Vector dbTypeList = new Vector(); dbTypeList.add(ASUtils.lvb("Generic JDBC", GenericDDLGenerator.class)); dbTypeList.add(ASUtils.lvb("DB2", DB2DDLGenerator.class)); dbTypeList.add(ASUtils.lvb("Oracle 8i/9i", OracleDDLGenerator.class)); dbTypeList.add(ASUtils.lvb("SQLServer 2000", SQLServerDDLGenerator.class)); add(new JLabel("Generate DDL for Database Type:")); add(dbType = new JComboBox(dbTypeList)); if (ddlg.getClass() == GenericDDLGenerator.class) { dbType.setSelectedIndex(0); } else if (ddlg.getClass() == DB2DDLGenerator.class) { dbType.setSelectedIndex(1); } else if (ddlg.getClass() == OracleDDLGenerator.class) { dbType.setSelectedIndex(2); } else if (ddlg.getClass() == SQLServerDDLGenerator.class) { dbType.setSelectedIndex(3); } else { logger.error("Unknown DDL generator class "+ddlg.getClass()); dbType.addItem(ASUtils.lvb("Unknwon Generator", ddlg.getClass())); } } |
dbType.addItem(ASUtils.lvb("Unknwon Generator", ddlg.getClass())); | dbType.addItem(ASUtils.lvb("Unknown Generator", ddlg.getClass())); | protected void setup() { GenericDDLGenerator ddlg = project.getDDLGenerator(); setLayout(new FormLayout()); Vector dbTypeList = new Vector(); dbTypeList.add(ASUtils.lvb("Generic JDBC", GenericDDLGenerator.class)); dbTypeList.add(ASUtils.lvb("DB2", DB2DDLGenerator.class)); dbTypeList.add(ASUtils.lvb("Oracle 8i/9i", OracleDDLGenerator.class)); dbTypeList.add(ASUtils.lvb("SQLServer 2000", SQLServerDDLGenerator.class)); add(new JLabel("Generate DDL for Database Type:")); add(dbType = new JComboBox(dbTypeList)); if (ddlg.getClass() == GenericDDLGenerator.class) { dbType.setSelectedIndex(0); } else if (ddlg.getClass() == DB2DDLGenerator.class) { dbType.setSelectedIndex(1); } else if (ddlg.getClass() == OracleDDLGenerator.class) { dbType.setSelectedIndex(2); } else if (ddlg.getClass() == SQLServerDDLGenerator.class) { dbType.setSelectedIndex(3); } else { logger.error("Unknown DDL generator class "+ddlg.getClass()); dbType.addItem(ASUtils.lvb("Unknwon Generator", ddlg.getClass())); } } |
if (dataType != null) { | if (dataType != null && dataType instanceof DataType) { | public Object createDataType(String name) { Object dataType = null; Class type = (Class) getAntProject().getDataTypeDefinitions().get(name); if ( type != null ) { Constructor ctor = null; boolean noArg = false; // DataType can have a "no arg" constructor or take a single // Project argument. try { ctor = type.getConstructor(new Class[0]); noArg = true; } catch (NoSuchMethodException nse) { try { ctor = type.getConstructor(new Class[] { Project.class }); noArg = false; } catch (NoSuchMethodException nsme) { log.info("datatype '" + name + "' didn't have a constructor with an Ant Project", nsme); } } if (noArg) { dataType = createDataType(ctor, new Object[0], name, "no-arg constructor"); } else { dataType = createDataType(ctor, new Object[] { getAntProject() }, name, "an Ant project"); } if (dataType != null) { ((DataType)dataType).setProject( getAntProject() ); } } return dataType; } |
if ( ih != null ) { | if ( ih != null && ! (object instanceof AntTag)) { | public Object createNestedObject(Object object, String name) { Object dataType = null; if ( object != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( object.getClass() ); if ( ih != null ) { try { dataType = ih.createElement( getAntProject(), object, name.toLowerCase() ); } catch (BuildException be) { if (object instanceof Tag) { if (log.isDebugEnabled()) { log.debug("Failed attempt to create an ant datatype for a jelly tag", be); } } else { log.error(be); } } } } if ( dataType == null ) { dataType = createDataType( name ); } return dataType; } |
+ " property on: " + parentObject + " to value: " | + " property on: " + safeToString(parentObject) + " to value: " | public void doTag(XMLOutput output) throws JellyTagException { Project project = getAntProject(); String tagName = getTagName(); Object parentObject = findBeanAncestor(); Object parentTask = findParentTaskObject(); // lets assume that Task instances are not nested inside other Task instances // for example <manifest> inside a <jar> should be a nested object, where as // if the parent is not a Task the <manifest> should create a ManifestTask // // also its possible to have a root Ant tag which isn't a task, such as when // defining <fileset id="...">...</fileset> Object nested = null; if (parentObject != null && !( parentTask instanceof TaskContainer) ) { nested = createNestedObject( parentObject, tagName ); } if (nested == null) { task = createTask( tagName ); if (task != null) { if ( log.isDebugEnabled() ) { log.debug( "Creating an ant Task for name: " + tagName ); } // the following algorithm follows the lifetime of a tag // http://jakarta.apache.org/ant/manual/develop.html#writingowntask // kindly recommended by Stefan Bodewig // create and set its project reference if ( task instanceof TaskAdapter ) { setObject( ((TaskAdapter)task).getProxy() ); } else { setObject( task ); } // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, task ); } // ### we might want to spoof a Target setting here // now lets initialize task.init(); // now lets invoke the body to call all the createXXX() or addXXX() methods String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets set the addText() of the body content, if its applicaable Method method = MethodUtils.getAccessibleMethod( task.getClass(), "addText", addTaskParamTypes ); if (method != null) { Object[] args = { body }; try { method.invoke(this.task, args); } catch (IllegalAccessException e) { throw new JellyTagException(e); } catch (InvocationTargetException e) { throw new JellyTagException(e); } } // now lets set all the attributes of the child elements // XXXX: to do! // now we're ready to invoke the task // XXX: should we call execute() or perform()? // according to org.apache.tools.ant.Main, redirect stdout and stderr PrintStream initialOut = System.out; PrintStream initialErr = System.err; PrintStream newOut = new PrintStream(new DemuxOutputStream(project, false)); PrintStream newErr = new PrintStream(new DemuxOutputStream(project, true)); try { System.setOut(newOut); System.setErr(newErr); task.perform(); } finally { System.setOut(initialOut); System.setErr(initialErr); } } } if (task == null) { if (nested == null) { if ( log.isDebugEnabled() ) { log.debug( "Trying to create a data type for tag: " + tagName ); } nested = createDataType( tagName ); } else { if ( log.isDebugEnabled() ) { log.debug( "Created nested property tag: " + tagName ); } } if ( nested != null ) { setObject( nested ); // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, nested ); } // TODO: work out why we always set the name attribute. // See JELLY-105.// try{// PropertyUtils.setProperty( nested, "name", tagName );// }// catch (Exception e) {// log.warn( "Caught exception setting nested name: " + tagName, e );// } // now lets invoke the body String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets add it to its parent if ( parentObject != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( parentObject.getClass() ); try { if (log.isDebugEnabled()) { log.debug("About to set the: " + tagName + " property on: " + parentObject + " to value: " + nested + " with type: " + nested.getClass() ); } ih.storeElement( project, parentObject, nested, tagName.toLowerCase() ); } catch (Exception e) { log.warn( "Caught exception setting nested: " + tagName, e ); } // now try to set the property for good measure // as the storeElement() method does not // seem to call any setter methods of non-String types try { BeanUtils.setProperty( parentObject, tagName, nested ); } catch (Exception e) { log.debug("Caught exception trying to set property: " + tagName + " on: " + parentObject); } } } else { log.warn("Could not convert tag: " + tagName + " into an Ant task, data type or property"); // lets treat this tag as static XML... StaticTag tag = new StaticTag("", tagName, tagName); tag.setParent( getParent() ); tag.setBody( getBody() ); tag.setContext(context); for (Iterator iter = getAttributes().entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Object value = entry.getValue(); tag.setAttribute(name, value); } tag.doTag(output); } } } |
log.debug("Caught exception trying to set property: " + tagName + " on: " + parentObject); | log.debug("Caught exception trying to set property: " + tagName + " on: " + safeToString(parentObject)); | public void doTag(XMLOutput output) throws JellyTagException { Project project = getAntProject(); String tagName = getTagName(); Object parentObject = findBeanAncestor(); Object parentTask = findParentTaskObject(); // lets assume that Task instances are not nested inside other Task instances // for example <manifest> inside a <jar> should be a nested object, where as // if the parent is not a Task the <manifest> should create a ManifestTask // // also its possible to have a root Ant tag which isn't a task, such as when // defining <fileset id="...">...</fileset> Object nested = null; if (parentObject != null && !( parentTask instanceof TaskContainer) ) { nested = createNestedObject( parentObject, tagName ); } if (nested == null) { task = createTask( tagName ); if (task != null) { if ( log.isDebugEnabled() ) { log.debug( "Creating an ant Task for name: " + tagName ); } // the following algorithm follows the lifetime of a tag // http://jakarta.apache.org/ant/manual/develop.html#writingowntask // kindly recommended by Stefan Bodewig // create and set its project reference if ( task instanceof TaskAdapter ) { setObject( ((TaskAdapter)task).getProxy() ); } else { setObject( task ); } // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, task ); } // ### we might want to spoof a Target setting here // now lets initialize task.init(); // now lets invoke the body to call all the createXXX() or addXXX() methods String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets set the addText() of the body content, if its applicaable Method method = MethodUtils.getAccessibleMethod( task.getClass(), "addText", addTaskParamTypes ); if (method != null) { Object[] args = { body }; try { method.invoke(this.task, args); } catch (IllegalAccessException e) { throw new JellyTagException(e); } catch (InvocationTargetException e) { throw new JellyTagException(e); } } // now lets set all the attributes of the child elements // XXXX: to do! // now we're ready to invoke the task // XXX: should we call execute() or perform()? // according to org.apache.tools.ant.Main, redirect stdout and stderr PrintStream initialOut = System.out; PrintStream initialErr = System.err; PrintStream newOut = new PrintStream(new DemuxOutputStream(project, false)); PrintStream newErr = new PrintStream(new DemuxOutputStream(project, true)); try { System.setOut(newOut); System.setErr(newErr); task.perform(); } finally { System.setOut(initialOut); System.setErr(initialErr); } } } if (task == null) { if (nested == null) { if ( log.isDebugEnabled() ) { log.debug( "Trying to create a data type for tag: " + tagName ); } nested = createDataType( tagName ); } else { if ( log.isDebugEnabled() ) { log.debug( "Created nested property tag: " + tagName ); } } if ( nested != null ) { setObject( nested ); // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, nested ); } // TODO: work out why we always set the name attribute. // See JELLY-105.// try{// PropertyUtils.setProperty( nested, "name", tagName );// }// catch (Exception e) {// log.warn( "Caught exception setting nested name: " + tagName, e );// } // now lets invoke the body String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets add it to its parent if ( parentObject != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( parentObject.getClass() ); try { if (log.isDebugEnabled()) { log.debug("About to set the: " + tagName + " property on: " + parentObject + " to value: " + nested + " with type: " + nested.getClass() ); } ih.storeElement( project, parentObject, nested, tagName.toLowerCase() ); } catch (Exception e) { log.warn( "Caught exception setting nested: " + tagName, e ); } // now try to set the property for good measure // as the storeElement() method does not // seem to call any setter methods of non-String types try { BeanUtils.setProperty( parentObject, tagName, nested ); } catch (Exception e) { log.debug("Caught exception trying to set property: " + tagName + " on: " + parentObject); } } } else { log.warn("Could not convert tag: " + tagName + " into an Ant task, data type or property"); // lets treat this tag as static XML... StaticTag tag = new StaticTag("", tagName, tagName); tag.setParent( getParent() ); tag.setBody( getBody() ); tag.setContext(context); for (Iterator iter = getAttributes().entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Object value = entry.getValue(); tag.setAttribute(name, value); } tag.doTag(output); } } } |
log.debug( "Setting bean property on: "+ object + " name: " + name + " value: " + value ); | log.debug( "Setting bean property on: "+ safeToString(object )+ " name: " + name + " value: " + safeToString(value)); | public void setBeanProperty(Object object, String name, Object value) throws JellyTagException { if ( log.isDebugEnabled() ) { log.debug( "Setting bean property on: "+ object + " name: " + name + " value: " + value ); } IntrospectionHelper ih = IntrospectionHelper.getHelper( object.getClass() ); if ( value instanceof String ) { try { ih.setAttribute( getAntProject(), object, name.toLowerCase(), (String) value ); return; } catch (Exception e) { // ignore: not a valid property } } try { ih.storeElement( getAntProject(), object, value, name ); } catch (Exception e) { try { // let any exceptions bubble up from here BeanUtils.setProperty( object, name, value ); } catch (IllegalAccessException ex) { throw new JellyTagException(ex); } catch (InvocationTargetException ex) { throw new JellyTagException(ex); } } } |
processFile(name,HMP_FILE,""); | processFile(name,HMP_FILE,null); | private void doBatch() { Vector files; File batchFile; File dataFile; String line; StringTokenizer tok; String infoMaybe =null; files = new Vector(); if(batchFileName == null) { return; } batchFile = new File(this.batchFileName); if(!batchFile.exists()) { System.out.println("batch file " + batchFileName + " does not exist"); System.exit(1); } if (!quietMode) System.out.println("Processing batch input file: " + batchFile); try { BufferedReader br = new BufferedReader(new FileReader(batchFile)); while( (line = br.readLine()) != null ) { files.add(line); } br.close(); for(int i = 0;i<files.size();i++){ line = (String)files.get(i); tok = new StringTokenizer(line); infoMaybe = null; if(tok.hasMoreTokens()){ dataFile = new File(tok.nextToken()); if(tok.hasMoreTokens()){ infoMaybe = tok.nextToken(); } if(dataFile.exists()) { String name = dataFile.getName(); if( name.substring(name.length()-4,name.length()).equalsIgnoreCase(".ped") ) { processFile(name,PED_FILE,infoMaybe); } else if(name.substring(name.length()-5,name.length()).equalsIgnoreCase(".haps")) { processFile(name,HAPS_FILE,infoMaybe); } else if(name.substring(name.length()-4,name.length()).equalsIgnoreCase(".hmp")){ processFile(name,HMP_FILE,""); } else{ if (!quietMode){ System.out.println("Filenames in batch file must end in .ped, .haps or .hmp\n" + name + " is not properly formatted."); } } } else { if(!quietMode){ System.out.println("file " + dataFile.getName() + " listed in the batch file could not be found"); } } } } } catch(FileNotFoundException e){ System.out.println("the following error has occured:\n" + e.toString()); } catch(IOException e){ System.out.println("the following error has occured:\n" + e.toString()); } } |
col.setPrimaryKeySeq(colInPK.isSelected() ? new Integer(model.getPkSize()) : null); | if (col.getPrimaryKeySeq() == null) { col.setPrimaryKeySeq(colInPK.isSelected() ? new Integer(model.getPkSize()) : null); } else { col.setPrimaryKeySeq(colInPK.isSelected() ? new Integer(col.getPrimaryKeySeq()) : null); } | protected void updateModel() { logger.debug("Updating model"); try { SQLColumn col = model.getColumn(index); col.setName(colName.getText()); col.setType(((SQLType) colType.getSelectedItem()).type); col.setScale(((Integer) colScale.getValue()).intValue()); col.setPrecision(((Integer) colPrec.getValue()).intValue()); col.setNullable(colNullable.isSelected() ? DatabaseMetaData.columnNullable : DatabaseMetaData.columnNoNulls); col.setRemarks(colRemarks.getText()); if (!(col.getDefaultValue() == null && colDefaultValue.getText().equals(""))) { col.setDefaultValue(colDefaultValue.getText()); } // Autoincrement has to go before the primary key or // this column will never allow nulls col.setAutoIncrement(colAutoInc.isSelected()); col.setPrimaryKeySeq(colInPK.isSelected() ? new Integer(model.getPkSize()) : null); // update selected index in case the column moved (add/remove PK) int index = model.getColumns().indexOf(col); selectColumn(index); } catch (ArchitectException ex) { JOptionPane.showMessageDialog(this, "Couldn't update column information"); logger.error("Couldn't update model!", ex); } } |
public void adjustDisplay(int dt){ | public void adjustDisplay(){ | public void adjustDisplay(int dt){ //this is called when the controller wants to change the haps //displayed, instead of directly repainting so that none of this math //is done when the screen repaints for other reasons (resizing, focus change, etc) //first filter haps on displaythresh Haplotype[][] filts; filts = new Haplotype[orderedHaplos.length][]; int numhaps = 0; int printable = 0; for (int i = 0; i < orderedHaplos.length; i++){ Vector tempVector = new Vector(); for (int j = 0; j < orderedHaplos[i].length; j++){ if (orderedHaplos[i][j].getPercentage()*100 > dt){ tempVector.add(orderedHaplos[i][j]); numhaps++; } } if (numhaps > 1){ printable++; numhaps=0; } filts[i] = new Haplotype[tempVector.size()]; tempVector.copyInto(filts[i]); } // if user sets display thresh higher than most common hap in any given block if (!(printable == filts.length)){ JOptionPane.showMessageDialog(this.getParent(), "Error: At least one block has too few haplotypes of frequency > " + dt, "Error", JOptionPane.ERROR_MESSAGE); return; } displayThresh = dt; filteredHaplos = filts; //then re-tag try{ filteredHaplos = theData.generateCrossovers(filteredHaplos); }catch (HaploViewException e){ JOptionPane.showMessageDialog(this.getParent(), e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } multidprimeArray = theData.getMultiDprime(); //if the haps pane exists, we want to make sure the vert scroll bar appears if necessary if (this.getParent() != null){ if (this.getPreferredSize().height > this.getParent().getHeight()){ ((JScrollPane)this.getParent().getParent()).setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); }else{ ((JScrollPane)this.getParent().getParent()).setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); } } repaint(); } |
if (orderedHaplos[i][j].getPercentage()*100 > dt){ | if (orderedHaplos[i][j].getPercentage()*100 > Options.getHaplotypeDisplayThreshold()){ | public void adjustDisplay(int dt){ //this is called when the controller wants to change the haps //displayed, instead of directly repainting so that none of this math //is done when the screen repaints for other reasons (resizing, focus change, etc) //first filter haps on displaythresh Haplotype[][] filts; filts = new Haplotype[orderedHaplos.length][]; int numhaps = 0; int printable = 0; for (int i = 0; i < orderedHaplos.length; i++){ Vector tempVector = new Vector(); for (int j = 0; j < orderedHaplos[i].length; j++){ if (orderedHaplos[i][j].getPercentage()*100 > dt){ tempVector.add(orderedHaplos[i][j]); numhaps++; } } if (numhaps > 1){ printable++; numhaps=0; } filts[i] = new Haplotype[tempVector.size()]; tempVector.copyInto(filts[i]); } // if user sets display thresh higher than most common hap in any given block if (!(printable == filts.length)){ JOptionPane.showMessageDialog(this.getParent(), "Error: At least one block has too few haplotypes of frequency > " + dt, "Error", JOptionPane.ERROR_MESSAGE); return; } displayThresh = dt; filteredHaplos = filts; //then re-tag try{ filteredHaplos = theData.generateCrossovers(filteredHaplos); }catch (HaploViewException e){ JOptionPane.showMessageDialog(this.getParent(), e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } multidprimeArray = theData.getMultiDprime(); //if the haps pane exists, we want to make sure the vert scroll bar appears if necessary if (this.getParent() != null){ if (this.getPreferredSize().height > this.getParent().getHeight()){ ((JScrollPane)this.getParent().getParent()).setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); }else{ ((JScrollPane)this.getParent().getParent()).setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); } } repaint(); } |
"Error: At least one block has too few haplotypes of frequency > " + dt, | "Error: At least one block has too few haplotypes of frequency > " + Options.getHaplotypeDisplayThreshold(), | public void adjustDisplay(int dt){ //this is called when the controller wants to change the haps //displayed, instead of directly repainting so that none of this math //is done when the screen repaints for other reasons (resizing, focus change, etc) //first filter haps on displaythresh Haplotype[][] filts; filts = new Haplotype[orderedHaplos.length][]; int numhaps = 0; int printable = 0; for (int i = 0; i < orderedHaplos.length; i++){ Vector tempVector = new Vector(); for (int j = 0; j < orderedHaplos[i].length; j++){ if (orderedHaplos[i][j].getPercentage()*100 > dt){ tempVector.add(orderedHaplos[i][j]); numhaps++; } } if (numhaps > 1){ printable++; numhaps=0; } filts[i] = new Haplotype[tempVector.size()]; tempVector.copyInto(filts[i]); } // if user sets display thresh higher than most common hap in any given block if (!(printable == filts.length)){ JOptionPane.showMessageDialog(this.getParent(), "Error: At least one block has too few haplotypes of frequency > " + dt, "Error", JOptionPane.ERROR_MESSAGE); return; } displayThresh = dt; filteredHaplos = filts; //then re-tag try{ filteredHaplos = theData.generateCrossovers(filteredHaplos); }catch (HaploViewException e){ JOptionPane.showMessageDialog(this.getParent(), e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } multidprimeArray = theData.getMultiDprime(); //if the haps pane exists, we want to make sure the vert scroll bar appears if necessary if (this.getParent() != null){ if (this.getPreferredSize().height > this.getParent().getHeight()){ ((JScrollPane)this.getParent().getParent()).setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); }else{ ((JScrollPane)this.getParent().getParent()).setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); } } repaint(); } |
displayThresh = dt; | public void adjustDisplay(int dt){ //this is called when the controller wants to change the haps //displayed, instead of directly repainting so that none of this math //is done when the screen repaints for other reasons (resizing, focus change, etc) //first filter haps on displaythresh Haplotype[][] filts; filts = new Haplotype[orderedHaplos.length][]; int numhaps = 0; int printable = 0; for (int i = 0; i < orderedHaplos.length; i++){ Vector tempVector = new Vector(); for (int j = 0; j < orderedHaplos[i].length; j++){ if (orderedHaplos[i][j].getPercentage()*100 > dt){ tempVector.add(orderedHaplos[i][j]); numhaps++; } } if (numhaps > 1){ printable++; numhaps=0; } filts[i] = new Haplotype[tempVector.size()]; tempVector.copyInto(filts[i]); } // if user sets display thresh higher than most common hap in any given block if (!(printable == filts.length)){ JOptionPane.showMessageDialog(this.getParent(), "Error: At least one block has too few haplotypes of frequency > " + dt, "Error", JOptionPane.ERROR_MESSAGE); return; } displayThresh = dt; filteredHaplos = filts; //then re-tag try{ filteredHaplos = theData.generateCrossovers(filteredHaplos); }catch (HaploViewException e){ JOptionPane.showMessageDialog(this.getParent(), e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } multidprimeArray = theData.getMultiDprime(); //if the haps pane exists, we want to make sure the vert scroll bar appears if necessary if (this.getParent() != null){ if (this.getPreferredSize().height > this.getParent().getHeight()){ ((JScrollPane)this.getParent().getParent()).setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS ); }else{ ((JScrollPane)this.getParent().getParent()).setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); } } repaint(); } |
|
Haplotype[][] haplos = theData.generateHaplotypes(theData.blocks, 0); | Haplotype[][] haplos = theData.generateHaplotypes(theData.blocks, 0,false); | public void getHaps() throws HaploViewException{ if (theData.blocks == null) {return;} Haplotype[][] haplos = theData.generateHaplotypes(theData.blocks, 0); orderedHaplos = new Haplotype[haplos.length][]; for (int i = 0; i < haplos.length; i++) { Vector orderedHaps = new Vector(); //step through each haplotype in this block for (int hapCount = 0; hapCount < haplos[i].length; hapCount++) { if (orderedHaps.size() == 0) { orderedHaps.add(haplos[i][hapCount]); } else { for (int j = 0; j < orderedHaps.size(); j++) { if (((Haplotype)(orderedHaps.elementAt(j))).getPercentage() < haplos[i][hapCount].getPercentage()) { orderedHaps.add(j, haplos[i][hapCount]); break; } if ((j+1) == orderedHaps.size()) { orderedHaps.add(haplos[i][hapCount]); break; } } } } orderedHaplos[i] = new Haplotype[orderedHaps.size()]; orderedHaps.copyInto(orderedHaplos[i]); } adjustDisplay(displayThresh); } |
adjustDisplay(displayThresh); | adjustDisplay(); | public void getHaps() throws HaploViewException{ if (theData.blocks == null) {return;} Haplotype[][] haplos = theData.generateHaplotypes(theData.blocks, 0); orderedHaplos = new Haplotype[haplos.length][]; for (int i = 0; i < haplos.length; i++) { Vector orderedHaps = new Vector(); //step through each haplotype in this block for (int hapCount = 0; hapCount < haplos[i].length; hapCount++) { if (orderedHaps.size() == 0) { orderedHaps.add(haplos[i][hapCount]); } else { for (int j = 0; j < orderedHaps.size(); j++) { if (((Haplotype)(orderedHaps.elementAt(j))).getPercentage() < haplos[i][hapCount].getPercentage()) { orderedHaps.add(j, haplos[i][hapCount]); break; } if ((j+1) == orderedHaps.size()) { orderedHaps.add(haplos[i][hapCount]); break; } } } } orderedHaplos[i] = new Haplotype[orderedHaps.size()]; orderedHaps.copyInto(orderedHaplos[i]); } adjustDisplay(displayThresh); } |
int where = fileSections.indexOf(dbcs); if (where < 0) throw new IllegalArgumentException("dbcs not in list"); fileSections.remove(dbcs); fireRemoveEvent(where, dbcs); | for ( int where=0; where<fileSections.size(); where++ ) { Object o = fileSections.get(where); if (o instanceof ArchitectDataSource) { if ( o.equals(dbcs) ) { fileSections.remove(where); fireRemoveEvent(where, dbcs); return; } } } throw new IllegalArgumentException("dbcs not in list"); | public void removeDataSource(ArchitectDataSource dbcs) { int where = fileSections.indexOf(dbcs); if (where < 0) throw new IllegalArgumentException("dbcs not in list"); fileSections.remove(dbcs); fireRemoveEvent(where, dbcs); } |
Relationship r = new Relationship(playPen, rel); | r = new Relationship(playPen, rel); | public Object createObject(Attributes attributes) { try { SQLRelationship rel = (SQLRelationship) objectIdMap.get(attributes.getValue("relationship-ref")); Relationship r = new Relationship(playPen, rel); playPen.add(r); return r; } catch (ArchitectException e) { logger.error("Couldn't create relationship component", e); return null; } } |
return r; | int pkx = Integer.parseInt(attributes.getValue("pk-x")); int pky = Integer.parseInt(attributes.getValue("pk-y")); int fkx = Integer.parseInt(attributes.getValue("fk-x")); int fky = Integer.parseInt(attributes.getValue("fk-y")); r.setPkConnectionPoint(new Point(pkx, pky)); r.setFkConnectionPoint(new Point(fkx, fky)); | public Object createObject(Attributes attributes) { try { SQLRelationship rel = (SQLRelationship) objectIdMap.get(attributes.getValue("relationship-ref")); Relationship r = new Relationship(playPen, rel); playPen.add(r); return r; } catch (ArchitectException e) { logger.error("Couldn't create relationship component", e); return null; } } |
return null; | } catch (NumberFormatException e) { logger.warn("Didn't set connection points because of integer parse error"); } catch (NullPointerException e) { logger.debug("No pk/fk connection points specified in save file;" +" not setting custom connection points"); | public Object createObject(Attributes attributes) { try { SQLRelationship rel = (SQLRelationship) objectIdMap.get(attributes.getValue("relationship-ref")); Relationship r = new Relationship(playPen, rel); playPen.add(r); return r; } catch (ArchitectException e) { logger.error("Couldn't create relationship component", e); return null; } } |
return r; | public Object createObject(Attributes attributes) { try { SQLRelationship rel = (SQLRelationship) objectIdMap.get(attributes.getValue("relationship-ref")); Relationship r = new Relationship(playPen, rel); playPen.add(r); return r; } catch (ArchitectException e) { logger.error("Couldn't create relationship component", e); return null; } } |
|
+ playPen.getComponentCount() * 2; | + playPen.getPPComponentCount() * 2; | public void save(ProgressMonitor pm) throws IOException, ArchitectException { out = new PrintWriter(new BufferedWriter(new FileWriter(file))); objectIdMap = new HashMap(); dbcsIdMap = new HashMap(); indent = 0; this.pm = pm; pm.setMinimum(0); int pmMax = countSourceTables((SQLObject) sourceDatabases.getModel().getRoot()) + playPen.getComponentCount() * 2; logger.debug("Setting progress monitor maximum to "+pmMax); pm.setMaximum(pmMax); progress = 0; pm.setProgress(progress); pm.setMillisToDecideToPopup(500); try { println("<?xml version=\"1.0\"?>"); println("<architect-project version=\"0.1\">"); indent++; println("<project-name>"+name+"</project-name>"); saveDBCS(); saveSourceDatabases(); saveTargetDatabase(); saveDDLGenerator(); savePlayPen(); indent--; println("</architect-project>"); } finally { out.close(); out = null; pm.close(); pm = null; } } |
int n = playPen.getComponentCount(); for (int i = 0; i < n; i++) { if (playPen.getComponent(i) instanceof TablePane) { TablePane tp = (TablePane) playPen.getComponent(i); Point p = tp.getLocation(); println("<table-pane table-ref=\""+objectIdMap.get(tp.getModel())+"\"" +" x=\""+p.x+"\" y=\""+p.y+"\" />"); pm.setProgress(++progress); pm.setNote(tp.getModel().getShortDisplayName()); } | Iterator it = playPen.getTablePanes().iterator(); while (it.hasNext()) { TablePane tp = (TablePane) it.next(); Point p = tp.getLocation(); println("<table-pane table-ref=\""+objectIdMap.get(tp.getModel())+"\"" +" x=\""+p.x+"\" y=\""+p.y+"\" />"); pm.setProgress(++progress); pm.setNote(tp.getModel().getShortDisplayName()); | protected void savePlayPen() throws IOException, ArchitectException { println("<play-pen>"); indent++; int n = playPen.getComponentCount(); for (int i = 0; i < n; i++) { if (playPen.getComponent(i) instanceof TablePane) { TablePane tp = (TablePane) playPen.getComponent(i); Point p = tp.getLocation(); println("<table-pane table-ref=\""+objectIdMap.get(tp.getModel())+"\"" +" x=\""+p.x+"\" y=\""+p.y+"\" />"); pm.setProgress(++progress); pm.setNote(tp.getModel().getShortDisplayName()); } } Iterator it = playPen.getRelationships().iterator(); while (it.hasNext()) { Relationship r = (Relationship) it.next(); println("<table-link relationship-ref=\""+objectIdMap.get(r.getModel())+"\" />"); } indent--; println("</play-pen>"); } |
Iterator it = playPen.getRelationships().iterator(); | it = playPen.getRelationships().iterator(); | protected void savePlayPen() throws IOException, ArchitectException { println("<play-pen>"); indent++; int n = playPen.getComponentCount(); for (int i = 0; i < n; i++) { if (playPen.getComponent(i) instanceof TablePane) { TablePane tp = (TablePane) playPen.getComponent(i); Point p = tp.getLocation(); println("<table-pane table-ref=\""+objectIdMap.get(tp.getModel())+"\"" +" x=\""+p.x+"\" y=\""+p.y+"\" />"); pm.setProgress(++progress); pm.setNote(tp.getModel().getShortDisplayName()); } } Iterator it = playPen.getRelationships().iterator(); while (it.hasNext()) { Relationship r = (Relationship) it.next(); println("<table-link relationship-ref=\""+objectIdMap.get(r.getModel())+"\" />"); } indent--; println("</play-pen>"); } |
println("<table-link relationship-ref=\""+objectIdMap.get(r.getModel())+"\" />"); | println("<table-link relationship-ref=\""+objectIdMap.get(r.getModel())+"\"" +" pk-x=\""+r.getPkConnectionPoint().x+"\"" +" pk-y=\""+r.getPkConnectionPoint().y+"\"" +" fk-x=\""+r.getFkConnectionPoint().x+"\"" +" fk-y=\""+r.getFkConnectionPoint().y+"\" />"); | protected void savePlayPen() throws IOException, ArchitectException { println("<play-pen>"); indent++; int n = playPen.getComponentCount(); for (int i = 0; i < n; i++) { if (playPen.getComponent(i) instanceof TablePane) { TablePane tp = (TablePane) playPen.getComponent(i); Point p = tp.getLocation(); println("<table-pane table-ref=\""+objectIdMap.get(tp.getModel())+"\"" +" x=\""+p.x+"\" y=\""+p.y+"\" />"); pm.setProgress(++progress); pm.setNote(tp.getModel().getShortDisplayName()); } } Iterator it = playPen.getRelationships().iterator(); while (it.hasNext()) { Relationship r = (Relationship) it.next(); println("<table-link relationship-ref=\""+objectIdMap.get(r.getModel())+"\" />"); } indent--; println("</play-pen>"); } |
propNames.put("pkCardinality", new Integer(((SQLRelationship) o).getPkCardinality())); propNames.put("fkCardinality", new Integer(((SQLRelationship) o).getFkCardinality())); propNames.put("identifying", new Boolean(((SQLRelationship) o).isIdentifying())); | protected void saveSQLObject(SQLObject o) throws IOException, ArchitectException { String id = (String) objectIdMap.get(o); if (id != null) { println("<reference ref-id=\""+id+"\" />"); return; } String type; Map propNames = new TreeMap(); if (o instanceof SQLDatabase) { id = "DB"+objectIdMap.size(); type = "database"; propNames.put("dbcs-ref", dbcsIdMap.get(((SQLDatabase) o).getConnectionSpec())); } else if (o instanceof SQLCatalog) { id = "CAT"+objectIdMap.size(); type = "catalog"; propNames.put("catalogName", ((SQLCatalog) o).getCatalogName()); } else if (o instanceof SQLSchema) { id = "SCH"+objectIdMap.size(); type = "schema"; propNames.put("schemaName", ((SQLSchema) o).getSchemaName()); } else if (o instanceof SQLTable) { id = "TAB"+objectIdMap.size(); type = "table"; propNames.put("tableName", ((SQLTable) o).getTableName()); propNames.put("remarks", ((SQLTable) o).getRemarks()); propNames.put("objectType", ((SQLTable) o).getObjectType()); propNames.put("primaryKeyName", ((SQLTable) o).getPrimaryKeyName()); pm.setProgress(++progress); pm.setNote(o.getShortDisplayName()); } else if (o instanceof SQLTable.Folder) { id = "FOL"+objectIdMap.size(); type = "folder"; propNames.put("name", ((SQLTable.Folder) o).getName()); } else if (o instanceof SQLColumn) { id = "COL"+objectIdMap.size(); type = "column"; SQLColumn sourceCol = ((SQLColumn) o).getSourceColumn(); if (sourceCol != null) { propNames.put("source-column-ref", objectIdMap.get(sourceCol)); } propNames.put("columnName", ((SQLColumn) o).getColumnName()); propNames.put("type", new Integer(((SQLColumn) o).getType())); propNames.put("sourceDBTypeName", ((SQLColumn) o).getSourceDBTypeName()); propNames.put("scale", new Integer(((SQLColumn) o).getScale())); propNames.put("precision", new Integer(((SQLColumn) o).getPrecision())); propNames.put("nullable", new Integer(((SQLColumn) o).getNullable())); propNames.put("remarks", ((SQLColumn) o).getRemarks()); propNames.put("defaultValue", ((SQLColumn) o).getDefaultValue()); propNames.put("primaryKeySeq", ((SQLColumn) o).getPrimaryKeySeq()); propNames.put("autoIncrement", new Boolean(((SQLColumn) o).isAutoIncrement())); } else if (o instanceof SQLRelationship) { id = "REL"+objectIdMap.size(); type = "relationship"; propNames.put("pk-table-ref", objectIdMap.get(((SQLRelationship) o).getPkTable())); propNames.put("fk-table-ref", objectIdMap.get(((SQLRelationship) o).getFkTable())); propNames.put("updateRule", new Integer(((SQLRelationship) o).getUpdateRule())); propNames.put("deleteRule", new Integer(((SQLRelationship) o).getDeleteRule())); propNames.put("deferrability", new Integer(((SQLRelationship) o).getDeferrability())); propNames.put("name", ((SQLRelationship) o).getName()); } else if (o instanceof SQLRelationship.ColumnMapping) { id = "CMP"+objectIdMap.size(); type = "column-mapping"; propNames.put("pk-column-ref", objectIdMap.get(((SQLRelationship.ColumnMapping) o).getPkColumn())); propNames.put("fk-column-ref", objectIdMap.get(((SQLRelationship.ColumnMapping) o).getFkColumn())); } else { throw new UnsupportedOperationException("Woops, the SQLObject type " +o.getClass().getName()+" is not supported!"); } objectIdMap.put(o, id); //print("<"+type+" hashCode=\""+o.hashCode()+"\" id=\""+id+"\" "); print("<"+type+" id=\""+id+"\" "); Iterator props = propNames.keySet().iterator(); while (props.hasNext()) { Object key = props.next(); Object value = propNames.get(key); if (value != null) { niprint(key+"=\""+value+"\" "); } } if (o.allowsChildren()) { niprintln(">"); Iterator children = o.getChildren().iterator(); indent++; while (children.hasNext()) { SQLObject child = (SQLObject) children.next(); if ( ! (child instanceof SQLRelationship)) { saveSQLObject(child); } } if (o instanceof SQLDatabase) { saveRelationships((SQLDatabase) o); } indent--; println("</"+type+">"); } else { niprintln("/>"); } } |
|
new org.dom4j.io.XMLWriter(new java.io.FileOutputStream("file.xml")).write(document); | public void testExample1() throws Exception { Document document = runScript( "src/test/org/apache/commons/jelly/jsl/example.jelly" ); Element small = (Element) document.selectSingleNode("/html/body/small"); new org.dom4j.io.XMLWriter(new java.io.FileOutputStream("file.xml")).write(document); //assertTrue( "<small> starts with 'James Elson'", small.getText().trim().startsWith("James Elson") ); assertEquals( "I am a title!", small.valueOf( "h2" ).trim() ); assertEquals( "Twas a dark, rainy night...", small.valueOf( "small" ).trim() ); assertEquals( "dfjsdfjsdf", small.valueOf( "p" ).trim() ); } |
|
StringTokenizer toks = new StringTokenizer(arg, "="); if (toks.countTokens() == 2) { sysProps.setProperty(toks.nextToken(), toks.nextToken()); } else { System.err.println("Invalid system property: " + arg); } | int ePos = arg.indexOf("="); if(ePos==-1 || ePos==0 || ePos==arg.length()-1) System.err.println("Invalid system property: \"" + arg + "\"."); sysProps.setProperty(arg.substring(0,ePos), arg.substring(ePos+1)); | public CommandLine parseCommandLineOptions(String[] args) throws ParseException { // create the expected options Options cmdLineOptions = new Options(); cmdLineOptions.addOption("o", true, "Output file"); cmdLineOptions.addOption("script", true, "Jelly script to run"); // -D options will be added to the system properties Properties sysProps = System.getProperties(); // filter the system property setting from the arg list // before passing it to the CLI parser ArrayList filteredArgList = new ArrayList(); for (int i=0;i<args.length;i++) { String arg = args[i]; // if this is a -D property parse it and add it to the system properties. // -D args will not be copied into the filteredArgList. if (arg.startsWith("-D") && (arg.length() > 2)) { arg = arg.substring(2); StringTokenizer toks = new StringTokenizer(arg, "="); if (toks.countTokens() == 2) { // add the tokens to the system properties sysProps.setProperty(toks.nextToken(), toks.nextToken()); } else { System.err.println("Invalid system property: " + arg); } } else { // add this to the filtered list of arguments filteredArgList.add(arg); // add additional "-?" options to the options object. if this is not done // the only options allowed would be "-o" and "-script". if (arg.startsWith("-") && arg.length() > 1) { if (!(arg.equals("-o") && arg.equals("-script"))) { cmdLineOptions.addOption(arg.substring(1, arg.length()), true, "dynamic option"); } } } } // make the filteredArgList into an array String[] filterArgs = new String[filteredArgList.size()]; filteredArgList.toArray(filterArgs); // parse the command line Parser parser = new GnuParser(); return parser.parse(cmdLineOptions, filterArgs); } |
JTable table = checkPanel.getTable(); FileWriter checkWriter = new FileWriter(outfile); int numCols = table.getColumnCount(); StringBuffer header = new StringBuffer(); for (int i = 0; i < numCols; i++){ header.append(table.getColumnName(i)).append("\t"); } header.append("\n"); checkWriter.write(header.toString()); for (int i = 0; i < table.getRowCount(); i++){ StringBuffer sb = new StringBuffer(); for (int j = 0; j < numCols-1; j++){ sb.append(table.getValueAt(i,j)).append("\t"); } if (((Boolean)table.getValueAt(i, numCols-1)).booleanValue()){ sb.append("\n"); }else{ sb.append("BAD\n"); } checkWriter.write(sb.toString()); } checkWriter.close(); | checkPanel.printTable(outfile); | void export(int tabNum, int format, int start, int stop){ fc.setSelectedFile(new File("")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ File outfile = fc.getSelectedFile(); if (format == PNG_MODE){ BufferedImage image; if (tabNum == VIEW_D_NUM){ image = dPrimeDisplay.export(start, stop); }else if (tabNum == VIEW_HAP_NUM){ image = hapDisplay.export(); }else{ image = new BufferedImage(1,1,BufferedImage.TYPE_3BYTE_BGR); } try{ String filename = outfile.getPath(); if (! (filename.endsWith(".png") || filename.endsWith(".PNG"))){ filename += ".png"; } Jimi.putImage("image/png", image, filename); }catch(JimiException je){ JOptionPane.showMessageDialog(this, je.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } else if (format == TXT_MODE){ try{ if (tabNum == VIEW_D_NUM){ theData.saveDprimeToText(outfile, TABLE_TYPE, start, stop); }else if (tabNum == VIEW_HAP_NUM){ theData.saveHapsToText(hapDisplay.filteredHaplos,hapDisplay.multidprimeArray, outfile); }else if (tabNum == VIEW_CHECK_NUM){ JTable table = checkPanel.getTable(); FileWriter checkWriter = new FileWriter(outfile); int numCols = table.getColumnCount(); StringBuffer header = new StringBuffer(); for (int i = 0; i < numCols; i++){ header.append(table.getColumnName(i)).append("\t"); } header.append("\n"); checkWriter.write(header.toString()); for (int i = 0; i < table.getRowCount(); i++){ StringBuffer sb = new StringBuffer(); //don't print the true/false vals in last column for (int j = 0; j < numCols-1; j++){ sb.append(table.getValueAt(i,j)).append("\t"); } //print BAD if last column is false if (((Boolean)table.getValueAt(i, numCols-1)).booleanValue()){ sb.append("\n"); }else{ sb.append("BAD\n"); } checkWriter.write(sb.toString()); } checkWriter.close(); }else if (tabNum == VIEW_TDT_NUM){ JTable table = tdtPanel.getTable(); FileWriter checkWriter = new FileWriter(outfile); int numCols = table.getColumnCount(); StringBuffer header = new StringBuffer(); for (int i = 0; i < numCols; i++){ header.append(table.getColumnName(i)).append("\t"); } header.append("\n"); checkWriter.write(header.toString()); for (int i = 0; i < table.getRowCount(); i++){ StringBuffer sb = new StringBuffer(); for (int j = 0; j < numCols; j++){ sb.append(table.getValueAt(i,j)).append("\t"); } sb.append("\n"); checkWriter.write(sb.toString()); } checkWriter.close(); } }catch(IOException ioe){ JOptionPane.showMessageDialog(this, ioe.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } } } |
try { if ( this.taskStack.isEmpty() ) { out.write( event.getMessage() + "\n" ); | if ( event.getPriority() > Project.MSG_INFO && ! isDebug() ) { return; } try { if ( ! this.taskStack.isEmpty() ) { out.write( " [" + this.taskStack.peek() + "] " ); | public void messageLogged(BuildEvent event) { try { if ( this.taskStack.isEmpty() ) { out.write( event.getMessage() + "\n" ); } else { out.write( " [" + this.taskStack.peek() + "] " + event.getMessage() + "\n" ); } } catch (SAXException e) { // ignore } } |
else { out.write( " [" + this.taskStack.peek() + "] " + event.getMessage() + "\n" ); | switch ( event.getPriority() ) { case ( Project.MSG_ERR ): { out.write( "[ERROR] "); break; } case ( Project.MSG_WARN ): { break; } case ( Project.MSG_INFO ): { break; } case ( Project.MSG_VERBOSE ): { out.write( "[VERBOSE] "); break; } case ( Project.MSG_DEBUG ): { out.write( "[DEBUG] "); break; } | public void messageLogged(BuildEvent event) { try { if ( this.taskStack.isEmpty() ) { out.write( event.getMessage() + "\n" ); } else { out.write( " [" + this.taskStack.peek() + "] " + event.getMessage() + "\n" ); } } catch (SAXException e) { // ignore } } |
} catch (SAXException e) { | out.write( event.getMessage() + "\n" ); out.flush(); } catch (SAXException e) { System.err.println( event.getMessage() ); System.err.flush(); } catch (IOException e) { | public void messageLogged(BuildEvent event) { try { if ( this.taskStack.isEmpty() ) { out.write( event.getMessage() + "\n" ); } else { out.write( " [" + this.taskStack.peek() + "] " + event.getMessage() + "\n" ); } } catch (SAXException e) { // ignore } } |
SwingUtilities.paintComponent(g2, pp, new Container(), 0, 0, scaledWidth, scaledHeight); ArchitectFrame.getMainInstance().splitPane.setRightComponent(pp); | for (int i = 0; i < pp.getPlayPenContentPane().getComponentCount(); i++) { PlayPenComponent ppc = pp.getPlayPenContentPane().getComponent(i); g2.translate(ppc.getX(), ppc.getY()); ppc.paint(g2); g2.translate(-ppc.getX(), -ppc.getY()); } | public void paintComponent(Graphics g) { validateLayout(); Graphics2D g2 = (Graphics2D) g; g2.setColor(pp.getBackground()); g2.fill(new Rectangle(0, 0, getWidth(), getHeight())); double zoom = calculateZoom(); int scaledWidth = (int) (getWidth()/zoom); int scaledHeight = (int) (getHeight()/zoom); if (logger.isDebugEnabled()) { Dimension ppSize = pp.getPreferredSize(); logger.debug("PlayPen preferred size = "+ppSize.width+"x"+ppSize.height); logger.debug("After scaling, preview panel coordinate space is "+scaledWidth+"x"+scaledHeight); } // now draw the playpen g2.scale(zoom, zoom); g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); //settings.pp.paint(g2); This is slow in win32 and x11 SwingUtilities.paintComponent(g2, pp, new Container(), 0, 0, scaledWidth, scaledHeight); ArchitectFrame.getMainInstance().splitPane.setRightComponent(pp); // and draw the lines where the page boundaries fall double iW = pageFormat.getImageableWidth(); double iH = pageFormat.getImageableHeight(); g2.scale(1/PrintPanel.this.zoom, 1/PrintPanel.this.zoom); g2.setColor(pp.getForeground()); for (int i = 0; i <= pagesAcross; i++) { g2.drawLine((int) (i * iW), 0, (int) (i * iW), (int) (scaledHeight*PrintPanel.this.zoom)); if (logger.isDebugEnabled()) logger.debug("Drew page separator at x="+(i*iW)); } for (int i = 0; i <= pagesDown; i++) { g2.drawLine(0, (int) (i * iH), (int) (scaledWidth*PrintPanel.this.zoom), (int) (i * iH)); if (logger.isDebugEnabled()) logger.debug("Drew page separator at y="+(i*iH)); } } |
pageFormat = pf; if (pf != oldPF) { validateLayout(); pageFormatLabel.setText(paperToPrintable(pageFormat)); firePropertyChange("pageFormat", oldPF, pageFormat); | if ( pf != null ) { pageFormat = pf; if (pf != oldPF) { validateLayout(); pageFormatLabel.setText(paperToPrintable(pageFormat)); firePropertyChange("pageFormat", oldPF, pageFormat); } | public void setPageFormat(PageFormat pf) { PageFormat oldPF = pageFormat; pageFormat = pf; if (pf != oldPF) { validateLayout(); pageFormatLabel.setText(paperToPrintable(pageFormat)); firePropertyChange("pageFormat", oldPF, pageFormat); } } |
public void run() { logger.debug("current motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); System.setProperty("awt.dnd.drag.threshold","50"); logger.debug("new motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); getMainInstance().macOSXRegistration(); getMainInstance().setVisible(true); } }); | public void run() { Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler()); logger.debug("current motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); System.setProperty("awt.dnd.drag.threshold","10"); logger.debug("new motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); getMainInstance().macOSXRegistration(); getMainInstance().setVisible(true); } }); | public static void main(String args[]) throws ArchitectException { ArchitectUtils.startup(); System.setProperty("apple.laf.useScreenMenuBar", "true"); ArchitectUtils.configureLog4j(); getMainInstance(); SwingUtilities.invokeLater(new Runnable() { public void run() { // this doesn't appear to have any effect on the motion threshold // in the Playpen, but it does seem to work on the DBTree... logger.debug("current motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); System.setProperty("awt.dnd.drag.threshold","50"); logger.debug("new motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); getMainInstance().macOSXRegistration(); getMainInstance().setVisible(true); } }); } |
logger.debug("current motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); System.setProperty("awt.dnd.drag.threshold","50"); logger.debug("new motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); getMainInstance().macOSXRegistration(); getMainInstance().setVisible(true); } | Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler()); logger.debug("current motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); System.setProperty("awt.dnd.drag.threshold","10"); logger.debug("new motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); getMainInstance().macOSXRegistration(); getMainInstance().setVisible(true); } | public void run() { // this doesn't appear to have any effect on the motion threshold // in the Playpen, but it does seem to work on the DBTree... logger.debug("current motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); System.setProperty("awt.dnd.drag.threshold","50"); logger.debug("new motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); getMainInstance().macOSXRegistration(); getMainInstance().setVisible(true); } |
StringTokenizer enum = new StringTokenizer( text, "," ); | StringTokenizer items = new StringTokenizer( text, "," ); | public Point parse(String text) { StringTokenizer enum = new StringTokenizer( text, "," ); int x = 0; int y = 0; if ( enum.hasMoreTokens() ) { x = parseNumber( enum.nextToken() ); } |
x = parseNumber( enum.nextToken() ); | y = parseNumber( items.nextToken() ); | public Point parse(String text) { StringTokenizer enum = new StringTokenizer( text, "," ); int x = 0; int y = 0; if ( enum.hasMoreTokens() ) { x = parseNumber( enum.nextToken() ); } |
r.showPopup(r.popup, evt.getPoint()); | r.showPopup(r.popup, p); | public boolean maybeShowPopup(MouseEvent evt) { Point p = evt.getPoint(); unzoomPoint(p); PlayPenComponent c = contentPane.getComponentAt(p); if (c != null) p.translate(-c.getX(), -c.getY()); if ( c instanceof Relationship) { if (evt.isPopupTrigger() && !evt.isConsumed()) { Relationship r = (Relationship) c; PlayPen pp = (PlayPen) evt.getSource(); pp.selectNone(); r.setSelected(true); r.showPopup(r.popup, evt.getPoint()); return true; } } else if ( c instanceof TablePane ) { TablePane tp = (TablePane) c; if (evt.isPopupTrigger() && !evt.isConsumed()) { PlayPen pp = tp.getPlayPen(); // this allows the right-click menu to work on multiple tables simultaneously if (!tp.isSelected()) { pp.selectNone(); tp.setSelected(true); } try { // tp.selectNone(); // single column selection model for now int idx = tp.pointToColumnIndex(p); if (idx >= 0) { tp.selectColumn(idx); } } catch (ArchitectException e) { logger.error("Exception converting point to column", e); return false; } logger.debug("about to show playpen tablepane popup..."); tp.showPopup(pp.tablePanePopup, p); return true; } } else { PlayPen pp = (PlayPen) evt.getSource(); if (evt.isPopupTrigger()) { //pp.selectNone(); pp.playPenPopup.show(pp, evt.getX(), evt.getY()); return true; } } return false; } |
Method invokeMethod = getInvokeMethod( theClass ); | public void doTag(XMLOutput output) throws Exception { invokeBody(output); if (name == null) { throw new MissingAttributeException("name"); } if (className == null) { throw new MissingAttributeException("className"); } Class theClass = null; try { ClassLoader classLoader = getClassLoader(); theClass = classLoader.loadClass(className); } catch (ClassNotFoundException e) { try { theClass = getClass().getClassLoader().loadClass(className); } catch (ClassNotFoundException e2) { try { theClass = Class.forName(className); } catch (ClassNotFoundException e3) { log.error( "Could not load class: " + className + " exception: " + e, e ); throw new JellyException( "Could not find class: " + className + " using ClassLoader: " + classLoader); } } } Method invokeMethod = getInvokeMethod( theClass ); if ( attributes == null ) { attributes = EMPTY_MAP; } BeanTag tag = new BeanTag(theClass, attributes, varAttribute, invokeMethod); getTagLibrary().registerBeanTag(name, tag); // now lets clear the attributes for next invocation and help the GC attributes = null; } |
|
BeanTag tag = new BeanTag(theClass, attributes, varAttribute, invokeMethod); getTagLibrary().registerBeanTag(name, tag); | final Class beanClass = theClass; final Method invokeMethod = getInvokeMethod( theClass ); final Map beanAttributes = attributes; TagFactory factory = new TagFactory() { public Tag createTag() { return new BeanTag(beanClass, beanAttributes, varAttribute, invokeMethod); } }; getTagLibrary().registerBeanTag(name, factory); | public void doTag(XMLOutput output) throws Exception { invokeBody(output); if (name == null) { throw new MissingAttributeException("name"); } if (className == null) { throw new MissingAttributeException("className"); } Class theClass = null; try { ClassLoader classLoader = getClassLoader(); theClass = classLoader.loadClass(className); } catch (ClassNotFoundException e) { try { theClass = getClass().getClassLoader().loadClass(className); } catch (ClassNotFoundException e2) { try { theClass = Class.forName(className); } catch (ClassNotFoundException e3) { log.error( "Could not load class: " + className + " exception: " + e, e ); throw new JellyException( "Could not find class: " + className + " using ClassLoader: " + classLoader); } } } Method invokeMethod = getInvokeMethod( theClass ); if ( attributes == null ) { attributes = EMPTY_MAP; } BeanTag tag = new BeanTag(theClass, attributes, varAttribute, invokeMethod); getTagLibrary().registerBeanTag(name, tag); // now lets clear the attributes for next invocation and help the GC attributes = null; } |
Vector result = null; | private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; if(!quietMode && fileName != null){ System.out.println("Using data file: " + fileName); } inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } textData = new HaploData(); Vector result = null; if(fileType == HAPS){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED) { //read in ped file result = textData.linkageToChrom(inputFile, PED); if(textData.getPedFile().isBogusParents()) { System.out.println("Error: One or more individuals in the file reference non-existent parents.\nThese references have been ignored."); } }else{ //read in hapmapfile result = textData.linkageToChrom(inputFile,HMP); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (result != null){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; if (result != null){ //once check has been run we can filter the markers for (int i = 0; i < result.size(); i++){ if ((((MarkerResult)result.get(i)).getRating() > 0 || skipCheck) && Chromosome.getUnfilteredMarker(i).getDupStatus() != 2){ markerResults[i] = true; }else{ markerResults[i] = false; } } }else{ //we haven't done the check (HAPS files) Arrays.fill(markerResults, true); } for (int i = 0; i < excludedMarkers.size(); i++){ int cur = ((Integer)excludedMarkers.elementAt(i)).intValue(); if (cur < 1 || cur > markerResults.length){ System.out.println("Excluded marker out of bounds has been ignored: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } Chromosome.doFilter(markerResults); if(!quietMode && infoFile != null){ System.out.println("Using marker information file: " + infoFile.getName()); } if(outputCheck && result != null){ CheckDataPanel cp = new CheckDataPanel(textData); cp.printTable(validateOutputFile(fileName + ".CHECK")); } Vector cust = new Vector(); if(blockOutputType != -1){ textData.generateDPrimeTable(); Haplotype[][] haplos; Haplotype[][] filtHaplos; switch(blockOutputType){ case BLOX_GABRIEL: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; case BLOX_4GAM: OutputFile = validateOutputFile(fileName + ".4GAMblocks"); break; case BLOX_SPINE: OutputFile = validateOutputFile(fileName + ".SPINEblocks"); break; case BLOX_CUSTOM: OutputFile = validateOutputFile(fileName + ".CUSTblocks"); //read in the blocks file File blocksFile = new File(blockFileName); cust = textData.readBlocks(blocksFile); break; case BLOX_ALL: //handled below, so we don't do anything here OutputFile = null; break; default: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; } //this handles output type ALL if(blockOutputType == BLOX_ALL) { OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); textData.guessBlocks(BLOX_GABRIEL); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); } if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC) { if (blockOutputType == BLOX_ALL){ System.out.println("Haplotype association results cannot be used with block output \"ALL\""); }else{ HaploData.saveHapAssocToText(haplos, validateOutputFile(fileName + ".HAPASSOC")); } } } if(outputDprime) { OutputFile = validateOutputFile(fileName + ".LD"); if (textData.dpTable != null){ textData.saveDprimeToText(OutputFile, TABLE_TYPE, 0, Chromosome.getSize()); }else{ textData.saveDprimeToText(OutputFile, LIVE_TYPE, 0, Chromosome.getSize()); } } if (outputPNG || outputCompressedPNG){ OutputFile = validateOutputFile(fileName + ".LD.PNG"); if (textData.dpTable == null){ textData.generateDPrimeTable(); textData.guessBlocks(BLOX_CUSTOM, new Vector()); } if (trackFileName != null){ textData.readAnalysisTrack(new File(trackFileName)); } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getName()); }catch(JimiException je){ System.out.println(je.getMessage()); } } if(Options.getAssocTest() == ASSOC_TRIO){ Vector tdtResults = TDT.calcTrioTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(tdtResults, validateOutputFile(fileName + ".ASSOC")); } else if(Options.getAssocTest() == ASSOC_CC) { Vector ccResults = TDT.calcCCTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(ccResults, validateOutputFile(fileName + ".ASSOC")); } } catch(IOException e){ System.err.println("An error has occured. This probably has to do with file input or output"); } catch(HaploViewException e){ System.err.println(e.getMessage()); } catch(PedFileException pfe) { System.err.println(pfe.getMessage()); } } |
|
result = textData.linkageToChrom(inputFile, PED); | textData.linkageToChrom(inputFile, PED); | private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; if(!quietMode && fileName != null){ System.out.println("Using data file: " + fileName); } inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } textData = new HaploData(); Vector result = null; if(fileType == HAPS){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED) { //read in ped file result = textData.linkageToChrom(inputFile, PED); if(textData.getPedFile().isBogusParents()) { System.out.println("Error: One or more individuals in the file reference non-existent parents.\nThese references have been ignored."); } }else{ //read in hapmapfile result = textData.linkageToChrom(inputFile,HMP); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (result != null){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; if (result != null){ //once check has been run we can filter the markers for (int i = 0; i < result.size(); i++){ if ((((MarkerResult)result.get(i)).getRating() > 0 || skipCheck) && Chromosome.getUnfilteredMarker(i).getDupStatus() != 2){ markerResults[i] = true; }else{ markerResults[i] = false; } } }else{ //we haven't done the check (HAPS files) Arrays.fill(markerResults, true); } for (int i = 0; i < excludedMarkers.size(); i++){ int cur = ((Integer)excludedMarkers.elementAt(i)).intValue(); if (cur < 1 || cur > markerResults.length){ System.out.println("Excluded marker out of bounds has been ignored: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } Chromosome.doFilter(markerResults); if(!quietMode && infoFile != null){ System.out.println("Using marker information file: " + infoFile.getName()); } if(outputCheck && result != null){ CheckDataPanel cp = new CheckDataPanel(textData); cp.printTable(validateOutputFile(fileName + ".CHECK")); } Vector cust = new Vector(); if(blockOutputType != -1){ textData.generateDPrimeTable(); Haplotype[][] haplos; Haplotype[][] filtHaplos; switch(blockOutputType){ case BLOX_GABRIEL: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; case BLOX_4GAM: OutputFile = validateOutputFile(fileName + ".4GAMblocks"); break; case BLOX_SPINE: OutputFile = validateOutputFile(fileName + ".SPINEblocks"); break; case BLOX_CUSTOM: OutputFile = validateOutputFile(fileName + ".CUSTblocks"); //read in the blocks file File blocksFile = new File(blockFileName); cust = textData.readBlocks(blocksFile); break; case BLOX_ALL: //handled below, so we don't do anything here OutputFile = null; break; default: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; } //this handles output type ALL if(blockOutputType == BLOX_ALL) { OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); textData.guessBlocks(BLOX_GABRIEL); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); } if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC) { if (blockOutputType == BLOX_ALL){ System.out.println("Haplotype association results cannot be used with block output \"ALL\""); }else{ HaploData.saveHapAssocToText(haplos, validateOutputFile(fileName + ".HAPASSOC")); } } } if(outputDprime) { OutputFile = validateOutputFile(fileName + ".LD"); if (textData.dpTable != null){ textData.saveDprimeToText(OutputFile, TABLE_TYPE, 0, Chromosome.getSize()); }else{ textData.saveDprimeToText(OutputFile, LIVE_TYPE, 0, Chromosome.getSize()); } } if (outputPNG || outputCompressedPNG){ OutputFile = validateOutputFile(fileName + ".LD.PNG"); if (textData.dpTable == null){ textData.generateDPrimeTable(); textData.guessBlocks(BLOX_CUSTOM, new Vector()); } if (trackFileName != null){ textData.readAnalysisTrack(new File(trackFileName)); } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getName()); }catch(JimiException je){ System.out.println(je.getMessage()); } } if(Options.getAssocTest() == ASSOC_TRIO){ Vector tdtResults = TDT.calcTrioTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(tdtResults, validateOutputFile(fileName + ".ASSOC")); } else if(Options.getAssocTest() == ASSOC_CC) { Vector ccResults = TDT.calcCCTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(ccResults, validateOutputFile(fileName + ".ASSOC")); } } catch(IOException e){ System.err.println("An error has occured. This probably has to do with file input or output"); } catch(HaploViewException e){ System.err.println(e.getMessage()); } catch(PedFileException pfe) { System.err.println(pfe.getMessage()); } } |
result = textData.linkageToChrom(inputFile,HMP); | textData.linkageToChrom(inputFile,HMP); | private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; if(!quietMode && fileName != null){ System.out.println("Using data file: " + fileName); } inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } textData = new HaploData(); Vector result = null; if(fileType == HAPS){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED) { //read in ped file result = textData.linkageToChrom(inputFile, PED); if(textData.getPedFile().isBogusParents()) { System.out.println("Error: One or more individuals in the file reference non-existent parents.\nThese references have been ignored."); } }else{ //read in hapmapfile result = textData.linkageToChrom(inputFile,HMP); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (result != null){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; if (result != null){ //once check has been run we can filter the markers for (int i = 0; i < result.size(); i++){ if ((((MarkerResult)result.get(i)).getRating() > 0 || skipCheck) && Chromosome.getUnfilteredMarker(i).getDupStatus() != 2){ markerResults[i] = true; }else{ markerResults[i] = false; } } }else{ //we haven't done the check (HAPS files) Arrays.fill(markerResults, true); } for (int i = 0; i < excludedMarkers.size(); i++){ int cur = ((Integer)excludedMarkers.elementAt(i)).intValue(); if (cur < 1 || cur > markerResults.length){ System.out.println("Excluded marker out of bounds has been ignored: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } Chromosome.doFilter(markerResults); if(!quietMode && infoFile != null){ System.out.println("Using marker information file: " + infoFile.getName()); } if(outputCheck && result != null){ CheckDataPanel cp = new CheckDataPanel(textData); cp.printTable(validateOutputFile(fileName + ".CHECK")); } Vector cust = new Vector(); if(blockOutputType != -1){ textData.generateDPrimeTable(); Haplotype[][] haplos; Haplotype[][] filtHaplos; switch(blockOutputType){ case BLOX_GABRIEL: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; case BLOX_4GAM: OutputFile = validateOutputFile(fileName + ".4GAMblocks"); break; case BLOX_SPINE: OutputFile = validateOutputFile(fileName + ".SPINEblocks"); break; case BLOX_CUSTOM: OutputFile = validateOutputFile(fileName + ".CUSTblocks"); //read in the blocks file File blocksFile = new File(blockFileName); cust = textData.readBlocks(blocksFile); break; case BLOX_ALL: //handled below, so we don't do anything here OutputFile = null; break; default: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; } //this handles output type ALL if(blockOutputType == BLOX_ALL) { OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); textData.guessBlocks(BLOX_GABRIEL); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); } if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC) { if (blockOutputType == BLOX_ALL){ System.out.println("Haplotype association results cannot be used with block output \"ALL\""); }else{ HaploData.saveHapAssocToText(haplos, validateOutputFile(fileName + ".HAPASSOC")); } } } if(outputDprime) { OutputFile = validateOutputFile(fileName + ".LD"); if (textData.dpTable != null){ textData.saveDprimeToText(OutputFile, TABLE_TYPE, 0, Chromosome.getSize()); }else{ textData.saveDprimeToText(OutputFile, LIVE_TYPE, 0, Chromosome.getSize()); } } if (outputPNG || outputCompressedPNG){ OutputFile = validateOutputFile(fileName + ".LD.PNG"); if (textData.dpTable == null){ textData.generateDPrimeTable(); textData.guessBlocks(BLOX_CUSTOM, new Vector()); } if (trackFileName != null){ textData.readAnalysisTrack(new File(trackFileName)); } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getName()); }catch(JimiException je){ System.out.println(je.getMessage()); } } if(Options.getAssocTest() == ASSOC_TRIO){ Vector tdtResults = TDT.calcTrioTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(tdtResults, validateOutputFile(fileName + ".ASSOC")); } else if(Options.getAssocTest() == ASSOC_CC) { Vector ccResults = TDT.calcCCTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(ccResults, validateOutputFile(fileName + ".ASSOC")); } } catch(IOException e){ System.err.println("An error has occured. This probably has to do with file input or output"); } catch(HaploViewException e){ System.err.println(e.getMessage()); } catch(PedFileException pfe) { System.err.println(pfe.getMessage()); } } |
if (result != null){ | if (fileType != HAPS){ | private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; if(!quietMode && fileName != null){ System.out.println("Using data file: " + fileName); } inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } textData = new HaploData(); Vector result = null; if(fileType == HAPS){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED) { //read in ped file result = textData.linkageToChrom(inputFile, PED); if(textData.getPedFile().isBogusParents()) { System.out.println("Error: One or more individuals in the file reference non-existent parents.\nThese references have been ignored."); } }else{ //read in hapmapfile result = textData.linkageToChrom(inputFile,HMP); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (result != null){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; if (result != null){ //once check has been run we can filter the markers for (int i = 0; i < result.size(); i++){ if ((((MarkerResult)result.get(i)).getRating() > 0 || skipCheck) && Chromosome.getUnfilteredMarker(i).getDupStatus() != 2){ markerResults[i] = true; }else{ markerResults[i] = false; } } }else{ //we haven't done the check (HAPS files) Arrays.fill(markerResults, true); } for (int i = 0; i < excludedMarkers.size(); i++){ int cur = ((Integer)excludedMarkers.elementAt(i)).intValue(); if (cur < 1 || cur > markerResults.length){ System.out.println("Excluded marker out of bounds has been ignored: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } Chromosome.doFilter(markerResults); if(!quietMode && infoFile != null){ System.out.println("Using marker information file: " + infoFile.getName()); } if(outputCheck && result != null){ CheckDataPanel cp = new CheckDataPanel(textData); cp.printTable(validateOutputFile(fileName + ".CHECK")); } Vector cust = new Vector(); if(blockOutputType != -1){ textData.generateDPrimeTable(); Haplotype[][] haplos; Haplotype[][] filtHaplos; switch(blockOutputType){ case BLOX_GABRIEL: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; case BLOX_4GAM: OutputFile = validateOutputFile(fileName + ".4GAMblocks"); break; case BLOX_SPINE: OutputFile = validateOutputFile(fileName + ".SPINEblocks"); break; case BLOX_CUSTOM: OutputFile = validateOutputFile(fileName + ".CUSTblocks"); //read in the blocks file File blocksFile = new File(blockFileName); cust = textData.readBlocks(blocksFile); break; case BLOX_ALL: //handled below, so we don't do anything here OutputFile = null; break; default: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; } //this handles output type ALL if(blockOutputType == BLOX_ALL) { OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); textData.guessBlocks(BLOX_GABRIEL); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); } if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC) { if (blockOutputType == BLOX_ALL){ System.out.println("Haplotype association results cannot be used with block output \"ALL\""); }else{ HaploData.saveHapAssocToText(haplos, validateOutputFile(fileName + ".HAPASSOC")); } } } if(outputDprime) { OutputFile = validateOutputFile(fileName + ".LD"); if (textData.dpTable != null){ textData.saveDprimeToText(OutputFile, TABLE_TYPE, 0, Chromosome.getSize()); }else{ textData.saveDprimeToText(OutputFile, LIVE_TYPE, 0, Chromosome.getSize()); } } if (outputPNG || outputCompressedPNG){ OutputFile = validateOutputFile(fileName + ".LD.PNG"); if (textData.dpTable == null){ textData.generateDPrimeTable(); textData.guessBlocks(BLOX_CUSTOM, new Vector()); } if (trackFileName != null){ textData.readAnalysisTrack(new File(trackFileName)); } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getName()); }catch(JimiException je){ System.out.println(je.getMessage()); } } if(Options.getAssocTest() == ASSOC_TRIO){ Vector tdtResults = TDT.calcTrioTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(tdtResults, validateOutputFile(fileName + ".ASSOC")); } else if(Options.getAssocTest() == ASSOC_CC) { Vector ccResults = TDT.calcCCTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(ccResults, validateOutputFile(fileName + ".ASSOC")); } } catch(IOException e){ System.err.println("An error has occured. This probably has to do with file input or output"); } catch(HaploViewException e){ System.err.println(e.getMessage()); } catch(PedFileException pfe) { System.err.println(pfe.getMessage()); } } |
if (result != null){ | Vector result = null; if (fileType != HAPS){ result = textData.getPedFile().getResults(); | private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; if(!quietMode && fileName != null){ System.out.println("Using data file: " + fileName); } inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } textData = new HaploData(); Vector result = null; if(fileType == HAPS){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED) { //read in ped file result = textData.linkageToChrom(inputFile, PED); if(textData.getPedFile().isBogusParents()) { System.out.println("Error: One or more individuals in the file reference non-existent parents.\nThese references have been ignored."); } }else{ //read in hapmapfile result = textData.linkageToChrom(inputFile,HMP); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (result != null){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; if (result != null){ //once check has been run we can filter the markers for (int i = 0; i < result.size(); i++){ if ((((MarkerResult)result.get(i)).getRating() > 0 || skipCheck) && Chromosome.getUnfilteredMarker(i).getDupStatus() != 2){ markerResults[i] = true; }else{ markerResults[i] = false; } } }else{ //we haven't done the check (HAPS files) Arrays.fill(markerResults, true); } for (int i = 0; i < excludedMarkers.size(); i++){ int cur = ((Integer)excludedMarkers.elementAt(i)).intValue(); if (cur < 1 || cur > markerResults.length){ System.out.println("Excluded marker out of bounds has been ignored: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } Chromosome.doFilter(markerResults); if(!quietMode && infoFile != null){ System.out.println("Using marker information file: " + infoFile.getName()); } if(outputCheck && result != null){ CheckDataPanel cp = new CheckDataPanel(textData); cp.printTable(validateOutputFile(fileName + ".CHECK")); } Vector cust = new Vector(); if(blockOutputType != -1){ textData.generateDPrimeTable(); Haplotype[][] haplos; Haplotype[][] filtHaplos; switch(blockOutputType){ case BLOX_GABRIEL: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; case BLOX_4GAM: OutputFile = validateOutputFile(fileName + ".4GAMblocks"); break; case BLOX_SPINE: OutputFile = validateOutputFile(fileName + ".SPINEblocks"); break; case BLOX_CUSTOM: OutputFile = validateOutputFile(fileName + ".CUSTblocks"); //read in the blocks file File blocksFile = new File(blockFileName); cust = textData.readBlocks(blocksFile); break; case BLOX_ALL: //handled below, so we don't do anything here OutputFile = null; break; default: OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); break; } //this handles output type ALL if(blockOutputType == BLOX_ALL) { OutputFile = validateOutputFile(fileName + ".GABRIELblocks"); textData.guessBlocks(BLOX_GABRIEL); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateHaplotypes(textData.blocks, false); filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); } if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC) { if (blockOutputType == BLOX_ALL){ System.out.println("Haplotype association results cannot be used with block output \"ALL\""); }else{ HaploData.saveHapAssocToText(haplos, validateOutputFile(fileName + ".HAPASSOC")); } } } if(outputDprime) { OutputFile = validateOutputFile(fileName + ".LD"); if (textData.dpTable != null){ textData.saveDprimeToText(OutputFile, TABLE_TYPE, 0, Chromosome.getSize()); }else{ textData.saveDprimeToText(OutputFile, LIVE_TYPE, 0, Chromosome.getSize()); } } if (outputPNG || outputCompressedPNG){ OutputFile = validateOutputFile(fileName + ".LD.PNG"); if (textData.dpTable == null){ textData.generateDPrimeTable(); textData.guessBlocks(BLOX_CUSTOM, new Vector()); } if (trackFileName != null){ textData.readAnalysisTrack(new File(trackFileName)); } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getName()); }catch(JimiException je){ System.out.println(je.getMessage()); } } if(Options.getAssocTest() == ASSOC_TRIO){ Vector tdtResults = TDT.calcTrioTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(tdtResults, validateOutputFile(fileName + ".ASSOC")); } else if(Options.getAssocTest() == ASSOC_CC) { Vector ccResults = TDT.calcCCTDT(textData.getPedFile()); HaploData.saveMarkerAssocToText(ccResults, validateOutputFile(fileName + ".ASSOC")); } } catch(IOException e){ System.err.println("An error has occured. This probably has to do with file input or output"); } catch(HaploViewException e){ System.err.println(e.getMessage()); } catch(PedFileException pfe) { System.err.println(pfe.getMessage()); } } |
public TDTPanel(PedFile pf, int t){ | public TDTPanel(PedFile pf, int t) throws PedFileException{ | public TDTPanel(PedFile pf, int t){ type = t; if (type == 1){ result = TDT.calcTrioTDT(pf); }else{ result = TDT.calcCCTDT(pf); } tableColumnNames.add("#"); tableColumnNames.add("Name"); if (type == 1){ tableColumnNames.add("Overtransmitted"); tableColumnNames.add("T:U"); }else{ tableColumnNames.add("Major Alleles"); tableColumnNames.add("Case, Control Ratios"); } tableColumnNames.add("Chi Squared"); tableColumnNames.add("p value"); refreshTable(); } |
private OpenProjectAction() { | private OpenProjectAction(RecentMenu recent) { | private OpenProjectAction() { super("Open Project...", ASUtils.createJLFIcon("general/Open", "Open Project", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))); putValue(AbstractAction.SHORT_DESCRIPTION, "Open"); putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); } |
this.recent = recent; | private OpenProjectAction() { super("Open Project...", ASUtils.createJLFIcon("general/Open", "Open Project", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))); putValue(AbstractAction.SHORT_DESCRIPTION, "Open"); putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask())); } |
|
recent.putRecentFileName(f.getAbsolutePath()); | public void actionPerformed(ActionEvent e) { if (promptForUnsavedModifications()) { JFileChooser chooser = new JFileChooser(); chooser.addChoosableFileFilter(ASUtils.ARCHITECT_FILE_FILTER); int returnVal = chooser.showOpenDialog(ArchitectFrame.this); if (returnVal == JFileChooser.APPROVE_OPTION) { File f = chooser.getSelectedFile(); LoadFileWorker worker; try { worker = new LoadFileWorker(f); new Thread(worker).start(); } catch (FileNotFoundException e1) { JOptionPane.showMessageDialog( ArchitectFrame.this, "File not found: "+f.getPath()); } catch (Exception e1) { ASUtils.showExceptionDialog( ArchitectFrame.this, "Error loading file", e1); } } } } |
|
Iterator it = project.getSourceDatabases().getDatabaseList().iterator();; | Iterator it = project.getSourceDatabases().getDatabaseList().iterator(); | protected void closeProject(SwingUIProject project) { // close connections Iterator it = project.getSourceDatabases().getDatabaseList().iterator();; while (it.hasNext()) { SQLDatabase db = (SQLDatabase) it.next(); logger.debug ("closing connection: " + db.getName()); db.disconnect(); } } |
openProjectAction = new OpenProjectAction(); | final RecentMenu recent = new RecentMenu(this) { @Override public void loadFile(String fileName) throws IOException { openFile(fileName); } }; openProjectAction = new OpenProjectAction(recent); JMenuItem clearItem = new JMenuItem("Clear Recent Files"); clearItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { recent.clear(); } }); | protected void init() throws ArchitectException { int accelMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); UserSettings us; // must be done right away, because a static // initializer in this class effects BeanUtils // behaviour which the XML Digester relies // upon heavily //TypeMap.getInstance(); contentPane = (JComponent)getContentPane(); try { ConfigFile cf = ConfigFile.getDefaultInstance(); us = cf.read(); architectSession.setUserSettings(us); sprefs = architectSession.getUserSettings().getSwingSettings(); } catch (IOException e) { throw new ArchitectException("prefs.read", e); } while (us.getPlDotIni() == null) { String message; String[] options = new String[] {"Browse", "Create"}; if (us.getPlDotIniPath() == null) { message = "location is not set"; } else if (new File(us.getPlDotIniPath()).isFile()) { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n could not be read"; } else { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n does not exist"; } int choice = JOptionPane.showOptionDialog(null, "The Architect keeps its list of database connections" + "\nin a file called PL.INI. Your PL.INI "+message+"." + "\n\nYou can browse for an existing PL.INI file on your system" + "\nor allow the Architect to create a new one in your home directory." + "\n\nHint: If you are a Power*Loader Suite user, you should browse for" + "\nan existing PL.INI in your Power*Loader installation directory.", "Missing PL.INI", 0, JOptionPane.INFORMATION_MESSAGE, null, options, null); File newPlIniFile; if (choice == 0) { JFileChooser fc = new JFileChooser(); fc.setFileFilter(ASUtils.INI_FILE_FILTER); fc.setDialogTitle("Locate your PL.INI file"); int fcChoice = fc.showOpenDialog(null); if (fcChoice == JFileChooser.APPROVE_OPTION) { newPlIniFile = fc.getSelectedFile(); } else { newPlIniFile = null; } } else { newPlIniFile = new File(System.getProperty("user.home"), "pl.ini"); } if (newPlIniFile != null) try { newPlIniFile.createNewFile(); us.setPlDotIniPath(newPlIniFile.getPath()); } catch (IOException e1) { logger.error("Caught IO exception while creating empty PL.INI at \"" +newPlIniFile.getPath()+"\"", e1); JOptionPane.showMessageDialog(null, "Failed to create file \""+newPlIniFile.getPath()+"\":\n"+e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } // Create actions aboutAction = new AboutAction(); newProjectAction = new AbstractAction("New Project", ASUtils.createJLFIcon("general/New","New Project",sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { if (promptForUnsavedModifications()) { try { closeProject(getProject()); setProject(new SwingUIProject("New Project")); logger.debug("Glass pane is "+getGlassPane()); } catch (Exception ex) { JOptionPane.showMessageDialog(ArchitectFrame.this, "Can't create new project: "+ex.getMessage()); logger.error("Got exception while creating new project", ex); } } } }; newProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "New"); newProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, accelMask)); openProjectAction = new OpenProjectAction(); saveProjectAction = new AbstractAction("Save Project", ASUtils.createJLFIcon("general/Save", "Save Project", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(false, true); } }; saveProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save"); saveProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, accelMask)); saveProjectAsAction = new AbstractAction("Save Project As...", ASUtils.createJLFIcon("general/SaveAs", "Save Project As...", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(true, true); } }; saveProjectAsAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save As"); prefAction = new PreferencesAction(); projectSettingsAction = new ProjectSettingsAction(); projectSettingsAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_COMMA, accelMask)); printAction = new PrintAction(); printAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_P, accelMask)); zoomInAction = new ZoomAction(ZOOM_STEP); zoomOutAction = new ZoomAction(ZOOM_STEP * -1.0); zoomNormalAction = new AbstractAction("Reset Zoom", ASUtils.createJLFIcon("general/Zoom", "Reset Zoom", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { playpen.setZoom(1.0); } }; zoomNormalAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Reset Zoom"); undoAction = new UndoAction(); redoAction = new RedoAction(); autoLayoutAction = new AutoLayoutAction(); autoLayout = new FruchtermanReingoldForceLayout(); autoLayoutAction.setLayout(autoLayout); exportDDLAction = new ExportDDLAction(); compareDMAction = new CompareDMAction(); exportPLTransAction = new ExportPLTransAction(); quickStartAction = new QuickStartAction(); deleteSelectedAction = new DeleteSelectedAction(); createIdentifyingRelationshipAction = new CreateRelationshipAction(true); createNonIdentifyingRelationshipAction = new CreateRelationshipAction(false); editRelationshipAction = new EditRelationshipAction(); createTableAction = new CreateTableAction(); editColumnAction = new EditColumnAction(); insertColumnAction = new InsertColumnAction(); editTableAction = new EditTableAction(); searchReplaceAction = new SearchReplaceAction(); searchReplaceAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F, accelMask)); selectAllAction = new SelectAllAction(); selectAllAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_A, accelMask)); menuBar = new JMenuBar(); //Settingup JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic('f'); fileMenu.add(newProjectAction); fileMenu.add(openProjectAction); fileMenu.add(saveProjectAction); fileMenu.add(saveProjectAsAction); fileMenu.add(printAction); fileMenu.add(prefAction); fileMenu.add(projectSettingsAction); fileMenu.add(saveSettingsAction); fileMenu.add(exitAction); menuBar.add(fileMenu); JMenu editMenu = new JMenu("Edit"); editMenu.setMnemonic('e'); editMenu.add(undoAction); editMenu.add(redoAction); editMenu.addSeparator(); editMenu.add(selectAllAction); editMenu.addSeparator(); editMenu.add(searchReplaceAction); menuBar.add(editMenu); // the connections menu is set up when a new project is created (because it depends on the current DBTree) connectionsMenu = new JMenu("Connections"); connectionsMenu.setMnemonic('c'); menuBar.add(connectionsMenu); JMenu etlMenu = new JMenu("ETL"); etlMenu.setMnemonic('l'); JMenu etlSubmenuOne = new JMenu("Power*Loader"); etlSubmenuOne.add(exportPLTransAction); etlSubmenuOne.add(new JMenuItem("PL Transaction File Export")); etlSubmenuOne.add(new JMenuItem("Run Power*Loader")); etlSubmenuOne.add(quickStartAction); etlMenu.add(etlSubmenuOne); menuBar.add(etlMenu); JMenu toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic('t'); toolsMenu.add(exportDDLAction); toolsMenu.add(compareDMAction); menuBar.add(toolsMenu); JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic('h'); helpMenu.add(aboutAction); menuBar.add(helpMenu); setJMenuBar(menuBar); projectBar = new JToolBar(JToolBar.HORIZONTAL); ppBar = new JToolBar(JToolBar.VERTICAL); projectBar.add(newProjectAction); projectBar.add(openProjectAction); projectBar.add(saveProjectAction); projectBar.addSeparator(); projectBar.add(printAction); projectBar.addSeparator(); projectBar.add(undoAction); projectBar.add(redoAction); projectBar.addSeparator(); projectBar.add(exportDDLAction); projectBar.addSeparator(); projectBar.add(compareDMAction); projectBar.addSeparator(); projectBar.add(autoLayoutAction); projectBar.setToolTipText("Project Toolbar"); projectBar.setName("Project Toolbar"); JButton tempButton = null; // shared actions need to report where they are coming from ppBar.setToolTipText("PlayPen Toolbar"); ppBar.setName("PlayPen ToolBar"); ppBar.add(zoomInAction); ppBar.add(zoomOutAction); ppBar.add(zoomNormalAction); ppBar.addSeparator(); tempButton = ppBar.add(deleteSelectedAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(createTableAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(insertColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); tempButton = ppBar.add(editColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); ppBar.add(createNonIdentifyingRelationshipAction); ppBar.add(createIdentifyingRelationshipAction); tempButton = ppBar.add(editRelationshipAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); Container projectBarPane = getContentPane(); projectBarPane.setLayout(new BorderLayout()); projectBarPane.add(projectBar, BorderLayout.NORTH); JPanel cp = new JPanel(new BorderLayout()); cp.add(ppBar, BorderLayout.EAST); projectBarPane.add(cp, BorderLayout.CENTER); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); cp.add(splitPane, BorderLayout.CENTER); logger.debug("Added splitpane to content pane"); splitPane.setDividerLocation (sprefs.getInt(SwingUserSettings.DIVIDER_LOCATION, 150)); //dbTree.getPreferredSize().width)); Rectangle bounds = new Rectangle(); bounds.x = sprefs.getInt(SwingUserSettings.MAIN_FRAME_X, 40); bounds.y = sprefs.getInt(SwingUserSettings.MAIN_FRAME_Y, 40); bounds.width = sprefs.getInt(SwingUserSettings.MAIN_FRAME_WIDTH, 600); bounds.height = sprefs.getInt(SwingUserSettings.MAIN_FRAME_HEIGHT, 440); setBounds(bounds); addWindowListener(afWindowListener = new ArchitectFrameWindowListener()); setProject(new SwingUIProject("New Project")); } |
bounds.x = sprefs.getInt(SwingUserSettings.MAIN_FRAME_X, 40); bounds.y = sprefs.getInt(SwingUserSettings.MAIN_FRAME_Y, 40); bounds.width = sprefs.getInt(SwingUserSettings.MAIN_FRAME_WIDTH, 600); bounds.height = sprefs.getInt(SwingUserSettings.MAIN_FRAME_HEIGHT, 440); | bounds.x = prefs.getInt(SwingUserSettings.MAIN_FRAME_X, 40); bounds.y = prefs.getInt(SwingUserSettings.MAIN_FRAME_Y, 40); bounds.width = prefs.getInt(SwingUserSettings.MAIN_FRAME_WIDTH, 600); bounds.height = prefs.getInt(SwingUserSettings.MAIN_FRAME_HEIGHT, 440); | protected void init() throws ArchitectException { int accelMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); UserSettings us; // must be done right away, because a static // initializer in this class effects BeanUtils // behaviour which the XML Digester relies // upon heavily //TypeMap.getInstance(); contentPane = (JComponent)getContentPane(); try { ConfigFile cf = ConfigFile.getDefaultInstance(); us = cf.read(); architectSession.setUserSettings(us); sprefs = architectSession.getUserSettings().getSwingSettings(); } catch (IOException e) { throw new ArchitectException("prefs.read", e); } while (us.getPlDotIni() == null) { String message; String[] options = new String[] {"Browse", "Create"}; if (us.getPlDotIniPath() == null) { message = "location is not set"; } else if (new File(us.getPlDotIniPath()).isFile()) { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n could not be read"; } else { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n does not exist"; } int choice = JOptionPane.showOptionDialog(null, "The Architect keeps its list of database connections" + "\nin a file called PL.INI. Your PL.INI "+message+"." + "\n\nYou can browse for an existing PL.INI file on your system" + "\nor allow the Architect to create a new one in your home directory." + "\n\nHint: If you are a Power*Loader Suite user, you should browse for" + "\nan existing PL.INI in your Power*Loader installation directory.", "Missing PL.INI", 0, JOptionPane.INFORMATION_MESSAGE, null, options, null); File newPlIniFile; if (choice == 0) { JFileChooser fc = new JFileChooser(); fc.setFileFilter(ASUtils.INI_FILE_FILTER); fc.setDialogTitle("Locate your PL.INI file"); int fcChoice = fc.showOpenDialog(null); if (fcChoice == JFileChooser.APPROVE_OPTION) { newPlIniFile = fc.getSelectedFile(); } else { newPlIniFile = null; } } else { newPlIniFile = new File(System.getProperty("user.home"), "pl.ini"); } if (newPlIniFile != null) try { newPlIniFile.createNewFile(); us.setPlDotIniPath(newPlIniFile.getPath()); } catch (IOException e1) { logger.error("Caught IO exception while creating empty PL.INI at \"" +newPlIniFile.getPath()+"\"", e1); JOptionPane.showMessageDialog(null, "Failed to create file \""+newPlIniFile.getPath()+"\":\n"+e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } // Create actions aboutAction = new AboutAction(); newProjectAction = new AbstractAction("New Project", ASUtils.createJLFIcon("general/New","New Project",sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { if (promptForUnsavedModifications()) { try { closeProject(getProject()); setProject(new SwingUIProject("New Project")); logger.debug("Glass pane is "+getGlassPane()); } catch (Exception ex) { JOptionPane.showMessageDialog(ArchitectFrame.this, "Can't create new project: "+ex.getMessage()); logger.error("Got exception while creating new project", ex); } } } }; newProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "New"); newProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, accelMask)); openProjectAction = new OpenProjectAction(); saveProjectAction = new AbstractAction("Save Project", ASUtils.createJLFIcon("general/Save", "Save Project", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(false, true); } }; saveProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save"); saveProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, accelMask)); saveProjectAsAction = new AbstractAction("Save Project As...", ASUtils.createJLFIcon("general/SaveAs", "Save Project As...", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(true, true); } }; saveProjectAsAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save As"); prefAction = new PreferencesAction(); projectSettingsAction = new ProjectSettingsAction(); projectSettingsAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_COMMA, accelMask)); printAction = new PrintAction(); printAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_P, accelMask)); zoomInAction = new ZoomAction(ZOOM_STEP); zoomOutAction = new ZoomAction(ZOOM_STEP * -1.0); zoomNormalAction = new AbstractAction("Reset Zoom", ASUtils.createJLFIcon("general/Zoom", "Reset Zoom", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { playpen.setZoom(1.0); } }; zoomNormalAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Reset Zoom"); undoAction = new UndoAction(); redoAction = new RedoAction(); autoLayoutAction = new AutoLayoutAction(); autoLayout = new FruchtermanReingoldForceLayout(); autoLayoutAction.setLayout(autoLayout); exportDDLAction = new ExportDDLAction(); compareDMAction = new CompareDMAction(); exportPLTransAction = new ExportPLTransAction(); quickStartAction = new QuickStartAction(); deleteSelectedAction = new DeleteSelectedAction(); createIdentifyingRelationshipAction = new CreateRelationshipAction(true); createNonIdentifyingRelationshipAction = new CreateRelationshipAction(false); editRelationshipAction = new EditRelationshipAction(); createTableAction = new CreateTableAction(); editColumnAction = new EditColumnAction(); insertColumnAction = new InsertColumnAction(); editTableAction = new EditTableAction(); searchReplaceAction = new SearchReplaceAction(); searchReplaceAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F, accelMask)); selectAllAction = new SelectAllAction(); selectAllAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_A, accelMask)); menuBar = new JMenuBar(); //Settingup JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic('f'); fileMenu.add(newProjectAction); fileMenu.add(openProjectAction); fileMenu.add(saveProjectAction); fileMenu.add(saveProjectAsAction); fileMenu.add(printAction); fileMenu.add(prefAction); fileMenu.add(projectSettingsAction); fileMenu.add(saveSettingsAction); fileMenu.add(exitAction); menuBar.add(fileMenu); JMenu editMenu = new JMenu("Edit"); editMenu.setMnemonic('e'); editMenu.add(undoAction); editMenu.add(redoAction); editMenu.addSeparator(); editMenu.add(selectAllAction); editMenu.addSeparator(); editMenu.add(searchReplaceAction); menuBar.add(editMenu); // the connections menu is set up when a new project is created (because it depends on the current DBTree) connectionsMenu = new JMenu("Connections"); connectionsMenu.setMnemonic('c'); menuBar.add(connectionsMenu); JMenu etlMenu = new JMenu("ETL"); etlMenu.setMnemonic('l'); JMenu etlSubmenuOne = new JMenu("Power*Loader"); etlSubmenuOne.add(exportPLTransAction); etlSubmenuOne.add(new JMenuItem("PL Transaction File Export")); etlSubmenuOne.add(new JMenuItem("Run Power*Loader")); etlSubmenuOne.add(quickStartAction); etlMenu.add(etlSubmenuOne); menuBar.add(etlMenu); JMenu toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic('t'); toolsMenu.add(exportDDLAction); toolsMenu.add(compareDMAction); menuBar.add(toolsMenu); JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic('h'); helpMenu.add(aboutAction); menuBar.add(helpMenu); setJMenuBar(menuBar); projectBar = new JToolBar(JToolBar.HORIZONTAL); ppBar = new JToolBar(JToolBar.VERTICAL); projectBar.add(newProjectAction); projectBar.add(openProjectAction); projectBar.add(saveProjectAction); projectBar.addSeparator(); projectBar.add(printAction); projectBar.addSeparator(); projectBar.add(undoAction); projectBar.add(redoAction); projectBar.addSeparator(); projectBar.add(exportDDLAction); projectBar.addSeparator(); projectBar.add(compareDMAction); projectBar.addSeparator(); projectBar.add(autoLayoutAction); projectBar.setToolTipText("Project Toolbar"); projectBar.setName("Project Toolbar"); JButton tempButton = null; // shared actions need to report where they are coming from ppBar.setToolTipText("PlayPen Toolbar"); ppBar.setName("PlayPen ToolBar"); ppBar.add(zoomInAction); ppBar.add(zoomOutAction); ppBar.add(zoomNormalAction); ppBar.addSeparator(); tempButton = ppBar.add(deleteSelectedAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(createTableAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(insertColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); tempButton = ppBar.add(editColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); ppBar.add(createNonIdentifyingRelationshipAction); ppBar.add(createIdentifyingRelationshipAction); tempButton = ppBar.add(editRelationshipAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); Container projectBarPane = getContentPane(); projectBarPane.setLayout(new BorderLayout()); projectBarPane.add(projectBar, BorderLayout.NORTH); JPanel cp = new JPanel(new BorderLayout()); cp.add(ppBar, BorderLayout.EAST); projectBarPane.add(cp, BorderLayout.CENTER); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); cp.add(splitPane, BorderLayout.CENTER); logger.debug("Added splitpane to content pane"); splitPane.setDividerLocation (sprefs.getInt(SwingUserSettings.DIVIDER_LOCATION, 150)); //dbTree.getPreferredSize().width)); Rectangle bounds = new Rectangle(); bounds.x = sprefs.getInt(SwingUserSettings.MAIN_FRAME_X, 40); bounds.y = sprefs.getInt(SwingUserSettings.MAIN_FRAME_Y, 40); bounds.width = sprefs.getInt(SwingUserSettings.MAIN_FRAME_WIDTH, 600); bounds.height = sprefs.getInt(SwingUserSettings.MAIN_FRAME_HEIGHT, 440); setBounds(bounds); addWindowListener(afWindowListener = new ArchitectFrameWindowListener()); setProject(new SwingUIProject("New Project")); } |
saveOrSaveAs(true, true); } | recent.clear(); } | public void actionPerformed(ActionEvent e) { saveOrSaveAs(true, true); } |
playpen.setZoom(1.0); | saveOrSaveAs(false, true); | public void actionPerformed(ActionEvent e) { playpen.setZoom(1.0); } |
sprefs.setInt(SwingUserSettings.DIVIDER_LOCATION, splitPane.getDividerLocation()); sprefs.setInt(SwingUserSettings.MAIN_FRAME_X, getLocation().x); sprefs.setInt(SwingUserSettings.MAIN_FRAME_Y, getLocation().y); sprefs.setInt(SwingUserSettings.MAIN_FRAME_WIDTH, getWidth()); sprefs.setInt(SwingUserSettings.MAIN_FRAME_HEIGHT, getHeight()); | prefs.putInt(SwingUserSettings.DIVIDER_LOCATION, splitPane.getDividerLocation()); prefs.putInt(SwingUserSettings.MAIN_FRAME_X, getLocation().x); prefs.putInt(SwingUserSettings.MAIN_FRAME_Y, getLocation().y); prefs.putInt(SwingUserSettings.MAIN_FRAME_WIDTH, getWidth()); prefs.putInt(SwingUserSettings.MAIN_FRAME_HEIGHT, getHeight()); | public void saveSettings() throws ArchitectException { if (configFile == null) configFile = ConfigFile.getDefaultInstance(); sprefs.setInt(SwingUserSettings.DIVIDER_LOCATION, splitPane.getDividerLocation()); sprefs.setInt(SwingUserSettings.MAIN_FRAME_X, getLocation().x); sprefs.setInt(SwingUserSettings.MAIN_FRAME_Y, getLocation().y); sprefs.setInt(SwingUserSettings.MAIN_FRAME_WIDTH, getWidth()); sprefs.setInt(SwingUserSettings.MAIN_FRAME_HEIGHT, getHeight()); configFile.write(getArchitectSession()); UserSettings us = getUserSettings(); try { us.getPlDotIni().write(new File(us.getPlDotIniPath())); } catch (IOException e) { logger.error("Couldn't save PL.INI file!", e); } } |
System.out.println("Data check results:\n" + "Name\tObsHET\tPredHET\tHWpval\t%Geno\tFamTrio\tMendErr"); for(int i=0;i<result.size();i++){ MarkerResult currentResult = (MarkerResult)result.get(i); System.out.println( Chromosome.getMarker(i).getName() +"\t"+ currentResult.getObsHet() +"\t"+ currentResult.getPredHet() +"\t"+ currentResult.getHWpvalue() +"\t"+ currentResult.getGenoPercent() +"\t"+ currentResult.getFamTrioNum() +"\t"+ currentResult.getMendErrNum()); } | CheckDataPanel cp = new CheckDataPanel(textData); cp.printTable(null); | private void processFile(String fileName,int fileType,String infoFileName){ System.out.println(TITLE_STRING); try { int outputType; long maxDistance; HaploData textData; File OutputFile; File inputFile; inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } maxDistance = this.arg_distance * 1000; outputType = this.arg_output; textData = new HaploData(0); Vector result = null; if(fileType == 0){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == 1) { //read in ped file /* if(this.arg_ignoreMarkers.size()>0) { for(int i=0;i<this.arg_ignoreMarkers.size();i++){ int index = Integer.parseInt((String)this.arg_ignoreMarkers.get(i)); if(index>0 && index<markerResultArray.length){ markerResultArray[index] = false; if(!this.arg_quiet) { System.out.println("Ignoring marker " + (index)); } } } }*/ result = textData.linkageToChrom(inputFile, 3, arg_skipCheck); }else{ //read in hapmapfile result = textData.linkageToChrom(inputFile,4,arg_skipCheck); } File infoFile; if(infoFileName.equals("")) { infoFile = null; }else{ infoFile = new File(infoFileName); } textData.prepareMarkerInput(infoFile,maxDistance,textData.getPedFile().getHMInfo()); if(!arg_quiet && infoFile != null){ System.out.println("Using marker file " + infoFile.getName()); } textData.infoKnown = true; if(this.arg_showCheck && result != null) { System.out.println("Data check results:\n" + "Name\tObsHET\tPredHET\tHWpval\t%Geno\tFamTrio\tMendErr"); for(int i=0;i<result.size();i++){ MarkerResult currentResult = (MarkerResult)result.get(i); System.out.println( Chromosome.getMarker(i).getName() +"\t"+ currentResult.getObsHet() +"\t"+ currentResult.getPredHet() +"\t"+ currentResult.getHWpvalue() +"\t"+ currentResult.getGenoPercent() +"\t"+ currentResult.getFamTrioNum() +"\t"+ currentResult.getMendErrNum()); } } if(this.arg_check && result != null){ OutputFile = new File (fileName + ".CHECK"); FileWriter saveCheckWriter = new FileWriter(OutputFile); saveCheckWriter.write("Name\tObsHET\tPredHET\tHWpval\t%Geno\tFamTrio\tMendErr\n"); for(int i=0;i<result.size();i++){ MarkerResult currentResult = (MarkerResult)result.get(i); saveCheckWriter.write( Chromosome.getMarker(i).getName() +"\t"+ currentResult.getObsHet() +"\t"+ currentResult.getPredHet() +"\t"+ currentResult.getHWpvalue() +"\t"+ currentResult.getGenoPercent() +"\t"+ currentResult.getFamTrioNum() +"\t"+ currentResult.getMendErrNum() +"\n"); } saveCheckWriter.close(); } Vector cust = new Vector(); if(outputType != -1){ textData.generateDPrimeTable(); Haplotype[][] haplos; switch(outputType){ case BLOX_GABRIEL: OutputFile = new File(fileName + ".GABRIELblocks"); break; case BLOX_4GAM: OutputFile = new File(fileName + ".4GAMblocks"); break; case BLOX_SPINE: OutputFile = new File(fileName + ".SPINEblocks"); break; case BLOX_CUSTOM: OutputFile = new File(fileName + ".CUSTblocks"); //read in the blocks file File blocksFile = new File(arg_blockfile); cust = textData.readBlocks(blocksFile); break; default: OutputFile = new File(fileName + ".GABRIELblocks"); break; } //this handles output type ALL int start = 0; int stop = Chromosome.getFilteredSize(); if(outputType == BLOX_ALL) { OutputFile = new File(fileName + ".GABRIELblocks"); textData.guessBlocks(BLOX_GABRIEL); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); OutputFile = new File(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); OutputFile = new File(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); }else{ textData.guessBlocks(outputType, cust); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); } } if(this.arg_dprime) { OutputFile = new File(fileName + ".DPRIME"); if (textData.filteredDPrimeTable != null){ textData.saveDprimeToText(OutputFile, TABLE_TYPE, 0, Chromosome.getFilteredSize()); }else{ textData.saveDprimeToText(OutputFile, LIVE_TYPE, 0, Chromosome.getFilteredSize()); } } //if(fileType){ //TDT.calcTrioTDT(textData.chromosomes); //TODO: Deal with this. why do we calc TDT? and make sure not to do it except when appropriate //} } catch(IOException e){ System.err.println("An error has occured. This probably has to do with file input or output"); } catch(HaploViewException e){ System.err.println(e.getMessage()); } catch(PedFileException pfe) { System.err.println(pfe.getMessage()); } } |
OutputFile = new File (fileName + ".CHECK"); FileWriter saveCheckWriter = new FileWriter(OutputFile); saveCheckWriter.write("Name\tObsHET\tPredHET\tHWpval\t%Geno\tFamTrio\tMendErr\n"); for(int i=0;i<result.size();i++){ MarkerResult currentResult = (MarkerResult)result.get(i); saveCheckWriter.write( Chromosome.getMarker(i).getName() +"\t"+ currentResult.getObsHet() +"\t"+ currentResult.getPredHet() +"\t"+ currentResult.getHWpvalue() +"\t"+ currentResult.getGenoPercent() +"\t"+ currentResult.getFamTrioNum() +"\t"+ currentResult.getMendErrNum() +"\n"); } saveCheckWriter.close(); | CheckDataPanel cp = new CheckDataPanel(textData); cp.printTable(new File (fileName + ".CHECK")); | private void processFile(String fileName,int fileType,String infoFileName){ System.out.println(TITLE_STRING); try { int outputType; long maxDistance; HaploData textData; File OutputFile; File inputFile; inputFile = new File(fileName); if(!inputFile.exists()){ System.out.println("input file: " + fileName + " does not exist"); System.exit(1); } maxDistance = this.arg_distance * 1000; outputType = this.arg_output; textData = new HaploData(0); Vector result = null; if(fileType == 0){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == 1) { //read in ped file /* if(this.arg_ignoreMarkers.size()>0) { for(int i=0;i<this.arg_ignoreMarkers.size();i++){ int index = Integer.parseInt((String)this.arg_ignoreMarkers.get(i)); if(index>0 && index<markerResultArray.length){ markerResultArray[index] = false; if(!this.arg_quiet) { System.out.println("Ignoring marker " + (index)); } } } }*/ result = textData.linkageToChrom(inputFile, 3, arg_skipCheck); }else{ //read in hapmapfile result = textData.linkageToChrom(inputFile,4,arg_skipCheck); } File infoFile; if(infoFileName.equals("")) { infoFile = null; }else{ infoFile = new File(infoFileName); } textData.prepareMarkerInput(infoFile,maxDistance,textData.getPedFile().getHMInfo()); if(!arg_quiet && infoFile != null){ System.out.println("Using marker file " + infoFile.getName()); } textData.infoKnown = true; if(this.arg_showCheck && result != null) { System.out.println("Data check results:\n" + "Name\tObsHET\tPredHET\tHWpval\t%Geno\tFamTrio\tMendErr"); for(int i=0;i<result.size();i++){ MarkerResult currentResult = (MarkerResult)result.get(i); System.out.println( Chromosome.getMarker(i).getName() +"\t"+ currentResult.getObsHet() +"\t"+ currentResult.getPredHet() +"\t"+ currentResult.getHWpvalue() +"\t"+ currentResult.getGenoPercent() +"\t"+ currentResult.getFamTrioNum() +"\t"+ currentResult.getMendErrNum()); } } if(this.arg_check && result != null){ OutputFile = new File (fileName + ".CHECK"); FileWriter saveCheckWriter = new FileWriter(OutputFile); saveCheckWriter.write("Name\tObsHET\tPredHET\tHWpval\t%Geno\tFamTrio\tMendErr\n"); for(int i=0;i<result.size();i++){ MarkerResult currentResult = (MarkerResult)result.get(i); saveCheckWriter.write( Chromosome.getMarker(i).getName() +"\t"+ currentResult.getObsHet() +"\t"+ currentResult.getPredHet() +"\t"+ currentResult.getHWpvalue() +"\t"+ currentResult.getGenoPercent() +"\t"+ currentResult.getFamTrioNum() +"\t"+ currentResult.getMendErrNum() +"\n"); } saveCheckWriter.close(); } Vector cust = new Vector(); if(outputType != -1){ textData.generateDPrimeTable(); Haplotype[][] haplos; switch(outputType){ case BLOX_GABRIEL: OutputFile = new File(fileName + ".GABRIELblocks"); break; case BLOX_4GAM: OutputFile = new File(fileName + ".4GAMblocks"); break; case BLOX_SPINE: OutputFile = new File(fileName + ".SPINEblocks"); break; case BLOX_CUSTOM: OutputFile = new File(fileName + ".CUSTblocks"); //read in the blocks file File blocksFile = new File(arg_blockfile); cust = textData.readBlocks(blocksFile); break; default: OutputFile = new File(fileName + ".GABRIELblocks"); break; } //this handles output type ALL int start = 0; int stop = Chromosome.getFilteredSize(); if(outputType == BLOX_ALL) { OutputFile = new File(fileName + ".GABRIELblocks"); textData.guessBlocks(BLOX_GABRIEL); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); OutputFile = new File(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); OutputFile = new File(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); }else{ textData.guessBlocks(outputType, cust); haplos = textData.generateHaplotypes(textData.blocks, 1); textData.saveHapsToText(orderHaps(haplos, textData), textData.getMultiDprime(), OutputFile); } } if(this.arg_dprime) { OutputFile = new File(fileName + ".DPRIME"); if (textData.filteredDPrimeTable != null){ textData.saveDprimeToText(OutputFile, TABLE_TYPE, 0, Chromosome.getFilteredSize()); }else{ textData.saveDprimeToText(OutputFile, LIVE_TYPE, 0, Chromosome.getFilteredSize()); } } //if(fileType){ //TDT.calcTrioTDT(textData.chromosomes); //TODO: Deal with this. why do we calc TDT? and make sure not to do it except when appropriate //} } catch(IOException e){ System.err.println("An error has occured. This probably has to do with file input or output"); } catch(HaploViewException e){ System.err.println(e.getMessage()); } catch(PedFileException pfe) { System.err.println(pfe.getMessage()); } } |
db.open( "repository.xml", Database.OPEN_READ_WRITE ); | db.open( "pv_test#" + user + "#" + passwd, Database.OPEN_READ_WRITE ); | public static Database getODMGDatabase() { if ( db == null ) { db = odmg.newDatabase(); try { db.open( "repository.xml", Database.OPEN_READ_WRITE ); } catch ( ODMGException e ) {// log.warn( "Could not open database: " + e.getMessage() ); db = null; } } return db; } |
log.error( "Could not open database: " + e.getMessage() ); | public static Database getODMGDatabase() { if ( db == null ) { db = odmg.newDatabase(); try { db.open( "repository.xml", Database.OPEN_READ_WRITE ); } catch ( ODMGException e ) {// log.warn( "Could not open database: " + e.getMessage() ); db = null; } } return db; } |
|
String volumeRoot = "c:\\temp\\photoVaultImageInstanceTest"; | public void setUp() { try { photo = PhotoInfo.retrievePhotoInfo( 1 ); } catch ( Exception e ) { fail( "Unable to retrieve PhotoInfo object" ); } String volumeRoot = "c:\\temp\\photoVaultImageInstanceTest"; volume = new Volume( "imageInstanceTest", volumeRoot ); } |
|
File testFile = new File( "c:\\java\\photovault\\testfiles\\test1.jpg" ); | File testFile = new File( testImgDir, "test1.jpg" ); | public void testImageInstanceCreate() { File testFile = new File( "c:\\java\\photovault\\testfiles\\test1.jpg" ); File instanceFile = volume.getFilingFname( testFile ); try { FileUtils.copyFile( testFile, instanceFile ); } catch ( IOException e ) { fail( e.getMessage() ); } ImageInstance f = ImageInstance.create( volume, instanceFile, photo ); assertNotNull( "Image instance is null", f ); assertMatchesDb( f ); f.delete(); } |
File testFile = new File( "c:\\java\\photovault\\testfiles\\test1.jpg" ); | File testFile = new File( testImgDir, "test1.jpg" ); | public void testImageInstanceDelete() { File testFile = new File( "c:\\java\\photovault\\testfiles\\test1.jpg" ); File instanceFile = volume.getFilingFname( testFile ); try { FileUtils.copyFile( testFile, instanceFile ); } catch ( IOException e ) { fail( e.getMessage() ); } ImageInstance f = ImageInstance.create( volume, instanceFile, photo ); assertNotNull( f ); f.delete(); Connection conn = ImageDb.getConnection(); try { Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery( "SELECT * FROM image_files WHERE dirname = \"c:\\java\\photovault\\testfiles\" AND fname = \"test1.jpg\"" ); if ( rs.next() ) { fail( "Found matching DB record after delete" ); } } catch ( SQLException e ) { fail( "DB error:; " + e.getMessage() ); } } |
ResultSet rs = stmt.executeQuery( "SELECT * FROM image_files WHERE dirname = \"c:\\java\\photovault\\testfiles\" AND fname = \"test1.jpg\"" ); | ResultSet rs = stmt.executeQuery( "SELECT * FROM image_instances WHERE dirname = \"" + testImgDir + "\" AND fname = \"test1.jpg\"" ); | public void testImageInstanceDelete() { File testFile = new File( "c:\\java\\photovault\\testfiles\\test1.jpg" ); File instanceFile = volume.getFilingFname( testFile ); try { FileUtils.copyFile( testFile, instanceFile ); } catch ( IOException e ) { fail( e.getMessage() ); } ImageInstance f = ImageInstance.create( volume, instanceFile, photo ); assertNotNull( f ); f.delete(); Connection conn = ImageDb.getConnection(); try { Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery( "SELECT * FROM image_files WHERE dirname = \"c:\\java\\photovault\\testfiles\" AND fname = \"test1.jpg\"" ); if ( rs.next() ) { fail( "Found matching DB record after delete" ); } } catch ( SQLException e ) { fail( "DB error:; " + e.getMessage() ); } } |
File testFile = new File( "c:\\java\\photovault\\testfiles\\test1.jpg" ); | File testFile = new File( testImgDir, "test1.jpg" ); | public void testImageInstanceUpdate() { File testFile = new File( "c:\\java\\photovault\\testfiles\\test1.jpg" ); File instanceFile = volume.getFilingFname( testFile ); try { FileUtils.copyFile( testFile, instanceFile ); } catch ( IOException e ) { fail( e.getMessage() ); } ImageInstance f = ImageInstance.create( volume, instanceFile, photo ); assertNotNull( "Image instance is null", f ); int width = f.getWidth(); int height = f.getHeight(); int hist = f.getInstanceType(); f.setHeight( height + 1 ); f.setWidth( width + 1 ); f.setInstanceType( ImageInstance.INSTANCE_TYPE_THUMBNAIL ); File imgFile = f.getImageFile(); assertMatchesDb( f ); // Reload the object from database and check that the modifications are OK try { f = ImageInstance.retrieve( volume, imgFile.getName() ); } catch ( PhotoNotFoundException e ) { fail( "Image file not found after update" ); } assertNotNull( "Image instance is null", f ); assertEquals( "Width not updated", f.getWidth(), width+1 ); assertEquals( "height not updated", f.getHeight(), height+1 ); assertEquals( "Instance type not updated", f.getInstanceType(), ImageInstance.INSTANCE_TYPE_THUMBNAIL ); File imgFile2 = f.getImageFile(); assertTrue( "Image file does not exist", imgFile2.exists() ); assertTrue( "Image file name not same after update", imgFile.equals( imgFile2 ) ); // Tidy up after execution f.delete(); } |
logger.debug("Glass pane is "+getGlassPane()); getGlassPane().setVisible(true); | logger.debug("Glass pane is "+getGlassPane()); | protected void init() throws ArchitectException { int accelMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); UserSettings us; // must be done right away, because a static // initializer in this class effects BeanUtils // behaviour which the XML Digester relies // upon heavily //TypeMap.getInstance(); contentPane = (JComponent)getContentPane(); try { ConfigFile cf = ConfigFile.getDefaultInstance(); us = cf.read(); architectSession.setUserSettings(us); sprefs = architectSession.getUserSettings().getSwingSettings(); } catch (IOException e) { throw new ArchitectException("prefs.read", e); } while (us.getPlDotIni() == null) { String message; String[] options = new String[] {"Browse", "Create"}; if (us.getPlDotIniPath() == null) { message = "location is not set"; } else if (new File(us.getPlDotIniPath()).isFile()) { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n could not be read"; } else { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n does not exist"; } int choice = JOptionPane.showOptionDialog(null, "The Architect keeps its list of database connections" + "\nin a file called PL.INI. Your PL.INI "+message+"." + "\n\nYou can browse for an existing PL.INI file on your system" + "\nor allow the Architect to create a new one in your home directory." + "\n\nHint: If you are a Power*Loader Suite user, you should browse for" + "\nan existing PL.INI in your Power*Loader installation directory.", "Missing PL.INI", 0, JOptionPane.INFORMATION_MESSAGE, null, options, null); File newPlIniFile; if (choice == 0) { JFileChooser fc = new JFileChooser(); fc.setFileFilter(ASUtils.INI_FILE_FILTER); fc.setDialogTitle("Locate your PL.INI file"); int fcChoice = fc.showOpenDialog(null); if (fcChoice == JFileChooser.APPROVE_OPTION) { newPlIniFile = fc.getSelectedFile(); } else { newPlIniFile = null; } } else { newPlIniFile = new File(System.getProperty("user.home"), "pl.ini"); } if (newPlIniFile != null) try { newPlIniFile.createNewFile(); us.setPlDotIniPath(newPlIniFile.getPath()); } catch (IOException e1) { logger.error("Caught IO exception while creating empty PL.INI at \"" +newPlIniFile.getPath()+"\"", e1); JOptionPane.showMessageDialog(null, "Failed to create file \""+newPlIniFile.getPath()+"\":\n"+e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } // Create actions aboutAction = new AboutAction(); newProjectAction = new AbstractAction("New Project", ASUtils.createJLFIcon("general/New","New Project",sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { if (promptForUnsavedModifications()) { try { closeProject(getProject()); setProject(new SwingUIProject("New Project")); logger.debug("Glass pane is "+getGlassPane()); getGlassPane().setVisible(true); } catch (Exception ex) { JOptionPane.showMessageDialog(ArchitectFrame.this, "Can't create new project: "+ex.getMessage()); logger.error("Got exception while creating new project", ex); } } } }; newProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "New"); newProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, accelMask)); openProjectAction = new OpenProjectAction(); saveProjectAction = new AbstractAction("Save Project", ASUtils.createJLFIcon("general/Save", "Save Project", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(false, true); } }; saveProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save"); saveProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, accelMask)); saveProjectAsAction = new AbstractAction("Save Project As...", ASUtils.createJLFIcon("general/SaveAs", "Save Project As...", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(true, true); } }; saveProjectAsAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save As"); prefAction = new PreferencesAction(); projectSettingsAction = new ProjectSettingsAction(); projectSettingsAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_COMMA, accelMask)); printAction = new PrintAction(); printAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_P, accelMask)); zoomInAction = new ZoomAction(ZOOM_STEP); zoomOutAction = new ZoomAction(ZOOM_STEP * -1.0); zoomNormalAction = new AbstractAction("Reset Zoom", ASUtils.createJLFIcon("general/Zoom", "Reset Zoom", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { playpen.setZoom(1.0); } }; zoomNormalAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Reset Zoom"); undoAction = new UndoAction(); redoAction = new RedoAction(); autoLayoutAction = new AutoLayoutAction(); autoLayout = new FruchtermanReingoldForceLayout(); autoLayoutAction.setLayout(autoLayout); exportDDLAction = new ExportDDLAction(); compareDMAction = new CompareDMAction(); exportPLTransAction = new ExportPLTransAction(); quickStartAction = new QuickStartAction(); deleteSelectedAction = new DeleteSelectedAction(); createIdentifyingRelationshipAction = new CreateRelationshipAction(true); createNonIdentifyingRelationshipAction = new CreateRelationshipAction(false); editRelationshipAction = new EditRelationshipAction(); createTableAction = new CreateTableAction(); editColumnAction = new EditColumnAction(); insertColumnAction = new InsertColumnAction(); editTableAction = new EditTableAction(); searchReplaceAction = new SearchReplaceAction(); searchReplaceAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F, accelMask)); menuBar = new JMenuBar(); //Settingup JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic('f'); fileMenu.add(new JMenuItem(newProjectAction)); fileMenu.add(new JMenuItem(openProjectAction)); fileMenu.add(new JMenuItem(saveProjectAction)); fileMenu.add(new JMenuItem(saveProjectAsAction)); fileMenu.add(new JMenuItem(printAction)); fileMenu.add(new JMenuItem(prefAction)); fileMenu.add(new JMenuItem(projectSettingsAction)); fileMenu.add(new JMenuItem(saveSettingsAction)); fileMenu.add(new JMenuItem(exitAction)); menuBar.add(fileMenu); JMenu editMenu = new JMenu("Edit"); editMenu.setMnemonic('e'); editMenu.add(undoAction); editMenu.add(redoAction); editMenu.addSeparator(); editMenu.add(new JMenuItem(searchReplaceAction)); menuBar.add(editMenu); // the connections menu is set up when a new project is created (because it depends on the current DBTree) connectionsMenu = new JMenu("Connections"); connectionsMenu.setMnemonic('c'); menuBar.add(connectionsMenu); JMenu etlMenu = new JMenu("ETL"); etlMenu.setMnemonic('l'); JMenu etlSubmenuOne = new JMenu("Power*Loader"); etlSubmenuOne.add(new JMenuItem(exportPLTransAction)); etlSubmenuOne.add(new JMenuItem("PL Transaction File Export")); etlSubmenuOne.add(new JMenuItem("Run Power*Loader")); etlSubmenuOne.add(new JMenuItem(quickStartAction)); etlMenu.add(etlSubmenuOne); menuBar.add(etlMenu); JMenu toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic('t'); toolsMenu.add(new JMenuItem(exportDDLAction)); toolsMenu.add(new JMenuItem(compareDMAction)); menuBar.add(toolsMenu); JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic('h'); helpMenu.add(new JMenuItem(aboutAction)); menuBar.add(helpMenu); setJMenuBar(menuBar); projectBar = new JToolBar(JToolBar.HORIZONTAL); ppBar = new JToolBar(JToolBar.VERTICAL); projectBar.add(newProjectAction); projectBar.add(openProjectAction); projectBar.add(saveProjectAction); projectBar.addSeparator(); projectBar.add(printAction); projectBar.addSeparator(); projectBar.add(undoAction); projectBar.add(redoAction); projectBar.addSeparator(); projectBar.add(exportDDLAction); projectBar.addSeparator(); projectBar.add(compareDMAction); projectBar.addSeparator(); projectBar.add(autoLayoutAction); JButton tempButton = null; // shared actions need to report where they are coming from ppBar.add(zoomInAction); ppBar.add(zoomOutAction); ppBar.add(zoomNormalAction); ppBar.addSeparator(); tempButton = ppBar.add(deleteSelectedAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(createTableAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(insertColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); tempButton = ppBar.add(editColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); ppBar.add(createNonIdentifyingRelationshipAction); ppBar.add(createIdentifyingRelationshipAction); tempButton = ppBar.add(editRelationshipAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); Container projectBarPane = getContentPane(); projectBarPane.setLayout(new BorderLayout()); projectBarPane.add(projectBar, BorderLayout.NORTH); JPanel cp = new JPanel(new BorderLayout()); cp.add(ppBar, BorderLayout.EAST); projectBarPane.add(cp, BorderLayout.CENTER); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); cp.add(splitPane, BorderLayout.CENTER); logger.debug("Added splitpane to content pane"); splitPane.setDividerLocation (sprefs.getInt(SwingUserSettings.DIVIDER_LOCATION, 150)); //dbTree.getPreferredSize().width)); Rectangle bounds = new Rectangle(); bounds.x = sprefs.getInt(SwingUserSettings.MAIN_FRAME_X, 40); bounds.y = sprefs.getInt(SwingUserSettings.MAIN_FRAME_Y, 40); bounds.width = sprefs.getInt(SwingUserSettings.MAIN_FRAME_WIDTH, 600); bounds.height = sprefs.getInt(SwingUserSettings.MAIN_FRAME_HEIGHT, 440); setBounds(bounds); addWindowListener(afWindowListener = new ArchitectFrameWindowListener()); setProject(new SwingUIProject("New Project")); } |
logger.debug("Glass pane is "+getGlassPane()); getGlassPane().setVisible(true); | logger.debug("Glass pane is "+getGlassPane()); | public void actionPerformed(ActionEvent e) { if (promptForUnsavedModifications()) { try { closeProject(getProject()); setProject(new SwingUIProject("New Project")); logger.debug("Glass pane is "+getGlassPane()); getGlassPane().setVisible(true); } catch (Exception ex) { JOptionPane.showMessageDialog(ArchitectFrame.this, "Can't create new project: "+ex.getMessage()); logger.error("Got exception while creating new project", ex); } } } |
PhotoCollectionChangeEvent e = new PhotoCollectionChangeEvent( f ); treeModel.photoCollectionChanged( e ); | public void addAllToFolder( PhotoFolder f ) { addedToFolders.add( f ); removedFromFolders.remove( f ); FolderNode fn = (FolderNode)nodeMapper.mapFolderToNode( f ); fn.addAllPhotos(); // Notify the tree model that representation of this node may // be changed // treeModel.nodeChanged( fn ); } |
|
PhotoCollectionChangeEvent e = new PhotoCollectionChangeEvent( f ); treeModel.photoCollectionChanged( e ); | public void removeAllFromFolder( PhotoFolder f ) { addedToFolders.remove( f ); removedFromFolders.add( f ); FolderNode fn = (FolderNode) nodeMapper.mapFolderToNode( f ); fn.removeAllPhotos(); // treeModel.nodeChanged(treeNode); } |
|
if (caller.dPrimeDisplay != null){ caller.dPrimeDisplay.setVisible(false); caller.dPrimeDisplay = null; } if (caller.hapDisplay != null){ caller.hapDisplay.setVisible(false); caller.hapDisplay = null; } | caller.clearDisplays(); | public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command.equals(RAW_DATA)){ load(PED); }else if (command.equals(PHASED_DATA)){ load(HAPS); }else if (command.equals(HAPMAP_DATA)){ load(HMP); }else if (command.equals(BROWSE_GENO)){ browse(GENO); }else if (command.equals(BROWSE_INFO)){ browse(INFO); }else if (command.equals("OK")){ HaploView caller = (HaploView)this.getParent(); if (doTDT.isSelected()){ if (trioButton.isSelected()){ Options.setAssocTest(ASSOC_TRIO); } else { Options.setAssocTest(ASSOC_CC); } }else{ Options.setAssocTest(ASSOC_NONE); } if (maxComparisonDistField.getText().equals("")){ Options.setMaxDistance(0); }else{ Options.setMaxDistance(Integer.parseInt(maxComparisonDistField.getText())); } String[] returnStrings = {genoFileField.getText(), infoFileField.getText()}; if (returnStrings[1].equals("")) returnStrings[1] = null; //if a dataset was previously loaded during this session, discard the display panes for it. if (caller.dPrimeDisplay != null){ caller.dPrimeDisplay.setVisible(false); caller.dPrimeDisplay = null; } if (caller.hapDisplay != null){ caller.hapDisplay.setVisible(false); caller.hapDisplay = null; } caller.readGenotypes(returnStrings, fileType); this.dispose(); }else if (command.equals("Cancel")){ this.dispose(); }else if (command.equals("tdt")){ if(this.doTDT.isSelected()){ trioButton.setEnabled(true); ccButton.setEnabled(true); }else{ trioButton.setEnabled(false); ccButton.setEnabled(false); } } } |
setPkConnectionPoint(ui.closestEdgePoint(true, getPkConnectionPoint())); | setPkConnectionPoint(((RelationshipUI) getUI()).closestEdgePoint(true, getPkConnectionPoint())); | public void componentResized(PlayPenComponentEvent e) { logger.debug("Component "+e.getPPComponent().getName()+" changed size"); if (e.getPPComponent() == pkTable) { setPkConnectionPoint(ui.closestEdgePoint(true, getPkConnectionPoint())); // true == PK } if (e.getPPComponent() == fkTable) { setFkConnectionPoint(ui.closestEdgePoint(false, getFkConnectionPoint())); // false == FK } } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.