bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; AssociationTestSet customAssocSet; 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_FILE){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED_FILE) { //read in ped file textData.linkageToChrom(inputFile, PED_FILE); 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 textData.linkageToChrom(inputFile,HMP_FILE); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (fileType != HAPS_FILE){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } HashSet whiteListedCustomMarkers = new HashSet(); if (customAssocTestsFileName != null){ customAssocSet = new AssociationTestSet(customAssocTestsFileName); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } Hashtable snpsByName = new Hashtable(); for(int i=0;i<Chromosome.getUnfilteredSize();i++) { SNP snp = Chromosome.getUnfilteredMarker(i); snpsByName.put(snp.getName(), snp); } if(forceIncludeTags != null) { for(int i=0;i<forceIncludeTags.size();i++) { if(snpsByName.containsKey(forceIncludeTags.get(i))) { whiteListedCustomMarkers.add(snpsByName.get(forceIncludeTags.get(i))); } } } textData.setWhiteList(whiteListedCustomMarkers); boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; Vector result = null; if (fileType != HAPS_FILE){ result = textData.getPedFile().getResults(); //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: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } for(int i=0;i<Chromosome.getUnfilteredSize();i++) { if(textData.isWhiteListed(Chromosome.getUnfilteredMarker(i))) { markerResults[i] = true; } } 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(); AssociationTestSet blockTestSet = null; 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); if(!quietMode) { System.out.println("Using custom blocks 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.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid Gabriel blocks."); } OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; }else if (!quietMode){ System.out.println("Skipping block output: no valid 4 Gamete blocks."); } OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid LD Spine blocks."); } }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid blocks."); } } 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{ if (haplos != null){ blockTestSet = new AssociationTestSet(haplos,null); blockTestSet.saveHapsToText(validateOutputFile(fileName + ".HAPASSOC")); }else if (!quietMode){ System.out.println("Skipping block association output: no valid blocks."); } } } } 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)); if(!quietMode) { System.out.println("Using analysis track file " + trackFileName); } } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getUnfilteredSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getAbsolutePath()); }catch(JimiException je){ System.out.println(je.getMessage()); } } AssociationTestSet markerTestSet =null; if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC){ if (randomizeAffection){ Vector aff = new Vector(); int j=0, k=0; for (int i = 0; i < textData.getPedFile().getNumIndividuals(); i++){ if (i%2 == 0){ aff.add(new Integer(1)); j++; }else{ aff.add(new Integer(2)); k++; } } Collections.shuffle(aff); markerTestSet = new AssociationTestSet(textData.getPedFile(),aff,Chromosome.getAllMarkers()); }else{ markerTestSet = new AssociationTestSet(textData.getPedFile(),null,Chromosome.getAllMarkers()); } markerTestSet.saveSNPsToText(validateOutputFile(fileName + ".ASSOC")); } if(customAssocSet != null) { if(!quietMode) { System.out.println("Using custom association test file " + customAssocTestsFileName); } try { customAssocSet.setPermTests(doPermutationTest); customAssocSet.runFileTests(textData,markerTestSet.getMarkerAssociationResults()); customAssocSet.saveResultsToText(validateOutputFile(fileName + ".CUSTASSOC")); }catch(IOException ioe) { System.out.println("An error occured writing the custom association results file."); customAssocSet = null; } } if(doPermutationTest) { AssociationTestSet permTests = new AssociationTestSet(); permTests.cat(markerTestSet); if(blockTestSet != null) { permTests.cat(blockTestSet); } final PermutationTestSet pts = new PermutationTestSet(permutationCount,textData.getPedFile(),customAssocSet,permTests); Thread permThread = new Thread(new Runnable() { public void run() { if (pts.isCustom()){ pts.doPermutations(PermutationTestSet.CUSTOM); }else{ pts.doPermutations(PermutationTestSet.SINGLE_PLUS_BLOCKS); } } }); permThread.start(); if(!quietMode) { System.out.println("Starting " + permutationCount + " permutation tests (each . printed represents 1% of tests completed)"); } int dotsPrinted =0; while(pts.getPermutationCount() - pts.getPermutationsPerformed() > 0) { while(( (double)pts.getPermutationsPerformed() / pts.getPermutationCount())*100 > dotsPrinted) { System.out.print("."); dotsPrinted++; } try{ Thread.sleep(100); }catch(InterruptedException ie) {} } System.out.println(); try { pts.writeResultsToFile(validateOutputFile(fileName + ".PERMUT")); } catch(IOException ioe) { System.out.println("An error occured while writing the permutation test results to file."); } } if(tagging != Tagger.NONE) { if(textData.dpTable == null) { textData.generateDPrimeTable(); } Vector snps = Chromosome.getAllMarkers(); HashSet names = new HashSet(); for (int i = 0; i < snps.size(); i++) { SNP snp = (SNP) snps.elementAt(i); names.add(snp.getName()); } HashSet filteredNames = new HashSet(); for(int i=0;i<Chromosome.getSize();i++) { filteredNames.add(Chromosome.getMarker(i).getName()); } Vector sitesToCapture = new Vector(); for(int i=0;i<Chromosome.getSize();i++) { sitesToCapture.add(Chromosome.getMarker(i)); } for (int i = 0; i < forceIncludeTags.size(); i++) { String s = (String) forceIncludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced included tags since I don't know about it."); } } for (int i = 0; i < forceExcludeTags.size(); i++) { String s = (String) forceExcludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced excluded tags since I don't know about it."); } } //chuck out filtered jazz from excludes, and nonexistent markers from both forceExcludeTags.retainAll(filteredNames); forceIncludeTags.retainAll(names); if(!quietMode) { System.out.println("Starting tagging."); } TaggerController tc = new TaggerController(textData,forceIncludeTags,forceExcludeTags,sitesToCapture, tagging,maxNumTags,findTags); tc.runTagger(); while(!tc.isTaggingCompleted()) { try { Thread.sleep(100); }catch(InterruptedException ie) {} } tc.saveResultsToFile(validateOutputFile(fileName + ".TAGS")); tc.dumpTests(validateOutputFile(fileName + ".TESTS")); } } 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()); } }
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; AssociationTestSet customAssocSet; 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_FILE){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED_FILE) { //read in ped file textData.linkageToChrom(inputFile, PED_FILE); 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 textData.linkageToChrom(inputFile,HMP_FILE); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (fileType != HAPS_FILE){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } HashSet whiteListedCustomMarkers = new HashSet(); if (customAssocTestsFileName != null){ customAssocSet = new AssociationTestSet(customAssocTestsFileName); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } Hashtable snpsByName = new Hashtable(); for(int i=0;i<Chromosome.getUnfilteredSize();i++) { SNP snp = Chromosome.getUnfilteredMarker(i); snpsByName.put(snp.getName(), snp); } if(forceIncludeTags != null) { for(int i=0;i<forceIncludeTags.size();i++) { if(snpsByName.containsKey(forceIncludeTags.get(i))) { whiteListedCustomMarkers.add(snpsByName.get(forceIncludeTags.get(i))); } } } textData.setWhiteList(whiteListedCustomMarkers); boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; Vector result = null; if (fileType != HAPS_FILE){ result = textData.getPedFile().getResults(); //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: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } for(int i=0;i<Chromosome.getUnfilteredSize();i++) { if(textData.isWhiteListed(Chromosome.getUnfilteredMarker(i))) { markerResults[i] = true; } } 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(); AssociationTestSet blockTestSet = null; 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); if(!quietMode) { System.out.println("Using custom blocks 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.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), outputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid Gabriel blocks."); } OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), outputFile);; }else if (!quietMode){ System.out.println("Skipping block output: no valid 4 Gamete blocks."); } OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), outputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid LD Spine blocks."); } }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), outputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid blocks."); } } 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{ if (haplos != null){ blockTestSet = new AssociationTestSet(haplos,null); blockTestSet.saveHapsToText(validateOutputFile(fileName + ".HAPASSOC")); }else if (!quietMode){ System.out.println("Skipping block association output: no valid blocks."); } } } } 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)); if(!quietMode) { System.out.println("Using analysis track file " + trackFileName); } } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getUnfilteredSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getAbsolutePath()); }catch(JimiException je){ System.out.println(je.getMessage()); } } AssociationTestSet markerTestSet =null; if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC){ if (randomizeAffection){ Vector aff = new Vector(); int j=0, k=0; for (int i = 0; i < textData.getPedFile().getNumIndividuals(); i++){ if (i%2 == 0){ aff.add(new Integer(1)); j++; }else{ aff.add(new Integer(2)); k++; } } Collections.shuffle(aff); markerTestSet = new AssociationTestSet(textData.getPedFile(),aff,Chromosome.getAllMarkers()); }else{ markerTestSet = new AssociationTestSet(textData.getPedFile(),null,Chromosome.getAllMarkers()); } markerTestSet.saveSNPsToText(validateOutputFile(fileName + ".ASSOC")); } if(customAssocSet != null) { if(!quietMode) { System.out.println("Using custom association test file " + customAssocTestsFileName); } try { customAssocSet.setPermTests(doPermutationTest); customAssocSet.runFileTests(textData,markerTestSet.getMarkerAssociationResults()); customAssocSet.saveResultsToText(validateOutputFile(fileName + ".CUSTASSOC")); }catch(IOException ioe) { System.out.println("An error occured writing the custom association results file."); customAssocSet = null; } } if(doPermutationTest) { AssociationTestSet permTests = new AssociationTestSet(); permTests.cat(markerTestSet); if(blockTestSet != null) { permTests.cat(blockTestSet); } final PermutationTestSet pts = new PermutationTestSet(permutationCount,textData.getPedFile(),customAssocSet,permTests); Thread permThread = new Thread(new Runnable() { public void run() { if (pts.isCustom()){ pts.doPermutations(PermutationTestSet.CUSTOM); }else{ pts.doPermutations(PermutationTestSet.SINGLE_PLUS_BLOCKS); } } }); permThread.start(); if(!quietMode) { System.out.println("Starting " + permutationCount + " permutation tests (each . printed represents 1% of tests completed)"); } int dotsPrinted =0; while(pts.getPermutationCount() - pts.getPermutationsPerformed() > 0) { while(( (double)pts.getPermutationsPerformed() / pts.getPermutationCount())*100 > dotsPrinted) { System.out.print("."); dotsPrinted++; } try{ Thread.sleep(100); }catch(InterruptedException ie) {} } System.out.println(); try { pts.writeResultsToFile(validateOutputFile(fileName + ".PERMUT")); } catch(IOException ioe) { System.out.println("An error occured while writing the permutation test results to file."); } } if(tagging != Tagger.NONE) { if(textData.dpTable == null) { textData.generateDPrimeTable(); } Vector snps = Chromosome.getAllMarkers(); HashSet names = new HashSet(); for (int i = 0; i < snps.size(); i++) { SNP snp = (SNP) snps.elementAt(i); names.add(snp.getName()); } HashSet filteredNames = new HashSet(); for(int i=0;i<Chromosome.getSize();i++) { filteredNames.add(Chromosome.getMarker(i).getName()); } Vector sitesToCapture = new Vector(); for(int i=0;i<Chromosome.getSize();i++) { sitesToCapture.add(Chromosome.getMarker(i)); } for (int i = 0; i < forceIncludeTags.size(); i++) { String s = (String) forceIncludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced included tags since I don't know about it."); } } for (int i = 0; i < forceExcludeTags.size(); i++) { String s = (String) forceExcludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced excluded tags since I don't know about it."); } } //chuck out filtered jazz from excludes, and nonexistent markers from both forceExcludeTags.retainAll(filteredNames); forceIncludeTags.retainAll(names); if(!quietMode) { System.out.println("Starting tagging."); } TaggerController tc = new TaggerController(textData,forceIncludeTags,forceExcludeTags,sitesToCapture, tagging,maxNumTags,findTags); tc.runTagger(); while(!tc.isTaggingCompleted()) { try { Thread.sleep(100); }catch(InterruptedException ie) {} } tc.saveResultsToFile(validateOutputFile(fileName + ".TAGS")); tc.dumpTests(validateOutputFile(fileName + ".TESTS")); } } 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()); } }
1,112,000
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; AssociationTestSet customAssocSet; 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_FILE){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED_FILE) { //read in ped file textData.linkageToChrom(inputFile, PED_FILE); 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 textData.linkageToChrom(inputFile,HMP_FILE); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (fileType != HAPS_FILE){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } HashSet whiteListedCustomMarkers = new HashSet(); if (customAssocTestsFileName != null){ customAssocSet = new AssociationTestSet(customAssocTestsFileName); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } Hashtable snpsByName = new Hashtable(); for(int i=0;i<Chromosome.getUnfilteredSize();i++) { SNP snp = Chromosome.getUnfilteredMarker(i); snpsByName.put(snp.getName(), snp); } if(forceIncludeTags != null) { for(int i=0;i<forceIncludeTags.size();i++) { if(snpsByName.containsKey(forceIncludeTags.get(i))) { whiteListedCustomMarkers.add(snpsByName.get(forceIncludeTags.get(i))); } } } textData.setWhiteList(whiteListedCustomMarkers); boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; Vector result = null; if (fileType != HAPS_FILE){ result = textData.getPedFile().getResults(); //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: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } for(int i=0;i<Chromosome.getUnfilteredSize();i++) { if(textData.isWhiteListed(Chromosome.getUnfilteredMarker(i))) { markerResults[i] = true; } } 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(); AssociationTestSet blockTestSet = null; 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); if(!quietMode) { System.out.println("Using custom blocks 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.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid Gabriel blocks."); } OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; }else if (!quietMode){ System.out.println("Skipping block output: no valid 4 Gamete blocks."); } OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid LD Spine blocks."); } }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid blocks."); } } 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{ if (haplos != null){ blockTestSet = new AssociationTestSet(haplos,null); blockTestSet.saveHapsToText(validateOutputFile(fileName + ".HAPASSOC")); }else if (!quietMode){ System.out.println("Skipping block association output: no valid blocks."); } } } } 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)); if(!quietMode) { System.out.println("Using analysis track file " + trackFileName); } } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getUnfilteredSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getAbsolutePath()); }catch(JimiException je){ System.out.println(je.getMessage()); } } AssociationTestSet markerTestSet =null; if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC){ if (randomizeAffection){ Vector aff = new Vector(); int j=0, k=0; for (int i = 0; i < textData.getPedFile().getNumIndividuals(); i++){ if (i%2 == 0){ aff.add(new Integer(1)); j++; }else{ aff.add(new Integer(2)); k++; } } Collections.shuffle(aff); markerTestSet = new AssociationTestSet(textData.getPedFile(),aff,Chromosome.getAllMarkers()); }else{ markerTestSet = new AssociationTestSet(textData.getPedFile(),null,Chromosome.getAllMarkers()); } markerTestSet.saveSNPsToText(validateOutputFile(fileName + ".ASSOC")); } if(customAssocSet != null) { if(!quietMode) { System.out.println("Using custom association test file " + customAssocTestsFileName); } try { customAssocSet.setPermTests(doPermutationTest); customAssocSet.runFileTests(textData,markerTestSet.getMarkerAssociationResults()); customAssocSet.saveResultsToText(validateOutputFile(fileName + ".CUSTASSOC")); }catch(IOException ioe) { System.out.println("An error occured writing the custom association results file."); customAssocSet = null; } } if(doPermutationTest) { AssociationTestSet permTests = new AssociationTestSet(); permTests.cat(markerTestSet); if(blockTestSet != null) { permTests.cat(blockTestSet); } final PermutationTestSet pts = new PermutationTestSet(permutationCount,textData.getPedFile(),customAssocSet,permTests); Thread permThread = new Thread(new Runnable() { public void run() { if (pts.isCustom()){ pts.doPermutations(PermutationTestSet.CUSTOM); }else{ pts.doPermutations(PermutationTestSet.SINGLE_PLUS_BLOCKS); } } }); permThread.start(); if(!quietMode) { System.out.println("Starting " + permutationCount + " permutation tests (each . printed represents 1% of tests completed)"); } int dotsPrinted =0; while(pts.getPermutationCount() - pts.getPermutationsPerformed() > 0) { while(( (double)pts.getPermutationsPerformed() / pts.getPermutationCount())*100 > dotsPrinted) { System.out.print("."); dotsPrinted++; } try{ Thread.sleep(100); }catch(InterruptedException ie) {} } System.out.println(); try { pts.writeResultsToFile(validateOutputFile(fileName + ".PERMUT")); } catch(IOException ioe) { System.out.println("An error occured while writing the permutation test results to file."); } } if(tagging != Tagger.NONE) { if(textData.dpTable == null) { textData.generateDPrimeTable(); } Vector snps = Chromosome.getAllMarkers(); HashSet names = new HashSet(); for (int i = 0; i < snps.size(); i++) { SNP snp = (SNP) snps.elementAt(i); names.add(snp.getName()); } HashSet filteredNames = new HashSet(); for(int i=0;i<Chromosome.getSize();i++) { filteredNames.add(Chromosome.getMarker(i).getName()); } Vector sitesToCapture = new Vector(); for(int i=0;i<Chromosome.getSize();i++) { sitesToCapture.add(Chromosome.getMarker(i)); } for (int i = 0; i < forceIncludeTags.size(); i++) { String s = (String) forceIncludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced included tags since I don't know about it."); } } for (int i = 0; i < forceExcludeTags.size(); i++) { String s = (String) forceExcludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced excluded tags since I don't know about it."); } } //chuck out filtered jazz from excludes, and nonexistent markers from both forceExcludeTags.retainAll(filteredNames); forceIncludeTags.retainAll(names); if(!quietMode) { System.out.println("Starting tagging."); } TaggerController tc = new TaggerController(textData,forceIncludeTags,forceExcludeTags,sitesToCapture, tagging,maxNumTags,findTags); tc.runTagger(); while(!tc.isTaggingCompleted()) { try { Thread.sleep(100); }catch(InterruptedException ie) {} } tc.saveResultsToFile(validateOutputFile(fileName + ".TAGS")); tc.dumpTests(validateOutputFile(fileName + ".TESTS")); } } 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()); } }
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; AssociationTestSet customAssocSet; 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_FILE){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED_FILE) { //read in ped file textData.linkageToChrom(inputFile, PED_FILE); 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 textData.linkageToChrom(inputFile,HMP_FILE); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (fileType != HAPS_FILE){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } HashSet whiteListedCustomMarkers = new HashSet(); if (customAssocTestsFileName != null){ customAssocSet = new AssociationTestSet(customAssocTestsFileName); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } Hashtable snpsByName = new Hashtable(); for(int i=0;i<Chromosome.getUnfilteredSize();i++) { SNP snp = Chromosome.getUnfilteredMarker(i); snpsByName.put(snp.getName(), snp); } if(forceIncludeTags != null) { for(int i=0;i<forceIncludeTags.size();i++) { if(snpsByName.containsKey(forceIncludeTags.get(i))) { whiteListedCustomMarkers.add(snpsByName.get(forceIncludeTags.get(i))); } } } textData.setWhiteList(whiteListedCustomMarkers); boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; Vector result = null; if (fileType != HAPS_FILE){ result = textData.getPedFile().getResults(); //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: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } for(int i=0;i<Chromosome.getUnfilteredSize();i++) { if(textData.isWhiteListed(Chromosome.getUnfilteredMarker(i))) { markerResults[i] = true; } } 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(); AssociationTestSet blockTestSet = null; 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); if(!quietMode) { System.out.println("Using custom blocks 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.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid Gabriel blocks."); } OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), outputFile);; }else if (!quietMode){ System.out.println("Skipping block output: no valid 4 Gamete blocks."); } OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid LD Spine blocks."); } }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid blocks."); } } 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{ if (haplos != null){ blockTestSet = new AssociationTestSet(haplos,null); blockTestSet.saveHapsToText(validateOutputFile(fileName + ".HAPASSOC")); }else if (!quietMode){ System.out.println("Skipping block association output: no valid blocks."); } } } } 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)); if(!quietMode) { System.out.println("Using analysis track file " + trackFileName); } } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getUnfilteredSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getAbsolutePath()); }catch(JimiException je){ System.out.println(je.getMessage()); } } AssociationTestSet markerTestSet =null; if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC){ if (randomizeAffection){ Vector aff = new Vector(); int j=0, k=0; for (int i = 0; i < textData.getPedFile().getNumIndividuals(); i++){ if (i%2 == 0){ aff.add(new Integer(1)); j++; }else{ aff.add(new Integer(2)); k++; } } Collections.shuffle(aff); markerTestSet = new AssociationTestSet(textData.getPedFile(),aff,Chromosome.getAllMarkers()); }else{ markerTestSet = new AssociationTestSet(textData.getPedFile(),null,Chromosome.getAllMarkers()); } markerTestSet.saveSNPsToText(validateOutputFile(fileName + ".ASSOC")); } if(customAssocSet != null) { if(!quietMode) { System.out.println("Using custom association test file " + customAssocTestsFileName); } try { customAssocSet.setPermTests(doPermutationTest); customAssocSet.runFileTests(textData,markerTestSet.getMarkerAssociationResults()); customAssocSet.saveResultsToText(validateOutputFile(fileName + ".CUSTASSOC")); }catch(IOException ioe) { System.out.println("An error occured writing the custom association results file."); customAssocSet = null; } } if(doPermutationTest) { AssociationTestSet permTests = new AssociationTestSet(); permTests.cat(markerTestSet); if(blockTestSet != null) { permTests.cat(blockTestSet); } final PermutationTestSet pts = new PermutationTestSet(permutationCount,textData.getPedFile(),customAssocSet,permTests); Thread permThread = new Thread(new Runnable() { public void run() { if (pts.isCustom()){ pts.doPermutations(PermutationTestSet.CUSTOM); }else{ pts.doPermutations(PermutationTestSet.SINGLE_PLUS_BLOCKS); } } }); permThread.start(); if(!quietMode) { System.out.println("Starting " + permutationCount + " permutation tests (each . printed represents 1% of tests completed)"); } int dotsPrinted =0; while(pts.getPermutationCount() - pts.getPermutationsPerformed() > 0) { while(( (double)pts.getPermutationsPerformed() / pts.getPermutationCount())*100 > dotsPrinted) { System.out.print("."); dotsPrinted++; } try{ Thread.sleep(100); }catch(InterruptedException ie) {} } System.out.println(); try { pts.writeResultsToFile(validateOutputFile(fileName + ".PERMUT")); } catch(IOException ioe) { System.out.println("An error occured while writing the permutation test results to file."); } } if(tagging != Tagger.NONE) { if(textData.dpTable == null) { textData.generateDPrimeTable(); } Vector snps = Chromosome.getAllMarkers(); HashSet names = new HashSet(); for (int i = 0; i < snps.size(); i++) { SNP snp = (SNP) snps.elementAt(i); names.add(snp.getName()); } HashSet filteredNames = new HashSet(); for(int i=0;i<Chromosome.getSize();i++) { filteredNames.add(Chromosome.getMarker(i).getName()); } Vector sitesToCapture = new Vector(); for(int i=0;i<Chromosome.getSize();i++) { sitesToCapture.add(Chromosome.getMarker(i)); } for (int i = 0; i < forceIncludeTags.size(); i++) { String s = (String) forceIncludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced included tags since I don't know about it."); } } for (int i = 0; i < forceExcludeTags.size(); i++) { String s = (String) forceExcludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced excluded tags since I don't know about it."); } } //chuck out filtered jazz from excludes, and nonexistent markers from both forceExcludeTags.retainAll(filteredNames); forceIncludeTags.retainAll(names); if(!quietMode) { System.out.println("Starting tagging."); } TaggerController tc = new TaggerController(textData,forceIncludeTags,forceExcludeTags,sitesToCapture, tagging,maxNumTags,findTags); tc.runTagger(); while(!tc.isTaggingCompleted()) { try { Thread.sleep(100); }catch(InterruptedException ie) {} } tc.saveResultsToFile(validateOutputFile(fileName + ".TAGS")); tc.dumpTests(validateOutputFile(fileName + ".TESTS")); } } 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()); } }
1,112,001
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; AssociationTestSet customAssocSet; 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_FILE){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED_FILE) { //read in ped file textData.linkageToChrom(inputFile, PED_FILE); 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 textData.linkageToChrom(inputFile,HMP_FILE); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (fileType != HAPS_FILE){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } HashSet whiteListedCustomMarkers = new HashSet(); if (customAssocTestsFileName != null){ customAssocSet = new AssociationTestSet(customAssocTestsFileName); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } Hashtable snpsByName = new Hashtable(); for(int i=0;i<Chromosome.getUnfilteredSize();i++) { SNP snp = Chromosome.getUnfilteredMarker(i); snpsByName.put(snp.getName(), snp); } if(forceIncludeTags != null) { for(int i=0;i<forceIncludeTags.size();i++) { if(snpsByName.containsKey(forceIncludeTags.get(i))) { whiteListedCustomMarkers.add(snpsByName.get(forceIncludeTags.get(i))); } } } textData.setWhiteList(whiteListedCustomMarkers); boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; Vector result = null; if (fileType != HAPS_FILE){ result = textData.getPedFile().getResults(); //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: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } for(int i=0;i<Chromosome.getUnfilteredSize();i++) { if(textData.isWhiteListed(Chromosome.getUnfilteredMarker(i))) { markerResults[i] = true; } } 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(); AssociationTestSet blockTestSet = null; 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); if(!quietMode) { System.out.println("Using custom blocks 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.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid Gabriel blocks."); } OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; }else if (!quietMode){ System.out.println("Skipping block output: no valid 4 Gamete blocks."); } OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid LD Spine blocks."); } }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid blocks."); } } 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{ if (haplos != null){ blockTestSet = new AssociationTestSet(haplos,null); blockTestSet.saveHapsToText(validateOutputFile(fileName + ".HAPASSOC")); }else if (!quietMode){ System.out.println("Skipping block association output: no valid blocks."); } } } } 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)); if(!quietMode) { System.out.println("Using analysis track file " + trackFileName); } } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getUnfilteredSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getAbsolutePath()); }catch(JimiException je){ System.out.println(je.getMessage()); } } AssociationTestSet markerTestSet =null; if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC){ if (randomizeAffection){ Vector aff = new Vector(); int j=0, k=0; for (int i = 0; i < textData.getPedFile().getNumIndividuals(); i++){ if (i%2 == 0){ aff.add(new Integer(1)); j++; }else{ aff.add(new Integer(2)); k++; } } Collections.shuffle(aff); markerTestSet = new AssociationTestSet(textData.getPedFile(),aff,Chromosome.getAllMarkers()); }else{ markerTestSet = new AssociationTestSet(textData.getPedFile(),null,Chromosome.getAllMarkers()); } markerTestSet.saveSNPsToText(validateOutputFile(fileName + ".ASSOC")); } if(customAssocSet != null) { if(!quietMode) { System.out.println("Using custom association test file " + customAssocTestsFileName); } try { customAssocSet.setPermTests(doPermutationTest); customAssocSet.runFileTests(textData,markerTestSet.getMarkerAssociationResults()); customAssocSet.saveResultsToText(validateOutputFile(fileName + ".CUSTASSOC")); }catch(IOException ioe) { System.out.println("An error occured writing the custom association results file."); customAssocSet = null; } } if(doPermutationTest) { AssociationTestSet permTests = new AssociationTestSet(); permTests.cat(markerTestSet); if(blockTestSet != null) { permTests.cat(blockTestSet); } final PermutationTestSet pts = new PermutationTestSet(permutationCount,textData.getPedFile(),customAssocSet,permTests); Thread permThread = new Thread(new Runnable() { public void run() { if (pts.isCustom()){ pts.doPermutations(PermutationTestSet.CUSTOM); }else{ pts.doPermutations(PermutationTestSet.SINGLE_PLUS_BLOCKS); } } }); permThread.start(); if(!quietMode) { System.out.println("Starting " + permutationCount + " permutation tests (each . printed represents 1% of tests completed)"); } int dotsPrinted =0; while(pts.getPermutationCount() - pts.getPermutationsPerformed() > 0) { while(( (double)pts.getPermutationsPerformed() / pts.getPermutationCount())*100 > dotsPrinted) { System.out.print("."); dotsPrinted++; } try{ Thread.sleep(100); }catch(InterruptedException ie) {} } System.out.println(); try { pts.writeResultsToFile(validateOutputFile(fileName + ".PERMUT")); } catch(IOException ioe) { System.out.println("An error occured while writing the permutation test results to file."); } } if(tagging != Tagger.NONE) { if(textData.dpTable == null) { textData.generateDPrimeTable(); } Vector snps = Chromosome.getAllMarkers(); HashSet names = new HashSet(); for (int i = 0; i < snps.size(); i++) { SNP snp = (SNP) snps.elementAt(i); names.add(snp.getName()); } HashSet filteredNames = new HashSet(); for(int i=0;i<Chromosome.getSize();i++) { filteredNames.add(Chromosome.getMarker(i).getName()); } Vector sitesToCapture = new Vector(); for(int i=0;i<Chromosome.getSize();i++) { sitesToCapture.add(Chromosome.getMarker(i)); } for (int i = 0; i < forceIncludeTags.size(); i++) { String s = (String) forceIncludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced included tags since I don't know about it."); } } for (int i = 0; i < forceExcludeTags.size(); i++) { String s = (String) forceExcludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced excluded tags since I don't know about it."); } } //chuck out filtered jazz from excludes, and nonexistent markers from both forceExcludeTags.retainAll(filteredNames); forceIncludeTags.retainAll(names); if(!quietMode) { System.out.println("Starting tagging."); } TaggerController tc = new TaggerController(textData,forceIncludeTags,forceExcludeTags,sitesToCapture, tagging,maxNumTags,findTags); tc.runTagger(); while(!tc.isTaggingCompleted()) { try { Thread.sleep(100); }catch(InterruptedException ie) {} } tc.saveResultsToFile(validateOutputFile(fileName + ".TAGS")); tc.dumpTests(validateOutputFile(fileName + ".TESTS")); } } 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()); } }
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; AssociationTestSet customAssocSet; 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_FILE){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED_FILE) { //read in ped file textData.linkageToChrom(inputFile, PED_FILE); 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 textData.linkageToChrom(inputFile,HMP_FILE); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (fileType != HAPS_FILE){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } HashSet whiteListedCustomMarkers = new HashSet(); if (customAssocTestsFileName != null){ customAssocSet = new AssociationTestSet(customAssocTestsFileName); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } Hashtable snpsByName = new Hashtable(); for(int i=0;i<Chromosome.getUnfilteredSize();i++) { SNP snp = Chromosome.getUnfilteredMarker(i); snpsByName.put(snp.getName(), snp); } if(forceIncludeTags != null) { for(int i=0;i<forceIncludeTags.size();i++) { if(snpsByName.containsKey(forceIncludeTags.get(i))) { whiteListedCustomMarkers.add(snpsByName.get(forceIncludeTags.get(i))); } } } textData.setWhiteList(whiteListedCustomMarkers); boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; Vector result = null; if (fileType != HAPS_FILE){ result = textData.getPedFile().getResults(); //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: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } for(int i=0;i<Chromosome.getUnfilteredSize();i++) { if(textData.isWhiteListed(Chromosome.getUnfilteredMarker(i))) { markerResults[i] = true; } } 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(); AssociationTestSet blockTestSet = null; 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); if(!quietMode) { System.out.println("Using custom blocks 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.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid Gabriel blocks."); } OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; }else if (!quietMode){ System.out.println("Skipping block output: no valid 4 Gamete blocks."); } OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid LD Spine blocks."); } }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid blocks."); } } 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{ if (haplos != null){ blockTestSet = new AssociationTestSet(haplos,null); blockTestSet.saveHapsToText(validateOutputFile(fileName + ".HAPASSOC")); }else if (!quietMode){ System.out.println("Skipping block association output: no valid blocks."); } } } } 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)); if(!quietMode) { System.out.println("Using analysis track file " + trackFileName); } } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getUnfilteredSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getAbsolutePath()); }catch(JimiException je){ System.out.println(je.getMessage()); } } AssociationTestSet markerTestSet =null; if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC){ if (randomizeAffection){ Vector aff = new Vector(); int j=0, k=0; for (int i = 0; i < textData.getPedFile().getNumIndividuals(); i++){ if (i%2 == 0){ aff.add(new Integer(1)); j++; }else{ aff.add(new Integer(2)); k++; } } Collections.shuffle(aff); markerTestSet = new AssociationTestSet(textData.getPedFile(),aff,Chromosome.getAllMarkers()); }else{ markerTestSet = new AssociationTestSet(textData.getPedFile(),null,Chromosome.getAllMarkers()); } markerTestSet.saveSNPsToText(validateOutputFile(fileName + ".ASSOC")); } if(customAssocSet != null) { if(!quietMode) { System.out.println("Using custom association test file " + customAssocTestsFileName); } try { customAssocSet.setPermTests(doPermutationTest); customAssocSet.runFileTests(textData,markerTestSet.getMarkerAssociationResults()); customAssocSet.saveResultsToText(validateOutputFile(fileName + ".CUSTASSOC")); }catch(IOException ioe) { System.out.println("An error occured writing the custom association results file."); customAssocSet = null; } } if(doPermutationTest) { AssociationTestSet permTests = new AssociationTestSet(); permTests.cat(markerTestSet); if(blockTestSet != null) { permTests.cat(blockTestSet); } final PermutationTestSet pts = new PermutationTestSet(permutationCount,textData.getPedFile(),customAssocSet,permTests); Thread permThread = new Thread(new Runnable() { public void run() { if (pts.isCustom()){ pts.doPermutations(PermutationTestSet.CUSTOM); }else{ pts.doPermutations(PermutationTestSet.SINGLE_PLUS_BLOCKS); } } }); permThread.start(); if(!quietMode) { System.out.println("Starting " + permutationCount + " permutation tests (each . printed represents 1% of tests completed)"); } int dotsPrinted =0; while(pts.getPermutationCount() - pts.getPermutationsPerformed() > 0) { while(( (double)pts.getPermutationsPerformed() / pts.getPermutationCount())*100 > dotsPrinted) { System.out.print("."); dotsPrinted++; } try{ Thread.sleep(100); }catch(InterruptedException ie) {} } System.out.println(); try { pts.writeResultsToFile(validateOutputFile(fileName + ".PERMUT")); } catch(IOException ioe) { System.out.println("An error occured while writing the permutation test results to file."); } } if(tagging != Tagger.NONE) { if(textData.dpTable == null) { textData.generateDPrimeTable(); } Vector snps = Chromosome.getAllMarkers(); HashSet names = new HashSet(); for (int i = 0; i < snps.size(); i++) { SNP snp = (SNP) snps.elementAt(i); names.add(snp.getName()); } HashSet filteredNames = new HashSet(); for(int i=0;i<Chromosome.getSize();i++) { filteredNames.add(Chromosome.getMarker(i).getName()); } Vector sitesToCapture = new Vector(); for(int i=0;i<Chromosome.getSize();i++) { sitesToCapture.add(Chromosome.getMarker(i)); } for (int i = 0; i < forceIncludeTags.size(); i++) { String s = (String) forceIncludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced included tags since I don't know about it."); } } for (int i = 0; i < forceExcludeTags.size(); i++) { String s = (String) forceExcludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced excluded tags since I don't know about it."); } } //chuck out filtered jazz from excludes, and nonexistent markers from both forceExcludeTags.retainAll(filteredNames); forceIncludeTags.retainAll(names); if(!quietMode) { System.out.println("Starting tagging."); } TaggerController tc = new TaggerController(textData,forceIncludeTags,forceExcludeTags,sitesToCapture, tagging,maxNumTags,findTags); tc.runTagger(); while(!tc.isTaggingCompleted()) { try { Thread.sleep(100); }catch(InterruptedException ie) {} } tc.saveResultsToFile(validateOutputFile(fileName + ".TAGS")); tc.dumpTests(validateOutputFile(fileName + ".TESTS")); } } 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()); } }
1,112,002
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; AssociationTestSet customAssocSet; 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_FILE){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED_FILE) { //read in ped file textData.linkageToChrom(inputFile, PED_FILE); 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 textData.linkageToChrom(inputFile,HMP_FILE); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (fileType != HAPS_FILE){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } HashSet whiteListedCustomMarkers = new HashSet(); if (customAssocTestsFileName != null){ customAssocSet = new AssociationTestSet(customAssocTestsFileName); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } Hashtable snpsByName = new Hashtable(); for(int i=0;i<Chromosome.getUnfilteredSize();i++) { SNP snp = Chromosome.getUnfilteredMarker(i); snpsByName.put(snp.getName(), snp); } if(forceIncludeTags != null) { for(int i=0;i<forceIncludeTags.size();i++) { if(snpsByName.containsKey(forceIncludeTags.get(i))) { whiteListedCustomMarkers.add(snpsByName.get(forceIncludeTags.get(i))); } } } textData.setWhiteList(whiteListedCustomMarkers); boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; Vector result = null; if (fileType != HAPS_FILE){ result = textData.getPedFile().getResults(); //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: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } for(int i=0;i<Chromosome.getUnfilteredSize();i++) { if(textData.isWhiteListed(Chromosome.getUnfilteredMarker(i))) { markerResults[i] = true; } } 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(); AssociationTestSet blockTestSet = null; 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); if(!quietMode) { System.out.println("Using custom blocks 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.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid Gabriel blocks."); } OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; }else if (!quietMode){ System.out.println("Skipping block output: no valid 4 Gamete blocks."); } OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid LD Spine blocks."); } }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid blocks."); } } 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{ if (haplos != null){ blockTestSet = new AssociationTestSet(haplos,null); blockTestSet.saveHapsToText(validateOutputFile(fileName + ".HAPASSOC")); }else if (!quietMode){ System.out.println("Skipping block association output: no valid blocks."); } } } } 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)); if(!quietMode) { System.out.println("Using analysis track file " + trackFileName); } } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getUnfilteredSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getAbsolutePath()); }catch(JimiException je){ System.out.println(je.getMessage()); } } AssociationTestSet markerTestSet =null; if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC){ if (randomizeAffection){ Vector aff = new Vector(); int j=0, k=0; for (int i = 0; i < textData.getPedFile().getNumIndividuals(); i++){ if (i%2 == 0){ aff.add(new Integer(1)); j++; }else{ aff.add(new Integer(2)); k++; } } Collections.shuffle(aff); markerTestSet = new AssociationTestSet(textData.getPedFile(),aff,Chromosome.getAllMarkers()); }else{ markerTestSet = new AssociationTestSet(textData.getPedFile(),null,Chromosome.getAllMarkers()); } markerTestSet.saveSNPsToText(validateOutputFile(fileName + ".ASSOC")); } if(customAssocSet != null) { if(!quietMode) { System.out.println("Using custom association test file " + customAssocTestsFileName); } try { customAssocSet.setPermTests(doPermutationTest); customAssocSet.runFileTests(textData,markerTestSet.getMarkerAssociationResults()); customAssocSet.saveResultsToText(validateOutputFile(fileName + ".CUSTASSOC")); }catch(IOException ioe) { System.out.println("An error occured writing the custom association results file."); customAssocSet = null; } } if(doPermutationTest) { AssociationTestSet permTests = new AssociationTestSet(); permTests.cat(markerTestSet); if(blockTestSet != null) { permTests.cat(blockTestSet); } final PermutationTestSet pts = new PermutationTestSet(permutationCount,textData.getPedFile(),customAssocSet,permTests); Thread permThread = new Thread(new Runnable() { public void run() { if (pts.isCustom()){ pts.doPermutations(PermutationTestSet.CUSTOM); }else{ pts.doPermutations(PermutationTestSet.SINGLE_PLUS_BLOCKS); } } }); permThread.start(); if(!quietMode) { System.out.println("Starting " + permutationCount + " permutation tests (each . printed represents 1% of tests completed)"); } int dotsPrinted =0; while(pts.getPermutationCount() - pts.getPermutationsPerformed() > 0) { while(( (double)pts.getPermutationsPerformed() / pts.getPermutationCount())*100 > dotsPrinted) { System.out.print("."); dotsPrinted++; } try{ Thread.sleep(100); }catch(InterruptedException ie) {} } System.out.println(); try { pts.writeResultsToFile(validateOutputFile(fileName + ".PERMUT")); } catch(IOException ioe) { System.out.println("An error occured while writing the permutation test results to file."); } } if(tagging != Tagger.NONE) { if(textData.dpTable == null) { textData.generateDPrimeTable(); } Vector snps = Chromosome.getAllMarkers(); HashSet names = new HashSet(); for (int i = 0; i < snps.size(); i++) { SNP snp = (SNP) snps.elementAt(i); names.add(snp.getName()); } HashSet filteredNames = new HashSet(); for(int i=0;i<Chromosome.getSize();i++) { filteredNames.add(Chromosome.getMarker(i).getName()); } Vector sitesToCapture = new Vector(); for(int i=0;i<Chromosome.getSize();i++) { sitesToCapture.add(Chromosome.getMarker(i)); } for (int i = 0; i < forceIncludeTags.size(); i++) { String s = (String) forceIncludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced included tags since I don't know about it."); } } for (int i = 0; i < forceExcludeTags.size(); i++) { String s = (String) forceExcludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced excluded tags since I don't know about it."); } } //chuck out filtered jazz from excludes, and nonexistent markers from both forceExcludeTags.retainAll(filteredNames); forceIncludeTags.retainAll(names); if(!quietMode) { System.out.println("Starting tagging."); } TaggerController tc = new TaggerController(textData,forceIncludeTags,forceExcludeTags,sitesToCapture, tagging,maxNumTags,findTags); tc.runTagger(); while(!tc.isTaggingCompleted()) { try { Thread.sleep(100); }catch(InterruptedException ie) {} } tc.saveResultsToFile(validateOutputFile(fileName + ".TAGS")); tc.dumpTests(validateOutputFile(fileName + ".TESTS")); } } 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()); } }
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; AssociationTestSet customAssocSet; 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_FILE){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED_FILE) { //read in ped file textData.linkageToChrom(inputFile, PED_FILE); 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 textData.linkageToChrom(inputFile,HMP_FILE); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (fileType != HAPS_FILE){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } HashSet whiteListedCustomMarkers = new HashSet(); if (customAssocTestsFileName != null){ customAssocSet = new AssociationTestSet(customAssocTestsFileName); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } Hashtable snpsByName = new Hashtable(); for(int i=0;i<Chromosome.getUnfilteredSize();i++) { SNP snp = Chromosome.getUnfilteredMarker(i); snpsByName.put(snp.getName(), snp); } if(forceIncludeTags != null) { for(int i=0;i<forceIncludeTags.size();i++) { if(snpsByName.containsKey(forceIncludeTags.get(i))) { whiteListedCustomMarkers.add(snpsByName.get(forceIncludeTags.get(i))); } } } textData.setWhiteList(whiteListedCustomMarkers); boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; Vector result = null; if (fileType != HAPS_FILE){ result = textData.getPedFile().getResults(); //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: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } for(int i=0;i<Chromosome.getUnfilteredSize();i++) { if(textData.isWhiteListed(Chromosome.getUnfilteredMarker(i))) { markerResults[i] = true; } } 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(); AssociationTestSet blockTestSet = null; 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); if(!quietMode) { System.out.println("Using custom blocks 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.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid Gabriel blocks."); } OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; }else if (!quietMode){ System.out.println("Skipping block output: no valid 4 Gamete blocks."); } OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid LD Spine blocks."); } }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid blocks."); } } 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{ if (haplos != null){ blockTestSet = new AssociationTestSet(haplos,null); blockTestSet.saveHapsToText(validateOutputFile(fileName + ".HAPASSOC")); }else if (!quietMode){ System.out.println("Skipping block association output: no valid blocks."); } } } } 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)); if(!quietMode) { System.out.println("Using analysis track file " + trackFileName); } } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getUnfilteredSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getAbsolutePath()); }catch(JimiException je){ System.out.println(je.getMessage()); } } AssociationTestSet markerTestSet =null; if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC){ if (randomizeAffection){ Vector aff = new Vector(); int j=0, k=0; for (int i = 0; i < textData.getPedFile().getNumIndividuals(); i++){ if (i%2 == 0){ aff.add(new Integer(1)); j++; }else{ aff.add(new Integer(2)); k++; } } Collections.shuffle(aff); markerTestSet = new AssociationTestSet(textData.getPedFile(),aff,Chromosome.getAllMarkers()); }else{ markerTestSet = new AssociationTestSet(textData.getPedFile(),null,Chromosome.getAllMarkers()); } markerTestSet.saveSNPsToText(validateOutputFile(fileName + ".ASSOC")); } if(customAssocSet != null) { if(!quietMode) { System.out.println("Using custom association test file " + customAssocTestsFileName); } try { customAssocSet.setPermTests(doPermutationTest); customAssocSet.runFileTests(textData,markerTestSet.getMarkerAssociationResults()); customAssocSet.saveResultsToText(validateOutputFile(fileName + ".CUSTASSOC")); }catch(IOException ioe) { System.out.println("An error occured writing the custom association results file."); customAssocSet = null; } } if(doPermutationTest) { AssociationTestSet permTests = new AssociationTestSet(); permTests.cat(markerTestSet); if(blockTestSet != null) { permTests.cat(blockTestSet); } final PermutationTestSet pts = new PermutationTestSet(permutationCount,textData.getPedFile(),customAssocSet,permTests); Thread permThread = new Thread(new Runnable() { public void run() { if (pts.isCustom()){ pts.doPermutations(PermutationTestSet.CUSTOM); }else{ pts.doPermutations(PermutationTestSet.SINGLE_PLUS_BLOCKS); } } }); permThread.start(); if(!quietMode) { System.out.println("Starting " + permutationCount + " permutation tests (each . printed represents 1% of tests completed)"); } int dotsPrinted =0; while(pts.getPermutationCount() - pts.getPermutationsPerformed() > 0) { while(( (double)pts.getPermutationsPerformed() / pts.getPermutationCount())*100 > dotsPrinted) { System.out.print("."); dotsPrinted++; } try{ Thread.sleep(100); }catch(InterruptedException ie) {} } System.out.println(); try { pts.writeResultsToFile(validateOutputFile(fileName + ".PERMUT")); } catch(IOException ioe) { System.out.println("An error occured while writing the permutation test results to file."); } } if(tagging != Tagger.NONE) { if(textData.dpTable == null) { textData.generateDPrimeTable(); } Vector snps = Chromosome.getAllMarkers(); HashSet names = new HashSet(); for (int i = 0; i < snps.size(); i++) { SNP snp = (SNP) snps.elementAt(i); names.add(snp.getName()); } HashSet filteredNames = new HashSet(); for(int i=0;i<Chromosome.getSize();i++) { filteredNames.add(Chromosome.getMarker(i).getName()); } Vector sitesToCapture = new Vector(); for(int i=0;i<Chromosome.getSize();i++) { sitesToCapture.add(Chromosome.getMarker(i)); } for (int i = 0; i < forceIncludeTags.size(); i++) { String s = (String) forceIncludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced included tags since I don't know about it."); } } for (int i = 0; i < forceExcludeTags.size(); i++) { String s = (String) forceExcludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced excluded tags since I don't know about it."); } } //chuck out filtered jazz from excludes, and nonexistent markers from both forceExcludeTags.retainAll(filteredNames); forceIncludeTags.retainAll(names); if(!quietMode) { System.out.println("Starting tagging."); } TaggerController tc = new TaggerController(textData,forceIncludeTags,forceExcludeTags,sitesToCapture, tagging,maxNumTags,findTags); tc.runTagger(); while(!tc.isTaggingCompleted()) { try { Thread.sleep(100); }catch(InterruptedException ie) {} } tc.saveResultsToFile(validateOutputFile(fileName + ".TAGS")); tc.dumpTests(validateOutputFile(fileName + ".TESTS")); } } 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()); } }
1,112,003
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; AssociationTestSet customAssocSet; 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_FILE){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED_FILE) { //read in ped file textData.linkageToChrom(inputFile, PED_FILE); 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 textData.linkageToChrom(inputFile,HMP_FILE); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (fileType != HAPS_FILE){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } HashSet whiteListedCustomMarkers = new HashSet(); if (customAssocTestsFileName != null){ customAssocSet = new AssociationTestSet(customAssocTestsFileName); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } Hashtable snpsByName = new Hashtable(); for(int i=0;i<Chromosome.getUnfilteredSize();i++) { SNP snp = Chromosome.getUnfilteredMarker(i); snpsByName.put(snp.getName(), snp); } if(forceIncludeTags != null) { for(int i=0;i<forceIncludeTags.size();i++) { if(snpsByName.containsKey(forceIncludeTags.get(i))) { whiteListedCustomMarkers.add(snpsByName.get(forceIncludeTags.get(i))); } } } textData.setWhiteList(whiteListedCustomMarkers); boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; Vector result = null; if (fileType != HAPS_FILE){ result = textData.getPedFile().getResults(); //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: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } for(int i=0;i<Chromosome.getUnfilteredSize();i++) { if(textData.isWhiteListed(Chromosome.getUnfilteredMarker(i))) { markerResults[i] = true; } } 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(); AssociationTestSet blockTestSet = null; 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); if(!quietMode) { System.out.println("Using custom blocks 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.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid Gabriel blocks."); } OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; }else if (!quietMode){ System.out.println("Skipping block output: no valid 4 Gamete blocks."); } OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid LD Spine blocks."); } }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid blocks."); } } 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{ if (haplos != null){ blockTestSet = new AssociationTestSet(haplos,null); blockTestSet.saveHapsToText(validateOutputFile(fileName + ".HAPASSOC")); }else if (!quietMode){ System.out.println("Skipping block association output: no valid blocks."); } } } } 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)); if(!quietMode) { System.out.println("Using analysis track file " + trackFileName); } } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getUnfilteredSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getAbsolutePath()); }catch(JimiException je){ System.out.println(je.getMessage()); } } AssociationTestSet markerTestSet =null; if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC){ if (randomizeAffection){ Vector aff = new Vector(); int j=0, k=0; for (int i = 0; i < textData.getPedFile().getNumIndividuals(); i++){ if (i%2 == 0){ aff.add(new Integer(1)); j++; }else{ aff.add(new Integer(2)); k++; } } Collections.shuffle(aff); markerTestSet = new AssociationTestSet(textData.getPedFile(),aff,Chromosome.getAllMarkers()); }else{ markerTestSet = new AssociationTestSet(textData.getPedFile(),null,Chromosome.getAllMarkers()); } markerTestSet.saveSNPsToText(validateOutputFile(fileName + ".ASSOC")); } if(customAssocSet != null) { if(!quietMode) { System.out.println("Using custom association test file " + customAssocTestsFileName); } try { customAssocSet.setPermTests(doPermutationTest); customAssocSet.runFileTests(textData,markerTestSet.getMarkerAssociationResults()); customAssocSet.saveResultsToText(validateOutputFile(fileName + ".CUSTASSOC")); }catch(IOException ioe) { System.out.println("An error occured writing the custom association results file."); customAssocSet = null; } } if(doPermutationTest) { AssociationTestSet permTests = new AssociationTestSet(); permTests.cat(markerTestSet); if(blockTestSet != null) { permTests.cat(blockTestSet); } final PermutationTestSet pts = new PermutationTestSet(permutationCount,textData.getPedFile(),customAssocSet,permTests); Thread permThread = new Thread(new Runnable() { public void run() { if (pts.isCustom()){ pts.doPermutations(PermutationTestSet.CUSTOM); }else{ pts.doPermutations(PermutationTestSet.SINGLE_PLUS_BLOCKS); } } }); permThread.start(); if(!quietMode) { System.out.println("Starting " + permutationCount + " permutation tests (each . printed represents 1% of tests completed)"); } int dotsPrinted =0; while(pts.getPermutationCount() - pts.getPermutationsPerformed() > 0) { while(( (double)pts.getPermutationsPerformed() / pts.getPermutationCount())*100 > dotsPrinted) { System.out.print("."); dotsPrinted++; } try{ Thread.sleep(100); }catch(InterruptedException ie) {} } System.out.println(); try { pts.writeResultsToFile(validateOutputFile(fileName + ".PERMUT")); } catch(IOException ioe) { System.out.println("An error occured while writing the permutation test results to file."); } } if(tagging != Tagger.NONE) { if(textData.dpTable == null) { textData.generateDPrimeTable(); } Vector snps = Chromosome.getAllMarkers(); HashSet names = new HashSet(); for (int i = 0; i < snps.size(); i++) { SNP snp = (SNP) snps.elementAt(i); names.add(snp.getName()); } HashSet filteredNames = new HashSet(); for(int i=0;i<Chromosome.getSize();i++) { filteredNames.add(Chromosome.getMarker(i).getName()); } Vector sitesToCapture = new Vector(); for(int i=0;i<Chromosome.getSize();i++) { sitesToCapture.add(Chromosome.getMarker(i)); } for (int i = 0; i < forceIncludeTags.size(); i++) { String s = (String) forceIncludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced included tags since I don't know about it."); } } for (int i = 0; i < forceExcludeTags.size(); i++) { String s = (String) forceExcludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced excluded tags since I don't know about it."); } } //chuck out filtered jazz from excludes, and nonexistent markers from both forceExcludeTags.retainAll(filteredNames); forceIncludeTags.retainAll(names); if(!quietMode) { System.out.println("Starting tagging."); } TaggerController tc = new TaggerController(textData,forceIncludeTags,forceExcludeTags,sitesToCapture, tagging,maxNumTags,findTags); tc.runTagger(); while(!tc.isTaggingCompleted()) { try { Thread.sleep(100); }catch(InterruptedException ie) {} } tc.saveResultsToFile(validateOutputFile(fileName + ".TAGS")); tc.dumpTests(validateOutputFile(fileName + ".TESTS")); } } 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()); } }
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; AssociationTestSet customAssocSet; 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_FILE){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED_FILE) { //read in ped file textData.linkageToChrom(inputFile, PED_FILE); 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 textData.linkageToChrom(inputFile,HMP_FILE); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (fileType != HAPS_FILE){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } HashSet whiteListedCustomMarkers = new HashSet(); if (customAssocTestsFileName != null){ customAssocSet = new AssociationTestSet(customAssocTestsFileName); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } Hashtable snpsByName = new Hashtable(); for(int i=0;i<Chromosome.getUnfilteredSize();i++) { SNP snp = Chromosome.getUnfilteredMarker(i); snpsByName.put(snp.getName(), snp); } if(forceIncludeTags != null) { for(int i=0;i<forceIncludeTags.size();i++) { if(snpsByName.containsKey(forceIncludeTags.get(i))) { whiteListedCustomMarkers.add(snpsByName.get(forceIncludeTags.get(i))); } } } textData.setWhiteList(whiteListedCustomMarkers); boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; Vector result = null; if (fileType != HAPS_FILE){ result = textData.getPedFile().getResults(); //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: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } for(int i=0;i<Chromosome.getUnfilteredSize();i++) { if(textData.isWhiteListed(Chromosome.getUnfilteredMarker(i))) { markerResults[i] = true; } } 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(); AssociationTestSet blockTestSet = null; 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); if(!quietMode) { System.out.println("Using custom blocks 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.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid Gabriel blocks."); } OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; }else if (!quietMode){ System.out.println("Skipping block output: no valid 4 Gamete blocks."); } OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid LD Spine blocks."); } }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid blocks."); } } 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{ if (haplos != null){ blockTestSet = new AssociationTestSet(haplos,null); blockTestSet.saveHapsToText(validateOutputFile(fileName + ".HAPASSOC")); }else if (!quietMode){ System.out.println("Skipping block association output: no valid blocks."); } } } } 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)); if(!quietMode) { System.out.println("Using analysis track file " + trackFileName); } } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getUnfilteredSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getAbsolutePath()); }catch(JimiException je){ System.out.println(je.getMessage()); } } AssociationTestSet markerTestSet =null; if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC){ if (randomizeAffection){ Vector aff = new Vector(); int j=0, k=0; for (int i = 0; i < textData.getPedFile().getNumIndividuals(); i++){ if (i%2 == 0){ aff.add(new Integer(1)); j++; }else{ aff.add(new Integer(2)); k++; } } Collections.shuffle(aff); markerTestSet = new AssociationTestSet(textData.getPedFile(),aff,Chromosome.getAllMarkers()); }else{ markerTestSet = new AssociationTestSet(textData.getPedFile(),null,Chromosome.getAllMarkers()); } markerTestSet.saveSNPsToText(validateOutputFile(fileName + ".ASSOC")); } if(customAssocSet != null) { if(!quietMode) { System.out.println("Using custom association test file " + customAssocTestsFileName); } try { customAssocSet.setPermTests(doPermutationTest); customAssocSet.runFileTests(textData,markerTestSet.getMarkerAssociationResults()); customAssocSet.saveResultsToText(validateOutputFile(fileName + ".CUSTASSOC")); }catch(IOException ioe) { System.out.println("An error occured writing the custom association results file."); customAssocSet = null; } } if(doPermutationTest) { AssociationTestSet permTests = new AssociationTestSet(); permTests.cat(markerTestSet); if(blockTestSet != null) { permTests.cat(blockTestSet); } final PermutationTestSet pts = new PermutationTestSet(permutationCount,textData.getPedFile(),customAssocSet,permTests); Thread permThread = new Thread(new Runnable() { public void run() { if (pts.isCustom()){ pts.doPermutations(PermutationTestSet.CUSTOM); }else{ pts.doPermutations(PermutationTestSet.SINGLE_PLUS_BLOCKS); } } }); permThread.start(); if(!quietMode) { System.out.println("Starting " + permutationCount + " permutation tests (each . printed represents 1% of tests completed)"); } int dotsPrinted =0; while(pts.getPermutationCount() - pts.getPermutationsPerformed() > 0) { while(( (double)pts.getPermutationsPerformed() / pts.getPermutationCount())*100 > dotsPrinted) { System.out.print("."); dotsPrinted++; } try{ Thread.sleep(100); }catch(InterruptedException ie) {} } System.out.println(); try { pts.writeResultsToFile(validateOutputFile(fileName + ".PERMUT")); } catch(IOException ioe) { System.out.println("An error occured while writing the permutation test results to file."); } } if(tagging != Tagger.NONE) { if(textData.dpTable == null) { textData.generateDPrimeTable(); } Vector snps = Chromosome.getAllMarkers(); HashSet names = new HashSet(); for (int i = 0; i < snps.size(); i++) { SNP snp = (SNP) snps.elementAt(i); names.add(snp.getName()); } HashSet filteredNames = new HashSet(); for(int i=0;i<Chromosome.getSize();i++) { filteredNames.add(Chromosome.getMarker(i).getName()); } Vector sitesToCapture = new Vector(); for(int i=0;i<Chromosome.getSize();i++) { sitesToCapture.add(Chromosome.getMarker(i)); } for (int i = 0; i < forceIncludeTags.size(); i++) { String s = (String) forceIncludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced included tags since I don't know about it."); } } for (int i = 0; i < forceExcludeTags.size(); i++) { String s = (String) forceExcludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced excluded tags since I don't know about it."); } } //chuck out filtered jazz from excludes, and nonexistent markers from both forceExcludeTags.retainAll(filteredNames); forceIncludeTags.retainAll(names); if(!quietMode) { System.out.println("Starting tagging."); } TaggerController tc = new TaggerController(textData,forceIncludeTags,forceExcludeTags,sitesToCapture, tagging,maxNumTags,findTags); tc.runTagger(); while(!tc.isTaggingCompleted()) { try { Thread.sleep(100); }catch(InterruptedException ie) {} } tc.saveResultsToFile(validateOutputFile(fileName + ".TAGS")); tc.dumpTests(validateOutputFile(fileName + ".TESTS")); } } 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()); } }
1,112,004
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; AssociationTestSet customAssocSet; 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_FILE){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED_FILE) { //read in ped file textData.linkageToChrom(inputFile, PED_FILE); 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 textData.linkageToChrom(inputFile,HMP_FILE); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (fileType != HAPS_FILE){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } HashSet whiteListedCustomMarkers = new HashSet(); if (customAssocTestsFileName != null){ customAssocSet = new AssociationTestSet(customAssocTestsFileName); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } Hashtable snpsByName = new Hashtable(); for(int i=0;i<Chromosome.getUnfilteredSize();i++) { SNP snp = Chromosome.getUnfilteredMarker(i); snpsByName.put(snp.getName(), snp); } if(forceIncludeTags != null) { for(int i=0;i<forceIncludeTags.size();i++) { if(snpsByName.containsKey(forceIncludeTags.get(i))) { whiteListedCustomMarkers.add(snpsByName.get(forceIncludeTags.get(i))); } } } textData.setWhiteList(whiteListedCustomMarkers); boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; Vector result = null; if (fileType != HAPS_FILE){ result = textData.getPedFile().getResults(); //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: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } for(int i=0;i<Chromosome.getUnfilteredSize();i++) { if(textData.isWhiteListed(Chromosome.getUnfilteredMarker(i))) { markerResults[i] = true; } } 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(); AssociationTestSet blockTestSet = null; 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); if(!quietMode) { System.out.println("Using custom blocks 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.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid Gabriel blocks."); } OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; }else if (!quietMode){ System.out.println("Skipping block output: no valid 4 Gamete blocks."); } OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid LD Spine blocks."); } }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid blocks."); } } 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{ if (haplos != null){ blockTestSet = new AssociationTestSet(haplos,null); blockTestSet.saveHapsToText(validateOutputFile(fileName + ".HAPASSOC")); }else if (!quietMode){ System.out.println("Skipping block association output: no valid blocks."); } } } } 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)); if(!quietMode) { System.out.println("Using analysis track file " + trackFileName); } } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getUnfilteredSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getAbsolutePath()); }catch(JimiException je){ System.out.println(je.getMessage()); } } AssociationTestSet markerTestSet =null; if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC){ if (randomizeAffection){ Vector aff = new Vector(); int j=0, k=0; for (int i = 0; i < textData.getPedFile().getNumIndividuals(); i++){ if (i%2 == 0){ aff.add(new Integer(1)); j++; }else{ aff.add(new Integer(2)); k++; } } Collections.shuffle(aff); markerTestSet = new AssociationTestSet(textData.getPedFile(),aff,Chromosome.getAllMarkers()); }else{ markerTestSet = new AssociationTestSet(textData.getPedFile(),null,Chromosome.getAllMarkers()); } markerTestSet.saveSNPsToText(validateOutputFile(fileName + ".ASSOC")); } if(customAssocSet != null) { if(!quietMode) { System.out.println("Using custom association test file " + customAssocTestsFileName); } try { customAssocSet.setPermTests(doPermutationTest); customAssocSet.runFileTests(textData,markerTestSet.getMarkerAssociationResults()); customAssocSet.saveResultsToText(validateOutputFile(fileName + ".CUSTASSOC")); }catch(IOException ioe) { System.out.println("An error occured writing the custom association results file."); customAssocSet = null; } } if(doPermutationTest) { AssociationTestSet permTests = new AssociationTestSet(); permTests.cat(markerTestSet); if(blockTestSet != null) { permTests.cat(blockTestSet); } final PermutationTestSet pts = new PermutationTestSet(permutationCount,textData.getPedFile(),customAssocSet,permTests); Thread permThread = new Thread(new Runnable() { public void run() { if (pts.isCustom()){ pts.doPermutations(PermutationTestSet.CUSTOM); }else{ pts.doPermutations(PermutationTestSet.SINGLE_PLUS_BLOCKS); } } }); permThread.start(); if(!quietMode) { System.out.println("Starting " + permutationCount + " permutation tests (each . printed represents 1% of tests completed)"); } int dotsPrinted =0; while(pts.getPermutationCount() - pts.getPermutationsPerformed() > 0) { while(( (double)pts.getPermutationsPerformed() / pts.getPermutationCount())*100 > dotsPrinted) { System.out.print("."); dotsPrinted++; } try{ Thread.sleep(100); }catch(InterruptedException ie) {} } System.out.println(); try { pts.writeResultsToFile(validateOutputFile(fileName + ".PERMUT")); } catch(IOException ioe) { System.out.println("An error occured while writing the permutation test results to file."); } } if(tagging != Tagger.NONE) { if(textData.dpTable == null) { textData.generateDPrimeTable(); } Vector snps = Chromosome.getAllMarkers(); HashSet names = new HashSet(); for (int i = 0; i < snps.size(); i++) { SNP snp = (SNP) snps.elementAt(i); names.add(snp.getName()); } HashSet filteredNames = new HashSet(); for(int i=0;i<Chromosome.getSize();i++) { filteredNames.add(Chromosome.getMarker(i).getName()); } Vector sitesToCapture = new Vector(); for(int i=0;i<Chromosome.getSize();i++) { sitesToCapture.add(Chromosome.getMarker(i)); } for (int i = 0; i < forceIncludeTags.size(); i++) { String s = (String) forceIncludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced included tags since I don't know about it."); } } for (int i = 0; i < forceExcludeTags.size(); i++) { String s = (String) forceExcludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced excluded tags since I don't know about it."); } } //chuck out filtered jazz from excludes, and nonexistent markers from both forceExcludeTags.retainAll(filteredNames); forceIncludeTags.retainAll(names); if(!quietMode) { System.out.println("Starting tagging."); } TaggerController tc = new TaggerController(textData,forceIncludeTags,forceExcludeTags,sitesToCapture, tagging,maxNumTags,findTags); tc.runTagger(); while(!tc.isTaggingCompleted()) { try { Thread.sleep(100); }catch(InterruptedException ie) {} } tc.saveResultsToFile(validateOutputFile(fileName + ".TAGS")); tc.dumpTests(validateOutputFile(fileName + ".TESTS")); } } 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()); } }
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; AssociationTestSet customAssocSet; 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_FILE){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED_FILE) { //read in ped file textData.linkageToChrom(inputFile, PED_FILE); 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 textData.linkageToChrom(inputFile,HMP_FILE); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (fileType != HAPS_FILE){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } HashSet whiteListedCustomMarkers = new HashSet(); if (customAssocTestsFileName != null){ customAssocSet = new AssociationTestSet(customAssocTestsFileName); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } Hashtable snpsByName = new Hashtable(); for(int i=0;i<Chromosome.getUnfilteredSize();i++) { SNP snp = Chromosome.getUnfilteredMarker(i); snpsByName.put(snp.getName(), snp); } if(forceIncludeTags != null) { for(int i=0;i<forceIncludeTags.size();i++) { if(snpsByName.containsKey(forceIncludeTags.get(i))) { whiteListedCustomMarkers.add(snpsByName.get(forceIncludeTags.get(i))); } } } textData.setWhiteList(whiteListedCustomMarkers); boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; Vector result = null; if (fileType != HAPS_FILE){ result = textData.getPedFile().getResults(); //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: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } for(int i=0;i<Chromosome.getUnfilteredSize();i++) { if(textData.isWhiteListed(Chromosome.getUnfilteredMarker(i))) { markerResults[i] = true; } } 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(); AssociationTestSet blockTestSet = null; 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); if(!quietMode) { System.out.println("Using custom blocks 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.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid Gabriel blocks."); } OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; }else if (!quietMode){ System.out.println("Skipping block output: no valid 4 Gamete blocks."); } OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid LD Spine blocks."); } }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid blocks."); } } 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{ if (haplos != null){ blockTestSet = new AssociationTestSet(haplos,null); blockTestSet.saveHapsToText(validateOutputFile(fileName + ".HAPASSOC")); }else if (!quietMode){ System.out.println("Skipping block association output: no valid blocks."); } } } } 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)); if(!quietMode) { System.out.println("Using analysis track file " + trackFileName); } } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getUnfilteredSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getAbsolutePath()); }catch(JimiException je){ System.out.println(je.getMessage()); } } AssociationTestSet markerTestSet =null; if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC){ if (randomizeAffection){ Vector aff = new Vector(); int j=0, k=0; for (int i = 0; i < textData.getPedFile().getNumIndividuals(); i++){ if (i%2 == 0){ aff.add(new Integer(1)); j++; }else{ aff.add(new Integer(2)); k++; } } Collections.shuffle(aff); markerTestSet = new AssociationTestSet(textData.getPedFile(),aff,Chromosome.getAllMarkers()); }else{ markerTestSet = new AssociationTestSet(textData.getPedFile(),null,Chromosome.getAllMarkers()); } markerTestSet.saveSNPsToText(validateOutputFile(fileName + ".ASSOC")); } if(customAssocSet != null) { if(!quietMode) { System.out.println("Using custom association test file " + customAssocTestsFileName); } try { customAssocSet.setPermTests(doPermutationTest); customAssocSet.runFileTests(textData,markerTestSet.getMarkerAssociationResults()); customAssocSet.saveResultsToText(validateOutputFile(fileName + ".CUSTASSOC")); }catch(IOException ioe) { System.out.println("An error occured writing the custom association results file."); customAssocSet = null; } } if(doPermutationTest) { AssociationTestSet permTests = new AssociationTestSet(); permTests.cat(markerTestSet); if(blockTestSet != null) { permTests.cat(blockTestSet); } final PermutationTestSet pts = new PermutationTestSet(permutationCount,textData.getPedFile(),customAssocSet,permTests); Thread permThread = new Thread(new Runnable() { public void run() { if (pts.isCustom()){ pts.doPermutations(PermutationTestSet.CUSTOM); }else{ pts.doPermutations(PermutationTestSet.SINGLE_PLUS_BLOCKS); } } }); permThread.start(); if(!quietMode) { System.out.println("Starting " + permutationCount + " permutation tests (each . printed represents 1% of tests completed)"); } int dotsPrinted =0; while(pts.getPermutationCount() - pts.getPermutationsPerformed() > 0) { while(( (double)pts.getPermutationsPerformed() / pts.getPermutationCount())*100 > dotsPrinted) { System.out.print("."); dotsPrinted++; } try{ Thread.sleep(100); }catch(InterruptedException ie) {} } System.out.println(); try { pts.writeResultsToFile(validateOutputFile(fileName + ".PERMUT")); } catch(IOException ioe) { System.out.println("An error occured while writing the permutation test results to file."); } } if(tagging != Tagger.NONE) { if(textData.dpTable == null) { textData.generateDPrimeTable(); } Vector snps = Chromosome.getAllMarkers(); HashSet names = new HashSet(); for (int i = 0; i < snps.size(); i++) { SNP snp = (SNP) snps.elementAt(i); names.add(snp.getName()); } HashSet filteredNames = new HashSet(); for(int i=0;i<Chromosome.getSize();i++) { filteredNames.add(Chromosome.getMarker(i).getName()); } Vector sitesToCapture = new Vector(); for(int i=0;i<Chromosome.getSize();i++) { sitesToCapture.add(Chromosome.getMarker(i)); } for (int i = 0; i < forceIncludeTags.size(); i++) { String s = (String) forceIncludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced included tags since I don't know about it."); } } for (int i = 0; i < forceExcludeTags.size(); i++) { String s = (String) forceExcludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced excluded tags since I don't know about it."); } } //chuck out filtered jazz from excludes, and nonexistent markers from both forceExcludeTags.retainAll(filteredNames); forceIncludeTags.retainAll(names); if(!quietMode) { System.out.println("Starting tagging."); } TaggerController tc = new TaggerController(textData,forceIncludeTags,forceExcludeTags,sitesToCapture, tagging,maxNumTags,findTags); tc.runTagger(); while(!tc.isTaggingCompleted()) { try { Thread.sleep(100); }catch(InterruptedException ie) {} } tc.saveResultsToFile(validateOutputFile(fileName + ".TAGS")); tc.dumpTests(validateOutputFile(fileName + ".TESTS")); } } 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()); } }
1,112,005
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; AssociationTestSet customAssocSet; 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_FILE){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED_FILE) { //read in ped file textData.linkageToChrom(inputFile, PED_FILE); 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 textData.linkageToChrom(inputFile,HMP_FILE); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (fileType != HAPS_FILE){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } HashSet whiteListedCustomMarkers = new HashSet(); if (customAssocTestsFileName != null){ customAssocSet = new AssociationTestSet(customAssocTestsFileName); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } Hashtable snpsByName = new Hashtable(); for(int i=0;i<Chromosome.getUnfilteredSize();i++) { SNP snp = Chromosome.getUnfilteredMarker(i); snpsByName.put(snp.getName(), snp); } if(forceIncludeTags != null) { for(int i=0;i<forceIncludeTags.size();i++) { if(snpsByName.containsKey(forceIncludeTags.get(i))) { whiteListedCustomMarkers.add(snpsByName.get(forceIncludeTags.get(i))); } } } textData.setWhiteList(whiteListedCustomMarkers); boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; Vector result = null; if (fileType != HAPS_FILE){ result = textData.getPedFile().getResults(); //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: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } for(int i=0;i<Chromosome.getUnfilteredSize();i++) { if(textData.isWhiteListed(Chromosome.getUnfilteredMarker(i))) { markerResults[i] = true; } } 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(); AssociationTestSet blockTestSet = null; 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); if(!quietMode) { System.out.println("Using custom blocks 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.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid Gabriel blocks."); } OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; }else if (!quietMode){ System.out.println("Skipping block output: no valid 4 Gamete blocks."); } OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid LD Spine blocks."); } }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid blocks."); } } 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{ if (haplos != null){ blockTestSet = new AssociationTestSet(haplos,null); blockTestSet.saveHapsToText(validateOutputFile(fileName + ".HAPASSOC")); }else if (!quietMode){ System.out.println("Skipping block association output: no valid blocks."); } } } } 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)); if(!quietMode) { System.out.println("Using analysis track file " + trackFileName); } } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getUnfilteredSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, OutputFile.getAbsolutePath()); }catch(JimiException je){ System.out.println(je.getMessage()); } } AssociationTestSet markerTestSet =null; if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC){ if (randomizeAffection){ Vector aff = new Vector(); int j=0, k=0; for (int i = 0; i < textData.getPedFile().getNumIndividuals(); i++){ if (i%2 == 0){ aff.add(new Integer(1)); j++; }else{ aff.add(new Integer(2)); k++; } } Collections.shuffle(aff); markerTestSet = new AssociationTestSet(textData.getPedFile(),aff,Chromosome.getAllMarkers()); }else{ markerTestSet = new AssociationTestSet(textData.getPedFile(),null,Chromosome.getAllMarkers()); } markerTestSet.saveSNPsToText(validateOutputFile(fileName + ".ASSOC")); } if(customAssocSet != null) { if(!quietMode) { System.out.println("Using custom association test file " + customAssocTestsFileName); } try { customAssocSet.setPermTests(doPermutationTest); customAssocSet.runFileTests(textData,markerTestSet.getMarkerAssociationResults()); customAssocSet.saveResultsToText(validateOutputFile(fileName + ".CUSTASSOC")); }catch(IOException ioe) { System.out.println("An error occured writing the custom association results file."); customAssocSet = null; } } if(doPermutationTest) { AssociationTestSet permTests = new AssociationTestSet(); permTests.cat(markerTestSet); if(blockTestSet != null) { permTests.cat(blockTestSet); } final PermutationTestSet pts = new PermutationTestSet(permutationCount,textData.getPedFile(),customAssocSet,permTests); Thread permThread = new Thread(new Runnable() { public void run() { if (pts.isCustom()){ pts.doPermutations(PermutationTestSet.CUSTOM); }else{ pts.doPermutations(PermutationTestSet.SINGLE_PLUS_BLOCKS); } } }); permThread.start(); if(!quietMode) { System.out.println("Starting " + permutationCount + " permutation tests (each . printed represents 1% of tests completed)"); } int dotsPrinted =0; while(pts.getPermutationCount() - pts.getPermutationsPerformed() > 0) { while(( (double)pts.getPermutationsPerformed() / pts.getPermutationCount())*100 > dotsPrinted) { System.out.print("."); dotsPrinted++; } try{ Thread.sleep(100); }catch(InterruptedException ie) {} } System.out.println(); try { pts.writeResultsToFile(validateOutputFile(fileName + ".PERMUT")); } catch(IOException ioe) { System.out.println("An error occured while writing the permutation test results to file."); } } if(tagging != Tagger.NONE) { if(textData.dpTable == null) { textData.generateDPrimeTable(); } Vector snps = Chromosome.getAllMarkers(); HashSet names = new HashSet(); for (int i = 0; i < snps.size(); i++) { SNP snp = (SNP) snps.elementAt(i); names.add(snp.getName()); } HashSet filteredNames = new HashSet(); for(int i=0;i<Chromosome.getSize();i++) { filteredNames.add(Chromosome.getMarker(i).getName()); } Vector sitesToCapture = new Vector(); for(int i=0;i<Chromosome.getSize();i++) { sitesToCapture.add(Chromosome.getMarker(i)); } for (int i = 0; i < forceIncludeTags.size(); i++) { String s = (String) forceIncludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced included tags since I don't know about it."); } } for (int i = 0; i < forceExcludeTags.size(); i++) { String s = (String) forceExcludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced excluded tags since I don't know about it."); } } //chuck out filtered jazz from excludes, and nonexistent markers from both forceExcludeTags.retainAll(filteredNames); forceIncludeTags.retainAll(names); if(!quietMode) { System.out.println("Starting tagging."); } TaggerController tc = new TaggerController(textData,forceIncludeTags,forceExcludeTags,sitesToCapture, tagging,maxNumTags,findTags); tc.runTagger(); while(!tc.isTaggingCompleted()) { try { Thread.sleep(100); }catch(InterruptedException ie) {} } tc.saveResultsToFile(validateOutputFile(fileName + ".TAGS")); tc.dumpTests(validateOutputFile(fileName + ".TESTS")); } } 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()); } }
private void processFile(String fileName, int fileType, String infoFileName){ try { HaploData textData; File OutputFile; File inputFile; AssociationTestSet customAssocSet; 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_FILE){ //read in haps file textData.prepareHapsInput(inputFile); } else if (fileType == PED_FILE) { //read in ped file textData.linkageToChrom(inputFile, PED_FILE); 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 textData.linkageToChrom(inputFile,HMP_FILE); } File infoFile = null; if (infoFileName != null){ infoFile = new File(infoFileName); } if (fileType != HAPS_FILE){ textData.prepareMarkerInput(infoFile,textData.getPedFile().getHMInfo()); }else{ textData.prepareMarkerInput(infoFile,null); } HashSet whiteListedCustomMarkers = new HashSet(); if (customAssocTestsFileName != null){ customAssocSet = new AssociationTestSet(customAssocTestsFileName); whiteListedCustomMarkers = customAssocSet.getWhitelist(); }else{ customAssocSet = null; } Hashtable snpsByName = new Hashtable(); for(int i=0;i<Chromosome.getUnfilteredSize();i++) { SNP snp = Chromosome.getUnfilteredMarker(i); snpsByName.put(snp.getName(), snp); } if(forceIncludeTags != null) { for(int i=0;i<forceIncludeTags.size();i++) { if(snpsByName.containsKey(forceIncludeTags.get(i))) { whiteListedCustomMarkers.add(snpsByName.get(forceIncludeTags.get(i))); } } } textData.setWhiteList(whiteListedCustomMarkers); boolean[] markerResults = new boolean[Chromosome.getUnfilteredSize()]; Vector result = null; if (fileType != HAPS_FILE){ result = textData.getPedFile().getResults(); //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: " + cur + "\nMarkers must be between 1 and N, where N is the total number of markers."); System.exit(1); }else{ markerResults[cur-1] = false; } } for(int i=0;i<Chromosome.getUnfilteredSize();i++) { if(textData.isWhiteListed(Chromosome.getUnfilteredMarker(i))) { markerResults[i] = true; } } 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(); AssociationTestSet blockTestSet = null; 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); if(!quietMode) { System.out.println("Using custom blocks 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.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid Gabriel blocks."); } OutputFile = validateOutputFile(fileName + ".4GAMblocks"); textData.guessBlocks(BLOX_4GAM); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile);; }else if (!quietMode){ System.out.println("Skipping block output: no valid 4 Gamete blocks."); } OutputFile = validateOutputFile(fileName + ".SPINEblocks"); textData.guessBlocks(BLOX_SPINE); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid LD Spine blocks."); } }else{ //guesses blocks based on output type determined above. textData.guessBlocks(blockOutputType, cust); haplos = textData.generateBlockHaplotypes(textData.blocks); if (haplos != null){ filtHaplos = filterHaplos(haplos); textData.pickTags(filtHaplos); textData.saveHapsToText(haplos, textData.computeMultiDprime(filtHaplos), OutputFile); }else if (!quietMode){ System.out.println("Skipping block output: no valid blocks."); } } 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{ if (haplos != null){ blockTestSet = new AssociationTestSet(haplos,null); blockTestSet.saveHapsToText(validateOutputFile(fileName + ".HAPASSOC")); }else if (!quietMode){ System.out.println("Skipping block association output: no valid blocks."); } } } } 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)); if(!quietMode) { System.out.println("Using analysis track file " + trackFileName); } } DPrimeDisplay dpd = new DPrimeDisplay(textData); BufferedImage i = dpd.export(0,Chromosome.getUnfilteredSize(),outputCompressedPNG); try{ Jimi.putImage("image/png", i, outputFile.getAbsolutePath()); }catch(JimiException je){ System.out.println(je.getMessage()); } } AssociationTestSet markerTestSet =null; if(Options.getAssocTest() == ASSOC_TRIO || Options.getAssocTest() == ASSOC_CC){ if (randomizeAffection){ Vector aff = new Vector(); int j=0, k=0; for (int i = 0; i < textData.getPedFile().getNumIndividuals(); i++){ if (i%2 == 0){ aff.add(new Integer(1)); j++; }else{ aff.add(new Integer(2)); k++; } } Collections.shuffle(aff); markerTestSet = new AssociationTestSet(textData.getPedFile(),aff,Chromosome.getAllMarkers()); }else{ markerTestSet = new AssociationTestSet(textData.getPedFile(),null,Chromosome.getAllMarkers()); } markerTestSet.saveSNPsToText(validateOutputFile(fileName + ".ASSOC")); } if(customAssocSet != null) { if(!quietMode) { System.out.println("Using custom association test file " + customAssocTestsFileName); } try { customAssocSet.setPermTests(doPermutationTest); customAssocSet.runFileTests(textData,markerTestSet.getMarkerAssociationResults()); customAssocSet.saveResultsToText(validateOutputFile(fileName + ".CUSTASSOC")); }catch(IOException ioe) { System.out.println("An error occured writing the custom association results file."); customAssocSet = null; } } if(doPermutationTest) { AssociationTestSet permTests = new AssociationTestSet(); permTests.cat(markerTestSet); if(blockTestSet != null) { permTests.cat(blockTestSet); } final PermutationTestSet pts = new PermutationTestSet(permutationCount,textData.getPedFile(),customAssocSet,permTests); Thread permThread = new Thread(new Runnable() { public void run() { if (pts.isCustom()){ pts.doPermutations(PermutationTestSet.CUSTOM); }else{ pts.doPermutations(PermutationTestSet.SINGLE_PLUS_BLOCKS); } } }); permThread.start(); if(!quietMode) { System.out.println("Starting " + permutationCount + " permutation tests (each . printed represents 1% of tests completed)"); } int dotsPrinted =0; while(pts.getPermutationCount() - pts.getPermutationsPerformed() > 0) { while(( (double)pts.getPermutationsPerformed() / pts.getPermutationCount())*100 > dotsPrinted) { System.out.print("."); dotsPrinted++; } try{ Thread.sleep(100); }catch(InterruptedException ie) {} } System.out.println(); try { pts.writeResultsToFile(validateOutputFile(fileName + ".PERMUT")); } catch(IOException ioe) { System.out.println("An error occured while writing the permutation test results to file."); } } if(tagging != Tagger.NONE) { if(textData.dpTable == null) { textData.generateDPrimeTable(); } Vector snps = Chromosome.getAllMarkers(); HashSet names = new HashSet(); for (int i = 0; i < snps.size(); i++) { SNP snp = (SNP) snps.elementAt(i); names.add(snp.getName()); } HashSet filteredNames = new HashSet(); for(int i=0;i<Chromosome.getSize();i++) { filteredNames.add(Chromosome.getMarker(i).getName()); } Vector sitesToCapture = new Vector(); for(int i=0;i<Chromosome.getSize();i++) { sitesToCapture.add(Chromosome.getMarker(i)); } for (int i = 0; i < forceIncludeTags.size(); i++) { String s = (String) forceIncludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced included tags since I don't know about it."); } } for (int i = 0; i < forceExcludeTags.size(); i++) { String s = (String) forceExcludeTags.elementAt(i); if(!names.contains(s) && !quietMode) { System.out.println("Warning: skipping marker " + s + " in the list of forced excluded tags since I don't know about it."); } } //chuck out filtered jazz from excludes, and nonexistent markers from both forceExcludeTags.retainAll(filteredNames); forceIncludeTags.retainAll(names); if(!quietMode) { System.out.println("Starting tagging."); } TaggerController tc = new TaggerController(textData,forceIncludeTags,forceExcludeTags,sitesToCapture, tagging,maxNumTags,findTags); tc.runTagger(); while(!tc.isTaggingCompleted()) { try { Thread.sleep(100); }catch(InterruptedException ie) {} } tc.saveResultsToFile(validateOutputFile(fileName + ".TAGS")); tc.dumpTests(validateOutputFile(fileName + ".TESTS")); } } 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()); } }
1,112,006
public void setUp() { String volumeRoot = "c:\\temp\\photoVaultVolumeTest"; volume = new Volume( "testVolume", volumeRoot ); extVol = new ExternalVolume( "extVolume", extvolRoot.getAbsolutePath() ); PhotovaultSettings settings = PhotovaultSettings.getSettings(); PVDatabase curDb = settings.getCurrentDatabase(); curDb.addVolume( extVol ); }
public void setUp() { String volumeRoot = "c:\\temp\\photoVaultVolumeTest"; volume = new Volume( "testVolume", volumeRoot ); extVol = new ExternalVolume( "extVolume", extvolRoot.getAbsolutePath() ); PhotovaultSettings settings = PhotovaultSettings.getSettings(); PVDatabase curDb = settings.getCurrentDatabase(); curDb.addVolume( extVol ); }
1,112,007
public PresentationObject getTopicsOverView(IWContext iwc){ Table T = new Table(); int row = 1; T.add(getTopicLink(-1,iwrb.getLocalizedString("new_topic","New topic")),1,row); row++; T.add(tf.format(iwrb.getLocalizedString("name","Name"),tf.HEADER),1,row); T.add(tf.format(iwrb.getLocalizedString("category","Category"),tf.HEADER),2,row); T.add(tf.format(iwrb.getLocalizedString("mail_server","Mail server"),tf.HEADER),3,row); T.add(tf.format(iwrb.getLocalizedString("subscribers","Subscribers"),tf.HEADER),4,row); T.add(tf.format(iwrb.getLocalizedString("welcome","Welcome"),tf.HEADER),5,row); row++; if(!topics.isEmpty()){ Iterator iter = topics.values().iterator(); EmailTopic topic; ICCategory category; EmailAccount account; EmailLetter welcome; Collection welcomes; Collection accounts; int emailCount; int topicID; while(iter.hasNext()){ topic = (EmailTopic) iter.next(); topicID = Integer.parseInt(topic.toString()); T.add(getTopicLink(topicID,topic.getName()),1,row); category = (ICCategory) categories.get(Integer.toString(topic.getCategoryId())); T.add(tf.format(category.getName()),2,row); accounts = MailFinder.getInstance().getTopicAccounts(topicID,MailProtocol.SMTP); if(accounts!=null && !accounts.isEmpty()){ account = (EmailAccount) accounts.iterator().next(); T.add(getAccountLink(topicID,Integer.parseInt( account.toString()),account.getHost()),3,row); } else{ T.add(getAccountLink(topicID,-1,"X"),3,row); } emailCount = MailFinder.getInstance().getListEmailsCount(topic.getListId()); T.add((getSubscribersLink(topicID,String.valueOf(emailCount))),4,row); welcomes = MailFinder.getInstance().getEmailLetters(topicID,MailLetter.TYPE_SUBSCRIPTION); if(welcomes!=null && !welcomes.isEmpty()){ welcome = (MailLetter) welcomes.iterator().next(); T.add(getWelcomeLetterLink(Integer.parseInt(welcome.toString()),topicID,welcome.getSubject()),5,row); //T.add(tf.format(welcome.getSubject()),5,row); } else{ T.add(getWelcomeLetterLink(-1,topicID,"X"),5,row); } row++; } } return T; }
public PresentationObject getTopicsOverView(IWContext iwc){ Table T = new Table(); int row = 1; T.add(getTopicLink(-1,iwrb.getLocalizedString("new_topic","New topic")),1,row); row++; T.add(tf.format(iwrb.getLocalizedString("name","Name"),tf.HEADER),1,row); T.add(tf.format(iwrb.getLocalizedString("category","Category"),tf.HEADER),2,row); T.add(tf.format(iwrb.getLocalizedString("mail_server","Mail server"),tf.HEADER),3,row); T.add(tf.format(iwrb.getLocalizedString("subscribers","Subscribers"),tf.HEADER),4,row); T.add(tf.format(iwrb.getLocalizedString("welcome","Welcome"),tf.HEADER),5,row); row++; if(!topics.isEmpty()){ Iterator iter = topics.values().iterator(); EmailTopic topic; ICCategory category; EmailAccount account; EmailLetter welcome; Collection welcomes; Collection accounts; int emailCount; int topicID; while(iter.hasNext()){ topic = (EmailTopic) iter.next(); topicID = topic.getIdentifier().intValue(); T.add(getTopicLink(topicID,topic.getName()),1,row); category = (ICCategory) categories.get(Integer.toString(topic.getCategoryId())); T.add(tf.format(category.getName()),2,row); accounts = MailFinder.getInstance().getTopicAccounts(topicID,MailProtocol.SMTP); if(accounts!=null && !accounts.isEmpty()){ account = (EmailAccount) accounts.iterator().next(); T.add(getAccountLink(topicID,Integer.parseInt( account.toString()),account.getHost()),3,row); } else{ T.add(getAccountLink(topicID,-1,"X"),3,row); } emailCount = MailFinder.getInstance().getListEmailsCount(topic.getListId()); T.add((getSubscribersLink(topicID,String.valueOf(emailCount))),4,row); welcomes = MailFinder.getInstance().getEmailLetters(topicID,MailLetter.TYPE_SUBSCRIPTION); if(welcomes!=null && !welcomes.isEmpty()){ welcome = (MailLetter) welcomes.iterator().next(); T.add(getWelcomeLetterLink(Integer.parseInt(welcome.toString()),topicID,welcome.getSubject()),5,row); //T.add(tf.format(welcome.getSubject()),5,row); } else{ T.add(getWelcomeLetterLink(-1,topicID,"X"),5,row); } row++; } } return T; }
1,112,008
private Query<S> applyFilterValues(FilterValues<S> values) { // FIXME: figure out how to transfer values directly to query. Query<S> query = mQuery; Filter<S> filter = query.getFilter(); // FIXME: this code can get confused if filter has constants. if (values != null && filter != null && query.getBlankParameterCount() != 0) { // FIXME: throws exception if not all values supplied query = query.withValues(values.getValuesFor(filter)); } return query; }
private Query<S> applyFilterValues(FilterValues<S> values) { // FIXME: figure out how to transfer values directly to query. Query<S> query = mQuery; Filter<S> filter = query.getFilter(); // FIXME: this code can get confused if filter has constants. if (values != null && filter != null && query.getBlankParameterCount() != 0) { // FIXME: throws exception if not all values supplied query = query.withValues(values.getSuppliedValuesFor(filter)); } return query; }
1,112,009
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command.equals(BROWSE_GENO)){ browse(GENO_FILE); }else if (command.equals(BROWSE_HAPS)){ browse(HAPS_FILE); }else if (command.equals(BROWSE_HMP)){ browse(HMP_FILE); }else if (command.equals(BROWSE_PHASE)){ browse(PHASED_FILE); }else if (command.equals(BROWSE_SAMPLE)){ browse(SAMPLE_FILE); }else if (command.equals(BROWSE_LEGEND)){ browse(LEGEND_FILE); }else if (command.equals(BROWSE_INFO)){ browse(INFO_FILE); }else if (command.equals(BROWSE_ASSOC)){ browse(ASSOC_FILE); }else if (command.equals(BROWSE_WGA)){ browse(PLINK_FILE); }else if (command.equals(BROWSE_MAP)){ browse(MAP_FILE); } else if (command.equals("OK")){ //workaround for dumb Swing can't requestFocus until shown bug //this one seems to throw a harmless exception in certain versions of the linux JRE try{ SwingUtilities.invokeLater( new Runnable(){ public void run() { pedFileField.requestFocus(); }}); }catch (RuntimeException re){ } int currTab = dataFormatPane.getSelectedIndex(); if (currTab == 0){ fileType = PED_FILE; }else if (currTab == 1){ fileType = HAPS_FILE; }else if (currTab == 2){ fileType = HMP_FILE; }else if (currTab == 3){ fileType = PHASED_FILE; }else if (currTab == 4){ fileType = PHASEDHMPDL_FILE; }else if (currTab == 5){ fileType = PLINK_FILE; } HaploView caller = (HaploView)this.getParent(); if(missingCutoffField.getText().equals("")) { Options.setMissingThreshold(1); } else { double missingThreshold = (double)(Integer.parseInt(missingCutoffField.getText())) / 100; if(missingThreshold > 1) { JOptionPane.showMessageDialog(caller, "Missing cutoff must be between 0 and 100", "Invalid value", JOptionPane.ERROR_MESSAGE); return; } Options.setMissingThreshold(missingThreshold); } if (doAssociation.isSelected() && fileType == PED_FILE){ if (trioButton.isSelected()){ Options.setAssocTest(ASSOC_TRIO); if(standardTDT.isSelected()){ Options.setTdtType(TDT_STD); }else if(parenTDT.isSelected()) { Options.setTdtType(TDT_PAREN); } } else { Options.setAssocTest(ASSOC_CC); } }else{ Options.setAssocTest(ASSOC_NONE); } if (xChrom.isSelected() && fileType == PED_FILE){ Chromosome.setDataChrom("chrx"); }else if (hapsXChrom.isSelected() && fileType == HAPS_FILE){ Chromosome.setDataChrom("chrx"); } else { Chromosome.setDataChrom("none"); } if (doGB.isSelected() && fileType == HMP_FILE){ Options.setShowGBrowse(true); }else{ Options.setShowGBrowse(false); } Options.setgBrowseLeft(0); Options.setgBrowseRight(0); if (maxComparisonDistField.getText().equals("")){ Options.setMaxDistance(0); }else{ Options.setMaxDistance(Integer.parseInt(maxComparisonDistField.getText())); } if (fileType == PHASED_FILE){ if (gZip.isSelected()){ Options.setGzip(true); }else{ Options.setGzip(false); } isDownloaded = false; if (phaseDoGB.isSelected()){ Options.setShowGBrowse(true); if (loadChromChooser.getSelectedIndex() == -1){ JOptionPane.showMessageDialog(caller, "HapMap Info Track download requires a chromosome.", "Invalid value", JOptionPane.ERROR_MESSAGE); return; } }else{ Options.setShowGBrowse(false); } if (loadChromChooser.getSelectedIndex() == -1){ chromChoice = ""; }else{ chromChoice = (String)loadChromChooser.getSelectedItem(); } } if (fileType == PHASEDHMPDL_FILE){ isDownloaded = true; if (downloadDoGB.isSelected()){ Options.setShowGBrowse(true); }else{ Options.setShowGBrowse(false); } if (chromChooser.getSelectedIndex() == -1){ JOptionPane.showMessageDialog(caller, "Please select a chromosome.", "Invalid value", JOptionPane.ERROR_MESSAGE); return; } if (chromStartField.getText().equals("")){ JOptionPane.showMessageDialog(caller, "Please enter a starting value.", "Invalid value", JOptionPane.ERROR_MESSAGE); return; } if (chromEndField.getText().equals("")){ JOptionPane.showMessageDialog(caller, "Please enter an ending value.", "Invalid value", JOptionPane.ERROR_MESSAGE); return; } if (Integer.parseInt(chromStartField.getText()) >= Integer.parseInt(chromEndField.getText())){ JOptionPane.showMessageDialog(caller, "End position must be larger then start position.", "Invalid value", JOptionPane.ERROR_MESSAGE); return; } chromChoice = (String)chromChooser.getSelectedItem(); popChoice = (String)popChooser.getSelectedItem(); } if (fileType == PLINK_FILE){ if (embeddedMap.isSelected()){ embed = "Y"; } } String[] returnStrings; if (fileType == HAPS_FILE){ returnStrings = new String[]{hapsFileField.getText(), hapsInfoField.getText(),null}; if (returnStrings[1].equals("")) returnStrings[1] = null; }else if (fileType == HMP_FILE){ returnStrings = new String[]{hmpFileField.getText(),null,null}; }else if (fileType == PHASED_FILE ){ returnStrings = new String[]{phaseFileField.getText(), phaseSampleField.getText(), phaseLegendField.getText(),"",chromChoice}; }else if (fileType == PHASEDHMPDL_FILE){ returnStrings = new String[]{"Chr" + chromChoice + ":" + popChoice + ":" + chromStartField.getText() + ".." + chromEndField.getText(), popChoice, chromStartField.getText(), chromEndField.getText(), chromChoice}; }else if (fileType == PLINK_FILE){ returnStrings = new String[]{plinkFileField.getText(), plinkMapField.getText(),embed}; } else{ returnStrings = new String[]{pedFileField.getText(), pedInfoField.getText(), testFileField.getText()}; if (returnStrings[1].equals("")) returnStrings[1] = null; if (returnStrings[2].equals("") || !doAssociation.isSelected()) returnStrings[2] = null; } //if a dataset was previously loaded during this session, discard the display panes for it. caller.clearDisplays(); caller.setPlinkData(null,null); this.dispose(); if (fileType != PLINK_FILE){ caller.readGenotypes(returnStrings, fileType, isDownloaded); }else{ caller.readWGA(returnStrings); } }else if (command.equals("Cancel")){ this.dispose(); }else if (command.equals("association")){ switchAssoc(doAssociation.isSelected()); }else if(command.equals("tdt")){ standardTDT.setEnabled(true); if (!xChrom.isSelected()){ parenTDT.setEnabled(true); } }else if(command.equals("ccButton")){ standardTDT.setEnabled(false); parenTDT.setEnabled(false); }else if (command.equals("xChrom")){ if (xChrom.isSelected()){ parenTDT.setEnabled(false); standardTDT.setSelected(true); }else if (standardTDT.isEnabled()){ parenTDT.setEnabled(true); } }else if (command.equals("Integrated Map Info")){ if (embeddedMap.isSelected()){ embeddedMap.setSelected(true); mapLabel.setEnabled(false); plinkMapField.setEnabled(false); browsePlinkMapButton.setEnabled(false); }else{ embeddedMap.setSelected(false); mapLabel.setEnabled(true); plinkMapField.setEnabled(true); browsePlinkMapButton.setEnabled(true); } }else if (command.equals("Proxy Settings")){ ProxyDialog pd = new ProxyDialog(this,"Proxy Settings"); pd.pack(); pd.setVisible(true); } }
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command.equals(BROWSE_GENO)){ browse(GENO_FILE); }else if (command.equals(BROWSE_HAPS)){ browse(HAPS_FILE); }else if (command.equals(BROWSE_HMP)){ browse(HMP_FILE); }else if (command.equals(BROWSE_PHASE)){ browse(PHASED_FILE); }else if (command.equals(BROWSE_SAMPLE)){ browse(SAMPLE_FILE); }else if (command.equals(BROWSE_LEGEND)){ browse(LEGEND_FILE); }else if (command.equals(BROWSE_INFO)){ browse(INFO_FILE); }else if (command.equals(BROWSE_ASSOC)){ browse(ASSOC_FILE); }else if (command.equals(BROWSE_WGA)){ browse(PLINK_FILE); }else if (command.equals(BROWSE_MAP)){ browse(MAP_FILE); } else if (command.equals("OK")){ //workaround for dumb Swing can't requestFocus until shown bug //this one seems to throw a harmless exception in certain versions of the linux JRE try{ SwingUtilities.invokeLater( new Runnable(){ public void run() { pedFileField.requestFocus(); }}); }catch (RuntimeException re){ } int currTab = dataFormatPane.getSelectedIndex(); if (currTab == 0){ fileType = PED_FILE; }else if (currTab == 1){ fileType = HAPS_FILE; }else if (currTab == 2){ fileType = HMP_FILE; }else if (currTab == 3){ fileType = PHASED_FILE; }else if (currTab == 4){ fileType = PHASEDHMPDL_FILE; }else if (currTab == 5){ fileType = PLINK_FILE; } HaploView caller = (HaploView)this.getParent(); if(missingCutoffField.getText().equals("")) { Options.setMissingThreshold(1); } else { double missingThreshold = (double)(Integer.parseInt(missingCutoffField.getText())) / 100; if(missingThreshold > 1) { JOptionPane.showMessageDialog(caller, "Missing cutoff must be between 0 and 100", "Invalid value", JOptionPane.ERROR_MESSAGE); return; } Options.setMissingThreshold(missingThreshold); } if (doAssociation.isSelected() && fileType == PED_FILE){ if (trioButton.isSelected()){ Options.setAssocTest(ASSOC_TRIO); if(standardTDT.isSelected()){ Options.setTdtType(TDT_STD); }else if(parenTDT.isSelected()) { Options.setTdtType(TDT_PAREN); } } else { Options.setAssocTest(ASSOC_CC); } }else{ Options.setAssocTest(ASSOC_NONE); } if (xChrom.isSelected() && fileType == PED_FILE){ Chromosome.setDataChrom("chrx"); }else if (hapsXChrom.isSelected() && fileType == HAPS_FILE){ Chromosome.setDataChrom("chrx"); } else { Chromosome.setDataChrom("none"); } if (doGB.isSelected() && fileType == HMP_FILE){ Options.setShowGBrowse(true); }else{ Options.setShowGBrowse(false); } Options.setgBrowseLeft(0); Options.setgBrowseRight(0); if (maxComparisonDistField.getText().equals("")){ Options.setMaxDistance(0); }else{ Options.setMaxDistance(Integer.parseInt(maxComparisonDistField.getText())); } if (fileType == PHASED_FILE){ if (gZip.isSelected()){ Options.setGzip(true); }else{ Options.setGzip(false); } isDownloaded = false; if (phaseDoGB.isSelected()){ Options.setShowGBrowse(true); if (loadChromChooser.getSelectedIndex() == -1){ JOptionPane.showMessageDialog(caller, "HapMap Info Track download requires a chromosome.", "Invalid value", JOptionPane.ERROR_MESSAGE); return; } }else{ Options.setShowGBrowse(false); } if (loadChromChooser.getSelectedIndex() == -1){ chromChoice = ""; }else{ chromChoice = (String)loadChromChooser.getSelectedItem(); } } if (fileType == PHASEDHMPDL_FILE){ isDownloaded = true; if (downloadDoGB.isSelected()){ Options.setShowGBrowse(true); }else{ Options.setShowGBrowse(false); } if (chromChooser.getSelectedIndex() == -1){ JOptionPane.showMessageDialog(caller, "Please select a chromosome.", "Invalid value", JOptionPane.ERROR_MESSAGE); return; } if (chromStartField.getText().equals("")){ JOptionPane.showMessageDialog(caller, "Please enter a starting value.", "Invalid value", JOptionPane.ERROR_MESSAGE); return; } if (chromEndField.getText().equals("")){ JOptionPane.showMessageDialog(caller, "Please enter an ending value.", "Invalid value", JOptionPane.ERROR_MESSAGE); return; } if (Integer.parseInt(chromStartField.getText()) >= Integer.parseInt(chromEndField.getText())){ JOptionPane.showMessageDialog(caller, "End position must be larger then start position.", "Invalid value", JOptionPane.ERROR_MESSAGE); return; } chromChoice = (String)chromChooser.getSelectedItem(); popChoice = (String)popChooser.getSelectedItem(); } if (fileType == PLINK_FILE){ if (embeddedMap.isSelected()){ embed = "Y"; } } String[] returnStrings; if (fileType == HAPS_FILE){ returnStrings = new String[]{hapsFileField.getText(), hapsInfoField.getText(),null}; if (returnStrings[1].equals("")) returnStrings[1] = null; }else if (fileType == HMP_FILE){ returnStrings = new String[]{hmpFileField.getText(),null,null}; }else if (fileType == PHASED_FILE ){ returnStrings = new String[]{phaseFileField.getText(), phaseSampleField.getText(), phaseLegendField.getText(),"",chromChoice}; }else if (fileType == PHASEDHMPDL_FILE){ returnStrings = new String[]{"Chr" + chromChoice + ":" + popChoice + ":" + chromStartField.getText() + ".." + chromEndField.getText(), popChoice, chromStartField.getText(), chromEndField.getText(), chromChoice}; }else if (fileType == PLINK_FILE){ returnStrings = new String[]{plinkFileField.getText(), plinkMapField.getText(),null,embed}; } else{ returnStrings = new String[]{pedFileField.getText(), pedInfoField.getText(), testFileField.getText()}; if (returnStrings[1].equals("")) returnStrings[1] = null; if (returnStrings[2].equals("") || !doAssociation.isSelected()) returnStrings[2] = null; } //if a dataset was previously loaded during this session, discard the display panes for it. caller.clearDisplays(); caller.setPlinkData(null,null); this.dispose(); if (fileType != PLINK_FILE){ caller.readGenotypes(returnStrings, fileType, isDownloaded); }else{ caller.readWGA(returnStrings); } }else if (command.equals("Cancel")){ this.dispose(); }else if (command.equals("association")){ switchAssoc(doAssociation.isSelected()); }else if(command.equals("tdt")){ standardTDT.setEnabled(true); if (!xChrom.isSelected()){ parenTDT.setEnabled(true); } }else if(command.equals("ccButton")){ standardTDT.setEnabled(false); parenTDT.setEnabled(false); }else if (command.equals("xChrom")){ if (xChrom.isSelected()){ parenTDT.setEnabled(false); standardTDT.setSelected(true); }else if (standardTDT.isEnabled()){ parenTDT.setEnabled(true); } }else if (command.equals("Integrated Map Info")){ if (embeddedMap.isSelected()){ embeddedMap.setSelected(true); mapLabel.setEnabled(false); plinkMapField.setEnabled(false); browsePlinkMapButton.setEnabled(false); }else{ embeddedMap.setSelected(false); mapLabel.setEnabled(true); plinkMapField.setEnabled(true); browsePlinkMapButton.setEnabled(true); } }else if (command.equals("Proxy Settings")){ ProxyDialog pd = new ProxyDialog(this,"Proxy Settings"); pd.pack(); pd.setVisible(true); } }
1,112,010
protected XMLParser getXMLParser() { XMLParser parser = (XMLParser) parserPool.get(); if (parser == null) { parser = createXMLParser(); parserPool.set(parser); } return parser; }
protected XMLParser getXMLParser() { XMLParser parser = (XMLParser) parserPool.get(); if (parser == null) { parser = createXMLParser(); parserPool.set(parser); } return parser; }
1,112,011
public void buildPage(String template, JellyContext ctx) { // try {// // Embedded embedded = new Embedded();// embedded.setOutputStream(new FileOutputStream("out.html"));// //embedded.setVariable("some-var","some-object");// // embedded.setScript("file:///anoncvs/jakarta-commons-sandbox/jelly/sample.jelly");// //or one can do.// //embedded.setScript(scriptAsInputStream);// // boolean bStatus=embedded.execute();// if(!bStatus) //if error// {// System.out.println(embedded.getErrorMsg());// }//// } catch (Exception e) {// e.printStackTrace();// } try { OutputStream output = new FileOutputStream("demopage.html"); JellyContext context = new JellyContext(); context.setVariable("name",nameField.getText()); context.setVariable("background",colorField.getText()); context.setVariable("url",urlField.getText()); Vector v = new Vector(); Enumeration enum= listModel.elements(); while (enum.hasMoreElements()) { v.add(enum.nextElement()); } context.setVariable("hobbies", v); XMLOutput xmlOutput = XMLOutput.createXMLOutput(output); context.runScript( resolveURL("src/test/org/apache/commons/jelly/demos/"+template), xmlOutput ); xmlOutput.flush(); System.out.println("Finished merging template"); } catch (Exception e) {
public void buildPage(String template, JellyContext ctx) { // try {// // Embedded embedded = new Embedded();// embedded.setOutputStream(new FileOutputStream("out.html"));// //embedded.setVariable("some-var","some-object");// // embedded.setScript("file:///anoncvs/jakarta-commons-sandbox/jelly/sample.jelly");// //or one can do.// //embedded.setScript(scriptAsInputStream);// // boolean bStatus=embedded.execute();// if(!bStatus) //if error// {// System.out.println(embedded.getErrorMsg());// }//// } catch (Exception e) {// e.printStackTrace();// } try { OutputStream output = new FileOutputStream("demopage.html"); JellyContext context = new JellyContext(); context.setVariable("name",nameField.getText()); context.setVariable("background",colorField.getText()); context.setVariable("url",urlField.getText()); Vector v = new Vector(); Enumeration enum= listModel.elements(); while (enum.hasMoreElements()) { v.add(enum.nextElement()); } context.setVariable("hobbies", v); XMLOutput xmlOutput = XMLOutput.createXMLOutput(output); context.runScript( resolveURL("src/test/org/apache/commons/jelly/demos/"+template), xmlOutput ); xmlOutput.flush(); System.out.println("Finished merging template"); } catch (Exception e) {
1,112,012
public TDTPanel(Vector chromosomes) { JTable table; TDT theTDT = new TDT(); Vector result = theTDT.calcTDT(chromosomes); Vector tableColumnNames = new Vector(); tableColumnNames.add("Name"); tableColumnNames.add("Chi Squared"); tableColumnNames.add("T/U Ratio"); tableColumnNames.add("p value"); Vector tableData = new Vector(); int numRes = Chromosome.getFilteredSize(); for (int i = 0; i < numRes; i++){ Vector tempVect = new Vector(); TDTResult currentResult = (TDTResult)result.get(Chromosome.realIndex[i]); tempVect.add(currentResult.getName()); tempVect.add(new Double(currentResult.getChiSq())); tempVect.add(currentResult.getTURatio()); tempVect.add(new Double(currentResult.getPValue())); tableData.add(tempVect.clone()); } table = new JTable(tableData,tableColumnNames); //table.setPreferredSize(new Dimension(200,200)); //for(int i=0;i<table.getColumnModel().getColumnCount();i++){ // table.getColumnModel().getColumn(i).setPreferredWidth(6); //} JScrollPane tableScroller = new JScrollPane(table); //tableScroller.getViewport().setPreferredSize(new Dimension(200, height)); add(tableScroller); }
public TDTPanel(Vector chromosomes) { JTable table; TDT theTDT = new TDT(); Vector result = theTDT.calcTDT(chromosomes); Vector tableColumnNames = new Vector(); tableColumnNames.add("Name"); tableColumnNames.add("Chi Squared"); tableColumnNames.add("T/U Ratio"); tableColumnNames.add("p value"); Vector tableData = new Vector(); int numRes = Chromosome.getFilteredSize(); for (int i = 0; i < numRes; i++){ Vector tempVect = new Vector(); TDTResult currentResult = (TDTResult)result.get(Chromosome.realIndex[i]); tempVect.add(currentResult.getName()); tempVect.add(new Double(currentResult.getChiSq())); tempVect.add(currentResult.getTURatio()); tempVect.add(new Double(currentResult.getPValue())); tableData.add(tempVect.clone()); } table = new JTable(tableData,tableColumnNames); //table.setPreferredSize(new Dimension(200,200)); //for(int i=0;i<table.getColumnModel().getColumnCount();i++){ // table.getColumnModel().getColumn(i).setPreferredWidth(6); //} JScrollPane tableScroller = new JScrollPane(table); //tableScroller.getViewport().setPreferredSize(new Dimension(200, height)); add(tableScroller); }
1,112,014
public TDTPanel(Vector chromosomes) { JTable table; TDT theTDT = new TDT(); Vector result = theTDT.calcTDT(chromosomes); Vector tableColumnNames = new Vector(); tableColumnNames.add("Name"); tableColumnNames.add("Chi Squared"); tableColumnNames.add("T/U Ratio"); tableColumnNames.add("p value"); Vector tableData = new Vector(); int numRes = Chromosome.getFilteredSize(); for (int i = 0; i < numRes; i++){ Vector tempVect = new Vector(); TDTResult currentResult = (TDTResult)result.get(Chromosome.realIndex[i]); tempVect.add(currentResult.getName()); tempVect.add(new Double(currentResult.getChiSq())); tempVect.add(currentResult.getTURatio()); tempVect.add(new Double(currentResult.getPValue())); tableData.add(tempVect.clone()); } table = new JTable(tableData,tableColumnNames); //table.setPreferredSize(new Dimension(200,200)); //for(int i=0;i<table.getColumnModel().getColumnCount();i++){ // table.getColumnModel().getColumn(i).setPreferredWidth(6); //} JScrollPane tableScroller = new JScrollPane(table); //tableScroller.getViewport().setPreferredSize(new Dimension(200, height)); add(tableScroller); }
public TDTPanel(Vector chromosomes) { JTable table; TDT theTDT = new TDT(); Vector result = theTDT.calcTDT(chromosomes); Vector tableColumnNames = new Vector(); tableColumnNames.add("Name"); tableColumnNames.add("Chi Squared"); tableColumnNames.add("T/U Ratio"); tableColumnNames.add("p value"); Vector tableData = new Vector(); int numRes = Chromosome.getFilteredSize(); for (int i = 0; i < numRes; i++){ Vector tempVect = new Vector(); TDTResult currentResult = (TDTResult)result.get(Chromosome.realIndex[i]); tempVect.add(currentResult.getName()); tempVect.add(new Double(currentResult.getChiSq())); tempVect.add(currentResult.getTURatio()); tempVect.add(new Double(currentResult.getPValue())); tableData.add(tempVect.clone()); } table = new JTable(tableData,tableColumnNames); //table.setPreferredSize(new Dimension(200,200)); //for(int i=0;i<table.getColumnModel().getColumnCount();i++){ // table.getColumnModel().getColumn(i).setPreferredWidth(6); //} JScrollPane tableScroller = new JScrollPane(table); //tableScroller.getViewport().setPreferredSize(new Dimension(200, height)); add(tableScroller); }
1,112,015
protected void createFolderPaneUI() { JPanel pane = new JPanel(); tabPane.addTab( "Folders", pane ); folderTreePane = new FolderTreePane( ctrl.getFolderController() ); pane.add( folderTreePane, BorderLayout.NORTH ); }
protected void createFolderPaneUI() { JPanel pane = new JPanel(); tabPane.addTab( "Folders", pane ); folderTreePane = new FolderTreePane( ctrl.getFolderController() ); pane.add( folderTreePane, BorderLayout.NORTH ); }
1,112,016
public SQLTable(SQLObject parent, String name, String remarks, String objectType, boolean startPopulated) throws ArchitectException { logger.debug("NEW TABLE "+name+"@"+hashCode()); this.parent = parent; setName(name); this.remarks = remarks; this.objectType = objectType; this.children = new ArrayList(); initFolders(startPopulated); }
public SQLTable(SQLObject parent, String name, String remarks, String objectType, boolean startPopulated) throws ArchitectException { logger.debug("NEW TABLE "+name+"@"+hashCode()); this.parent = parent; setName(name); this.remarks = remarks; this.objectType = objectType; this.children = new ArrayList(); initFolders(startPopulated); }
1,112,017
public HaplotypeDisplayController(HaplotypeDisplay parent){ this.parent = parent; setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); JPanel leftPanel = new JPanel(); leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.Y_AXIS)); JPanel rightPanel = new JPanel(); rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS)); JPanel hapPercentPanel = new JPanel(); hapPercentPanel.add(new JLabel("Examine haplotypes above ")); hapPercentPanel.add(minDisplayField = new NumberTextField(String.valueOf(parent.displayThresh), 3, false)); hapPercentPanel.add(new JLabel("%")); leftPanel.add(hapPercentPanel); JPanel thinPanel = new JPanel(); thinPanel.add(new JLabel("Connect with thin lines if > ")); thinPanel.add(minThinField = new NumberTextField(String.valueOf(parent.thinThresh), 3, false)); thinPanel.add(new JLabel("%")); leftPanel.add(thinPanel); JPanel thickPanel = new JPanel(); thickPanel.add(new JLabel("Connect with thick lines if > ")); thickPanel.add(minThickField = new NumberTextField(String.valueOf(parent.thickThresh), 3, false)); thickPanel.add(new JLabel("%")); leftPanel.add(thickPanel); //numericAlleles = new JCheckBox("Display alleles as numbers."); //add(numericAlleles); JLabel dispLab = new JLabel("Display alleles as:"); rightPanel.add(dispLab); JRadioButton letBut = new JRadioButton("letters"); letBut.setActionCommand("0"); letBut.setSelected(true); rightPanel.add(letBut); JRadioButton numBut = new JRadioButton("numbers"); numBut.setActionCommand("1"); rightPanel.add(numBut); JRadioButton sqBut = new JRadioButton("colored squares"); sqBut.setActionCommand("2"); rightPanel.add(sqBut); alleleDisplayGroup = new ButtonGroup(); alleleDisplayGroup.add(letBut); alleleDisplayGroup.add(numBut); alleleDisplayGroup.add(sqBut); JPanel optionPanel = new JPanel(); optionPanel.add(leftPanel); optionPanel.add(rightPanel); add(optionPanel); goButton = new JButton("Go"); goButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { setDisplayThresh(Integer.parseInt(minDisplayField.getText())); setThinThresh(Integer.parseInt(minThinField.getText())); setThickThresh(Integer.parseInt(minThickField.getText())); setNumericAlls(alleleDisplayGroup.getSelection().getActionCommand()); paintIt(); } }); add(goButton); fieldSize = minDisplayField.getPreferredSize(); }
public HaplotypeDisplayController(HaplotypeDisplay parent){ this.parent = parent; setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); JPanel leftPanel = new JPanel(); leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.Y_AXIS)); JPanel rightPanel = new JPanel(); rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS)); JPanel hapPercentPanel = new JPanel(); hapPercentPanel.add(new JLabel("Examine haplotypes above ")); hapPercentPanel.add(minDisplayField = new NumberTextField(String.valueOf(Options.getHaplotypeDisplayThreshold()), 3, false)); hapPercentPanel.add(new JLabel("%")); leftPanel.add(hapPercentPanel); JPanel thinPanel = new JPanel(); thinPanel.add(new JLabel("Connect with thin lines if > ")); thinPanel.add(minThinField = new NumberTextField(String.valueOf(parent.thinThresh), 3, false)); thinPanel.add(new JLabel("%")); leftPanel.add(thinPanel); JPanel thickPanel = new JPanel(); thickPanel.add(new JLabel("Connect with thick lines if > ")); thickPanel.add(minThickField = new NumberTextField(String.valueOf(parent.thickThresh), 3, false)); thickPanel.add(new JLabel("%")); leftPanel.add(thickPanel); //numericAlleles = new JCheckBox("Display alleles as numbers."); //add(numericAlleles); JLabel dispLab = new JLabel("Display alleles as:"); rightPanel.add(dispLab); JRadioButton letBut = new JRadioButton("letters"); letBut.setActionCommand("0"); letBut.setSelected(true); rightPanel.add(letBut); JRadioButton numBut = new JRadioButton("numbers"); numBut.setActionCommand("1"); rightPanel.add(numBut); JRadioButton sqBut = new JRadioButton("colored squares"); sqBut.setActionCommand("2"); rightPanel.add(sqBut); alleleDisplayGroup = new ButtonGroup(); alleleDisplayGroup.add(letBut); alleleDisplayGroup.add(numBut); alleleDisplayGroup.add(sqBut); JPanel optionPanel = new JPanel(); optionPanel.add(leftPanel); optionPanel.add(rightPanel); add(optionPanel); goButton = new JButton("Go"); goButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { setDisplayThresh(Integer.parseInt(minDisplayField.getText())); setThinThresh(Integer.parseInt(minThinField.getText())); setThickThresh(Integer.parseInt(minThickField.getText())); setNumericAlls(alleleDisplayGroup.getSelection().getActionCommand()); paintIt(); } }); add(goButton); fieldSize = minDisplayField.getPreferredSize(); }
1,112,019
public void setDisplayThresh(int amount){ if (parent.displayThresh != amount){ parent.adjustDisplay(amount); } }
public void setDisplayThresh(int amount){ if (parent.displayThresh != amount){ parent.adjustDisplay(amount); } }
1,112,020
protected int countSourceTables(int count, SQLObject o) throws ArchitectException { if (o instanceof SQLTable) { return count + 1; } else { Iterator it = o.getChildren().iterator(); while (it.hasNext()) { count += countSourceTables(count, (SQLObject) it.next()); } } return count; }
protected int countSourceTables(SQLObject o) throws ArchitectException { if (o instanceof SQLTable) { return count + 1; } else { Iterator it = o.getChildren().iterator(); while (it.hasNext()) { count += countSourceTables(count, (SQLObject) it.next()); } } return count; }
1,112,021
protected int countSourceTables(int count, SQLObject o) throws ArchitectException { if (o instanceof SQLTable) { return count + 1; } else { Iterator it = o.getChildren().iterator(); while (it.hasNext()) { count += countSourceTables(count, (SQLObject) it.next()); } } return count; }
protected int countSourceTables(int count, SQLObject o) throws ArchitectException { if (o instanceof SQLTable) { return 1; } else if (o == playPen.getDatabase()) { return 0; } else { Iterator it = o.getChildren().iterator(); while (it.hasNext()) { count += countSourceTables(count, (SQLObject) it.next()); } } return count; }
1,112,022
protected int countSourceTables(int count, SQLObject o) throws ArchitectException { if (o instanceof SQLTable) { return count + 1; } else { Iterator it = o.getChildren().iterator(); while (it.hasNext()) { count += countSourceTables(count, (SQLObject) it.next()); } } return count; }
protected int countSourceTables(int count, SQLObject o) throws ArchitectException { if (o instanceof SQLTable) { return count + 1; } else { Iterator it = o.getChildren().iterator(); while (it.hasNext()) { myCount += countSourceTables((SQLObject) it.next()); } } return count; }
1,112,023
protected int countSourceTables(int count, SQLObject o) throws ArchitectException { if (o instanceof SQLTable) { return count + 1; } else { Iterator it = o.getChildren().iterator(); while (it.hasNext()) { count += countSourceTables(count, (SQLObject) it.next()); } } return count; }
protected int countSourceTables(int count, SQLObject o) throws ArchitectException { if (o instanceof SQLTable) { return count + 1; } else { Iterator it = o.getChildren().iterator(); while (it.hasNext()) { count += countSourceTables(count, (SQLObject) it.next()); } } }
1,112,024
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); pm.setMaximum(countSourceTables(0, (SQLObject) sourceDatabases.getModel().getRoot()) + playPen.getComponentCount() * 2); 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(); savePlayPen(); indent--; println("</architect-project>"); } finally { out.close(); out = null; pm.close(); pm = null; } }
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); pm.setMaximum(countSourceTables(0, (SQLObject) sourceDatabases.getModel().getRoot()) + playPen.getComponentCount() * 2); 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(); savePlayPen(); indent--; println("</architect-project>"); } finally { out.close(); out = null; pm.close(); pm = null; } }
1,112,025
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) { logger.debug("column "+o+" source is "+sourceCol+" (hash "+sourceCol.hashCode() +"; id "+objectIdMap.get(sourceCol) +", parent "+sourceCol.getParent()+" hash "+sourceCol.getParent().hashCode() +", parent "+sourceCol.getParent().getParent()+" hash "+sourceCol.getParent().getParent().hashCode() +", parent "+sourceCol.getParent().getParent().getParent()+" hash "+sourceCol.getParent().getParent().getParent().hashCode() +")"); 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("/>"); } }
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) { logger.debug("column "+o+" source is "+sourceCol+" (hash "+sourceCol.hashCode() +"; id "+objectIdMap.get(sourceCol) +", parent "+sourceCol.getParent()+" hash "+sourceCol.getParent().hashCode() +", parent "+sourceCol.getParent().getParent()+" hash "+sourceCol.getParent().getParent().hashCode() +", parent "+sourceCol.getParent().getParent().getParent()+" hash "+sourceCol.getParent().getParent().getParent().hashCode() +")"); 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("/>"); } }
1,112,026
public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { WeblogicApplicationForm appForm = (WeblogicApplicationForm)actionForm; ApplicationConfig config = ApplicationConfigManager.getApplicationConfig( appForm.getApplicationId()); assert config != null; config.setName(appForm.getName()); config.setHost(appForm.getHost()); config.setPort(new Integer(appForm.getPort())); config.setUsername(appForm.getUsername()); final String password = appForm.getPassword(); if(!password.equals(config.getPassword())){ config.setPassword(password); } ApplicationConfigManager.updateApplication(config); return mapping.findForward(Forwards.SUCCESS); }
public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { ApplicationForm appForm = (ApplicationForm)actionForm; ApplicationConfig config = ApplicationConfigManager.getApplicationConfig( appForm.getApplicationId()); assert config != null; config.setName(appForm.getName()); config.setHost(appForm.getHost()); config.setPort(new Integer(appForm.getPort())); config.setUsername(appForm.getUsername()); final String password = appForm.getPassword(); if(!password.equals(config.getPassword())){ config.setPassword(password); } ApplicationConfigManager.updateApplication(config); return mapping.findForward(Forwards.SUCCESS); }
1,112,029
public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { WeblogicApplicationForm appForm = (WeblogicApplicationForm)actionForm; ApplicationConfig config = ApplicationConfigManager.getApplicationConfig( appForm.getApplicationId()); assert config != null; config.setName(appForm.getName()); config.setHost(appForm.getHost()); config.setPort(new Integer(appForm.getPort())); config.setUsername(appForm.getUsername()); final String password = appForm.getPassword(); if(!password.equals(config.getPassword())){ config.setPassword(password); } ApplicationConfigManager.updateApplication(config); return mapping.findForward(Forwards.SUCCESS); }
public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { WeblogicApplicationForm appForm = (WeblogicApplicationForm)actionForm; ApplicationConfig config = ApplicationConfigManager.getApplicationConfig( appForm.getApplicationId()); assert config != null; config.setName(appForm.getName()); config.setHost(appForm.getHost()); if(appForm.getPort() != null) config.setPort(new Integer(appForm.getPort())); config.setUsername(appForm.getUsername()); final String password = appForm.getPassword(); if(!password.equals(config.getPassword())){ config.setPassword(password); } ApplicationConfigManager.updateApplication(config); return mapping.findForward(Forwards.SUCCESS); }
1,112,030
public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { WeblogicApplicationForm appForm = (WeblogicApplicationForm)actionForm; ApplicationConfig config = ApplicationConfigManager.getApplicationConfig( appForm.getApplicationId()); assert config != null; config.setName(appForm.getName()); config.setHost(appForm.getHost()); config.setPort(new Integer(appForm.getPort())); config.setUsername(appForm.getUsername()); final String password = appForm.getPassword(); if(!password.equals(config.getPassword())){ config.setPassword(password); } ApplicationConfigManager.updateApplication(config); return mapping.findForward(Forwards.SUCCESS); }
public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { WeblogicApplicationForm appForm = (WeblogicApplicationForm)actionForm; ApplicationConfig config = ApplicationConfigManager.getApplicationConfig( appForm.getApplicationId()); assert config != null; config.setName(appForm.getName()); config.setHost(appForm.getHost()); config.setPort(new Integer(appForm.getPort())); config.setUsername(appForm.getUsername()); final String password = appForm.getPassword(); if(password != null && !password.equals(config.getPassword())){ config.setPassword(password); } ApplicationConfigManager.updateApplication(config); return mapping.findForward(Forwards.SUCCESS); }
1,112,031
public TagScript createCustomTagScript(final String name, Attributes attributes) throws Exception { // custom Ant tags if ( name.equals("fileScanner") ) { return new BeanTagScript( new TagFactory() { public Tag createTag() throws Exception { return new FileScannerTag(new FileScanner(getProject())); } } ); } return null; }
public TagScript createCustomTagScript(final String name, Attributes attributes) throws Exception { // custom Ant tags if ( name.equals("fileScanner") ) { return new BeanTagScript( new TagFactory() { public Tag createTag() throws Exception { return new FileScannerTag(new FileScanner()); } } ); } return null; }
1,112,032
public Tag createTag() throws Exception { return new FileScannerTag(new FileScanner(getProject())); }
public Tag createTag() throws Exception { return new FileScannerTag(new FileScanner()); }
1,112,033
public static Project createProject() { Project project = new Project(); BuildLogger logger = new NoBannerLogger(); logger.setMessageOutputLevel( org.apache.tools.ant.Project.MSG_INFO ); logger.setOutputPrintStream( System.out ); logger.setErrorPrintStream( System.err); project.addBuildListener( logger ); project.init(); // force lazy construction which avoids null pointer exceptions when using // file sets project.getBaseDir(); return project; }
public static Project createProject() { Project project = new Project(); BuildLogger logger = new NoBannerLogger(); logger.setMessageOutputLevel( org.apache.tools.ant.Project.MSG_INFO ); logger.setOutputPrintStream( System.out ); logger.setErrorPrintStream( System.err); project.addBuildListener( logger ); project.init(); // force lazy construction which avoids null pointer exceptions when using // file sets project.getBaseDir(); return project; }
1,112,034
public Tag createTag(String name) throws Exception { AntTag tag = new AntTag( getProject(), name ); if ( name.equals( "echo" ) ) { tag.setTrim(false); } return tag; }
public Tag createTag(String name) throws Exception { AntTag tag = new AntTag( name ); if ( name.equals( "echo" ) ) { tag.setTrim(false); } return tag; }
1,112,035
public static Project getProject(JellyContext context) { Project project = (Project) context.findVariable( "org.apache.commons.jelly.ant.Project" ); if ( project == null ) { project = createProject(); context.setVariable( "org.apache.commons.jelly.ant.Project", project ); } return project; }
public static Project getProject(JellyContext context) { Project project = (Project) context.findVariable( PROJECT_CONTEXT_HANDLE ); if ( project == null ) { project = createProject(); context.setVariable( "org.apache.commons.jelly.ant.Project", project ); } return project; }
1,112,036
public static Project getProject(JellyContext context) { Project project = (Project) context.findVariable( "org.apache.commons.jelly.ant.Project" ); if ( project == null ) { project = createProject(); context.setVariable( "org.apache.commons.jelly.ant.Project", project ); } return project; }
public static Project getProject(JellyContext context) { Project project = (Project) context.findVariable( "org.apache.commons.jelly.ant.Project" ); if ( project == null ) { project = createProject(); context.setVariable( "org.apache.commons.jelly.ant.Project", project ); } return project; }
1,112,037
public void dbChildrenRemoved(SQLObjectEvent e) { logger.debug("SQLObject children got removed: "+e); boolean fireEvent = false; SQLObject o = e.getSQLSource(); SQLObject[] c = e.getChildren(); for (int i = 0; i < c.length; i++) { try { ArchitectUtils.unlistenToHierarchy(this, c[i]); } catch (ArchitectException ex) { logger.error("Couldn't unlisten to removed object", ex); } if (c[i] instanceof SQLTable) { for (int j = 0; j < getComponentCount(); j++) { TablePane tp = (TablePane) getComponent(j); if (selectedChild == tp) selectedChild = null; if (tp.getModel() == c[i]) { remove(j); fireEvent = true; } } } else if (c[i] instanceof SQLRelationship) { for (int j = 0, n = getComponentCount(); j < n; j++) { Relationship r = (Relationship) getComponent(j); if (selectedChild == r) selectedChild = null; if (r.getModel() == c[i]) { remove(j); fireEvent = true; } } } } if (fireEvent) { firePropertyChange("model.children", null, null); repaint(); } }
public void dbChildrenRemoved(SQLObjectEvent e) { logger.debug("SQLObject children got removed: "+e); boolean fireEvent = false; SQLObject o = e.getSQLSource(); SQLObject[] c = e.getChildren(); for (int i = 0; i < c.length; i++) { try { ArchitectUtils.unlistenToHierarchy(this, c[i]); } catch (ArchitectException ex) { logger.error("Couldn't unlisten to removed object", ex); } if (c[i] instanceof SQLTable) { for (int j = 0; j < getComponentCount(); j++) { TablePane tp = (TablePane) getComponent(j); if (selectedChild == tp) selectedChild = null; if (tp.getModel() == c[i]) { remove(j); fireEvent = true; } } } else if (c[i] instanceof SQLRelationship) { for (int j = 0, n = getComponentCount(); j < n; j++) { Relationship r = (Relationship) getComponent(j); if (selectedChild == r) selectedChild = null; if (r.getModel() == c[i]) { remove(j); fireEvent = true; } } } } if (fireEvent) { firePropertyChange("model.children", null, null); repaint(); } }
1,112,038
public void dbChildrenRemoved(SQLObjectEvent e) { logger.debug("SQLObject children got removed: "+e); boolean fireEvent = false; SQLObject o = e.getSQLSource(); SQLObject[] c = e.getChildren(); for (int i = 0; i < c.length; i++) { try { ArchitectUtils.unlistenToHierarchy(this, c[i]); } catch (ArchitectException ex) { logger.error("Couldn't unlisten to removed object", ex); } if (c[i] instanceof SQLTable) { for (int j = 0; j < getComponentCount(); j++) { TablePane tp = (TablePane) getComponent(j); if (selectedChild == tp) selectedChild = null; if (tp.getModel() == c[i]) { remove(j); fireEvent = true; } } } else if (c[i] instanceof SQLRelationship) { for (int j = 0, n = getComponentCount(); j < n; j++) { Relationship r = (Relationship) getComponent(j); if (selectedChild == r) selectedChild = null; if (r.getModel() == c[i]) { remove(j); fireEvent = true; } } } } if (fireEvent) { firePropertyChange("model.children", null, null); repaint(); } }
public void dbChildrenRemoved(SQLObjectEvent e) { logger.debug("SQLObject children got removed: "+e); boolean fireEvent = false; SQLObject o = e.getSQLSource(); SQLObject[] c = e.getChildren(); for (int i = 0; i < c.length; i++) { try { ArchitectUtils.unlistenToHierarchy(this, c[i]); } catch (ArchitectException ex) { logger.error("Couldn't unlisten to removed object", ex); } if (c[i] instanceof SQLTable) { for (int j = 0; j < getComponentCount(); j++) { TablePane tp = (TablePane) getComponent(j); if (selectedChild == tp) selectedChild = null; if (tp.getModel() == c[i]) { remove(j); fireEvent = true; } } } else if (c[i] instanceof SQLRelationship) { for (int j = 0, n = getComponentCount(); j < n; j++) { Relationship r = (Relationship) getComponent(j); if (selectedChild == r) selectedChild = null; if (r.getModel() == c[i]) { remove(j); fireEvent = true; } } } } if (fireEvent) { firePropertyChange("model.children", null, null); repaint(); } }
1,112,039
public void itemSelected(SelectionEvent e) { selectedChild = e.getSelectedItem(); fireSelectionEvent(e.getSelectedItem()); }
public void itemSelected(SelectionEvent e) { selectedChild = e.getSelectedItem(); fireSelectionEvent(e.getSelectedItem()); }
1,112,040
void setupTablePanePopup() { ArchitectFrame af = ArchitectFrame.getMainInstance(); tablePanePopup = new JPopupMenu(); JMenuItem mi; mi = new JMenuItem(); mi.setAction(af.editColumnAction); tablePanePopup.add(mi); mi = new JMenuItem(); mi.setAction(af.insertColumnAction); tablePanePopup.add(mi); mi = new JMenuItem(); mi.setAction(af.deleteColumnAction); tablePanePopup.add(mi); tablePanePopup.addSeparator(); mi = new JMenuItem(); mi.setAction(af.editTableAction); tablePanePopup.add(mi); mi = new JMenuItem(); mi.setAction(af.deleteTableAction); tablePanePopup.add(mi); tablePanePopup.addSeparator(); mi = new JMenuItem("Create Relationship"); tablePanePopup.add(mi); tablePanePopup.addSeparator(); mi = new JMenuItem("Show listeners"); mi.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { TablePane tp = (TablePane) getSelection(); JOptionPane.showMessageDialog(tp, new JScrollPane(new JList(new java.util.Vector(tp.getModel().getSQLObjectListeners())))); } }); tablePanePopup.add(mi); }
void setupTablePanePopup() { ArchitectFrame af = ArchitectFrame.getMainInstance(); tablePanePopup = new JPopupMenu(); JMenuItem mi; mi = new JMenuItem(); mi.setAction(af.editColumnAction); tablePanePopup.add(mi); mi = new JMenuItem(); mi.setAction(af.insertColumnAction); tablePanePopup.add(mi); mi = new JMenuItem(); mi.setAction(af.deleteColumnAction); tablePanePopup.add(mi); tablePanePopup.addSeparator(); mi = new JMenuItem(); mi.setAction(af.editTableAction); tablePanePopup.add(mi); mi = new JMenuItem(); mi.setAction(af.deleteTableAction); tablePanePopup.add(mi); tablePanePopup.addSeparator(); mi = new JMenuItem("Create Relationship"); tablePanePopup.add(mi); tablePanePopup.addSeparator(); mi = new JMenuItem("Show listeners"); mi.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { TablePane tp = (TablePane) getSelection(); JOptionPane.showMessageDialog(tp, new JScrollPane(new JList(new java.util.Vector(tp.getModel().getSQLObjectListeners())))); } }); tablePanePopup.add(mi); }
1,112,041
public void mouseClicked(MouseEvent e) { JTableHeader h = (JTableHeader) e.getSource(); TableColumnModel columnModel = h.getColumnModel(); int viewColumn = columnModel.getColumnIndexAtX(e.getX()); //XXX: Should change to a better condition for size editting // for now, it's just ctrl click on the header if (e.isControlDown()){ table.initSingleColumnSize(viewColumn); } }
public void mouseClicked(MouseEvent e) { JTableHeader h = (JTableHeader) e.getSource(); TableColumnModel columnModel = h.getColumnModel(); int viewColumn = columnModel.getColumnIndexAtX(e.getX()); //XXX: Should change to a better condition for size editting // for now, it's just ctrl click on the header if (e.isControlDown()){ initSingleColumnSize(viewColumn); } }
1,112,042
public TableModelColumnAutofit(TableModel tableModel, ProfileTable table){ this.tableModel = tableModel; this.table = table; mouseListener = new MouseListener(); }
public TableModelColumnAutofit(TableModel tableModel, JTable table){ this.tableModel = tableModel; this.table = table; mouseListener = new MouseListener(); }
1,112,043
protected void fireTreeNodesChanged(TreeModelEvent e) { final TreeModelEvent ev =e; Runnable notifier = new Runnable(){ public void run() { Iterator it = treeModelListeners.iterator(); while (it.hasNext()) { ((TreeModelListener) it.next()).treeNodesChanged(ev); } } }; if (SwingUtilities.isEventDispatchThread()) { notifier.run(); } else { SwingUtilities.invokeLater(notifier); } }
protected void fireTreeNodesChanged(TreeModelEvent e) { final TreeModelEvent ev =e; Runnable notifier = new Runnable(){ public void run() { Iterator it = treeModelListeners.iterator(); while (it.hasNext()) { ((TreeModelListener) it.next()).treeNodesChanged(ev); } } }; if (SwingUtilities.isEventDispatchThread()) { notifier.run(); } else { SwingUtilities.invokeLater(notifier); } }
1,112,046
protected void fireTreeNodesInserted(TreeModelEvent e) { if (logger.isDebugEnabled()) logger.debug("Firing treeNodesInserted event: "+e); final TreeModelEvent ev =e; Runnable notifier = new Runnable(){ public void run() { Iterator it = treeModelListeners.iterator(); while (it.hasNext()) { ((TreeModelListener) it.next()).treeNodesInserted(ev); } } }; if (SwingUtilities.isEventDispatchThread()) { notifier.run(); } else { SwingUtilities.invokeLater(notifier); } }
protected void fireTreeNodesInserted(TreeModelEvent e) { if (logger.isDebugEnabled()) logger.debug("Firing treeNodesInserted event: "+e); final TreeModelEvent ev =e; Runnable notifier = new Runnable(){ public void run() { Iterator it = treeModelListeners.iterator(); while (it.hasNext()) { ((TreeModelListener) it.next()).treeNodesInserted(ev); } } }; notifier.run(); } else { SwingUtilities.invokeLater(notifier); } }
1,112,047
protected void fireTreeNodesInserted(TreeModelEvent e) { if (logger.isDebugEnabled()) logger.debug("Firing treeNodesInserted event: "+e); final TreeModelEvent ev =e; Runnable notifier = new Runnable(){ public void run() { Iterator it = treeModelListeners.iterator(); while (it.hasNext()) { ((TreeModelListener) it.next()).treeNodesInserted(ev); } } }; if (SwingUtilities.isEventDispatchThread()) { notifier.run(); } else { SwingUtilities.invokeLater(notifier); } }
protected void fireTreeNodesInserted(TreeModelEvent e) { if (logger.isDebugEnabled()) logger.debug("Firing treeNodesInserted event: "+e); final TreeModelEvent ev =e; Runnable notifier = new Runnable(){ public void run() { Iterator it = treeModelListeners.iterator(); while (it.hasNext()) { ((TreeModelListener) it.next()).treeNodesInserted(ev); } } }; if (SwingUtilities.isEventDispatchThread()) { notifier.run(); } else { SwingUtilities.invokeLater(notifier); } }
1,112,048
protected void fireTreeNodesRemoved(TreeModelEvent e) { if (logger.isDebugEnabled()) logger.debug("Firing treeNodesRemoved event "+e); final TreeModelEvent ev =e; Runnable notifier = new Runnable(){ public void run() { Iterator it = treeModelListeners.iterator(); while (it.hasNext()) { ((TreeModelListener) it.next()).treeNodesRemoved(ev); } } }; if (SwingUtilities.isEventDispatchThread()) { notifier.run(); } else { SwingUtilities.invokeLater(notifier); } }
protected void fireTreeNodesRemoved(TreeModelEvent e) { if (logger.isDebugEnabled()) logger.debug("Firing treeNodesRemoved event "+e); final TreeModelEvent ev =e; Runnable notifier = new Runnable(){ public void run() { Iterator it = treeModelListeners.iterator(); while (it.hasNext()) { ((TreeModelListener) it.next()).treeNodesRemoved(ev); } } }; if (SwingUtilities.isEventDispatchThread()) { notifier.run(); } else { SwingUtilities.invokeLater(notifier); } }
1,112,049
protected void fireTreeStructureChanged(TreeModelEvent e) { final TreeModelEvent ev =e; Runnable notifier = new Runnable(){ public void run() { Iterator it = treeModelListeners.iterator(); while (it.hasNext()) { ((TreeModelListener) it.next()).treeStructureChanged(ev); } } }; if (SwingUtilities.isEventDispatchThread()) { notifier.run(); } else { SwingUtilities.invokeLater(notifier); } }
protected void fireTreeStructureChanged(TreeModelEvent e) { final TreeModelEvent ev =e; Runnable notifier = new Runnable(){ public void run() { Iterator it = treeModelListeners.iterator(); while (it.hasNext()) { ((TreeModelListener) it.next()).treeStructureChanged(ev); } } }; notifier.run(); } else { SwingUtilities.invokeLater(notifier); } }
1,112,050
protected void fireTreeStructureChanged(TreeModelEvent e) { final TreeModelEvent ev =e; Runnable notifier = new Runnable(){ public void run() { Iterator it = treeModelListeners.iterator(); while (it.hasNext()) { ((TreeModelListener) it.next()).treeStructureChanged(ev); } } }; if (SwingUtilities.isEventDispatchThread()) { notifier.run(); } else { SwingUtilities.invokeLater(notifier); } }
protected void fireTreeStructureChanged(TreeModelEvent e) { final TreeModelEvent ev =e; Runnable notifier = new Runnable(){ public void run() { Iterator it = treeModelListeners.iterator(); while (it.hasNext()) { ((TreeModelListener) it.next()).treeStructureChanged(ev); } } }; if (SwingUtilities.isEventDispatchThread()) { notifier.run(); } else { SwingUtilities.invokeLater(notifier); } }
1,112,051
public static Vector calcTDT(Vector chromosomes) { Vector results = new Vector(); int numMarkers = Chromosome.getSize(); for(int k=0;k<numMarkers;k++){ results.add(new TDTResult(Chromosome.getMarker(k))); } for(int i=0;i<chromosomes.size()-3;i++){ Chromosome chrom1T = (Chromosome)chromosomes.get(i); i++; Chromosome chrom1U = (Chromosome)chromosomes.get(i); i++; Chromosome chrom2T = (Chromosome)chromosomes.get(i); i++; Chromosome chrom2U = (Chromosome)chromosomes.get(i); //System.out.println("ind1T: " + chrom1T.getPed() + "\t" + chrom1T.getIndividual() ); //System.out.println("ind1U: " + chrom1U.getPed() + "\t" + chrom1U.getIndividual() ); //System.out.println("ind2T: " + chrom2T.getPed() + "\t" + chrom2T.getIndividual() ); //System.out.println("ind2U: " + chrom2U.getPed() + "\t" + chrom2U.getIndividual() ); for(int j=0;j<numMarkers;j++){ byte allele1T = chrom1T.getGenotype(j); byte allele1U = chrom1U.getGenotype(j); byte allele2T = chrom2T.getGenotype(j); byte allele2U = chrom2U.getGenotype(j); TDTResult curRes = (TDTResult)results.get(j); //System.out.println("marker "+ j + ":\t " + allele1T + "\t" + allele1U + "\t" + allele2T + "\t" + allele2U); if(!(allele1T == 5 && allele1U == 5 && allele2T !=5 && allele2U != 5) && !(allele1T != 5 && allele1U != 5 && allele2T ==5 && allele2U == 5)) { //handling missing kid parent het case curRes.tallyInd(allele1T,allele1U); curRes.tallyInd(allele2T,allele2U); } } } for(int i=0;i<results.size();i++){ TDTResult tempRes = (TDTResult)results.get(i); int[][] counts = tempRes.counts; //System.out.println( counts[0][0] + "\t" + counts[1][1] + "\t" + counts[0][1] + "\t" + counts[1][0]); } return results; }
public static Vector calcTDT(Vector chromosomes) { Vector results = new Vector(); int numMarkers = Chromosome.getSize(); for(int k=0;k<numMarkers;k++){ results.add(new TDTResult(Chromosome.getMarker(k))); } for(int i=0;i<chromosomes.size()-3;i++){ Chromosome chrom1T = (Chromosome)chromosomes.get(i); i++; Chromosome chrom1U = (Chromosome)chromosomes.get(i); i++; Chromosome chrom2T = (Chromosome)chromosomes.get(i); i++; Chromosome chrom2U = (Chromosome)chromosomes.get(i); //System.out.println("ind1T: " + chrom1T.getPed() + "\t" + chrom1T.getIndividual() ); //System.out.println("ind1U: " + chrom1U.getPed() + "\t" + chrom1U.getIndividual() ); //System.out.println("ind2T: " + chrom2T.getPed() + "\t" + chrom2T.getIndividual() ); //System.out.println("ind2U: " + chrom2U.getPed() + "\t" + chrom2U.getIndividual() ); for(int j=0;j<numMarkers;j++){ byte allele1T = chrom1T.getGenotype(j); byte allele1U = chrom1U.getGenotype(j); byte allele2T = chrom2T.getGenotype(j); byte allele2U = chrom2U.getGenotype(j); TDTResult curRes = (TDTResult)results.get(j); //System.out.println("marker "+ j + ":\t " + allele1T + "\t" + allele1U + "\t" + allele2T + "\t" + allele2U); if(!(allele1T == 5 && allele1U == 5 && allele2T !=5 && allele2U != 5) && !(allele1T != 5 && allele1U != 5 && allele2T ==5 && allele2U == 5)) { //handling missing kid parent het case curRes.tallyInd(allele1T,allele1U); curRes.tallyInd(allele2T,allele2U); } } } for(int i=0;i<results.size();i++){ TDTResult tempRes = (TDTResult)results.get(i); int[][] counts = tempRes.counts; //System.out.println( counts[0][0] + "\t" + counts[1][1] + "\t" + counts[0][1] + "\t" + counts[1][0]); } return results; }
1,112,053
public void mouseMoved(MouseEvent e) { if (movingPk) { r.setPkConnectionPoint(translatePoint(e.getPoint())); } else { r.setFkConnectionPoint(translatePoint(e.getPoint())); } }
public void mouseMoved(MouseEvent e) { if (movingPk) { r.setPkConnectionPoint(translatePoint(p)); } else { r.setFkConnectionPoint(translatePoint(e.getPoint())); } }
1,112,054
public void mouseMoved(MouseEvent e) { if (movingPk) { r.setPkConnectionPoint(translatePoint(e.getPoint())); } else { r.setFkConnectionPoint(translatePoint(e.getPoint())); } }
public void mouseMoved(MouseEvent e) { if (movingPk) { r.setPkConnectionPoint(translatePoint(e.getPoint())); } else { r.setFkConnectionPoint(translatePoint(p)); } }
1,112,055
protected void setup() { pkConnectionPoint = new Point(); fkConnectionPoint = new Point(); updateUI(); setOpaque(true); setBackground(Color.green); model.addSQLObjectListener(this); setToolTipText(model.getName()); ui.bestConnectionPoints(pkTable, fkTable, pkConnectionPoint, // in pktable-space fkConnectionPoint); // in fktable-space createPopup(); setVisible(true); mouseListener = new MouseListener(); addMouseListener(mouseListener); addMouseMotionListener(mouseListener); }
protected void setup() { pkConnectionPoint = new Point(); fkConnectionPoint = new Point(); updateUI(); setOpaque(false); setBackground(Color.green); model.addSQLObjectListener(this); setToolTipText(model.getName()); ui.bestConnectionPoints(pkTable, fkTable, pkConnectionPoint, // in pktable-space fkConnectionPoint); // in fktable-space createPopup(); setVisible(true); mouseListener = new MouseListener(); addMouseListener(mouseListener); addMouseMotionListener(mouseListener); }
1,112,056
Haplotype[][] generateHaplotypes(Vector blocks, int hapthresh) throws HaploViewException{ //TODO: output indiv hap estimates Haplotype[][] results = new Haplotype[blocks.size()][]; //String raw = new String(); //String currentLine; this.totalBlocks = blocks.size(); this.blocksDone = 0; for (int k = 0; k < blocks.size(); k++){ this.blocksDone++; int[] preFiltBlock = (int[])blocks.elementAt(k); int[] theBlock; int[] selectedMarkers = new int[0]; int[] equivClass = new int[0]; if (preFiltBlock.length > 30){ equivClass = new int[preFiltBlock.length]; int classCounter = 0; for (int x = 0; x < preFiltBlock.length; x++){ int marker1 = preFiltBlock[x]; //already been lumped into an equivalency class if (equivClass[x] != 0){ continue; } //start a new equivalency class for this SNP classCounter ++; equivClass[x] = classCounter; for (int y = x+1; y < preFiltBlock.length; y++){ int marker2 = preFiltBlock[y]; if (marker1 > marker2){ int tmp = marker1; marker1 = marker2; marker2 = tmp; } if (filteredDPrimeTable[marker1][marker2].getRSquared() == 1.0){ //these two SNPs are redundant equivClass[y] = classCounter; } } } //parse equivalency classes selectedMarkers = new int[classCounter]; for (int x = 0; x < selectedMarkers.length; x++){ selectedMarkers[x] = -1; } for (int x = 0; x < classCounter; x++){ double genoPC = 1.0; for (int y = 0; y < equivClass.length; y++){ if (equivClass[y] == x+1){ //int[]tossed = new int[3]; if (percentBadGenotypes[preFiltBlock[y]] < genoPC){ selectedMarkers[x] = preFiltBlock[y]; genoPC = percentBadGenotypes[preFiltBlock[y]]; } } } } theBlock = selectedMarkers; Arrays.sort(theBlock); //System.out.println("Block " + k + " " + theBlock.length + "/" + preFiltBlock.length); }else{ theBlock = preFiltBlock; } byte[] thisHap; Vector inputHaploVector = new Vector(); for (int i = 0; i < chromosomes.size(); i++){ thisHap = new byte[theBlock.length]; Chromosome thisChrom = (Chromosome)chromosomes.elementAt(i); Chromosome nextChrom = (Chromosome)chromosomes.elementAt(++i); int missing=0; //int dhet=0; for (int j = 0; j < theBlock.length; j++){ byte theGeno = thisChrom.getFilteredGenotype(theBlock[j]); byte nextGeno = nextChrom.getFilteredGenotype(theBlock[j]); if(theGeno == 0 || nextGeno == 0) missing++; } if (! (missing > theBlock.length/2 || missing > missingLimit)){ for (int j = 0; j < theBlock.length; j++){ byte a1 = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); byte a2 = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); byte theGeno = thisChrom.getFilteredGenotype(theBlock[j]); if (theGeno >= 5){ thisHap[j] = 'h'; } else { if (theGeno == a1){ thisHap[j] = '1'; }else if (theGeno == a2){ thisHap[j] = '2'; }else{ thisHap[j] = '0'; } } } inputHaploVector.add(thisHap); thisHap = new byte[theBlock.length]; for (int j = 0; j < theBlock.length; j++){ byte a1 = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); byte a2 = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); byte nextGeno = nextChrom.getFilteredGenotype(theBlock[j]); if (nextGeno >= 5){ thisHap[j] = 'h'; } else { if (nextGeno == a1){ thisHap[j] = '1'; }else if (nextGeno == a2){ thisHap[j] = '2'; }else{ thisHap[j] = '0'; } } } inputHaploVector.add(thisHap); } } byte[][] input_haplos = (byte[][])inputHaploVector.toArray(new byte[0][0]); //break up large blocks if needed int[] block_size; if (theBlock.length < 9){ block_size = new int[1]; block_size[0] = theBlock.length; } else { //some base-8 arithmetic int ones = theBlock.length%8; int eights = (theBlock.length - ones)/8; if (ones == 0){ block_size = new int[eights]; for (int i = 0; i < eights; i++){ block_size[i]=8; } } else { block_size = new int[eights+1]; for (int i = 0; i < eights-1; i++){ block_size[i]=8; } block_size[eights-1] = (8+ones)/2; block_size[eights] = 8+ones-block_size[eights-1]; } } String EMreturn = new String(""); int[] num_haplos_present = new int[1]; Vector haplos_present = new Vector(); Vector haplo_freq = new Vector(); //kirby patch EM theEM = new EM(); theEM.full_em_breakup(input_haplos, 4, num_haplos_present, haplos_present, haplo_freq, block_size, 0); for (int j = 0; j < haplos_present.size(); j++){ EMreturn += (String)haplos_present.elementAt(j)+"\t"+(String)haplo_freq.elementAt(j)+"\t"; } StringTokenizer st = new StringTokenizer(EMreturn); int p = 0; Haplotype[] tempArray = new Haplotype[st.countTokens()/2]; while(st.hasMoreTokens()){ String aString = st.nextToken(); int[] genos = new int[aString.length()]; for (int j = 0; j < aString.length(); j++){ byte returnBit = Byte.parseByte(aString.substring(j,j+1)); if (returnBit == 1){ genos[j] = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); }else{ if (Chromosome.getFilteredMarker(theBlock[j]).getMinor() == 0){ genos[j] = 8; }else{ genos[j] = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); } } } if (selectedMarkers.length > 0){ //we need to reassemble the haplotypes Hashtable hapsHash = new Hashtable(); //add to hash all the genotypes we phased for (int q = 0; q < genos.length; q++){ hapsHash.put(new Integer(theBlock[q]), new Integer(genos[q])); } //now add all the genotypes we didn't bother phasing, based on //which marker they are identical to for (int q = 0; q < equivClass.length; q++){ int currentClass = equivClass[q]-1; if (selectedMarkers[currentClass] == preFiltBlock[q]){ //we alredy added the phased genotypes above continue; } int indexIntoBlock=0; for (int x = 0; x < theBlock.length; x++){ if (theBlock[x] == selectedMarkers[currentClass]){ indexIntoBlock = x; break; } } //this (somewhat laboriously) reconstructs whether to add the minor or major allele if (Chromosome.getFilteredMarker(selectedMarkers[currentClass]).getMajor() == genos[indexIntoBlock]){ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getFilteredMarker(preFiltBlock[q]).getMajor())); }else{ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getFilteredMarker(preFiltBlock[q]).getMinor())); } } genos = new int[preFiltBlock.length]; for (int q = 0; q < preFiltBlock.length; q++){ genos[q] = ((Integer)hapsHash.get(new Integer(preFiltBlock[q]))).intValue(); } } double tempPerc = Double.parseDouble(st.nextToken()); if (tempPerc*100 > hapthresh){ tempArray[p] = new Haplotype(genos, tempPerc, preFiltBlock); p++; } } //make the results array only large enough to hold haps //which pass threshold above results[k] = new Haplotype[p]; for (int z = 0; z < p; z++){ results[k][z] = tempArray[z]; } } return results; }
Haplotype[][] generateHaplotypes(Vector blocks, int hapthresh) throws HaploViewException{ //TODO: output indiv hap estimates Haplotype[][] results = new Haplotype[blocks.size()][]; //String raw = new String(); //String currentLine; this.totalBlocks = blocks.size(); this.blocksDone = 0; for (int k = 0; k < blocks.size(); k++){ this.blocksDone++; int[] preFiltBlock = (int[])blocks.elementAt(k); int[] theBlock; int[] selectedMarkers = new int[0]; int[] equivClass = new int[0]; if (preFiltBlock.length > 30){ equivClass = new int[preFiltBlock.length]; int classCounter = 0; for (int x = 0; x < preFiltBlock.length; x++){ int marker1 = preFiltBlock[x]; //already been lumped into an equivalency class if (equivClass[x] != 0){ continue; } //start a new equivalency class for this SNP classCounter ++; equivClass[x] = classCounter; for (int y = x+1; y < preFiltBlock.length; y++){ int marker2 = preFiltBlock[y]; if (marker1 > marker2){ int tmp = marker1; marker1 = marker2; marker2 = tmp; } if (filteredDPrimeTable[marker1][marker2].getRSquared() == 1.0){ //these two SNPs are redundant equivClass[y] = classCounter; } } } //parse equivalency classes selectedMarkers = new int[classCounter]; for (int x = 0; x < selectedMarkers.length; x++){ selectedMarkers[x] = -1; } for (int x = 0; x < classCounter; x++){ double genoPC = 1.0; for (int y = 0; y < equivClass.length; y++){ if (equivClass[y] == x+1){ //int[]tossed = new int[3]; if (percentBadGenotypes[preFiltBlock[y]] < genoPC){ selectedMarkers[x] = preFiltBlock[y]; genoPC = percentBadGenotypes[preFiltBlock[y]]; } } } } theBlock = selectedMarkers; Arrays.sort(theBlock); //System.out.println("Block " + k + " " + theBlock.length + "/" + preFiltBlock.length); }else{ theBlock = preFiltBlock; } byte[] thisHap; Vector inputHaploVector = new Vector(); for (int i = 0; i < chromosomes.size(); i++){ thisHap = new byte[theBlock.length]; Chromosome thisChrom = (Chromosome)chromosomes.elementAt(i); Chromosome nextChrom = (Chromosome)chromosomes.elementAt(++i); int missing=0; //int dhet=0; for (int j = 0; j < theBlock.length; j++){ byte theGeno = thisChrom.getFilteredGenotype(theBlock[j]); byte nextGeno = nextChrom.getFilteredGenotype(theBlock[j]); if(theGeno == 0 || nextGeno == 0) missing++; } if (! (missing > theBlock.length/2 || missing > missingLimit)){ for (int j = 0; j < theBlock.length; j++){ byte a1 = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); byte a2 = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); byte theGeno = thisChrom.getFilteredGenotype(theBlock[j]); if (theGeno >= 5){ thisHap[j] = 'h'; } else { if (theGeno == a1){ thisHap[j] = '1'; }else if (theGeno == a2){ thisHap[j] = '2'; }else{ thisHap[j] = '0'; } } } inputHaploVector.add(thisHap); thisHap = new byte[theBlock.length]; for (int j = 0; j < theBlock.length; j++){ byte a1 = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); byte a2 = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); byte nextGeno = nextChrom.getFilteredGenotype(theBlock[j]); if (nextGeno >= 5){ thisHap[j] = 'h'; } else { if (nextGeno == a1){ thisHap[j] = '1'; }else if (nextGeno == a2){ thisHap[j] = '2'; }else{ thisHap[j] = '0'; } } } inputHaploVector.add(thisHap); } } byte[][] input_haplos = (byte[][])inputHaploVector.toArray(new byte[0][0]); //break up large blocks if needed int[] block_size; if (theBlock.length < 9){ block_size = new int[1]; block_size[0] = theBlock.length; } else { //some base-8 arithmetic int ones = theBlock.length%8; int eights = (theBlock.length - ones)/8; if (ones == 0){ block_size = new int[eights]; for (int i = 0; i < eights; i++){ block_size[i]=8; } } else { block_size = new int[eights+1]; for (int i = 0; i < eights-1; i++){ block_size[i]=8; } block_size[eights-1] = (8+ones)/2; block_size[eights] = 8+ones-block_size[eights-1]; } } String EMreturn = new String(""); int[] num_haplos_present = new int[1]; Vector haplos_present = new Vector(); Vector haplo_freq = new Vector(); //kirby patch EM theEM = new EM(); theEM.full_em_breakup(input_haplos, 4, num_haplos_present, haplos_present, haplo_freq, block_size, 0); for (int j = 0; j < haplos_present.size(); j++){ EMreturn += (String)haplos_present.elementAt(j)+"\t"+(String)haplo_freq.elementAt(j)+"\t"; } StringTokenizer st = new StringTokenizer(EMreturn); int p = 0; Haplotype[] tempArray = new Haplotype[st.countTokens()/2]; while(st.hasMoreTokens()){ String aString = st.nextToken(); int[] genos = new int[aString.length()]; for (int j = 0; j < aString.length(); j++){ byte returnBit = Byte.parseByte(aString.substring(j,j+1)); if (returnBit == 1){ genos[j] = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); }else{ if (Chromosome.getFilteredMarker(theBlock[j]).getMinor() == 0){ genos[j] = 8; }else{ genos[j] = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); } } } if (selectedMarkers.length > 0){ //we need to reassemble the haplotypes Hashtable hapsHash = new Hashtable(); //add to hash all the genotypes we phased for (int q = 0; q < genos.length; q++){ hapsHash.put(new Integer(theBlock[q]), new Integer(genos[q])); } //now add all the genotypes we didn't bother phasing, based on //which marker they are identical to for (int q = 0; q < equivClass.length; q++){ int currentClass = equivClass[q]-1; if (selectedMarkers[currentClass] == preFiltBlock[q]){ //we alredy added the phased genotypes above continue; } int indexIntoBlock=0; for (int x = 0; x < theBlock.length; x++){ if (theBlock[x] == selectedMarkers[currentClass]){ indexIntoBlock = x; break; } } //this (somewhat laboriously) reconstructs whether to add the minor or major allele if (Chromosome.getFilteredMarker(selectedMarkers[currentClass]).getMajor() == genos[indexIntoBlock]){ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getFilteredMarker(preFiltBlock[q]).getMajor())); }else{ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getFilteredMarker(preFiltBlock[q]).getMinor())); } } genos = new int[preFiltBlock.length]; for (int q = 0; q < preFiltBlock.length; q++){ genos[q] = ((Integer)hapsHash.get(new Integer(preFiltBlock[q]))).intValue(); } } double tempPerc = Double.parseDouble(st.nextToken()); if (tempPerc*100 > hapthresh){ tempArray[p] = new Haplotype(genos, tempPerc, preFiltBlock); p++; } } //make the results array only large enough to hold haps //which pass threshold above results[k] = new Haplotype[p]; for (int z = 0; z < p; z++){ results[k][z] = tempArray[z]; } } return results; }
1,112,057
Haplotype[][] generateHaplotypes(Vector blocks, int hapthresh) throws HaploViewException{ //TODO: output indiv hap estimates Haplotype[][] results = new Haplotype[blocks.size()][]; //String raw = new String(); //String currentLine; this.totalBlocks = blocks.size(); this.blocksDone = 0; for (int k = 0; k < blocks.size(); k++){ this.blocksDone++; int[] preFiltBlock = (int[])blocks.elementAt(k); int[] theBlock; int[] selectedMarkers = new int[0]; int[] equivClass = new int[0]; if (preFiltBlock.length > 30){ equivClass = new int[preFiltBlock.length]; int classCounter = 0; for (int x = 0; x < preFiltBlock.length; x++){ int marker1 = preFiltBlock[x]; //already been lumped into an equivalency class if (equivClass[x] != 0){ continue; } //start a new equivalency class for this SNP classCounter ++; equivClass[x] = classCounter; for (int y = x+1; y < preFiltBlock.length; y++){ int marker2 = preFiltBlock[y]; if (marker1 > marker2){ int tmp = marker1; marker1 = marker2; marker2 = tmp; } if (filteredDPrimeTable[marker1][marker2].getRSquared() == 1.0){ //these two SNPs are redundant equivClass[y] = classCounter; } } } //parse equivalency classes selectedMarkers = new int[classCounter]; for (int x = 0; x < selectedMarkers.length; x++){ selectedMarkers[x] = -1; } for (int x = 0; x < classCounter; x++){ double genoPC = 1.0; for (int y = 0; y < equivClass.length; y++){ if (equivClass[y] == x+1){ //int[]tossed = new int[3]; if (percentBadGenotypes[preFiltBlock[y]] < genoPC){ selectedMarkers[x] = preFiltBlock[y]; genoPC = percentBadGenotypes[preFiltBlock[y]]; } } } } theBlock = selectedMarkers; Arrays.sort(theBlock); //System.out.println("Block " + k + " " + theBlock.length + "/" + preFiltBlock.length); }else{ theBlock = preFiltBlock; } byte[] thisHap; Vector inputHaploVector = new Vector(); for (int i = 0; i < chromosomes.size(); i++){ thisHap = new byte[theBlock.length]; Chromosome thisChrom = (Chromosome)chromosomes.elementAt(i); Chromosome nextChrom = (Chromosome)chromosomes.elementAt(++i); int missing=0; //int dhet=0; for (int j = 0; j < theBlock.length; j++){ byte theGeno = thisChrom.getFilteredGenotype(theBlock[j]); byte nextGeno = nextChrom.getFilteredGenotype(theBlock[j]); if(theGeno == 0 || nextGeno == 0) missing++; } if (! (missing > theBlock.length/2 || missing > missingLimit)){ for (int j = 0; j < theBlock.length; j++){ byte a1 = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); byte a2 = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); byte theGeno = thisChrom.getFilteredGenotype(theBlock[j]); if (theGeno >= 5){ thisHap[j] = 'h'; } else { if (theGeno == a1){ thisHap[j] = '1'; }else if (theGeno == a2){ thisHap[j] = '2'; }else{ thisHap[j] = '0'; } } } inputHaploVector.add(thisHap); thisHap = new byte[theBlock.length]; for (int j = 0; j < theBlock.length; j++){ byte a1 = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); byte a2 = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); byte nextGeno = nextChrom.getFilteredGenotype(theBlock[j]); if (nextGeno >= 5){ thisHap[j] = 'h'; } else { if (nextGeno == a1){ thisHap[j] = '1'; }else if (nextGeno == a2){ thisHap[j] = '2'; }else{ thisHap[j] = '0'; } } } inputHaploVector.add(thisHap); } } byte[][] input_haplos = (byte[][])inputHaploVector.toArray(new byte[0][0]); //break up large blocks if needed int[] block_size; if (theBlock.length < 9){ block_size = new int[1]; block_size[0] = theBlock.length; } else { //some base-8 arithmetic int ones = theBlock.length%8; int eights = (theBlock.length - ones)/8; if (ones == 0){ block_size = new int[eights]; for (int i = 0; i < eights; i++){ block_size[i]=8; } } else { block_size = new int[eights+1]; for (int i = 0; i < eights-1; i++){ block_size[i]=8; } block_size[eights-1] = (8+ones)/2; block_size[eights] = 8+ones-block_size[eights-1]; } } String EMreturn = new String(""); int[] num_haplos_present = new int[1]; Vector haplos_present = new Vector(); Vector haplo_freq = new Vector(); //kirby patch EM theEM = new EM(); theEM.full_em_breakup(input_haplos, 4, num_haplos_present, haplos_present, haplo_freq, block_size, 0); for (int j = 0; j < haplos_present.size(); j++){ EMreturn += (String)haplos_present.elementAt(j)+"\t"+(String)haplo_freq.elementAt(j)+"\t"; } StringTokenizer st = new StringTokenizer(EMreturn); int p = 0; Haplotype[] tempArray = new Haplotype[st.countTokens()/2]; while(st.hasMoreTokens()){ String aString = st.nextToken(); int[] genos = new int[aString.length()]; for (int j = 0; j < aString.length(); j++){ byte returnBit = Byte.parseByte(aString.substring(j,j+1)); if (returnBit == 1){ genos[j] = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); }else{ if (Chromosome.getFilteredMarker(theBlock[j]).getMinor() == 0){ genos[j] = 8; }else{ genos[j] = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); } } } if (selectedMarkers.length > 0){ //we need to reassemble the haplotypes Hashtable hapsHash = new Hashtable(); //add to hash all the genotypes we phased for (int q = 0; q < genos.length; q++){ hapsHash.put(new Integer(theBlock[q]), new Integer(genos[q])); } //now add all the genotypes we didn't bother phasing, based on //which marker they are identical to for (int q = 0; q < equivClass.length; q++){ int currentClass = equivClass[q]-1; if (selectedMarkers[currentClass] == preFiltBlock[q]){ //we alredy added the phased genotypes above continue; } int indexIntoBlock=0; for (int x = 0; x < theBlock.length; x++){ if (theBlock[x] == selectedMarkers[currentClass]){ indexIntoBlock = x; break; } } //this (somewhat laboriously) reconstructs whether to add the minor or major allele if (Chromosome.getFilteredMarker(selectedMarkers[currentClass]).getMajor() == genos[indexIntoBlock]){ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getFilteredMarker(preFiltBlock[q]).getMajor())); }else{ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getFilteredMarker(preFiltBlock[q]).getMinor())); } } genos = new int[preFiltBlock.length]; for (int q = 0; q < preFiltBlock.length; q++){ genos[q] = ((Integer)hapsHash.get(new Integer(preFiltBlock[q]))).intValue(); } } double tempPerc = Double.parseDouble(st.nextToken()); if (tempPerc*100 > hapthresh){ tempArray[p] = new Haplotype(genos, tempPerc, preFiltBlock); p++; } } //make the results array only large enough to hold haps //which pass threshold above results[k] = new Haplotype[p]; for (int z = 0; z < p; z++){ results[k][z] = tempArray[z]; } } return results; }
Haplotype[][] generateHaplotypes(Vector blocks, int hapthresh) throws HaploViewException{ //TODO: output indiv hap estimates Haplotype[][] results = new Haplotype[blocks.size()][]; //String raw = new String(); //String currentLine; this.totalBlocks = blocks.size(); this.blocksDone = 0; for (int k = 0; k < blocks.size(); k++){ this.blocksDone++; int[] preFiltBlock = (int[])blocks.elementAt(k); int[] theBlock; int[] selectedMarkers = new int[0]; int[] equivClass = new int[0]; if (preFiltBlock.length > 30){ equivClass = new int[preFiltBlock.length]; int classCounter = 0; for (int x = 0; x < preFiltBlock.length; x++){ int marker1 = preFiltBlock[x]; //already been lumped into an equivalency class if (equivClass[x] != 0){ continue; } //start a new equivalency class for this SNP classCounter ++; equivClass[x] = classCounter; for (int y = x+1; y < preFiltBlock.length; y++){ int marker2 = preFiltBlock[y]; if (marker1 > marker2){ int tmp = marker1; marker1 = marker2; marker2 = tmp; } if (filteredDPrimeTable[marker1][marker2].getRSquared() == 1.0){ //these two SNPs are redundant equivClass[y] = classCounter; } } } //parse equivalency classes selectedMarkers = new int[classCounter]; for (int x = 0; x < selectedMarkers.length; x++){ selectedMarkers[x] = -1; } for (int x = 0; x < classCounter; x++){ double genoPC = 1.0; for (int y = 0; y < equivClass.length; y++){ if (equivClass[y] == x+1){ //int[]tossed = new int[3]; if (percentBadGenotypes[preFiltBlock[y]] < genoPC){ selectedMarkers[x] = preFiltBlock[y]; genoPC = percentBadGenotypes[preFiltBlock[y]]; } } } } theBlock = selectedMarkers; Arrays.sort(theBlock); //System.out.println("Block " + k + " " + theBlock.length + "/" + preFiltBlock.length); }else{ theBlock = preFiltBlock; } byte[] thisHap; Vector inputHaploVector = new Vector(); for (int i = 0; i < chromosomes.size(); i++){ thisHap = new byte[theBlock.length]; Chromosome thisChrom = (Chromosome)chromosomes.elementAt(i); Chromosome nextChrom = (Chromosome)chromosomes.elementAt(++i); int missing=0; //int dhet=0; for (int j = 0; j < theBlock.length; j++){ byte theGeno = thisChrom.getFilteredGenotype(theBlock[j]); byte nextGeno = nextChrom.getFilteredGenotype(theBlock[j]); if(theGeno == 0 || nextGeno == 0) missing++; } if (! (missing > theBlock.length/2 || missing > missingLimit)){ for (int j = 0; j < theBlock.length; j++){ byte a1 = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); byte a2 = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); byte theGeno = thisChrom.getFilteredGenotype(theBlock[j]); if (theGeno >= 5){ thisHap[j] = 'h'; } else { if (theGeno == a1){ thisHap[j] = '1'; }else if (theGeno == a2){ thisHap[j] = '2'; }else{ thisHap[j] = '0'; } } } inputHaploVector.add(thisHap); thisHap = new byte[theBlock.length]; for (int j = 0; j < theBlock.length; j++){ byte a1 = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); byte a2 = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); byte nextGeno = nextChrom.getFilteredGenotype(theBlock[j]); if (nextGeno >= 5){ thisHap[j] = 'h'; } else { if (nextGeno == a1){ thisHap[j] = '1'; }else if (nextGeno == a2){ thisHap[j] = '2'; }else{ thisHap[j] = '0'; } } } inputHaploVector.add(thisHap); } } byte[][] input_haplos = (byte[][])inputHaploVector.toArray(new byte[0][0]); //break up large blocks if needed int[] block_size; if (theBlock.length < 9){ block_size = new int[1]; block_size[0] = theBlock.length; } else { //some base-8 arithmetic int ones = theBlock.length%8; int eights = (theBlock.length - ones)/8; if (ones == 0){ block_size = new int[eights]; for (int i = 0; i < eights; i++){ block_size[i]=8; } } else { block_size = new int[eights+1]; for (int i = 0; i < eights-1; i++){ block_size[i]=8; } block_size[eights-1] = (8+ones)/2; block_size[eights] = 8+ones-block_size[eights-1]; } } String EMreturn = new String(""); int[] num_haplos_present = new int[1]; Vector haplos_present = new Vector(); Vector haplo_freq = new Vector(); //kirby patch EM theEM = new EM(); theEM.full_em_breakup(input_haplos, 4, num_haplos_present, haplos_present, haplo_freq, block_size, 0); for (int j = 0; j < haplos_present.size(); j++){ EMreturn += (String)haplos_present.elementAt(j)+"\t"+(String)haplo_freq.elementAt(j)+"\t"; } StringTokenizer st = new StringTokenizer(EMreturn); int p = 0; Haplotype[] tempArray = new Haplotype[st.countTokens()/2]; while(st.hasMoreTokens()){ String aString = st.nextToken(); int[] genos = new int[aString.length()]; for (int j = 0; j < aString.length(); j++){ byte returnBit = Byte.parseByte(aString.substring(j,j+1)); if (returnBit == 1){ genos[j] = Chromosome.getFilteredMarker(theBlock[j]).getMajor(); }else{ if (Chromosome.getFilteredMarker(theBlock[j]).getMinor() == 0){ genos[j] = 8; }else{ genos[j] = Chromosome.getFilteredMarker(theBlock[j]).getMinor(); } } } if (selectedMarkers.length > 0){ //we need to reassemble the haplotypes Hashtable hapsHash = new Hashtable(); //add to hash all the genotypes we phased for (int q = 0; q < genos.length; q++){ hapsHash.put(new Integer(theBlock[q]), new Integer(genos[q])); } //now add all the genotypes we didn't bother phasing, based on //which marker they are identical to for (int q = 0; q < equivClass.length; q++){ int currentClass = equivClass[q]-1; if (selectedMarkers[currentClass] == preFiltBlock[q]){ //we alredy added the phased genotypes above continue; } int indexIntoBlock=0; for (int x = 0; x < theBlock.length; x++){ if (theBlock[x] == selectedMarkers[currentClass]){ indexIntoBlock = x; break; } } //this (somewhat laboriously) reconstructs whether to add the minor or major allele if (Chromosome.getFilteredMarker(selectedMarkers[currentClass]).getMajor() == genos[indexIntoBlock]){ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getFilteredMarker(preFiltBlock[q]).getMajor())); }else{ hapsHash.put(new Integer(preFiltBlock[q]), new Integer(Chromosome.getFilteredMarker(preFiltBlock[q]).getMinor())); } } genos = new int[preFiltBlock.length]; for (int q = 0; q < preFiltBlock.length; q++){ genos[q] = ((Integer)hapsHash.get(new Integer(preFiltBlock[q]))).intValue(); } } double tempPerc = Double.parseDouble(st.nextToken()); if (tempPerc*100 > hapthresh){ tempArray[p] = new Haplotype(genos, tempPerc, preFiltBlock); p++; } } //make the results array only large enough to hold haps //which pass threshold above results[k] = new Haplotype[p]; for (int z = 0; z < p; z++){ results[k][z] = tempArray[z]; } } return results; }
1,112,058
public Object createObject(Attributes attributes) { SQLTable tab = new SQLTable(); String id = attributes.getValue("id"); if (id != null) { objectIdMap.put(id, tab); } else { logger.warn("No ID found in table element while loading project!"); } String populated = attributes.getValue("populated"); if (populated != null && populated.equals("false")) { try { tab.initFolders(false); } catch (ArchitectException e) { logger.error("Couldn't add folder to table \""+tab.getName()+"\"", e); JOptionPane.showMessageDialog(null, "Failed to add folder to table:\n"+e.getMessage()); } } return tab; }
public Object createObject(Attributes attributes) throws ArchitectException{ SQLTable tab = new SQLTable(); String id = attributes.getValue("id"); if (id != null) { objectIdMap.put(id, tab); } else { logger.warn("No ID found in table element while loading project!"); } String populated = attributes.getValue("populated"); if (populated != null && populated.equals("false")) { try { tab.initFolders(false); } catch (ArchitectException e) { logger.error("Couldn't add folder to table \""+tab.getName()+"\"", e); JOptionPane.showMessageDialog(null, "Failed to add folder to table:\n"+e.getMessage()); } } return tab; }
1,112,059
public Tag createTag() throws Exception { return (Tag) tagClass.newInstance(); }
public Tag createTag(String name, Attributes attributes) throws Exception { return (Tag) tagClass.newInstance(); }
1,112,060
public void doTag(XMLOutput output) throws Exception { Object xpathContext = getXPathContext(); if (select == null) { select = createXPathFromBody(xpathContext); } String text = select.valueOf(xpathContext); if ( text != null ) { output.write(text); } }
public void doTag(XMLOutput output) throws Exception { Object xpathContext = getXPathContext(); if (select == null) { throw new MissingAttributeException( "select" ); } String text = select.valueOf(xpathContext); if ( text != null ) { output.write(text); } }
1,112,065
public void doTag(XMLOutput output) throws Exception { Object xpathContext = getXPathContext(); if (select == null) { select = createXPathFromBody(xpathContext); } String text = select.valueOf(xpathContext); if ( text != null ) { output.write(text); } }
public void doTag(XMLOutput output) throws Exception { Object xpathContext = getXPathContext(); if (select == null) { select = createXPathFromBody(xpathContext); } String text = select.stringValueOf(xpathContext); if ( text != null ) { output.write(text); } }
1,112,066
public void doTag(final XMLOutput output) throws Exception { if ( xmlOutput == null ) { // lets default to system.out xmlOutput = XMLOutput.createXMLOutput( System.out ); } Thread thread = new Thread( new Runnable() { public void run() { try { invokeBody(xmlOutput); xmlOutput.close(); } catch (Exception e) { e.printStackTrace(); } } } ); if ( name != null ) { thread.setName( name ); } thread.start(); }
public void doTag(final XMLOutput output) throws Exception { if ( xmlOutput == null ) { // lets default to system.out xmlOutput = XMLOutput.createXMLOutput( System.out ); } Thread thread = new Thread( new Runnable() { public void run() { try { getBody().run(newContext, xmlOutput); xmlOutput.close(); } catch (Exception e) { e.printStackTrace(); } } } ); if ( name != null ) { thread.setName( name ); } thread.start(); }
1,112,068
public void run() { try { invokeBody(xmlOutput); xmlOutput.close(); } catch (Exception e) { e.printStackTrace(); } }
public void run() { try { getBody().run(newContext, xmlOutput); xmlOutput.close(); } catch (Exception e) { e.printStackTrace(); } }
1,112,069
public void actionPerformed(ActionEvent e) { if (configFile == null) configFile = ConfigFile.getDefaultInstance(); try { 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(prefs); } catch (ArchitectException ex) { logger.error("Couldn't save settings", ex); } }
public void actionPerformed(ActionEvent e) { try { 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(prefs); } catch (ArchitectException ex) { logger.error("Couldn't save settings", ex); } }
1,112,070
public void actionPerformed(ActionEvent e) { if (configFile == null) configFile = ConfigFile.getDefaultInstance(); try { 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(prefs); } catch (ArchitectException ex) { logger.error("Couldn't save settings", ex); } }
public void actionPerformed(ActionEvent e) { if (configFile == null) configFile = ConfigFile.getDefaultInstance(); try { 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(prefs); } catch (ArchitectException ex) { logger.error("Couldn't save settings", ex); } }
1,112,071
public ArchitectFrame() throws ArchitectException { mainInstance = this; try { ConfigFile cf = ConfigFile.getDefaultInstance(); prefs = cf.read(); sprefs = prefs.getSwingSettings(); } catch (IOException e) { throw new ArchitectException("prefs.read", e); } project = new SwingUIProject("New Project"); setName("Power*Architect: "+project.getName()); Container cp = getContentPane(); cp.setLayout(new BorderLayout()); menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); fileMenu.add(new JMenuItem(saveSettingsAction)); menuBar.add(fileMenu); setJMenuBar(menuBar); playpen = new PlayPen(project.getTargetDatabase()); List databases = project.getSourceDatabases();// Iterator it = prefs.getConnections().iterator();// while (it.hasNext()) {// databases.add(new SQLDatabase((DBConnectionSpec) it.next()));// } dbTree = new DBTree(databases); ((SQLObject) dbTree.getModel().getRoot()).addChild(project.getTargetDatabase()); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(dbTree), new JScrollPane(playpen)); cp.add(splitPane, BorderLayout.CENTER); splitPane.setDividerLocation (sprefs.getInt(SwingUserSettings.DIVIDER_LOCATION, dbTree.getPreferredSize().width)); toolBar = new JToolBar(); toolBar.add(new JButton(saveSettingsAction)); toolBar.add(new JButton(new CreateRelationshipAction(playpen))); cp.add(toolBar, BorderLayout.NORTH); 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); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
public ArchitectFrame() throws ArchitectException { mainInstance = this; try { ConfigFile cf = ConfigFile.getDefaultInstance(); prefs = cf.read(); sprefs = prefs.getSwingSettings(); } catch (IOException e) { throw new ArchitectException("prefs.read", e); } project = new SwingUIProject("New Project"); setName("Power*Architect: "+project.getName()); Container cp = getContentPane(); cp.setLayout(new BorderLayout()); menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); fileMenu.add(new JMenuItem(saveSettingsAction)); menuBar.add(fileMenu); setJMenuBar(menuBar); playpen = new PlayPen(project.getTargetDatabase()); List databases = project.getSourceDatabases();// Iterator it = prefs.getConnections().iterator();// while (it.hasNext()) {// databases.add(new SQLDatabase((DBConnectionSpec) it.next()));// } dbTree = new DBTree(databases); ((SQLObject) dbTree.getModel().getRoot()).addChild(project.getTargetDatabase()); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(dbTree), new JScrollPane(playpen)); cp.add(splitPane, BorderLayout.CENTER); splitPane.setDividerLocation (sprefs.getInt(SwingUserSettings.DIVIDER_LOCATION, dbTree.getPreferredSize().width)); toolBar = new JToolBar(); toolBar.add(new JButton(saveSettingsAction)); toolBar.add(new JButton(new CreateRelationshipAction(playpen))); cp.add(toolBar, BorderLayout.NORTH); 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); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
1,112,072
public ArchitectFrame() throws ArchitectException { mainInstance = this; try { ConfigFile cf = ConfigFile.getDefaultInstance(); prefs = cf.read(); sprefs = prefs.getSwingSettings(); } catch (IOException e) { throw new ArchitectException("prefs.read", e); } project = new SwingUIProject("New Project"); setName("Power*Architect: "+project.getName()); Container cp = getContentPane(); cp.setLayout(new BorderLayout()); menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); fileMenu.add(new JMenuItem(saveSettingsAction)); menuBar.add(fileMenu); setJMenuBar(menuBar); playpen = new PlayPen(project.getTargetDatabase()); List databases = project.getSourceDatabases();// Iterator it = prefs.getConnections().iterator();// while (it.hasNext()) {// databases.add(new SQLDatabase((DBConnectionSpec) it.next()));// } dbTree = new DBTree(databases); ((SQLObject) dbTree.getModel().getRoot()).addChild(project.getTargetDatabase()); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(dbTree), new JScrollPane(playpen)); cp.add(splitPane, BorderLayout.CENTER); splitPane.setDividerLocation (sprefs.getInt(SwingUserSettings.DIVIDER_LOCATION, dbTree.getPreferredSize().width)); toolBar = new JToolBar(); toolBar.add(new JButton(saveSettingsAction)); toolBar.add(new JButton(new CreateRelationshipAction(playpen))); cp.add(toolBar, BorderLayout.NORTH); 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); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
public ArchitectFrame() throws ArchitectException { mainInstance = this; try { ConfigFile cf = ConfigFile.getDefaultInstance(); prefs = cf.read(); sprefs = prefs.getSwingSettings(); } catch (IOException e) { throw new ArchitectException("prefs.read", e); } project = new SwingUIProject("New Project"); setName("Power*Architect: "+project.getName()); Container cp = getContentPane(); cp.setLayout(new BorderLayout()); menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); fileMenu.add(new JMenuItem(saveSettingsAction)); menuBar.add(fileMenu); setJMenuBar(menuBar); playpen = new PlayPen(project.getTargetDatabase()); List databases = project.getSourceDatabases();// Iterator it = prefs.getConnections().iterator();// while (it.hasNext()) {// databases.add(new SQLDatabase((DBConnectionSpec) it.next()));// } dbTree = new DBTree(databases); ((SQLObject) dbTree.getModel().getRoot()).addChild(project.getTargetDatabase()); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(dbTree), new JScrollPane(playpen)); cp.add(splitPane, BorderLayout.CENTER); splitPane.setDividerLocation (sprefs.getInt(SwingUserSettings.DIVIDER_LOCATION, dbTree.getPreferredSize().width)); toolBar = new JToolBar(); toolBar.add(new JButton(saveSettingsAction)); toolBar.add(new JButton(new CreateRelationshipAction(playpen))); cp.add(toolBar, BorderLayout.NORTH); 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); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
1,112,073
public ArchitectFrame() throws ArchitectException { mainInstance = this; try { ConfigFile cf = ConfigFile.getDefaultInstance(); prefs = cf.read(); sprefs = prefs.getSwingSettings(); } catch (IOException e) { throw new ArchitectException("prefs.read", e); } project = new SwingUIProject("New Project"); setName("Power*Architect: "+project.getName()); Container cp = getContentPane(); cp.setLayout(new BorderLayout()); menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); fileMenu.add(new JMenuItem(saveSettingsAction)); menuBar.add(fileMenu); setJMenuBar(menuBar); playpen = new PlayPen(project.getTargetDatabase()); List databases = project.getSourceDatabases();// Iterator it = prefs.getConnections().iterator();// while (it.hasNext()) {// databases.add(new SQLDatabase((DBConnectionSpec) it.next()));// } dbTree = new DBTree(databases); ((SQLObject) dbTree.getModel().getRoot()).addChild(project.getTargetDatabase()); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(dbTree), new JScrollPane(playpen)); cp.add(splitPane, BorderLayout.CENTER); splitPane.setDividerLocation (sprefs.getInt(SwingUserSettings.DIVIDER_LOCATION, dbTree.getPreferredSize().width)); toolBar = new JToolBar(); toolBar.add(new JButton(saveSettingsAction)); toolBar.add(new JButton(new CreateRelationshipAction(playpen))); cp.add(toolBar, BorderLayout.NORTH); 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); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
public ArchitectFrame() throws ArchitectException { mainInstance = this; try { ConfigFile cf = ConfigFile.getDefaultInstance(); prefs = cf.read(); sprefs = prefs.getSwingSettings(); } catch (IOException e) { throw new ArchitectException("prefs.read", e); } project = new SwingUIProject("New Project"); setName("Power*Architect: "+project.getName()); Container cp = getContentPane(); cp.setLayout(new BorderLayout()); menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); fileMenu.add(new JMenuItem(saveSettingsAction)); menuBar.add(fileMenu); setJMenuBar(menuBar); playpen = new PlayPen(project.getTargetDatabase()); List databases = project.getSourceDatabases();// Iterator it = prefs.getConnections().iterator();// while (it.hasNext()) {// databases.add(new SQLDatabase((DBConnectionSpec) it.next()));// } dbTree = new DBTree(databases); ((SQLObject) dbTree.getModel().getRoot()).addChild(project.getTargetDatabase()); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(dbTree), new JScrollPane(playpen)); cp.add(splitPane, BorderLayout.CENTER); splitPane.setDividerLocation (sprefs.getInt(SwingUserSettings.DIVIDER_LOCATION, dbTree.getPreferredSize().width)); toolBar = new JToolBar(); toolBar.add(new JButton(saveSettingsAction)); toolBar.add(new JButton(new CreateRelationshipAction(playpen))); cp.add(toolBar, BorderLayout.NORTH); 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); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
1,112,074
void browse(int browseType){ String name; String markerInfoName = ""; JFileChooser fc = new JFileChooser(System.getProperty("user.dir")); fc.setSelectedFile(null); int returned = fc.showOpenDialog(this); if (returned != JFileChooser.APPROVE_OPTION) return; File file = fc.getSelectedFile(); if (browseType == GENO){ name = file.getName(); genoFileField.setText(file.getParent()+File.separator+name); if(infoFileField.getText().equals("")){ //baseName should be everything but the final ".XXX" extension StringTokenizer st = new StringTokenizer(name,"."); String baseName = st.nextToken(); for (int i = 0; i < st.countTokens()-1; i++){ baseName = baseName.concat(".").concat(st.nextToken()); } //check for info file for original file sample.haps //either sample.haps.info or sample.info File maybeMarkers1 = new File(file.getParent(), name + MARKER_DATA_EXT); File maybeMarkers2 = new File(file.getParent(), baseName + MARKER_DATA_EXT); if (maybeMarkers1.exists()){ markerInfoName = maybeMarkers1.getName(); }else if (maybeMarkers2.exists()){ markerInfoName = maybeMarkers2.getName(); }else{ return; } infoFileField.setText(file.getParent()+File.separator+markerInfoName); } }else if (browseType==INFO){ markerInfoName = file.getName(); infoFileField.setText(file.getParent()+File.separator+markerInfoName); } }
void browse(int browseType){ String name; String markerInfoName = ""; JFileChooser fc = new JFileChooser(System.getProperty("user.dir")); fc.setSelectedFile(null); int returned = fc.showOpenDialog(this); if (returned != JFileChooser.APPROVE_OPTION) return; File file = fc.getSelectedFile(); if (browseType == GENO){ name = file.getName(); genoFileField.setText(file.getParent()+File.separator+name); if(infoFileField.getText().equals("")){ //baseName should be everything but the final ".XXX" extension StringTokenizer st = new StringTokenizer(name,"."); String baseName = st.nextToken(); for (int i = 0; i < st.countTokens()-1; i++){ baseName = baseName.concat(".").concat(st.nextToken()); } //check for info file for original file sample.haps //either sample.haps.info or sample.info File maybeMarkers1 = new File(file.getParent(), name + MARKER_DATA_EXT); File maybeMarkers2 = new File(file.getParent(), baseName + MARKER_DATA_EXT); if (maybeMarkers1.exists()){ markerInfoName = maybeMarkers1.getName(); }else if (maybeMarkers2.exists()){ markerInfoName = maybeMarkers2.getName(); }else{ return; } infoFileField.setText(file.getParent()+File.separator+markerInfoName); } }else if (browseType==INFO){ markerInfoName = file.getName(); infoFileField.setText(file.getParent()+File.separator+markerInfoName); } }
1,112,076
void browse(int browseType){ String name; String markerInfoName = ""; JFileChooser fc = new JFileChooser(System.getProperty("user.dir")); fc.setSelectedFile(null); int returned = fc.showOpenDialog(this); if (returned != JFileChooser.APPROVE_OPTION) return; File file = fc.getSelectedFile(); if (browseType == GENO){ name = file.getName(); genoFileField.setText(file.getParent()+File.separator+name); if(infoFileField.getText().equals("")){ //baseName should be everything but the final ".XXX" extension StringTokenizer st = new StringTokenizer(name,"."); String baseName = st.nextToken(); for (int i = 0; i < st.countTokens()-1; i++){ baseName = baseName.concat(".").concat(st.nextToken()); } //check for info file for original file sample.haps //either sample.haps.info or sample.info File maybeMarkers1 = new File(file.getParent(), name + MARKER_DATA_EXT); File maybeMarkers2 = new File(file.getParent(), baseName + MARKER_DATA_EXT); if (maybeMarkers1.exists()){ markerInfoName = maybeMarkers1.getName(); }else if (maybeMarkers2.exists()){ markerInfoName = maybeMarkers2.getName(); }else{ return; } infoFileField.setText(file.getParent()+File.separator+markerInfoName); } }else if (browseType==INFO){ markerInfoName = file.getName(); infoFileField.setText(file.getParent()+File.separator+markerInfoName); } }
void browse(int browseType){ String name; String markerInfoName = ""; JFileChooser fc = new JFileChooser(System.getProperty("user.dir")); fc.setSelectedFile(null); int returned = fc.showOpenDialog(this); if (returned != JFileChooser.APPROVE_OPTION) return; File file = h.fc.getSelectedFile(); if (browseType == GENO){ name = file.getName(); genoFileField.setText(file.getParent()+File.separator+name); if(infoFileField.getText().equals("")){ //baseName should be everything but the final ".XXX" extension StringTokenizer st = new StringTokenizer(name,"."); String baseName = st.nextToken(); for (int i = 0; i < st.countTokens()-1; i++){ baseName = baseName.concat(".").concat(st.nextToken()); } //check for info file for original file sample.haps //either sample.haps.info or sample.info File maybeMarkers1 = new File(file.getParent(), name + MARKER_DATA_EXT); File maybeMarkers2 = new File(file.getParent(), baseName + MARKER_DATA_EXT); if (maybeMarkers1.exists()){ markerInfoName = maybeMarkers1.getName(); }else if (maybeMarkers2.exists()){ markerInfoName = maybeMarkers2.getName(); }else{ return; } infoFileField.setText(file.getParent()+File.separator+markerInfoName); } }else if (browseType==INFO){ markerInfoName = file.getName(); infoFileField.setText(file.getParent()+File.separator+markerInfoName); } }
1,112,077
public void mouseClicked(MouseEvent evt) { if ((evt.getModifiers() & MouseEvent.BUTTON1_MASK) != 0) { TablePane tp = (TablePane) evt.getSource(); if (evt.getClickCount() == 2) { // double click if (tp.isSelected()) { ArchitectFrame af = ArchitectFrame.getMainInstance(); int selectedColIndex = tp.getSelectedColumnIndex(); if (selectedColIndex == COLUMN_INDEX_NONE) { af.editTableAction.actionPerformed (new ActionEvent(tp, ActionEvent.ACTION_PERFORMED, "DoubleClick")); } else if (selectedColIndex >= 0) { af.editColumnAction.actionPerformed (new ActionEvent(tp, ActionEvent.ACTION_PERFORMED, "DoubleClick")); } } } } }
public void mouseClicked(MouseEvent evt) { if ((evt.getModifiers() & MouseEvent.BUTTON1_MASK) != 0) { TablePane tp = (TablePane) evt.getSource(); if (evt.getClickCount() == 2) { // double click if (tp.isSelected()) { ArchitectFrame af = ArchitectFrame.getMainInstance(); int selectedColIndex = tp.getSelectedColumnIndex(); if (selectedColIndex == COLUMN_INDEX_NONE) { af.editTableAction.actionPerformed (new ActionEvent(tp, ActionEvent.ACTION_PERFORMED, ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN)); } else if (selectedColIndex >= 0) { af.editColumnAction.actionPerformed (new ActionEvent(tp, ActionEvent.ACTION_PERFORMED, ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN)); } } } } }
1,112,078
public CompareSchemaWorker (SQLSchema source, SQLSchema target ) throws ArchitectException { this.source = source; this.target = target; jobSize = source.getChildren().size(); progress = 0; finished = false; }
public CompareSchemaWorker (SQLSchema source, SQLSchema target, GenericDDLGenerator gen ) throws ArchitectException { this.source = source; this.target = target; jobSize = source.getChildren().size(); progress = 0; finished = false; }
1,112,079
public void run() { // FIXME: this should not be hardwired to oracle! OracleDDLGenerator od = new OracleDDLGenerator(); final DefaultStyledDocument output = new DefaultStyledDocument(); SimpleAttributeSet attrsSource = new SimpleAttributeSet(); SimpleAttributeSet attrsTarget = new SimpleAttributeSet(); SimpleAttributeSet attrsSame = new SimpleAttributeSet(); SimpleAttributeSet attrsMsg = new SimpleAttributeSet(); StyleConstants.setFontFamily(attrsSource, "Courier New"); StyleConstants.setFontSize(attrsSource, 12); StyleConstants.setForeground(attrsSource, Color.red); StyleConstants.setFontFamily(attrsTarget, "Courier New"); StyleConstants.setFontSize(attrsTarget, 12); StyleConstants.setForeground(attrsTarget, Color.green); StyleConstants.setFontFamily(attrsSame, "Courier New"); StyleConstants.setFontSize(attrsSame, 12); StyleConstants.setForeground(attrsSame, Color.black); StyleConstants.setFontFamily(attrsMsg, "Courier New"); StyleConstants.setFontSize(attrsMsg, 12); StyleConstants.setForeground(attrsMsg, Color.orange); try { List sourceTablesList = source.getChildren(); List targetTablesList = target.getChildren(); Iterator it = sourceTablesList.iterator(); while (it.hasNext()) { SQLObject table = (SQLObject) it.next(); if ( table instanceof SQLTable ) { SQLTable targetTable = targetSQLSchema.getTableByName( table.getName() ); if ( targetTable == null ) { output.insertString(output.getLength(), "<<<TABLE NOT FOUND IN " + targetDatabase.getDataSource().getDisplayName() + "." + targetSchemaDropdown.getSelectedItem() + ">>>" + newline, attrsMsg ); output.insertString(output.getLength(), table.toString() + newline, attrsSource ); } else { output.insertString(output.getLength(), newline + table.toString() + newline, attrsSame ); Iterator it2 = (((SQLTable)table).getColumns()).iterator(); while (it2.hasNext()) { SQLObject column = (SQLObject) it2.next(); if ( column instanceof SQLColumn ) { SQLColumn targetColumn = targetTable.getColumnByName( ((SQLColumn)column).getName() ); if ( targetColumn == null ) { output.insertString(output.getLength(), " <<<NEW COLUMN>>>" + newline, attrsMsg ); output.insertString(output.getLength(), " " + ((SQLColumn)column).toString() + newline, attrsSource ); } else { if ( ((SQLColumn)column).getType() != targetColumn.getType() ) { output.insertString(output.getLength(), " <<<DIFFERENT DATA TYPE>>>" + newline, attrsMsg ); output.insertString(output.getLength(), " " + ((SQLColumn)column).getName(), attrsSame ); output.insertString(output.getLength(), " " + ca.sqlpower.architect.swingui.SQLType.getTypeName(((SQLColumn)column).getType()) +"("+((SQLColumn)column).getScale()+")" + newline, attrsSource ); } else if ( ((SQLColumn)column).getScale() != targetColumn.getScale() ) { output.insertString(output.getLength(), " <<<DIFFERENT SCALE>>>" + newline, attrsMsg ); output.insertString(output.getLength(), " " + ((SQLColumn)column).getName() + " " + ca.sqlpower.architect.swingui.SQLType.getTypeName(((SQLColumn)column).getType()) , attrsSame ); output.insertString(output.getLength(), " ("+((SQLColumn)column).getScale()+")" + newline, attrsSource ); } else { output.insertString(output.getLength(), " " + ca.sqlpower.architect.swingui.SQLType.getTypeName(((SQLColumn)column).getType()) +"("+((SQLColumn)column).getScale()+")" + newline, attrsSame ); } // compare column data type/scale } // column } // is column } // while table children } // table exist } // is table progress++; } // schema children, while loop } catch ( ArchitectException exp ) { System.err.println(exp.toString()); } catch (BadLocationException ble) { System.err.println("Couldn't insert styled text."); } finally { finished = true; } SwingUtilities.invokeLater(new Runnable() { public void run() { outputTextPane.setDocument(output); } }); }
public void run() { // FIXME: this should not be hardwired to oracle! final DefaultStyledDocument output = new DefaultStyledDocument(); SimpleAttributeSet attrsSource = new SimpleAttributeSet(); SimpleAttributeSet attrsTarget = new SimpleAttributeSet(); SimpleAttributeSet attrsSame = new SimpleAttributeSet(); SimpleAttributeSet attrsMsg = new SimpleAttributeSet(); StyleConstants.setFontFamily(attrsSource, "Courier New"); StyleConstants.setFontSize(attrsSource, 12); StyleConstants.setForeground(attrsSource, Color.red); StyleConstants.setFontFamily(attrsTarget, "Courier New"); StyleConstants.setFontSize(attrsTarget, 12); StyleConstants.setForeground(attrsTarget, Color.green); StyleConstants.setFontFamily(attrsSame, "Courier New"); StyleConstants.setFontSize(attrsSame, 12); StyleConstants.setForeground(attrsSame, Color.black); StyleConstants.setFontFamily(attrsMsg, "Courier New"); StyleConstants.setFontSize(attrsMsg, 12); StyleConstants.setForeground(attrsMsg, Color.orange); try { List sourceTablesList = source.getChildren(); List targetTablesList = target.getChildren(); Iterator it = sourceTablesList.iterator(); while (it.hasNext()) { SQLObject table = (SQLObject) it.next(); if ( table instanceof SQLTable ) { SQLTable targetTable = targetSQLSchema.getTableByName( table.getName() ); if ( targetTable == null ) { output.insertString(output.getLength(), "<<<TABLE NOT FOUND IN " + targetDatabase.getDataSource().getDisplayName() + "." + targetSchemaDropdown.getSelectedItem() + ">>>" + newline, attrsMsg ); output.insertString(output.getLength(), table.toString() + newline, attrsSource ); } else { output.insertString(output.getLength(), newline + table.toString() + newline, attrsSame ); Iterator it2 = (((SQLTable)table).getColumns()).iterator(); while (it2.hasNext()) { SQLObject column = (SQLObject) it2.next(); if ( column instanceof SQLColumn ) { SQLColumn targetColumn = targetTable.getColumnByName( ((SQLColumn)column).getName() ); if ( targetColumn == null ) { output.insertString(output.getLength(), " <<<NEW COLUMN>>>" + newline, attrsMsg ); output.insertString(output.getLength(), " " + ((SQLColumn)column).toString() + newline, attrsSource ); } else { if ( ((SQLColumn)column).getType() != targetColumn.getType() ) { output.insertString(output.getLength(), " <<<DIFFERENT DATA TYPE>>>" + newline, attrsMsg ); output.insertString(output.getLength(), " " + ((SQLColumn)column).getName(), attrsSame ); output.insertString(output.getLength(), " " + ca.sqlpower.architect.swingui.SQLType.getTypeName(((SQLColumn)column).getType()) +"("+((SQLColumn)column).getScale()+")" + newline, attrsSource ); } else if ( ((SQLColumn)column).getScale() != targetColumn.getScale() ) { output.insertString(output.getLength(), " <<<DIFFERENT SCALE>>>" + newline, attrsMsg ); output.insertString(output.getLength(), " " + ((SQLColumn)column).getName() + " " + ca.sqlpower.architect.swingui.SQLType.getTypeName(((SQLColumn)column).getType()) , attrsSame ); output.insertString(output.getLength(), " ("+((SQLColumn)column).getScale()+")" + newline, attrsSource ); } else { output.insertString(output.getLength(), " " + ca.sqlpower.architect.swingui.SQLType.getTypeName(((SQLColumn)column).getType()) +"("+((SQLColumn)column).getScale()+")" + newline, attrsSame ); } // compare column data type/scale } // column } // is column } // while table children } // table exist } // is table progress++; } // schema children, while loop } catch ( ArchitectException exp ) { System.err.println(exp.toString()); } catch (BadLocationException ble) { System.err.println("Couldn't insert styled text."); } finally { finished = true; } SwingUtilities.invokeLater(new Runnable() { public void run() { outputTextPane.setDocument(output); } }); }
1,112,081
public void run() { if ( sourceInd ) { sourceSchemaDropdown.removeAllItems(); sourceSchemaDropdown.setVisible(true); Iterator it = schema.iterator(); while (it.hasNext()) { sourceSchemaDropdown.addItem((String)it.next()); } // If it has a schema set this enabled if (sourceSchemaDropdown.getItemCount() >0) { sourceSchemaDropdown.setEnabled(true); } sourceDatabase = db; } else { targetSchemaDropdown.removeAllItems(); targetSchemaDropdown.setVisible(true); Iterator it = schema.iterator(); while (it.hasNext()) { targetSchemaDropdown.addItem((String)it.next()); } // If it has a target set this enabled if (targetSchemaDropdown.getItemCount() >0) { targetSchemaDropdown.setEnabled(true); } sourceDatabase = db; } startCompareAction.enableIfPossible(); }
public void run() { if ( sourceInd ) { sourceSchemaDropdown.removeAllItems(); sourceSchemaDropdown.setVisible(true); Iterator it = schema.iterator(); while (it.hasNext()) { sourceSchemaDropdown.addItem((String)it.next()); } // If it has a schema set this enabled if (sourceSchemaDropdown.getItemCount() >0) { sourceSchemaDropdown.setEnabled(true); } sourceDatabase = db; } else { targetSchemaDropdown.removeAllItems(); targetSchemaDropdown.setVisible(true); Iterator it = schema.iterator(); while (it.hasNext()) { targetSchemaDropdown.addItem((String)it.next()); } // If it has a target set this enabled if (targetSchemaDropdown.getItemCount() >0) { targetSchemaDropdown.setEnabled(true); } sourceDatabase = db; } startCompareAction.enableIfPossible(); }
1,112,082
public Integer getJobSize() throws ArchitectException { return progressMonitor.getJobSize(); }
public Integer getJobSize() throws ArchitectException { return progressMonitor.getJobSize(); }
1,112,083
public int getProgress() throws ArchitectException { return progressMonitor.getProgress(); }
public int getProgress() throws ArchitectException { return progressMonitor.getProgress(); }
1,112,084
public boolean isFinished() throws ArchitectException { return progressMonitor.isFinished(); }
public boolean isFinished() throws ArchitectException { return progressMonitor.isFinished(); }
1,112,085
public void actionPerformed(ActionEvent e) { try { startCompareAction.setEnabled(false); SimpleAttributeSet attrsMsg = new SimpleAttributeSet(); StyleConstants.setFontFamily(attrsMsg, "Courier New"); StyleConstants.setFontSize(attrsMsg, 12); StyleConstants.setForeground(attrsMsg, Color.orange); sourceSQLSchema = sourceDatabase.getSchemaByName((String)sourceSchemaDropdown.getSelectedItem()); targetSQLSchema = targetDatabase.getSchemaByName((String)targetSchemaDropdown.getSelectedItem()); CompareSchemaWorker worker = new CompareSchemaWorker(sourceSQLSchema,targetSQLSchema); StyledDocument styledDoc = outputTextPane.getStyledDocument(); if (styledDoc instanceof AbstractDocument) { outputDoc = (AbstractDocument)styledDoc; } else { System.err.println("Text pane's document isn't an AbstractDocument!"); return; } outputDoc.insertString(outputDoc.getLength(), "Please wait..." + worker.getJobSize() + newline, attrsMsg ); CompareProgressWatcher watcher = new CompareProgressWatcher(progressBar,worker); new javax.swing.Timer(100, watcher).start(); new Thread(worker).start(); } catch ( ArchitectException exp) { logger.error("SchemaListerProgressWatcher failt2", exp); } catch (BadLocationException ble) { System.err.println("Couldn't insert styled text."); } }
public void actionPerformed(ActionEvent e) { try { startCompareAction.setEnabled(false); SimpleAttributeSet attrsMsg = new SimpleAttributeSet(); StyleConstants.setFontFamily(attrsMsg, "Courier New"); StyleConstants.setFontSize(attrsMsg, 12); StyleConstants.setForeground(attrsMsg, Color.orange); sourceSQLSchema = sourceDatabase.getSchemaByName((String)sourceSchemaDropdown.getSelectedItem()); targetSQLSchema = targetDatabase.getSchemaByName((String)targetSchemaDropdown.getSelectedItem()); CompareSchemaWorker worker = new CompareSchemaWorker(sourceSQLSchema,targetSQLSchema); StyledDocument styledDoc = outputTextPane.getStyledDocument(); if (styledDoc instanceof AbstractDocument) { outputDoc = (AbstractDocument)styledDoc; } else { System.err.println("Text pane's document isn't an AbstractDocument!"); return; } outputDoc.insertString(outputDoc.getLength(), "Please wait..." + worker.getJobSize() + newline, attrsMsg ); CompareProgressWatcher watcher = new CompareProgressWatcher(progressBar,worker); new javax.swing.Timer(100, watcher).start(); new Thread(worker).start(); } catch ( ArchitectException exp) { logger.error("SchemaListerProgressWatcher failt2", exp); } catch (BadLocationException ble) { System.err.println("Couldn't insert styled text."); } }
1,112,086
public void actionPerformed(ActionEvent e) { try { startCompareAction.setEnabled(false); SimpleAttributeSet attrsMsg = new SimpleAttributeSet(); StyleConstants.setFontFamily(attrsMsg, "Courier New"); StyleConstants.setFontSize(attrsMsg, 12); StyleConstants.setForeground(attrsMsg, Color.orange); sourceSQLSchema = sourceDatabase.getSchemaByName((String)sourceSchemaDropdown.getSelectedItem()); targetSQLSchema = targetDatabase.getSchemaByName((String)targetSchemaDropdown.getSelectedItem()); CompareSchemaWorker worker = new CompareSchemaWorker(sourceSQLSchema,targetSQLSchema); StyledDocument styledDoc = outputTextPane.getStyledDocument(); if (styledDoc instanceof AbstractDocument) { outputDoc = (AbstractDocument)styledDoc; } else { System.err.println("Text pane's document isn't an AbstractDocument!"); return; } outputDoc.insertString(outputDoc.getLength(), "Please wait..." + worker.getJobSize() + newline, attrsMsg ); CompareProgressWatcher watcher = new CompareProgressWatcher(progressBar,worker); new javax.swing.Timer(100, watcher).start(); new Thread(worker).start(); } catch ( ArchitectException exp) { logger.error("SchemaListerProgressWatcher failt2", exp); } catch (BadLocationException ble) { System.err.println("Couldn't insert styled text."); } }
public void actionPerformed(ActionEvent e) { try { startCompareAction.setEnabled(false); SimpleAttributeSet attrsMsg = new SimpleAttributeSet(); StyleConstants.setFontFamily(attrsMsg, "Courier New"); StyleConstants.setFontSize(attrsMsg, 12); StyleConstants.setForeground(attrsMsg, Color.orange); sourceSQLSchema = sourceDatabase.getSchemaByName((String)sourceSchemaDropdown.getSelectedItem()); targetSQLSchema = targetDatabase.getSchemaByName((String)targetSchemaDropdown.getSelectedItem()); CompareSchemaWorker worker = new CompareSchemaWorker(sourceSQLSchema,targetSQLSchema); StyledDocument styledDoc = outputTextPane.getStyledDocument(); if (styledDoc instanceof AbstractDocument) { outputDoc = (AbstractDocument)styledDoc; } else { System.err.println("Text pane's document isn't an AbstractDocument!"); return; } outputDoc.insertString(outputDoc.getLength(), "Please wait..." + worker.getJobSize() + newline, attrsMsg ); CompareProgressWatcher watcher = new CompareProgressWatcher(progressBar,worker); new javax.swing.Timer(100, watcher).start(); new Thread(worker).start(); } catch ( ArchitectException exp) { logger.error("SchemaListerProgressWatcher failt2", exp); } catch (BadLocationException ble) { System.err.println("Couldn't insert styled text."); } }
1,112,087
private void buildUI() { ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); // layout source database option/combox target combox JRadioButton sourcePlayPenRadio = new JRadioButton(); sourcePlayPenRadio.setName("sourcePlayPenRadio"); sourcePlayPenRadio.setActionCommand("Project"); sourcePlayPenRadio.setSelected(true); JRadioButton sourcePhysicalRadio = new JRadioButton(); sourcePhysicalRadio.setName("sourcePhysicalRadio"); sourcePhysicalRadio.setActionCommand("SQL Connection"); //Group the radio buttons. ButtonGroup sourceButtonGroup = new ButtonGroup(); sourceButtonGroup.add(sourcePlayPenRadio); sourceButtonGroup.add(sourcePhysicalRadio); //Register a listener for the radio buttons. sourcePlayPenRadio.addActionListener(new SourceOptionListener()); sourcePhysicalRadio.addActionListener(new SourceOptionListener()); sourceDatabaseDropdown = new JComboBox(); sourceDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { sourceDatabaseDropdown.addItem(ds); } sourceDatabaseDropdown.setName("sourceDatabaseDropdown"); sourceDatabaseDropdown.addActionListener(new ConnectionListener()); sourceDatabaseDropdown.setEnabled(false); sourceDatabaseDropdown.setRenderer(dataSourceRenderer); sourceNewConnButton = new JButton("New..."); sourceNewConnButton.setName("sourceNewConnButton"); sourceNewConnButton.setEnabled(false); sourceNewConnButton.addActionListener(newConnectionAction); sourceCatalogDropdown = new JComboBox(); sourceCatalogDropdown.setName("sourceCatalogDropdown"); sourceCatalogDropdown.setEnabled(false); sourceSchemaDropdown = new JComboBox(); sourceSchemaDropdown.setName("sourceSchemaDropdown"); sourceSchemaDropdown.setEnabled(false); targetDatabaseDropdown = new JComboBox(); targetDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { targetDatabaseDropdown.addItem(ds); } targetDatabaseDropdown.setName("targetDatabaseDropdown"); targetDatabaseDropdown.setRenderer(dataSourceRenderer); targetDatabaseDropdown.addActionListener(new ConnectionListener()); targetNewConnButton = new JButton("New..."); targetNewConnButton.setName("targetNewConnButton"); targetNewConnButton.setEnabled(true); targetNewConnButton.addActionListener(newConnectionAction); targetCatalogDropdown = new JComboBox(); targetCatalogDropdown.setName("targetCatalogDropdown"); targetCatalogDropdown.setEnabled(false); targetSchemaDropdown = new JComboBox(); targetSchemaDropdown.setName("targetSchemaDropdown"); targetSchemaDropdown.setEnabled(false); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setVisible(false); // layout compare methods check box and syntax combox JRadioButton sourceLikeTargetButton = new JRadioButton(); sourceLikeTargetButton.setName("sourceLikeTargetButton"); sourceLikeTargetButton.setActionCommand("source like target"); sourceLikeTargetButton.setSelected(false); JRadioButton targetLikeSourceButton = new JRadioButton( ); targetLikeSourceButton.setName("targetLikeSourceButton"); targetLikeSourceButton.setActionCommand("target like source"); targetLikeSourceButton.setSelected(false); JRadioButton justCompareButton = new JRadioButton(); justCompareButton.setName("justCompareButton"); justCompareButton.setActionCommand("compare"); justCompareButton.setSelected(true); //Group the radio buttons. ButtonGroup operationGroup = new ButtonGroup(); operationGroup.add(sourceLikeTargetButton); operationGroup.add(targetLikeSourceButton); operationGroup.add(justCompareButton); JComboBox sqlTypeDropdown = new JComboBox(DDLUtils.getDDLTypes()); sqlTypeDropdown.setName("sqlTypeDropDown"); OutputChoiceListener listener = new OutputChoiceListener(sqlTypeDropdown); JRadioButton sqlButton = new JRadioButton( ); sqlButton.setName("sqlButton"); sqlButton.setActionCommand("sqlButton"); sqlButton.setSelected(true); sqlButton.addActionListener(listener); JRadioButton englishButton = new JRadioButton(); englishButton.setName("englishButton"); englishButton.setActionCommand("english"); englishButton.setSelected(false); englishButton.addActionListener(listener); //Group the radio buttons. ButtonGroup outputGroup = new ButtonGroup(); outputGroup.add(sqlButton); outputGroup.add(englishButton); // outputDoc outputTextPane outputTextPane = new JTextPane(); outputTextPane.setCaretPosition(0); outputTextPane.setMargin(new Insets(5,5,5,5)); JScrollPane scrollPane = new JScrollPane(outputTextPane); scrollPane.setPreferredSize(new Dimension(300, 300)); startCompareAction = new StartCompareAction(); startCompareAction.setEnabled(false); buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); FormLayout formLayout = new FormLayout("20dlu, 2dlu, pref, 4dlu," + "pref:grow, 2dlu, pref, 4dlu," + "pref:grow, 4dlu, pref:grow", ""); formLayout.setColumnGroups(new int[][] {{5,9,11}}); JPanel panel = logger.isDebugEnabled() ? new FormDebugPanel() : new JPanel(); DefaultFormBuilder builder = new DefaultFormBuilder(formLayout, panel); builder.setDefaultDialogBorder(); CellConstraints cc = new CellConstraints(); builder.appendSeparator("Compare Source"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePlayPenRadio); builder.append("Project ["+project.getName()+"]"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePhysicalRadio); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(sourceDatabaseDropdown); builder.append(sourceNewConnButton, sourceCatalogDropdown, sourceSchemaDropdown); builder.appendSeparator("With Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(targetDatabaseDropdown); builder.append(targetNewConnButton, targetCatalogDropdown, targetSchemaDropdown); builder.appendSeparator("Output Format"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sqlButton); JPanel ddlTypePanel = new JPanel(new BorderLayout(3,3)); ddlTypePanel.add(new JLabel("SQL for"), BorderLayout.WEST); ddlTypePanel.add(sqlTypeDropdown, BorderLayout.CENTER); // ddl generator type list builder.append(ddlTypePanel); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(englishButton); builder.append("English descriptions"); builder.nextLine(); builder.appendSeparator("Comparison Sense"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sourceLikeTargetButton); builder.append("How to make Source like Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(targetLikeSourceButton); builder.append("How to make Target like Source"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(justCompareButton); builder.append("Show all differences"); builder.nextLine(); builder.appendSeparator("Status"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.add(new JLabel(""), cc.xy(5, builder.getRow())); builder.add(progressBar, cc.xyw(7, builder.getRow(), 5)); setLayout(new BorderLayout()); add(builder.getPanel()); }
private void buildUI() { ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); // layout source database option/combox target combox sourcePlayPenRadio = new JRadioButton(); sourcePlayPenRadio.setName("sourcePlayPenRadio"); sourcePlayPenRadio.setActionCommand("Project"); sourcePlayPenRadio.setSelected(true); JRadioButton sourcePhysicalRadio = new JRadioButton(); sourcePhysicalRadio.setName("sourcePhysicalRadio"); sourcePhysicalRadio.setActionCommand("SQL Connection"); //Group the radio buttons. ButtonGroup sourceButtonGroup = new ButtonGroup(); sourceButtonGroup.add(sourcePlayPenRadio); sourceButtonGroup.add(sourcePhysicalRadio); //Register a listener for the radio buttons. sourcePlayPenRadio.addActionListener(new SourceOptionListener()); sourcePhysicalRadio.addActionListener(new SourceOptionListener()); sourceDatabaseDropdown = new JComboBox(); sourceDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { sourceDatabaseDropdown.addItem(ds); } sourceDatabaseDropdown.setName("sourceDatabaseDropdown"); sourceDatabaseDropdown.addActionListener(new ConnectionListener()); sourceDatabaseDropdown.setEnabled(false); sourceDatabaseDropdown.setRenderer(dataSourceRenderer); sourceNewConnButton = new JButton("New..."); sourceNewConnButton.setName("sourceNewConnButton"); sourceNewConnButton.setEnabled(false); sourceNewConnButton.addActionListener(newConnectionAction); sourceCatalogDropdown = new JComboBox(); sourceCatalogDropdown.setName("sourceCatalogDropdown"); sourceCatalogDropdown.setEnabled(false); sourceSchemaDropdown = new JComboBox(); sourceSchemaDropdown.setName("sourceSchemaDropdown"); sourceSchemaDropdown.setEnabled(false); targetDatabaseDropdown = new JComboBox(); targetDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { targetDatabaseDropdown.addItem(ds); } targetDatabaseDropdown.setName("targetDatabaseDropdown"); targetDatabaseDropdown.setRenderer(dataSourceRenderer); targetDatabaseDropdown.addActionListener(new ConnectionListener()); targetNewConnButton = new JButton("New..."); targetNewConnButton.setName("targetNewConnButton"); targetNewConnButton.setEnabled(true); targetNewConnButton.addActionListener(newConnectionAction); targetCatalogDropdown = new JComboBox(); targetCatalogDropdown.setName("targetCatalogDropdown"); targetCatalogDropdown.setEnabled(false); targetSchemaDropdown = new JComboBox(); targetSchemaDropdown.setName("targetSchemaDropdown"); targetSchemaDropdown.setEnabled(false); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setVisible(false); // layout compare methods check box and syntax combox JRadioButton sourceLikeTargetButton = new JRadioButton(); sourceLikeTargetButton.setName("sourceLikeTargetButton"); sourceLikeTargetButton.setActionCommand("source like target"); sourceLikeTargetButton.setSelected(false); JRadioButton targetLikeSourceButton = new JRadioButton( ); targetLikeSourceButton.setName("targetLikeSourceButton"); targetLikeSourceButton.setActionCommand("target like source"); targetLikeSourceButton.setSelected(false); JRadioButton justCompareButton = new JRadioButton(); justCompareButton.setName("justCompareButton"); justCompareButton.setActionCommand("compare"); justCompareButton.setSelected(true); //Group the radio buttons. ButtonGroup operationGroup = new ButtonGroup(); operationGroup.add(sourceLikeTargetButton); operationGroup.add(targetLikeSourceButton); operationGroup.add(justCompareButton); JComboBox sqlTypeDropdown = new JComboBox(DDLUtils.getDDLTypes()); sqlTypeDropdown.setName("sqlTypeDropDown"); OutputChoiceListener listener = new OutputChoiceListener(sqlTypeDropdown); JRadioButton sqlButton = new JRadioButton( ); sqlButton.setName("sqlButton"); sqlButton.setActionCommand("sqlButton"); sqlButton.setSelected(true); sqlButton.addActionListener(listener); JRadioButton englishButton = new JRadioButton(); englishButton.setName("englishButton"); englishButton.setActionCommand("english"); englishButton.setSelected(false); englishButton.addActionListener(listener); //Group the radio buttons. ButtonGroup outputGroup = new ButtonGroup(); outputGroup.add(sqlButton); outputGroup.add(englishButton); // outputDoc outputTextPane outputTextPane = new JTextPane(); outputTextPane.setCaretPosition(0); outputTextPane.setMargin(new Insets(5,5,5,5)); JScrollPane scrollPane = new JScrollPane(outputTextPane); scrollPane.setPreferredSize(new Dimension(300, 300)); startCompareAction = new StartCompareAction(); startCompareAction.setEnabled(false); buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); FormLayout formLayout = new FormLayout("20dlu, 2dlu, pref, 4dlu," + "pref:grow, 2dlu, pref, 4dlu," + "pref:grow, 4dlu, pref:grow", ""); formLayout.setColumnGroups(new int[][] {{5,9,11}}); JPanel panel = logger.isDebugEnabled() ? new FormDebugPanel() : new JPanel(); DefaultFormBuilder builder = new DefaultFormBuilder(formLayout, panel); builder.setDefaultDialogBorder(); CellConstraints cc = new CellConstraints(); builder.appendSeparator("Compare Source"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePlayPenRadio); builder.append("Project ["+project.getName()+"]"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePhysicalRadio); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(sourceDatabaseDropdown); builder.append(sourceNewConnButton, sourceCatalogDropdown, sourceSchemaDropdown); builder.appendSeparator("With Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(targetDatabaseDropdown); builder.append(targetNewConnButton, targetCatalogDropdown, targetSchemaDropdown); builder.appendSeparator("Output Format"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sqlButton); JPanel ddlTypePanel = new JPanel(new BorderLayout(3,3)); ddlTypePanel.add(new JLabel("SQL for"), BorderLayout.WEST); ddlTypePanel.add(sqlTypeDropdown, BorderLayout.CENTER); // ddl generator type list builder.append(ddlTypePanel); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(englishButton); builder.append("English descriptions"); builder.nextLine(); builder.appendSeparator("Comparison Sense"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sourceLikeTargetButton); builder.append("How to make Source like Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(targetLikeSourceButton); builder.append("How to make Target like Source"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(justCompareButton); builder.append("Show all differences"); builder.nextLine(); builder.appendSeparator("Status"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.add(new JLabel(""), cc.xy(5, builder.getRow())); builder.add(progressBar, cc.xyw(7, builder.getRow(), 5)); setLayout(new BorderLayout()); add(builder.getPanel()); }
1,112,088
private void buildUI() { ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); // layout source database option/combox target combox JRadioButton sourcePlayPenRadio = new JRadioButton(); sourcePlayPenRadio.setName("sourcePlayPenRadio"); sourcePlayPenRadio.setActionCommand("Project"); sourcePlayPenRadio.setSelected(true); JRadioButton sourcePhysicalRadio = new JRadioButton(); sourcePhysicalRadio.setName("sourcePhysicalRadio"); sourcePhysicalRadio.setActionCommand("SQL Connection"); //Group the radio buttons. ButtonGroup sourceButtonGroup = new ButtonGroup(); sourceButtonGroup.add(sourcePlayPenRadio); sourceButtonGroup.add(sourcePhysicalRadio); //Register a listener for the radio buttons. sourcePlayPenRadio.addActionListener(new SourceOptionListener()); sourcePhysicalRadio.addActionListener(new SourceOptionListener()); sourceDatabaseDropdown = new JComboBox(); sourceDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { sourceDatabaseDropdown.addItem(ds); } sourceDatabaseDropdown.setName("sourceDatabaseDropdown"); sourceDatabaseDropdown.addActionListener(new ConnectionListener()); sourceDatabaseDropdown.setEnabled(false); sourceDatabaseDropdown.setRenderer(dataSourceRenderer); sourceNewConnButton = new JButton("New..."); sourceNewConnButton.setName("sourceNewConnButton"); sourceNewConnButton.setEnabled(false); sourceNewConnButton.addActionListener(newConnectionAction); sourceCatalogDropdown = new JComboBox(); sourceCatalogDropdown.setName("sourceCatalogDropdown"); sourceCatalogDropdown.setEnabled(false); sourceSchemaDropdown = new JComboBox(); sourceSchemaDropdown.setName("sourceSchemaDropdown"); sourceSchemaDropdown.setEnabled(false); targetDatabaseDropdown = new JComboBox(); targetDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { targetDatabaseDropdown.addItem(ds); } targetDatabaseDropdown.setName("targetDatabaseDropdown"); targetDatabaseDropdown.setRenderer(dataSourceRenderer); targetDatabaseDropdown.addActionListener(new ConnectionListener()); targetNewConnButton = new JButton("New..."); targetNewConnButton.setName("targetNewConnButton"); targetNewConnButton.setEnabled(true); targetNewConnButton.addActionListener(newConnectionAction); targetCatalogDropdown = new JComboBox(); targetCatalogDropdown.setName("targetCatalogDropdown"); targetCatalogDropdown.setEnabled(false); targetSchemaDropdown = new JComboBox(); targetSchemaDropdown.setName("targetSchemaDropdown"); targetSchemaDropdown.setEnabled(false); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setVisible(false); // layout compare methods check box and syntax combox JRadioButton sourceLikeTargetButton = new JRadioButton(); sourceLikeTargetButton.setName("sourceLikeTargetButton"); sourceLikeTargetButton.setActionCommand("source like target"); sourceLikeTargetButton.setSelected(false); JRadioButton targetLikeSourceButton = new JRadioButton( ); targetLikeSourceButton.setName("targetLikeSourceButton"); targetLikeSourceButton.setActionCommand("target like source"); targetLikeSourceButton.setSelected(false); JRadioButton justCompareButton = new JRadioButton(); justCompareButton.setName("justCompareButton"); justCompareButton.setActionCommand("compare"); justCompareButton.setSelected(true); //Group the radio buttons. ButtonGroup operationGroup = new ButtonGroup(); operationGroup.add(sourceLikeTargetButton); operationGroup.add(targetLikeSourceButton); operationGroup.add(justCompareButton); JComboBox sqlTypeDropdown = new JComboBox(DDLUtils.getDDLTypes()); sqlTypeDropdown.setName("sqlTypeDropDown"); OutputChoiceListener listener = new OutputChoiceListener(sqlTypeDropdown); JRadioButton sqlButton = new JRadioButton( ); sqlButton.setName("sqlButton"); sqlButton.setActionCommand("sqlButton"); sqlButton.setSelected(true); sqlButton.addActionListener(listener); JRadioButton englishButton = new JRadioButton(); englishButton.setName("englishButton"); englishButton.setActionCommand("english"); englishButton.setSelected(false); englishButton.addActionListener(listener); //Group the radio buttons. ButtonGroup outputGroup = new ButtonGroup(); outputGroup.add(sqlButton); outputGroup.add(englishButton); // outputDoc outputTextPane outputTextPane = new JTextPane(); outputTextPane.setCaretPosition(0); outputTextPane.setMargin(new Insets(5,5,5,5)); JScrollPane scrollPane = new JScrollPane(outputTextPane); scrollPane.setPreferredSize(new Dimension(300, 300)); startCompareAction = new StartCompareAction(); startCompareAction.setEnabled(false); buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); FormLayout formLayout = new FormLayout("20dlu, 2dlu, pref, 4dlu," + "pref:grow, 2dlu, pref, 4dlu," + "pref:grow, 4dlu, pref:grow", ""); formLayout.setColumnGroups(new int[][] {{5,9,11}}); JPanel panel = logger.isDebugEnabled() ? new FormDebugPanel() : new JPanel(); DefaultFormBuilder builder = new DefaultFormBuilder(formLayout, panel); builder.setDefaultDialogBorder(); CellConstraints cc = new CellConstraints(); builder.appendSeparator("Compare Source"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePlayPenRadio); builder.append("Project ["+project.getName()+"]"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePhysicalRadio); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(sourceDatabaseDropdown); builder.append(sourceNewConnButton, sourceCatalogDropdown, sourceSchemaDropdown); builder.appendSeparator("With Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(targetDatabaseDropdown); builder.append(targetNewConnButton, targetCatalogDropdown, targetSchemaDropdown); builder.appendSeparator("Output Format"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sqlButton); JPanel ddlTypePanel = new JPanel(new BorderLayout(3,3)); ddlTypePanel.add(new JLabel("SQL for"), BorderLayout.WEST); ddlTypePanel.add(sqlTypeDropdown, BorderLayout.CENTER); // ddl generator type list builder.append(ddlTypePanel); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(englishButton); builder.append("English descriptions"); builder.nextLine(); builder.appendSeparator("Comparison Sense"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sourceLikeTargetButton); builder.append("How to make Source like Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(targetLikeSourceButton); builder.append("How to make Target like Source"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(justCompareButton); builder.append("Show all differences"); builder.nextLine(); builder.appendSeparator("Status"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.add(new JLabel(""), cc.xy(5, builder.getRow())); builder.add(progressBar, cc.xyw(7, builder.getRow(), 5)); setLayout(new BorderLayout()); add(builder.getPanel()); }
private void buildUI() { ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); // layout source database option/combox target combox JRadioButton sourcePlayPenRadio = new JRadioButton(); sourcePlayPenRadio.setName("sourcePlayPenRadio"); sourcePlayPenRadio.setActionCommand("Project"); sourcePlayPenRadio.setSelected(true); sourcePhysicalRadio = new JRadioButton(); sourcePhysicalRadio.setName("sourcePhysicalRadio"); sourcePhysicalRadio.setActionCommand("SQL Connection"); //Group the radio buttons. ButtonGroup sourceButtonGroup = new ButtonGroup(); sourceButtonGroup.add(sourcePlayPenRadio); sourceButtonGroup.add(sourcePhysicalRadio); //Register a listener for the radio buttons. sourcePlayPenRadio.addActionListener(new SourceOptionListener()); sourcePhysicalRadio.addActionListener(new SourceOptionListener()); sourceDatabaseDropdown = new JComboBox(); sourceDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { sourceDatabaseDropdown.addItem(ds); } sourceDatabaseDropdown.setName("sourceDatabaseDropdown"); sourceDatabaseDropdown.addActionListener(new ConnectionListener()); sourceDatabaseDropdown.setEnabled(false); sourceDatabaseDropdown.setRenderer(dataSourceRenderer); sourceNewConnButton = new JButton("New..."); sourceNewConnButton.setName("sourceNewConnButton"); sourceNewConnButton.setEnabled(false); sourceNewConnButton.addActionListener(newConnectionAction); sourceCatalogDropdown = new JComboBox(); sourceCatalogDropdown.setName("sourceCatalogDropdown"); sourceCatalogDropdown.setEnabled(false); sourceSchemaDropdown = new JComboBox(); sourceSchemaDropdown.setName("sourceSchemaDropdown"); sourceSchemaDropdown.setEnabled(false); targetDatabaseDropdown = new JComboBox(); targetDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { targetDatabaseDropdown.addItem(ds); } targetDatabaseDropdown.setName("targetDatabaseDropdown"); targetDatabaseDropdown.setRenderer(dataSourceRenderer); targetDatabaseDropdown.addActionListener(new ConnectionListener()); targetNewConnButton = new JButton("New..."); targetNewConnButton.setName("targetNewConnButton"); targetNewConnButton.setEnabled(true); targetNewConnButton.addActionListener(newConnectionAction); targetCatalogDropdown = new JComboBox(); targetCatalogDropdown.setName("targetCatalogDropdown"); targetCatalogDropdown.setEnabled(false); targetSchemaDropdown = new JComboBox(); targetSchemaDropdown.setName("targetSchemaDropdown"); targetSchemaDropdown.setEnabled(false); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setVisible(false); // layout compare methods check box and syntax combox JRadioButton sourceLikeTargetButton = new JRadioButton(); sourceLikeTargetButton.setName("sourceLikeTargetButton"); sourceLikeTargetButton.setActionCommand("source like target"); sourceLikeTargetButton.setSelected(false); JRadioButton targetLikeSourceButton = new JRadioButton( ); targetLikeSourceButton.setName("targetLikeSourceButton"); targetLikeSourceButton.setActionCommand("target like source"); targetLikeSourceButton.setSelected(false); JRadioButton justCompareButton = new JRadioButton(); justCompareButton.setName("justCompareButton"); justCompareButton.setActionCommand("compare"); justCompareButton.setSelected(true); //Group the radio buttons. ButtonGroup operationGroup = new ButtonGroup(); operationGroup.add(sourceLikeTargetButton); operationGroup.add(targetLikeSourceButton); operationGroup.add(justCompareButton); JComboBox sqlTypeDropdown = new JComboBox(DDLUtils.getDDLTypes()); sqlTypeDropdown.setName("sqlTypeDropDown"); OutputChoiceListener listener = new OutputChoiceListener(sqlTypeDropdown); JRadioButton sqlButton = new JRadioButton( ); sqlButton.setName("sqlButton"); sqlButton.setActionCommand("sqlButton"); sqlButton.setSelected(true); sqlButton.addActionListener(listener); JRadioButton englishButton = new JRadioButton(); englishButton.setName("englishButton"); englishButton.setActionCommand("english"); englishButton.setSelected(false); englishButton.addActionListener(listener); //Group the radio buttons. ButtonGroup outputGroup = new ButtonGroup(); outputGroup.add(sqlButton); outputGroup.add(englishButton); // outputDoc outputTextPane outputTextPane = new JTextPane(); outputTextPane.setCaretPosition(0); outputTextPane.setMargin(new Insets(5,5,5,5)); JScrollPane scrollPane = new JScrollPane(outputTextPane); scrollPane.setPreferredSize(new Dimension(300, 300)); startCompareAction = new StartCompareAction(); startCompareAction.setEnabled(false); buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); FormLayout formLayout = new FormLayout("20dlu, 2dlu, pref, 4dlu," + "pref:grow, 2dlu, pref, 4dlu," + "pref:grow, 4dlu, pref:grow", ""); formLayout.setColumnGroups(new int[][] {{5,9,11}}); JPanel panel = logger.isDebugEnabled() ? new FormDebugPanel() : new JPanel(); DefaultFormBuilder builder = new DefaultFormBuilder(formLayout, panel); builder.setDefaultDialogBorder(); CellConstraints cc = new CellConstraints(); builder.appendSeparator("Compare Source"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePlayPenRadio); builder.append("Project ["+project.getName()+"]"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePhysicalRadio); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(sourceDatabaseDropdown); builder.append(sourceNewConnButton, sourceCatalogDropdown, sourceSchemaDropdown); builder.appendSeparator("With Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(targetDatabaseDropdown); builder.append(targetNewConnButton, targetCatalogDropdown, targetSchemaDropdown); builder.appendSeparator("Output Format"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sqlButton); JPanel ddlTypePanel = new JPanel(new BorderLayout(3,3)); ddlTypePanel.add(new JLabel("SQL for"), BorderLayout.WEST); ddlTypePanel.add(sqlTypeDropdown, BorderLayout.CENTER); // ddl generator type list builder.append(ddlTypePanel); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(englishButton); builder.append("English descriptions"); builder.nextLine(); builder.appendSeparator("Comparison Sense"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sourceLikeTargetButton); builder.append("How to make Source like Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(targetLikeSourceButton); builder.append("How to make Target like Source"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(justCompareButton); builder.append("Show all differences"); builder.nextLine(); builder.appendSeparator("Status"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.add(new JLabel(""), cc.xy(5, builder.getRow())); builder.add(progressBar, cc.xyw(7, builder.getRow(), 5)); setLayout(new BorderLayout()); add(builder.getPanel()); }
1,112,089
private void buildUI() { ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); // layout source database option/combox target combox JRadioButton sourcePlayPenRadio = new JRadioButton(); sourcePlayPenRadio.setName("sourcePlayPenRadio"); sourcePlayPenRadio.setActionCommand("Project"); sourcePlayPenRadio.setSelected(true); JRadioButton sourcePhysicalRadio = new JRadioButton(); sourcePhysicalRadio.setName("sourcePhysicalRadio"); sourcePhysicalRadio.setActionCommand("SQL Connection"); //Group the radio buttons. ButtonGroup sourceButtonGroup = new ButtonGroup(); sourceButtonGroup.add(sourcePlayPenRadio); sourceButtonGroup.add(sourcePhysicalRadio); //Register a listener for the radio buttons. sourcePlayPenRadio.addActionListener(new SourceOptionListener()); sourcePhysicalRadio.addActionListener(new SourceOptionListener()); sourceDatabaseDropdown = new JComboBox(); sourceDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { sourceDatabaseDropdown.addItem(ds); } sourceDatabaseDropdown.setName("sourceDatabaseDropdown"); sourceDatabaseDropdown.addActionListener(new ConnectionListener()); sourceDatabaseDropdown.setEnabled(false); sourceDatabaseDropdown.setRenderer(dataSourceRenderer); sourceNewConnButton = new JButton("New..."); sourceNewConnButton.setName("sourceNewConnButton"); sourceNewConnButton.setEnabled(false); sourceNewConnButton.addActionListener(newConnectionAction); sourceCatalogDropdown = new JComboBox(); sourceCatalogDropdown.setName("sourceCatalogDropdown"); sourceCatalogDropdown.setEnabled(false); sourceSchemaDropdown = new JComboBox(); sourceSchemaDropdown.setName("sourceSchemaDropdown"); sourceSchemaDropdown.setEnabled(false); targetDatabaseDropdown = new JComboBox(); targetDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { targetDatabaseDropdown.addItem(ds); } targetDatabaseDropdown.setName("targetDatabaseDropdown"); targetDatabaseDropdown.setRenderer(dataSourceRenderer); targetDatabaseDropdown.addActionListener(new ConnectionListener()); targetNewConnButton = new JButton("New..."); targetNewConnButton.setName("targetNewConnButton"); targetNewConnButton.setEnabled(true); targetNewConnButton.addActionListener(newConnectionAction); targetCatalogDropdown = new JComboBox(); targetCatalogDropdown.setName("targetCatalogDropdown"); targetCatalogDropdown.setEnabled(false); targetSchemaDropdown = new JComboBox(); targetSchemaDropdown.setName("targetSchemaDropdown"); targetSchemaDropdown.setEnabled(false); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setVisible(false); // layout compare methods check box and syntax combox JRadioButton sourceLikeTargetButton = new JRadioButton(); sourceLikeTargetButton.setName("sourceLikeTargetButton"); sourceLikeTargetButton.setActionCommand("source like target"); sourceLikeTargetButton.setSelected(false); JRadioButton targetLikeSourceButton = new JRadioButton( ); targetLikeSourceButton.setName("targetLikeSourceButton"); targetLikeSourceButton.setActionCommand("target like source"); targetLikeSourceButton.setSelected(false); JRadioButton justCompareButton = new JRadioButton(); justCompareButton.setName("justCompareButton"); justCompareButton.setActionCommand("compare"); justCompareButton.setSelected(true); //Group the radio buttons. ButtonGroup operationGroup = new ButtonGroup(); operationGroup.add(sourceLikeTargetButton); operationGroup.add(targetLikeSourceButton); operationGroup.add(justCompareButton); JComboBox sqlTypeDropdown = new JComboBox(DDLUtils.getDDLTypes()); sqlTypeDropdown.setName("sqlTypeDropDown"); OutputChoiceListener listener = new OutputChoiceListener(sqlTypeDropdown); JRadioButton sqlButton = new JRadioButton( ); sqlButton.setName("sqlButton"); sqlButton.setActionCommand("sqlButton"); sqlButton.setSelected(true); sqlButton.addActionListener(listener); JRadioButton englishButton = new JRadioButton(); englishButton.setName("englishButton"); englishButton.setActionCommand("english"); englishButton.setSelected(false); englishButton.addActionListener(listener); //Group the radio buttons. ButtonGroup outputGroup = new ButtonGroup(); outputGroup.add(sqlButton); outputGroup.add(englishButton); // outputDoc outputTextPane outputTextPane = new JTextPane(); outputTextPane.setCaretPosition(0); outputTextPane.setMargin(new Insets(5,5,5,5)); JScrollPane scrollPane = new JScrollPane(outputTextPane); scrollPane.setPreferredSize(new Dimension(300, 300)); startCompareAction = new StartCompareAction(); startCompareAction.setEnabled(false); buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); FormLayout formLayout = new FormLayout("20dlu, 2dlu, pref, 4dlu," + "pref:grow, 2dlu, pref, 4dlu," + "pref:grow, 4dlu, pref:grow", ""); formLayout.setColumnGroups(new int[][] {{5,9,11}}); JPanel panel = logger.isDebugEnabled() ? new FormDebugPanel() : new JPanel(); DefaultFormBuilder builder = new DefaultFormBuilder(formLayout, panel); builder.setDefaultDialogBorder(); CellConstraints cc = new CellConstraints(); builder.appendSeparator("Compare Source"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePlayPenRadio); builder.append("Project ["+project.getName()+"]"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePhysicalRadio); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(sourceDatabaseDropdown); builder.append(sourceNewConnButton, sourceCatalogDropdown, sourceSchemaDropdown); builder.appendSeparator("With Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(targetDatabaseDropdown); builder.append(targetNewConnButton, targetCatalogDropdown, targetSchemaDropdown); builder.appendSeparator("Output Format"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sqlButton); JPanel ddlTypePanel = new JPanel(new BorderLayout(3,3)); ddlTypePanel.add(new JLabel("SQL for"), BorderLayout.WEST); ddlTypePanel.add(sqlTypeDropdown, BorderLayout.CENTER); // ddl generator type list builder.append(ddlTypePanel); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(englishButton); builder.append("English descriptions"); builder.nextLine(); builder.appendSeparator("Comparison Sense"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sourceLikeTargetButton); builder.append("How to make Source like Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(targetLikeSourceButton); builder.append("How to make Target like Source"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(justCompareButton); builder.append("Show all differences"); builder.nextLine(); builder.appendSeparator("Status"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.add(new JLabel(""), cc.xy(5, builder.getRow())); builder.add(progressBar, cc.xyw(7, builder.getRow(), 5)); setLayout(new BorderLayout()); add(builder.getPanel()); }
private void buildUI() { ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); // layout source database option/combox target combox JRadioButton sourcePlayPenRadio = new JRadioButton(); sourcePlayPenRadio.setName("sourcePlayPenRadio"); sourcePlayPenRadio.setActionCommand("Project"); sourcePlayPenRadio.setSelected(true); JRadioButton sourcePhysicalRadio = new JRadioButton(); sourcePhysicalRadio.setName("sourcePhysicalRadio"); sourcePhysicalRadio.setActionCommand("SQL Connection"); //Group the radio buttons. ButtonGroup sourceButtonGroup = new ButtonGroup(); sourceButtonGroup.add(sourcePlayPenRadio); sourceButtonGroup.add(sourcePhysicalRadio); //Register a listener for the radio buttons. sourcePlayPenRadio.addActionListener(new SourceOptionListener()); sourcePhysicalRadio.addActionListener(new SourceOptionListener()); sourceDatabaseDropdown = new JComboBox(); sourceDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { sourceDatabaseDropdown.addItem(ds); } sourceDatabaseDropdown.setName("sourceDatabaseDropdown"); sourceDatabaseDropdown.addActionListener(new CatalogPopulator(sourceSchemaDropdown,sourceCatalogDropdown)); sourceDatabaseDropdown.setEnabled(false); sourceDatabaseDropdown.setRenderer(dataSourceRenderer); sourceNewConnButton = new JButton("New..."); sourceNewConnButton.setName("sourceNewConnButton"); sourceNewConnButton.setEnabled(false); sourceNewConnButton.addActionListener(newConnectionAction); sourceCatalogDropdown = new JComboBox(); sourceCatalogDropdown.setName("sourceCatalogDropdown"); sourceCatalogDropdown.setEnabled(false); sourceSchemaDropdown = new JComboBox(); sourceSchemaDropdown.setName("sourceSchemaDropdown"); sourceSchemaDropdown.setEnabled(false); targetDatabaseDropdown = new JComboBox(); targetDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { targetDatabaseDropdown.addItem(ds); } targetDatabaseDropdown.setName("targetDatabaseDropdown"); targetDatabaseDropdown.setRenderer(dataSourceRenderer); targetDatabaseDropdown.addActionListener(new ConnectionListener()); targetNewConnButton = new JButton("New..."); targetNewConnButton.setName("targetNewConnButton"); targetNewConnButton.setEnabled(true); targetNewConnButton.addActionListener(newConnectionAction); targetCatalogDropdown = new JComboBox(); targetCatalogDropdown.setName("targetCatalogDropdown"); targetCatalogDropdown.setEnabled(false); targetSchemaDropdown = new JComboBox(); targetSchemaDropdown.setName("targetSchemaDropdown"); targetSchemaDropdown.setEnabled(false); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setVisible(false); // layout compare methods check box and syntax combox JRadioButton sourceLikeTargetButton = new JRadioButton(); sourceLikeTargetButton.setName("sourceLikeTargetButton"); sourceLikeTargetButton.setActionCommand("source like target"); sourceLikeTargetButton.setSelected(false); JRadioButton targetLikeSourceButton = new JRadioButton( ); targetLikeSourceButton.setName("targetLikeSourceButton"); targetLikeSourceButton.setActionCommand("target like source"); targetLikeSourceButton.setSelected(false); JRadioButton justCompareButton = new JRadioButton(); justCompareButton.setName("justCompareButton"); justCompareButton.setActionCommand("compare"); justCompareButton.setSelected(true); //Group the radio buttons. ButtonGroup operationGroup = new ButtonGroup(); operationGroup.add(sourceLikeTargetButton); operationGroup.add(targetLikeSourceButton); operationGroup.add(justCompareButton); JComboBox sqlTypeDropdown = new JComboBox(DDLUtils.getDDLTypes()); sqlTypeDropdown.setName("sqlTypeDropDown"); OutputChoiceListener listener = new OutputChoiceListener(sqlTypeDropdown); JRadioButton sqlButton = new JRadioButton( ); sqlButton.setName("sqlButton"); sqlButton.setActionCommand("sqlButton"); sqlButton.setSelected(true); sqlButton.addActionListener(listener); JRadioButton englishButton = new JRadioButton(); englishButton.setName("englishButton"); englishButton.setActionCommand("english"); englishButton.setSelected(false); englishButton.addActionListener(listener); //Group the radio buttons. ButtonGroup outputGroup = new ButtonGroup(); outputGroup.add(sqlButton); outputGroup.add(englishButton); // outputDoc outputTextPane outputTextPane = new JTextPane(); outputTextPane.setCaretPosition(0); outputTextPane.setMargin(new Insets(5,5,5,5)); JScrollPane scrollPane = new JScrollPane(outputTextPane); scrollPane.setPreferredSize(new Dimension(300, 300)); startCompareAction = new StartCompareAction(); startCompareAction.setEnabled(false); buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); FormLayout formLayout = new FormLayout("20dlu, 2dlu, pref, 4dlu," + "pref:grow, 2dlu, pref, 4dlu," + "pref:grow, 4dlu, pref:grow", ""); formLayout.setColumnGroups(new int[][] {{5,9,11}}); JPanel panel = logger.isDebugEnabled() ? new FormDebugPanel() : new JPanel(); DefaultFormBuilder builder = new DefaultFormBuilder(formLayout, panel); builder.setDefaultDialogBorder(); CellConstraints cc = new CellConstraints(); builder.appendSeparator("Compare Source"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePlayPenRadio); builder.append("Project ["+project.getName()+"]"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePhysicalRadio); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(sourceDatabaseDropdown); builder.append(sourceNewConnButton, sourceCatalogDropdown, sourceSchemaDropdown); builder.appendSeparator("With Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(targetDatabaseDropdown); builder.append(targetNewConnButton, targetCatalogDropdown, targetSchemaDropdown); builder.appendSeparator("Output Format"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sqlButton); JPanel ddlTypePanel = new JPanel(new BorderLayout(3,3)); ddlTypePanel.add(new JLabel("SQL for"), BorderLayout.WEST); ddlTypePanel.add(sqlTypeDropdown, BorderLayout.CENTER); // ddl generator type list builder.append(ddlTypePanel); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(englishButton); builder.append("English descriptions"); builder.nextLine(); builder.appendSeparator("Comparison Sense"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sourceLikeTargetButton); builder.append("How to make Source like Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(targetLikeSourceButton); builder.append("How to make Target like Source"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(justCompareButton); builder.append("Show all differences"); builder.nextLine(); builder.appendSeparator("Status"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.add(new JLabel(""), cc.xy(5, builder.getRow())); builder.add(progressBar, cc.xyw(7, builder.getRow(), 5)); setLayout(new BorderLayout()); add(builder.getPanel()); }
1,112,090
private void buildUI() { ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); // layout source database option/combox target combox JRadioButton sourcePlayPenRadio = new JRadioButton(); sourcePlayPenRadio.setName("sourcePlayPenRadio"); sourcePlayPenRadio.setActionCommand("Project"); sourcePlayPenRadio.setSelected(true); JRadioButton sourcePhysicalRadio = new JRadioButton(); sourcePhysicalRadio.setName("sourcePhysicalRadio"); sourcePhysicalRadio.setActionCommand("SQL Connection"); //Group the radio buttons. ButtonGroup sourceButtonGroup = new ButtonGroup(); sourceButtonGroup.add(sourcePlayPenRadio); sourceButtonGroup.add(sourcePhysicalRadio); //Register a listener for the radio buttons. sourcePlayPenRadio.addActionListener(new SourceOptionListener()); sourcePhysicalRadio.addActionListener(new SourceOptionListener()); sourceDatabaseDropdown = new JComboBox(); sourceDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { sourceDatabaseDropdown.addItem(ds); } sourceDatabaseDropdown.setName("sourceDatabaseDropdown"); sourceDatabaseDropdown.addActionListener(new ConnectionListener()); sourceDatabaseDropdown.setEnabled(false); sourceDatabaseDropdown.setRenderer(dataSourceRenderer); sourceNewConnButton = new JButton("New..."); sourceNewConnButton.setName("sourceNewConnButton"); sourceNewConnButton.setEnabled(false); sourceNewConnButton.addActionListener(newConnectionAction); sourceCatalogDropdown = new JComboBox(); sourceCatalogDropdown.setName("sourceCatalogDropdown"); sourceCatalogDropdown.setEnabled(false); sourceSchemaDropdown = new JComboBox(); sourceSchemaDropdown.setName("sourceSchemaDropdown"); sourceSchemaDropdown.setEnabled(false); targetDatabaseDropdown = new JComboBox(); targetDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { targetDatabaseDropdown.addItem(ds); } targetDatabaseDropdown.setName("targetDatabaseDropdown"); targetDatabaseDropdown.setRenderer(dataSourceRenderer); targetDatabaseDropdown.addActionListener(new ConnectionListener()); targetNewConnButton = new JButton("New..."); targetNewConnButton.setName("targetNewConnButton"); targetNewConnButton.setEnabled(true); targetNewConnButton.addActionListener(newConnectionAction); targetCatalogDropdown = new JComboBox(); targetCatalogDropdown.setName("targetCatalogDropdown"); targetCatalogDropdown.setEnabled(false); targetSchemaDropdown = new JComboBox(); targetSchemaDropdown.setName("targetSchemaDropdown"); targetSchemaDropdown.setEnabled(false); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setVisible(false); // layout compare methods check box and syntax combox JRadioButton sourceLikeTargetButton = new JRadioButton(); sourceLikeTargetButton.setName("sourceLikeTargetButton"); sourceLikeTargetButton.setActionCommand("source like target"); sourceLikeTargetButton.setSelected(false); JRadioButton targetLikeSourceButton = new JRadioButton( ); targetLikeSourceButton.setName("targetLikeSourceButton"); targetLikeSourceButton.setActionCommand("target like source"); targetLikeSourceButton.setSelected(false); JRadioButton justCompareButton = new JRadioButton(); justCompareButton.setName("justCompareButton"); justCompareButton.setActionCommand("compare"); justCompareButton.setSelected(true); //Group the radio buttons. ButtonGroup operationGroup = new ButtonGroup(); operationGroup.add(sourceLikeTargetButton); operationGroup.add(targetLikeSourceButton); operationGroup.add(justCompareButton); JComboBox sqlTypeDropdown = new JComboBox(DDLUtils.getDDLTypes()); sqlTypeDropdown.setName("sqlTypeDropDown"); OutputChoiceListener listener = new OutputChoiceListener(sqlTypeDropdown); JRadioButton sqlButton = new JRadioButton( ); sqlButton.setName("sqlButton"); sqlButton.setActionCommand("sqlButton"); sqlButton.setSelected(true); sqlButton.addActionListener(listener); JRadioButton englishButton = new JRadioButton(); englishButton.setName("englishButton"); englishButton.setActionCommand("english"); englishButton.setSelected(false); englishButton.addActionListener(listener); //Group the radio buttons. ButtonGroup outputGroup = new ButtonGroup(); outputGroup.add(sqlButton); outputGroup.add(englishButton); // outputDoc outputTextPane outputTextPane = new JTextPane(); outputTextPane.setCaretPosition(0); outputTextPane.setMargin(new Insets(5,5,5,5)); JScrollPane scrollPane = new JScrollPane(outputTextPane); scrollPane.setPreferredSize(new Dimension(300, 300)); startCompareAction = new StartCompareAction(); startCompareAction.setEnabled(false); buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); FormLayout formLayout = new FormLayout("20dlu, 2dlu, pref, 4dlu," + "pref:grow, 2dlu, pref, 4dlu," + "pref:grow, 4dlu, pref:grow", ""); formLayout.setColumnGroups(new int[][] {{5,9,11}}); JPanel panel = logger.isDebugEnabled() ? new FormDebugPanel() : new JPanel(); DefaultFormBuilder builder = new DefaultFormBuilder(formLayout, panel); builder.setDefaultDialogBorder(); CellConstraints cc = new CellConstraints(); builder.appendSeparator("Compare Source"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePlayPenRadio); builder.append("Project ["+project.getName()+"]"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePhysicalRadio); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(sourceDatabaseDropdown); builder.append(sourceNewConnButton, sourceCatalogDropdown, sourceSchemaDropdown); builder.appendSeparator("With Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(targetDatabaseDropdown); builder.append(targetNewConnButton, targetCatalogDropdown, targetSchemaDropdown); builder.appendSeparator("Output Format"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sqlButton); JPanel ddlTypePanel = new JPanel(new BorderLayout(3,3)); ddlTypePanel.add(new JLabel("SQL for"), BorderLayout.WEST); ddlTypePanel.add(sqlTypeDropdown, BorderLayout.CENTER); // ddl generator type list builder.append(ddlTypePanel); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(englishButton); builder.append("English descriptions"); builder.nextLine(); builder.appendSeparator("Comparison Sense"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sourceLikeTargetButton); builder.append("How to make Source like Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(targetLikeSourceButton); builder.append("How to make Target like Source"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(justCompareButton); builder.append("Show all differences"); builder.nextLine(); builder.appendSeparator("Status"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.add(new JLabel(""), cc.xy(5, builder.getRow())); builder.add(progressBar, cc.xyw(7, builder.getRow(), 5)); setLayout(new BorderLayout()); add(builder.getPanel()); }
private void buildUI() { ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); // layout source database option/combox target combox JRadioButton sourcePlayPenRadio = new JRadioButton(); sourcePlayPenRadio.setName("sourcePlayPenRadio"); sourcePlayPenRadio.setActionCommand("Project"); sourcePlayPenRadio.setSelected(true); JRadioButton sourcePhysicalRadio = new JRadioButton(); sourcePhysicalRadio.setName("sourcePhysicalRadio"); sourcePhysicalRadio.setActionCommand("SQL Connection"); //Group the radio buttons. ButtonGroup sourceButtonGroup = new ButtonGroup(); sourceButtonGroup.add(sourcePlayPenRadio); sourceButtonGroup.add(sourcePhysicalRadio); //Register a listener for the radio buttons. sourcePlayPenRadio.addActionListener(new SourceOptionListener()); sourcePhysicalRadio.addActionListener(new SourceOptionListener()); sourceDatabaseDropdown = new JComboBox(); sourceDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { sourceDatabaseDropdown.addItem(ds); } sourceDatabaseDropdown.setName("sourceDatabaseDropdown"); sourceDatabaseDropdown.addActionListener(new ConnectionListener()); sourceDatabaseDropdown.setEnabled(false); sourceDatabaseDropdown.setRenderer(dataSourceRenderer); sourceNewConnButton = new JButton("New..."); sourceNewConnButton.setName("sourceNewConnButton"); sourceNewConnButton.setEnabled(false); sourceNewConnButton.addActionListener(newConnectionAction); sourceCatalogDropdown = new JComboBox(); sourceCatalogDropdown.setName("sourceCatalogDropdown"); sourceCatalogDropdown.setEnabled(false); sourceSchemaDropdown = new JComboBox(); sourceSchemaDropdown.setName("sourceSchemaDropdown"); sourceSchemaDropdown.setEnabled(false); targetDatabaseDropdown = new JComboBox(); targetDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { targetDatabaseDropdown.addItem(ds); } targetDatabaseDropdown.setName("targetDatabaseDropdown"); targetDatabaseDropdown.setRenderer(dataSourceRenderer); targetDatabaseDropdown.addActionListener(new ConnectionListener()); targetNewConnButton = new JButton("New..."); targetNewConnButton.setName("targetNewConnButton"); targetNewConnButton.setEnabled(true); targetNewConnButton.addActionListener(newConnectionAction); targetCatalogDropdown = new JComboBox(); targetCatalogDropdown.setName("targetCatalogDropdown"); targetCatalogDropdown.setEnabled(false); targetSchemaDropdown = new JComboBox(); targetSchemaDropdown.setName("targetSchemaDropdown"); targetSchemaDropdown.setEnabled(false); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setVisible(false); // layout compare methods check box and syntax combox JRadioButton sourceLikeTargetButton = new JRadioButton(); sourceLikeTargetButton.setName("sourceLikeTargetButton"); sourceLikeTargetButton.setActionCommand("source like target"); sourceLikeTargetButton.setSelected(false); JRadioButton targetLikeSourceButton = new JRadioButton( ); targetLikeSourceButton.setName("targetLikeSourceButton"); targetLikeSourceButton.setActionCommand("target like source"); targetLikeSourceButton.setSelected(false); JRadioButton justCompareButton = new JRadioButton(); justCompareButton.setName("justCompareButton"); justCompareButton.setActionCommand("compare"); justCompareButton.setSelected(true); //Group the radio buttons. ButtonGroup operationGroup = new ButtonGroup(); operationGroup.add(sourceLikeTargetButton); operationGroup.add(targetLikeSourceButton); operationGroup.add(justCompareButton); JComboBox sqlTypeDropdown = new JComboBox(DDLUtils.getDDLTypes()); sqlTypeDropdown.setName("sqlTypeDropDown"); OutputChoiceListener listener = new OutputChoiceListener(sqlTypeDropdown); JRadioButton sqlButton = new JRadioButton( ); sqlButton.setName("sqlButton"); sqlButton.setActionCommand("sqlButton"); sqlButton.setSelected(true); sqlButton.addActionListener(listener); JRadioButton englishButton = new JRadioButton(); englishButton.setName("englishButton"); englishButton.setActionCommand("english"); englishButton.setSelected(false); englishButton.addActionListener(listener); //Group the radio buttons. ButtonGroup outputGroup = new ButtonGroup(); outputGroup.add(sqlButton); outputGroup.add(englishButton); // outputDoc outputTextPane outputTextPane = new JTextPane(); outputTextPane.setCaretPosition(0); outputTextPane.setMargin(new Insets(5,5,5,5)); JScrollPane scrollPane = new JScrollPane(outputTextPane); scrollPane.setPreferredSize(new Dimension(300, 300)); startCompareAction = new StartCompareAction(); startCompareAction.setEnabled(false); buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); FormLayout formLayout = new FormLayout("20dlu, 2dlu, pref, 4dlu," + "pref:grow, 2dlu, pref, 4dlu," + "pref:grow, 4dlu, pref:grow", ""); formLayout.setColumnGroups(new int[][] {{5,9,11}}); JPanel panel = logger.isDebugEnabled() ? new FormDebugPanel() : new JPanel(); DefaultFormBuilder builder = new DefaultFormBuilder(formLayout, panel); builder.setDefaultDialogBorder(); CellConstraints cc = new CellConstraints(); builder.appendSeparator("Compare Source"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePlayPenRadio); builder.append("Project ["+project.getName()+"]"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePhysicalRadio); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(sourceDatabaseDropdown); builder.append(sourceNewConnButton, sourceCatalogDropdown, sourceSchemaDropdown); builder.appendSeparator("With Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(targetDatabaseDropdown); builder.append(targetNewConnButton, targetCatalogDropdown, targetSchemaDropdown); builder.appendSeparator("Output Format"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sqlButton); JPanel ddlTypePanel = new JPanel(new BorderLayout(3,3)); ddlTypePanel.add(new JLabel("SQL for"), BorderLayout.WEST); ddlTypePanel.add(sqlTypeDropdown, BorderLayout.CENTER); // ddl generator type list builder.append(ddlTypePanel); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(englishButton); builder.append("English descriptions"); builder.nextLine(); builder.appendSeparator("Comparison Sense"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sourceLikeTargetButton); builder.append("How to make Source like Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(targetLikeSourceButton); builder.append("How to make Target like Source"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(justCompareButton); builder.append("Show all differences"); builder.nextLine(); builder.appendSeparator("Status"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.add(new JLabel(""), cc.xy(5, builder.getRow())); builder.add(progressBar, cc.xyw(7, builder.getRow(), 5)); setLayout(new BorderLayout()); add(builder.getPanel()); }
1,112,091
private void buildUI() { ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); // layout source database option/combox target combox JRadioButton sourcePlayPenRadio = new JRadioButton(); sourcePlayPenRadio.setName("sourcePlayPenRadio"); sourcePlayPenRadio.setActionCommand("Project"); sourcePlayPenRadio.setSelected(true); JRadioButton sourcePhysicalRadio = new JRadioButton(); sourcePhysicalRadio.setName("sourcePhysicalRadio"); sourcePhysicalRadio.setActionCommand("SQL Connection"); //Group the radio buttons. ButtonGroup sourceButtonGroup = new ButtonGroup(); sourceButtonGroup.add(sourcePlayPenRadio); sourceButtonGroup.add(sourcePhysicalRadio); //Register a listener for the radio buttons. sourcePlayPenRadio.addActionListener(new SourceOptionListener()); sourcePhysicalRadio.addActionListener(new SourceOptionListener()); sourceDatabaseDropdown = new JComboBox(); sourceDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { sourceDatabaseDropdown.addItem(ds); } sourceDatabaseDropdown.setName("sourceDatabaseDropdown"); sourceDatabaseDropdown.addActionListener(new ConnectionListener()); sourceDatabaseDropdown.setEnabled(false); sourceDatabaseDropdown.setRenderer(dataSourceRenderer); sourceNewConnButton = new JButton("New..."); sourceNewConnButton.setName("sourceNewConnButton"); sourceNewConnButton.setEnabled(false); sourceNewConnButton.addActionListener(newConnectionAction); sourceCatalogDropdown = new JComboBox(); sourceCatalogDropdown.setName("sourceCatalogDropdown"); sourceCatalogDropdown.setEnabled(false); sourceSchemaDropdown = new JComboBox(); sourceSchemaDropdown.setName("sourceSchemaDropdown"); sourceSchemaDropdown.setEnabled(false); targetDatabaseDropdown = new JComboBox(); targetDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { targetDatabaseDropdown.addItem(ds); } targetDatabaseDropdown.setName("targetDatabaseDropdown"); targetDatabaseDropdown.setRenderer(dataSourceRenderer); targetDatabaseDropdown.addActionListener(new ConnectionListener()); targetNewConnButton = new JButton("New..."); targetNewConnButton.setName("targetNewConnButton"); targetNewConnButton.setEnabled(true); targetNewConnButton.addActionListener(newConnectionAction); targetCatalogDropdown = new JComboBox(); targetCatalogDropdown.setName("targetCatalogDropdown"); targetCatalogDropdown.setEnabled(false); targetSchemaDropdown = new JComboBox(); targetSchemaDropdown.setName("targetSchemaDropdown"); targetSchemaDropdown.setEnabled(false); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setVisible(false); // layout compare methods check box and syntax combox JRadioButton sourceLikeTargetButton = new JRadioButton(); sourceLikeTargetButton.setName("sourceLikeTargetButton"); sourceLikeTargetButton.setActionCommand("source like target"); sourceLikeTargetButton.setSelected(false); JRadioButton targetLikeSourceButton = new JRadioButton( ); targetLikeSourceButton.setName("targetLikeSourceButton"); targetLikeSourceButton.setActionCommand("target like source"); targetLikeSourceButton.setSelected(false); JRadioButton justCompareButton = new JRadioButton(); justCompareButton.setName("justCompareButton"); justCompareButton.setActionCommand("compare"); justCompareButton.setSelected(true); //Group the radio buttons. ButtonGroup operationGroup = new ButtonGroup(); operationGroup.add(sourceLikeTargetButton); operationGroup.add(targetLikeSourceButton); operationGroup.add(justCompareButton); JComboBox sqlTypeDropdown = new JComboBox(DDLUtils.getDDLTypes()); sqlTypeDropdown.setName("sqlTypeDropDown"); OutputChoiceListener listener = new OutputChoiceListener(sqlTypeDropdown); JRadioButton sqlButton = new JRadioButton( ); sqlButton.setName("sqlButton"); sqlButton.setActionCommand("sqlButton"); sqlButton.setSelected(true); sqlButton.addActionListener(listener); JRadioButton englishButton = new JRadioButton(); englishButton.setName("englishButton"); englishButton.setActionCommand("english"); englishButton.setSelected(false); englishButton.addActionListener(listener); //Group the radio buttons. ButtonGroup outputGroup = new ButtonGroup(); outputGroup.add(sqlButton); outputGroup.add(englishButton); // outputDoc outputTextPane outputTextPane = new JTextPane(); outputTextPane.setCaretPosition(0); outputTextPane.setMargin(new Insets(5,5,5,5)); JScrollPane scrollPane = new JScrollPane(outputTextPane); scrollPane.setPreferredSize(new Dimension(300, 300)); startCompareAction = new StartCompareAction(); startCompareAction.setEnabled(false); buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); FormLayout formLayout = new FormLayout("20dlu, 2dlu, pref, 4dlu," + "pref:grow, 2dlu, pref, 4dlu," + "pref:grow, 4dlu, pref:grow", ""); formLayout.setColumnGroups(new int[][] {{5,9,11}}); JPanel panel = logger.isDebugEnabled() ? new FormDebugPanel() : new JPanel(); DefaultFormBuilder builder = new DefaultFormBuilder(formLayout, panel); builder.setDefaultDialogBorder(); CellConstraints cc = new CellConstraints(); builder.appendSeparator("Compare Source"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePlayPenRadio); builder.append("Project ["+project.getName()+"]"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePhysicalRadio); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(sourceDatabaseDropdown); builder.append(sourceNewConnButton, sourceCatalogDropdown, sourceSchemaDropdown); builder.appendSeparator("With Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(targetDatabaseDropdown); builder.append(targetNewConnButton, targetCatalogDropdown, targetSchemaDropdown); builder.appendSeparator("Output Format"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sqlButton); JPanel ddlTypePanel = new JPanel(new BorderLayout(3,3)); ddlTypePanel.add(new JLabel("SQL for"), BorderLayout.WEST); ddlTypePanel.add(sqlTypeDropdown, BorderLayout.CENTER); // ddl generator type list builder.append(ddlTypePanel); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(englishButton); builder.append("English descriptions"); builder.nextLine(); builder.appendSeparator("Comparison Sense"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sourceLikeTargetButton); builder.append("How to make Source like Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(targetLikeSourceButton); builder.append("How to make Target like Source"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(justCompareButton); builder.append("Show all differences"); builder.nextLine(); builder.appendSeparator("Status"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.add(new JLabel(""), cc.xy(5, builder.getRow())); builder.add(progressBar, cc.xyw(7, builder.getRow(), 5)); setLayout(new BorderLayout()); add(builder.getPanel()); }
private void buildUI() { ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); // layout source database option/combox target combox JRadioButton sourcePlayPenRadio = new JRadioButton(); sourcePlayPenRadio.setName("sourcePlayPenRadio"); sourcePlayPenRadio.setActionCommand("Project"); sourcePlayPenRadio.setSelected(true); JRadioButton sourcePhysicalRadio = new JRadioButton(); sourcePhysicalRadio.setName("sourcePhysicalRadio"); sourcePhysicalRadio.setActionCommand("SQL Connection"); //Group the radio buttons. ButtonGroup sourceButtonGroup = new ButtonGroup(); sourceButtonGroup.add(sourcePlayPenRadio); sourceButtonGroup.add(sourcePhysicalRadio); //Register a listener for the radio buttons. sourcePlayPenRadio.addActionListener(new SourceOptionListener()); sourcePhysicalRadio.addActionListener(new SourceOptionListener()); sourceDatabaseDropdown = new JComboBox(); sourceDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { sourceDatabaseDropdown.addItem(ds); } sourceDatabaseDropdown.setName("sourceDatabaseDropdown"); sourceDatabaseDropdown.addActionListener(new ConnectionListener()); sourceDatabaseDropdown.setEnabled(false); sourceDatabaseDropdown.setRenderer(dataSourceRenderer); sourceNewConnButton = new JButton("New..."); sourceNewConnButton.setName("sourceNewConnButton"); sourceNewConnButton.setEnabled(false); sourceNewConnButton.addActionListener(newConnectionAction); sourceCatalogDropdown = new JComboBox(); sourceCatalogDropdown.setName("sourceCatalogDropdown"); sourceCatalogDropdown.setEnabled(false); sourceSchemaDropdown = new JComboBox(); sourceSchemaDropdown.setName("sourceSchemaDropdown"); sourceSchemaDropdown.setEnabled(false); targetDatabaseDropdown = new JComboBox(); targetDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { targetDatabaseDropdown.addItem(ds); } targetDatabaseDropdown.setName("targetDatabaseDropdown"); targetDatabaseDropdown.setRenderer(dataSourceRenderer); targetDatabaseDropdown.addActionListener(new CatalogPopulator(targetSchemaDropdown,targetCatalogDropdown)); targetNewConnButton = new JButton("New..."); targetNewConnButton.setName("targetNewConnButton"); targetNewConnButton.setEnabled(true); targetNewConnButton.addActionListener(newConnectionAction); targetCatalogDropdown = new JComboBox(); targetCatalogDropdown.setName("targetCatalogDropdown"); targetCatalogDropdown.setEnabled(false); targetSchemaDropdown = new JComboBox(); targetSchemaDropdown.setName("targetSchemaDropdown"); targetSchemaDropdown.setEnabled(false); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setVisible(false); // layout compare methods check box and syntax combox JRadioButton sourceLikeTargetButton = new JRadioButton(); sourceLikeTargetButton.setName("sourceLikeTargetButton"); sourceLikeTargetButton.setActionCommand("source like target"); sourceLikeTargetButton.setSelected(false); JRadioButton targetLikeSourceButton = new JRadioButton( ); targetLikeSourceButton.setName("targetLikeSourceButton"); targetLikeSourceButton.setActionCommand("target like source"); targetLikeSourceButton.setSelected(false); JRadioButton justCompareButton = new JRadioButton(); justCompareButton.setName("justCompareButton"); justCompareButton.setActionCommand("compare"); justCompareButton.setSelected(true); //Group the radio buttons. ButtonGroup operationGroup = new ButtonGroup(); operationGroup.add(sourceLikeTargetButton); operationGroup.add(targetLikeSourceButton); operationGroup.add(justCompareButton); JComboBox sqlTypeDropdown = new JComboBox(DDLUtils.getDDLTypes()); sqlTypeDropdown.setName("sqlTypeDropDown"); OutputChoiceListener listener = new OutputChoiceListener(sqlTypeDropdown); JRadioButton sqlButton = new JRadioButton( ); sqlButton.setName("sqlButton"); sqlButton.setActionCommand("sqlButton"); sqlButton.setSelected(true); sqlButton.addActionListener(listener); JRadioButton englishButton = new JRadioButton(); englishButton.setName("englishButton"); englishButton.setActionCommand("english"); englishButton.setSelected(false); englishButton.addActionListener(listener); //Group the radio buttons. ButtonGroup outputGroup = new ButtonGroup(); outputGroup.add(sqlButton); outputGroup.add(englishButton); // outputDoc outputTextPane outputTextPane = new JTextPane(); outputTextPane.setCaretPosition(0); outputTextPane.setMargin(new Insets(5,5,5,5)); JScrollPane scrollPane = new JScrollPane(outputTextPane); scrollPane.setPreferredSize(new Dimension(300, 300)); startCompareAction = new StartCompareAction(); startCompareAction.setEnabled(false); buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); FormLayout formLayout = new FormLayout("20dlu, 2dlu, pref, 4dlu," + "pref:grow, 2dlu, pref, 4dlu," + "pref:grow, 4dlu, pref:grow", ""); formLayout.setColumnGroups(new int[][] {{5,9,11}}); JPanel panel = logger.isDebugEnabled() ? new FormDebugPanel() : new JPanel(); DefaultFormBuilder builder = new DefaultFormBuilder(formLayout, panel); builder.setDefaultDialogBorder(); CellConstraints cc = new CellConstraints(); builder.appendSeparator("Compare Source"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePlayPenRadio); builder.append("Project ["+project.getName()+"]"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePhysicalRadio); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(sourceDatabaseDropdown); builder.append(sourceNewConnButton, sourceCatalogDropdown, sourceSchemaDropdown); builder.appendSeparator("With Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(targetDatabaseDropdown); builder.append(targetNewConnButton, targetCatalogDropdown, targetSchemaDropdown); builder.appendSeparator("Output Format"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sqlButton); JPanel ddlTypePanel = new JPanel(new BorderLayout(3,3)); ddlTypePanel.add(new JLabel("SQL for"), BorderLayout.WEST); ddlTypePanel.add(sqlTypeDropdown, BorderLayout.CENTER); // ddl generator type list builder.append(ddlTypePanel); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(englishButton); builder.append("English descriptions"); builder.nextLine(); builder.appendSeparator("Comparison Sense"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sourceLikeTargetButton); builder.append("How to make Source like Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(targetLikeSourceButton); builder.append("How to make Target like Source"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(justCompareButton); builder.append("Show all differences"); builder.nextLine(); builder.appendSeparator("Status"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.add(new JLabel(""), cc.xy(5, builder.getRow())); builder.add(progressBar, cc.xyw(7, builder.getRow(), 5)); setLayout(new BorderLayout()); add(builder.getPanel()); }
1,112,092
private void buildUI() { ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); // layout source database option/combox target combox JRadioButton sourcePlayPenRadio = new JRadioButton(); sourcePlayPenRadio.setName("sourcePlayPenRadio"); sourcePlayPenRadio.setActionCommand("Project"); sourcePlayPenRadio.setSelected(true); JRadioButton sourcePhysicalRadio = new JRadioButton(); sourcePhysicalRadio.setName("sourcePhysicalRadio"); sourcePhysicalRadio.setActionCommand("SQL Connection"); //Group the radio buttons. ButtonGroup sourceButtonGroup = new ButtonGroup(); sourceButtonGroup.add(sourcePlayPenRadio); sourceButtonGroup.add(sourcePhysicalRadio); //Register a listener for the radio buttons. sourcePlayPenRadio.addActionListener(new SourceOptionListener()); sourcePhysicalRadio.addActionListener(new SourceOptionListener()); sourceDatabaseDropdown = new JComboBox(); sourceDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { sourceDatabaseDropdown.addItem(ds); } sourceDatabaseDropdown.setName("sourceDatabaseDropdown"); sourceDatabaseDropdown.addActionListener(new ConnectionListener()); sourceDatabaseDropdown.setEnabled(false); sourceDatabaseDropdown.setRenderer(dataSourceRenderer); sourceNewConnButton = new JButton("New..."); sourceNewConnButton.setName("sourceNewConnButton"); sourceNewConnButton.setEnabled(false); sourceNewConnButton.addActionListener(newConnectionAction); sourceCatalogDropdown = new JComboBox(); sourceCatalogDropdown.setName("sourceCatalogDropdown"); sourceCatalogDropdown.setEnabled(false); sourceSchemaDropdown = new JComboBox(); sourceSchemaDropdown.setName("sourceSchemaDropdown"); sourceSchemaDropdown.setEnabled(false); targetDatabaseDropdown = new JComboBox(); targetDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { targetDatabaseDropdown.addItem(ds); } targetDatabaseDropdown.setName("targetDatabaseDropdown"); targetDatabaseDropdown.setRenderer(dataSourceRenderer); targetDatabaseDropdown.addActionListener(new ConnectionListener()); targetNewConnButton = new JButton("New..."); targetNewConnButton.setName("targetNewConnButton"); targetNewConnButton.setEnabled(true); targetNewConnButton.addActionListener(newConnectionAction); targetCatalogDropdown = new JComboBox(); targetCatalogDropdown.setName("targetCatalogDropdown"); targetCatalogDropdown.setEnabled(false); targetSchemaDropdown = new JComboBox(); targetSchemaDropdown.setName("targetSchemaDropdown"); targetSchemaDropdown.setEnabled(false); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setVisible(false); // layout compare methods check box and syntax combox JRadioButton sourceLikeTargetButton = new JRadioButton(); sourceLikeTargetButton.setName("sourceLikeTargetButton"); sourceLikeTargetButton.setActionCommand("source like target"); sourceLikeTargetButton.setSelected(false); JRadioButton targetLikeSourceButton = new JRadioButton( ); targetLikeSourceButton.setName("targetLikeSourceButton"); targetLikeSourceButton.setActionCommand("target like source"); targetLikeSourceButton.setSelected(false); JRadioButton justCompareButton = new JRadioButton(); justCompareButton.setName("justCompareButton"); justCompareButton.setActionCommand("compare"); justCompareButton.setSelected(true); //Group the radio buttons. ButtonGroup operationGroup = new ButtonGroup(); operationGroup.add(sourceLikeTargetButton); operationGroup.add(targetLikeSourceButton); operationGroup.add(justCompareButton); JComboBox sqlTypeDropdown = new JComboBox(DDLUtils.getDDLTypes()); sqlTypeDropdown.setName("sqlTypeDropDown"); OutputChoiceListener listener = new OutputChoiceListener(sqlTypeDropdown); JRadioButton sqlButton = new JRadioButton( ); sqlButton.setName("sqlButton"); sqlButton.setActionCommand("sqlButton"); sqlButton.setSelected(true); sqlButton.addActionListener(listener); JRadioButton englishButton = new JRadioButton(); englishButton.setName("englishButton"); englishButton.setActionCommand("english"); englishButton.setSelected(false); englishButton.addActionListener(listener); //Group the radio buttons. ButtonGroup outputGroup = new ButtonGroup(); outputGroup.add(sqlButton); outputGroup.add(englishButton); // outputDoc outputTextPane outputTextPane = new JTextPane(); outputTextPane.setCaretPosition(0); outputTextPane.setMargin(new Insets(5,5,5,5)); JScrollPane scrollPane = new JScrollPane(outputTextPane); scrollPane.setPreferredSize(new Dimension(300, 300)); startCompareAction = new StartCompareAction(); startCompareAction.setEnabled(false); buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); FormLayout formLayout = new FormLayout("20dlu, 2dlu, pref, 4dlu," + "pref:grow, 2dlu, pref, 4dlu," + "pref:grow, 4dlu, pref:grow", ""); formLayout.setColumnGroups(new int[][] {{5,9,11}}); JPanel panel = logger.isDebugEnabled() ? new FormDebugPanel() : new JPanel(); DefaultFormBuilder builder = new DefaultFormBuilder(formLayout, panel); builder.setDefaultDialogBorder(); CellConstraints cc = new CellConstraints(); builder.appendSeparator("Compare Source"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePlayPenRadio); builder.append("Project ["+project.getName()+"]"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePhysicalRadio); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(sourceDatabaseDropdown); builder.append(sourceNewConnButton, sourceCatalogDropdown, sourceSchemaDropdown); builder.appendSeparator("With Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(targetDatabaseDropdown); builder.append(targetNewConnButton, targetCatalogDropdown, targetSchemaDropdown); builder.appendSeparator("Output Format"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sqlButton); JPanel ddlTypePanel = new JPanel(new BorderLayout(3,3)); ddlTypePanel.add(new JLabel("SQL for"), BorderLayout.WEST); ddlTypePanel.add(sqlTypeDropdown, BorderLayout.CENTER); // ddl generator type list builder.append(ddlTypePanel); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(englishButton); builder.append("English descriptions"); builder.nextLine(); builder.appendSeparator("Comparison Sense"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sourceLikeTargetButton); builder.append("How to make Source like Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(targetLikeSourceButton); builder.append("How to make Target like Source"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(justCompareButton); builder.append("Show all differences"); builder.nextLine(); builder.appendSeparator("Status"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.add(new JLabel(""), cc.xy(5, builder.getRow())); builder.add(progressBar, cc.xyw(7, builder.getRow(), 5)); setLayout(new BorderLayout()); add(builder.getPanel()); }
private void buildUI() { ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); // layout source database option/combox target combox JRadioButton sourcePlayPenRadio = new JRadioButton(); sourcePlayPenRadio.setName("sourcePlayPenRadio"); sourcePlayPenRadio.setActionCommand("Project"); sourcePlayPenRadio.setSelected(true); JRadioButton sourcePhysicalRadio = new JRadioButton(); sourcePhysicalRadio.setName("sourcePhysicalRadio"); sourcePhysicalRadio.setActionCommand("SQL Connection"); //Group the radio buttons. ButtonGroup sourceButtonGroup = new ButtonGroup(); sourceButtonGroup.add(sourcePlayPenRadio); sourceButtonGroup.add(sourcePhysicalRadio); //Register a listener for the radio buttons. sourcePlayPenRadio.addActionListener(new SourceOptionListener()); sourcePhysicalRadio.addActionListener(new SourceOptionListener()); sourceDatabaseDropdown = new JComboBox(); sourceDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { sourceDatabaseDropdown.addItem(ds); } sourceDatabaseDropdown.setName("sourceDatabaseDropdown"); sourceDatabaseDropdown.addActionListener(new ConnectionListener()); sourceDatabaseDropdown.setEnabled(false); sourceDatabaseDropdown.setRenderer(dataSourceRenderer); sourceNewConnButton = new JButton("New..."); sourceNewConnButton.setName("sourceNewConnButton"); sourceNewConnButton.setEnabled(false); sourceNewConnButton.addActionListener(newConnectionAction); sourceCatalogDropdown = new JComboBox(); sourceCatalogDropdown.setName("sourceCatalogDropdown"); sourceCatalogDropdown.setEnabled(false); sourceSchemaDropdown = new JComboBox(); sourceSchemaDropdown.setName("sourceSchemaDropdown"); sourceSchemaDropdown.setEnabled(false); targetDatabaseDropdown = new JComboBox(); targetDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { targetDatabaseDropdown.addItem(ds); } targetDatabaseDropdown.setName("targetDatabaseDropdown"); targetDatabaseDropdown.setRenderer(dataSourceRenderer); targetDatabaseDropdown.addActionListener(new ConnectionListener()); targetNewConnButton = new JButton("New..."); targetNewConnButton.setName("targetNewConnButton"); targetNewConnButton.setEnabled(true); targetNewConnButton.addActionListener(newConnectionAction); targetCatalogDropdown = new JComboBox(); targetCatalogDropdown.setName("targetCatalogDropdown"); targetCatalogDropdown.setEnabled(false); targetSchemaDropdown = new JComboBox(); targetSchemaDropdown.setName("targetSchemaDropdown"); targetSchemaDropdown.setEnabled(false); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setVisible(false); // layout compare methods check box and syntax combox JRadioButton sourceLikeTargetButton = new JRadioButton(); sourceLikeTargetButton.setName("sourceLikeTargetButton"); sourceLikeTargetButton.setActionCommand("source like target"); sourceLikeTargetButton.setSelected(false); JRadioButton targetLikeSourceButton = new JRadioButton( ); targetLikeSourceButton.setName("targetLikeSourceButton"); targetLikeSourceButton.setActionCommand("target like source"); targetLikeSourceButton.setSelected(false); JRadioButton justCompareButton = new JRadioButton(); justCompareButton.setName("justCompareButton"); justCompareButton.setActionCommand("compare"); justCompareButton.setSelected(true); //Group the radio buttons. ButtonGroup operationGroup = new ButtonGroup(); operationGroup.add(sourceLikeTargetButton); operationGroup.add(targetLikeSourceButton); operationGroup.add(justCompareButton); JComboBox sqlTypeDropdown = new JComboBox(DDLUtils.getDDLTypes()); sqlTypeDropdown.setName("sqlTypeDropDown"); OutputChoiceListener listener = new OutputChoiceListener(sqlTypeDropdown); JRadioButton sqlButton = new JRadioButton( ); sqlButton.setName("sqlButton"); sqlButton.setActionCommand("sqlButton"); sqlButton.setSelected(true); sqlButton.addActionListener(listener); JRadioButton englishButton = new JRadioButton(); englishButton.setName("englishButton"); englishButton.setActionCommand("english"); englishButton.setSelected(false); englishButton.addActionListener(listener); //Group the radio buttons. ButtonGroup outputGroup = new ButtonGroup(); outputGroup.add(sqlButton); outputGroup.add(englishButton); // outputDoc outputTextPane outputTextPane = new JTextPane(); outputTextPane.setCaretPosition(0); outputTextPane.setMargin(new Insets(5,5,5,5)); JScrollPane scrollPane = new JScrollPane(outputTextPane); scrollPane.setPreferredSize(new Dimension(300, 300)); startCompareAction = new StartCompareAction(); startCompareAction.setEnabled(false); buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); FormLayout formLayout = new FormLayout("20dlu, 2dlu, pref, 4dlu," + "pref:grow, 2dlu, pref, 4dlu," + "pref:grow, 4dlu, pref:grow", ""); formLayout.setColumnGroups(new int[][] {{5,9,11}}); JPanel panel = logger.isDebugEnabled() ? new FormDebugPanel() : new JPanel(); DefaultFormBuilder builder = new DefaultFormBuilder(formLayout, panel); builder.setDefaultDialogBorder(); CellConstraints cc = new CellConstraints(); builder.appendSeparator("Compare Source"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePlayPenRadio); builder.append("Project ["+project.getName()+"]"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePhysicalRadio); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(sourceDatabaseDropdown); builder.append(sourceNewConnButton, sourceCatalogDropdown, sourceSchemaDropdown); builder.appendSeparator("With Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(targetDatabaseDropdown); builder.append(targetNewConnButton, targetCatalogDropdown, targetSchemaDropdown); builder.appendSeparator("Output Format"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sqlButton); JPanel ddlTypePanel = new JPanel(new BorderLayout(3,3)); ddlTypePanel.add(new JLabel("SQL for"), BorderLayout.WEST); ddlTypePanel.add(sqlTypeDropdown, BorderLayout.CENTER); // ddl generator type list builder.append(ddlTypePanel); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(englishButton); builder.append("English descriptions"); builder.nextLine(); builder.appendSeparator("Comparison Sense"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sourceLikeTargetButton); builder.append("How to make Source like Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(targetLikeSourceButton); builder.append("How to make Target like Source"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(justCompareButton); builder.append("Show all differences"); builder.nextLine(); builder.appendSeparator("Status"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.add(new JLabel(""), cc.xy(5, builder.getRow())); builder.add(progressBar, cc.xyw(7, builder.getRow(), 5)); setLayout(new BorderLayout()); add(builder.getPanel()); }
1,112,093
private void buildUI() { ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); // layout source database option/combox target combox JRadioButton sourcePlayPenRadio = new JRadioButton(); sourcePlayPenRadio.setName("sourcePlayPenRadio"); sourcePlayPenRadio.setActionCommand("Project"); sourcePlayPenRadio.setSelected(true); JRadioButton sourcePhysicalRadio = new JRadioButton(); sourcePhysicalRadio.setName("sourcePhysicalRadio"); sourcePhysicalRadio.setActionCommand("SQL Connection"); //Group the radio buttons. ButtonGroup sourceButtonGroup = new ButtonGroup(); sourceButtonGroup.add(sourcePlayPenRadio); sourceButtonGroup.add(sourcePhysicalRadio); //Register a listener for the radio buttons. sourcePlayPenRadio.addActionListener(new SourceOptionListener()); sourcePhysicalRadio.addActionListener(new SourceOptionListener()); sourceDatabaseDropdown = new JComboBox(); sourceDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { sourceDatabaseDropdown.addItem(ds); } sourceDatabaseDropdown.setName("sourceDatabaseDropdown"); sourceDatabaseDropdown.addActionListener(new ConnectionListener()); sourceDatabaseDropdown.setEnabled(false); sourceDatabaseDropdown.setRenderer(dataSourceRenderer); sourceNewConnButton = new JButton("New..."); sourceNewConnButton.setName("sourceNewConnButton"); sourceNewConnButton.setEnabled(false); sourceNewConnButton.addActionListener(newConnectionAction); sourceCatalogDropdown = new JComboBox(); sourceCatalogDropdown.setName("sourceCatalogDropdown"); sourceCatalogDropdown.setEnabled(false); sourceSchemaDropdown = new JComboBox(); sourceSchemaDropdown.setName("sourceSchemaDropdown"); sourceSchemaDropdown.setEnabled(false); targetDatabaseDropdown = new JComboBox(); targetDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { targetDatabaseDropdown.addItem(ds); } targetDatabaseDropdown.setName("targetDatabaseDropdown"); targetDatabaseDropdown.setRenderer(dataSourceRenderer); targetDatabaseDropdown.addActionListener(new ConnectionListener()); targetNewConnButton = new JButton("New..."); targetNewConnButton.setName("targetNewConnButton"); targetNewConnButton.setEnabled(true); targetNewConnButton.addActionListener(newConnectionAction); targetCatalogDropdown = new JComboBox(); targetCatalogDropdown.setName("targetCatalogDropdown"); targetCatalogDropdown.setEnabled(false); targetSchemaDropdown = new JComboBox(); targetSchemaDropdown.setName("targetSchemaDropdown"); targetSchemaDropdown.setEnabled(false); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setVisible(false); // layout compare methods check box and syntax combox JRadioButton sourceLikeTargetButton = new JRadioButton(); sourceLikeTargetButton.setName("sourceLikeTargetButton"); sourceLikeTargetButton.setActionCommand("source like target"); sourceLikeTargetButton.setSelected(false); JRadioButton targetLikeSourceButton = new JRadioButton( ); targetLikeSourceButton.setName("targetLikeSourceButton"); targetLikeSourceButton.setActionCommand("target like source"); targetLikeSourceButton.setSelected(false); JRadioButton justCompareButton = new JRadioButton(); justCompareButton.setName("justCompareButton"); justCompareButton.setActionCommand("compare"); justCompareButton.setSelected(true); //Group the radio buttons. ButtonGroup operationGroup = new ButtonGroup(); operationGroup.add(sourceLikeTargetButton); operationGroup.add(targetLikeSourceButton); operationGroup.add(justCompareButton); JComboBox sqlTypeDropdown = new JComboBox(DDLUtils.getDDLTypes()); sqlTypeDropdown.setName("sqlTypeDropDown"); OutputChoiceListener listener = new OutputChoiceListener(sqlTypeDropdown); JRadioButton sqlButton = new JRadioButton( ); sqlButton.setName("sqlButton"); sqlButton.setActionCommand("sqlButton"); sqlButton.setSelected(true); sqlButton.addActionListener(listener); JRadioButton englishButton = new JRadioButton(); englishButton.setName("englishButton"); englishButton.setActionCommand("english"); englishButton.setSelected(false); englishButton.addActionListener(listener); //Group the radio buttons. ButtonGroup outputGroup = new ButtonGroup(); outputGroup.add(sqlButton); outputGroup.add(englishButton); // outputDoc outputTextPane outputTextPane = new JTextPane(); outputTextPane.setCaretPosition(0); outputTextPane.setMargin(new Insets(5,5,5,5)); JScrollPane scrollPane = new JScrollPane(outputTextPane); scrollPane.setPreferredSize(new Dimension(300, 300)); startCompareAction = new StartCompareAction(); startCompareAction.setEnabled(false); buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); FormLayout formLayout = new FormLayout("20dlu, 2dlu, pref, 4dlu," + "pref:grow, 2dlu, pref, 4dlu," + "pref:grow, 4dlu, pref:grow", ""); formLayout.setColumnGroups(new int[][] {{5,9,11}}); JPanel panel = logger.isDebugEnabled() ? new FormDebugPanel() : new JPanel(); DefaultFormBuilder builder = new DefaultFormBuilder(formLayout, panel); builder.setDefaultDialogBorder(); CellConstraints cc = new CellConstraints(); builder.appendSeparator("Compare Source"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePlayPenRadio); builder.append("Project ["+project.getName()+"]"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePhysicalRadio); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(sourceDatabaseDropdown); builder.append(sourceNewConnButton, sourceCatalogDropdown, sourceSchemaDropdown); builder.appendSeparator("With Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(targetDatabaseDropdown); builder.append(targetNewConnButton, targetCatalogDropdown, targetSchemaDropdown); builder.appendSeparator("Output Format"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sqlButton); JPanel ddlTypePanel = new JPanel(new BorderLayout(3,3)); ddlTypePanel.add(new JLabel("SQL for"), BorderLayout.WEST); ddlTypePanel.add(sqlTypeDropdown, BorderLayout.CENTER); // ddl generator type list builder.append(ddlTypePanel); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(englishButton); builder.append("English descriptions"); builder.nextLine(); builder.appendSeparator("Comparison Sense"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sourceLikeTargetButton); builder.append("How to make Source like Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(targetLikeSourceButton); builder.append("How to make Target like Source"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(justCompareButton); builder.append("Show all differences"); builder.nextLine(); builder.appendSeparator("Status"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.add(new JLabel(""), cc.xy(5, builder.getRow())); builder.add(progressBar, cc.xyw(7, builder.getRow(), 5)); setLayout(new BorderLayout()); add(builder.getPanel()); }
private void buildUI() { ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); // layout source database option/combox target combox JRadioButton sourcePlayPenRadio = new JRadioButton(); sourcePlayPenRadio.setName("sourcePlayPenRadio"); sourcePlayPenRadio.setActionCommand("Project"); sourcePlayPenRadio.setSelected(true); JRadioButton sourcePhysicalRadio = new JRadioButton(); sourcePhysicalRadio.setName("sourcePhysicalRadio"); sourcePhysicalRadio.setActionCommand("SQL Connection"); //Group the radio buttons. ButtonGroup sourceButtonGroup = new ButtonGroup(); sourceButtonGroup.add(sourcePlayPenRadio); sourceButtonGroup.add(sourcePhysicalRadio); //Register a listener for the radio buttons. sourcePlayPenRadio.addActionListener(new SourceOptionListener()); sourcePhysicalRadio.addActionListener(new SourceOptionListener()); sourceDatabaseDropdown = new JComboBox(); sourceDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { sourceDatabaseDropdown.addItem(ds); } sourceDatabaseDropdown.setName("sourceDatabaseDropdown"); sourceDatabaseDropdown.addActionListener(new ConnectionListener()); sourceDatabaseDropdown.setEnabled(false); sourceDatabaseDropdown.setRenderer(dataSourceRenderer); sourceNewConnButton = new JButton("New..."); sourceNewConnButton.setName("sourceNewConnButton"); sourceNewConnButton.setEnabled(false); sourceNewConnButton.addActionListener(newConnectionAction); sourceCatalogDropdown = new JComboBox(); sourceCatalogDropdown.setName("sourceCatalogDropdown"); sourceCatalogDropdown.setEnabled(false); sourceSchemaDropdown = new JComboBox(); sourceSchemaDropdown.setName("sourceSchemaDropdown"); sourceSchemaDropdown.setEnabled(false); targetDatabaseDropdown = new JComboBox(); targetDatabaseDropdown.addItem(null); // the non-selection selection for (ArchitectDataSource ds : af.getUserSettings().getConnections()) { targetDatabaseDropdown.addItem(ds); } targetDatabaseDropdown.setName("targetDatabaseDropdown"); targetDatabaseDropdown.setRenderer(dataSourceRenderer); targetDatabaseDropdown.addActionListener(new ConnectionListener()); targetNewConnButton = new JButton("New..."); targetNewConnButton.setName("targetNewConnButton"); targetNewConnButton.setEnabled(true); targetNewConnButton.addActionListener(newConnectionAction); targetCatalogDropdown = new JComboBox(); targetCatalogDropdown.setName("targetCatalogDropdown"); targetCatalogDropdown.setEnabled(false); targetSchemaDropdown = new JComboBox(); targetSchemaDropdown.setName("targetSchemaDropdown"); targetSchemaDropdown.setEnabled(false); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setVisible(false); // layout compare methods check box and syntax combox JRadioButton sourceLikeTargetButton = new JRadioButton(); sourceLikeTargetButton.setName("sourceLikeTargetButton"); sourceLikeTargetButton.setActionCommand("source like target"); sourceLikeTargetButton.setSelected(false); JRadioButton targetLikeSourceButton = new JRadioButton( ); targetLikeSourceButton.setName("targetLikeSourceButton"); targetLikeSourceButton.setActionCommand("target like source"); targetLikeSourceButton.setSelected(false); JRadioButton justCompareButton = new JRadioButton(); justCompareButton.setName("justCompareButton"); justCompareButton.setActionCommand("compare"); justCompareButton.setSelected(true); //Group the radio buttons. ButtonGroup operationGroup = new ButtonGroup(); operationGroup.add(sourceLikeTargetButton); operationGroup.add(targetLikeSourceButton); operationGroup.add(justCompareButton); sqlTypeDropdown = new JComboBox(DDLUtils.getDDLTypes()); sqlTypeDropdown.setName("sqlTypeDropDown"); OutputChoiceListener listener = new OutputChoiceListener(sqlTypeDropdown); JRadioButton sqlButton = new JRadioButton( ); sqlButton.setName("sqlButton"); sqlButton.setActionCommand("sqlButton"); sqlButton.setSelected(true); sqlButton.addActionListener(listener); JRadioButton englishButton = new JRadioButton(); englishButton.setName("englishButton"); englishButton.setActionCommand("english"); englishButton.setSelected(false); englishButton.addActionListener(listener); //Group the radio buttons. ButtonGroup outputGroup = new ButtonGroup(); outputGroup.add(sqlButton); outputGroup.add(englishButton); // outputDoc outputTextPane outputTextPane = new JTextPane(); outputTextPane.setCaretPosition(0); outputTextPane.setMargin(new Insets(5,5,5,5)); JScrollPane scrollPane = new JScrollPane(outputTextPane); scrollPane.setPreferredSize(new Dimension(300, 300)); startCompareAction = new StartCompareAction(); startCompareAction.setEnabled(false); buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); FormLayout formLayout = new FormLayout("20dlu, 2dlu, pref, 4dlu," + "pref:grow, 2dlu, pref, 4dlu," + "pref:grow, 4dlu, pref:grow", ""); formLayout.setColumnGroups(new int[][] {{5,9,11}}); JPanel panel = logger.isDebugEnabled() ? new FormDebugPanel() : new JPanel(); DefaultFormBuilder builder = new DefaultFormBuilder(formLayout, panel); builder.setDefaultDialogBorder(); CellConstraints cc = new CellConstraints(); builder.appendSeparator("Compare Source"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePlayPenRadio); builder.append("Project ["+project.getName()+"]"); builder.nextLine(); builder.append(""); // takes up blank space builder.append(sourcePhysicalRadio); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(sourceDatabaseDropdown); builder.append(sourceNewConnButton, sourceCatalogDropdown, sourceSchemaDropdown); builder.appendSeparator("With Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append("Physical Database"); builder.nextColumn(2); builder.append("Catalog"); builder.append("Schema"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(4); builder.append(targetDatabaseDropdown); builder.append(targetNewConnButton, targetCatalogDropdown, targetSchemaDropdown); builder.appendSeparator("Output Format"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sqlButton); JPanel ddlTypePanel = new JPanel(new BorderLayout(3,3)); ddlTypePanel.add(new JLabel("SQL for"), BorderLayout.WEST); ddlTypePanel.add(sqlTypeDropdown, BorderLayout.CENTER); // ddl generator type list builder.append(ddlTypePanel); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(englishButton); builder.append("English descriptions"); builder.nextLine(); builder.appendSeparator("Comparison Sense"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(sourceLikeTargetButton); builder.append("How to make Source like Target"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(targetLikeSourceButton); builder.append("How to make Target like Source"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.nextColumn(2); builder.append(justCompareButton); builder.append("Show all differences"); builder.nextLine(); builder.appendSeparator("Status"); builder.appendRow(builder.getLineGapSpec()); builder.appendRow("pref"); builder.nextLine(2); builder.add(new JLabel(""), cc.xy(5, builder.getRow())); builder.add(progressBar, cc.xyw(7, builder.getRow(), 5)); setLayout(new BorderLayout()); add(builder.getPanel()); }
1,112,094
public void run() { outputTextPane.setDocument(output); }
public void run() { outputTextPane.setDocument(output); }
1,112,095
public void doTag(XMLOutput output) throws Exception { // evaluate body as it may contain a <destination> tag getBody().run(context, output); Destination destination = getDestination(); if ( destination == null ) { throw new JellyException( "No destination specified. Either specify a 'destination' attribute or use a nested <jms:destination> tag" ); } Message message = null; if ( timeout > 0 ) { message = getConnection().receive( destination, timeout ); } else if ( timeout == 0 ) { message = getConnection().receiveNoWait( destination ); } else { message = getConnection().receive( destination ); } onMessage( message ); }
public void doTag(XMLOutput output) throws Exception { // evaluate body as it may contain a <destination> tag invokeBody(output); Destination destination = getDestination(); if ( destination == null ) { throw new JellyException( "No destination specified. Either specify a 'destination' attribute or use a nested <jms:destination> tag" ); } Message message = null; if ( timeout > 0 ) { message = getConnection().receive( destination, timeout ); } else if ( timeout == 0 ) { message = getConnection().receiveNoWait( destination ); } else { message = getConnection().receive( destination ); } onMessage( message ); }
1,112,098
private void paintThumbnail( Graphics2D g2, PhotoInfo photo, int startx, int starty, boolean isSelected ) { log.debug( "paintThumbnail entry " + photo.getUid() ); long startTime = System.currentTimeMillis(); long thumbReadyTime = 0; long thumbDrawnTime = 0; long endTime = 0; // Current position in which attributes can be drawn int ypos = starty + rowHeight/2; // Create a transaction which will be used for persisten object operations // during painting (to avoid creating several short-livin transactions) ODMGXAWrapper txw = new ODMGXAWrapper(); Thumbnail thumbnail = null; log.debug( "finding thumb" ); boolean hasThumbnail = photo.hasThumbnail(); log.debug( "asked if has thumb" ); if ( hasThumbnail ) { log.debug( "Photo " + photo.getUid() + " has thumbnail" ); thumbnail = photo.getThumbnail(); log.debug( "got thumbnail" ); } else { thumbnail = Thumbnail.getDefaultThumbnail(); if ( !thumbCreatorThread.isBusy() ) { log.debug( "Create thumbnail for " + photo.getUid() ); thumbCreatorThread.createThumbnail( photo ); log.debug( "Thumbnail request submitted" ); } } thumbReadyTime = System.currentTimeMillis(); log.debug( "starting to draw" ); // Find the position for the thumbnail BufferedImage img = thumbnail.getImage(); if ( img.getWidth() > columnWidth || img.getHeight() > rowHeight ) { img = img.getSubimage( 0, 0, Math.min( img.getWidth(), columnWidth ), Math.min( img.getHeight(), rowHeight ) ); } int x = startx + (columnWidth - img.getWidth())/(int)2; int y = starty + (rowHeight - img.getHeight())/(int)2; log.debug( "drawing thumbnail" ); g2.drawImage( img, new AffineTransform( 1f, 0f, 0f, 1f, x, y ), null ); log.debug( "Drawn, drawing decorations" ); if ( isSelected ) { Stroke prevStroke = g2.getStroke(); Color prevColor = g2.getColor(); g2.setStroke( new BasicStroke( 3.0f) ); g2.setColor( Color.BLUE ); g2.drawRect( x, y, img.getWidth(), img.getHeight() ); g2.setColor( prevColor ); g2.setStroke( prevStroke ); } thumbDrawnTime = System.currentTimeMillis(); // Increase ypos so that attributes are drawn under the image ypos += ((int)img.getHeight())/2 + 4; // Draw the attributes // Draw the qualoity icon to the upper left corner of the thumbnail int quality = photo.getQuality(); if ( showQuality && quality != PhotoInfo.QUALITY_UNDEFINED ) { ImageIcon qualityIcon = qualityIcons[quality]; int qx = startx + (columnWidth-img.getWidth()-qualityIcon.getIconWidth())/(int)2; int qy = starty + (rowHeight-img.getHeight()-qualityIcon.getIconHeight())/(int)2; qualityIcon.paintIcon( this, g2, qx, qy ); } Color prevBkg = g2.getBackground(); if ( isSelected ) { g2.setBackground( Color.BLUE ); } else { g2.setBackground( this.getBackground() ); } Font attrFont = new Font( "Arial", Font.PLAIN, 10 ); FontRenderContext frc = g2.getFontRenderContext(); if ( showDate && photo.getShootTime() != null ) { FuzzyDate fd = new FuzzyDate( photo.getShootTime(), photo.getTimeAccuracy() ); String dateStr = fd.format(); TextLayout txt = new TextLayout( dateStr, attrFont, frc ); // Calculate the position for the text Rectangle2D bounds = txt.getBounds(); int xpos = startx + ((int)(columnWidth - bounds.getWidth()))/2 - (int)bounds.getMinX(); g2.clearRect( xpos-2, ypos-2, (int)bounds.getWidth()+4, (int)bounds.getHeight()+4 ); txt.draw( g2, xpos, (int)(ypos + bounds.getHeight()) ); ypos += bounds.getHeight() + 4; } String shootPlace = photo.getShootingPlace(); if ( showPlace && shootPlace != null && shootPlace.length() > 0 ) { TextLayout txt = new TextLayout( photo.getShootingPlace(), attrFont, frc ); // Calculate the position for the text Rectangle2D bounds = txt.getBounds(); int xpos = startx + ((int)(columnWidth-bounds.getWidth()))/2 - (int)bounds.getMinX(); g2.clearRect( xpos-2, ypos-2, (int)bounds.getWidth()+4, (int)bounds.getHeight()+4 ); txt.draw( g2, xpos, (int)(ypos + bounds.getHeight()) ); ypos += bounds.getHeight() + 4; } g2.setBackground( prevBkg ); txw.commit(); endTime = System.currentTimeMillis(); log.debug( "paintThumbnail: exit " + photo.getUid() ); log.debug( "Thumb fetch " + (thumbReadyTime - startTime ) + " ms" ); log.debug( "Thumb draw " + ( thumbDrawnTime - thumbReadyTime ) + " ms" ); log.debug( "Deacoration draw " + (endTime - thumbDrawnTime ) + " ms" ); log.debug( "Total " + (endTime - startTime ) + " ms" ); }
private void paintThumbnail( Graphics2D g2, PhotoInfo photo, int startx, int starty, boolean isSelected ) { log.debug( "paintThumbnail entry " + photo.getUid() ); long startTime = System.currentTimeMillis(); long thumbReadyTime = 0; long thumbDrawnTime = 0; long endTime = 0; // Current position in which attributes can be drawn int ypos = starty + rowHeight/2; // Create a transaction which will be used for persisten object operations // during painting (to avoid creating several short-livin transactions) ODMGXAWrapper txw = new ODMGXAWrapper(); Thumbnail thumbnail = null; log.debug( "finding thumb" ); boolean hasThumbnail = photo.hasThumbnail(); log.debug( "asked if has thumb" ); if ( hasThumbnail ) { log.debug( "Photo " + photo.getUid() + " has thumbnail" ); thumbnail = photo.getThumbnail(); log.debug( "got thumbnail" ); } else { thumbnail = photo.getOldThumbnail(); if ( thumbnail != null ) { useOldThumbnail = true; } else { thumbnail = Thumbnail.getDefaultThumbnail(); } if ( !thumbCreatorThread.isBusy() ) { log.debug( "Create thumbnail for " + photo.getUid() ); thumbCreatorThread.createThumbnail( photo ); log.debug( "Thumbnail request submitted" ); } } thumbReadyTime = System.currentTimeMillis(); log.debug( "starting to draw" ); // Find the position for the thumbnail BufferedImage img = thumbnail.getImage(); if ( img.getWidth() > columnWidth || img.getHeight() > rowHeight ) { img = img.getSubimage( 0, 0, Math.min( img.getWidth(), columnWidth ), Math.min( img.getHeight(), rowHeight ) ); } int x = startx + (columnWidth - img.getWidth())/(int)2; int y = starty + (rowHeight - img.getHeight())/(int)2; log.debug( "drawing thumbnail" ); g2.drawImage( img, new AffineTransform( 1f, 0f, 0f, 1f, x, y ), null ); log.debug( "Drawn, drawing decorations" ); if ( isSelected ) { Stroke prevStroke = g2.getStroke(); Color prevColor = g2.getColor(); g2.setStroke( new BasicStroke( 3.0f) ); g2.setColor( Color.BLUE ); g2.drawRect( x, y, img.getWidth(), img.getHeight() ); g2.setColor( prevColor ); g2.setStroke( prevStroke ); } thumbDrawnTime = System.currentTimeMillis(); // Increase ypos so that attributes are drawn under the image ypos += ((int)img.getHeight())/2 + 4; // Draw the attributes // Draw the qualoity icon to the upper left corner of the thumbnail int quality = photo.getQuality(); if ( showQuality && quality != PhotoInfo.QUALITY_UNDEFINED ) { ImageIcon qualityIcon = qualityIcons[quality]; int qx = startx + (columnWidth-img.getWidth()-qualityIcon.getIconWidth())/(int)2; int qy = starty + (rowHeight-img.getHeight()-qualityIcon.getIconHeight())/(int)2; qualityIcon.paintIcon( this, g2, qx, qy ); } Color prevBkg = g2.getBackground(); if ( isSelected ) { g2.setBackground( Color.BLUE ); } else { g2.setBackground( this.getBackground() ); } Font attrFont = new Font( "Arial", Font.PLAIN, 10 ); FontRenderContext frc = g2.getFontRenderContext(); if ( showDate && photo.getShootTime() != null ) { FuzzyDate fd = new FuzzyDate( photo.getShootTime(), photo.getTimeAccuracy() ); String dateStr = fd.format(); TextLayout txt = new TextLayout( dateStr, attrFont, frc ); // Calculate the position for the text Rectangle2D bounds = txt.getBounds(); int xpos = startx + ((int)(columnWidth - bounds.getWidth()))/2 - (int)bounds.getMinX(); g2.clearRect( xpos-2, ypos-2, (int)bounds.getWidth()+4, (int)bounds.getHeight()+4 ); txt.draw( g2, xpos, (int)(ypos + bounds.getHeight()) ); ypos += bounds.getHeight() + 4; } String shootPlace = photo.getShootingPlace(); if ( showPlace && shootPlace != null && shootPlace.length() > 0 ) { TextLayout txt = new TextLayout( photo.getShootingPlace(), attrFont, frc ); // Calculate the position for the text Rectangle2D bounds = txt.getBounds(); int xpos = startx + ((int)(columnWidth-bounds.getWidth()))/2 - (int)bounds.getMinX(); g2.clearRect( xpos-2, ypos-2, (int)bounds.getWidth()+4, (int)bounds.getHeight()+4 ); txt.draw( g2, xpos, (int)(ypos + bounds.getHeight()) ); ypos += bounds.getHeight() + 4; } g2.setBackground( prevBkg ); txw.commit(); endTime = System.currentTimeMillis(); log.debug( "paintThumbnail: exit " + photo.getUid() ); log.debug( "Thumb fetch " + (thumbReadyTime - startTime ) + " ms" ); log.debug( "Thumb draw " + ( thumbDrawnTime - thumbReadyTime ) + " ms" ); log.debug( "Deacoration draw " + (endTime - thumbDrawnTime ) + " ms" ); log.debug( "Total " + (endTime - startTime ) + " ms" ); }
1,112,101
public void removeAllFromFolder( PhotoFolder f ) { addedToFolders.remove( f ); removedFromFolders.add( f ); DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) folderNodes.get( f ); FolderNode fn = (FolderNode) treeNode.getUserObject(); fn.removeAllPhotos(); // If this folder has no visible children remove it from the tree if ( treeNode.getChildCount() == 0 ) { DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) treeNode.getParent(); FolderNode parentFolderNode = (FolderNode) parentNode.getUserObject(); // Remove the folder also from controller internal data structures folderNodes.remove( f ); treeModel.removeNodeFromParent( treeNode ); /* Check whether the parent node (and its parets...) contain any photos * from the model. If not we can remove them as well */ while ( !parentFolderNode.containsPhotos() && parentNode != topNode ) { treeNode = parentNode; fn = parentFolderNode; parentNode = (DefaultMutableTreeNode) treeNode.getParent(); parentFolderNode = (FolderNode) parentNode.getUserObject(); folderNodes.remove( fn.getFolder()); treeModel.removeNodeFromParent( treeNode ); } } else { // This folder has children that have photos in the model // Don't remove the folder but notify model that representation // should be changed treeModel.nodeChanged(treeNode); } }
public void removeAllFromFolder( PhotoFolder f ) { addedToFolders.remove( f ); removedFromFolders.add( f ); DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) folderNodes.get( f ); FolderNode fn = (FolderNode) treeNode.getUserObject(); fn.removeAllPhotos(); // If this folder has no visible children remove it from the tree if ( treeNode.getChildCount() == 0 ) { DefaultMutableTreeNode parentNode = (DefaultMutableTreeNode) treeNode.getParent(); FolderNode parentFolderNode = (FolderNode) parentNode.getUserObject(); // Remove the folder also from controller internal data structures folderNodes.remove( f ); treeModel.removeNodeFromParent( treeNode ); /* Check whether the parent node (and its parets...) contain any photos * from the model. If not we can remove them as well */ while ( !parentFolderNode.containsPhotos() && parentNode.getChildCount() == 0 && parentNode != topNode ) { treeNode = parentNode; fn = parentFolderNode; parentNode = (DefaultMutableTreeNode) treeNode.getParent(); parentFolderNode = (FolderNode) parentNode.getUserObject(); folderNodes.remove( fn.getFolder()); treeModel.removeNodeFromParent( treeNode ); } } else { // This folder has children that have photos in the model // Don't remove the folder but notify model that representation // should be changed treeModel.nodeChanged(treeNode); } }
1,112,103
protected URL createRelativeURL(URL rootURL, String relativeURI) throws MalformedURLException { if (rootURL == null) { File file = new File(System.getProperty("user.dir")); rootURL = file.toURL(); } String urlText = rootURL.toString() + relativeURI; if ( log.isDebugEnabled() ) { log.debug("Attempting to open url: " + urlText); } return new URL(urlText); }
protected URL createRelativeURL(URL rootURL, String relativeURI) throws MalformedURLException { URL url = rootURL; if (url == null) { File file = new File(System.getProperty("user.dir")); rootURL = file.toURL(); } String urlText = rootURL.toString() + relativeURI; if ( log.isDebugEnabled() ) { log.debug("Attempting to open url: " + urlText); } return new URL(urlText); }
1,112,104
protected URL createRelativeURL(URL rootURL, String relativeURI) throws MalformedURLException { if (rootURL == null) { File file = new File(System.getProperty("user.dir")); rootURL = file.toURL(); } String urlText = rootURL.toString() + relativeURI; if ( log.isDebugEnabled() ) { log.debug("Attempting to open url: " + urlText); } return new URL(urlText); }
protected URL createRelativeURL(URL rootURL, String relativeURI) throws MalformedURLException { if (rootURL == null) { File file = new File(System.getProperty("user.dir")); url = file.toURL(); } String urlText = rootURL.toString() + relativeURI; if ( log.isDebugEnabled() ) { log.debug("Attempting to open url: " + urlText); } return new URL(urlText); }
1,112,105
protected URL createRelativeURL(URL rootURL, String relativeURI) throws MalformedURLException { if (rootURL == null) { File file = new File(System.getProperty("user.dir")); rootURL = file.toURL(); } String urlText = rootURL.toString() + relativeURI; if ( log.isDebugEnabled() ) { log.debug("Attempting to open url: " + urlText); } return new URL(urlText); }
protected URL createRelativeURL(URL rootURL, String relativeURI) throws MalformedURLException { if (rootURL == null) { File file = new File(System.getProperty("user.dir")); rootURL = file.toURL(); } String urlText = url.toString() + relativeURI; if ( log.isDebugEnabled() ) { log.debug("Attempting to open url: " + urlText); } return new URL(urlText); }
1,112,106
public ClassLoader getClassLoader() { if (this.classLoader != null) { return (this.classLoader); } if (this.useContextClassLoader) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if (classLoader != null) { return (classLoader); } } return (this.getClass().getClassLoader()); }
public ClassLoader getClassLoader() { if (this.classLoader != null) { return (this.classLoader); } if (this.useContextClassLoader) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); if (classLoader != null) { return (classLoader); } } return (this.getClass().getClassLoader()); }
1,112,107
public Object getVariable(String name) { Object value = variables.get(name); boolean definedHere = value != null || variables.containsKey(name); if (definedHere) return value; if ( value == null && isInherit() ) { JellyContext parent = getParent(); if (parent != null) { value = parent.getVariable( name ); } } // ### this is a hack - remove this when we have support for pluggable Scopes if ( value == null ) { value = getSystemProperty(name); } return value; }
public Object getVariable(String name) { Object value = variables.get(name); boolean definedHere = value != null || variables.containsKey(name); if (definedHere) return value; if ( value == null && isInherit() ) { JellyContext parent = getParent(); if (parent != null) { value = parent.getVariable( name ); } } // ### this is a hack - remove this when we have support for pluggable Scopes if ( value == null ) { value = getSystemProperty(name); } return value; }
1,112,108
public Object getVariable(String name) { if ( getInherit() ) { return getParent().findVariable( name ); } return variables.get(name); }
public Object getVariable(String name) { if ( getInherit() ) { return getParent().findVariable( name ); } return variables.get(name); }
1,112,109
public Object getVariable(String name) { if ( getInherit() ) { return getParent().findVariable( name ); } return variables.get(name); }
public Object getVariable(String name) { if ( getInherit() ) { return getParent().findVariable( name ); } return value; }
1,112,110
public void setScopedVariable(String name, Object value) { if ( getExport() ) { getParent().setScopedVariable( name, value ); } }
public void setScopedVariable(String name, Object value) { if ( getExport() && getParent() != null ) { getParent().setScopedVariable( name, value ); } }
1,112,111
public void databaseAdded(DatabaseListChangeEvent e) { connections = plini.getConnections(); for (int i = listenerList.size() -1 ; i>=0; i--) { listenerList.get(i).contentsChanged(new ListDataEvent(this,ListDataEvent.INTERVAL_ADDED,e.getListIndex(),e.getListIndex())); } }
public void databaseAdded(DatabaseListChangeEvent e) { connections = plini.getConnections(); for (int i = listenerList.size() - 1; i >= 0; i--) { listenerList.get(i).contentsChanged( new ListDataEvent(this, ListDataEvent.INTERVAL_ADDED, e.getListIndex(), e.getListIndex())); } for (int i = listenerList.size() -1 ; i>=0; i--) { listenerList.get(i).contentsChanged(new ListDataEvent(this,ListDataEvent.INTERVAL_ADDED,e.getListIndex(),e.getListIndex())); } }
1,112,113
public void databaseAdded(DatabaseListChangeEvent e) { connections = plini.getConnections(); for (int i = listenerList.size() -1 ; i>=0; i--) { listenerList.get(i).contentsChanged(new ListDataEvent(this,ListDataEvent.INTERVAL_ADDED,e.getListIndex(),e.getListIndex())); } }
public void databaseAdded(DatabaseListChangeEvent e) { connections = plini.getConnections(); for (int i = listenerList.size() -1 ; i>=0; i--) { listenerList.get(i).contentsChanged(new ListDataEvent(this,ListDataEvent.INTERVAL_ADDED,e.getListIndex(),e.getListIndex())); } }
1,112,114
public TDTPanel(Vector chromosomes, int t) { type = t; if (type == 1){ result = TDT.calcTrioTDT(chromosomes); }else{ result = TDT.calcCCTDT(chromosomes); } 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(); }
public TDTPanel(PedFile pf, int t) { type = t; if (type == 1){ result = TDT.calcTrioTDT(chromosomes); }else{ result = TDT.calcCCTDT(chromosomes); } 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(); }
1,112,115
public TDTPanel(Vector chromosomes, int t) { type = t; if (type == 1){ result = TDT.calcTrioTDT(chromosomes); }else{ result = TDT.calcCCTDT(chromosomes); } 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(); }
public TDTPanel(Vector chromosomes, int t) { type = t; if (type == 1){ result = TDT.calcTrioTDT(pf); }else{ result = TDT.calcCCTDT(chromosomes); } 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(); }
1,112,116
public TDTPanel(Vector chromosomes, int t) { type = t; if (type == 1){ result = TDT.calcTrioTDT(chromosomes); }else{ result = TDT.calcCCTDT(chromosomes); } 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(); }
public TDTPanel(Vector chromosomes, int t) { type = t; if (type == 1){ result = TDT.calcTrioTDT(chromosomes); }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(); }
1,112,117
public void doTag(XMLOutput output) throws Exception { Map attributes = getAttributes(); Object bean = attributes.remove( "object" ); if ( bean == null ) { throw new MissingAttributeException("bean"); } setBeanProperties(bean, attributes); }
public void doTag(XMLOutput output) throws Exception { Map attributes = getAttributes(); Object bean = attributes.remove( "object" ); if ( bean == null ) { BeanSource tag = (BeanSource) findAncestorWithClass(BeanSource.class); if (tag != null) { bean = tag.getBean(); } if (bean == null) { throw new MissingAttributeException("bean"); } } setBeanProperties(bean, attributes); }
1,112,118
public void add(PlayPenComponent c, int i) { children.add(i,c); c.addPlayPenComponentListener(playPenComponentEventPassthrough); c.addSelectionListener(getOwner()); c.revalidate(); }
public void add(PlayPenComponent c, int i) { if (c instanceof Relationship) { relations.add(i-children.size(),(Relationship)c); } else { children.add(i,c); } c.addPlayPenComponentListener(playPenComponentEventPassthrough); c.addSelectionListener(getOwner()); c.revalidate(); }
1,112,120