bugged
stringlengths 6
599k
| fixed
stringlengths 10
599k
| __index_level_0__
int64 0
1.13M
|
|---|---|---|
void readGenotypes(String[] inputOptions, int type){ //input is a 3 element array with //inputOptions[0] = ped file //inputOptions[1] = info file ("" if none) //inputOptions[2] = max comparison distance (don't compute d' if markers are greater than this dist apart) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); try { if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_TDT_NUM].setEnabled(false); assocTest = 0; } theData = new HaploData(assocTest); if (type == HAPS){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1].equals("")){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } checkPanel = null; if (type == HAPS){ readMarkers(markerFile, null); }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); checkPanel = new CheckDataPanel(theData); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); } //deal with max comparison distance if (inputOptions[2].equals("")){ inputOptions[2] = "0"; } maxCompDist = Long.parseLong(inputOptions[2])*1000; //let's start the math this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(1); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first colorMenuItems[0].setSelected(true); blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); //LOD panel /*panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); LODDisplay ld = new LODDisplay(theData); JScrollPane lodScroller = new JScrollPane(ld); panel.add(lodScroller); tabs.addTab(viewItems[VIEW_LOD_NUM], panel); viewMenuItems[VIEW_LOD_NUM].setEnabled(true);*/ //int optionalTabCount = 1; //check data panel if (checkPanel != null){ //optionalTabCount++; //VIEW_CHECK_NUM = optionalTabCount; //viewItems[VIEW_CHECK_NUM] = VIEW_CHECK_PANEL; JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); JLabel countsLabel = new JLabel("Using " + theData.numSingletons + " singletons and " + theData.numTrios + " trios from " + theData.numPeds + " families."); if (theData.numTrios + theData.numSingletons == 0){ countsLabel.setForeground(Color.red); } countsLabel.setAlignmentX(Component.CENTER_ALIGNMENT); metaCheckPanel.add(countsLabel); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //TDT panel if(assocTest > 0) { //optionalTabCount++; //VIEW_TDT_NUM = optionalTabCount; //viewItems[VIEW_TDT_NUM] = VIEW_TDT; tdtPanel = new TDTPanel(theData.chromosomes, assocTest); tabs.addTab(viewItems[VIEW_TDT_NUM], tdtPanel); viewMenuItems[VIEW_TDT_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } }
|
void readGenotypes(String[] inputOptions, int type){ //input is a 3 element array with //inputOptions[0] = ped file //inputOptions[1] = info file ("" if none) //inputOptions[2] = max comparison distance (don't compute d' if markers are greater than this dist apart) //type is either 3 or 4 for ped and hapmap files respectively final File inFile = new File(inputOptions[0]); try { if (inFile.length() < 1){ throw new HaploViewException("Genotype file is empty or nonexistent: " + inFile.getName()); } if (type == HAPS){ //these are not available for non ped files viewMenuItems[VIEW_CHECK_NUM].setEnabled(false); viewMenuItems[VIEW_TDT_NUM].setEnabled(false); assocTest = 0; } theData = new HaploData(assocTest); if (type == HAPS){ theData.prepareHapsInput(new File(inputOptions[0])); }else{ theData.linkageToChrom(inFile, type); } //deal with marker information theData.infoKnown = false; File markerFile; if (inputOptions[1].equals("")){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } checkPanel = null; if (type == HAPS){ readMarkers(markerFile, null); }else{ readMarkers(markerFile, theData.getPedFile().getHMInfo()); checkPanel = new CheckDataPanel(theData); checkPanel.setAlignmentX(Component.CENTER_ALIGNMENT); } //deal with max comparison distance if (inputOptions[2].equals("")){ inputOptions[2] = "0"; } maxCompDist = Long.parseLong(inputOptions[2])*1000; //let's start the math this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; changeKey(1); theData.generateDPrimeTable(); theData.guessBlocks(BLOX_GABRIEL); //theData.guessBlocks(BLOX_NONE); //for debugging, doesn't call blocks at first colorMenuItems[0].setSelected(true); blockMenuItems[0].setSelected(true); zoomMenuItems[0].setSelected(true); theData.blocksChanged = false; Container contents = getContentPane(); contents.removeAll(); int currentTab = VIEW_D_NUM; /*if (!(tabs == null)){ currentTab = tabs.getSelectedIndex(); } */ tabs = new JTabbedPane(); tabs.addChangeListener(new TabChangeListener()); //first, draw the D' picture JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); dPrimeDisplay = new DPrimeDisplay(window); JScrollPane dPrimeScroller = new JScrollPane(dPrimeDisplay); dPrimeScroller.getViewport().setScrollMode(JViewport.BLIT_SCROLL_MODE); dPrimeScroller.getVerticalScrollBar().setUnitIncrement(60); dPrimeScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(dPrimeScroller); tabs.addTab(viewItems[VIEW_D_NUM], panel); viewMenuItems[VIEW_D_NUM].setEnabled(true); //compute and show haps on next tab panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); try { hapDisplay = new HaplotypeDisplay(theData); } catch(HaploViewException e) { JOptionPane.showMessageDialog(window, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } HaplotypeDisplayController hdc = new HaplotypeDisplayController(hapDisplay); hapScroller = new JScrollPane(hapDisplay); hapScroller.getVerticalScrollBar().setUnitIncrement(60); hapScroller.getHorizontalScrollBar().setUnitIncrement(60); panel.add(hapScroller); panel.add(hdc); tabs.addTab(viewItems[VIEW_HAP_NUM], panel); viewMenuItems[VIEW_HAP_NUM].setEnabled(true); //LOD panel /*panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); LODDisplay ld = new LODDisplay(theData); JScrollPane lodScroller = new JScrollPane(ld); panel.add(lodScroller); tabs.addTab(viewItems[VIEW_LOD_NUM], panel); viewMenuItems[VIEW_LOD_NUM].setEnabled(true);*/ //int optionalTabCount = 1; //check data panel if (checkPanel != null){ //optionalTabCount++; //VIEW_CHECK_NUM = optionalTabCount; //viewItems[VIEW_CHECK_NUM] = VIEW_CHECK_PANEL; JPanel metaCheckPanel = new JPanel(); metaCheckPanel.setLayout(new BoxLayout(metaCheckPanel, BoxLayout.Y_AXIS)); JLabel countsLabel = new JLabel("Using " + theData.numSingletons + " singletons and " + theData.numTrios + " trios from " + theData.numPeds + " families."); if (theData.numTrios + theData.numSingletons == 0){ countsLabel.setForeground(Color.red); } countsLabel.setAlignmentX(Component.CENTER_ALIGNMENT); metaCheckPanel.add(countsLabel); metaCheckPanel.add(checkPanel); cdc = new CheckDataController(window); metaCheckPanel.add(cdc); tabs.addTab(viewItems[VIEW_CHECK_NUM], metaCheckPanel); viewMenuItems[VIEW_CHECK_NUM].setEnabled(true); currentTab=VIEW_CHECK_NUM; } //TDT panel if(assocTest > 0) { //optionalTabCount++; //VIEW_TDT_NUM = optionalTabCount; //viewItems[VIEW_TDT_NUM] = VIEW_TDT; tdtPanel = new TDTPanel(theData.chromosomes, assocTest); tabs.addTab(viewItems[VIEW_TDT_NUM], tdtPanel); viewMenuItems[VIEW_TDT_NUM].setEnabled(true); } tabs.setSelectedIndex(currentTab); contents.add(tabs); repaint(); setVisible(true); theData.finished = true; setTitle(TITLE_STRING + " -- " + inFile.getName()); return null; } }; timer = new javax.swing.Timer(50, new ActionListener(){ public void actionPerformed(ActionEvent evt){ if (theData.finished){ timer.stop(); for (int i = 0; i < blockMenuItems.length; i++){ blockMenuItems[i].setEnabled(true); } clearBlocksItem.setEnabled(true); readMarkerItem.setEnabled(true); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); worker.start(); timer.start(); }catch(IOException ioexec) { JOptionPane.showMessageDialog(this, ioexec.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } catch(PedFileException pfe){ JOptionPane.showMessageDialog(this, pfe.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); }catch (HaploViewException hve){ JOptionPane.showMessageDialog(this, hve.getMessage(), "File Error", JOptionPane.ERROR_MESSAGE); } }
| 1,108,955
|
public void run(JellyContext context, XMLOutput output) throws Exception { try { tag.setContext(context); DynaTag dynaTag = (DynaTag) tag; // ### probably compiling this to 2 arrays might be quicker and smaller for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Expression expression = (Expression) entry.getValue(); Object value = expression.evaluate(context); dynaTag.setAttribute(name, value); } tag.doTag(output); } catch (JellyException e) { handleException(e); } catch (Exception e) { handleException(e); } }
|
public void run(JellyContext context, XMLOutput output) throws Exception { try { tag.setContext(context); // ### probably compiling this to 2 arrays might be quicker and smaller for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Expression expression = (Expression) entry.getValue(); Object value = expression.evaluate(context); dynaTag.setAttribute(name, value); } tag.doTag(output); } catch (JellyException e) { handleException(e); } catch (Exception e) { handleException(e); } }
| 1,108,956
|
public void run(JellyContext context, XMLOutput output) throws Exception { try { tag.setContext(context); DynaTag dynaTag = (DynaTag) tag; // ### probably compiling this to 2 arrays might be quicker and smaller for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Expression expression = (Expression) entry.getValue(); Object value = expression.evaluate(context); dynaTag.setAttribute(name, value); } tag.doTag(output); } catch (JellyException e) { handleException(e); } catch (Exception e) { handleException(e); } }
|
public void run(JellyContext context, XMLOutput output) throws Exception { try { tag.setContext(context); DynaTag dynaTag = (DynaTag) tag; // ### probably compiling this to 2 arrays might be quicker and smaller for (Iterator iter = attributes.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Expression expression = (Expression) entry.getValue(); Object value = expression.evaluate(context); dynaTag.setAttribute(name, value); } tag.doTag(output); } catch (JellyException e) { handleException(e); } catch (Exception e) { handleException(e); } }
| 1,108,957
|
private MarkerResult checkMarker(int loc, String name)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, parenthet=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable numindivs=new Hashtable(); Hashtable parentgeno = new Hashtable(); Hashtable kidgeno = new Hashtable(); Hashtable parenthom = new Hashtable(); Hashtable count = new Hashtable(); String allele1_string, allele2_string; //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getIsTyped()){ byte[] markers = currentInd.getMarker(loc); allele1 = markers[0]; allele1_string = Integer.toString(allele1); allele2 = markers[1]; allele2_string = Integer.toString(allele2); String familyID = currentInd.getFamilyID(); incOrSetOne(numindivs,familyID); //no allele data missing if(allele1 > 0 && allele2 >0){ //make sure entry has parents if(!(currentInd.getMomID().equals("0") || currentInd.getDadID().equals("0"))){ //do mendel check //byte[] marker = ((Individual)pedFileHash.get(familyID + " " + currentInd.getMomID())).getMarker(loc); byte[] marker = (currentFamily.getMember(currentInd.getMomID())).getMarker(loc); int momAllele1 = marker[0]; int momAllele2 = marker[1]; //marker = ((Individual)pedFileHash.get(familyID + " " + currentInd.getDadID())).getMarker(loc); marker = (currentFamily.getMember(currentInd.getDadID())).getMarker(loc); int dadAllele1 = marker[0]; int dadAllele2 = marker[1]; //don't check if parents are missing any data if (!(momAllele1 == 0 || momAllele2 == 0 || dadAllele1 == 0 || dadAllele2 ==0)){ //mom hom if(momAllele1 == momAllele2){ //both parents hom if (dadAllele1 == dadAllele2){ //both parents hom same allele if (momAllele1 == dadAllele1){ //kid must be hom same allele if (allele1 != momAllele1 || allele2 != momAllele1) { mendErrNum ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } //end mendel check } } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getIsTyped()){ byte[] markers = currentInd.getMarker(loc); allele1 = markers[0]; allele1_string = Integer.toString(allele1); allele2 = markers[1]; allele2_string = Integer.toString(allele2); String familyID = currentInd.getFamilyID(); incOrSetOne(numindivs,familyID); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has parents if(currentInd.getMomID().compareTo(Individual.DATA_MISSING)==0 && currentInd.getDadID().compareTo(Individual.DATA_MISSING)==0){ //$parentgeno{$ped}++ //set parentgeno incOrSetOne(parentgeno,familyID); if(allele1 != allele2) { parenthet++; } else{ incOrSetOne(parenthom,allele1_string); } } else{//$kidgeno{$ped}++ incOrSetOne(kidgeno,familyID); } if(allele1 == allele2) { hom++; } else { het++; } //count number of allele incOrSetOne(count,allele1_string); incOrSetOne(count,allele2_string); } //missing data else missing++; } } } double obsHET = getObsHET(het, hom); double preHET = getPreHET(count); //HW p value double pvalue = getPValue(parenthom, parenthet); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(numindivs, parentgeno, kidgeno); //rating int rating = this.getRating(genopct, pvalue, obsHET, mendErrNum); result.setObsHet(obsHET); result.setPredHet(preHET); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); result.setName(name); return result; }
|
private MarkerResult checkMarker(int loc, String name)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, parenthet=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable numindivs=new Hashtable(); Hashtable parentgeno = new Hashtable(); Hashtable kidgeno = new Hashtable(); Hashtable parenthom = new Hashtable(); Hashtable count = new Hashtable(); String allele1_string, allele2_string; //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getIsTyped()){ byte[] markers; byte[] zeroArray = {0,0}; if (currentInd.getZeroed(loc)){ markers = zeroArray; }else{ markers = currentInd.getMarker(loc); } allele1 = markers[0]; allele1_string = Integer.toString(allele1); allele2 = markers[1]; allele2_string = Integer.toString(allele2); String familyID = currentInd.getFamilyID(); incOrSetOne(numindivs,familyID); //no allele data missing if(allele1 > 0 && allele2 >0){ //make sure entry has parents if(!(currentInd.getMomID().equals("0") || currentInd.getDadID().equals("0"))){ //do mendel check //byte[] marker = ((Individual)pedFileHash.get(familyID + " " + currentInd.getMomID())).getMarker(loc); byte[] marker = (currentFamily.getMember(currentInd.getMomID())).getMarker(loc); int momAllele1 = marker[0]; int momAllele2 = marker[1]; //marker = ((Individual)pedFileHash.get(familyID + " " + currentInd.getDadID())).getMarker(loc); marker = (currentFamily.getMember(currentInd.getDadID())).getMarker(loc); int dadAllele1 = marker[0]; int dadAllele2 = marker[1]; //don't check if parents are missing any data if (!(momAllele1 == 0 || momAllele2 == 0 || dadAllele1 == 0 || dadAllele2 ==0)){ //mom hom if(momAllele1 == momAllele2){ //both parents hom if (dadAllele1 == dadAllele2){ //both parents hom same allele if (momAllele1 == dadAllele1){ //kid must be hom same allele if (allele1 != momAllele1 || allele2 != momAllele1) { mendErrNum ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } //end mendel check } } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getIsTyped()){ byte[] markers; byte[] zeroArray = {0,0}; if (currentInd.getZeroed(loc)){ markers = zeroArray; }else{ markers = currentInd.getMarker(loc); } allele1 = markers[0]; allele1_string = Integer.toString(allele1); allele2 = markers[1]; allele2_string = Integer.toString(allele2); String familyID = currentInd.getFamilyID(); incOrSetOne(numindivs,familyID); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has parents if(currentInd.getMomID().compareTo(Individual.DATA_MISSING)==0 && currentInd.getDadID().compareTo(Individual.DATA_MISSING)==0){ //$parentgeno{$ped}++ //set parentgeno incOrSetOne(parentgeno,familyID); if(allele1 != allele2) { parenthet++; } else{ incOrSetOne(parenthom,allele1_string); } } else{//$kidgeno{$ped}++ incOrSetOne(kidgeno,familyID); } if(allele1 == allele2) { hom++; } else { het++; } //count number of allele incOrSetOne(count,allele1_string); incOrSetOne(count,allele2_string); } //missing data else missing++; } } } double obsHET = getObsHET(het, hom); double preHET = getPreHET(count); //HW p value double pvalue = getPValue(parenthom, parenthet); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(numindivs, parentgeno, kidgeno); //rating int rating = this.getRating(genopct, pvalue, obsHET, mendErrNum); result.setObsHet(obsHET); result.setPredHet(preHET); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); result.setName(name); return result; }
| 1,108,958
|
private MarkerResult checkMarker(int loc, String name)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, parenthet=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable numindivs=new Hashtable(); Hashtable parentgeno = new Hashtable(); Hashtable kidgeno = new Hashtable(); Hashtable parenthom = new Hashtable(); Hashtable count = new Hashtable(); String allele1_string, allele2_string; //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getIsTyped()){ byte[] markers = currentInd.getMarker(loc); allele1 = markers[0]; allele1_string = Integer.toString(allele1); allele2 = markers[1]; allele2_string = Integer.toString(allele2); String familyID = currentInd.getFamilyID(); incOrSetOne(numindivs,familyID); //no allele data missing if(allele1 > 0 && allele2 >0){ //make sure entry has parents if(!(currentInd.getMomID().equals("0") || currentInd.getDadID().equals("0"))){ //do mendel check //byte[] marker = ((Individual)pedFileHash.get(familyID + " " + currentInd.getMomID())).getMarker(loc); byte[] marker = (currentFamily.getMember(currentInd.getMomID())).getMarker(loc); int momAllele1 = marker[0]; int momAllele2 = marker[1]; //marker = ((Individual)pedFileHash.get(familyID + " " + currentInd.getDadID())).getMarker(loc); marker = (currentFamily.getMember(currentInd.getDadID())).getMarker(loc); int dadAllele1 = marker[0]; int dadAllele2 = marker[1]; //don't check if parents are missing any data if (!(momAllele1 == 0 || momAllele2 == 0 || dadAllele1 == 0 || dadAllele2 ==0)){ //mom hom if(momAllele1 == momAllele2){ //both parents hom if (dadAllele1 == dadAllele2){ //both parents hom same allele if (momAllele1 == dadAllele1){ //kid must be hom same allele if (allele1 != momAllele1 || allele2 != momAllele1) { mendErrNum ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } //end mendel check } } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getIsTyped()){ byte[] markers = currentInd.getMarker(loc); allele1 = markers[0]; allele1_string = Integer.toString(allele1); allele2 = markers[1]; allele2_string = Integer.toString(allele2); String familyID = currentInd.getFamilyID(); incOrSetOne(numindivs,familyID); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has parents if(currentInd.getMomID().compareTo(Individual.DATA_MISSING)==0 && currentInd.getDadID().compareTo(Individual.DATA_MISSING)==0){ //$parentgeno{$ped}++ //set parentgeno incOrSetOne(parentgeno,familyID); if(allele1 != allele2) { parenthet++; } else{ incOrSetOne(parenthom,allele1_string); } } else{//$kidgeno{$ped}++ incOrSetOne(kidgeno,familyID); } if(allele1 == allele2) { hom++; } else { het++; } //count number of allele incOrSetOne(count,allele1_string); incOrSetOne(count,allele2_string); } //missing data else missing++; } } } double obsHET = getObsHET(het, hom); double preHET = getPreHET(count); //HW p value double pvalue = getPValue(parenthom, parenthet); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(numindivs, parentgeno, kidgeno); //rating int rating = this.getRating(genopct, pvalue, obsHET, mendErrNum); result.setObsHet(obsHET); result.setPredHet(preHET); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); result.setName(name); return result; }
|
private MarkerResult checkMarker(int loc, String name)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, parenthet=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable numindivs=new Hashtable(); Hashtable parentgeno = new Hashtable(); Hashtable kidgeno = new Hashtable(); Hashtable parenthom = new Hashtable(); Hashtable count = new Hashtable(); String allele1_string, allele2_string; //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getIsTyped()){ byte[] markers = currentInd.getMarker(loc); allele1 = markers[0]; allele1_string = Integer.toString(allele1); allele2 = markers[1]; allele2_string = Integer.toString(allele2); String familyID = currentInd.getFamilyID(); incOrSetOne(numindivs,familyID); //no allele data missing if(allele1 > 0 && allele2 >0){ //make sure entry has parents if(!(currentInd.getMomID().equals("0") || currentInd.getDadID().equals("0"))){ //do mendel check //byte[] marker = ((Individual)pedFileHash.get(familyID + " " + currentInd.getMomID())).getMarker(loc); byte[] marker = (currentFamily.getMember(currentInd.getMomID())).getMarker(loc); int momAllele1 = marker[0]; int momAllele2 = marker[1]; //marker = ((Individual)pedFileHash.get(familyID + " " + currentInd.getDadID())).getMarker(loc); marker = (currentFamily.getMember(currentInd.getDadID())).getMarker(loc); int dadAllele1 = marker[0]; int dadAllele2 = marker[1]; //don't check if parents are missing any data if (!(momAllele1 == 0 || momAllele2 == 0 || dadAllele1 == 0 || dadAllele2 ==0)){ //mom hom if(momAllele1 == momAllele2){ //both parents hom if (dadAllele1 == dadAllele2){ //both parents hom same allele if (momAllele1 == dadAllele1){ //kid must be hom same allele if (allele1 != momAllele1 || allele2 != momAllele1) { mendErrNum ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } //end mendel check } } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getIsTyped()){ byte[] markers = currentInd.getMarker(loc); allele1 = markers[0]; allele1_string = Integer.toString(allele1); allele2 = markers[1]; allele2_string = Integer.toString(allele2); String familyID = currentInd.getFamilyID(); incOrSetOne(numindivs,familyID); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has parents if(currentInd.getMomID().compareTo(Individual.DATA_MISSING)==0 && currentInd.getDadID().compareTo(Individual.DATA_MISSING)==0){ //$parentgeno{$ped}++ //set parentgeno incOrSetOne(parentgeno,familyID); if(allele1 != allele2) { parenthet++; } else{ incOrSetOne(parenthom,allele1_string); } } else{//$kidgeno{$ped}++ incOrSetOne(kidgeno,familyID); } if(allele1 == allele2) { hom++; } else { het++; } //count number of allele incOrSetOne(count,allele1_string); incOrSetOne(count,allele2_string); } //missing data else missing++; } } } double obsHET = getObsHET(het, hom); double[] freqStuff = getFreqStuff(count); double preHET = freqStuff[0]; double maf = freqStuff[1]; //HW p value double pvalue = getPValue(parenthom, parenthet); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(numindivs, parentgeno, kidgeno); //rating int rating = this.getRating(genopct, pvalue, obsHET, mendErrNum); result.setObsHet(obsHET); result.setPredHet(preHET); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); result.setName(name); return result; }
| 1,108,959
|
private MarkerResult checkMarker(int loc, String name)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, parenthet=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable numindivs=new Hashtable(); Hashtable parentgeno = new Hashtable(); Hashtable kidgeno = new Hashtable(); Hashtable parenthom = new Hashtable(); Hashtable count = new Hashtable(); String allele1_string, allele2_string; //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getIsTyped()){ byte[] markers = currentInd.getMarker(loc); allele1 = markers[0]; allele1_string = Integer.toString(allele1); allele2 = markers[1]; allele2_string = Integer.toString(allele2); String familyID = currentInd.getFamilyID(); incOrSetOne(numindivs,familyID); //no allele data missing if(allele1 > 0 && allele2 >0){ //make sure entry has parents if(!(currentInd.getMomID().equals("0") || currentInd.getDadID().equals("0"))){ //do mendel check //byte[] marker = ((Individual)pedFileHash.get(familyID + " " + currentInd.getMomID())).getMarker(loc); byte[] marker = (currentFamily.getMember(currentInd.getMomID())).getMarker(loc); int momAllele1 = marker[0]; int momAllele2 = marker[1]; //marker = ((Individual)pedFileHash.get(familyID + " " + currentInd.getDadID())).getMarker(loc); marker = (currentFamily.getMember(currentInd.getDadID())).getMarker(loc); int dadAllele1 = marker[0]; int dadAllele2 = marker[1]; //don't check if parents are missing any data if (!(momAllele1 == 0 || momAllele2 == 0 || dadAllele1 == 0 || dadAllele2 ==0)){ //mom hom if(momAllele1 == momAllele2){ //both parents hom if (dadAllele1 == dadAllele2){ //both parents hom same allele if (momAllele1 == dadAllele1){ //kid must be hom same allele if (allele1 != momAllele1 || allele2 != momAllele1) { mendErrNum ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } //end mendel check } } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getIsTyped()){ byte[] markers = currentInd.getMarker(loc); allele1 = markers[0]; allele1_string = Integer.toString(allele1); allele2 = markers[1]; allele2_string = Integer.toString(allele2); String familyID = currentInd.getFamilyID(); incOrSetOne(numindivs,familyID); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has parents if(currentInd.getMomID().compareTo(Individual.DATA_MISSING)==0 && currentInd.getDadID().compareTo(Individual.DATA_MISSING)==0){ //$parentgeno{$ped}++ //set parentgeno incOrSetOne(parentgeno,familyID); if(allele1 != allele2) { parenthet++; } else{ incOrSetOne(parenthom,allele1_string); } } else{//$kidgeno{$ped}++ incOrSetOne(kidgeno,familyID); } if(allele1 == allele2) { hom++; } else { het++; } //count number of allele incOrSetOne(count,allele1_string); incOrSetOne(count,allele2_string); } //missing data else missing++; } } } double obsHET = getObsHET(het, hom); double preHET = getPreHET(count); //HW p value double pvalue = getPValue(parenthom, parenthet); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(numindivs, parentgeno, kidgeno); //rating int rating = this.getRating(genopct, pvalue, obsHET, mendErrNum); result.setObsHet(obsHET); result.setPredHet(preHET); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); result.setName(name); return result; }
|
private MarkerResult checkMarker(int loc, String name)throws PedFileException{ MarkerResult result = new MarkerResult(); Individual currentInd; //int indivgeno=0, int missing=0, parenthet=0, mendErrNum=0; int allele1=0, allele2=0, hom=0, het=0; //Hashtable allgenos = new Hashtable(); Hashtable numindivs=new Hashtable(); Hashtable parentgeno = new Hashtable(); Hashtable kidgeno = new Hashtable(); Hashtable parenthom = new Hashtable(); Hashtable count = new Hashtable(); String allele1_string, allele2_string; //loop through each family, check data for marker loc Enumeration famList = _pedFile.getFamList(); while(famList.hasMoreElements()){ Family currentFamily = _pedFile.getFamily((String)famList.nextElement()); Enumeration indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getIsTyped()){ byte[] markers = currentInd.getMarker(loc); allele1 = markers[0]; allele1_string = Integer.toString(allele1); allele2 = markers[1]; allele2_string = Integer.toString(allele2); String familyID = currentInd.getFamilyID(); incOrSetOne(numindivs,familyID); //no allele data missing if(allele1 > 0 && allele2 >0){ //make sure entry has parents if(!(currentInd.getMomID().equals("0") || currentInd.getDadID().equals("0"))){ //do mendel check //byte[] marker = ((Individual)pedFileHash.get(familyID + " " + currentInd.getMomID())).getMarker(loc); byte[] marker = (currentFamily.getMember(currentInd.getMomID())).getMarker(loc); int momAllele1 = marker[0]; int momAllele2 = marker[1]; //marker = ((Individual)pedFileHash.get(familyID + " " + currentInd.getDadID())).getMarker(loc); marker = (currentFamily.getMember(currentInd.getDadID())).getMarker(loc); int dadAllele1 = marker[0]; int dadAllele2 = marker[1]; //don't check if parents are missing any data if (!(momAllele1 == 0 || momAllele2 == 0 || dadAllele1 == 0 || dadAllele2 ==0)){ //mom hom if(momAllele1 == momAllele2){ //both parents hom if (dadAllele1 == dadAllele2){ //both parents hom same allele if (momAllele1 == dadAllele1){ //kid must be hom same allele if (allele1 != momAllele1 || allele2 != momAllele1) { mendErrNum ++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } //parents hom diff allele }else{ //kid must be het if (allele1 == allele2) { mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom hom dad het }else{ //kid can't be hom for non-momallele if (allele1 != momAllele1 && allele2 != momAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //mom het }else{ //dad hom if (dadAllele1 == dadAllele2){ //kid can't be hom for non-dadallele if(allele1 != dadAllele1 && allele2 != dadAllele1){ mendErrNum++; currentInd.zeroOutMarker(loc); currentFamily.getMember(currentInd.getMomID()).zeroOutMarker(loc); currentFamily.getMember(currentInd.getDadID()).zeroOutMarker(loc); } } //both parents het no mend err poss } } } //end mendel check } } } indList = currentFamily.getMemberList(); //loop through each individual in the current Family while(indList.hasMoreElements()){ currentInd = currentFamily.getMember((String)indList.nextElement()); if (currentInd.getIsTyped()){ byte[] markers = currentInd.getMarker(loc); allele1 = markers[0]; allele1_string = Integer.toString(allele1); allele2 = markers[1]; allele2_string = Integer.toString(allele2); String familyID = currentInd.getFamilyID(); incOrSetOne(numindivs,familyID); //no allele data missing if(allele1 > 0 && allele2 >0){ //indiv has parents if(currentInd.getMomID().compareTo(Individual.DATA_MISSING)==0 && currentInd.getDadID().compareTo(Individual.DATA_MISSING)==0){ //$parentgeno{$ped}++ //set parentgeno incOrSetOne(parentgeno,familyID); if(allele1 != allele2) { parenthet++; } else{ incOrSetOne(parenthom,allele1_string); } } else{//$kidgeno{$ped}++ incOrSetOne(kidgeno,familyID); } if(allele1 == allele2) { hom++; } else { het++; } //count number of allele incOrSetOne(count,allele1_string); incOrSetOne(count,allele2_string); } //missing data else missing++; } } } double obsHET = getObsHET(het, hom); double preHET = getPreHET(count); //HW p value double pvalue = getPValue(parenthom, parenthet); //geno percent double genopct = getGenoPercent(het, hom, missing); // num of families with a fully genotyped trio //int famTrio =0; int famTrio = getNumOfFamTrio(numindivs, parentgeno, kidgeno); //rating int rating = this.getRating(genopct, pvalue, obsHET, mendErrNum,maf); result.setObsHet(obsHET); result.setPredHet(preHET); result.setHWpvalue(pvalue); result.setGenoPercent(genopct); result.setFamTrioNum(famTrio); result.setMendErrNum(mendErrNum); result.setRating(rating); result.setName(name); return result; }
| 1,108,960
|
private int getRating(double genopct, double pval, double obsHet, int menderr){ int rating = 0; if (obsHet < 0.01){ rating -= 1; } if (genopct < failedGenoCut){ rating -= 2; } if (pval < hwCut){ rating -= 4; } if (menderr > numMendErrCut){ rating -= 8; } if (rating == 0){ rating = 1; } return rating; }
|
private int getRating(double genopct, double pval, double obsHet, int menderr, double maf){ int rating = 0; if (obsHet < 0.01){ rating -= 1; } if (genopct < failedGenoCut){ rating -= 2; } if (pval < hwCut){ rating -= 4; } if (menderr > numMendErrCut){ rating -= 8; } if (rating == 0){ rating = 1; } return rating; }
| 1,108,962
|
public String getMessage(){ // TODO: look in the message catalog and get an error string return "To be implemented:errorCode:" + errorCode; }
|
public String getMessage(){ // TODO: look in the message catalog and get an error string return ErrorCatalog.getMessage(errorCode, values); }
| 1,108,963
|
public static SwingWorker showUpdatePanel(){ final SwingWorker worker; worker = new SwingWorker(){ UpdateChecker uc; public Object construct() { uc = new UpdateChecker(); try { uc.checkForUpdate(); } catch(IOException ioe) { //this means we couldnt connect but we want it to die quietly } return null; } public void finished() { if(uc != null) { if(uc.isNewVersionAvailable()) { //theres an update available so lets pop some crap up final JLayeredPane jlp = window.getLayeredPane(); final JPanel udp = new JPanel(); if (Constants.BETA_VERSION == 0){ udp.setLayout(new BoxLayout(udp, BoxLayout.Y_AXIS)); double version = uc.getNewVersion(); Font detailsFont = new Font("Default", Font.PLAIN, 14); JLabel announceLabel = new JLabel("A newer version of Haploview (" +version+") is available."); announceLabel.setFont(detailsFont); JLabel detailsLabel = new JLabel("See \"Check for update\" in the file menu for details."); detailsLabel.setFont(detailsFont); udp.add(announceLabel); udp.add(detailsLabel); udp.setBorder(BorderFactory.createRaisedBevelBorder()); int width = udp.getPreferredSize().width; int height = udp.getPreferredSize().height; int borderwidth = udp.getBorder().getBorderInsets(udp).right; int borderheight = udp.getBorder().getBorderInsets(udp).bottom; udp.setBounds(jlp.getWidth()-width-borderwidth, jlp.getHeight()-height-borderheight, udp.getPreferredSize().width, udp.getPreferredSize().height); udp.setOpaque(true); jlp.add(udp, JLayeredPane.POPUP_LAYER); java.util.Timer updateTimer = new java.util.Timer(); //show this update message for 6.5 seconds updateTimer.schedule(new TimerTask() { public void run() { jlp.remove(udp); jlp.repaint(); } },6000); }else{ UpdateDisplayDialog betaUdp = new UpdateDisplayDialog(window,"Update Check",uc); betaUdp.pack(); betaUdp.setVisible(true); } } } } }; return worker; }
|
public static SwingWorker showUpdatePanel(){ final SwingWorker worker; worker = new SwingWorker(){ UpdateChecker uc; public Object construct() { uc = new UpdateChecker(); try { uc.checkForUpdate(); } catch(IOException ioe) { //this means we couldnt connect but we want it to die quietly } return null; } public void finished() { if(uc != null && Constants.BETA_VERSION == 0) { if(uc.isNewVersionAvailable()) { //theres an update available so lets pop some crap up final JLayeredPane jlp = window.getLayeredPane(); final JPanel udp = new JPanel(); if (Constants.BETA_VERSION == 0){ udp.setLayout(new BoxLayout(udp, BoxLayout.Y_AXIS)); double version = uc.getNewVersion(); Font detailsFont = new Font("Default", Font.PLAIN, 14); JLabel announceLabel = new JLabel("A newer version of Haploview (" +version+") is available."); announceLabel.setFont(detailsFont); JLabel detailsLabel = new JLabel("See \"Check for update\" in the file menu for details."); detailsLabel.setFont(detailsFont); udp.add(announceLabel); udp.add(detailsLabel); udp.setBorder(BorderFactory.createRaisedBevelBorder()); int width = udp.getPreferredSize().width; int height = udp.getPreferredSize().height; int borderwidth = udp.getBorder().getBorderInsets(udp).right; int borderheight = udp.getBorder().getBorderInsets(udp).bottom; udp.setBounds(jlp.getWidth()-width-borderwidth, jlp.getHeight()-height-borderheight, udp.getPreferredSize().width, udp.getPreferredSize().height); udp.setOpaque(true); jlp.add(udp, JLayeredPane.POPUP_LAYER); java.util.Timer updateTimer = new java.util.Timer(); //show this update message for 6.5 seconds updateTimer.schedule(new TimerTask() { public void run() { jlp.remove(udp); jlp.repaint(); } },6000); }else{ UpdateDisplayDialog betaUdp = new UpdateDisplayDialog(window,"Update Check",uc); betaUdp.pack(); betaUdp.setVisible(true); } } } } }; return worker; }
| 1,108,965
|
public static SwingWorker showUpdatePanel(){ final SwingWorker worker; worker = new SwingWorker(){ UpdateChecker uc; public Object construct() { uc = new UpdateChecker(); try { uc.checkForUpdate(); } catch(IOException ioe) { //this means we couldnt connect but we want it to die quietly } return null; } public void finished() { if(uc != null) { if(uc.isNewVersionAvailable()) { //theres an update available so lets pop some crap up final JLayeredPane jlp = window.getLayeredPane(); final JPanel udp = new JPanel(); if (Constants.BETA_VERSION == 0){ udp.setLayout(new BoxLayout(udp, BoxLayout.Y_AXIS)); double version = uc.getNewVersion(); Font detailsFont = new Font("Default", Font.PLAIN, 14); JLabel announceLabel = new JLabel("A newer version of Haploview (" +version+") is available."); announceLabel.setFont(detailsFont); JLabel detailsLabel = new JLabel("See \"Check for update\" in the file menu for details."); detailsLabel.setFont(detailsFont); udp.add(announceLabel); udp.add(detailsLabel); udp.setBorder(BorderFactory.createRaisedBevelBorder()); int width = udp.getPreferredSize().width; int height = udp.getPreferredSize().height; int borderwidth = udp.getBorder().getBorderInsets(udp).right; int borderheight = udp.getBorder().getBorderInsets(udp).bottom; udp.setBounds(jlp.getWidth()-width-borderwidth, jlp.getHeight()-height-borderheight, udp.getPreferredSize().width, udp.getPreferredSize().height); udp.setOpaque(true); jlp.add(udp, JLayeredPane.POPUP_LAYER); java.util.Timer updateTimer = new java.util.Timer(); //show this update message for 6.5 seconds updateTimer.schedule(new TimerTask() { public void run() { jlp.remove(udp); jlp.repaint(); } },6000); }else{ UpdateDisplayDialog betaUdp = new UpdateDisplayDialog(window,"Update Check",uc); betaUdp.pack(); betaUdp.setVisible(true); } } } } }; return worker; }
|
public static SwingWorker showUpdatePanel(){ final SwingWorker worker; worker = new SwingWorker(){ UpdateChecker uc; public Object construct() { uc = new UpdateChecker(); try { uc.checkForUpdate(); } catch(IOException ioe) { //this means we couldnt connect but we want it to die quietly } return null; } public void finished() { if(uc != null) { if(uc.isNewVersionAvailable()) { //theres an update available so lets pop some crap up final JLayeredPane jlp = window.getLayeredPane(); final JPanel udp = new JPanel(); if (Constants.BETA_VERSION == 0){ udp.setLayout(new BoxLayout(udp, BoxLayout.Y_AXIS)); double version = uc.getNewVersion(); Font detailsFont = new Font("Default", Font.PLAIN, 14); JLabel announceLabel = new JLabel("A newer version of Haploview (" +version+") is available."); announceLabel.setFont(detailsFont); JLabel detailsLabel = new JLabel("See \"Check for update\" in the file menu for details."); detailsLabel.setFont(detailsFont); udp.add(announceLabel); udp.add(detailsLabel); udp.setBorder(BorderFactory.createRaisedBevelBorder()); int width = udp.getPreferredSize().width; int height = udp.getPreferredSize().height; int borderwidth = udp.getBorder().getBorderInsets(udp).right; int borderheight = udp.getBorder().getBorderInsets(udp).bottom; udp.setBounds(jlp.getWidth()-width-borderwidth, jlp.getHeight()-height-borderheight, udp.getPreferredSize().width, udp.getPreferredSize().height); udp.setOpaque(true); jlp.add(udp, JLayeredPane.POPUP_LAYER); java.util.Timer updateTimer = new java.util.Timer(); //show this update message for 6.5 seconds updateTimer.schedule(new TimerTask() { public void run() { jlp.remove(udp); jlp.repaint(); } },6000); }else{ UpdateDisplayDialog betaUdp = new UpdateDisplayDialog(window,"Update Check",uc); betaUdp.pack(); betaUdp.setVisible(true); } } } } }; return worker; }
| 1,108,966
|
public static SwingWorker showUpdatePanel(){ final SwingWorker worker; worker = new SwingWorker(){ UpdateChecker uc; public Object construct() { uc = new UpdateChecker(); try { uc.checkForUpdate(); } catch(IOException ioe) { //this means we couldnt connect but we want it to die quietly } return null; } public void finished() { if(uc != null) { if(uc.isNewVersionAvailable()) { //theres an update available so lets pop some crap up final JLayeredPane jlp = window.getLayeredPane(); final JPanel udp = new JPanel(); if (Constants.BETA_VERSION == 0){ udp.setLayout(new BoxLayout(udp, BoxLayout.Y_AXIS)); double version = uc.getNewVersion(); Font detailsFont = new Font("Default", Font.PLAIN, 14); JLabel announceLabel = new JLabel("A newer version of Haploview (" +version+") is available."); announceLabel.setFont(detailsFont); JLabel detailsLabel = new JLabel("See \"Check for update\" in the file menu for details."); detailsLabel.setFont(detailsFont); udp.add(announceLabel); udp.add(detailsLabel); udp.setBorder(BorderFactory.createRaisedBevelBorder()); int width = udp.getPreferredSize().width; int height = udp.getPreferredSize().height; int borderwidth = udp.getBorder().getBorderInsets(udp).right; int borderheight = udp.getBorder().getBorderInsets(udp).bottom; udp.setBounds(jlp.getWidth()-width-borderwidth, jlp.getHeight()-height-borderheight, udp.getPreferredSize().width, udp.getPreferredSize().height); udp.setOpaque(true); jlp.add(udp, JLayeredPane.POPUP_LAYER); java.util.Timer updateTimer = new java.util.Timer(); //show this update message for 6.5 seconds updateTimer.schedule(new TimerTask() { public void run() { jlp.remove(udp); jlp.repaint(); } },6000); }else{ UpdateDisplayDialog betaUdp = new UpdateDisplayDialog(window,"Update Check",uc); betaUdp.pack(); betaUdp.setVisible(true); } } } } }; return worker; }
|
public static SwingWorker showUpdatePanel(){ final SwingWorker worker; worker = new SwingWorker(){ UpdateChecker uc; public Object construct() { uc = new UpdateChecker(); try { uc.checkForUpdate(); } catch(IOException ioe) { //this means we couldnt connect but we want it to die quietly } return null; } public void finished() { if(uc != null) { if(uc.isNewVersionAvailable()) { //theres an update available so lets pop some crap up final JLayeredPane jlp = window.getLayeredPane(); final JPanel udp = new JPanel(); if (Constants.BETA_VERSION == 0){ udp.setLayout(new BoxLayout(udp, BoxLayout.Y_AXIS)); double version = uc.getNewVersion(); Font detailsFont = new Font("Default", Font.PLAIN, 14); JLabel announceLabel = new JLabel("A newer version of Haploview (" +version+") is available."); announceLabel.setFont(detailsFont); JLabel detailsLabel = new JLabel("See \"Check for update\" in the file menu for details."); detailsLabel.setFont(detailsFont); udp.add(announceLabel); udp.add(detailsLabel); udp.setBorder(BorderFactory.createRaisedBevelBorder()); int width = udp.getPreferredSize().width; int height = udp.getPreferredSize().height; int borderwidth = udp.getBorder().getBorderInsets(udp).right; int borderheight = udp.getBorder().getBorderInsets(udp).bottom; udp.setBounds(jlp.getWidth()-width-borderwidth, jlp.getHeight()-height-borderheight, udp.getPreferredSize().width, udp.getPreferredSize().height); udp.setOpaque(true); jlp.add(udp, JLayeredPane.POPUP_LAYER); java.util.Timer updateTimer = new java.util.Timer(); //show this update message for 6.5 seconds updateTimer.schedule(new TimerTask() { public void run() { jlp.remove(udp); jlp.repaint(); } },6000); }else{ UpdateDisplayDialog betaUdp = new UpdateDisplayDialog(window,"Update Check",uc); betaUdp.pack(); betaUdp.setVisible(true); } } } } }; return worker; }
| 1,108,967
|
public void finished() { if(uc != null) { if(uc.isNewVersionAvailable()) { //theres an update available so lets pop some crap up final JLayeredPane jlp = window.getLayeredPane(); final JPanel udp = new JPanel(); if (Constants.BETA_VERSION == 0){ udp.setLayout(new BoxLayout(udp, BoxLayout.Y_AXIS)); double version = uc.getNewVersion(); Font detailsFont = new Font("Default", Font.PLAIN, 14); JLabel announceLabel = new JLabel("A newer version of Haploview (" +version+") is available."); announceLabel.setFont(detailsFont); JLabel detailsLabel = new JLabel("See \"Check for update\" in the file menu for details."); detailsLabel.setFont(detailsFont); udp.add(announceLabel); udp.add(detailsLabel); udp.setBorder(BorderFactory.createRaisedBevelBorder()); int width = udp.getPreferredSize().width; int height = udp.getPreferredSize().height; int borderwidth = udp.getBorder().getBorderInsets(udp).right; int borderheight = udp.getBorder().getBorderInsets(udp).bottom; udp.setBounds(jlp.getWidth()-width-borderwidth, jlp.getHeight()-height-borderheight, udp.getPreferredSize().width, udp.getPreferredSize().height); udp.setOpaque(true); jlp.add(udp, JLayeredPane.POPUP_LAYER); java.util.Timer updateTimer = new java.util.Timer(); //show this update message for 6.5 seconds updateTimer.schedule(new TimerTask() { public void run() { jlp.remove(udp); jlp.repaint(); } },6000); }else{ UpdateDisplayDialog betaUdp = new UpdateDisplayDialog(window,"Update Check",uc); betaUdp.pack(); betaUdp.setVisible(true); } } } }
|
public void finished() { if(uc != null && Constants.BETA_VERSION == 0) { if(uc.isNewVersionAvailable()) { //theres an update available so lets pop some crap up final JLayeredPane jlp = window.getLayeredPane(); final JPanel udp = new JPanel(); if (Constants.BETA_VERSION == 0){ udp.setLayout(new BoxLayout(udp, BoxLayout.Y_AXIS)); double version = uc.getNewVersion(); Font detailsFont = new Font("Default", Font.PLAIN, 14); JLabel announceLabel = new JLabel("A newer version of Haploview (" +version+") is available."); announceLabel.setFont(detailsFont); JLabel detailsLabel = new JLabel("See \"Check for update\" in the file menu for details."); detailsLabel.setFont(detailsFont); udp.add(announceLabel); udp.add(detailsLabel); udp.setBorder(BorderFactory.createRaisedBevelBorder()); int width = udp.getPreferredSize().width; int height = udp.getPreferredSize().height; int borderwidth = udp.getBorder().getBorderInsets(udp).right; int borderheight = udp.getBorder().getBorderInsets(udp).bottom; udp.setBounds(jlp.getWidth()-width-borderwidth, jlp.getHeight()-height-borderheight, udp.getPreferredSize().width, udp.getPreferredSize().height); udp.setOpaque(true); jlp.add(udp, JLayeredPane.POPUP_LAYER); java.util.Timer updateTimer = new java.util.Timer(); //show this update message for 6.5 seconds updateTimer.schedule(new TimerTask() { public void run() { jlp.remove(udp); jlp.repaint(); } },6000); }else{ UpdateDisplayDialog betaUdp = new UpdateDisplayDialog(window,"Update Check",uc); betaUdp.pack(); betaUdp.setVisible(true); } } } }
| 1,108,968
|
public void finished() { if(uc != null) { if(uc.isNewVersionAvailable()) { //theres an update available so lets pop some crap up final JLayeredPane jlp = window.getLayeredPane(); final JPanel udp = new JPanel(); if (Constants.BETA_VERSION == 0){ udp.setLayout(new BoxLayout(udp, BoxLayout.Y_AXIS)); double version = uc.getNewVersion(); Font detailsFont = new Font("Default", Font.PLAIN, 14); JLabel announceLabel = new JLabel("A newer version of Haploview (" +version+") is available."); announceLabel.setFont(detailsFont); JLabel detailsLabel = new JLabel("See \"Check for update\" in the file menu for details."); detailsLabel.setFont(detailsFont); udp.add(announceLabel); udp.add(detailsLabel); udp.setBorder(BorderFactory.createRaisedBevelBorder()); int width = udp.getPreferredSize().width; int height = udp.getPreferredSize().height; int borderwidth = udp.getBorder().getBorderInsets(udp).right; int borderheight = udp.getBorder().getBorderInsets(udp).bottom; udp.setBounds(jlp.getWidth()-width-borderwidth, jlp.getHeight()-height-borderheight, udp.getPreferredSize().width, udp.getPreferredSize().height); udp.setOpaque(true); jlp.add(udp, JLayeredPane.POPUP_LAYER); java.util.Timer updateTimer = new java.util.Timer(); //show this update message for 6.5 seconds updateTimer.schedule(new TimerTask() { public void run() { jlp.remove(udp); jlp.repaint(); } },6000); }else{ UpdateDisplayDialog betaUdp = new UpdateDisplayDialog(window,"Update Check",uc); betaUdp.pack(); betaUdp.setVisible(true); } } } }
|
public void finished() { if(uc != null) { if(uc.isNewVersionAvailable()) { //theres an update available so lets pop some crap up final JLayeredPane jlp = window.getLayeredPane(); final JPanel udp = new JPanel(); if (Constants.BETA_VERSION == 0){ udp.setLayout(new BoxLayout(udp, BoxLayout.Y_AXIS)); double version = uc.getNewVersion(); Font detailsFont = new Font("Default", Font.PLAIN, 14); JLabel announceLabel = new JLabel("A newer version of Haploview (" +version+") is available."); announceLabel.setFont(detailsFont); JLabel detailsLabel = new JLabel("See \"Check for update\" in the file menu for details."); detailsLabel.setFont(detailsFont); udp.add(announceLabel); udp.add(detailsLabel); udp.setBorder(BorderFactory.createRaisedBevelBorder()); int width = udp.getPreferredSize().width; int height = udp.getPreferredSize().height; int borderwidth = udp.getBorder().getBorderInsets(udp).right; int borderheight = udp.getBorder().getBorderInsets(udp).bottom; udp.setBounds(jlp.getWidth()-width-borderwidth, jlp.getHeight()-height-borderheight, udp.getPreferredSize().width, udp.getPreferredSize().height); udp.setOpaque(true); jlp.add(udp, JLayeredPane.POPUP_LAYER); java.util.Timer updateTimer = new java.util.Timer(); //show this update message for 6.5 seconds updateTimer.schedule(new TimerTask() { public void run() { jlp.remove(udp); jlp.repaint(); } },6000); }else{ UpdateDisplayDialog betaUdp = new UpdateDisplayDialog(window,"Update Check",uc); betaUdp.pack(); betaUdp.setVisible(true); } } } }
| 1,108,969
|
public void finished() { if(uc != null) { if(uc.isNewVersionAvailable()) { //theres an update available so lets pop some crap up final JLayeredPane jlp = window.getLayeredPane(); final JPanel udp = new JPanel(); if (Constants.BETA_VERSION == 0){ udp.setLayout(new BoxLayout(udp, BoxLayout.Y_AXIS)); double version = uc.getNewVersion(); Font detailsFont = new Font("Default", Font.PLAIN, 14); JLabel announceLabel = new JLabel("A newer version of Haploview (" +version+") is available."); announceLabel.setFont(detailsFont); JLabel detailsLabel = new JLabel("See \"Check for update\" in the file menu for details."); detailsLabel.setFont(detailsFont); udp.add(announceLabel); udp.add(detailsLabel); udp.setBorder(BorderFactory.createRaisedBevelBorder()); int width = udp.getPreferredSize().width; int height = udp.getPreferredSize().height; int borderwidth = udp.getBorder().getBorderInsets(udp).right; int borderheight = udp.getBorder().getBorderInsets(udp).bottom; udp.setBounds(jlp.getWidth()-width-borderwidth, jlp.getHeight()-height-borderheight, udp.getPreferredSize().width, udp.getPreferredSize().height); udp.setOpaque(true); jlp.add(udp, JLayeredPane.POPUP_LAYER); java.util.Timer updateTimer = new java.util.Timer(); //show this update message for 6.5 seconds updateTimer.schedule(new TimerTask() { public void run() { jlp.remove(udp); jlp.repaint(); } },6000); }else{ UpdateDisplayDialog betaUdp = new UpdateDisplayDialog(window,"Update Check",uc); betaUdp.pack(); betaUdp.setVisible(true); } } } }
|
public void finished() { if(uc != null) { if(uc.isNewVersionAvailable()) { //theres an update available so lets pop some crap up final JLayeredPane jlp = window.getLayeredPane(); final JPanel udp = new JPanel(); if (Constants.BETA_VERSION == 0){ udp.setLayout(new BoxLayout(udp, BoxLayout.Y_AXIS)); double version = uc.getNewVersion(); Font detailsFont = new Font("Default", Font.PLAIN, 14); JLabel announceLabel = new JLabel("A newer version of Haploview (" +version+") is available."); announceLabel.setFont(detailsFont); JLabel detailsLabel = new JLabel("See \"Check for update\" in the file menu for details."); detailsLabel.setFont(detailsFont); udp.add(announceLabel); udp.add(detailsLabel); udp.setBorder(BorderFactory.createRaisedBevelBorder()); int width = udp.getPreferredSize().width; int height = udp.getPreferredSize().height; int borderwidth = udp.getBorder().getBorderInsets(udp).right; int borderheight = udp.getBorder().getBorderInsets(udp).bottom; udp.setBounds(jlp.getWidth()-width-borderwidth, jlp.getHeight()-height-borderheight, udp.getPreferredSize().width, udp.getPreferredSize().height); udp.setOpaque(true); jlp.add(udp, JLayeredPane.POPUP_LAYER); java.util.Timer updateTimer = new java.util.Timer(); //show this update message for 6.5 seconds updateTimer.schedule(new TimerTask() { public void run() { jlp.remove(udp); jlp.repaint(); } },6000); }else{ UpdateDisplayDialog betaUdp = new UpdateDisplayDialog(window,"Update Check",uc); betaUdp.pack(); betaUdp.setVisible(true); } } } }
| 1,108,970
|
private void init() throws ArchitectException { int accelMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); prefs = PrefsUtils.getUserPrefsNode(architectSession); CoreUserSettings us; // must be done right away, because a static // initializer in this class effects BeanUtils // behaviour which the XML Digester relies // upon heavily //TypeMap.getInstance(); contentPane = (JComponent)getContentPane(); try { ConfigFile cf = ConfigFile.getDefaultInstance(); us = cf.read(getArchitectSession()); architectSession.setUserSettings(us); sprefs = architectSession.getUserSettings().getSwingSettings(); } catch (IOException e) { throw new ArchitectException("prefs.read", e); } while (!us.isPlDotIniPathValid()) { String message; String[] options = new String[] {"Browse", "Create"}; if (us.getPlDotIniPath() == null) { message = "location is not set"; } else if (new File(us.getPlDotIniPath()).isFile()) { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n could not be read"; } else { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n does not exist"; } int choice = JOptionPane.showOptionDialog(null, // blocking wait "The Architect keeps its list of database connections" + "\nin a file called PL.INI. Your PL.INI "+message+"." + "\n\nYou can browse for an existing PL.INI file on your system" + "\nor allow the Architect to create a new one in your home directory." + "\n\nHint: If you are a Power*Loader Suite user, you should browse for" + "\nan existing PL.INI in your Power*Loader installation directory.", "Missing PL.INI", 0, JOptionPane.INFORMATION_MESSAGE, null, options, null); File newPlIniFile; if (choice == JOptionPane.CLOSED_OPTION) { throw new ArchitectException("Can't start without a pl.ini file"); } else if (choice == 0) { JFileChooser fc = new JFileChooser(); fc.setFileFilter(ASUtils.INI_FILE_FILTER); fc.setDialogTitle("Locate your PL.INI file"); int fcChoice = fc.showOpenDialog(null); // blocking wait if (fcChoice == JFileChooser.APPROVE_OPTION) { newPlIniFile = fc.getSelectedFile(); } else { newPlIniFile = null; } } else if (choice == 1) { newPlIniFile = new File(System.getProperty("user.home"), "pl.ini"); } else throw new ArchitectException("Unexpected return from JOptionPane.showOptionDialog to get pl.ini"); if (newPlIniFile != null) try { newPlIniFile.createNewFile(); us.setPlDotIniPath(newPlIniFile.getPath()); } catch (IOException e1) { logger.error("Caught IO exception while creating empty PL.INI at \"" +newPlIniFile.getPath()+"\"", e1); JOptionPane.showMessageDialog(null, "Failed to create file \""+newPlIniFile.getPath()+"\":\n"+e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } // Create actions aboutAction = new AboutAction(); Action helpAction = new HelpAction(); newProjectAction = new AbstractAction("New Project", ASUtils.createJLFIcon("general/New","New Project",sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { if (promptForUnsavedModifications()) { try { prefs.putInt(SwingUserSettings.DIVIDER_LOCATION, splitPane.getDividerLocation()); closeProject(getProject()); setProject(new SwingUIProject("New Project")); logger.debug("Glass pane is "+getGlassPane()); } catch (Exception ex) { JOptionPane.showMessageDialog(ArchitectFrame.this, "Can't create new project: "+ex.getMessage()); logger.error("Got exception while creating new project", ex); } } } }; newProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "New"); newProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, accelMask)); recent = new RecentMenu(this) { @Override public void loadFile(String fileName) throws IOException { File f = new File(fileName); LoadFileWorker worker; try { worker = new LoadFileWorker(f,null); new Thread(worker).start(); } catch (FileNotFoundException e1) { JOptionPane.showMessageDialog( ArchitectFrame.this, "File not found: "+f.getPath()); } catch (Exception e1) { ASUtils.showExceptionDialog( ArchitectFrame.this, "Error loading file", e1); } } }; openProjectAction = new OpenProjectAction(recent); JMenuItem clearItem = new JMenuItem("Clear Recent Files"); clearItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { recent.clear(); } }); saveProjectAction = new AbstractAction("Save Project", ASUtils.createJLFIcon("general/Save", "Save Project", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(false, true); } }; saveProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save"); saveProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, accelMask)); saveProjectAsAction = new AbstractAction("Save Project As...", ASUtils.createJLFIcon("general/SaveAs", "Save Project As...", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(true, true); } }; saveProjectAsAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save As"); prefAction = new PreferencesAction(); projectSettingsAction = new ProjectSettingsAction(); projectSettingsAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_COMMA, accelMask)); printAction = new PrintAction(); printAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_P, accelMask)); zoomInAction = new ZoomAction(ZOOM_STEP); zoomOutAction = new ZoomAction(ZOOM_STEP * -1.0); zoomNormalAction = new AbstractAction("Reset Zoom", ASUtils.createJLFIcon("general/Zoom", "Reset Zoom", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { playpen.setZoom(1.0); } }; zoomNormalAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Reset Zoom"); zoomAllAction = new AbstractAction("Zoom to fit", ASUtils.createJLFIcon("general/Zoom", "Reset Zoom", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { Rectangle rect = null; if ( playpen != null ) { for (int i = 0; i < playpen.getContentPane().getComponentCount(); i++) { PlayPenComponent ppc = playpen.getContentPane().getComponent(i); if ( rect == null ) { rect = new Rectangle(ppc.getLocation(),ppc.getSize()); } else { rect.add(ppc.getBounds()); } } } if ( rect == null ) return; double zoom = Math.min(playpen.getViewportSize().getHeight()/rect.height, playpen.getViewportSize().getWidth()/rect.width); zoom *= 0.90; playpen.setZoom(zoom); playpen.scrollRectToVisible(playpen.zoomRect(rect)); } }; zoomAllAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Zoom to fit"); undoAction = new UndoAction(); redoAction = new RedoAction(); autoLayoutAction = new AutoLayoutAction(); autoLayout = new FruchtermanReingoldForceLayout(); autoLayoutAction.setLayout(autoLayout); exportDDLAction = new ExportDDLAction(); compareDMAction = new CompareDMAction(); exportPLTransAction = new ExportPLTransAction(); exportPLJobXMLAction = new ExportPLJobXMLAction(); quickStartAction = new QuickStartAction(); Action exportCSVAction = new AbstractAction("Export CSV File") { public void actionPerformed(ActionEvent e) { try { ExportCSV export = new ExportCSV(getProject().getPlayPen().getDatabase().getTables()); File file = null; JFileChooser fileDialog = new JFileChooser(); fileDialog.setSelectedFile(new File("map.csv")); if (fileDialog.showSaveDialog(ArchitectFrame.getMainInstance()) == JFileChooser.APPROVE_OPTION){ file = fileDialog.getSelectedFile(); } else { return; } FileWriter output = null; output = new FileWriter(file); output.write(export.getCSVMapping()); output.flush(); } catch (IOException e1) { throw new RuntimeException(e1); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } } }; Action mappingReportAction = new AbstractAction("Visual Mapping Report") { // TODO convert this to an architect pane public void actionPerformed(ActionEvent e) { try { final MappingReport mr ; final List<SQLTable> selectedTables; if (playpen.getSelectedTables().size() == 0) { selectedTables = new ArrayList(playpen.getTables()); } else { if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(ArchitectFrame.getMainInstance(),"View only the "+playpen.getSelectedTables().size()+" selected tables","Show Mapping",JOptionPane.YES_NO_OPTION)) { selectedTables = new ArrayList<SQLTable>(); for(TablePane tp: playpen.getSelectedTables()) { selectedTables.add(tp.getModel()); } } else { selectedTables = new ArrayList(playpen.getTables()); } } mr = new MappingReport(selectedTables); final JFrame f = new JFrame("Mapping Report"); // You call this a radar?? -- No sir, we call it Mr. Panel. JPanel mrPanel = new JPanel() { protected void paintComponent(java.awt.Graphics g) { super.paintComponent(g); try { mr.drawHighLevelReport((Graphics2D) g,null); } catch (ArchitectException e1) { logger.error("ArchitectException while generating mapping diagram", e1); ASUtils.showExceptionDialog(ArchitectFrame.this, "Couldn't generate mapping diagram", e1); } } }; mrPanel.setDoubleBuffered(true); mrPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); mrPanel.setPreferredSize(mr.getRequiredSize()); mrPanel.setOpaque(true); mrPanel.setBackground(Color.WHITE); ButtonBarBuilder buttonBar = new ButtonBarBuilder(); JButton csv = new JButton(new AbstractAction(){ public void actionPerformed(ActionEvent e) { try { ExportCSV export = new ExportCSV(selectedTables); File file = null; JFileChooser fileDialog = new JFileChooser(); fileDialog.setSelectedFile(new File("map.csv")); if (fileDialog.showSaveDialog(ArchitectFrame.getMainInstance()) == JFileChooser.APPROVE_OPTION){ file = fileDialog.getSelectedFile(); } else { return; } FileWriter output = null; output = new FileWriter(file); output.write(export.getCSVMapping()); output.flush(); } catch (IOException e1) { throw new RuntimeException(e1); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } } }); csv.setText("Export CSV"); buttonBar.addGriddedGrowing(csv); ExportPLTransAction plTransaction = new ExportPLTransAction(); JButton pl = new JButton(plTransaction); plTransaction.setExportingTables(selectedTables); pl.setText("Export PL Transaction"); buttonBar.addRelatedGap(); buttonBar.addGriddedGrowing(pl); JButton close = new JButton(new AbstractAction(){ public void actionPerformed(ActionEvent e) { f.setVisible(false); } }); close.setText("Close"); buttonBar.addRelatedGap(); buttonBar.addGriddedGrowing(close); JPanel basePane = new JPanel(new BorderLayout(5,5)); basePane.add(new JScrollPane(mrPanel),BorderLayout.CENTER); basePane.add(buttonBar.getPanel(),BorderLayout.SOUTH); f.setContentPane(basePane); f.pack(); ASUtils.centre(f); f.setVisible(true); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } } }; deleteSelectedAction = new DeleteSelectedAction(); createIdentifyingRelationshipAction = new CreateRelationshipAction(true); createNonIdentifyingRelationshipAction = new CreateRelationshipAction(false); editRelationshipAction = new EditRelationshipAction(); createTableAction = new CreateTableAction(); editColumnAction = new EditColumnAction(); insertColumnAction = new InsertColumnAction(); editTableAction = new EditTableAction(); searchReplaceAction = new SearchReplaceAction(); searchReplaceAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F, accelMask)); selectAllAction = new SelectAllAction(); selectAllAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_A, accelMask)); /* profiling stuff */ profileAction = new ProfilePanelAction(); //viewProfileAction = new ViewProfileAction(); not being used for second architect release menuBar = new JMenuBar(); //Settingup JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic('f'); fileMenu.add(newProjectAction); fileMenu.add(openProjectAction); fileMenu.add(recent); fileMenu.add(clearItem); fileMenu.addSeparator(); fileMenu.add(saveProjectAction); fileMenu.add(saveProjectAsAction); fileMenu.add(printAction); fileMenu.addSeparator(); if (!MAC_OS_X) { fileMenu.add(prefAction); } fileMenu.add(saveSettingsAction); fileMenu.add(projectSettingsAction); if (!MAC_OS_X) { fileMenu.addSeparator(); fileMenu.add(exitAction); } menuBar.add(fileMenu); JMenu editMenu = new JMenu("Edit"); editMenu.setMnemonic('e'); editMenu.add(undoAction); editMenu.add(redoAction); editMenu.addSeparator(); editMenu.add(selectAllAction); editMenu.addSeparator(); editMenu.add(searchReplaceAction); menuBar.add(editMenu); // the connections menu is set up when a new project is created (because it depends on the current DBTree) connectionsMenu = new JMenu("Connections"); connectionsMenu.setMnemonic('c'); menuBar.add(connectionsMenu); JMenu etlMenu = new JMenu("ETL"); etlMenu.setMnemonic('l'); JMenu etlSubmenuOne = new JMenu("Power*Loader"); etlSubmenuOne.add(exportPLTransAction); // Todo add in ability to run the engine from the architect /* Action runPL = new RunPLAction(); runPL.putValue(Action.NAME,"Run Power*Loader"); etlSubmenuOne.add(runPL); */ etlSubmenuOne.add(exportPLJobXMLAction); etlSubmenuOne.add(quickStartAction); etlMenu.add(etlSubmenuOne); etlMenu.add(exportCSVAction); etlMenu.add(mappingReportAction); menuBar.add(etlMenu); JMenu toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic('t'); toolsMenu.add(exportDDLAction); toolsMenu.add(compareDMAction); toolsMenu.add(new SQLRunnerAction()); menuBar.add(toolsMenu); JMenu profileMenu = new JMenu("Profile"); profileMenu.setMnemonic('p'); profileMenu.add(profileAction); //profileMenu.add(viewProfileAction);not being used for second architect release menuBar.add(profileMenu); JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic('h'); if (!MAC_OS_X) { helpMenu.add(aboutAction); helpMenu.addSeparator(); } helpMenu.add(helpAction); menuBar.add(helpMenu); setJMenuBar(menuBar); projectBar = new JToolBar(JToolBar.HORIZONTAL); ppBar = new JToolBar(JToolBar.VERTICAL); projectBar.add(newProjectAction); projectBar.add(openProjectAction); projectBar.add(saveProjectAction); projectBar.addSeparator(); projectBar.add(printAction); projectBar.addSeparator(); projectBar.add(undoAction); projectBar.add(redoAction); projectBar.addSeparator(); projectBar.add(exportDDLAction); projectBar.add(compareDMAction); projectBar.addSeparator(); projectBar.add(autoLayoutAction); projectBar.add(profileAction); projectBar.addSeparator(); projectBar.add(helpAction); projectBar.setToolTipText("Project Toolbar"); projectBar.setName("Project Toolbar"); JButton tempButton = null; // shared actions need to report where they are coming from ppBar.setToolTipText("PlayPen Toolbar"); ppBar.setName("PlayPen ToolBar"); ppBar.add(zoomInAction); ppBar.add(zoomOutAction); ppBar.add(zoomNormalAction); ppBar.add(zoomAllAction); ppBar.addSeparator(); tempButton = ppBar.add(deleteSelectedAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(createTableAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(insertColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); tempButton = ppBar.add(editColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); ppBar.add(createNonIdentifyingRelationshipAction); ppBar.add(createIdentifyingRelationshipAction); tempButton = ppBar.add(editRelationshipAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); Container projectBarPane = getContentPane(); projectBarPane.setLayout(new BorderLayout()); projectBarPane.add(projectBar, BorderLayout.NORTH); JPanel cp = new JPanel(new BorderLayout()); cp.add(ppBar, BorderLayout.EAST); projectBarPane.add(cp, BorderLayout.CENTER); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); cp.add(splitPane, BorderLayout.CENTER); logger.debug("Added splitpane to content pane"); splitPane.setDividerLocation(prefs.getInt(SwingUserSettings.DIVIDER_LOCATION,150)); Rectangle bounds = new Rectangle(); bounds.x = prefs.getInt(SwingUserSettings.MAIN_FRAME_X, 40); bounds.y = prefs.getInt(SwingUserSettings.MAIN_FRAME_Y, 40); bounds.width = prefs.getInt(SwingUserSettings.MAIN_FRAME_WIDTH, 600); bounds.height = prefs.getInt(SwingUserSettings.MAIN_FRAME_HEIGHT, 440); setBounds(bounds); addWindowListener(afWindowListener = new ArchitectFrameWindowListener()); setProject(new SwingUIProject("New Project")); }
|
private void init() throws ArchitectException { int accelMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); prefs = PrefsUtils.getUserPrefsNode(architectSession); CoreUserSettings us; // must be done right away, because a static // initializer in this class effects BeanUtils // behaviour which the XML Digester relies // upon heavily //TypeMap.getInstance(); contentPane = (JComponent)getContentPane(); try { ConfigFile cf = ConfigFile.getDefaultInstance(); us = cf.read(getArchitectSession()); architectSession.setUserSettings(us); sprefs = architectSession.getUserSettings().getSwingSettings(); } catch (IOException e) { throw new ArchitectException("prefs.read", e); } while (!us.isPlDotIniPathValid()) { String message; String[] options = new String[] {"Browse", "Create"}; if (us.getPlDotIniPath() == null) { message = "location is not set"; } else if (new File(us.getPlDotIniPath()).isFile()) { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n could not be read"; } else { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n does not exist"; } int choice = JOptionPane.showOptionDialog(null, // blocking wait "The Architect keeps its list of database connections" + "\nin a file called PL.INI. Your PL.INI "+message+"." + "\n\nYou can browse for an existing PL.INI file on your system" + "\nor allow the Architect to create a new one in your home directory." + "\n\nHint: If you are a Power*Loader Suite user, you should browse for" + "\nan existing PL.INI in your Power*Loader installation directory.", "Missing PL.INI", 0, JOptionPane.INFORMATION_MESSAGE, null, options, null); File newPlIniFile; if (choice == JOptionPane.CLOSED_OPTION) { throw new ArchitectException("Can't start without a pl.ini file"); } else if (choice == 0) { JFileChooser fc = new JFileChooser(); fc.setFileFilter(ASUtils.INI_FILE_FILTER); fc.setDialogTitle("Locate your PL.INI file"); int fcChoice = fc.showOpenDialog(null); // blocking wait if (fcChoice == JFileChooser.APPROVE_OPTION) { newPlIniFile = fc.getSelectedFile(); } else { newPlIniFile = null; } } else if (choice == 1) { newPlIniFile = new File(System.getProperty("user.home"), "pl.ini"); } else throw new ArchitectException("Unexpected return from JOptionPane.showOptionDialog to get pl.ini"); if (newPlIniFile != null) try { newPlIniFile.createNewFile(); us.setPlDotIniPath(newPlIniFile.getPath()); } catch (IOException e1) { logger.error("Caught IO exception while creating empty PL.INI at \"" +newPlIniFile.getPath()+"\"", e1); JOptionPane.showMessageDialog(null, "Failed to create file \""+newPlIniFile.getPath()+"\":\n"+e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } // Create actions aboutAction = new AboutAction(); Action helpAction = new HelpAction(); newProjectAction = new AbstractAction("New Project", ASUtils.createJLFIcon("general/New","New Project",sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { if (promptForUnsavedModifications()) { try { prefs.putInt(SwingUserSettings.DIVIDER_LOCATION, splitPane.getDividerLocation()); closeProject(getProject()); setProject(new SwingUIProject("New Project")); logger.debug("Glass pane is "+getGlassPane()); } catch (Exception ex) { JOptionPane.showMessageDialog(ArchitectFrame.this, "Can't create new project: "+ex.getMessage()); logger.error("Got exception while creating new project", ex); } } } }; newProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "New"); newProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, accelMask)); recent = new RecentMenu(this) { @Override public void loadFile(String fileName) throws IOException { File f = new File(fileName); LoadFileWorker worker; try { worker = new LoadFileWorker(f,null); new Thread(worker).start(); } catch (FileNotFoundException e1) { JOptionPane.showMessageDialog( ArchitectFrame.this, "File not found: "+f.getPath()); } catch (Exception e1) { ASUtils.showExceptionDialog( ArchitectFrame.this, "Error loading file", e1); } } }; openProjectAction = new OpenProjectAction(recent); JMenuItem clearItem = new JMenuItem("Clear Recent Files"); clearItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { recent.clear(); } }); saveProjectAction = new AbstractAction("Save Project", ASUtils.createJLFIcon("general/Save", "Save Project", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(false, true); } }; saveProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save"); saveProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, accelMask)); saveProjectAsAction = new AbstractAction("Save Project As...", ASUtils.createJLFIcon("general/SaveAs", "Save Project As...", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(true, true); } }; saveProjectAsAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save As"); prefAction = new PreferencesAction(); projectSettingsAction = new ProjectSettingsAction(); projectSettingsAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_COMMA, accelMask)); printAction = new PrintAction(); printAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_P, accelMask)); zoomInAction = new ZoomAction(ZOOM_STEP); zoomOutAction = new ZoomAction(ZOOM_STEP * -1.0); zoomNormalAction = new AbstractAction("Reset Zoom", ASUtils.createJLFIcon("general/Zoom", "Reset Zoom", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { playpen.setZoom(1.0); } }; zoomNormalAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Reset Zoom"); zoomAllAction = new AbstractAction("Zoom to fit", ASUtils.createJLFIcon("general/Zoom", "Reset Zoom", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { Rectangle rect = null; if ( playpen != null ) { for (int i = 0; i < playpen.getContentPane().getComponentCount(); i++) { PlayPenComponent ppc = playpen.getContentPane().getComponent(i); if ( rect == null ) { rect = new Rectangle(ppc.getLocation(),ppc.getSize()); } else { rect.add(ppc.getBounds()); } } } if ( rect == null ) return; double zoom = Math.min(playpen.getViewportSize().getHeight()/rect.height, playpen.getViewportSize().getWidth()/rect.width); zoom *= 0.90; playpen.setZoom(zoom); playpen.scrollRectToVisible(playpen.zoomRect(rect)); } }; zoomAllAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Zoom to fit"); undoAction = new UndoAction(); redoAction = new RedoAction(); autoLayoutAction = new AutoLayoutAction(); autoLayout = new FruchtermanReingoldForceLayout(); autoLayoutAction.setLayout(autoLayout); exportDDLAction = new ExportDDLAction(); compareDMAction = new CompareDMAction(); exportPLTransAction = new ExportPLTransAction(); exportPLJobXMLAction = new ExportPLJobXMLAction(); quickStartAction = new QuickStartAction(); Action exportCSVAction = new AbstractAction("Export CSV File") { public void actionPerformed(ActionEvent e) { try { ExportCSV export = new ExportCSV(getProject().getPlayPen().getDatabase().getTables()); File file = null; JFileChooser fileDialog = new JFileChooser(); fileDialog.setSelectedFile(new File("map.csv")); if (fileDialog.showSaveDialog(ArchitectFrame.getMainInstance()) == JFileChooser.APPROVE_OPTION){ file = fileDialog.getSelectedFile(); } else { return; } FileWriter output = null; output = new FileWriter(file); output.write(export.getCSVMapping()); output.flush(); } catch (IOException e1) { throw new RuntimeException(e1); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } } }; Action mappingReportAction = new AbstractAction("Visual Mapping Report") { // TODO convert this to an architect pane public void actionPerformed(ActionEvent e) { try { final MappingReport mr ; final List<SQLTable> selectedTables; if (playpen.getSelectedTables().size() == 0) { selectedTables = new ArrayList(playpen.getTables()); } else { if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(ArchitectFrame.getMainInstance(),"View only the "+playpen.getSelectedTables().size()+" selected tables","Show Mapping",JOptionPane.YES_NO_OPTION)) { selectedTables = new ArrayList<SQLTable>(); for(TablePane tp: playpen.getSelectedTables()) { selectedTables.add(tp.getModel()); } } else { selectedTables = new ArrayList(playpen.getTables()); } } mr = new MappingReport(selectedTables); final JFrame f = new JFrame("Mapping Report"); // You call this a radar?? -- No sir, we call it Mr. Panel. JPanel mrPanel = new JPanel() { protected void paintComponent(java.awt.Graphics g) { super.paintComponent(g); try { mr.drawHighLevelReport((Graphics2D) g,null); } catch (ArchitectException e1) { logger.error("ArchitectException while generating mapping diagram", e1); ASUtils.showExceptionDialog(ArchitectFrame.this, "Couldn't generate mapping diagram", e1); } } }; mrPanel.setDoubleBuffered(true); mrPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); mrPanel.setPreferredSize(mr.getRequiredSize()); mrPanel.setOpaque(true); mrPanel.setBackground(Color.WHITE); ButtonBarBuilder buttonBar = new ButtonBarBuilder(); JButton csv = new JButton(new AbstractAction(){ public void actionPerformed(ActionEvent e) { try { ExportCSV export = new ExportCSV(selectedTables); File file = null; JFileChooser fileDialog = new JFileChooser(); fileDialog.setSelectedFile(new File("map.csv")); if (fileDialog.showSaveDialog(ArchitectFrame.getMainInstance()) == JFileChooser.APPROVE_OPTION){ file = fileDialog.getSelectedFile(); } else { return; } FileWriter output = null; output = new FileWriter(file); output.write(export.getCSVMapping()); output.flush(); } catch (IOException e1) { throw new RuntimeException(e1); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } } }); csv.setText("Export CSV"); buttonBar.addGriddedGrowing(csv); ExportPLTransAction plTransaction = new ExportPLTransAction(); JButton pl = new JButton(plTransaction); plTransaction.setExportingTables(selectedTables); pl.setText("Export PL Transaction"); buttonBar.addRelatedGap(); buttonBar.addGriddedGrowing(pl); JButton close = new JButton(new AbstractAction(){ public void actionPerformed(ActionEvent e) { f.setVisible(false); } }); close.setText("Close"); buttonBar.addRelatedGap(); buttonBar.addGriddedGrowing(close); JPanel basePane = new JPanel(new BorderLayout(5,5)); basePane.add(new JScrollPane(mrPanel),BorderLayout.CENTER); basePane.add(buttonBar.getPanel(),BorderLayout.SOUTH); f.setContentPane(basePane); f.pack(); ASUtils.centre(f); f.setVisible(true); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } } }; deleteSelectedAction = new DeleteSelectedAction(); createIdentifyingRelationshipAction = new CreateRelationshipAction(true); createNonIdentifyingRelationshipAction = new CreateRelationshipAction(false); editRelationshipAction = new EditRelationshipAction(); createTableAction = new CreateTableAction(); editColumnAction = new EditColumnAction(); insertColumnAction = new InsertColumnAction(); editTableAction = new EditTableAction(); searchReplaceAction = new SearchReplaceAction(); searchReplaceAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F, accelMask)); selectAllAction = new SelectAllAction(); selectAllAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_A, accelMask)); /* profiling stuff */ profileAction = new ProfilePanelAction(); //viewProfileAction = new ViewProfileAction(); not being used for second architect release menuBar = new JMenuBar(); //Settingup JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic('f'); fileMenu.add(newProjectAction); fileMenu.add(openProjectAction); fileMenu.add(recent); fileMenu.add(clearItem); fileMenu.addSeparator(); fileMenu.add(saveProjectAction); fileMenu.add(saveProjectAsAction); fileMenu.add(printAction); fileMenu.addSeparator(); if (!MAC_OS_X) { fileMenu.add(prefAction); } fileMenu.add(saveSettingsAction); fileMenu.add(projectSettingsAction); if (!MAC_OS_X) { fileMenu.addSeparator(); fileMenu.add(exitAction); } menuBar.add(fileMenu); JMenu editMenu = new JMenu("Edit"); editMenu.setMnemonic('e'); editMenu.add(undoAction); editMenu.add(redoAction); editMenu.addSeparator(); editMenu.add(selectAllAction); editMenu.addSeparator(); editMenu.add(searchReplaceAction); menuBar.add(editMenu); // the connections menu is set up when a new project is created (because it depends on the current DBTree) connectionsMenu = new JMenu("Connections"); connectionsMenu.setMnemonic('c'); menuBar.add(connectionsMenu); JMenu etlMenu = new JMenu("ETL"); etlMenu.setMnemonic('l'); JMenu etlSubmenuOne = new JMenu("Power*Loader"); etlSubmenuOne.add(exportPLTransAction); // Todo add in ability to run the engine from the architect /* Action runPL = new RunPLAction(); runPL.putValue(Action.NAME,"Run Power*Loader"); etlSubmenuOne.add(runPL); */ etlSubmenuOne.add(exportPLJobXMLAction); etlSubmenuOne.add(quickStartAction); etlMenu.add(etlSubmenuOne); etlMenu.add(exportCSVAction); etlMenu.add(mappingReportAction); menuBar.add(etlMenu); JMenu toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic('t'); toolsMenu.add(exportDDLAction); toolsMenu.add(compareDMAction); toolsMenu.add(new SQLRunnerAction()); menuBar.add(toolsMenu); JMenu profileMenu = new JMenu("Profile"); profileMenu.setMnemonic('p'); profileMenu.add(profileAction); //profileMenu.add(viewProfileAction);not being used for second architect release menuBar.add(profileMenu); JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic('h'); if (!MAC_OS_X) { helpMenu.add(aboutAction); helpMenu.addSeparator(); } helpMenu.add(helpAction); menuBar.add(helpMenu); setJMenuBar(menuBar); projectBar = new JToolBar(JToolBar.HORIZONTAL); ppBar = new JToolBar(JToolBar.VERTICAL); projectBar.add(newProjectAction); projectBar.add(openProjectAction); projectBar.add(saveProjectAction); projectBar.addSeparator(); projectBar.add(printAction); projectBar.addSeparator(); projectBar.add(undoAction); projectBar.add(redoAction); projectBar.addSeparator(); projectBar.add(exportDDLAction); projectBar.add(compareDMAction); projectBar.addSeparator(); projectBar.add(autoLayoutAction); projectBar.add(profileAction); projectBar.addSeparator(); projectBar.add(helpAction); projectBar.setToolTipText("Project Toolbar"); projectBar.setName("Project Toolbar"); JButton tempButton = null; // shared actions need to report where they are coming from ppBar.setToolTipText("PlayPen Toolbar"); ppBar.setName("PlayPen ToolBar"); ppBar.add(zoomInAction); ppBar.add(zoomOutAction); ppBar.add(zoomNormalAction); ppBar.add(zoomAllAction); ppBar.addSeparator(); tempButton = ppBar.add(deleteSelectedAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(createTableAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(insertColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); tempButton = ppBar.add(editColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); ppBar.add(createNonIdentifyingRelationshipAction); ppBar.add(createIdentifyingRelationshipAction); tempButton = ppBar.add(editRelationshipAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); Container projectBarPane = getContentPane(); projectBarPane.setLayout(new BorderLayout()); projectBarPane.add(projectBar, BorderLayout.NORTH); JPanel cp = new JPanel(new BorderLayout()); cp.add(ppBar, BorderLayout.EAST); projectBarPane.add(cp, BorderLayout.CENTER); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); cp.add(splitPane, BorderLayout.CENTER); logger.debug("Added splitpane to content pane"); splitPane.setDividerLocation(prefs.getInt(SwingUserSettings.DIVIDER_LOCATION,150)); Rectangle bounds = new Rectangle(); bounds.x = prefs.getInt(SwingUserSettings.MAIN_FRAME_X, 40); bounds.y = prefs.getInt(SwingUserSettings.MAIN_FRAME_Y, 40); bounds.width = prefs.getInt(SwingUserSettings.MAIN_FRAME_WIDTH, 600); bounds.height = prefs.getInt(SwingUserSettings.MAIN_FRAME_HEIGHT, 440); setBounds(bounds); addWindowListener(afWindowListener = new ArchitectFrameWindowListener()); setProject(new SwingUIProject("New Project")); }
| 1,108,971
|
private void init() throws ArchitectException { int accelMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); prefs = PrefsUtils.getUserPrefsNode(architectSession); CoreUserSettings us; // must be done right away, because a static // initializer in this class effects BeanUtils // behaviour which the XML Digester relies // upon heavily //TypeMap.getInstance(); contentPane = (JComponent)getContentPane(); try { ConfigFile cf = ConfigFile.getDefaultInstance(); us = cf.read(getArchitectSession()); architectSession.setUserSettings(us); sprefs = architectSession.getUserSettings().getSwingSettings(); } catch (IOException e) { throw new ArchitectException("prefs.read", e); } while (!us.isPlDotIniPathValid()) { String message; String[] options = new String[] {"Browse", "Create"}; if (us.getPlDotIniPath() == null) { message = "location is not set"; } else if (new File(us.getPlDotIniPath()).isFile()) { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n could not be read"; } else { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n does not exist"; } int choice = JOptionPane.showOptionDialog(null, // blocking wait "The Architect keeps its list of database connections" + "\nin a file called PL.INI. Your PL.INI "+message+"." + "\n\nYou can browse for an existing PL.INI file on your system" + "\nor allow the Architect to create a new one in your home directory." + "\n\nHint: If you are a Power*Loader Suite user, you should browse for" + "\nan existing PL.INI in your Power*Loader installation directory.", "Missing PL.INI", 0, JOptionPane.INFORMATION_MESSAGE, null, options, null); File newPlIniFile; if (choice == JOptionPane.CLOSED_OPTION) { throw new ArchitectException("Can't start without a pl.ini file"); } else if (choice == 0) { JFileChooser fc = new JFileChooser(); fc.setFileFilter(ASUtils.INI_FILE_FILTER); fc.setDialogTitle("Locate your PL.INI file"); int fcChoice = fc.showOpenDialog(null); // blocking wait if (fcChoice == JFileChooser.APPROVE_OPTION) { newPlIniFile = fc.getSelectedFile(); } else { newPlIniFile = null; } } else if (choice == 1) { newPlIniFile = new File(System.getProperty("user.home"), "pl.ini"); } else throw new ArchitectException("Unexpected return from JOptionPane.showOptionDialog to get pl.ini"); if (newPlIniFile != null) try { newPlIniFile.createNewFile(); us.setPlDotIniPath(newPlIniFile.getPath()); } catch (IOException e1) { logger.error("Caught IO exception while creating empty PL.INI at \"" +newPlIniFile.getPath()+"\"", e1); JOptionPane.showMessageDialog(null, "Failed to create file \""+newPlIniFile.getPath()+"\":\n"+e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } // Create actions aboutAction = new AboutAction(); Action helpAction = new HelpAction(); newProjectAction = new AbstractAction("New Project", ASUtils.createJLFIcon("general/New","New Project",sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { if (promptForUnsavedModifications()) { try { prefs.putInt(SwingUserSettings.DIVIDER_LOCATION, splitPane.getDividerLocation()); closeProject(getProject()); setProject(new SwingUIProject("New Project")); logger.debug("Glass pane is "+getGlassPane()); } catch (Exception ex) { JOptionPane.showMessageDialog(ArchitectFrame.this, "Can't create new project: "+ex.getMessage()); logger.error("Got exception while creating new project", ex); } } } }; newProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "New"); newProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, accelMask)); recent = new RecentMenu(this) { @Override public void loadFile(String fileName) throws IOException { File f = new File(fileName); LoadFileWorker worker; try { worker = new LoadFileWorker(f,null); new Thread(worker).start(); } catch (FileNotFoundException e1) { JOptionPane.showMessageDialog( ArchitectFrame.this, "File not found: "+f.getPath()); } catch (Exception e1) { ASUtils.showExceptionDialog( ArchitectFrame.this, "Error loading file", e1); } } }; openProjectAction = new OpenProjectAction(recent); JMenuItem clearItem = new JMenuItem("Clear Recent Files"); clearItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { recent.clear(); } }); saveProjectAction = new AbstractAction("Save Project", ASUtils.createJLFIcon("general/Save", "Save Project", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(false, true); } }; saveProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save"); saveProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, accelMask)); saveProjectAsAction = new AbstractAction("Save Project As...", ASUtils.createJLFIcon("general/SaveAs", "Save Project As...", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(true, true); } }; saveProjectAsAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save As"); prefAction = new PreferencesAction(); projectSettingsAction = new ProjectSettingsAction(); projectSettingsAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_COMMA, accelMask)); printAction = new PrintAction(); printAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_P, accelMask)); zoomInAction = new ZoomAction(ZOOM_STEP); zoomOutAction = new ZoomAction(ZOOM_STEP * -1.0); zoomNormalAction = new AbstractAction("Reset Zoom", ASUtils.createJLFIcon("general/Zoom", "Reset Zoom", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { playpen.setZoom(1.0); } }; zoomNormalAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Reset Zoom"); zoomAllAction = new AbstractAction("Zoom to fit", ASUtils.createJLFIcon("general/Zoom", "Reset Zoom", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { Rectangle rect = null; if ( playpen != null ) { for (int i = 0; i < playpen.getContentPane().getComponentCount(); i++) { PlayPenComponent ppc = playpen.getContentPane().getComponent(i); if ( rect == null ) { rect = new Rectangle(ppc.getLocation(),ppc.getSize()); } else { rect.add(ppc.getBounds()); } } } if ( rect == null ) return; double zoom = Math.min(playpen.getViewportSize().getHeight()/rect.height, playpen.getViewportSize().getWidth()/rect.width); zoom *= 0.90; playpen.setZoom(zoom); playpen.scrollRectToVisible(playpen.zoomRect(rect)); } }; zoomAllAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Zoom to fit"); undoAction = new UndoAction(); redoAction = new RedoAction(); autoLayoutAction = new AutoLayoutAction(); autoLayout = new FruchtermanReingoldForceLayout(); autoLayoutAction.setLayout(autoLayout); exportDDLAction = new ExportDDLAction(); compareDMAction = new CompareDMAction(); exportPLTransAction = new ExportPLTransAction(); exportPLJobXMLAction = new ExportPLJobXMLAction(); quickStartAction = new QuickStartAction(); Action exportCSVAction = new AbstractAction("Export CSV File") { public void actionPerformed(ActionEvent e) { try { ExportCSV export = new ExportCSV(getProject().getPlayPen().getDatabase().getTables()); File file = null; JFileChooser fileDialog = new JFileChooser(); fileDialog.setSelectedFile(new File("map.csv")); if (fileDialog.showSaveDialog(ArchitectFrame.getMainInstance()) == JFileChooser.APPROVE_OPTION){ file = fileDialog.getSelectedFile(); } else { return; } FileWriter output = null; output = new FileWriter(file); output.write(export.getCSVMapping()); output.flush(); } catch (IOException e1) { throw new RuntimeException(e1); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } } }; Action mappingReportAction = new AbstractAction("Visual Mapping Report") { // TODO convert this to an architect pane public void actionPerformed(ActionEvent e) { try { final MappingReport mr ; final List<SQLTable> selectedTables; if (playpen.getSelectedTables().size() == 0) { selectedTables = new ArrayList(playpen.getTables()); } else { if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(ArchitectFrame.getMainInstance(),"View only the "+playpen.getSelectedTables().size()+" selected tables","Show Mapping",JOptionPane.YES_NO_OPTION)) { selectedTables = new ArrayList<SQLTable>(); for(TablePane tp: playpen.getSelectedTables()) { selectedTables.add(tp.getModel()); } } else { selectedTables = new ArrayList(playpen.getTables()); } } mr = new MappingReport(selectedTables); final JFrame f = new JFrame("Mapping Report"); // You call this a radar?? -- No sir, we call it Mr. Panel. JPanel mrPanel = new JPanel() { protected void paintComponent(java.awt.Graphics g) { super.paintComponent(g); try { mr.drawHighLevelReport((Graphics2D) g,null); } catch (ArchitectException e1) { logger.error("ArchitectException while generating mapping diagram", e1); ASUtils.showExceptionDialog(ArchitectFrame.this, "Couldn't generate mapping diagram", e1); } } }; mrPanel.setDoubleBuffered(true); mrPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); mrPanel.setPreferredSize(mr.getRequiredSize()); mrPanel.setOpaque(true); mrPanel.setBackground(Color.WHITE); ButtonBarBuilder buttonBar = new ButtonBarBuilder(); JButton csv = new JButton(new AbstractAction(){ public void actionPerformed(ActionEvent e) { try { ExportCSV export = new ExportCSV(selectedTables); File file = null; JFileChooser fileDialog = new JFileChooser(); fileDialog.setSelectedFile(new File("map.csv")); if (fileDialog.showSaveDialog(ArchitectFrame.getMainInstance()) == JFileChooser.APPROVE_OPTION){ file = fileDialog.getSelectedFile(); } else { return; } FileWriter output = null; output = new FileWriter(file); output.write(export.getCSVMapping()); output.flush(); } catch (IOException e1) { throw new RuntimeException(e1); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } } }); csv.setText("Export CSV"); buttonBar.addGriddedGrowing(csv); ExportPLTransAction plTransaction = new ExportPLTransAction(); JButton pl = new JButton(plTransaction); plTransaction.setExportingTables(selectedTables); pl.setText("Export PL Transaction"); buttonBar.addRelatedGap(); buttonBar.addGriddedGrowing(pl); JButton close = new JButton(new AbstractAction(){ public void actionPerformed(ActionEvent e) { f.setVisible(false); } }); close.setText("Close"); buttonBar.addRelatedGap(); buttonBar.addGriddedGrowing(close); JPanel basePane = new JPanel(new BorderLayout(5,5)); basePane.add(new JScrollPane(mrPanel),BorderLayout.CENTER); basePane.add(buttonBar.getPanel(),BorderLayout.SOUTH); f.setContentPane(basePane); f.pack(); ASUtils.centre(f); f.setVisible(true); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } } }; deleteSelectedAction = new DeleteSelectedAction(); createIdentifyingRelationshipAction = new CreateRelationshipAction(true); createNonIdentifyingRelationshipAction = new CreateRelationshipAction(false); editRelationshipAction = new EditRelationshipAction(); createTableAction = new CreateTableAction(); editColumnAction = new EditColumnAction(); insertColumnAction = new InsertColumnAction(); editTableAction = new EditTableAction(); searchReplaceAction = new SearchReplaceAction(); searchReplaceAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F, accelMask)); selectAllAction = new SelectAllAction(); selectAllAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_A, accelMask)); /* profiling stuff */ profileAction = new ProfilePanelAction(); //viewProfileAction = new ViewProfileAction(); not being used for second architect release menuBar = new JMenuBar(); //Settingup JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic('f'); fileMenu.add(newProjectAction); fileMenu.add(openProjectAction); fileMenu.add(recent); fileMenu.add(clearItem); fileMenu.addSeparator(); fileMenu.add(saveProjectAction); fileMenu.add(saveProjectAsAction); fileMenu.add(printAction); fileMenu.addSeparator(); if (!MAC_OS_X) { fileMenu.add(prefAction); } fileMenu.add(saveSettingsAction); fileMenu.add(projectSettingsAction); if (!MAC_OS_X) { fileMenu.addSeparator(); fileMenu.add(exitAction); } menuBar.add(fileMenu); JMenu editMenu = new JMenu("Edit"); editMenu.setMnemonic('e'); editMenu.add(undoAction); editMenu.add(redoAction); editMenu.addSeparator(); editMenu.add(selectAllAction); editMenu.addSeparator(); editMenu.add(searchReplaceAction); menuBar.add(editMenu); // the connections menu is set up when a new project is created (because it depends on the current DBTree) connectionsMenu = new JMenu("Connections"); connectionsMenu.setMnemonic('c'); menuBar.add(connectionsMenu); JMenu etlMenu = new JMenu("ETL"); etlMenu.setMnemonic('l'); JMenu etlSubmenuOne = new JMenu("Power*Loader"); etlSubmenuOne.add(exportPLTransAction); // Todo add in ability to run the engine from the architect /* Action runPL = new RunPLAction(); runPL.putValue(Action.NAME,"Run Power*Loader"); etlSubmenuOne.add(runPL); */ etlSubmenuOne.add(exportPLJobXMLAction); etlSubmenuOne.add(quickStartAction); etlMenu.add(etlSubmenuOne); etlMenu.add(exportCSVAction); etlMenu.add(mappingReportAction); menuBar.add(etlMenu); JMenu toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic('t'); toolsMenu.add(exportDDLAction); toolsMenu.add(compareDMAction); toolsMenu.add(new SQLRunnerAction()); menuBar.add(toolsMenu); JMenu profileMenu = new JMenu("Profile"); profileMenu.setMnemonic('p'); profileMenu.add(profileAction); //profileMenu.add(viewProfileAction);not being used for second architect release menuBar.add(profileMenu); JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic('h'); if (!MAC_OS_X) { helpMenu.add(aboutAction); helpMenu.addSeparator(); } helpMenu.add(helpAction); menuBar.add(helpMenu); setJMenuBar(menuBar); projectBar = new JToolBar(JToolBar.HORIZONTAL); ppBar = new JToolBar(JToolBar.VERTICAL); projectBar.add(newProjectAction); projectBar.add(openProjectAction); projectBar.add(saveProjectAction); projectBar.addSeparator(); projectBar.add(printAction); projectBar.addSeparator(); projectBar.add(undoAction); projectBar.add(redoAction); projectBar.addSeparator(); projectBar.add(exportDDLAction); projectBar.add(compareDMAction); projectBar.addSeparator(); projectBar.add(autoLayoutAction); projectBar.add(profileAction); projectBar.addSeparator(); projectBar.add(helpAction); projectBar.setToolTipText("Project Toolbar"); projectBar.setName("Project Toolbar"); JButton tempButton = null; // shared actions need to report where they are coming from ppBar.setToolTipText("PlayPen Toolbar"); ppBar.setName("PlayPen ToolBar"); ppBar.add(zoomInAction); ppBar.add(zoomOutAction); ppBar.add(zoomNormalAction); ppBar.add(zoomAllAction); ppBar.addSeparator(); tempButton = ppBar.add(deleteSelectedAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(createTableAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(insertColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); tempButton = ppBar.add(editColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); ppBar.add(createNonIdentifyingRelationshipAction); ppBar.add(createIdentifyingRelationshipAction); tempButton = ppBar.add(editRelationshipAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); Container projectBarPane = getContentPane(); projectBarPane.setLayout(new BorderLayout()); projectBarPane.add(projectBar, BorderLayout.NORTH); JPanel cp = new JPanel(new BorderLayout()); cp.add(ppBar, BorderLayout.EAST); projectBarPane.add(cp, BorderLayout.CENTER); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); cp.add(splitPane, BorderLayout.CENTER); logger.debug("Added splitpane to content pane"); splitPane.setDividerLocation(prefs.getInt(SwingUserSettings.DIVIDER_LOCATION,150)); Rectangle bounds = new Rectangle(); bounds.x = prefs.getInt(SwingUserSettings.MAIN_FRAME_X, 40); bounds.y = prefs.getInt(SwingUserSettings.MAIN_FRAME_Y, 40); bounds.width = prefs.getInt(SwingUserSettings.MAIN_FRAME_WIDTH, 600); bounds.height = prefs.getInt(SwingUserSettings.MAIN_FRAME_HEIGHT, 440); setBounds(bounds); addWindowListener(afWindowListener = new ArchitectFrameWindowListener()); setProject(new SwingUIProject("New Project")); }
|
private void init() throws ArchitectException { int accelMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); prefs = PrefsUtils.getUserPrefsNode(architectSession); CoreUserSettings us; // must be done right away, because a static // initializer in this class effects BeanUtils // behaviour which the XML Digester relies // upon heavily //TypeMap.getInstance(); contentPane = (JComponent)getContentPane(); try { ConfigFile cf = ConfigFile.getDefaultInstance(); us = cf.read(getArchitectSession()); architectSession.setUserSettings(us); sprefs = architectSession.getUserSettings().getSwingSettings(); } catch (IOException e) { throw new ArchitectException("prefs.read", e); } while (!us.isPlDotIniPathValid()) { String message; String[] options = new String[] {"Browse", "Create"}; if (us.getPlDotIniPath() == null) { message = "location is not set"; } else if (new File(us.getPlDotIniPath()).isFile()) { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n could not be read"; } else { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n does not exist"; } int choice = JOptionPane.showOptionDialog(null, // blocking wait "The Architect keeps its list of database connections" + "\nin a file called PL.INI. Your PL.INI "+message+"." + "\n\nYou can browse for an existing PL.INI file on your system" + "\nor allow the Architect to create a new one in your home directory." + "\n\nHint: If you are a Power*Loader Suite user, you should browse for" + "\nan existing PL.INI in your Power*Loader installation directory.", "Missing PL.INI", 0, JOptionPane.INFORMATION_MESSAGE, null, options, null); File newPlIniFile; if (choice == JOptionPane.CLOSED_OPTION) { throw new ArchitectException("Can't start without a pl.ini file"); } else if (choice == 0) { JFileChooser fc = new JFileChooser(); fc.setFileFilter(ASUtils.INI_FILE_FILTER); fc.setDialogTitle("Locate your PL.INI file"); int fcChoice = fc.showOpenDialog(null); // blocking wait if (fcChoice == JFileChooser.APPROVE_OPTION) { newPlIniFile = fc.getSelectedFile(); } else { newPlIniFile = null; } } else if (choice == 1) { newPlIniFile = new File(System.getProperty("user.home"), "pl.ini"); } else throw new ArchitectException("Unexpected return from JOptionPane.showOptionDialog to get pl.ini"); if (newPlIniFile != null) try { newPlIniFile.createNewFile(); us.setPlDotIniPath(newPlIniFile.getPath()); } catch (IOException e1) { logger.error("Caught IO exception while creating empty PL.INI at \"" +newPlIniFile.getPath()+"\"", e1); JOptionPane.showMessageDialog(null, "Failed to create file \""+newPlIniFile.getPath()+"\":\n"+e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } // Create actions aboutAction = new AboutAction(); Action helpAction = new HelpAction(); newProjectAction = new AbstractAction("New Project", ASUtils.createJLFIcon("general/New","New Project",sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { if (promptForUnsavedModifications()) { try { prefs.putInt(SwingUserSettings.DIVIDER_LOCATION, splitPane.getDividerLocation()); closeProject(getProject()); setProject(new SwingUIProject("New Project")); logger.debug("Glass pane is "+getGlassPane()); } catch (Exception ex) { JOptionPane.showMessageDialog(ArchitectFrame.this, "Can't create new project: "+ex.getMessage()); logger.error("Got exception while creating new project", ex); } } } }; newProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "New"); newProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, accelMask)); recent = new RecentMenu(this) { @Override public void loadFile(String fileName) throws IOException { File f = new File(fileName); LoadFileWorker worker; try { worker = new LoadFileWorker(f,null); new Thread(worker).start(); } catch (FileNotFoundException e1) { JOptionPane.showMessageDialog( ArchitectFrame.this, "File not found: "+f.getPath()); } catch (Exception e1) { ASUtils.showExceptionDialog( ArchitectFrame.this, "Error loading file", e1); } } }; openProjectAction = new OpenProjectAction(recent); JMenuItem clearItem = new JMenuItem("Clear Recent Files"); clearItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { recent.clear(); } }); saveProjectAction = new AbstractAction("Save Project", ASUtils.createJLFIcon("general/Save", "Save Project", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(false, true); } }; saveProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save"); saveProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, accelMask)); saveProjectAsAction = new AbstractAction("Save Project As...", ASUtils.createJLFIcon("general/SaveAs", "Save Project As...", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(true, true); } }; saveProjectAsAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save As"); prefAction = new PreferencesAction(); projectSettingsAction = new ProjectSettingsAction(); projectSettingsAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_COMMA, accelMask)); printAction = new PrintAction(); printAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_P, accelMask)); zoomInAction = new ZoomAction(ZOOM_STEP); zoomOutAction = new ZoomAction(ZOOM_STEP * -1.0); zoomNormalAction = new AbstractAction("Reset Zoom", ASUtils.createJLFIcon("general/Zoom", "Reset Zoom", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { playpen.setZoom(1.0); } }; zoomNormalAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Reset Zoom"); zoomAllAction = new AbstractAction("Zoom to fit", ASUtils.createJLFIcon("general/Zoom", "Reset Zoom", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { Rectangle rect = null; if ( playpen != null ) { for (int i = 0; i < playpen.getContentPane().getComponentCount(); i++) { PlayPenComponent ppc = playpen.getContentPane().getComponent(i); if ( rect == null ) { rect = new Rectangle(ppc.getLocation(),ppc.getSize()); } else { rect.add(ppc.getBounds()); } } } if ( rect == null ) return; double zoom = Math.min(playpen.getViewportSize().getHeight()/rect.height, playpen.getViewportSize().getWidth()/rect.width); zoom *= 0.90; playpen.setZoom(zoom); playpen.scrollRectToVisible(playpen.zoomRect(rect)); } }; zoomAllAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Zoom to fit"); undoAction = new UndoAction(); redoAction = new RedoAction(); autoLayoutAction = new AutoLayoutAction(); autoLayout = new FruchtermanReingoldForceLayout(); autoLayoutAction.setLayout(autoLayout); exportDDLAction = new ExportDDLAction(); compareDMAction = new CompareDMAction(); exportPLTransAction = new ExportPLTransAction(); exportPLJobXMLAction = new ExportPLJobXMLAction(); quickStartAction = new QuickStartAction(); Action exportCSVAction = new AbstractAction("Export CSV File") { public void actionPerformed(ActionEvent e) { try { ExportCSV export = new ExportCSV(getProject().getPlayPen().getDatabase().getTables()); File file = null; JFileChooser fileDialog = new JFileChooser(); fileDialog.setSelectedFile(new File("map.csv")); if (fileDialog.showSaveDialog(ArchitectFrame.getMainInstance()) == JFileChooser.APPROVE_OPTION){ file = fileDialog.getSelectedFile(); } else { return; } FileWriter output = null; output = new FileWriter(file); output.write(export.getCSVMapping()); output.flush(); } catch (IOException e1) { throw new RuntimeException(e1); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } } }; Action mappingReportAction = new AbstractAction("Visual Mapping Report") { // TODO convert this to an architect pane public void actionPerformed(ActionEvent e) { try { final MappingReport mr ; final List<SQLTable> selectedTables; if (playpen.getSelectedTables().size() == 0) { selectedTables = new ArrayList(playpen.getTables()); } else { if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(ArchitectFrame.getMainInstance(),"View only the "+playpen.getSelectedTables().size()+" selected tables","Show Mapping",JOptionPane.YES_NO_OPTION)) { selectedTables = new ArrayList<SQLTable>(); for(TablePane tp: playpen.getSelectedTables()) { selectedTables.add(tp.getModel()); } } else { selectedTables = new ArrayList(playpen.getTables()); } } mr = new MappingReport(selectedTables); final JFrame f = new JFrame("Mapping Report"); // You call this a radar?? -- No sir, we call it Mr. Panel. JPanel mrPanel = new JPanel() { protected void paintComponent(java.awt.Graphics g) { super.paintComponent(g); try { mr.drawHighLevelReport((Graphics2D) g,null); } catch (ArchitectException e1) { logger.error("ArchitectException while generating mapping diagram", e1); ASUtils.showExceptionDialog(ArchitectFrame.this, "Couldn't generate mapping diagram", e1); } } }; mrPanel.setDoubleBuffered(true); mrPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); mrPanel.setPreferredSize(mr.getRequiredSize()); mrPanel.setOpaque(true); mrPanel.setBackground(Color.WHITE); ButtonBarBuilder buttonBar = new ButtonBarBuilder(); JButton csv = new JButton(new AbstractAction(){ public void actionPerformed(ActionEvent e) { try { ExportCSV export = new ExportCSV(selectedTables); File file = null; JFileChooser fileDialog = new JFileChooser(); fileDialog.setSelectedFile(new File("map.csv")); if (fileDialog.showSaveDialog(ArchitectFrame.getMainInstance()) == JFileChooser.APPROVE_OPTION){ file = fileDialog.getSelectedFile(); } else { return; } FileWriter output = null; output = new FileWriter(file); output.write(export.getCSVMapping()); output.flush(); } catch (IOException e1) { throw new RuntimeException(e1); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } } }); csv.setText("Export CSV"); buttonBar.addGriddedGrowing(csv); ExportPLTransAction plTransaction = new ExportPLTransAction(); JButton pl = new JButton(plTransaction); plTransaction.setExportingTables(selectedTables); pl.setText("Export PL Transaction"); buttonBar.addRelatedGap(); buttonBar.addGriddedGrowing(pl); JButton close = new JButton(new AbstractAction(){ public void actionPerformed(ActionEvent e) { f.setVisible(false); } }); close.setText("Close"); buttonBar.addRelatedGap(); buttonBar.addGriddedGrowing(close); JPanel basePane = new JPanel(new BorderLayout(5,5)); basePane.add(new JScrollPane(mrPanel),BorderLayout.CENTER); basePane.add(buttonBar.getPanel(),BorderLayout.SOUTH); f.setContentPane(basePane); f.pack(); ASUtils.centre(f); f.setVisible(true); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } } }; deleteSelectedAction = new DeleteSelectedAction(); createIdentifyingRelationshipAction = new CreateRelationshipAction(true); createNonIdentifyingRelationshipAction = new CreateRelationshipAction(false); editRelationshipAction = new EditRelationshipAction(); createTableAction = new CreateTableAction(); editColumnAction = new EditColumnAction(); insertColumnAction = new InsertColumnAction(); editTableAction = new EditTableAction(); searchReplaceAction = new SearchReplaceAction(); searchReplaceAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F, accelMask)); selectAllAction = new SelectAllAction(); selectAllAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_A, accelMask)); /* profiling stuff */ profileAction = new ProfilePanelAction(); //viewProfileAction = new ViewProfileAction(); not being used for second architect release menuBar = new JMenuBar(); //Settingup JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic('f'); fileMenu.add(newProjectAction); fileMenu.add(openProjectAction); fileMenu.add(recent); fileMenu.add(clearItem); fileMenu.addSeparator(); fileMenu.add(saveProjectAction); fileMenu.add(saveProjectAsAction); fileMenu.add(printAction); fileMenu.addSeparator(); if (!MAC_OS_X) { fileMenu.add(prefAction); } fileMenu.add(saveSettingsAction); fileMenu.add(projectSettingsAction); if (!MAC_OS_X) { fileMenu.addSeparator(); fileMenu.add(exitAction); } menuBar.add(fileMenu); JMenu editMenu = new JMenu("Edit"); editMenu.setMnemonic('e'); editMenu.add(undoAction); editMenu.add(redoAction); editMenu.addSeparator(); editMenu.add(selectAllAction); editMenu.addSeparator(); editMenu.add(searchReplaceAction); menuBar.add(editMenu); // the connections menu is set up when a new project is created (because it depends on the current DBTree) connectionsMenu = new JMenu("Connections"); connectionsMenu.setMnemonic('c'); menuBar.add(connectionsMenu); JMenu etlMenu = new JMenu("ETL"); etlMenu.setMnemonic('l'); JMenu etlSubmenuOne = new JMenu("Power*Loader"); etlSubmenuOne.add(exportPLTransAction); // Todo add in ability to run the engine from the architect /* Action runPL = new RunPLAction(); runPL.putValue(Action.NAME,"Run Power*Loader"); etlSubmenuOne.add(runPL); */ etlSubmenuOne.add(exportPLJobXMLAction); etlSubmenuOne.add(quickStartAction); etlMenu.add(etlSubmenuOne); etlMenu.add(exportCSVAction); etlMenu.add(mappingReportAction); menuBar.add(etlMenu); JMenu toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic('t'); toolsMenu.add(exportDDLAction); toolsMenu.add(compareDMAction); toolsMenu.add(new SQLRunnerAction()); menuBar.add(toolsMenu); JMenu profileMenu = new JMenu("Profile"); profileMenu.setMnemonic('p'); profileMenu.add(profileAction); //profileMenu.add(viewProfileAction);not being used for second architect release menuBar.add(profileMenu); JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic('h'); if (!MAC_OS_X) { helpMenu.add(aboutAction); helpMenu.addSeparator(); } helpMenu.add(helpAction); menuBar.add(helpMenu); setJMenuBar(menuBar); projectBar = new JToolBar(JToolBar.HORIZONTAL); ppBar = new JToolBar(JToolBar.VERTICAL); projectBar.add(newProjectAction); projectBar.add(openProjectAction); projectBar.add(saveProjectAction); projectBar.addSeparator(); projectBar.add(printAction); projectBar.addSeparator(); projectBar.add(undoAction); projectBar.add(redoAction); projectBar.addSeparator(); projectBar.add(exportDDLAction); projectBar.add(compareDMAction); projectBar.addSeparator(); projectBar.add(autoLayoutAction); projectBar.add(profileAction); projectBar.addSeparator(); projectBar.add(helpAction); projectBar.setToolTipText("Project Toolbar"); projectBar.setName("Project Toolbar"); JButton tempButton = null; // shared actions need to report where they are coming from ppBar.setToolTipText("PlayPen Toolbar"); ppBar.setName("PlayPen ToolBar"); ppBar.add(zoomInAction); ppBar.add(zoomOutAction); ppBar.add(zoomNormalAction); ppBar.add(zoomAllAction); ppBar.addSeparator(); tempButton = ppBar.add(deleteSelectedAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(createTableAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(insertColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); tempButton = ppBar.add(editColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); ppBar.add(createNonIdentifyingRelationshipAction); ppBar.add(createIdentifyingRelationshipAction); tempButton = ppBar.add(editRelationshipAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); Container projectBarPane = getContentPane(); projectBarPane.setLayout(new BorderLayout()); projectBarPane.add(projectBar, BorderLayout.NORTH); JPanel cp = new JPanel(new BorderLayout()); cp.add(ppBar, BorderLayout.EAST); projectBarPane.add(cp, BorderLayout.CENTER); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); cp.add(splitPane, BorderLayout.CENTER); logger.debug("Added splitpane to content pane"); splitPane.setDividerLocation(prefs.getInt(SwingUserSettings.DIVIDER_LOCATION,150)); Rectangle bounds = new Rectangle(); bounds.x = prefs.getInt(SwingUserSettings.MAIN_FRAME_X, 40); bounds.y = prefs.getInt(SwingUserSettings.MAIN_FRAME_Y, 40); bounds.width = prefs.getInt(SwingUserSettings.MAIN_FRAME_WIDTH, 600); bounds.height = prefs.getInt(SwingUserSettings.MAIN_FRAME_HEIGHT, 440); setBounds(bounds); addWindowListener(afWindowListener = new ArchitectFrameWindowListener()); setProject(new SwingUIProject("New Project")); }
| 1,108,972
|
public void actionPerformed(ActionEvent e) { try { ExportCSV export = new ExportCSV(getProject().getPlayPen().getDatabase().getTables()); File file = null; JFileChooser fileDialog = new JFileChooser(); fileDialog.setSelectedFile(new File("map.csv")); if (fileDialog.showSaveDialog(ArchitectFrame.getMainInstance()) == JFileChooser.APPROVE_OPTION){ file = fileDialog.getSelectedFile(); } else { return; } FileWriter output = null; output = new FileWriter(file); output.write(export.getCSVMapping()); output.flush(); } catch (IOException e1) { throw new RuntimeException(e1); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } }
|
public void actionPerformed(ActionEvent e) { try { final MappingReport mr ; final List<SQLTable> selectedTables; if (playpen.getSelectedTables().size() == 0) { selectedTables = new ArrayList(playpen.getTables()); } else { if (JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(ArchitectFrame.getMainInstance(),"View only the "+playpen.getSelectedTables().size()+" selected tables","Show Mapping",JOptionPane.YES_NO_OPTION)) { selectedTables = new ArrayList<SQLTable>(); for(TablePane tp: playpen.getSelectedTables()) { selectedTables.add(tp.getModel()); } } else { selectedTables = new ArrayList(playpen.getTables()); } } mr = new MappingReport(selectedTables); File file = null; JFileChooser fileDialog = new JFileChooser(); fileDialog.setSelectedFile(new File("map.csv")); if (fileDialog.showSaveDialog(ArchitectFrame.getMainInstance()) == JFileChooser.APPROVE_OPTION){ file = fileDialog.getSelectedFile(); } else { return; } FileWriter output = null; output = new FileWriter(file); output.write(export.getCSVMapping()); output.flush(); } catch (IOException e1) { throw new RuntimeException(e1); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } }
| 1,108,973
|
public void actionPerformed(ActionEvent e) { try { ExportCSV export = new ExportCSV(getProject().getPlayPen().getDatabase().getTables()); File file = null; JFileChooser fileDialog = new JFileChooser(); fileDialog.setSelectedFile(new File("map.csv")); if (fileDialog.showSaveDialog(ArchitectFrame.getMainInstance()) == JFileChooser.APPROVE_OPTION){ file = fileDialog.getSelectedFile(); } else { return; } FileWriter output = null; output = new FileWriter(file); output.write(export.getCSVMapping()); output.flush(); } catch (IOException e1) { throw new RuntimeException(e1); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } }
|
public void actionPerformed(ActionEvent e) { try { ExportCSV export = new ExportCSV(getProject().getPlayPen().getDatabase().getTables()); final JFrame f = new JFrame("Mapping Report"); JFileChooser fileDialog = new JFileChooser(); fileDialog.setSelectedFile(new File("map.csv")); if (fileDialog.showSaveDialog(ArchitectFrame.getMainInstance()) == JFileChooser.APPROVE_OPTION){ file = fileDialog.getSelectedFile(); } else { return; } FileWriter output = null; output = new FileWriter(file); output.write(export.getCSVMapping()); output.flush(); } catch (IOException e1) { throw new RuntimeException(e1); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } }
| 1,108,974
|
public void actionPerformed(ActionEvent e) { try { ExportCSV export = new ExportCSV(getProject().getPlayPen().getDatabase().getTables()); File file = null; JFileChooser fileDialog = new JFileChooser(); fileDialog.setSelectedFile(new File("map.csv")); if (fileDialog.showSaveDialog(ArchitectFrame.getMainInstance()) == JFileChooser.APPROVE_OPTION){ file = fileDialog.getSelectedFile(); } else { return; } FileWriter output = null; output = new FileWriter(file); output.write(export.getCSVMapping()); output.flush(); } catch (IOException e1) { throw new RuntimeException(e1); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } }
|
public void actionPerformed(ActionEvent e) { try { ExportCSV export = new ExportCSV(getProject().getPlayPen().getDatabase().getTables()); File file = null; JFileChooser fileDialog = new JFileChooser(); fileDialog.setSelectedFile(new File("map.csv")); if (fileDialog.showSaveDialog(ArchitectFrame.getMainInstance()) == JFileChooser.APPROVE_OPTION){ file = fileDialog.getSelectedFile(); } else { return; } FileWriter output = null; output = new FileWriter(file); output.write(export.getCSVMapping()); output.flush(); } catch (IOException e1) { throw new RuntimeException(e1); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } }
| 1,108,975
|
public void actionPerformed(ActionEvent e) { try { ExportCSV export = new ExportCSV(getProject().getPlayPen().getDatabase().getTables()); File file = null; JFileChooser fileDialog = new JFileChooser(); fileDialog.setSelectedFile(new File("map.csv")); if (fileDialog.showSaveDialog(ArchitectFrame.getMainInstance()) == JFileChooser.APPROVE_OPTION){ file = fileDialog.getSelectedFile(); } else { return; } FileWriter output = null; output = new FileWriter(file); output.write(export.getCSVMapping()); output.flush(); } catch (IOException e1) { throw new RuntimeException(e1); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } }
|
public void actionPerformed(ActionEvent e) { try { ExportCSV export = new ExportCSV(getProject().getPlayPen().getDatabase().getTables()); File file = null; JFileChooser fileDialog = new JFileChooser(); fileDialog.setSelectedFile(new File("map.csv")); if (fileDialog.showSaveDialog(ArchitectFrame.getMainInstance()) == JFileChooser.APPROVE_OPTION){ file = fileDialog.getSelectedFile(); } else { return; } FileWriter output = null; output = new FileWriter(file); output.write(export.getCSVMapping()); output.flush(); } catch (IOException e1) { throw new RuntimeException(e1); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } }
| 1,108,976
|
public void actionPerformed(ActionEvent e) { try { ExportCSV export = new ExportCSV(getProject().getPlayPen().getDatabase().getTables()); File file = null; JFileChooser fileDialog = new JFileChooser(); fileDialog.setSelectedFile(new File("map.csv")); if (fileDialog.showSaveDialog(ArchitectFrame.getMainInstance()) == JFileChooser.APPROVE_OPTION){ file = fileDialog.getSelectedFile(); } else { return; } FileWriter output = null; output = new FileWriter(file); output.write(export.getCSVMapping()); output.flush(); } catch (IOException e1) { throw new RuntimeException(e1); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } }
|
public void actionPerformed(ActionEvent e) { try { ExportCSV export = new ExportCSV(getProject().getPlayPen().getDatabase().getTables()); File file = null; JFileChooser fileDialog = new JFileChooser(); fileDialog.setSelectedFile(new File("map.csv")); if (fileDialog.showSaveDialog(ArchitectFrame.getMainInstance()) == JFileChooser.APPROVE_OPTION){ file = fileDialog.getSelectedFile(); } else { return; } FileWriter output = null; output = new FileWriter(file); output.write(export.getCSVMapping()); output.flush(); } catch (IOException e1) { throw new RuntimeException(e1); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } }
| 1,108,977
|
public void actionPerformed(ActionEvent e) { try { ExportCSV export = new ExportCSV(selectedTables); File file = null; JFileChooser fileDialog = new JFileChooser(); fileDialog.setSelectedFile(new File("map.csv")); if (fileDialog.showSaveDialog(ArchitectFrame.getMainInstance()) == JFileChooser.APPROVE_OPTION){ file = fileDialog.getSelectedFile(); } else { return; } FileWriter output = null; output = new FileWriter(file); output.write(export.getCSVMapping()); output.flush(); } catch (IOException e1) { throw new RuntimeException(e1); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } }
|
public void actionPerformed(ActionEvent e) { try { ExportCSV export = new ExportCSV(selectedTables); File file = null; JFileChooser fileDialog = new JFileChooser(); fileDialog.setSelectedFile(new File("map.csv")); if (fileDialog.showSaveDialog(ArchitectFrame.getMainInstance()) == JFileChooser.APPROVE_OPTION){ file = fileDialog.getSelectedFile(); } else { return; } FileWriter output = null; output = new FileWriter(file); output.write(export.getCSVMapping()); output.flush(); } catch (IOException e1) { throw new RuntimeException(e1); } catch (ArchitectException e1) { throw new ArchitectRuntimeException(e1); } }
| 1,108,978
|
public void actionPerformed(ActionEvent e) { recent.clear(); }
|
public void actionPerformed(ActionEvent e) { recent.clear(); }
| 1,108,979
|
public void actionPerformed(ActionEvent e) { saveOrSaveAs(false, true); }
|
public void actionPerformed(ActionEvent e) { saveOrSaveAs(true, true); }
| 1,108,980
|
public void actionPerformed(ActionEvent e) { saveOrSaveAs(true, true); }
|
public void actionPerformed(ActionEvent e) { playpen.setZoom(1.0); }
| 1,108,981
|
public void actionPerformed(ActionEvent e) { playpen.setZoom(1.0); }
|
public void actionPerformed(ActionEvent e) { Rectangle rect = null; if ( playpen != null ) { for (int i = 0; i < playpen.getContentPane().getComponentCount(); i++) { PlayPenComponent ppc = playpen.getContentPane().getComponent(i); if ( rect == null ) { rect = new Rectangle(ppc.getLocation(),ppc.getSize()); } else { rect.add(ppc.getBounds()); } } }
| 1,108,982
|
public void actionPerformed(ActionEvent e) { Rectangle rect = null; if ( playpen != null ) { for (int i = 0; i < playpen.getContentPane().getComponentCount(); i++) { PlayPenComponent ppc = playpen.getContentPane().getComponent(i); if ( rect == null ) { rect = new Rectangle(ppc.getLocation(),ppc.getSize()); } else { rect.add(ppc.getBounds()); } } } if ( rect == null ) return; double zoom = Math.min(playpen.getViewportSize().getHeight()/rect.height, playpen.getViewportSize().getWidth()/rect.width); zoom *= 0.90; playpen.setZoom(zoom); playpen.scrollRectToVisible(playpen.zoomRect(rect)); }
|
public void actionPerformed(ActionEvent e) { Rectangle rect = null; if ( playpen != null ) { for (int i = 0; i < playpen.getContentPane().getComponentCount(); i++) { PlayPenComponent ppc = playpen.getContentPane().getComponent(i); if ( rect == null ) { rect = new Rectangle(ppc.getLocation(),ppc.getSize()); } else { rect.add(ppc.getBounds()); } } } if ( rect == null ) return; double zoom = Math.min(playpen.getViewportSize().getHeight()/rect.height, playpen.getViewportSize().getWidth()/rect.width); zoom *= 0.90; playpen.setZoom(zoom); playpen.scrollRectToVisible(playpen.zoomRect(rect)); }
| 1,108,984
|
public void actionPerformed(ActionEvent e) { Rectangle rect = null; if ( playpen != null ) { for (int i = 0; i < playpen.getContentPane().getComponentCount(); i++) { PlayPenComponent ppc = playpen.getContentPane().getComponent(i); if ( rect == null ) { rect = new Rectangle(ppc.getLocation(),ppc.getSize()); } else { rect.add(ppc.getBounds()); } } } if ( rect == null ) return; double zoom = Math.min(playpen.getViewportSize().getHeight()/rect.height, playpen.getViewportSize().getWidth()/rect.width); zoom *= 0.90; playpen.setZoom(zoom); playpen.scrollRectToVisible(playpen.zoomRect(rect)); }
|
public void actionPerformed(ActionEvent e) { Rectangle rect = null; if ( playpen != null ) { for (int i = 0; i < playpen.getContentPane().getComponentCount(); i++) { PlayPenComponent ppc = playpen.getContentPane().getComponent(i); if ( rect == null ) { rect = new Rectangle(ppc.getLocation(),ppc.getSize()); } else { rect.add(ppc.getBounds()); } } } if ( rect == null ) return; double zoom = Math.min(playpen.getViewportSize().getHeight()/rect.height, playpen.getViewportSize().getWidth()/rect.width); zoom *= 0.90; playpen.setZoom(zoom); playpen.scrollRectToVisible(playpen.zoomRect(rect)); }
| 1,108,985
|
public void actionPerformed(ActionEvent e) { Rectangle rect = null; if ( playpen != null ) { for (int i = 0; i < playpen.getContentPane().getComponentCount(); i++) { PlayPenComponent ppc = playpen.getContentPane().getComponent(i); if ( rect == null ) { rect = new Rectangle(ppc.getLocation(),ppc.getSize()); } else { rect.add(ppc.getBounds()); } } } if ( rect == null ) return; double zoom = Math.min(playpen.getViewportSize().getHeight()/rect.height, playpen.getViewportSize().getWidth()/rect.width); zoom *= 0.90; playpen.setZoom(zoom); playpen.scrollRectToVisible(playpen.zoomRect(rect)); }
|
public void actionPerformed(ActionEvent e) { Rectangle rect = null; if ( playpen != null ) { for (int i = 0; i < playpen.getContentPane().getComponentCount(); i++) { PlayPenComponent ppc = playpen.getContentPane().getComponent(i); if ( rect == null ) { rect = new Rectangle(ppc.getLocation(),ppc.getSize()); } else { rect.add(ppc.getBounds()); } } } if ( rect == null ) return; double zoom = Math.min(playpen.getViewportSize().getHeight()/rect.height, playpen.getViewportSize().getWidth()/rect.width); zoom *= 0.90; playpen.setZoom(zoom); playpen.scrollRectToVisible(playpen.zoomRect(rect)); }
| 1,108,986
|
public void actionPerformed(ActionEvent e) { Rectangle rect = null; if ( playpen != null ) { for (int i = 0; i < playpen.getContentPane().getComponentCount(); i++) { PlayPenComponent ppc = playpen.getContentPane().getComponent(i); if ( rect == null ) { rect = new Rectangle(ppc.getLocation(),ppc.getSize()); } else { rect.add(ppc.getBounds()); } } } if ( rect == null ) return; double zoom = Math.min(playpen.getViewportSize().getHeight()/rect.height, playpen.getViewportSize().getWidth()/rect.width); zoom *= 0.90; playpen.setZoom(zoom); playpen.scrollRectToVisible(playpen.zoomRect(rect)); }
|
public void actionPerformed(ActionEvent e) { Rectangle rect = null; if ( playpen != null ) { for (int i = 0; i < playpen.getContentPane().getComponentCount(); i++) { PlayPenComponent ppc = playpen.getContentPane().getComponent(i); if ( rect == null ) { rect = new Rectangle(ppc.getLocation(),ppc.getSize()); } else { rect.add(ppc.getBounds()); } } } if ( rect == null ) return; double zoom = Math.min(playpen.getViewportSize().getHeight()/rect.height, playpen.getViewportSize().getWidth()/rect.width); zoom *= 0.90; playpen.setZoom(zoom); playpen.scrollRectToVisible(playpen.zoomRect(rect)); }
| 1,108,987
|
public void run() { Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler()); // this doesn't appear to have any effect on the motion threshold // in the Playpen, but it does seem to work on the DBTree... logger.debug("current motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); System.setProperty("awt.dnd.drag.threshold","10"); logger.debug("new motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); getMainInstance().macOSXRegistration(); getMainInstance().setVisible(true); LoadFileWorker worker; if (openFile != null) { try { worker = getMainInstance().new LoadFileWorker(openFile,getMainInstance().recent); new Thread(worker).start(); } catch (FileNotFoundException e1) { JOptionPane.showMessageDialog( getMainInstance(), "File not found: "+openFile.getPath()); } catch (Exception e1) { ASUtils.showExceptionDialog( getMainInstance(), "Error loading file", e1); } } }
|
public void run() { Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler()); // this doesn't appear to have any effect on the motion threshold // in the Playpen, but it does seem to work on the DBTree... logger.debug("current motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); System.setProperty("awt.dnd.drag.threshold","10"); logger.debug("new motion threshold is: " + System.getProperty("awt.dnd.drag.threshold")); getMainInstance().macOSXRegistration(); getMainInstance().setVisible(true); LoadFileWorker worker; if (openFile != null) { try { worker = getMainInstance().new LoadFileWorker(openFile,getMainInstance().recent); new Thread(worker).start(); } catch (FileNotFoundException e1) { JOptionPane.showMessageDialog( getMainInstance(), "File not found: "+openFile.getPath()); } catch (Exception e1) { ASUtils.showExceptionDialog( getMainInstance(), "Error loading file", e1); } } }
| 1,108,988
|
public Dimension getPreferredSize() { Rectangle cbounds = null; //int minx = Integer.MAX_VALUE, miny = Integer.MAX_VALUE, maxx = 0, maxy = 0; int minx = 0, miny = 0, maxx = 0, maxy = 0; for (int i = 0; i < contentPane.getComponentCount(); i++) { Component c = contentPane.getComponent(i); if (c.isVisible()) { cbounds = c.getBounds(cbounds); logger.debug("bounds: " + cbounds); minx = Math.min(cbounds.x, minx); miny = Math.min(cbounds.y, miny); maxx = Math.max(cbounds.x + cbounds.width , maxx); maxy = Math.max(cbounds.y + cbounds.height, maxy); logger.debug("min:("+minx+","+miny+"),max:("+maxx+","+maxy+")"); } } Dimension min = getMinimumSize(); Dimension userDim = new Dimension(maxx-minx,maxy-miny); logger.debug("userDim is: " + userDim); Dimension usedSpace = new Dimension((int) ((double) Math.max(maxx - minx, min.width) * zoom), (int) ((double) Math.max(maxy - miny, min.height) * zoom)); logger.debug("zoom="+zoom+",usedSpace size is viewport size: " + usedSpace); // but, make sure we return a preferred size that is at least as big as the Viewport Dimension vpSize = getViewportSize(); if (vpSize != null) { if (vpSize.width > usedSpace.width && vpSize.height > usedSpace.height) { logger.debug("preferered size is viewport?: " + vpSize); return vpSize; } } // default logger.debug("preferred size is usedSpace?: " + usedSpace); return usedSpace; }
|
public Dimension getPreferredSize() { Rectangle cbounds = null; //int minx = Integer.MAX_VALUE, miny = Integer.MAX_VALUE, maxx = 0, maxy = 0; int minx = 0, miny = 0, maxx = 0, maxy = 0; for (int i = 0; i < contentPane.getComponentCount(); i++) { Component c = contentPane.getComponent(i); if (c.isVisible()) { cbounds = c.getBounds(cbounds); minx = Math.min(cbounds.x, minx); miny = Math.min(cbounds.y, miny); maxx = Math.max(cbounds.x + cbounds.width , maxx); maxy = Math.max(cbounds.y + cbounds.height, maxy); logger.debug("min:("+minx+","+miny+"),max:("+maxx+","+maxy+")"); } } Dimension min = getMinimumSize(); Dimension userDim = new Dimension(maxx-minx,maxy-miny); logger.debug("userDim is: " + userDim); Dimension usedSpace = new Dimension((int) ((double) Math.max(maxx - minx, min.width) * zoom), (int) ((double) Math.max(maxy - miny, min.height) * zoom)); logger.debug("zoom="+zoom+",usedSpace size is viewport size: " + usedSpace); // but, make sure we return a preferred size that is at least as big as the Viewport Dimension vpSize = getViewportSize(); if (vpSize != null) { if (vpSize.width > usedSpace.width && vpSize.height > usedSpace.height) { logger.debug("preferered size is viewport?: " + vpSize); return vpSize; } } // default logger.debug("preferred size is usedSpace?: " + usedSpace); return usedSpace; }
| 1,108,989
|
public Dimension getPreferredSize() { Rectangle cbounds = null; //int minx = Integer.MAX_VALUE, miny = Integer.MAX_VALUE, maxx = 0, maxy = 0; int minx = 0, miny = 0, maxx = 0, maxy = 0; for (int i = 0; i < contentPane.getComponentCount(); i++) { Component c = contentPane.getComponent(i); if (c.isVisible()) { cbounds = c.getBounds(cbounds); logger.debug("bounds: " + cbounds); minx = Math.min(cbounds.x, minx); miny = Math.min(cbounds.y, miny); maxx = Math.max(cbounds.x + cbounds.width , maxx); maxy = Math.max(cbounds.y + cbounds.height, maxy); logger.debug("min:("+minx+","+miny+"),max:("+maxx+","+maxy+")"); } } Dimension min = getMinimumSize(); Dimension userDim = new Dimension(maxx-minx,maxy-miny); logger.debug("userDim is: " + userDim); Dimension usedSpace = new Dimension((int) ((double) Math.max(maxx - minx, min.width) * zoom), (int) ((double) Math.max(maxy - miny, min.height) * zoom)); logger.debug("zoom="+zoom+",usedSpace size is viewport size: " + usedSpace); // but, make sure we return a preferred size that is at least as big as the Viewport Dimension vpSize = getViewportSize(); if (vpSize != null) { if (vpSize.width > usedSpace.width && vpSize.height > usedSpace.height) { logger.debug("preferered size is viewport?: " + vpSize); return vpSize; } } // default logger.debug("preferred size is usedSpace?: " + usedSpace); return usedSpace; }
|
public Dimension getPreferredSize() { Rectangle cbounds = null; //int minx = Integer.MAX_VALUE, miny = Integer.MAX_VALUE, maxx = 0, maxy = 0; int minx = 0, miny = 0, maxx = 0, maxy = 0; for (int i = 0; i < contentPane.getComponentCount(); i++) { Component c = contentPane.getComponent(i); if (c.isVisible()) { cbounds = c.getBounds(cbounds); logger.debug("bounds: " + cbounds); minx = Math.min(cbounds.x, minx); miny = Math.min(cbounds.y, miny); maxx = Math.max(cbounds.x + cbounds.width , maxx); maxy = Math.max(cbounds.y + cbounds.height, maxy); } } Dimension min = getMinimumSize(); Dimension userDim = new Dimension(maxx-minx,maxy-miny); logger.debug("userDim is: " + userDim); Dimension usedSpace = new Dimension((int) ((double) Math.max(maxx - minx, min.width) * zoom), (int) ((double) Math.max(maxy - miny, min.height) * zoom)); logger.debug("zoom="+zoom+",usedSpace size is viewport size: " + usedSpace); // but, make sure we return a preferred size that is at least as big as the Viewport Dimension vpSize = getViewportSize(); if (vpSize != null) { if (vpSize.width > usedSpace.width && vpSize.height > usedSpace.height) { logger.debug("preferered size is viewport?: " + vpSize); return vpSize; } } // default logger.debug("preferred size is usedSpace?: " + usedSpace); return usedSpace; }
| 1,108,990
|
public Dimension getPreferredSize() { Rectangle cbounds = null; //int minx = Integer.MAX_VALUE, miny = Integer.MAX_VALUE, maxx = 0, maxy = 0; int minx = 0, miny = 0, maxx = 0, maxy = 0; for (int i = 0; i < contentPane.getComponentCount(); i++) { Component c = contentPane.getComponent(i); if (c.isVisible()) { cbounds = c.getBounds(cbounds); logger.debug("bounds: " + cbounds); minx = Math.min(cbounds.x, minx); miny = Math.min(cbounds.y, miny); maxx = Math.max(cbounds.x + cbounds.width , maxx); maxy = Math.max(cbounds.y + cbounds.height, maxy); logger.debug("min:("+minx+","+miny+"),max:("+maxx+","+maxy+")"); } } Dimension min = getMinimumSize(); Dimension userDim = new Dimension(maxx-minx,maxy-miny); logger.debug("userDim is: " + userDim); Dimension usedSpace = new Dimension((int) ((double) Math.max(maxx - minx, min.width) * zoom), (int) ((double) Math.max(maxy - miny, min.height) * zoom)); logger.debug("zoom="+zoom+",usedSpace size is viewport size: " + usedSpace); // but, make sure we return a preferred size that is at least as big as the Viewport Dimension vpSize = getViewportSize(); if (vpSize != null) { if (vpSize.width > usedSpace.width && vpSize.height > usedSpace.height) { logger.debug("preferered size is viewport?: " + vpSize); return vpSize; } } // default logger.debug("preferred size is usedSpace?: " + usedSpace); return usedSpace; }
|
public Dimension getPreferredSize() { Rectangle cbounds = null; //int minx = Integer.MAX_VALUE, miny = Integer.MAX_VALUE, maxx = 0, maxy = 0; int minx = 0, miny = 0, maxx = 0, maxy = 0; for (int i = 0; i < contentPane.getComponentCount(); i++) { Component c = contentPane.getComponent(i); if (c.isVisible()) { cbounds = c.getBounds(cbounds); logger.debug("bounds: " + cbounds); minx = Math.min(cbounds.x, minx); miny = Math.min(cbounds.y, miny); maxx = Math.max(cbounds.x + cbounds.width , maxx); maxy = Math.max(cbounds.y + cbounds.height, maxy); logger.debug("min:("+minx+","+miny+"),max:("+maxx+","+maxy+")"); } } Dimension userDim = new Dimension(maxx-minx,maxy-miny); logger.debug("userDim is: " + userDim); Dimension usedSpace = new Dimension((int) ((double) Math.max(maxx - minx, min.width) * zoom), (int) ((double) Math.max(maxy - miny, min.height) * zoom)); logger.debug("zoom="+zoom+",usedSpace size is viewport size: " + usedSpace); // but, make sure we return a preferred size that is at least as big as the Viewport Dimension vpSize = getViewportSize(); if (vpSize != null) { if (vpSize.width > usedSpace.width && vpSize.height > usedSpace.height) { logger.debug("preferered size is viewport?: " + vpSize); return vpSize; } } // default logger.debug("preferred size is usedSpace?: " + usedSpace); return usedSpace; }
| 1,108,991
|
public Dimension getPreferredSize() { Rectangle cbounds = null; //int minx = Integer.MAX_VALUE, miny = Integer.MAX_VALUE, maxx = 0, maxy = 0; int minx = 0, miny = 0, maxx = 0, maxy = 0; for (int i = 0; i < contentPane.getComponentCount(); i++) { Component c = contentPane.getComponent(i); if (c.isVisible()) { cbounds = c.getBounds(cbounds); logger.debug("bounds: " + cbounds); minx = Math.min(cbounds.x, minx); miny = Math.min(cbounds.y, miny); maxx = Math.max(cbounds.x + cbounds.width , maxx); maxy = Math.max(cbounds.y + cbounds.height, maxy); logger.debug("min:("+minx+","+miny+"),max:("+maxx+","+maxy+")"); } } Dimension min = getMinimumSize(); Dimension userDim = new Dimension(maxx-minx,maxy-miny); logger.debug("userDim is: " + userDim); Dimension usedSpace = new Dimension((int) ((double) Math.max(maxx - minx, min.width) * zoom), (int) ((double) Math.max(maxy - miny, min.height) * zoom)); logger.debug("zoom="+zoom+",usedSpace size is viewport size: " + usedSpace); // but, make sure we return a preferred size that is at least as big as the Viewport Dimension vpSize = getViewportSize(); if (vpSize != null) { if (vpSize.width > usedSpace.width && vpSize.height > usedSpace.height) { logger.debug("preferered size is viewport?: " + vpSize); return vpSize; } } // default logger.debug("preferred size is usedSpace?: " + usedSpace); return usedSpace; }
|
public Dimension getPreferredSize() { Rectangle cbounds = null; //int minx = Integer.MAX_VALUE, miny = Integer.MAX_VALUE, maxx = 0, maxy = 0; int minx = 0, miny = 0, maxx = 0, maxy = 0; for (int i = 0; i < contentPane.getComponentCount(); i++) { Component c = contentPane.getComponent(i); if (c.isVisible()) { cbounds = c.getBounds(cbounds); logger.debug("bounds: " + cbounds); minx = Math.min(cbounds.x, minx); miny = Math.min(cbounds.y, miny); maxx = Math.max(cbounds.x + cbounds.width , maxx); maxy = Math.max(cbounds.y + cbounds.height, maxy); logger.debug("min:("+minx+","+miny+"),max:("+maxx+","+maxy+")"); } } Dimension min = getMinimumSize(); Dimension userDim = new Dimension(maxx-minx,maxy-miny); logger.debug("userDim is: " + userDim); Dimension usedSpace = new Dimension((int) ((double) Math.max(maxx - minx, min.width) * zoom), (int) ((double) Math.max(maxy - miny, min.height) * zoom)); logger.debug("zoom="+zoom+",usedSpace size is viewport size: " + usedSpace); // but, make sure we return a preferred size that is at least as big as the Viewport Dimension vpSize = getViewportSize(); if (vpSize != null) { if (vpSize.width > usedSpace.width && vpSize.height > usedSpace.height) { logger.debug("preferered size is viewport?: " + vpSize); return vpSize; } } // default logger.debug("preferred size is usedSpace?: " + usedSpace); return usedSpace; }
| 1,108,992
|
public Dimension getPreferredSize() { Rectangle cbounds = null; //int minx = Integer.MAX_VALUE, miny = Integer.MAX_VALUE, maxx = 0, maxy = 0; int minx = 0, miny = 0, maxx = 0, maxy = 0; for (int i = 0; i < contentPane.getComponentCount(); i++) { Component c = contentPane.getComponent(i); if (c.isVisible()) { cbounds = c.getBounds(cbounds); logger.debug("bounds: " + cbounds); minx = Math.min(cbounds.x, minx); miny = Math.min(cbounds.y, miny); maxx = Math.max(cbounds.x + cbounds.width , maxx); maxy = Math.max(cbounds.y + cbounds.height, maxy); logger.debug("min:("+minx+","+miny+"),max:("+maxx+","+maxy+")"); } } Dimension min = getMinimumSize(); Dimension userDim = new Dimension(maxx-minx,maxy-miny); logger.debug("userDim is: " + userDim); Dimension usedSpace = new Dimension((int) ((double) Math.max(maxx - minx, min.width) * zoom), (int) ((double) Math.max(maxy - miny, min.height) * zoom)); logger.debug("zoom="+zoom+",usedSpace size is viewport size: " + usedSpace); // but, make sure we return a preferred size that is at least as big as the Viewport Dimension vpSize = getViewportSize(); if (vpSize != null) { if (vpSize.width > usedSpace.width && vpSize.height > usedSpace.height) { logger.debug("preferered size is viewport?: " + vpSize); return vpSize; } } // default logger.debug("preferred size is usedSpace?: " + usedSpace); return usedSpace; }
|
public Dimension getPreferredSize() { Rectangle cbounds = null; //int minx = Integer.MAX_VALUE, miny = Integer.MAX_VALUE, maxx = 0, maxy = 0; int minx = 0, miny = 0, maxx = 0, maxy = 0; for (int i = 0; i < contentPane.getComponentCount(); i++) { Component c = contentPane.getComponent(i); if (c.isVisible()) { cbounds = c.getBounds(cbounds); logger.debug("bounds: " + cbounds); minx = Math.min(cbounds.x, minx); miny = Math.min(cbounds.y, miny); maxx = Math.max(cbounds.x + cbounds.width , maxx); maxy = Math.max(cbounds.y + cbounds.height, maxy); logger.debug("min:("+minx+","+miny+"),max:("+maxx+","+maxy+")"); } } Dimension min = getMinimumSize(); Dimension userDim = new Dimension(maxx-minx,maxy-miny); logger.debug("userDim is: " + userDim); Dimension usedSpace = new Dimension((int) ((double) Math.max(maxx - minx, min.width) * zoom), (int) ((double) Math.max(maxy - miny, min.height) * zoom)); logger.debug("zoom="+zoom+",usedSpace size is viewport size: " + usedSpace); // but, make sure we return a preferred size that is at least as big as the Viewport Dimension vpSize = getViewportSize(); if (vpSize != null) { if (vpSize.width > usedSpace.width && vpSize.height > usedSpace.height) { logger.debug("preferered size is viewport?: " + vpSize); return vpSize; } } // default logger.debug("preferred size is usedSpace?: " + usedSpace); return usedSpace; }
| 1,108,993
|
public Dimension getPreferredSize() { Rectangle cbounds = null; //int minx = Integer.MAX_VALUE, miny = Integer.MAX_VALUE, maxx = 0, maxy = 0; int minx = 0, miny = 0, maxx = 0, maxy = 0; for (int i = 0; i < contentPane.getComponentCount(); i++) { Component c = contentPane.getComponent(i); if (c.isVisible()) { cbounds = c.getBounds(cbounds); logger.debug("bounds: " + cbounds); minx = Math.min(cbounds.x, minx); miny = Math.min(cbounds.y, miny); maxx = Math.max(cbounds.x + cbounds.width , maxx); maxy = Math.max(cbounds.y + cbounds.height, maxy); logger.debug("min:("+minx+","+miny+"),max:("+maxx+","+maxy+")"); } } Dimension min = getMinimumSize(); Dimension userDim = new Dimension(maxx-minx,maxy-miny); logger.debug("userDim is: " + userDim); Dimension usedSpace = new Dimension((int) ((double) Math.max(maxx - minx, min.width) * zoom), (int) ((double) Math.max(maxy - miny, min.height) * zoom)); logger.debug("zoom="+zoom+",usedSpace size is viewport size: " + usedSpace); // but, make sure we return a preferred size that is at least as big as the Viewport Dimension vpSize = getViewportSize(); if (vpSize != null) { if (vpSize.width > usedSpace.width && vpSize.height > usedSpace.height) { logger.debug("preferered size is viewport?: " + vpSize); return vpSize; } } // default logger.debug("preferred size is usedSpace?: " + usedSpace); return usedSpace; }
|
public Dimension getPreferredSize() { Rectangle cbounds = null; //int minx = Integer.MAX_VALUE, miny = Integer.MAX_VALUE, maxx = 0, maxy = 0; int minx = 0, miny = 0, maxx = 0, maxy = 0; for (int i = 0; i < contentPane.getComponentCount(); i++) { Component c = contentPane.getComponent(i); if (c.isVisible()) { cbounds = c.getBounds(cbounds); logger.debug("bounds: " + cbounds); minx = Math.min(cbounds.x, minx); miny = Math.min(cbounds.y, miny); maxx = Math.max(cbounds.x + cbounds.width , maxx); maxy = Math.max(cbounds.y + cbounds.height, maxy); logger.debug("min:("+minx+","+miny+"),max:("+maxx+","+maxy+")"); } } Dimension min = getMinimumSize(); Dimension userDim = new Dimension(maxx-minx,maxy-miny); logger.debug("userDim is: " + userDim); Dimension usedSpace = new Dimension((int) ((double) Math.max(maxx - minx, min.width) * zoom), (int) ((double) Math.max(maxy - miny, min.height) * zoom)); logger.debug("zoom="+zoom+",usedSpace size is viewport size: " + usedSpace); // but, make sure we return a preferred size that is at least as big as the Viewport Dimension vpSize = getViewportSize(); if (vpSize != null) { if (vpSize.width > usedSpace.width && vpSize.height > usedSpace.height) { logger.debug("preferered size is viewport?: " + vpSize); return vpSize; } } // default logger.debug("preferred size is usedSpace?: " + usedSpace); return usedSpace; }
| 1,108,994
|
public void doTag(final XMLOutput output) throws Exception { if ( verifier == null ) { throw new MissingAttributeException("verifier"); } boolean valid = false; // evaluate the body using the current Verifier if ( errorHandler != null ) { // we are redirecting errors to another handler // so just filter the body VerifierFilter filter = verifier.getVerifierFilter(); // now install the current output in the filter chain... // #### ContentHandler handler = filter.getContentHandler(); handler.startDocument(); getBody().run(context, new XMLOutput( handler ) ); handler.endDocument(); valid = filter.isValid(); } else { // outputting the errors to the current output verifier.setErrorHandler( new ErrorHandler() { public void error(SAXParseException exception) throws SAXException { outputException(output, "error", exception); } public void fatalError(SAXParseException exception) throws SAXException { outputException(output, "fatalError", exception); } public void warning(SAXParseException exception) throws SAXException { outputException(output, "warning", exception); } } ); VerifierHandler handler = verifier.getVerifierHandler(); handler.startDocument(); getBody().run(context, new XMLOutput( handler ) ); handler.endDocument(); valid = handler.isValid(); } if (var != null ) { Boolean value = (valid) ? Boolean.TRUE : Boolean.FALSE; context.setVariable(var, value); } }
|
public void doTag(final XMLOutput output) throws Exception { if ( verifier == null ) { throw new MissingAttributeException("verifier"); } boolean valid = false; // evaluate the body using the current Verifier if ( errorHandler != null ) { // we are redirecting errors to another handler // so just filter the body VerifierFilter filter = verifier.getVerifierFilter(); // now install the current output in the filter chain... // #### ContentHandler handler = filter.getContentHandler(); handler.startDocument(); invokeBody( new XMLOutput( handler ) ); handler.endDocument(); valid = filter.isValid(); } else { // outputting the errors to the current output verifier.setErrorHandler( new ErrorHandler() { public void error(SAXParseException exception) throws SAXException { outputException(output, "error", exception); } public void fatalError(SAXParseException exception) throws SAXException { outputException(output, "fatalError", exception); } public void warning(SAXParseException exception) throws SAXException { outputException(output, "warning", exception); } } ); VerifierHandler handler = verifier.getVerifierHandler(); handler.startDocument(); invokeBody( new XMLOutput( handler ) ); handler.endDocument(); valid = handler.isValid(); } if (var != null ) { Boolean value = (valid) ? Boolean.TRUE : Boolean.FALSE; context.setVariable(var, value); } }
| 1,108,996
|
public void changeColumnIndex(int oldIdx, int newIdx) throws ArchitectException { // remove and add the column directly, then manually fire the event. // This is necessary because the relationships prevent deletion of locked keys. SQLColumn col = (SQLColumn) columnsFolder.children.remove(oldIdx); columnsFolder.fireDbChildRemoved(oldIdx, col); columnsFolder.children.add(newIdx, col); if (newIdx == 0 || ((SQLColumn) columnsFolder.children.get(newIdx-1)).primaryKeySeq != null) { col.primaryKeySeq = new Integer(1); // will get sane value when normalized } normalizePrimaryKey(); columnsFolder.fireDbChildInserted(newIdx, col); }
|
public void changeColumnIndex(int oldIdx, int newIdx) throws ArchitectException { // remove and add the column directly, then manually fire the event. // This is necessary because the relationships prevent deletion of locked keys. SQLColumn col = (SQLColumn) columnsFolder.children.remove(oldIdx); columnsFolder.fireDbChildRemoved(oldIdx, col); getColumns().add(newIdx, col); if (newIdx == 0 || ((SQLColumn) columnsFolder.children.get(newIdx-1)).primaryKeySeq != null) { col.primaryKeySeq = new Integer(1); // will get sane value when normalized } normalizePrimaryKey(); columnsFolder.fireDbChildInserted(newIdx, col); }
| 1,108,998
|
public void changeColumnIndex(int oldIdx, int newIdx) throws ArchitectException { // remove and add the column directly, then manually fire the event. // This is necessary because the relationships prevent deletion of locked keys. SQLColumn col = (SQLColumn) columnsFolder.children.remove(oldIdx); columnsFolder.fireDbChildRemoved(oldIdx, col); columnsFolder.children.add(newIdx, col); if (newIdx == 0 || ((SQLColumn) columnsFolder.children.get(newIdx-1)).primaryKeySeq != null) { col.primaryKeySeq = new Integer(1); // will get sane value when normalized } normalizePrimaryKey(); columnsFolder.fireDbChildInserted(newIdx, col); }
|
public void changeColumnIndex(int oldIdx, int newIdx) throws ArchitectException { // remove and add the column directly, then manually fire the event. // This is necessary because the relationships prevent deletion of locked keys. SQLColumn col = (SQLColumn) columnsFolder.children.remove(oldIdx); columnsFolder.fireDbChildRemoved(oldIdx, col); columnsFolder.children.add(newIdx, col); if (newIdx == 0 || ((SQLColumn) getColumns().get(newIdx-1)).primaryKeySeq != null) { col.primaryKeySeq = new Integer(1); // will get sane value when normalized } normalizePrimaryKey(); columnsFolder.fireDbChildInserted(newIdx, col); }
| 1,108,999
|
public int getColumnIndex(SQLColumn col) { logger.debug("Looking for column index of: " + col); Iterator it = columnsFolder.children.iterator(); int colIdx = 0; while (it.hasNext()) { if (it.next() == col) { return colIdx; } colIdx++; } logger.debug("NOT FOUND"); return -1; }
|
public int getColumnIndex(SQLColumn col) { logger.debug("Looking for column index of: " + col); Iterator it = columnsFolder.children.iterator(); int colIdx = 0; while (it.hasNext()) { if (it.next() == col) { return colIdx; } colIdx++; } logger.debug("NOT FOUND"); return -1; }
| 1,109,000
|
public int getColumnIndex(SQLColumn col) { logger.debug("Looking for column index of: " + col); Iterator it = columnsFolder.children.iterator(); int colIdx = 0; while (it.hasNext()) { if (it.next() == col) { return colIdx; } colIdx++; } logger.debug("NOT FOUND"); return -1; }
|
public int getColumnIndex(SQLColumn col) { logger.debug("Looking for column index of: " + col); Iterator it = columnsFolder.children.iterator(); int colIdx = 0; while (it.hasNext()) { if (it.next() == col) { return colIdx; } } catch (ArchitectException e) { logger.warn("Unexpected ArchitectException in getColumnIndex on " +col.toString()); } logger.debug("NOT FOUND"); return -1; }
| 1,109,001
|
public List keysOfColumn(SQLColumn col) { LinkedList keys = new LinkedList(); Iterator it = exportedKeysFolder.children.iterator(); while (it.hasNext()) { SQLRelationship r = (SQLRelationship) it.next(); if (r.containsPkColumn(col)) { keys.add(r); } } it = importedKeysFolder.children.iterator(); while (it.hasNext()) { SQLRelationship r = (SQLRelationship) it.next(); if (r.containsFkColumn(col)) { keys.add(r); } } return keys; }
|
public List keysOfColumn(SQLColumn col) throws ArchitectException { LinkedList keys = new LinkedList(); Iterator it = exportedKeysFolder.children.iterator(); while (it.hasNext()) { SQLRelationship r = (SQLRelationship) it.next(); if (r.containsPkColumn(col)) { keys.add(r); } } it = importedKeysFolder.children.iterator(); while (it.hasNext()) { SQLRelationship r = (SQLRelationship) it.next(); if (r.containsFkColumn(col)) { keys.add(r); } } return keys; }
| 1,109,002
|
public List keysOfColumn(SQLColumn col) { LinkedList keys = new LinkedList(); Iterator it = exportedKeysFolder.children.iterator(); while (it.hasNext()) { SQLRelationship r = (SQLRelationship) it.next(); if (r.containsPkColumn(col)) { keys.add(r); } } it = importedKeysFolder.children.iterator(); while (it.hasNext()) { SQLRelationship r = (SQLRelationship) it.next(); if (r.containsFkColumn(col)) { keys.add(r); } } return keys; }
|
public List keysOfColumn(SQLColumn col) { LinkedList keys = new LinkedList(); Iterator it = getExportedKeys().iterator(); while (it.hasNext()) { SQLRelationship r = (SQLRelationship) it.next(); if (r.containsPkColumn(col)) { keys.add(r); } } it = importedKeysFolder.children.iterator(); while (it.hasNext()) { SQLRelationship r = (SQLRelationship) it.next(); if (r.containsFkColumn(col)) { keys.add(r); } } return keys; }
| 1,109,003
|
public List keysOfColumn(SQLColumn col) { LinkedList keys = new LinkedList(); Iterator it = exportedKeysFolder.children.iterator(); while (it.hasNext()) { SQLRelationship r = (SQLRelationship) it.next(); if (r.containsPkColumn(col)) { keys.add(r); } } it = importedKeysFolder.children.iterator(); while (it.hasNext()) { SQLRelationship r = (SQLRelationship) it.next(); if (r.containsFkColumn(col)) { keys.add(r); } } return keys; }
|
public List keysOfColumn(SQLColumn col) { LinkedList keys = new LinkedList(); Iterator it = exportedKeysFolder.children.iterator(); while (it.hasNext()) { SQLRelationship r = (SQLRelationship) it.next(); if (r.containsPkColumn(col)) { keys.add(r); } } it = getExportedKeys().iterator(); while (it.hasNext()) { SQLRelationship r = (SQLRelationship) it.next(); if (r.containsFkColumn(col)) { keys.add(r); } } return keys; }
| 1,109,004
|
public void normalizePrimaryKey() { if (columnsFolder.children.isEmpty()) return; boolean donePk = false; int i = 0; Iterator it = columnsFolder.children.iterator(); while (it.hasNext()) { SQLColumn col = (SQLColumn) it.next(); if (col.getPrimaryKeySeq() == null) donePk = true; if (!donePk) { col.primaryKeySeq = new Integer(i); } else { col.primaryKeySeq = null; } i++; } }
|
public void normalizePrimaryKey() { if (columnsFolder.children.isEmpty()) return; boolean donePk = false; int i = 0; Iterator it = columnsFolder.children.iterator(); while (it.hasNext()) { SQLColumn col = (SQLColumn) it.next(); if (col.getPrimaryKeySeq() == null) donePk = true; if (!donePk) { col.primaryKeySeq = new Integer(i); } else { col.primaryKeySeq = null; } i++; } }
| 1,109,005
|
public void normalizePrimaryKey() { if (columnsFolder.children.isEmpty()) return; boolean donePk = false; int i = 0; Iterator it = columnsFolder.children.iterator(); while (it.hasNext()) { SQLColumn col = (SQLColumn) it.next(); if (col.getPrimaryKeySeq() == null) donePk = true; if (!donePk) { col.primaryKeySeq = new Integer(i); } else { col.primaryKeySeq = null; } i++; } }
|
public void normalizePrimaryKey() { if (columnsFolder.children.isEmpty()) return; boolean donePk = false; int i = 0; Iterator it = columnsFolder.children.iterator(); while (it.hasNext()) { SQLColumn col = (SQLColumn) it.next(); if (col.getPrimaryKeySeq() == null) donePk = true; if (!donePk) { col.primaryKeySeq = new Integer(i); } else { col.primaryKeySeq = null; } } catch (ArchitectException e) { logger.warn("Unexpected ArchitectException in normalizePrimaryKey "+e); } }
| 1,109,006
|
protected synchronized void populateColumns() throws ArchitectException { if (columnsFolder.isPopulated()) return; if (columnsFolder.children.size() > 0) throw new IllegalStateException("Can't populate table because it already contains columns"); try { SQLColumn.addColumnsToTable(this, getCatalogName(), getSchemaName(), tableName); } catch (SQLException e) { throw new ArchitectException("Failed to populate columns of table "+getName(), e); } finally { columnsFolder.populated = true; Collections.sort(columnsFolder.children, new SQLColumn.SortByPKSeq()); normalizePrimaryKey(); int newSize = columnsFolder.children.size(); int[] changedIndices = new int[newSize]; for (int i = 0; i < newSize; i++) { changedIndices[i] = i; } columnsFolder.fireDbChildrenInserted(changedIndices, columnsFolder.children); } }
|
private synchronized void populateColumns() throws ArchitectException { if (columnsFolder.isPopulated()) return; if (columnsFolder.children.size() > 0) throw new IllegalStateException("Can't populate table because it already contains columns"); try { SQLColumn.addColumnsToTable(this, getCatalogName(), getSchemaName(), tableName); } catch (SQLException e) { throw new ArchitectException("Failed to populate columns of table "+getName(), e); } finally { columnsFolder.populated = true; Collections.sort(columnsFolder.children, new SQLColumn.SortByPKSeq()); normalizePrimaryKey(); int newSize = columnsFolder.children.size(); int[] changedIndices = new int[newSize]; for (int i = 0; i < newSize; i++) { changedIndices[i] = i; } columnsFolder.fireDbChildrenInserted(changedIndices, columnsFolder.children); } }
| 1,109,007
|
public synchronized void populateRelationships() throws ArchitectException { if (!columnsFolder.isPopulated()) throw new IllegalStateException("Table must be populated before relationships are added"); if (importedKeysFolder.isPopulated()) return; int oldSize = importedKeysFolder.children.size(); /* this must come before * SQLRelationship.addImportedRelationshipsToTable because * addImportedRelationshipsToTable causes SQLObjectEvents to be fired, * which in turn could cause infinite recursion when listeners * query the size of the relationships folder. */ importedKeysFolder.populated = true; try { SQLRelationship.addImportedRelationshipsToTable(this); } finally { int newSize = importedKeysFolder.children.size(); if (newSize > oldSize) { int[] changedIndices = new int[newSize - oldSize]; for (int i = 0, n = newSize - oldSize; i < n; i++) { changedIndices[i] = oldSize + i; } try { importedKeysFolder.fireDbChildrenInserted (changedIndices, importedKeysFolder.children.subList(oldSize, newSize)); } catch (IndexOutOfBoundsException ex) { logger.error("Index out of bounds while adding imported keys to table " +getName()+" where oldSize="+oldSize+"; newSize="+newSize +"; imported keys="+importedKeysFolder.children); } } } }
|
private synchronized void populateRelationships() throws ArchitectException { if (!columnsFolder.isPopulated()) throw new IllegalStateException("Table must be populated before relationships are added"); if (importedKeysFolder.isPopulated()) return; int oldSize = importedKeysFolder.children.size(); /* this must come before * SQLRelationship.addImportedRelationshipsToTable because * addImportedRelationshipsToTable causes SQLObjectEvents to be fired, * which in turn could cause infinite recursion when listeners * query the size of the relationships folder. */ importedKeysFolder.populated = true; try { SQLRelationship.addImportedRelationshipsToTable(this); } finally { int newSize = importedKeysFolder.children.size(); if (newSize > oldSize) { int[] changedIndices = new int[newSize - oldSize]; for (int i = 0, n = newSize - oldSize; i < n; i++) { changedIndices[i] = oldSize + i; } try { importedKeysFolder.fireDbChildrenInserted (changedIndices, importedKeysFolder.children.subList(oldSize, newSize)); } catch (IndexOutOfBoundsException ex) { logger.error("Index out of bounds while adding imported keys to table " +getName()+" where oldSize="+oldSize+"; newSize="+newSize +"; imported keys="+importedKeysFolder.children); } } } }
| 1,109,008
|
public void actionPerformed(ActionEvent e) { final SQLDatabase souDB =playpen.getDatabase(); final PLExport plexp = new PLExport(); final JDialog d = new JDialog(ArchitectFrame.getMainInstance(), "PL Repository"); JPanel plp = new JPanel(new BorderLayout(12,12)); plp.setBorder(BorderFactory.createEmptyBorder(12,12,12,12)); final PLExportPanel plPanel = new PLExportPanel(); plp.add(plPanel, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); JButton okButton = new JButton("Ok"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (plPanel.historyBox.getSelectedIndex() == 0) { JOptionPane.showMessageDialog(plPanel, "You have to select a target database from the list.", "Error", JOptionPane.ERROR_MESSAGE); return; } try { //plPanel.applyChanges(); plexp.setJobId(plPanel.getPlJobId()); plexp.setFolderName(plPanel.getPlFolderName()); plexp.setJobDescription(plPanel.getPlJobDescription()); plexp.setJobComment(plPanel.getPlJobComment()); plexp.setPlDBCS(plPanel.getDbcs()); plexp.setOutputTableOwner(plPanel.getPlOutputTableOwner()); plexp.setPlUsername(plPanel.getPlUserName()); plexp.setPlPassword(plPanel.getPlPassword()); } catch (Exception ex) { String message = "Can't export Transaction: "+ex.getMessage(); if (plPanel.isSelectedRunPLEngine()) { message += "\nThe engine will not run"; } JOptionPane.showMessageDialog(architectFrame, message); logger.error("Got exception while exporting Trans", ex); return; } d.setVisible(false); try { plexp.export(souDB); if (plPanel.isSelectedRunPLEngine()) { logger.debug("run PL LOADER Engine"); File plIni = new File(architectFrame.getUserSettings().getETLUserSettings().getPlDotIniPath()); File plDir = plIni.getParentFile(); File engineExe = new File(plDir, plPanel.getSelectedPlDatabase().getEngineExeutableName()); StringBuffer wcomm = new StringBuffer(1000); wcomm.append(engineExe.getPath()); wcomm.append(" USER_PROMPT=N"); wcomm.append(" JOB=").append(plPanel.getPlJobId()); wcomm.append(" USER=").append((plPanel.getDbcs()).getUser()).append("/").append((plPanel.getDbcs()).getPass()); wcomm.append("@").append(plPanel.getSelectedPlDatabase().getTNSName()); wcomm.append(" DEBUG=N SEND_EMAIL=N SKIP_PACKAGES=N CALC_DETAIL_STATS=N COMMIT_FREQ=100 APPEND_TO_JOB_LOG_IND=N"); wcomm.append(" APPEND_TO_JOB_ERR_IND=N"); wcomm.append(" SHOW_PROGRESS=100" ); System.out.println(wcomm.toString()); try { Process proc = Runtime.getRuntime().exec(wcomm.toString()); JDialog d = new JDialog(architectFrame, "Power*Loader Engine"); d.setContentPane(new EngineExecPanel(proc)); d.pack(); d.setVisible(true); } catch (IOException ie){ JOptionPane.showMessageDialog(playpen, "Unexpected Exception running Engine:\n"+ie); logger.error(ie); } } } catch (PLSecurityException ex) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+ex.getMessage()); logger.error("Got exception while exporting Trans", ex); } catch (SQLException esql) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+esql.getMessage()); logger.error("Got exception while exporting Trans", esql); } catch (ArchitectException arex){ JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+arex.getMessage()); logger.error("Got exception while exporting Trans", arex); } } }); buttonPanel.add(okButton); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { plPanel.discardChanges(); d.setVisible(false); } }); buttonPanel.add(cancelButton); plp.add(buttonPanel, BorderLayout.SOUTH); d.setContentPane(plp); d.pack(); d.setVisible(true); }
|
public void actionPerformed(ActionEvent e) { final SQLDatabase souDB =playpen.getDatabase(); final PLExport plexp = new PLExport(); final JDialog d = new JDialog(ArchitectFrame.getMainInstance(), "PL Repository"); JPanel plp = new JPanel(new BorderLayout(12,12)); plp.setBorder(BorderFactory.createEmptyBorder(12,12,12,12)); final PLExportPanel plPanel = new PLExportPanel(); plp.add(plPanel, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); JButton okButton = new JButton("Ok"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (plPanel.getTargetDBCS() == null) { JOptionPane.showMessageDialog(plPanel, "You have to select a target database from the list.", "Error", JOptionPane.ERROR_MESSAGE); return; } try { //plPanel.applyChanges(); plexp.setJobId(plPanel.getPlJobId()); plexp.setFolderName(plPanel.getPlFolderName()); plexp.setJobDescription(plPanel.getPlJobDescription()); plexp.setJobComment(plPanel.getPlJobComment()); plexp.setPlDBCS(plPanel.getDbcs()); plexp.setOutputTableOwner(plPanel.getPlOutputTableOwner()); plexp.setPlUsername(plPanel.getPlUserName()); plexp.setPlPassword(plPanel.getPlPassword()); } catch (Exception ex) { String message = "Can't export Transaction: "+ex.getMessage(); if (plPanel.isSelectedRunPLEngine()) { message += "\nThe engine will not run"; } JOptionPane.showMessageDialog(architectFrame, message); logger.error("Got exception while exporting Trans", ex); return; } d.setVisible(false); try { plexp.export(souDB); if (plPanel.isSelectedRunPLEngine()) { logger.debug("run PL LOADER Engine"); File plIni = new File(architectFrame.getUserSettings().getETLUserSettings().getPlDotIniPath()); File plDir = plIni.getParentFile(); File engineExe = new File(plDir, plPanel.getSelectedPlDatabase().getEngineExeutableName()); StringBuffer wcomm = new StringBuffer(1000); wcomm.append(engineExe.getPath()); wcomm.append(" USER_PROMPT=N"); wcomm.append(" JOB=").append(plPanel.getPlJobId()); wcomm.append(" USER=").append((plPanel.getDbcs()).getUser()).append("/").append((plPanel.getDbcs()).getPass()); wcomm.append("@").append(plPanel.getSelectedPlDatabase().getTNSName()); wcomm.append(" DEBUG=N SEND_EMAIL=N SKIP_PACKAGES=N CALC_DETAIL_STATS=N COMMIT_FREQ=100 APPEND_TO_JOB_LOG_IND=N"); wcomm.append(" APPEND_TO_JOB_ERR_IND=N"); wcomm.append(" SHOW_PROGRESS=100" ); System.out.println(wcomm.toString()); try { Process proc = Runtime.getRuntime().exec(wcomm.toString()); JDialog d = new JDialog(architectFrame, "Power*Loader Engine"); d.setContentPane(new EngineExecPanel(proc)); d.pack(); d.setVisible(true); } catch (IOException ie){ JOptionPane.showMessageDialog(playpen, "Unexpected Exception running Engine:\n"+ie); logger.error(ie); } } } catch (PLSecurityException ex) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+ex.getMessage()); logger.error("Got exception while exporting Trans", ex); } catch (SQLException esql) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+esql.getMessage()); logger.error("Got exception while exporting Trans", esql); } catch (ArchitectException arex){ JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+arex.getMessage()); logger.error("Got exception while exporting Trans", arex); } } }); buttonPanel.add(okButton); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { plPanel.discardChanges(); d.setVisible(false); } }); buttonPanel.add(cancelButton); plp.add(buttonPanel, BorderLayout.SOUTH); d.setContentPane(plp); d.pack(); d.setVisible(true); }
| 1,109,009
|
public void actionPerformed(ActionEvent e) { final SQLDatabase souDB =playpen.getDatabase(); final PLExport plexp = new PLExport(); final JDialog d = new JDialog(ArchitectFrame.getMainInstance(), "PL Repository"); JPanel plp = new JPanel(new BorderLayout(12,12)); plp.setBorder(BorderFactory.createEmptyBorder(12,12,12,12)); final PLExportPanel plPanel = new PLExportPanel(); plp.add(plPanel, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); JButton okButton = new JButton("Ok"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (plPanel.historyBox.getSelectedIndex() == 0) { JOptionPane.showMessageDialog(plPanel, "You have to select a target database from the list.", "Error", JOptionPane.ERROR_MESSAGE); return; } try { //plPanel.applyChanges(); plexp.setJobId(plPanel.getPlJobId()); plexp.setFolderName(plPanel.getPlFolderName()); plexp.setJobDescription(plPanel.getPlJobDescription()); plexp.setJobComment(plPanel.getPlJobComment()); plexp.setPlDBCS(plPanel.getDbcs()); plexp.setOutputTableOwner(plPanel.getPlOutputTableOwner()); plexp.setPlUsername(plPanel.getPlUserName()); plexp.setPlPassword(plPanel.getPlPassword()); } catch (Exception ex) { String message = "Can't export Transaction: "+ex.getMessage(); if (plPanel.isSelectedRunPLEngine()) { message += "\nThe engine will not run"; } JOptionPane.showMessageDialog(architectFrame, message); logger.error("Got exception while exporting Trans", ex); return; } d.setVisible(false); try { plexp.export(souDB); if (plPanel.isSelectedRunPLEngine()) { logger.debug("run PL LOADER Engine"); File plIni = new File(architectFrame.getUserSettings().getETLUserSettings().getPlDotIniPath()); File plDir = plIni.getParentFile(); File engineExe = new File(plDir, plPanel.getSelectedPlDatabase().getEngineExeutableName()); StringBuffer wcomm = new StringBuffer(1000); wcomm.append(engineExe.getPath()); wcomm.append(" USER_PROMPT=N"); wcomm.append(" JOB=").append(plPanel.getPlJobId()); wcomm.append(" USER=").append((plPanel.getDbcs()).getUser()).append("/").append((plPanel.getDbcs()).getPass()); wcomm.append("@").append(plPanel.getSelectedPlDatabase().getTNSName()); wcomm.append(" DEBUG=N SEND_EMAIL=N SKIP_PACKAGES=N CALC_DETAIL_STATS=N COMMIT_FREQ=100 APPEND_TO_JOB_LOG_IND=N"); wcomm.append(" APPEND_TO_JOB_ERR_IND=N"); wcomm.append(" SHOW_PROGRESS=100" ); System.out.println(wcomm.toString()); try { Process proc = Runtime.getRuntime().exec(wcomm.toString()); JDialog d = new JDialog(architectFrame, "Power*Loader Engine"); d.setContentPane(new EngineExecPanel(proc)); d.pack(); d.setVisible(true); } catch (IOException ie){ JOptionPane.showMessageDialog(playpen, "Unexpected Exception running Engine:\n"+ie); logger.error(ie); } } } catch (PLSecurityException ex) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+ex.getMessage()); logger.error("Got exception while exporting Trans", ex); } catch (SQLException esql) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+esql.getMessage()); logger.error("Got exception while exporting Trans", esql); } catch (ArchitectException arex){ JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+arex.getMessage()); logger.error("Got exception while exporting Trans", arex); } } }); buttonPanel.add(okButton); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { plPanel.discardChanges(); d.setVisible(false); } }); buttonPanel.add(cancelButton); plp.add(buttonPanel, BorderLayout.SOUTH); d.setContentPane(plp); d.pack(); d.setVisible(true); }
|
public void actionPerformed(ActionEvent e) { final SQLDatabase souDB =playpen.getDatabase(); final PLExport plexp = new PLExport(); final JDialog d = new JDialog(ArchitectFrame.getMainInstance(), "PL Repository"); JPanel plp = new JPanel(new BorderLayout(12,12)); plp.setBorder(BorderFactory.createEmptyBorder(12,12,12,12)); final PLExportPanel plPanel = new PLExportPanel(); plp.add(plPanel, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); JButton okButton = new JButton("Ok"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (plPanel.historyBox.getSelectedIndex() == 0) { JOptionPane.showMessageDialog(plPanel, "You have to select a target database from the list.", "Error", JOptionPane.ERROR_MESSAGE); return; } try { //plPanel.applyChanges(); plexp.setJobId(plPanel.getPlJobId()); plexp.setFolderName(plPanel.getPlFolderName()); plexp.setJobDescription(plPanel.getPlJobDescription()); plexp.setJobComment(plPanel.getPlJobComment()); plexp.setPlDBCS(plPanel.getTargetDBCS()); plexp.setOutputTableOwner(plPanel.getPlOutputTableOwner()); plexp.setPlUsername(plPanel.getPlUserName()); plexp.setPlPassword(plPanel.getPlPassword()); } catch (Exception ex) { String message = "Can't export Transaction: "+ex.getMessage(); if (plPanel.isSelectedRunPLEngine()) { message += "\nThe engine will not run"; } JOptionPane.showMessageDialog(architectFrame, message); logger.error("Got exception while exporting Trans", ex); return; } d.setVisible(false); try { plexp.export(souDB); if (plPanel.isSelectedRunPLEngine()) { logger.debug("run PL LOADER Engine"); File plIni = new File(architectFrame.getUserSettings().getETLUserSettings().getPlDotIniPath()); File plDir = plIni.getParentFile(); File engineExe = new File(plDir, plPanel.getSelectedPlDatabase().getEngineExeutableName()); StringBuffer wcomm = new StringBuffer(1000); wcomm.append(engineExe.getPath()); wcomm.append(" USER_PROMPT=N"); wcomm.append(" JOB=").append(plPanel.getPlJobId()); wcomm.append(" USER=").append((plPanel.getDbcs()).getUser()).append("/").append((plPanel.getDbcs()).getPass()); wcomm.append("@").append(plPanel.getSelectedPlDatabase().getTNSName()); wcomm.append(" DEBUG=N SEND_EMAIL=N SKIP_PACKAGES=N CALC_DETAIL_STATS=N COMMIT_FREQ=100 APPEND_TO_JOB_LOG_IND=N"); wcomm.append(" APPEND_TO_JOB_ERR_IND=N"); wcomm.append(" SHOW_PROGRESS=100" ); System.out.println(wcomm.toString()); try { Process proc = Runtime.getRuntime().exec(wcomm.toString()); JDialog d = new JDialog(architectFrame, "Power*Loader Engine"); d.setContentPane(new EngineExecPanel(proc)); d.pack(); d.setVisible(true); } catch (IOException ie){ JOptionPane.showMessageDialog(playpen, "Unexpected Exception running Engine:\n"+ie); logger.error(ie); } } } catch (PLSecurityException ex) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+ex.getMessage()); logger.error("Got exception while exporting Trans", ex); } catch (SQLException esql) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+esql.getMessage()); logger.error("Got exception while exporting Trans", esql); } catch (ArchitectException arex){ JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+arex.getMessage()); logger.error("Got exception while exporting Trans", arex); } } }); buttonPanel.add(okButton); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { plPanel.discardChanges(); d.setVisible(false); } }); buttonPanel.add(cancelButton); plp.add(buttonPanel, BorderLayout.SOUTH); d.setContentPane(plp); d.pack(); d.setVisible(true); }
| 1,109,010
|
public void actionPerformed(ActionEvent e) { final SQLDatabase souDB =playpen.getDatabase(); final PLExport plexp = new PLExport(); final JDialog d = new JDialog(ArchitectFrame.getMainInstance(), "PL Repository"); JPanel plp = new JPanel(new BorderLayout(12,12)); plp.setBorder(BorderFactory.createEmptyBorder(12,12,12,12)); final PLExportPanel plPanel = new PLExportPanel(); plp.add(plPanel, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); JButton okButton = new JButton("Ok"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (plPanel.historyBox.getSelectedIndex() == 0) { JOptionPane.showMessageDialog(plPanel, "You have to select a target database from the list.", "Error", JOptionPane.ERROR_MESSAGE); return; } try { //plPanel.applyChanges(); plexp.setJobId(plPanel.getPlJobId()); plexp.setFolderName(plPanel.getPlFolderName()); plexp.setJobDescription(plPanel.getPlJobDescription()); plexp.setJobComment(plPanel.getPlJobComment()); plexp.setPlDBCS(plPanel.getDbcs()); plexp.setOutputTableOwner(plPanel.getPlOutputTableOwner()); plexp.setPlUsername(plPanel.getPlUserName()); plexp.setPlPassword(plPanel.getPlPassword()); } catch (Exception ex) { String message = "Can't export Transaction: "+ex.getMessage(); if (plPanel.isSelectedRunPLEngine()) { message += "\nThe engine will not run"; } JOptionPane.showMessageDialog(architectFrame, message); logger.error("Got exception while exporting Trans", ex); return; } d.setVisible(false); try { plexp.export(souDB); if (plPanel.isSelectedRunPLEngine()) { logger.debug("run PL LOADER Engine"); File plIni = new File(architectFrame.getUserSettings().getETLUserSettings().getPlDotIniPath()); File plDir = plIni.getParentFile(); File engineExe = new File(plDir, plPanel.getSelectedPlDatabase().getEngineExeutableName()); StringBuffer wcomm = new StringBuffer(1000); wcomm.append(engineExe.getPath()); wcomm.append(" USER_PROMPT=N"); wcomm.append(" JOB=").append(plPanel.getPlJobId()); wcomm.append(" USER=").append((plPanel.getDbcs()).getUser()).append("/").append((plPanel.getDbcs()).getPass()); wcomm.append("@").append(plPanel.getSelectedPlDatabase().getTNSName()); wcomm.append(" DEBUG=N SEND_EMAIL=N SKIP_PACKAGES=N CALC_DETAIL_STATS=N COMMIT_FREQ=100 APPEND_TO_JOB_LOG_IND=N"); wcomm.append(" APPEND_TO_JOB_ERR_IND=N"); wcomm.append(" SHOW_PROGRESS=100" ); System.out.println(wcomm.toString()); try { Process proc = Runtime.getRuntime().exec(wcomm.toString()); JDialog d = new JDialog(architectFrame, "Power*Loader Engine"); d.setContentPane(new EngineExecPanel(proc)); d.pack(); d.setVisible(true); } catch (IOException ie){ JOptionPane.showMessageDialog(playpen, "Unexpected Exception running Engine:\n"+ie); logger.error(ie); } } } catch (PLSecurityException ex) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+ex.getMessage()); logger.error("Got exception while exporting Trans", ex); } catch (SQLException esql) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+esql.getMessage()); logger.error("Got exception while exporting Trans", esql); } catch (ArchitectException arex){ JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+arex.getMessage()); logger.error("Got exception while exporting Trans", arex); } } }); buttonPanel.add(okButton); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { plPanel.discardChanges(); d.setVisible(false); } }); buttonPanel.add(cancelButton); plp.add(buttonPanel, BorderLayout.SOUTH); d.setContentPane(plp); d.pack(); d.setVisible(true); }
|
public void actionPerformed(ActionEvent e) { final SQLDatabase souDB =playpen.getDatabase(); final PLExport plexp = new PLExport(); final JDialog d = new JDialog(ArchitectFrame.getMainInstance(), "PL Repository"); JPanel plp = new JPanel(new BorderLayout(12,12)); plp.setBorder(BorderFactory.createEmptyBorder(12,12,12,12)); final PLExportPanel plPanel = new PLExportPanel(); plp.add(plPanel, BorderLayout.CENTER); JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); JButton okButton = new JButton("Ok"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (plPanel.historyBox.getSelectedIndex() == 0) { JOptionPane.showMessageDialog(plPanel, "You have to select a target database from the list.", "Error", JOptionPane.ERROR_MESSAGE); return; } try { //plPanel.applyChanges(); plexp.setJobId(plPanel.getPlJobId()); plexp.setFolderName(plPanel.getPlFolderName()); plexp.setJobDescription(plPanel.getPlJobDescription()); plexp.setJobComment(plPanel.getPlJobComment()); plexp.setPlDBCS(plPanel.getDbcs()); plexp.setOutputTableOwner(plPanel.getPlOutputTableOwner()); plexp.setPlUsername(plPanel.getPlUserName()); plexp.setPlPassword(plPanel.getPlPassword()); } catch (Exception ex) { String message = "Can't export Transaction: "+ex.getMessage(); if (plPanel.isSelectedRunPLEngine()) { message += "\nThe engine will not run"; } JOptionPane.showMessageDialog(architectFrame, message); logger.error("Got exception while exporting Trans", ex); return; } d.setVisible(false); try { plexp.export(souDB); if (plPanel.isSelectedRunPLEngine()) { logger.debug("run PL LOADER Engine"); File plIni = new File(architectFrame.getUserSettings().getETLUserSettings().getPlDotIniPath()); File plDir = plIni.getParentFile(); File engineExe = new File(plDir, plPanel.getSelectedPlDatabase().getEngineExeutableName()); StringBuffer wcomm = new StringBuffer(1000); wcomm.append(engineExe.getPath()); wcomm.append(" USER_PROMPT=N"); wcomm.append(" JOB=").append(plPanel.getPlJobId()); wcomm.append(" USER=").append((plPanel.getTargetDBCS()).getUser()).append("/").append((plPanel.getTargetDBCS()).getPass()); wcomm.append("@").append(plPanel.getSelectedPlDatabase().getTNSName()); wcomm.append(" DEBUG=N SEND_EMAIL=N SKIP_PACKAGES=N CALC_DETAIL_STATS=N COMMIT_FREQ=100 APPEND_TO_JOB_LOG_IND=N"); wcomm.append(" APPEND_TO_JOB_ERR_IND=N"); wcomm.append(" SHOW_PROGRESS=100" ); System.out.println(wcomm.toString()); try { Process proc = Runtime.getRuntime().exec(wcomm.toString()); JDialog d = new JDialog(architectFrame, "Power*Loader Engine"); d.setContentPane(new EngineExecPanel(proc)); d.pack(); d.setVisible(true); } catch (IOException ie){ JOptionPane.showMessageDialog(playpen, "Unexpected Exception running Engine:\n"+ie); logger.error(ie); } } } catch (PLSecurityException ex) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+ex.getMessage()); logger.error("Got exception while exporting Trans", ex); } catch (SQLException esql) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+esql.getMessage()); logger.error("Got exception while exporting Trans", esql); } catch (ArchitectException arex){ JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+arex.getMessage()); logger.error("Got exception while exporting Trans", arex); } } }); buttonPanel.add(okButton); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { plPanel.discardChanges(); d.setVisible(false); } }); buttonPanel.add(cancelButton); plp.add(buttonPanel, BorderLayout.SOUTH); d.setContentPane(plp); d.pack(); d.setVisible(true); }
| 1,109,011
|
public void actionPerformed(ActionEvent evt) { if (plPanel.historyBox.getSelectedIndex() == 0) { JOptionPane.showMessageDialog(plPanel, "You have to select a target database from the list.", "Error", JOptionPane.ERROR_MESSAGE); return; } try { //plPanel.applyChanges(); plexp.setJobId(plPanel.getPlJobId()); plexp.setFolderName(plPanel.getPlFolderName()); plexp.setJobDescription(plPanel.getPlJobDescription()); plexp.setJobComment(plPanel.getPlJobComment()); plexp.setPlDBCS(plPanel.getDbcs()); plexp.setOutputTableOwner(plPanel.getPlOutputTableOwner()); plexp.setPlUsername(plPanel.getPlUserName()); plexp.setPlPassword(plPanel.getPlPassword()); } catch (Exception ex) { String message = "Can't export Transaction: "+ex.getMessage(); if (plPanel.isSelectedRunPLEngine()) { message += "\nThe engine will not run"; } JOptionPane.showMessageDialog(architectFrame, message); logger.error("Got exception while exporting Trans", ex); return; } d.setVisible(false); try { plexp.export(souDB); if (plPanel.isSelectedRunPLEngine()) { logger.debug("run PL LOADER Engine"); File plIni = new File(architectFrame.getUserSettings().getETLUserSettings().getPlDotIniPath()); File plDir = plIni.getParentFile(); File engineExe = new File(plDir, plPanel.getSelectedPlDatabase().getEngineExeutableName()); StringBuffer wcomm = new StringBuffer(1000); wcomm.append(engineExe.getPath()); wcomm.append(" USER_PROMPT=N"); wcomm.append(" JOB=").append(plPanel.getPlJobId()); wcomm.append(" USER=").append((plPanel.getDbcs()).getUser()).append("/").append((plPanel.getDbcs()).getPass()); wcomm.append("@").append(plPanel.getSelectedPlDatabase().getTNSName()); wcomm.append(" DEBUG=N SEND_EMAIL=N SKIP_PACKAGES=N CALC_DETAIL_STATS=N COMMIT_FREQ=100 APPEND_TO_JOB_LOG_IND=N"); wcomm.append(" APPEND_TO_JOB_ERR_IND=N"); wcomm.append(" SHOW_PROGRESS=100" ); System.out.println(wcomm.toString()); try { Process proc = Runtime.getRuntime().exec(wcomm.toString()); JDialog d = new JDialog(architectFrame, "Power*Loader Engine"); d.setContentPane(new EngineExecPanel(proc)); d.pack(); d.setVisible(true); } catch (IOException ie){ JOptionPane.showMessageDialog(playpen, "Unexpected Exception running Engine:\n"+ie); logger.error(ie); } } } catch (PLSecurityException ex) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+ex.getMessage()); logger.error("Got exception while exporting Trans", ex); } catch (SQLException esql) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+esql.getMessage()); logger.error("Got exception while exporting Trans", esql); } catch (ArchitectException arex){ JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+arex.getMessage()); logger.error("Got exception while exporting Trans", arex); } }
|
public void actionPerformed(ActionEvent evt) { if (plPanel.getTargetDBCS() == null) { JOptionPane.showMessageDialog(plPanel, "You have to select a target database from the list.", "Error", JOptionPane.ERROR_MESSAGE); return; } try { //plPanel.applyChanges(); plexp.setJobId(plPanel.getPlJobId()); plexp.setFolderName(plPanel.getPlFolderName()); plexp.setJobDescription(plPanel.getPlJobDescription()); plexp.setJobComment(plPanel.getPlJobComment()); plexp.setPlDBCS(plPanel.getDbcs()); plexp.setOutputTableOwner(plPanel.getPlOutputTableOwner()); plexp.setPlUsername(plPanel.getPlUserName()); plexp.setPlPassword(plPanel.getPlPassword()); } catch (Exception ex) { String message = "Can't export Transaction: "+ex.getMessage(); if (plPanel.isSelectedRunPLEngine()) { message += "\nThe engine will not run"; } JOptionPane.showMessageDialog(architectFrame, message); logger.error("Got exception while exporting Trans", ex); return; } d.setVisible(false); try { plexp.export(souDB); if (plPanel.isSelectedRunPLEngine()) { logger.debug("run PL LOADER Engine"); File plIni = new File(architectFrame.getUserSettings().getETLUserSettings().getPlDotIniPath()); File plDir = plIni.getParentFile(); File engineExe = new File(plDir, plPanel.getSelectedPlDatabase().getEngineExeutableName()); StringBuffer wcomm = new StringBuffer(1000); wcomm.append(engineExe.getPath()); wcomm.append(" USER_PROMPT=N"); wcomm.append(" JOB=").append(plPanel.getPlJobId()); wcomm.append(" USER=").append((plPanel.getDbcs()).getUser()).append("/").append((plPanel.getDbcs()).getPass()); wcomm.append("@").append(plPanel.getSelectedPlDatabase().getTNSName()); wcomm.append(" DEBUG=N SEND_EMAIL=N SKIP_PACKAGES=N CALC_DETAIL_STATS=N COMMIT_FREQ=100 APPEND_TO_JOB_LOG_IND=N"); wcomm.append(" APPEND_TO_JOB_ERR_IND=N"); wcomm.append(" SHOW_PROGRESS=100" ); System.out.println(wcomm.toString()); try { Process proc = Runtime.getRuntime().exec(wcomm.toString()); JDialog d = new JDialog(architectFrame, "Power*Loader Engine"); d.setContentPane(new EngineExecPanel(proc)); d.pack(); d.setVisible(true); } catch (IOException ie){ JOptionPane.showMessageDialog(playpen, "Unexpected Exception running Engine:\n"+ie); logger.error(ie); } } } catch (PLSecurityException ex) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+ex.getMessage()); logger.error("Got exception while exporting Trans", ex); } catch (SQLException esql) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+esql.getMessage()); logger.error("Got exception while exporting Trans", esql); } catch (ArchitectException arex){ JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+arex.getMessage()); logger.error("Got exception while exporting Trans", arex); } }
| 1,109,012
|
public void actionPerformed(ActionEvent evt) { if (plPanel.historyBox.getSelectedIndex() == 0) { JOptionPane.showMessageDialog(plPanel, "You have to select a target database from the list.", "Error", JOptionPane.ERROR_MESSAGE); return; } try { //plPanel.applyChanges(); plexp.setJobId(plPanel.getPlJobId()); plexp.setFolderName(plPanel.getPlFolderName()); plexp.setJobDescription(plPanel.getPlJobDescription()); plexp.setJobComment(plPanel.getPlJobComment()); plexp.setPlDBCS(plPanel.getDbcs()); plexp.setOutputTableOwner(plPanel.getPlOutputTableOwner()); plexp.setPlUsername(plPanel.getPlUserName()); plexp.setPlPassword(plPanel.getPlPassword()); } catch (Exception ex) { String message = "Can't export Transaction: "+ex.getMessage(); if (plPanel.isSelectedRunPLEngine()) { message += "\nThe engine will not run"; } JOptionPane.showMessageDialog(architectFrame, message); logger.error("Got exception while exporting Trans", ex); return; } d.setVisible(false); try { plexp.export(souDB); if (plPanel.isSelectedRunPLEngine()) { logger.debug("run PL LOADER Engine"); File plIni = new File(architectFrame.getUserSettings().getETLUserSettings().getPlDotIniPath()); File plDir = plIni.getParentFile(); File engineExe = new File(plDir, plPanel.getSelectedPlDatabase().getEngineExeutableName()); StringBuffer wcomm = new StringBuffer(1000); wcomm.append(engineExe.getPath()); wcomm.append(" USER_PROMPT=N"); wcomm.append(" JOB=").append(plPanel.getPlJobId()); wcomm.append(" USER=").append((plPanel.getDbcs()).getUser()).append("/").append((plPanel.getDbcs()).getPass()); wcomm.append("@").append(plPanel.getSelectedPlDatabase().getTNSName()); wcomm.append(" DEBUG=N SEND_EMAIL=N SKIP_PACKAGES=N CALC_DETAIL_STATS=N COMMIT_FREQ=100 APPEND_TO_JOB_LOG_IND=N"); wcomm.append(" APPEND_TO_JOB_ERR_IND=N"); wcomm.append(" SHOW_PROGRESS=100" ); System.out.println(wcomm.toString()); try { Process proc = Runtime.getRuntime().exec(wcomm.toString()); JDialog d = new JDialog(architectFrame, "Power*Loader Engine"); d.setContentPane(new EngineExecPanel(proc)); d.pack(); d.setVisible(true); } catch (IOException ie){ JOptionPane.showMessageDialog(playpen, "Unexpected Exception running Engine:\n"+ie); logger.error(ie); } } } catch (PLSecurityException ex) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+ex.getMessage()); logger.error("Got exception while exporting Trans", ex); } catch (SQLException esql) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+esql.getMessage()); logger.error("Got exception while exporting Trans", esql); } catch (ArchitectException arex){ JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+arex.getMessage()); logger.error("Got exception while exporting Trans", arex); } }
|
public void actionPerformed(ActionEvent evt) { if (plPanel.historyBox.getSelectedIndex() == 0) { JOptionPane.showMessageDialog(plPanel, "You have to select a target database from the list.", "Error", JOptionPane.ERROR_MESSAGE); return; } try { //plPanel.applyChanges(); plexp.setJobId(plPanel.getPlJobId()); plexp.setFolderName(plPanel.getPlFolderName()); plexp.setJobDescription(plPanel.getPlJobDescription()); plexp.setJobComment(plPanel.getPlJobComment()); plexp.setPlDBCS(plPanel.getTargetDBCS()); plexp.setOutputTableOwner(plPanel.getPlOutputTableOwner()); plexp.setPlUsername(plPanel.getPlUserName()); plexp.setPlPassword(plPanel.getPlPassword()); } catch (Exception ex) { String message = "Can't export Transaction: "+ex.getMessage(); if (plPanel.isSelectedRunPLEngine()) { message += "\nThe engine will not run"; } JOptionPane.showMessageDialog(architectFrame, message); logger.error("Got exception while exporting Trans", ex); return; } d.setVisible(false); try { plexp.export(souDB); if (plPanel.isSelectedRunPLEngine()) { logger.debug("run PL LOADER Engine"); File plIni = new File(architectFrame.getUserSettings().getETLUserSettings().getPlDotIniPath()); File plDir = plIni.getParentFile(); File engineExe = new File(plDir, plPanel.getSelectedPlDatabase().getEngineExeutableName()); StringBuffer wcomm = new StringBuffer(1000); wcomm.append(engineExe.getPath()); wcomm.append(" USER_PROMPT=N"); wcomm.append(" JOB=").append(plPanel.getPlJobId()); wcomm.append(" USER=").append((plPanel.getDbcs()).getUser()).append("/").append((plPanel.getDbcs()).getPass()); wcomm.append("@").append(plPanel.getSelectedPlDatabase().getTNSName()); wcomm.append(" DEBUG=N SEND_EMAIL=N SKIP_PACKAGES=N CALC_DETAIL_STATS=N COMMIT_FREQ=100 APPEND_TO_JOB_LOG_IND=N"); wcomm.append(" APPEND_TO_JOB_ERR_IND=N"); wcomm.append(" SHOW_PROGRESS=100" ); System.out.println(wcomm.toString()); try { Process proc = Runtime.getRuntime().exec(wcomm.toString()); JDialog d = new JDialog(architectFrame, "Power*Loader Engine"); d.setContentPane(new EngineExecPanel(proc)); d.pack(); d.setVisible(true); } catch (IOException ie){ JOptionPane.showMessageDialog(playpen, "Unexpected Exception running Engine:\n"+ie); logger.error(ie); } } } catch (PLSecurityException ex) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+ex.getMessage()); logger.error("Got exception while exporting Trans", ex); } catch (SQLException esql) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+esql.getMessage()); logger.error("Got exception while exporting Trans", esql); } catch (ArchitectException arex){ JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+arex.getMessage()); logger.error("Got exception while exporting Trans", arex); } }
| 1,109,013
|
public void actionPerformed(ActionEvent evt) { if (plPanel.historyBox.getSelectedIndex() == 0) { JOptionPane.showMessageDialog(plPanel, "You have to select a target database from the list.", "Error", JOptionPane.ERROR_MESSAGE); return; } try { //plPanel.applyChanges(); plexp.setJobId(plPanel.getPlJobId()); plexp.setFolderName(plPanel.getPlFolderName()); plexp.setJobDescription(plPanel.getPlJobDescription()); plexp.setJobComment(plPanel.getPlJobComment()); plexp.setPlDBCS(plPanel.getDbcs()); plexp.setOutputTableOwner(plPanel.getPlOutputTableOwner()); plexp.setPlUsername(plPanel.getPlUserName()); plexp.setPlPassword(plPanel.getPlPassword()); } catch (Exception ex) { String message = "Can't export Transaction: "+ex.getMessage(); if (plPanel.isSelectedRunPLEngine()) { message += "\nThe engine will not run"; } JOptionPane.showMessageDialog(architectFrame, message); logger.error("Got exception while exporting Trans", ex); return; } d.setVisible(false); try { plexp.export(souDB); if (plPanel.isSelectedRunPLEngine()) { logger.debug("run PL LOADER Engine"); File plIni = new File(architectFrame.getUserSettings().getETLUserSettings().getPlDotIniPath()); File plDir = plIni.getParentFile(); File engineExe = new File(plDir, plPanel.getSelectedPlDatabase().getEngineExeutableName()); StringBuffer wcomm = new StringBuffer(1000); wcomm.append(engineExe.getPath()); wcomm.append(" USER_PROMPT=N"); wcomm.append(" JOB=").append(plPanel.getPlJobId()); wcomm.append(" USER=").append((plPanel.getDbcs()).getUser()).append("/").append((plPanel.getDbcs()).getPass()); wcomm.append("@").append(plPanel.getSelectedPlDatabase().getTNSName()); wcomm.append(" DEBUG=N SEND_EMAIL=N SKIP_PACKAGES=N CALC_DETAIL_STATS=N COMMIT_FREQ=100 APPEND_TO_JOB_LOG_IND=N"); wcomm.append(" APPEND_TO_JOB_ERR_IND=N"); wcomm.append(" SHOW_PROGRESS=100" ); System.out.println(wcomm.toString()); try { Process proc = Runtime.getRuntime().exec(wcomm.toString()); JDialog d = new JDialog(architectFrame, "Power*Loader Engine"); d.setContentPane(new EngineExecPanel(proc)); d.pack(); d.setVisible(true); } catch (IOException ie){ JOptionPane.showMessageDialog(playpen, "Unexpected Exception running Engine:\n"+ie); logger.error(ie); } } } catch (PLSecurityException ex) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+ex.getMessage()); logger.error("Got exception while exporting Trans", ex); } catch (SQLException esql) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+esql.getMessage()); logger.error("Got exception while exporting Trans", esql); } catch (ArchitectException arex){ JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+arex.getMessage()); logger.error("Got exception while exporting Trans", arex); } }
|
public void actionPerformed(ActionEvent evt) { if (plPanel.historyBox.getSelectedIndex() == 0) { JOptionPane.showMessageDialog(plPanel, "You have to select a target database from the list.", "Error", JOptionPane.ERROR_MESSAGE); return; } try { //plPanel.applyChanges(); plexp.setJobId(plPanel.getPlJobId()); plexp.setFolderName(plPanel.getPlFolderName()); plexp.setJobDescription(plPanel.getPlJobDescription()); plexp.setJobComment(plPanel.getPlJobComment()); plexp.setPlDBCS(plPanel.getDbcs()); plexp.setOutputTableOwner(plPanel.getPlOutputTableOwner()); plexp.setPlUsername(plPanel.getPlUserName()); plexp.setPlPassword(plPanel.getPlPassword()); } catch (Exception ex) { String message = "Can't export Transaction: "+ex.getMessage(); if (plPanel.isSelectedRunPLEngine()) { message += "\nThe engine will not run"; } JOptionPane.showMessageDialog(architectFrame, message); logger.error("Got exception while exporting Trans", ex); return; } d.setVisible(false); try { plexp.export(souDB); if (plPanel.isSelectedRunPLEngine()) { logger.debug("run PL LOADER Engine"); File plIni = new File(architectFrame.getUserSettings().getETLUserSettings().getPlDotIniPath()); File plDir = plIni.getParentFile(); File engineExe = new File(plDir, plPanel.getSelectedPlDatabase().getEngineExeutableName()); StringBuffer wcomm = new StringBuffer(1000); wcomm.append(engineExe.getPath()); wcomm.append(" USER_PROMPT=N"); wcomm.append(" JOB=").append(plPanel.getPlJobId()); wcomm.append(" USER=").append((plPanel.getTargetDBCS()).getUser()).append("/").append((plPanel.getTargetDBCS()).getPass()); wcomm.append("@").append(plPanel.getSelectedPlDatabase().getTNSName()); wcomm.append(" DEBUG=N SEND_EMAIL=N SKIP_PACKAGES=N CALC_DETAIL_STATS=N COMMIT_FREQ=100 APPEND_TO_JOB_LOG_IND=N"); wcomm.append(" APPEND_TO_JOB_ERR_IND=N"); wcomm.append(" SHOW_PROGRESS=100" ); System.out.println(wcomm.toString()); try { Process proc = Runtime.getRuntime().exec(wcomm.toString()); JDialog d = new JDialog(architectFrame, "Power*Loader Engine"); d.setContentPane(new EngineExecPanel(proc)); d.pack(); d.setVisible(true); } catch (IOException ie){ JOptionPane.showMessageDialog(playpen, "Unexpected Exception running Engine:\n"+ie); logger.error(ie); } } } catch (PLSecurityException ex) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+ex.getMessage()); logger.error("Got exception while exporting Trans", ex); } catch (SQLException esql) { JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+esql.getMessage()); logger.error("Got exception while exporting Trans", esql); } catch (ArchitectException arex){ JOptionPane.showMessageDialog (architectFrame, "Can't export Transaction: "+arex.getMessage()); logger.error("Got exception while exporting Trans", arex); } }
| 1,109,014
|
public PlayPen(SQLDatabase db) { super(); if (db == null) throw new NullPointerException("db must be non-null"); this.db = db; relationships = new LinkedList(); db.addSQLObjectListener(this); setLayout(new PlayPenLayout(this)); setName("Play Pen"); setMinimumSize(new Dimension(200,200)); setBackground(java.awt.Color.white); setOpaque(false); // XXX: it really is opaque, but we can't have super.paintComponent() painting over top of our relationship lines dt = new DropTarget(this, new PlayPenDropListener()); tableNames = new HashMap(); addContainerListener(this); setupTablePanePopup(); }
|
public PlayPen(SQLDatabase db) { super(); if (db == null) throw new NullPointerException("db must be non-null"); this.db = db; relationships = new LinkedList(); try { ArchitectUtils.listenToHierarchy(this, db); } catch (ArchitectException ex) { logger.error("Couldn't listen to database", ex); } setLayout(new PlayPenLayout(this)); setName("Play Pen"); setMinimumSize(new Dimension(200,200)); setBackground(java.awt.Color.white); setOpaque(false); // XXX: it really is opaque, but we can't have super.paintComponent() painting over top of our relationship lines dt = new DropTarget(this, new PlayPenDropListener()); tableNames = new HashMap(); addContainerListener(this); setupTablePanePopup(); }
| 1,109,015
|
public void dbChildrenInserted(SQLObjectEvent e) { logger.debug("SQLObject children got inserted: "+e); SQLObject o = e.getSQLSource(); SQLObject[] c = e.getChildren(); for (int i = 0; i < c.length; i++) { if (c[i] instanceof SQLTable) { c[i].addSQLObjectListener(this); } } firePropertyChange("model.children", null, null); revalidate(); }
|
public void dbChildrenInserted(SQLObjectEvent e) { logger.debug("SQLObject children got inserted: "+e); SQLObject o = e.getSQLSource(); SQLObject[] c = e.getChildren(); for (int i = 0; i < c.length; i++) { if (c[i] instanceof SQLTable) { c[i].addSQLObjectListener(this); } } firePropertyChange("model.children", null, null); revalidate(); }
| 1,109,016
|
public void dbChildrenInserted(SQLObjectEvent e) { logger.debug("SQLObject children got inserted: "+e); SQLObject o = e.getSQLSource(); SQLObject[] c = e.getChildren(); for (int i = 0; i < c.length; i++) { if (c[i] instanceof SQLTable) { c[i].addSQLObjectListener(this); } } firePropertyChange("model.children", null, null); revalidate(); }
|
public void dbChildrenInserted(SQLObjectEvent e) { logger.debug("SQLObject children got inserted: "+e); SQLObject o = e.getSQLSource(); SQLObject[] c = e.getChildren(); for (int i = 0; i < c.length; i++) { if (c[i] instanceof SQLTable) { c[i].addSQLObjectListener(this); } } firePropertyChange("model.children", null, null); revalidate(); }
| 1,109,017
|
public void dbChildrenRemoved(SQLObjectEvent e) { logger.debug("SQLObject children got removed: "+e); SQLObject o = e.getSQLSource(); SQLObject[] c = e.getChildren(); for (int i = 0; i < c.length; i++) { if (c[i] instanceof SQLTable) { c[i].removeSQLObjectListener(this); for (int j = 0; j < getComponentCount(); j++) { TablePane tp = (TablePane) getComponent(j); if (tp.getModel() == c[i]) { remove(j); } } } } firePropertyChange("model.children", null, null); repaint(); }
|
public void dbChildrenRemoved(SQLObjectEvent e) { logger.debug("SQLObject children got removed: "+e); SQLObject o = e.getSQLSource(); SQLObject[] c = e.getChildren(); for (int i = 0; i < c.length; i++) { if (c[i] instanceof SQLTable) { for (int j = 0; j < getComponentCount(); j++) { TablePane tp = (TablePane) getComponent(j); if (tp.getModel() == c[i]) { remove(j); } } } } firePropertyChange("model.children", null, null); repaint(); }
| 1,109,018
|
public void dbChildrenRemoved(SQLObjectEvent e) { logger.debug("SQLObject children got removed: "+e); SQLObject o = e.getSQLSource(); SQLObject[] c = e.getChildren(); for (int i = 0; i < c.length; i++) { if (c[i] instanceof SQLTable) { c[i].removeSQLObjectListener(this); for (int j = 0; j < getComponentCount(); j++) { TablePane tp = (TablePane) getComponent(j); if (tp.getModel() == c[i]) { remove(j); } } } } firePropertyChange("model.children", null, null); repaint(); }
|
public void dbChildrenRemoved(SQLObjectEvent e) { logger.debug("SQLObject children got removed: "+e); SQLObject o = e.getSQLSource(); SQLObject[] c = e.getChildren(); for (int i = 0; i < c.length; i++) { if (c[i] instanceof SQLTable) { c[i].removeSQLObjectListener(this); for (int j = 0; j < getComponentCount(); j++) { TablePane tp = (TablePane) getComponent(j); if (tp.getModel() == c[i]) { remove(j); } } } } firePropertyChange("model.children", null, null); repaint(); }
| 1,109,019
|
protected void configure() { // load the properties file of libraries available InputStream in = null; URL url = getClassLoader().getResource("org/apache/commons/jelly/jelly.properties"); if (url != null) { log.debug("Loading Jelly default tag libraries from: " + url); Properties properties = new Properties(); try { in = url.openStream(); properties.load(in); for (Iterator iter = properties.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String uri = (String) entry.getKey(); String className = (String) entry.getValue(); String libraryURI = "jelly:" + uri; // don't overload any Mock Tags already if ( context.getTagLibrary(libraryURI) == null ) { context.registerTagLibrary(libraryURI, className); } } } catch (IOException e) { log.error("Could not load jelly properties from: " + url + ". Reason: " + e, e); } finally { try { in.close(); } catch (Exception e) { // ignore } } } }
|
protected void configure() { // load the properties file of libraries available InputStream in = null; URL url = getClassLoader().getResource("org/apache/commons/jelly/jelly.properties"); if (url != null) { log.debug("Loading Jelly default tag libraries from: " + url); Properties properties = new Properties(); try { in = url.openStream(); properties.load(in); for (Iterator iter = properties.entrySet().iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry) iter.next(); String uri = (String) entry.getKey(); String className = (String) entry.getValue(); String libraryURI = "jelly:" + uri; // don't overload any Mock Tags already if ( ! context.isTagLibraryRegistered(libraryURI) ) { context.registerTagLibrary(libraryURI, className); } } } catch (IOException e) { log.error("Could not load jelly properties from: " + url + ". Reason: " + e, e); } finally { try { in.close(); } catch (Exception e) { // ignore } } } }
| 1,109,020
|
public ExpressionScript(Expression expression) { this.expression = expression; }
|
public ExpressionScript(Expression expression) { this.expression = expression; }
| 1,109,021
|
public ConstantExpression(Object value) { this.value = value; }
|
public ConstantExpression(Object value) { this.value = value; }
| 1,109,022
|
public StaticTagScript(TagFactory tagFactory) { super(tagFactory); }
|
public StaticTagScript(TagFactory tagFactory) { super(tagFactory); }
| 1,109,023
|
public String getOverTransmittedAllele(int type) { String[] alleleCodes = new String[5]; alleleCodes[0] = "X"; alleleCodes[1] = "A"; alleleCodes[2] = "C"; alleleCodes[3] = "G"; alleleCodes[4] = "T"; String retStr; if (this.counts[0][0] >= this.counts[0][1]){ retStr = alleleCodes[allele1]; }else{ retStr = alleleCodes[allele2]; } if (type != 1){ if (this.counts[1][0] >= this.counts[1][1]){ retStr += (", " + alleleCodes[allele1]); }else{ retStr += (", " + alleleCodes[allele2]); } } return retStr; }
|
public String getOverTransmittedAllele(int type) { String[] alleleCodes = new String[5]; alleleCodes[0] = "X"; alleleCodes[1] = "A"; alleleCodes[2] = "C"; alleleCodes[3] = "G"; alleleCodes[4] = "T"; String retStr; if (this.counts[0][0] > this.counts[0][1]){ retStr = alleleCodes[allele1]; }else{ retStr = alleleCodes[allele2]; } if (type != 1){ if (this.counts[1][0] >= this.counts[1][1]){ retStr += (", " + alleleCodes[allele1]); }else{ retStr += (", " + alleleCodes[allele2]); } } return retStr; }
| 1,109,024
|
public String getOverTransmittedAllele(int type) { String[] alleleCodes = new String[5]; alleleCodes[0] = "X"; alleleCodes[1] = "A"; alleleCodes[2] = "C"; alleleCodes[3] = "G"; alleleCodes[4] = "T"; String retStr; if (this.counts[0][0] >= this.counts[0][1]){ retStr = alleleCodes[allele1]; }else{ retStr = alleleCodes[allele2]; } if (type != 1){ if (this.counts[1][0] >= this.counts[1][1]){ retStr += (", " + alleleCodes[allele1]); }else{ retStr += (", " + alleleCodes[allele2]); } } return retStr; }
|
public String getOverTransmittedAllele(int type) { String[] alleleCodes = new String[5]; alleleCodes[0] = "X"; alleleCodes[1] = "A"; alleleCodes[2] = "C"; alleleCodes[3] = "G"; alleleCodes[4] = "T"; String retStr; if (this.counts[0][0] >= this.counts[0][1]){ retStr = alleleCodes[allele1]; }else{ retStr = alleleCodes[allele2]; } if (type != 1){ if (this.counts[1][0] > this.counts[1][1]){ retStr += (", " + alleleCodes[allele1]); }else{ retStr += (", " + alleleCodes[allele2]); } } return retStr; }
| 1,109,025
|
private void argHandler(String[] args){ //TODO: -specify values from HaplotypeDisplayController (min hap percentage etc) // -want to be able to output haps file from pedfile boolean nogui = false; String batchMode = ""; String hapsFileName = ""; String pedFileName = ""; String infoFileName = ""; String hapmapFileName = ""; boolean showCheck = false; boolean skipCheck = false; Vector ignoreMarkers = new Vector(); int outputType = -1; int maxDistance = -1; boolean quietMode = false; boolean outputDprime=false; boolean outputCheck=false; for(int i =0; i < args.length; i++) { if(args[i].equals("-help") || args[i].equals("-h")) { System.out.println("HaploView command line options\n" + "-h, -help print this message\n" + "-n command line output only\n" + "-q quiet mode- doesnt print any warnings or information to screen\n" + "-p <pedfile> specify an input file in pedigree file format\n" + " pedfile specific options (nogui mode only): \n" + " --showcheck displays the results of the various pedigree integrity checks\n" + " --skipcheck skips the various pedfile checks\n" + //TODO: fix ignoremarkers //" --ignoremarkers <markers> ignores the specified markers.<markers> is a comma\n" + //" seperated list of markers. eg. 1,5,7,19,25\n" + "-a <hapmapfile> specify an input file in HapMap format\n" + "-l <hapsfile> specify an input file in .haps format\n" + "-i <infofile> specify a marker info file\n" + "-b <batchfile> batch mode. batchfile should contain a list of files either all genotype or alternating genotype/info\n" + "-d outputs dprime to <inputfile>.DPRIME\n" + "-c outputs marker checks to <inputfile>.CHECK\n" + " note: -d and -c default to no blocks output. use -o to also output blocks\n" + "-o <GAB,GAM,SPI,ALL> output type. Gabriel, 4 gamete, spine output or all 3. default is SFS.\n" + "-m <distance> maximum comparison distance in kilobases (integer). default is 500"); System.exit(0); } else if(args[i].equals("-n")) { nogui = true; } else if(args[i].equals("-p")) { i++; if( i>=args.length || (args[i].charAt(0) == '-') || args[i].equals("showcheck") ){ System.out.println("-p requires a filename"); System.exit(1); } else{ if(!pedFileName.equals("")){ System.out.println("multiple -p arguments found. only last pedfile listed will be used"); } pedFileName = args[i]; } } else if (args[i].equals("--showcheck")){ showCheck = true; } else if (args[i].equals("--skipcheck")){ skipCheck = true; } /* else if (args[i].equals("--ignoremarkers")){ i++; if(i>=args.length || (args[i].charAt(0) == '-')){ System.out.println("--ignoremarkers requires a list of markers"); System.exit(1); } else { StringTokenizer str = new StringTokenizer(args[i],","); while(str.hasMoreTokens()) { ignoreMarkers.add(str.nextToken()); } } } */ else if(args[i].equals("-ha") || args[i].equals("-l")) { i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println("-ha requires a filename"); System.exit(1); } else{ if(!hapsFileName.equals("")){ System.out.println("multiple -ha arguments found. only last haps file listed will be used"); } hapsFileName = args[i]; } } else if(args[i].equals("-i")) { i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println("-i requires a filename"); System.exit(1); } else{ if(!infoFileName.equals("")){ System.out.println("multiple -i arguments found. only last info file listed will be used"); } infoFileName = args[i]; } } else if (args[i].equals("-a")){ i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println("-a requires a filename"); System.exit(1); } else{ if(!hapmapFileName.equals("")){ System.out.println("multiple -a arguments found. only last hapmap file listed will be used"); } hapmapFileName = args[i]; } } else if(args[i].equals("-o")) { i++; if(!(i>=args.length) && !((args[i].charAt(0)) == '-')){ if(outputType != -1){ System.out.println("only one -o argument is allowed"); System.exit(1); } if(args[i].equals("SFS") || args[i].equals("GAB")){ outputType = BLOX_GABRIEL; } else if(args[i].equals("GAM")){ outputType = BLOX_4GAM; } else if(args[i].equals("MJD") || args[i].equals("SPI")){ outputType = BLOX_SPINE; } else if(args[i].equals("ALL")) { outputType = BLOX_ALL; } } else { //defaults to SFS output outputType = BLOX_GABRIEL; i--; } } else if(args[i].equals("-d") || args[i].equals("--dprime")) { outputDprime = true; } else if (args[i].equals("-c")){ outputCheck = true; } else if(args[i].equals("-m")) { i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println("-m requires an integer argument"); System.exit(1); } else { if(maxDistance != -1){ System.out.println("only one -m argument allowed"); System.exit(1); } maxDistance = Integer.parseInt(args[i]); if(maxDistance<0){ System.out.println("-m argument must be a positive integer"); System.exit(1); } } } else if(args[i].equals("-b")) { //batch mode i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println("-b requires a filename"); System.exit(1); } else{ if(!batchMode.equals("")){ System.out.println("multiple -b arguments found. only last batch file listed will be used"); } batchMode = args[i]; } } else if(args[i].equals("-q")) { quietMode = true; } else { System.out.println("invalid parameter specified: " + args[i]); } } //mess with vars, set defaults, etc if( outputType == -1 && ( !pedFileName.equals("") || !hapsFileName.equals("") || !batchMode.equals("")) && !outputDprime && !outputCheck) { outputType = BLOX_GABRIEL; if(nogui && !quietMode) { System.out.println("No output type specified. Default of SFS will be used"); } } if(showCheck && !nogui && !quietMode) { System.out.println("pedfile showcheck option only applies in nogui mode. ignored."); } if(skipCheck && !quietMode) { System.out.println("Skipping pedigree file check"); } if(maxDistance == -1){ maxDistance = 500; } //set the global variables arg_nogui = nogui; arg_hapsfile = hapsFileName; arg_infoFileName = infoFileName; arg_pedfile = pedFileName; arg_hapmapfile = hapmapFileName; arg_showCheck = showCheck; arg_skipCheck = skipCheck; arg_ignoreMarkers = ignoreMarkers; arg_output = outputType; arg_distance = maxDistance; arg_batchMode = batchMode; arg_quiet = quietMode; arg_dprime = outputDprime; arg_check = outputCheck; }
|
private void argHandler(String[] args){ //TODO: -specify values from HaplotypeDisplayController (min hap percentage etc) // -want to be able to output haps file from pedfile boolean nogui = false; String batchMode = ""; String hapsFileName = ""; String pedFileName = ""; String infoFileName = ""; String hapmapFileName = ""; boolean showCheck = false; boolean skipCheck = false; Vector ignoreMarkers = new Vector(); int outputType = -1; int maxDistance = -1; boolean quietMode = false; boolean outputDprime=false; boolean outputCheck=false; for(int i =0; i < args.length; i++) { if(args[i].equals("-help") || args[i].equals("-h")) { System.out.println("HaploView command line options\n" + "-h, -help print this message\n" + "-n command line output only\n" + "-q quiet mode- doesnt print any warnings or information to screen\n" + "-p <pedfile> specify an input file in pedigree file format\n" + " pedfile specific options (nogui mode only): \n" + " --showcheck displays the results of the various pedigree integrity checks\n" + " --skipcheck skips the various pedfile checks\n" + //TODO: fix ignoremarkers //" --ignoremarkers <markers> ignores the specified markers.<markers> is a comma\n" + //" seperated list of markers. eg. 1,5,7,19,25\n" + "-a <hapmapfile> specify an input file in HapMap format\n" + "-l <hapsfile> specify an input file in .haps format\n" + "-i <infofile> specify a marker info file\n" + "-b <batchfile> batch mode. batchfile should contain a list of files either all genotype or alternating genotype/info\n" + "-d outputs dprime to <inputfile>.DPRIME\n" + "-c outputs marker checks to <inputfile>.CHECK\n" + " note: -d and -c default to no blocks output. use -o to also output blocks\n" + "-o <GAB,GAM,SPI,ALL> output type. Gabriel, 4 gamete, spine output or all 3. default is Gabriel.\n" + "-m <distance> maximum comparison distance in kilobases (integer). default is 500"); System.exit(0); } else if(args[i].equals("-n")) { nogui = true; } else if(args[i].equals("-p")) { i++; if( i>=args.length || (args[i].charAt(0) == '-') || args[i].equals("showcheck") ){ System.out.println("-p requires a filename"); System.exit(1); } else{ if(!pedFileName.equals("")){ System.out.println("multiple -p arguments found. only last pedfile listed will be used"); } pedFileName = args[i]; } } else if (args[i].equals("--showcheck")){ showCheck = true; } else if (args[i].equals("--skipcheck")){ skipCheck = true; } /* else if (args[i].equals("--ignoremarkers")){ i++; if(i>=args.length || (args[i].charAt(0) == '-')){ System.out.println("--ignoremarkers requires a list of markers"); System.exit(1); } else { StringTokenizer str = new StringTokenizer(args[i],","); while(str.hasMoreTokens()) { ignoreMarkers.add(str.nextToken()); } } } */ else if(args[i].equals("-ha") || args[i].equals("-l")) { i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println("-ha requires a filename"); System.exit(1); } else{ if(!hapsFileName.equals("")){ System.out.println("multiple -ha arguments found. only last haps file listed will be used"); } hapsFileName = args[i]; } } else if(args[i].equals("-i")) { i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println("-i requires a filename"); System.exit(1); } else{ if(!infoFileName.equals("")){ System.out.println("multiple -i arguments found. only last info file listed will be used"); } infoFileName = args[i]; } } else if (args[i].equals("-a")){ i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println("-a requires a filename"); System.exit(1); } else{ if(!hapmapFileName.equals("")){ System.out.println("multiple -a arguments found. only last hapmap file listed will be used"); } hapmapFileName = args[i]; } } else if(args[i].equals("-o")) { i++; if(!(i>=args.length) && !((args[i].charAt(0)) == '-')){ if(outputType != -1){ System.out.println("only one -o argument is allowed"); System.exit(1); } if(args[i].equals("SFS") || args[i].equals("GAB")){ outputType = BLOX_GABRIEL; } else if(args[i].equals("GAM")){ outputType = BLOX_4GAM; } else if(args[i].equals("MJD") || args[i].equals("SPI")){ outputType = BLOX_SPINE; } else if(args[i].equals("ALL")) { outputType = BLOX_ALL; } } else { //defaults to SFS output outputType = BLOX_GABRIEL; i--; } } else if(args[i].equals("-d") || args[i].equals("--dprime")) { outputDprime = true; } else if (args[i].equals("-c")){ outputCheck = true; } else if(args[i].equals("-m")) { i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println("-m requires an integer argument"); System.exit(1); } else { if(maxDistance != -1){ System.out.println("only one -m argument allowed"); System.exit(1); } maxDistance = Integer.parseInt(args[i]); if(maxDistance<0){ System.out.println("-m argument must be a positive integer"); System.exit(1); } } } else if(args[i].equals("-b")) { //batch mode i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println("-b requires a filename"); System.exit(1); } else{ if(!batchMode.equals("")){ System.out.println("multiple -b arguments found. only last batch file listed will be used"); } batchMode = args[i]; } } else if(args[i].equals("-q")) { quietMode = true; } else { System.out.println("invalid parameter specified: " + args[i]); } } //mess with vars, set defaults, etc if( outputType == -1 && ( !pedFileName.equals("") || !hapsFileName.equals("") || !batchMode.equals("")) && !outputDprime && !outputCheck) { outputType = BLOX_GABRIEL; if(nogui && !quietMode) { System.out.println("No output type specified. Default of SFS will be used"); } } if(showCheck && !nogui && !quietMode) { System.out.println("pedfile showcheck option only applies in nogui mode. ignored."); } if(skipCheck && !quietMode) { System.out.println("Skipping pedigree file check"); } if(maxDistance == -1){ maxDistance = 500; } //set the global variables arg_nogui = nogui; arg_hapsfile = hapsFileName; arg_infoFileName = infoFileName; arg_pedfile = pedFileName; arg_hapmapfile = hapmapFileName; arg_showCheck = showCheck; arg_skipCheck = skipCheck; arg_ignoreMarkers = ignoreMarkers; arg_output = outputType; arg_distance = maxDistance; arg_batchMode = batchMode; arg_quiet = quietMode; arg_dprime = outputDprime; arg_check = outputCheck; }
| 1,109,027
|
private void argHandler(String[] args){ //TODO: -specify values from HaplotypeDisplayController (min hap percentage etc) // -want to be able to output haps file from pedfile boolean nogui = false; String batchMode = ""; String hapsFileName = ""; String pedFileName = ""; String infoFileName = ""; String hapmapFileName = ""; boolean showCheck = false; boolean skipCheck = false; Vector ignoreMarkers = new Vector(); int outputType = -1; int maxDistance = -1; boolean quietMode = false; boolean outputDprime=false; boolean outputCheck=false; for(int i =0; i < args.length; i++) { if(args[i].equals("-help") || args[i].equals("-h")) { System.out.println("HaploView command line options\n" + "-h, -help print this message\n" + "-n command line output only\n" + "-q quiet mode- doesnt print any warnings or information to screen\n" + "-p <pedfile> specify an input file in pedigree file format\n" + " pedfile specific options (nogui mode only): \n" + " --showcheck displays the results of the various pedigree integrity checks\n" + " --skipcheck skips the various pedfile checks\n" + //TODO: fix ignoremarkers //" --ignoremarkers <markers> ignores the specified markers.<markers> is a comma\n" + //" seperated list of markers. eg. 1,5,7,19,25\n" + "-a <hapmapfile> specify an input file in HapMap format\n" + "-l <hapsfile> specify an input file in .haps format\n" + "-i <infofile> specify a marker info file\n" + "-b <batchfile> batch mode. batchfile should contain a list of files either all genotype or alternating genotype/info\n" + "-d outputs dprime to <inputfile>.DPRIME\n" + "-c outputs marker checks to <inputfile>.CHECK\n" + " note: -d and -c default to no blocks output. use -o to also output blocks\n" + "-o <GAB,GAM,SPI,ALL> output type. Gabriel, 4 gamete, spine output or all 3. default is SFS.\n" + "-m <distance> maximum comparison distance in kilobases (integer). default is 500"); System.exit(0); } else if(args[i].equals("-n")) { nogui = true; } else if(args[i].equals("-p")) { i++; if( i>=args.length || (args[i].charAt(0) == '-') || args[i].equals("showcheck") ){ System.out.println("-p requires a filename"); System.exit(1); } else{ if(!pedFileName.equals("")){ System.out.println("multiple -p arguments found. only last pedfile listed will be used"); } pedFileName = args[i]; } } else if (args[i].equals("--showcheck")){ showCheck = true; } else if (args[i].equals("--skipcheck")){ skipCheck = true; } /* else if (args[i].equals("--ignoremarkers")){ i++; if(i>=args.length || (args[i].charAt(0) == '-')){ System.out.println("--ignoremarkers requires a list of markers"); System.exit(1); } else { StringTokenizer str = new StringTokenizer(args[i],","); while(str.hasMoreTokens()) { ignoreMarkers.add(str.nextToken()); } } } */ else if(args[i].equals("-ha") || args[i].equals("-l")) { i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println("-ha requires a filename"); System.exit(1); } else{ if(!hapsFileName.equals("")){ System.out.println("multiple -ha arguments found. only last haps file listed will be used"); } hapsFileName = args[i]; } } else if(args[i].equals("-i")) { i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println("-i requires a filename"); System.exit(1); } else{ if(!infoFileName.equals("")){ System.out.println("multiple -i arguments found. only last info file listed will be used"); } infoFileName = args[i]; } } else if (args[i].equals("-a")){ i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println("-a requires a filename"); System.exit(1); } else{ if(!hapmapFileName.equals("")){ System.out.println("multiple -a arguments found. only last hapmap file listed will be used"); } hapmapFileName = args[i]; } } else if(args[i].equals("-o")) { i++; if(!(i>=args.length) && !((args[i].charAt(0)) == '-')){ if(outputType != -1){ System.out.println("only one -o argument is allowed"); System.exit(1); } if(args[i].equals("SFS") || args[i].equals("GAB")){ outputType = BLOX_GABRIEL; } else if(args[i].equals("GAM")){ outputType = BLOX_4GAM; } else if(args[i].equals("MJD") || args[i].equals("SPI")){ outputType = BLOX_SPINE; } else if(args[i].equals("ALL")) { outputType = BLOX_ALL; } } else { //defaults to SFS output outputType = BLOX_GABRIEL; i--; } } else if(args[i].equals("-d") || args[i].equals("--dprime")) { outputDprime = true; } else if (args[i].equals("-c")){ outputCheck = true; } else if(args[i].equals("-m")) { i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println("-m requires an integer argument"); System.exit(1); } else { if(maxDistance != -1){ System.out.println("only one -m argument allowed"); System.exit(1); } maxDistance = Integer.parseInt(args[i]); if(maxDistance<0){ System.out.println("-m argument must be a positive integer"); System.exit(1); } } } else if(args[i].equals("-b")) { //batch mode i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println("-b requires a filename"); System.exit(1); } else{ if(!batchMode.equals("")){ System.out.println("multiple -b arguments found. only last batch file listed will be used"); } batchMode = args[i]; } } else if(args[i].equals("-q")) { quietMode = true; } else { System.out.println("invalid parameter specified: " + args[i]); } } //mess with vars, set defaults, etc if( outputType == -1 && ( !pedFileName.equals("") || !hapsFileName.equals("") || !batchMode.equals("")) && !outputDprime && !outputCheck) { outputType = BLOX_GABRIEL; if(nogui && !quietMode) { System.out.println("No output type specified. Default of SFS will be used"); } } if(showCheck && !nogui && !quietMode) { System.out.println("pedfile showcheck option only applies in nogui mode. ignored."); } if(skipCheck && !quietMode) { System.out.println("Skipping pedigree file check"); } if(maxDistance == -1){ maxDistance = 500; } //set the global variables arg_nogui = nogui; arg_hapsfile = hapsFileName; arg_infoFileName = infoFileName; arg_pedfile = pedFileName; arg_hapmapfile = hapmapFileName; arg_showCheck = showCheck; arg_skipCheck = skipCheck; arg_ignoreMarkers = ignoreMarkers; arg_output = outputType; arg_distance = maxDistance; arg_batchMode = batchMode; arg_quiet = quietMode; arg_dprime = outputDprime; arg_check = outputCheck; }
|
private void argHandler(String[] args){ //TODO: -specify values from HaplotypeDisplayController (min hap percentage etc) // -want to be able to output haps file from pedfile boolean nogui = false; String batchMode = ""; String hapsFileName = ""; String pedFileName = ""; String infoFileName = ""; String hapmapFileName = ""; boolean showCheck = false; boolean skipCheck = false; Vector ignoreMarkers = new Vector(); int outputType = -1; int maxDistance = -1; boolean quietMode = false; boolean outputDprime=false; boolean outputCheck=false; for(int i =0; i < args.length; i++) { if(args[i].equals("-help") || args[i].equals("-h")) { System.out.println("HaploView command line options\n" + "-h, -help print this message\n" + "-n command line output only\n" + "-q quiet mode- doesnt print any warnings or information to screen\n" + "-p <pedfile> specify an input file in pedigree file format\n" + " pedfile specific options (nogui mode only): \n" + " --showcheck displays the results of the various pedigree integrity checks\n" + " --skipcheck skips the various pedfile checks\n" + //TODO: fix ignoremarkers //" --ignoremarkers <markers> ignores the specified markers.<markers> is a comma\n" + //" seperated list of markers. eg. 1,5,7,19,25\n" + "-a <hapmapfile> specify an input file in HapMap format\n" + "-l <hapsfile> specify an input file in .haps format\n" + "-i <infofile> specify a marker info file\n" + "-b <batchfile> batch mode. batchfile should contain a list of files either all genotype or alternating genotype/info\n" + "-d outputs dprime to <inputfile>.DPRIME\n" + "-c outputs marker checks to <inputfile>.CHECK\n" + " note: -d and -c default to no blocks output. use -o to also output blocks\n" + "-o <GAB,GAM,SPI,ALL> output type. Gabriel, 4 gamete, spine output or all 3. default is SFS.\n" + "-m <distance> maximum comparison distance in kilobases (integer). default is 500"); System.exit(0); } else if(args[i].equals("-n")) { nogui = true; } else if(args[i].equals("-p")) { i++; if( i>=args.length || (args[i].charAt(0) == '-') || args[i].equals("showcheck") ){ System.out.println("-p requires a filename"); System.exit(1); } else{ if(!pedFileName.equals("")){ System.out.println("multiple -p arguments found. only last pedfile listed will be used"); } pedFileName = args[i]; } } else if (args[i].equals("--showcheck")){ showCheck = true; } else if (args[i].equals("--skipcheck")){ skipCheck = true; } /* else if (args[i].equals("--ignoremarkers")){ i++; if(i>=args.length || (args[i].charAt(0) == '-')){ System.out.println("--ignoremarkers requires a list of markers"); System.exit(1); } else { StringTokenizer str = new StringTokenizer(args[i],","); while(str.hasMoreTokens()) { ignoreMarkers.add(str.nextToken()); } } } */ else if(args[i].equals("-ha") || args[i].equals("-l")) { i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println("-ha requires a filename"); System.exit(1); } else{ if(!hapsFileName.equals("")){ System.out.println("multiple -ha arguments found. only last haps file listed will be used"); } hapsFileName = args[i]; } } else if(args[i].equals("-i")) { i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println("-i requires a filename"); System.exit(1); } else{ if(!infoFileName.equals("")){ System.out.println("multiple -i arguments found. only last info file listed will be used"); } infoFileName = args[i]; } } else if (args[i].equals("-a")){ i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println("-a requires a filename"); System.exit(1); } else{ if(!hapmapFileName.equals("")){ System.out.println("multiple -a arguments found. only last hapmap file listed will be used"); } hapmapFileName = args[i]; } } else if(args[i].equals("-o")) { i++; if(!(i>=args.length) && !((args[i].charAt(0)) == '-')){ if(outputType != -1){ System.out.println("only one -o argument is allowed"); System.exit(1); } if(args[i].equals("SFS") || args[i].equals("GAB")){ outputType = BLOX_GABRIEL; } else if(args[i].equals("GAM")){ outputType = BLOX_4GAM; } else if(args[i].equals("MJD") || args[i].equals("SPI")){ outputType = BLOX_SPINE; } else if(args[i].equals("ALL")) { outputType = BLOX_ALL; } } else { //defaults to SFS output outputType = BLOX_GABRIEL; i--; } } else if(args[i].equals("-d") || args[i].equals("--dprime")) { outputDprime = true; } else if (args[i].equals("-c")){ outputCheck = true; } else if(args[i].equals("-m")) { i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println("-m requires an integer argument"); System.exit(1); } else { if(maxDistance != -1){ System.out.println("only one -m argument allowed"); System.exit(1); } maxDistance = Integer.parseInt(args[i]); if(maxDistance<0){ System.out.println("-m argument must be a positive integer"); System.exit(1); } } } else if(args[i].equals("-b")) { //batch mode i++; if(i>=args.length || ((args[i].charAt(0)) == '-')){ System.out.println("-b requires a filename"); System.exit(1); } else{ if(!batchMode.equals("")){ System.out.println("multiple -b arguments found. only last batch file listed will be used"); } batchMode = args[i]; } } else if(args[i].equals("-q")) { quietMode = true; } else { System.out.println("invalid parameter specified: " + args[i]); } } //mess with vars, set defaults, etc if( outputType == -1 && ( !pedFileName.equals("") || !hapsFileName.equals("") || !batchMode.equals("") || !hapmapFileName.equals("")) && !outputDprime && !outputCheck) { outputType = BLOX_GABRIEL; if(nogui && !quietMode) { System.out.println("No output type specified. Default of SFS will be used"); } } if(showCheck && !nogui && !quietMode) { System.out.println("pedfile showcheck option only applies in nogui mode. ignored."); } if(skipCheck && !quietMode) { System.out.println("Skipping pedigree file check"); } if(maxDistance == -1){ maxDistance = 500; } //set the global variables arg_nogui = nogui; arg_hapsfile = hapsFileName; arg_infoFileName = infoFileName; arg_pedfile = pedFileName; arg_hapmapfile = hapmapFileName; arg_showCheck = showCheck; arg_skipCheck = skipCheck; arg_ignoreMarkers = ignoreMarkers; arg_output = outputType; arg_distance = maxDistance; arg_batchMode = batchMode; arg_quiet = quietMode; arg_dprime = outputDprime; arg_check = outputCheck; }
| 1,109,028
|
public void paintComponent(Graphics g){ Graphics2D g2 = (Graphics2D) g; Dimension size = getSize(); Dimension pref = getPreferredSize(); Rectangle visRect = getVisibleRect(); /* boxSize = ((clipRect.width-2*H_BORDER)/dPrimeTable.length-1); if (boxSize < 12){boxSize=12;} if (boxSize < 25){ printDetails = false; boxRadius = boxSize/2; }else{ boxRadius = boxSize/2 - 1; } */ //okay so this dumb if block is to prevent the ugly repainting //bug when loading markers after the data are already being displayed, //results in a little off-centering for small datasets, but not too bad. //clickxshift and clickyshift are used later to translate from x,y coords //to the pair of markers comparison at those coords if (!(markersLoaded)){ g2.translate((size.width - pref.width) / 2, (size.height - pref.height) / 2); clickXShift = left + (size.width-pref.width)/2; clickYShift = top + (size.height - pref.height)/2; } else { g2.translate((size.width - pref.width) / 2, 0); clickXShift = left + (size.width-pref.width)/2; clickYShift = top; } FontMetrics boxFontMetrics = g.getFontMetrics(boxFont); int diamondX[] = new int[4]; int diamondY[] = new int[4]; Polygon diamond; left = H_BORDER; top = V_BORDER; FontMetrics metrics; int ascent; g2.setColor(this.getBackground()); g2.fillRect(0,0,pref.width,pref.height); g2.setColor(Color.BLACK); if (markersLoaded) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); //// draw the marker locations BasicStroke thickerStroke = new BasicStroke(1); BasicStroke thinnerStroke = new BasicStroke(0.25f); int wide = (dPrimeTable.length-1) * boxSize; //TODO: talk to kirby about locusview scaling gizmo int lineLeft = wide/20; int lineSpan = (wide/10)*9; long minpos = Chromosome.getMarker(0).getPosition(); long maxpos = Chromosome.getMarker(Chromosome.size()-1).getPosition(); double spanpos = maxpos - minpos; g2.setStroke(thinnerStroke); g2.setColor(Color.white); g2.fillRect(left + lineLeft, 5, lineSpan, TICK_HEIGHT); g2.setColor(Color.black); g2.drawRect(left + lineLeft, 5, lineSpan, TICK_HEIGHT); for (int i = 0; i < Chromosome.size(); i++) { double pos = (Chromosome.getMarker(i).getPosition() - minpos) / spanpos; int xx = (int) (left + lineLeft + lineSpan*pos); g2.setStroke(thickerStroke); g.drawLine(xx, 5, xx, 5 + TICK_HEIGHT); g2.setStroke(thinnerStroke); g.drawLine(xx, 5 + TICK_HEIGHT, left + i*boxSize, TICK_BOTTOM); } top += TICK_BOTTOM; //// draw the marker names if (printDetails){ g.setFont(markerNameFont); metrics = g.getFontMetrics(); ascent = metrics.getAscent(); widestMarkerName = metrics.stringWidth(Chromosome.getMarker(0).getName()); for (int x = 1; x < dPrimeTable.length; x++) { //TODO: fix bug with loading datasets with data and then without int thiswide = metrics.stringWidth(Chromosome.getMarker(x).getName()); if (thiswide > widestMarkerName) widestMarkerName = thiswide; } //System.out.println(widest); g2.translate(left, top + widestMarkerName); g2.rotate(-Math.PI / 2.0); for (int x = 0; x < dPrimeTable.length; x++) { g2.drawString(Chromosome.getMarker(x).getName(),TEXT_NUMBER_GAP, x*boxSize + ascent/3); } g2.rotate(Math.PI / 2.0); g2.translate(-left, -(top + widestMarkerName)); // move everybody down top += widestMarkerName + TEXT_NUMBER_GAP; } g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } //// draw the marker numbers if (printDetails){ g.setFont(markerNumFont); metrics = g.getFontMetrics(); ascent = metrics.getAscent(); System.out.println(dPrimeTable.length); for (int x = 0; x < dPrimeTable.length; x++) { String mark = String.valueOf(Chromosome.realIndex[x] + 1); g.drawString(mark, left + x*boxSize - metrics.stringWidth(mark)/2, top + ascent); } top += boxRadius/2; // give a little space between numbers and boxes } //the following values are the bounds on the boxes we want to //display given that the current window is 'visRect' lowX = (visRect.x-clickXShift-(visRect.y + visRect.height-clickYShift))/boxSize; if (lowX < 0) { lowX = 0; } highX = ((visRect.x + visRect.width)/boxSize)+1; if (highX > dPrimeTable.length-1){ highX = dPrimeTable.length-1; } lowY = ((visRect.x-clickXShift)+(visRect.y-clickYShift))/boxSize; if (lowY < lowX+1){ lowY = lowX+1; } highY = (((visRect.x-clickXShift+visRect.width) + (visRect.y-clickYShift+visRect.height))/boxSize)+1; if (highY > dPrimeTable.length){ highY = dPrimeTable.length; } // draw table column by column for (int x = lowX; x < highX; x++) { //always draw the fewest possible boxes if (lowY < x+1){ lowY = x+1; } for (int y = lowY; y < highY; y++) { if (dPrimeTable[x][y] == null){ continue; } //TODO:if you load data then info it doesn't handle selective drawing correctly double d = dPrimeTable[x][y].getDPrime(); //double l = dPrimeTable[x][y].getLOD(); Color boxColor = dPrimeTable[x][y].getColor(); // draw markers above int xx = left + (x + y) * boxSize / 2; int yy = top + (y - x) * boxSize / 2; diamondX[0] = xx; diamondY[0] = yy - boxRadius; diamondX[1] = xx + boxRadius; diamondY[1] = yy; diamondX[2] = xx; diamondY[2] = yy + boxRadius; diamondX[3] = xx - boxRadius; diamondY[3] = yy; diamond = new Polygon(diamondX, diamondY, 4); g.setColor(boxColor); g.fillPolygon(diamond); if (boxColor == Color.white) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setColor(Color.lightGray); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } if(printDetails){ g.setFont(boxFont); ascent = boxFontMetrics.getAscent(); int val = (int) (d * 100); g.setColor((val < 50) ? Color.gray : Color.black); if (val != 100) { String valu = String.valueOf(val); int widf = boxFontMetrics.stringWidth(valu); g.drawString(valu, xx - widf/2, yy + ascent/2); } } } } if (pref.getWidth() > visRect.width){ if (noImage){ //first time through draw a worldmap if dataset is big: final int WM_MAX_WIDTH = 300; int scalefactor; if (2*dPrimeTable.length < WM_MAX_WIDTH){ scalefactor = chartSize.width/(2*(dPrimeTable.length-1)); } else { scalefactor = chartSize.width/WM_MAX_WIDTH; } CompoundBorder wmBorder = new CompoundBorder(BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder()); worldmap = new BufferedImage(chartSize.width/scalefactor+wmBorder.getBorderInsets(this).left*2, chartSize.height/scalefactor+wmBorder.getBorderInsets(this).top*2, BufferedImage.TYPE_3BYTE_BGR); Graphics gw = worldmap.getGraphics(); gw.setColor(this.getBackground()); gw.fillRect(1,1,worldmap.getWidth()-2,worldmap.getHeight()-2); //make a pretty border gw.setColor(Color.BLACK); wmBorder.paintBorder(this,gw,0,0,worldmap.getWidth()-1,worldmap.getHeight()-1); ir = wmBorder.getInteriorRectangle(this,0,0,worldmap.getWidth()-1, worldmap.getHeight()-1); int prefBoxSize = ((worldmap.getWidth())/dPrimeTable.length-1); if (prefBoxSize < 1){ prefBoxSize=1; } for (int x = 0; x < dPrimeTable.length-1; x++){ for (int y = x+1; y < dPrimeTable.length; y++){ if (dPrimeTable[x][y] == null){ continue; } int xx = (x + y)+wmBorder.getBorderInsets(this).left;// * boxSize / 2; int yy = (y - x)+wmBorder.getBorderInsets(this).top;// * boxSize / 2; diamondX[0] = xx; diamondY[0] = yy - 1; diamondX[1] = xx + 1; diamondY[1] = yy; diamondX[2] = xx; diamondY[2] = yy + 1; diamondX[3] = xx - 1; diamondY[3] = yy; gw.setColor(dPrimeTable[x][y].getColor()); gw.fillPolygon(new Polygon(diamondX, diamondY,4)); /*gw.fillRect(xx+wmBorder.getBorderInsets(this).left, yy+wmBorder.getBorderInsets(this).top,3,3);//prefBoxSize,prefBoxSize);*/ } } noImage = false; } paintWorldMap(g); } }
|
public void paintComponent(Graphics g){ Graphics2D g2 = (Graphics2D) g; Dimension size = getSize(); Dimension pref = getPreferredSize(); Rectangle visRect = getVisibleRect(); /* boxSize = ((clipRect.width-2*H_BORDER)/dPrimeTable.length-1); if (boxSize < 12){boxSize=12;} if (boxSize < 25){ printDetails = false; boxRadius = boxSize/2; }else{ boxRadius = boxSize/2 - 1; } */ //okay so this dumb if block is to prevent the ugly repainting //bug when loading markers after the data are already being displayed, //results in a little off-centering for small datasets, but not too bad. //clickxshift and clickyshift are used later to translate from x,y coords //to the pair of markers comparison at those coords if (!(markersLoaded)){ g2.translate((size.width - pref.width) / 2, (size.height - pref.height) / 2); clickXShift = left + (size.width-pref.width)/2; clickYShift = top + (size.height - pref.height)/2; } else { g2.translate((size.width - pref.width) / 2, 0); clickXShift = left + (size.width-pref.width)/2; clickYShift = top; } FontMetrics boxFontMetrics = g.getFontMetrics(boxFont); int diamondX[] = new int[4]; int diamondY[] = new int[4]; Polygon diamond; left = H_BORDER; top = V_BORDER; FontMetrics metrics; int ascent; g2.setColor(this.getBackground()); g2.fillRect(0,0,pref.width,pref.height); g2.setColor(Color.BLACK); if (markersLoaded) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); //// draw the marker locations BasicStroke thickerStroke = new BasicStroke(1); BasicStroke thinnerStroke = new BasicStroke(0.25f); int wide = (dPrimeTable.length-1) * boxSize; //TODO: talk to kirby about locusview scaling gizmo int lineLeft = wide/20; int lineSpan = (wide/10)*9; long minpos = Chromosome.getMarker(0).getPosition(); long maxpos = Chromosome.getMarker(Chromosome.size()-1).getPosition(); double spanpos = maxpos - minpos; g2.setStroke(thinnerStroke); g2.setColor(Color.white); g2.fillRect(left + lineLeft, 5, lineSpan, TICK_HEIGHT); g2.setColor(Color.black); g2.drawRect(left + lineLeft, 5, lineSpan, TICK_HEIGHT); for (int i = 0; i < Chromosome.size(); i++) { double pos = (Chromosome.getMarker(i).getPosition() - minpos) / spanpos; int xx = (int) (left + lineLeft + lineSpan*pos); g2.setStroke(thickerStroke); g.drawLine(xx, 5, xx, 5 + TICK_HEIGHT); g2.setStroke(thinnerStroke); g.drawLine(xx, 5 + TICK_HEIGHT, left + i*boxSize, TICK_BOTTOM); } top += TICK_BOTTOM; //// draw the marker names if (printDetails){ g.setFont(markerNameFont); metrics = g.getFontMetrics(); ascent = metrics.getAscent(); widestMarkerName = metrics.stringWidth(Chromosome.getMarker(0).getName()); for (int x = 1; x < dPrimeTable.length; x++) { //TODO: fix bug with loading datasets with data and then without int thiswide = metrics.stringWidth(Chromosome.getMarker(x).getName()); if (thiswide > widestMarkerName) widestMarkerName = thiswide; } //System.out.println(widest); g2.translate(left, top + widestMarkerName); g2.rotate(-Math.PI / 2.0); for (int x = 0; x < dPrimeTable.length; x++) { g2.drawString(Chromosome.getMarker(x).getName(),TEXT_NUMBER_GAP, x*boxSize + ascent/3); } g2.rotate(Math.PI / 2.0); g2.translate(-left, -(top + widestMarkerName)); // move everybody down top += widestMarkerName + TEXT_NUMBER_GAP; } g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } //// draw the marker numbers if (printDetails){ g.setFont(markerNumFont); metrics = g.getFontMetrics(); ascent = metrics.getAscent(); for (int x = 0; x < dPrimeTable.length; x++) { String mark = String.valueOf(Chromosome.realIndex[x] + 1); g.drawString(mark, left + x*boxSize - metrics.stringWidth(mark)/2, top + ascent); } top += boxRadius/2; // give a little space between numbers and boxes } //the following values are the bounds on the boxes we want to //display given that the current window is 'visRect' lowX = (visRect.x-clickXShift-(visRect.y + visRect.height-clickYShift))/boxSize; if (lowX < 0) { lowX = 0; } highX = ((visRect.x + visRect.width)/boxSize)+1; if (highX > dPrimeTable.length-1){ highX = dPrimeTable.length-1; } lowY = ((visRect.x-clickXShift)+(visRect.y-clickYShift))/boxSize; if (lowY < lowX+1){ lowY = lowX+1; } highY = (((visRect.x-clickXShift+visRect.width) + (visRect.y-clickYShift+visRect.height))/boxSize)+1; if (highY > dPrimeTable.length){ highY = dPrimeTable.length; } // draw table column by column for (int x = lowX; x < highX; x++) { //always draw the fewest possible boxes if (lowY < x+1){ lowY = x+1; } for (int y = lowY; y < highY; y++) { if (dPrimeTable[x][y] == null){ continue; } //TODO:if you load data then info it doesn't handle selective drawing correctly double d = dPrimeTable[x][y].getDPrime(); //double l = dPrimeTable[x][y].getLOD(); Color boxColor = dPrimeTable[x][y].getColor(); // draw markers above int xx = left + (x + y) * boxSize / 2; int yy = top + (y - x) * boxSize / 2; diamondX[0] = xx; diamondY[0] = yy - boxRadius; diamondX[1] = xx + boxRadius; diamondY[1] = yy; diamondX[2] = xx; diamondY[2] = yy + boxRadius; diamondX[3] = xx - boxRadius; diamondY[3] = yy; diamond = new Polygon(diamondX, diamondY, 4); g.setColor(boxColor); g.fillPolygon(diamond); if (boxColor == Color.white) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setColor(Color.lightGray); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } if(printDetails){ g.setFont(boxFont); ascent = boxFontMetrics.getAscent(); int val = (int) (d * 100); g.setColor((val < 50) ? Color.gray : Color.black); if (val != 100) { String valu = String.valueOf(val); int widf = boxFontMetrics.stringWidth(valu); g.drawString(valu, xx - widf/2, yy + ascent/2); } } } } if (pref.getWidth() > visRect.width){ if (noImage){ //first time through draw a worldmap if dataset is big: final int WM_MAX_WIDTH = 300; int scalefactor; if (2*dPrimeTable.length < WM_MAX_WIDTH){ scalefactor = chartSize.width/(2*(dPrimeTable.length-1)); } else { scalefactor = chartSize.width/WM_MAX_WIDTH; } CompoundBorder wmBorder = new CompoundBorder(BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder()); worldmap = new BufferedImage(chartSize.width/scalefactor+wmBorder.getBorderInsets(this).left*2, chartSize.height/scalefactor+wmBorder.getBorderInsets(this).top*2, BufferedImage.TYPE_3BYTE_BGR); Graphics gw = worldmap.getGraphics(); gw.setColor(this.getBackground()); gw.fillRect(1,1,worldmap.getWidth()-2,worldmap.getHeight()-2); //make a pretty border gw.setColor(Color.BLACK); wmBorder.paintBorder(this,gw,0,0,worldmap.getWidth()-1,worldmap.getHeight()-1); ir = wmBorder.getInteriorRectangle(this,0,0,worldmap.getWidth()-1, worldmap.getHeight()-1); int prefBoxSize = ((worldmap.getWidth())/dPrimeTable.length-1); if (prefBoxSize < 1){ prefBoxSize=1; } for (int x = 0; x < dPrimeTable.length-1; x++){ for (int y = x+1; y < dPrimeTable.length; y++){ if (dPrimeTable[x][y] == null){ continue; } int xx = (x + y)+wmBorder.getBorderInsets(this).left;// * boxSize / 2; int yy = (y - x)+wmBorder.getBorderInsets(this).top;// * boxSize / 2; diamondX[0] = xx; diamondY[0] = yy - 1; diamondX[1] = xx + 1; diamondY[1] = yy; diamondX[2] = xx; diamondY[2] = yy + 1; diamondX[3] = xx - 1; diamondY[3] = yy; gw.setColor(dPrimeTable[x][y].getColor()); gw.fillPolygon(new Polygon(diamondX, diamondY,4)); /*gw.fillRect(xx+wmBorder.getBorderInsets(this).left, yy+wmBorder.getBorderInsets(this).top,3,3);//prefBoxSize,prefBoxSize);*/ } } noImage = false; } paintWorldMap(g); } }
| 1,109,029
|
public void setModel( Object model ) { setModel( model, false ); }
|
public void setModel( Object model ) { setModel( model, false ); }
| 1,109,030
|
private boolean checkAttributeDataType(ObjectAttributeInfo[] objAttrInfo, String[] dataTypes, ApplicationConfig appConfig, List attributesList){ boolean result = false; outerloop: for(int i=0; i<objAttrInfo.length;i++){ ObjectAttributeInfo attrInfo = objAttrInfo[i]; for(int j=0; j<dataTypes.length; j++){ Class attrInfoType = getClass(attrInfo.getType(), appConfig.getModuleClassLoader()); Class dataType = getClass(dataTypes[j], this.getClass().getClassLoader()); if(dataType.isAssignableFrom(attrInfoType)){ result = true; if(attributesList != null){ attributesList.add(attrInfo); }else{ break outerloop; } } } } return result; }
|
private boolean checkAttributeDataType(ObjectAttributeInfo[] objAttrInfo, String[] dataTypes, ApplicationConfig appConfig, List attributesList){ boolean result = false; outerloop: for(int i=0; i<objAttrInfo.length;i++){ ObjectAttributeInfo attrInfo = objAttrInfo[i]; for(int j=0; j<dataTypes.length; j++){ Class attrInfoType = getClass(attrInfo.getType(), appConfig.getModuleClassLoader()); Class dataType = getClass(dataTypes[j], this.getClass().getClassLoader()); if(attrInfoType != null && dataType.isAssignableFrom(attrInfoType)){ result = true; if(attributesList != null){ attributesList.add(attrInfo); }else{ break outerloop; } } } } return result; }
| 1,109,031
|
private Class getClass(String type, ClassLoader classLoader){ if(type.equals("boolean")) return Boolean.class; if(type.equals("byte")) return Byte.TYPE; if(type.equals("char")) return Character.class; if(type.equals("double")) return Double.class; if(type.equals("float")) return Float.class; if(type.equals("int")) return Integer.class; if(type.equals("long")) return Long.class; if(type.equals("short")) return Short.class; if(type.equals("void")) return Void.class; Class clazz = null; try{ clazz = Class.forName(type, true, classLoader); }catch(ClassNotFoundException e){ throw new RuntimeException(e); } return clazz; }
|
private Class getClass(String type, ClassLoader classLoader){ if(type.equals("boolean")) return Boolean.class; if(type.equals("byte")) return Byte.TYPE; if(type.equals("char")) return Character.class; if(type.equals("double")) return Double.class; if(type.equals("float")) return Float.class; if(type.equals("int")) return Integer.class; if(type.equals("long")) return Long.class; if(type.equals("short")) return Short.class; if(type.equals("void")) return Void.class; Class clazz = null; try{ clazz = Class.forName(type, true, classLoader); }catch(ClassNotFoundException e){ logger.fine("Error finding class of type=" + type + ", error=" + e.getMessage()); } return clazz; }
| 1,109,032
|
private List queryMBeansWithAttributes(ServiceContext context, String filter, String[] dataTypes) throws ServiceException{ ServerConnection serverConnection = context.getServerConnection(); List mbeans = queryMBeans(context, filter); List mbeanToAttributesList = new ArrayList(); for(Iterator itr=mbeans.iterator(); itr.hasNext();){ MBeanData mbeanData = (MBeanData)itr.next(); ObjectName objName = new ObjectName(mbeanData.getName()); ObjectInfo objInfo = serverConnection.getObjectInfo(objName); ObjectAttributeInfo[] objAttrInfo = objInfo.getAttributes(); if(objAttrInfo!=null && objAttrInfo.length > 0){ if(dataTypes!=null && dataTypes.length > 0){ if(checkAttributeDataType(objAttrInfo, dataTypes, context.getApplicationConfig(), null)){ mbeanToAttributesList.add(mbeanData); } }else{ mbeanToAttributesList.add(mbeanData); } } } return mbeanToAttributesList; }
|
private List queryMBeansWithAttributes(ServiceContext context, String filter, String[] dataTypes) throws ServiceException{ ServerConnection serverConnection = context.getServerConnection(); List mbeans = queryMBeans(context, filter); List mbeanToAttributesList = new ArrayList(); for(Iterator itr=mbeans.iterator(); itr.hasNext();){ MBeanData mbeanData = (MBeanData)itr.next(); ObjectName objName = new ObjectName(mbeanData.getName()); ObjectInfo objInfo = serverConnection.getObjectInfo(objName); ObjectAttributeInfo[] objAttrInfo = objInfo.getAttributes(); if(objAttrInfo!=null && objAttrInfo.length > 0){ if(dataTypes!=null && dataTypes.length > 0){ if(checkAttributeDataType(objAttrInfo, dataTypes, context.getApplicationConfig(), null)){ mbeanToAttributesList.add(mbeanData); } }else{ mbeanToAttributesList.add(mbeanData); } } } return mbeanToAttributesList; }
| 1,109,033
|
private List queryMBeansWithAttributes(ServiceContext context, String filter, String[] dataTypes) throws ServiceException{ ServerConnection serverConnection = context.getServerConnection(); List mbeans = queryMBeans(context, filter); List mbeanToAttributesList = new ArrayList(); for(Iterator itr=mbeans.iterator(); itr.hasNext();){ MBeanData mbeanData = (MBeanData)itr.next(); ObjectName objName = new ObjectName(mbeanData.getName()); ObjectInfo objInfo = serverConnection.getObjectInfo(objName); ObjectAttributeInfo[] objAttrInfo = objInfo.getAttributes(); if(objAttrInfo!=null && objAttrInfo.length > 0){ if(dataTypes!=null && dataTypes.length > 0){ if(checkAttributeDataType(objAttrInfo, dataTypes, context.getApplicationConfig(), null)){ mbeanToAttributesList.add(mbeanData); } }else{ mbeanToAttributesList.add(mbeanData); } } } return mbeanToAttributesList; }
|
private List queryMBeansWithAttributes(ServiceContext context, String filter, String[] dataTypes) throws ServiceException{ ServerConnection serverConnection = context.getServerConnection(); List mbeans = queryMBeans(context, filter); List mbeanToAttributesList = new ArrayList(); for(Iterator itr=mbeans.iterator(); itr.hasNext();){ MBeanData mbeanData = (MBeanData)itr.next(); ObjectName objName = new ObjectName(mbeanData.getName()); ObjectInfo objInfo = serverConnection.getObjectInfo(objName); ObjectAttributeInfo[] objAttrInfo = objInfo.getAttributes(); if(objAttrInfo!=null && objAttrInfo.length > 0){ if(dataTypes!=null && dataTypes.length > 0){ if(checkAttributeDataType(objAttrInfo, dataTypes, context.getApplicationConfig(), null)){ mbeanToAttributesList.add(mbeanData); } }else{ mbeanToAttributesList.add(mbeanData); } } } return mbeanToAttributesList; }
| 1,109,034
|
public Map queryMBeansWithNotifications(ServiceContext context) throws ServiceException { ServerConnection serverConnection = context.getServerConnection(); Set mbeans = serverConnection.queryNames(DEFAULT_FILTER_OBJECT_NAME); Map mbeanToNoficationsMap = new TreeMap(); for(Iterator it=mbeans.iterator(); it.hasNext(); ){ ObjectName objName = (ObjectName)it.next(); ObjectInfo objInfo = serverConnection.getObjectInfo(objName); ObjectNotificationInfo[] notifications = objInfo.getNotifications(); if(notifications != null && notifications.length > 0){ mbeanToNoficationsMap.put(objName.getCanonicalName(), notifications); } } return mbeanToNoficationsMap; }
|
public Map queryMBeansWithNotifications(ServiceContext context) throws ServiceException { ServerConnection serverConnection = context.getServerConnection(); Set mbeans = serverConnection.queryNames(DEFAULT_FILTER_OBJECT_NAME); Map mbeanToNoficationsMap = new TreeMap(); for(Iterator it=mbeans.iterator(); it.hasNext(); ){ ObjectName objName = (ObjectName)it.next(); ObjectInfo objInfo = serverConnection.getObjectInfo(objName); ObjectNotificationInfo[] notifications = objInfo.getNotifications(); if(notifications != null && notifications.length > 0){ mbeanToNoficationsMap.put(objName.getCanonicalName(), notifications); } } return mbeanToNoficationsMap; }
| 1,109,036
|
public void addSQLObjectListener(SQLObjectListener l) { if (getSQLObjectListeners().contains(l)) { logger.warn("NOT Adding duplicate listener "+l+" to SQLObject "+this); return; } getSQLObjectListeners().add(l); }
|
public void addSQLObjectListener(SQLObjectListener l) { if (getSQLObjectListeners().contains(l)) { if (logger.isDebugEnabled()) { logger.debug("NOT Adding duplicate listener "+l+" to SQLObject "+this); } return; } getSQLObjectListeners().add(l); }
| 1,109,037
|
public Object createNestedObject(String name) throws Exception { Object dataType = null; Object object = getObject(); if ( object != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( object.getClass() ); if ( ih != null ) { try { dataType = ih.createElement( getAntProject(), object, name ); } catch (Exception e) { log.error(e); } } } if ( dataType == null ) { dataType = createDataType( name ); } return dataType; }
|
public Object createNestedObject(Object object, String name) throws Exception { Object dataType = null; Object object = getObject(); if ( object != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( object.getClass() ); if ( ih != null ) { try { dataType = ih.createElement( getAntProject(), object, name ); } catch (Exception e) { log.error(e); } } } if ( dataType == null ) { dataType = createDataType( name ); } return dataType; }
| 1,109,038
|
public Object createNestedObject(String name) throws Exception { Object dataType = null; Object object = getObject(); if ( object != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( object.getClass() ); if ( ih != null ) { try { dataType = ih.createElement( getAntProject(), object, name ); } catch (Exception e) { log.error(e); } } } if ( dataType == null ) { dataType = createDataType( name ); } return dataType; }
|
public Object createNestedObject(String name) throws Exception { Object dataType = null; if ( object != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( object.getClass() ); if ( ih != null ) { try { dataType = ih.createElement( getAntProject(), object, name ); } catch (Exception e) { log.error(e); } } } if ( dataType == null ) { dataType = createDataType( name ); } return dataType; }
| 1,109,039
|
public void doTag(XMLOutput output) throws Exception { Project project = getAntProject(); String tagName = getTagName(); if ( project.getTaskDefinitions().containsKey( tagName ) ) { // the following algorithm follows the lifetime of a tag // http://jakarta.apache.org/ant/manual/develop.html#writingowntask // kindly recommended by Stefan Bodewig // create and set its project reference task = createTask( tagName ); if ( task instanceof TaskAdapter ) { setObject( ((TaskAdapter)task).getProxy() ); } else { setObject( task ); } // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, task ); } // ### we might want to spoof a Target setting here // now lets initialize task.init(); // now lets invoke the body to call all the createXXX() or addXXX() methods String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets set the addText() of the body content, if its applicaable Method method = MethodUtils.getAccessibleMethod( task.getClass(), "addText", addTaskParamTypes ); if (method != null) { String text = getBodyText(); Object[] args = { text }; method.invoke(this.task, args); } // now lets set all the attributes of the child elements // XXXX: to do! // now we're ready to invoke the task // XXX: should we call execute() or perform()? task.perform(); } else { // System.err.println( "Setting datatype/nested object of name: " + tagName ); // must be a datatype. AntTag ancestor = (AntTag) findAncestorWithClass( AntTag.class ); Object nested = null; if ( ancestor != null ) { nested = ancestor.createNestedObject( tagName ); } else { // System.err.println( "No ancestor" ); AntTagSupport ancestorToo = (AntTagSupport) findAncestorWithClass( AntTagSupport.class ); if ( ancestorToo != null ) { nested = ancestorToo.createNestedObject( tagName ); } } if ( nested == null ) { nested = createDataType( tagName ); } if ( nested != null ) { setObject( nested ); // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, nested ); } try{ PropertyUtils.setProperty( nested, "name", tagName ); } catch (Exception e) { } } // now lets invoke the body String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets add it to its parent if ( ancestor != null ) { Object parentObj = ancestor.getObject(); if ( parentObj != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( parentObj.getClass() ); try { ih.storeElement( project, parentObj, nested, tagName ); } catch (Exception e) { //log.warn( "Caught exception setting nested: " + tagName, e ); } } } } }
|
public void doTag(XMLOutput output) throws Exception { Project project = getAntProject(); String tagName = getTagName(); if ( project.getTaskDefinitions().containsKey( tagName ) ) { // the following algorithm follows the lifetime of a tag // http://jakarta.apache.org/ant/manual/develop.html#writingowntask // kindly recommended by Stefan Bodewig // create and set its project reference task = createTask( tagName ); if ( task instanceof TaskAdapter ) { setObject( ((TaskAdapter)task).getProxy() ); } else { setObject( task ); } // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, task ); } // ### we might want to spoof a Target setting here // now lets initialize task.init(); // now lets invoke the body to call all the createXXX() or addXXX() methods String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets set the addText() of the body content, if its applicaable Method method = MethodUtils.getAccessibleMethod( task.getClass(), "addText", addTaskParamTypes ); if (method != null) { String text = getBodyText(); Object[] args = { text }; method.invoke(this.task, args); } // now lets set all the attributes of the child elements // XXXX: to do! // now we're ready to invoke the task // XXX: should we call execute() or perform()? task.perform(); } else { // System.err.println( "Setting datatype/nested object of name: " + tagName ); // must be a datatype. AntTag ancestor = (AntTag) findAncestorWithClass( AntTag.class ); Object nested = null; if ( ancestor != null ) { nested = ancestor.createNestedObject( tagName ); } else { // System.err.println( "No ancestor" ); AntTagSupport ancestorToo = (AntTagSupport) findAncestorWithClass( AntTagSupport.class ); if ( ancestorToo != null ) { nested = ancestorToo.createNestedObject( tagName ); } } if ( nested == null ) { nested = createDataType( tagName ); } if ( nested != null ) { setObject( nested ); // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, nested ); } try{ PropertyUtils.setProperty( nested, "name", tagName ); } catch (Exception e) { } } // now lets invoke the body String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets add it to its parent if ( ancestor != null ) { Object parentObj = ancestor.getObject(); if ( parentObj != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( parentObj.getClass() ); try { ih.storeElement( project, parentObj, nested, tagName ); } catch (Exception e) { //log.warn( "Caught exception setting nested: " + tagName, e ); } } } } }
| 1,109,041
|
public void doTag(XMLOutput output) throws Exception { Project project = getAntProject(); String tagName = getTagName(); if ( project.getTaskDefinitions().containsKey( tagName ) ) { // the following algorithm follows the lifetime of a tag // http://jakarta.apache.org/ant/manual/develop.html#writingowntask // kindly recommended by Stefan Bodewig // create and set its project reference task = createTask( tagName ); if ( task instanceof TaskAdapter ) { setObject( ((TaskAdapter)task).getProxy() ); } else { setObject( task ); } // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, task ); } // ### we might want to spoof a Target setting here // now lets initialize task.init(); // now lets invoke the body to call all the createXXX() or addXXX() methods String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets set the addText() of the body content, if its applicaable Method method = MethodUtils.getAccessibleMethod( task.getClass(), "addText", addTaskParamTypes ); if (method != null) { String text = getBodyText(); Object[] args = { text }; method.invoke(this.task, args); } // now lets set all the attributes of the child elements // XXXX: to do! // now we're ready to invoke the task // XXX: should we call execute() or perform()? task.perform(); } else { // System.err.println( "Setting datatype/nested object of name: " + tagName ); // must be a datatype. AntTag ancestor = (AntTag) findAncestorWithClass( AntTag.class ); Object nested = null; if ( ancestor != null ) { nested = ancestor.createNestedObject( tagName ); } else { // System.err.println( "No ancestor" ); AntTagSupport ancestorToo = (AntTagSupport) findAncestorWithClass( AntTagSupport.class ); if ( ancestorToo != null ) { nested = ancestorToo.createNestedObject( tagName ); } } if ( nested == null ) { nested = createDataType( tagName ); } if ( nested != null ) { setObject( nested ); // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, nested ); } try{ PropertyUtils.setProperty( nested, "name", tagName ); } catch (Exception e) { } } // now lets invoke the body String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets add it to its parent if ( ancestor != null ) { Object parentObj = ancestor.getObject(); if ( parentObj != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( parentObj.getClass() ); try { ih.storeElement( project, parentObj, nested, tagName ); } catch (Exception e) { //log.warn( "Caught exception setting nested: " + tagName, e ); } } } } }
|
public void doTag(XMLOutput output) throws Exception { Project project = getAntProject(); String tagName = getTagName(); if ( project.getTaskDefinitions().containsKey( tagName ) ) { // the following algorithm follows the lifetime of a tag // http://jakarta.apache.org/ant/manual/develop.html#writingowntask // kindly recommended by Stefan Bodewig // create and set its project reference task = createTask( tagName ); if ( task instanceof TaskAdapter ) { setObject( ((TaskAdapter)task).getProxy() ); } else { setObject( task ); } // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, task ); } // ### we might want to spoof a Target setting here // now lets initialize task.init(); // now lets invoke the body to call all the createXXX() or addXXX() methods String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets set the addText() of the body content, if its applicaable Method method = MethodUtils.getAccessibleMethod( task.getClass(), "addText", addTaskParamTypes ); if (method != null) { String text = getBodyText(); Object[] args = { text }; method.invoke(this.task, args); } // now lets set all the attributes of the child elements // XXXX: to do! // now we're ready to invoke the task // XXX: should we call execute() or perform()? task.perform(); } else { // System.err.println( "Setting datatype/nested object of name: " + tagName ); // must be a datatype. AntTag ancestor = (AntTag) findAncestorWithClass( AntTag.class ); Object nested = null; if ( ancestor != null ) { nested = ancestor.createNestedObject( tagName ); } else { // System.err.println( "No ancestor" ); AntTagSupport ancestorToo = (AntTagSupport) findAncestorWithClass( AntTagSupport.class ); if ( ancestorToo != null ) { nested = ancestorToo.createNestedObject( tagName ); } } if ( nested == null ) { nested = createDataType( tagName ); } if ( nested != null ) { setObject( nested ); // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, nested ); } try{ PropertyUtils.setProperty( nested, "name", tagName ); } catch (Exception e) { } } // now lets invoke the body String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets add it to its parent if ( ancestor != null ) { Object parentObj = ancestor.getObject(); if ( parentObj != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( parentObj.getClass() ); try { ih.storeElement( project, parentObj, nested, tagName ); } catch (Exception e) { //log.warn( "Caught exception setting nested: " + tagName, e ); } } } } }
| 1,109,042
|
public void doTag(XMLOutput output) throws Exception { Project project = getAntProject(); String tagName = getTagName(); if ( project.getTaskDefinitions().containsKey( tagName ) ) { // the following algorithm follows the lifetime of a tag // http://jakarta.apache.org/ant/manual/develop.html#writingowntask // kindly recommended by Stefan Bodewig // create and set its project reference task = createTask( tagName ); if ( task instanceof TaskAdapter ) { setObject( ((TaskAdapter)task).getProxy() ); } else { setObject( task ); } // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, task ); } // ### we might want to spoof a Target setting here // now lets initialize task.init(); // now lets invoke the body to call all the createXXX() or addXXX() methods String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets set the addText() of the body content, if its applicaable Method method = MethodUtils.getAccessibleMethod( task.getClass(), "addText", addTaskParamTypes ); if (method != null) { String text = getBodyText(); Object[] args = { text }; method.invoke(this.task, args); } // now lets set all the attributes of the child elements // XXXX: to do! // now we're ready to invoke the task // XXX: should we call execute() or perform()? task.perform(); } else { // System.err.println( "Setting datatype/nested object of name: " + tagName ); // must be a datatype. AntTag ancestor = (AntTag) findAncestorWithClass( AntTag.class ); Object nested = null; if ( ancestor != null ) { nested = ancestor.createNestedObject( tagName ); } else { // System.err.println( "No ancestor" ); AntTagSupport ancestorToo = (AntTagSupport) findAncestorWithClass( AntTagSupport.class ); if ( ancestorToo != null ) { nested = ancestorToo.createNestedObject( tagName ); } } if ( nested == null ) { nested = createDataType( tagName ); } if ( nested != null ) { setObject( nested ); // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, nested ); } try{ PropertyUtils.setProperty( nested, "name", tagName ); } catch (Exception e) { } } // now lets invoke the body String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets add it to its parent if ( ancestor != null ) { Object parentObj = ancestor.getObject(); if ( parentObj != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( parentObj.getClass() ); try { ih.storeElement( project, parentObj, nested, tagName ); } catch (Exception e) { //log.warn( "Caught exception setting nested: " + tagName, e ); } } } } }
|
public void doTag(XMLOutput output) throws Exception { Project project = getAntProject(); String tagName = getTagName(); if ( project.getTaskDefinitions().containsKey( tagName ) ) { // the following algorithm follows the lifetime of a tag // http://jakarta.apache.org/ant/manual/develop.html#writingowntask // kindly recommended by Stefan Bodewig // create and set its project reference task = createTask( tagName ); if ( task instanceof TaskAdapter ) { setObject( ((TaskAdapter)task).getProxy() ); } else { setObject( task ); } // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, task ); } // ### we might want to spoof a Target setting here // now lets initialize task.init(); // now lets invoke the body to call all the createXXX() or addXXX() methods String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets set the addText() of the body content, if its applicaable Method method = MethodUtils.getAccessibleMethod( task.getClass(), "addText", addTaskParamTypes ); if (method != null) { String text = getBodyText(); Object[] args = { text }; method.invoke(this.task, args); } // now lets set all the attributes of the child elements // XXXX: to do! // now we're ready to invoke the task // XXX: should we call execute() or perform()? task.perform(); } else { // System.err.println( "Setting datatype/nested object of name: " + tagName ); // must be a datatype. AntTag ancestor = (AntTag) findAncestorWithClass( AntTag.class ); Object nested = null; if ( ancestor != null ) { nested = ancestor.createNestedObject( tagName ); } else { // System.err.println( "No ancestor" ); AntTagSupport ancestorToo = (AntTagSupport) findAncestorWithClass( AntTagSupport.class ); if ( ancestorToo != null ) { nested = ancestorToo.createNestedObject( tagName ); } } if ( nested == null ) { nested = createDataType( tagName ); } if ( nested != null ) { setObject( nested ); // set the task ID if one is given Object id = getAttributes().remove( "id" ); if ( id != null ) { project.addReference( (String) id, nested ); } try{ PropertyUtils.setProperty( nested, "name", tagName ); } catch (Exception e) { } } // now lets invoke the body String body = getBodyText(); // now lets set any attributes of this tag... setBeanProperties(); // now lets add it to its parent if ( ancestor != null ) { Object parentObj = ancestor.getObject(); if ( parentObj != null ) { IntrospectionHelper ih = IntrospectionHelper.getHelper( parentObj.getClass() ); try { ih.storeElement( project, parentObj, nested, tagName ); } catch (Exception e) { //log.warn( "Caught exception setting nested: " + tagName, e ); } } } } }
| 1,109,043
|
public void setBeanProperties() throws Exception { Object object = getObject(); if ( object != null ) { Map map = getAttributes(); for ( Iterator iter = map.entrySet().iterator(); iter.hasNext(); ) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Object value = entry.getValue(); setBeanProperty( object, name, value ); } } }
|
public void setBeanProperties() throws Exception { Object object = getTaskObject(); if ( object != null ) { Map map = getAttributes(); for ( Iterator iter = map.entrySet().iterator(); iter.hasNext(); ) { Map.Entry entry = (Map.Entry) iter.next(); String name = (String) entry.getKey(); Object value = entry.getValue(); setBeanProperty( object, name, value ); } } }
| 1,109,044
|
public Expression createExpression(ExpressionFactory factory, String tagName, String attributeName, String attributeValue) throws Exception { if (attributeName.equals( "value" ) || attributeName.equals( "items" ) || attributeName.equals( "test" ) ) { return factory.createExpression( attributeValue ); } // will use the default expression instead return null; }
|
public Expression createExpression(ExpressionFactory factory, String tagName, String attributeName, String attributeValue) throws Exception { if (attributeName.equals( "value" ) || attributeName.equals( "items" ) || attributeName.equals( "test" ) ) { return factory.createExpression( attributeValue ); } // will use the default expression instead return null; }
| 1,109,048
|
public static Object unmarshal(Class clazz, String str){ try { return org.exolab.castor.xml.Unmarshaller.unmarshal(clazz, new StringReader(str)); } catch (Exception e) { throw new RuntimeException("Error while unmarshalling obj of type:" + clazz.getName(), e); } }
|
public static Object unmarshal(String className, String str){ try { return org.exolab.castor.xml.Unmarshaller.unmarshal(clazz, new StringReader(str)); } catch (Exception e) { throw new RuntimeException("Error while unmarshalling obj of type:" + clazz.getName(), e); } }
| 1,109,050
|
public static Object unmarshal(Class clazz, String str){ try { return org.exolab.castor.xml.Unmarshaller.unmarshal(clazz, new StringReader(str)); } catch (Exception e) { throw new RuntimeException("Error while unmarshalling obj of type:" + clazz.getName(), e); } }
|
public static Object unmarshal(Class clazz, String str){ try { return org.exolab.castor.xml.Unmarshaller.unmarshal(clazz, new StringReader(str)); } catch (Exception e) { throw new RuntimeException("Error while unmarshalling obj of type:" + clazz.getName(), e); } }
| 1,109,051
|
public static String marshal(Object obj){ StringWriter writer = new StringWriter(); try { org.exolab.castor.xml.Marshaller marshaller = new org.exolab.castor.xml.Marshaller(writer); marshaller.setRootElement("marshalledObject"); marshaller.setMarshalAsDocument(false); marshaller.setSuppressXSIType(true); marshaller.marshal(obj); } catch (Exception e) { throw new RuntimeException("Error while marshalling obj of type:" + obj.getClass().getName(), e); } return writer.toString(); }
|
public static String marshal(Object obj){ StringWriter writer = new StringWriter(); try { org.exolab.castor.xml.Marshaller marshaller = new org.exolab.castor.xml.Marshaller(writer); marshaller.setRootElement("marshalledObject"); marshaller.setMarshalAsDocument(false); marshaller.setSuppressXSIType(true); marshaller.marshal(obj); } catch (Exception e) { throw new RuntimeException("Error while marshalling obj of type:" + obj.getClass().getName(), e); } return writer.toString(); }
| 1,109,052
|
public static String marshal(Object obj){ StringWriter writer = new StringWriter(); try { org.exolab.castor.xml.Marshaller marshaller = new org.exolab.castor.xml.Marshaller(writer); marshaller.setRootElement("marshalledObject"); marshaller.setMarshalAsDocument(false); marshaller.setSuppressXSIType(true); marshaller.marshal(obj); } catch (Exception e) { throw new RuntimeException("Error while marshalling obj of type:" + obj.getClass().getName(), e); } return writer.toString(); }
|
public static String marshal(Object obj){ StringWriter writer = new StringWriter(); try { org.exolab.castor.xml.Marshaller marshaller = new org.exolab.castor.xml.Marshaller(writer); marshaller.setRootElement("marshalledObject"); marshaller.setMarshalAsDocument(false); marshaller.setSuppressXSIType(true); marshaller.marshal(obj); } catch (Exception e) { throw new RuntimeException("Error while marshalling obj of type:" + obj.getClass().getName(), e); } logger.fine("Marshalled value: " + output); return output; }
| 1,109,053
|
public synchronized void populate() throws ArchitectException { if (populated) return; int oldSize = children.size(); Connection con = null; ResultSet rs = null; try { con = getConnection(); DatabaseMetaData dbmd = con.getMetaData(); logger.debug("MetaData class is: " + dbmd.getClass().getName()); rs = dbmd.getCatalogs(); while (rs.next()) { String catName = rs.getString(1); SQLCatalog cat = null; if (catName != null) { cat = new SQLCatalog(this, catName); cat.setNativeTerm(dbmd.getCatalogTerm()); logger.debug("Set catalog term to "+cat.getNativeTerm()); children.add(cat); } } // if we tried to get Catalogs, and there were none, then I guess // we should look for Schemas instead (i.e. this database has no // catalogs, and schemas attached directly to the database) if ( children.size() == oldSize ) { rs = dbmd.getSchemas(); while (rs.next()) { children.add(new SQLSchema(this, rs.getString(1),false)); } } } catch (SQLException e) { throw new ArchitectException("database.populate.fail", e); } finally { populated = true; int newSize = children.size(); if (newSize > oldSize) { int[] changedIndices = new int[newSize - oldSize]; for (int i = 0, n = newSize - oldSize; i < n; i++) { changedIndices[i] = oldSize + i; } fireDbChildrenInserted(changedIndices, children.subList(oldSize, newSize)); } try { if ( rs != null ) rs.close(); } catch (SQLException e2) { throw new ArchitectException("database.rs.close.fail", e2); } } }
|
public synchronized void populate() throws ArchitectException { if (populated) return; int oldSize = children.size(); Connection con = null; ResultSet rs = null; try { con = getConnection(); DatabaseMetaData dbmd = con.getMetaData(); rs = dbmd.getCatalogs(); while (rs.next()) { String catName = rs.getString(1); SQLCatalog cat = null; if (catName != null) { cat = new SQLCatalog(this, catName); cat.setNativeTerm(dbmd.getCatalogTerm()); logger.debug("Set catalog term to "+cat.getNativeTerm()); children.add(cat); } } // if we tried to get Catalogs, and there were none, then I guess // we should look for Schemas instead (i.e. this database has no // catalogs, and schemas attached directly to the database) if ( children.size() == oldSize ) { rs = dbmd.getSchemas(); while (rs.next()) { children.add(new SQLSchema(this, rs.getString(1),false)); } } } catch (SQLException e) { throw new ArchitectException("database.populate.fail", e); } finally { populated = true; int newSize = children.size(); if (newSize > oldSize) { int[] changedIndices = new int[newSize - oldSize]; for (int i = 0, n = newSize - oldSize; i < n; i++) { changedIndices[i] = oldSize + i; } fireDbChildrenInserted(changedIndices, children.subList(oldSize, newSize)); } try { if ( rs != null ) rs.close(); } catch (SQLException e2) { throw new ArchitectException("database.rs.close.fail", e2); } } }
| 1,109,054
|
void generateDPrimeTable(long maxdist){ //calculating D prime requires the number of each possible 2 marker //haplotype in the dataset dPrimeTable = new PairwiseLinkage[Chromosome.getSize()][Chromosome.getSize()]; int doublehet; long negMaxdist = -1*maxdist; int[][] twoMarkerHaplos = new int[3][3]; totalComps = (Chromosome.getSize()*(Chromosome.getSize()-1))/2; System.out.println(totalComps); compsDone =0; //loop through all marker pairs for (int pos2 = 1; pos2 < dPrimeTable.length; pos2++){ //clear the array for (int pos1 = 0; pos1 < pos2; pos1++){ compsDone++; long sep = Chromosome.getMarker(pos1).getPosition() - Chromosome.getMarker(pos2).getPosition(); if (maxdist > 0){ if ((sep > maxdist || sep < negMaxdist)){ dPrimeTable[pos1][pos2] = null; continue; } } for (int i = 0; i < twoMarkerHaplos.length; i++){ for (int j = 0; j < twoMarkerHaplos[i].length; j++){ twoMarkerHaplos[i][j] = 0; } } doublehet = 0; //get the alleles for the markers int m1a1 = 0; int m1a2 = 0; int m2a1 = 0; int m2a2 = 0; int m1H = 0; int m2H = 0; for (int i = 0; i < chromosomes.size(); i++){ byte a1 = ((Chromosome) chromosomes.elementAt(i)).getGenotype(pos1); byte a2 = ((Chromosome) chromosomes.elementAt(i)).getGenotype(pos2); if (m1a1 > 0){ if (m1a2 == 0 && !(a1 == 5) && !(a1 == 0) && a1 != m1a1) m1a2 = a1; } else if (!(a1 == 5) && !(a1 == 0)) m1a1=a1; if (m2a1 > 0){ if (m2a2 == 0 && !(a2 == 5) && !(a2 == 0) && a2 != m2a1) m2a2 = a2; } else if (!(a2 == 5) && !(a2 == 0)) m2a1=a2; if (a1 == 5) m1H++; if (a2 == 5) m2H++; } //check for non-polymorphic markers if (m1a2==0){ if (m1H==0){ dPrimeTable[pos1][pos2] = null;//new PairwiseLinkage(0,0,0,0,0,nullArray); continue; } else { if (m1a1 == 1){ m1a2=2; } else { m1a2 = 1; } } } if (m2a2==0){ if (m2H==0){ dPrimeTable[pos1][pos2] = null;//new PairwiseLinkage(0,0,0,0,0,nullArray); continue; } else { if (m2a1 == 1){ m2a2=2; } else { m2a2 = 1; } } } int[] marker1num = new int[5]; int[] marker2num = new int[5]; marker1num[0]=0; marker1num[m1a1]=1; marker1num[m1a2]=2; marker2num[0]=0; marker2num[m2a1]=1; marker2num[m2a2]=2; //iterate through all chromosomes in dataset for (int i = 0; i < chromosomes.size(); i++){ //System.out.println(i + " " + pos1 + " " + pos2); //assign alleles for each of a pair of chromosomes at a marker to four variables byte a1 = ((Chromosome) chromosomes.elementAt(i)).getGenotype(pos1); byte a2 = ((Chromosome) chromosomes.elementAt(i)).getGenotype(pos2); byte b1 = ((Chromosome) chromosomes.elementAt(++i)).getGenotype(pos1); byte b2 = ((Chromosome) chromosomes.elementAt(i)).getGenotype(pos2); if (a1 == 0 || a2 == 0 || b1 == 0 || b2 == 0){ //skip missing data } else if ((a1 == 5 && a2 == 5) || (a1 == 5 && !(a2 == b2)) || (a2 == 5 && !(a1 == b1))) doublehet++; //find doublehets and resolved haplotypes else if (a1 == 5){ twoMarkerHaplos[1][marker2num[a2]]++; twoMarkerHaplos[2][marker2num[a2]]++; } else if (a2 == 5){ twoMarkerHaplos[marker1num[a1]][1]++; twoMarkerHaplos[marker1num[a1]][2]++; } else { twoMarkerHaplos[marker1num[a1]][marker2num[a2]]++; twoMarkerHaplos[marker1num[b1]][marker2num[b2]]++; } } //another monomorphic marker check int r1, r2, c1, c2; r1 = twoMarkerHaplos[1][1] + twoMarkerHaplos[1][2]; r2 = twoMarkerHaplos[2][1] + twoMarkerHaplos[2][2]; c1 = twoMarkerHaplos[1][1] + twoMarkerHaplos[2][1]; c2 = twoMarkerHaplos[1][2] + twoMarkerHaplos[2][2]; if ( (r1==0 || r2==0 || c1==0 || c2==0) && doublehet == 0){ dPrimeTable[pos1][pos2] = null;//new PairwiseLinkage(0,0,0,0,0,nullArray); continue; } //compute D Prime for this pair of markers. //return is a tab delimited string of d', lod, r^2, CI(low), CI(high) dPrimeTable[pos1][pos2] = computeDPrime(twoMarkerHaplos[1][1], twoMarkerHaplos[1][2], twoMarkerHaplos[2][1], twoMarkerHaplos[2][2], doublehet, 0.1); this.realCompsDone++; } } }
|
void generateDPrimeTable(long maxdist){ //calculating D prime requires the number of each possible 2 marker //haplotype in the dataset dPrimeTable = new PairwiseLinkage[Chromosome.getSize()][Chromosome.getSize()]; int doublehet; long negMaxdist = -1*maxdist; int[][] twoMarkerHaplos = new int[3][3]; totalComps = (Chromosome.getSize()*(Chromosome.getSize()-1))/2; compsDone =0; //loop through all marker pairs for (int pos2 = 1; pos2 < dPrimeTable.length; pos2++){ //clear the array for (int pos1 = 0; pos1 < pos2; pos1++){ compsDone++; long sep = Chromosome.getMarker(pos1).getPosition() - Chromosome.getMarker(pos2).getPosition(); if (maxdist > 0){ if ((sep > maxdist || sep < negMaxdist)){ dPrimeTable[pos1][pos2] = null; continue; } } for (int i = 0; i < twoMarkerHaplos.length; i++){ for (int j = 0; j < twoMarkerHaplos[i].length; j++){ twoMarkerHaplos[i][j] = 0; } } doublehet = 0; //get the alleles for the markers int m1a1 = 0; int m1a2 = 0; int m2a1 = 0; int m2a2 = 0; int m1H = 0; int m2H = 0; for (int i = 0; i < chromosomes.size(); i++){ byte a1 = ((Chromosome) chromosomes.elementAt(i)).getGenotype(pos1); byte a2 = ((Chromosome) chromosomes.elementAt(i)).getGenotype(pos2); if (m1a1 > 0){ if (m1a2 == 0 && !(a1 == 5) && !(a1 == 0) && a1 != m1a1) m1a2 = a1; } else if (!(a1 == 5) && !(a1 == 0)) m1a1=a1; if (m2a1 > 0){ if (m2a2 == 0 && !(a2 == 5) && !(a2 == 0) && a2 != m2a1) m2a2 = a2; } else if (!(a2 == 5) && !(a2 == 0)) m2a1=a2; if (a1 == 5) m1H++; if (a2 == 5) m2H++; } //check for non-polymorphic markers if (m1a2==0){ if (m1H==0){ dPrimeTable[pos1][pos2] = null;//new PairwiseLinkage(0,0,0,0,0,nullArray); continue; } else { if (m1a1 == 1){ m1a2=2; } else { m1a2 = 1; } } } if (m2a2==0){ if (m2H==0){ dPrimeTable[pos1][pos2] = null;//new PairwiseLinkage(0,0,0,0,0,nullArray); continue; } else { if (m2a1 == 1){ m2a2=2; } else { m2a2 = 1; } } } int[] marker1num = new int[5]; int[] marker2num = new int[5]; marker1num[0]=0; marker1num[m1a1]=1; marker1num[m1a2]=2; marker2num[0]=0; marker2num[m2a1]=1; marker2num[m2a2]=2; //iterate through all chromosomes in dataset for (int i = 0; i < chromosomes.size(); i++){ //System.out.println(i + " " + pos1 + " " + pos2); //assign alleles for each of a pair of chromosomes at a marker to four variables byte a1 = ((Chromosome) chromosomes.elementAt(i)).getGenotype(pos1); byte a2 = ((Chromosome) chromosomes.elementAt(i)).getGenotype(pos2); byte b1 = ((Chromosome) chromosomes.elementAt(++i)).getGenotype(pos1); byte b2 = ((Chromosome) chromosomes.elementAt(i)).getGenotype(pos2); if (a1 == 0 || a2 == 0 || b1 == 0 || b2 == 0){ //skip missing data } else if ((a1 == 5 && a2 == 5) || (a1 == 5 && !(a2 == b2)) || (a2 == 5 && !(a1 == b1))) doublehet++; //find doublehets and resolved haplotypes else if (a1 == 5){ twoMarkerHaplos[1][marker2num[a2]]++; twoMarkerHaplos[2][marker2num[a2]]++; } else if (a2 == 5){ twoMarkerHaplos[marker1num[a1]][1]++; twoMarkerHaplos[marker1num[a1]][2]++; } else { twoMarkerHaplos[marker1num[a1]][marker2num[a2]]++; twoMarkerHaplos[marker1num[b1]][marker2num[b2]]++; } } //another monomorphic marker check int r1, r2, c1, c2; r1 = twoMarkerHaplos[1][1] + twoMarkerHaplos[1][2]; r2 = twoMarkerHaplos[2][1] + twoMarkerHaplos[2][2]; c1 = twoMarkerHaplos[1][1] + twoMarkerHaplos[2][1]; c2 = twoMarkerHaplos[1][2] + twoMarkerHaplos[2][2]; if ( (r1==0 || r2==0 || c1==0 || c2==0) && doublehet == 0){ dPrimeTable[pos1][pos2] = null;//new PairwiseLinkage(0,0,0,0,0,nullArray); continue; } //compute D Prime for this pair of markers. //return is a tab delimited string of d', lod, r^2, CI(low), CI(high) dPrimeTable[pos1][pos2] = computeDPrime(twoMarkerHaplos[1][1], twoMarkerHaplos[1][2], twoMarkerHaplos[2][1], twoMarkerHaplos[2][2], doublehet, 0.1); this.realCompsDone++; } } }
| 1,109,056
|
void generateDPrimeTable(long maxdist){ //calculating D prime requires the number of each possible 2 marker //haplotype in the dataset dPrimeTable = new PairwiseLinkage[Chromosome.getSize()][Chromosome.getSize()]; int doublehet; long negMaxdist = -1*maxdist; int[][] twoMarkerHaplos = new int[3][3]; totalComps = (Chromosome.getSize()*(Chromosome.getSize()-1))/2; System.out.println(totalComps); compsDone =0; //loop through all marker pairs for (int pos2 = 1; pos2 < dPrimeTable.length; pos2++){ //clear the array for (int pos1 = 0; pos1 < pos2; pos1++){ compsDone++; long sep = Chromosome.getMarker(pos1).getPosition() - Chromosome.getMarker(pos2).getPosition(); if (maxdist > 0){ if ((sep > maxdist || sep < negMaxdist)){ dPrimeTable[pos1][pos2] = null; continue; } } for (int i = 0; i < twoMarkerHaplos.length; i++){ for (int j = 0; j < twoMarkerHaplos[i].length; j++){ twoMarkerHaplos[i][j] = 0; } } doublehet = 0; //get the alleles for the markers int m1a1 = 0; int m1a2 = 0; int m2a1 = 0; int m2a2 = 0; int m1H = 0; int m2H = 0; for (int i = 0; i < chromosomes.size(); i++){ byte a1 = ((Chromosome) chromosomes.elementAt(i)).getGenotype(pos1); byte a2 = ((Chromosome) chromosomes.elementAt(i)).getGenotype(pos2); if (m1a1 > 0){ if (m1a2 == 0 && !(a1 == 5) && !(a1 == 0) && a1 != m1a1) m1a2 = a1; } else if (!(a1 == 5) && !(a1 == 0)) m1a1=a1; if (m2a1 > 0){ if (m2a2 == 0 && !(a2 == 5) && !(a2 == 0) && a2 != m2a1) m2a2 = a2; } else if (!(a2 == 5) && !(a2 == 0)) m2a1=a2; if (a1 == 5) m1H++; if (a2 == 5) m2H++; } //check for non-polymorphic markers if (m1a2==0){ if (m1H==0){ dPrimeTable[pos1][pos2] = null;//new PairwiseLinkage(0,0,0,0,0,nullArray); continue; } else { if (m1a1 == 1){ m1a2=2; } else { m1a2 = 1; } } } if (m2a2==0){ if (m2H==0){ dPrimeTable[pos1][pos2] = null;//new PairwiseLinkage(0,0,0,0,0,nullArray); continue; } else { if (m2a1 == 1){ m2a2=2; } else { m2a2 = 1; } } } int[] marker1num = new int[5]; int[] marker2num = new int[5]; marker1num[0]=0; marker1num[m1a1]=1; marker1num[m1a2]=2; marker2num[0]=0; marker2num[m2a1]=1; marker2num[m2a2]=2; //iterate through all chromosomes in dataset for (int i = 0; i < chromosomes.size(); i++){ //System.out.println(i + " " + pos1 + " " + pos2); //assign alleles for each of a pair of chromosomes at a marker to four variables byte a1 = ((Chromosome) chromosomes.elementAt(i)).getGenotype(pos1); byte a2 = ((Chromosome) chromosomes.elementAt(i)).getGenotype(pos2); byte b1 = ((Chromosome) chromosomes.elementAt(++i)).getGenotype(pos1); byte b2 = ((Chromosome) chromosomes.elementAt(i)).getGenotype(pos2); if (a1 == 0 || a2 == 0 || b1 == 0 || b2 == 0){ //skip missing data } else if ((a1 == 5 && a2 == 5) || (a1 == 5 && !(a2 == b2)) || (a2 == 5 && !(a1 == b1))) doublehet++; //find doublehets and resolved haplotypes else if (a1 == 5){ twoMarkerHaplos[1][marker2num[a2]]++; twoMarkerHaplos[2][marker2num[a2]]++; } else if (a2 == 5){ twoMarkerHaplos[marker1num[a1]][1]++; twoMarkerHaplos[marker1num[a1]][2]++; } else { twoMarkerHaplos[marker1num[a1]][marker2num[a2]]++; twoMarkerHaplos[marker1num[b1]][marker2num[b2]]++; } } //another monomorphic marker check int r1, r2, c1, c2; r1 = twoMarkerHaplos[1][1] + twoMarkerHaplos[1][2]; r2 = twoMarkerHaplos[2][1] + twoMarkerHaplos[2][2]; c1 = twoMarkerHaplos[1][1] + twoMarkerHaplos[2][1]; c2 = twoMarkerHaplos[1][2] + twoMarkerHaplos[2][2]; if ( (r1==0 || r2==0 || c1==0 || c2==0) && doublehet == 0){ dPrimeTable[pos1][pos2] = null;//new PairwiseLinkage(0,0,0,0,0,nullArray); continue; } //compute D Prime for this pair of markers. //return is a tab delimited string of d', lod, r^2, CI(low), CI(high) dPrimeTable[pos1][pos2] = computeDPrime(twoMarkerHaplos[1][1], twoMarkerHaplos[1][2], twoMarkerHaplos[2][1], twoMarkerHaplos[2][2], doublehet, 0.1); this.realCompsDone++; } } }
|
void generateDPrimeTable(long maxdist){ //calculating D prime requires the number of each possible 2 marker //haplotype in the dataset dPrimeTable = new PairwiseLinkage[Chromosome.getSize()][Chromosome.getSize()]; int doublehet; long negMaxdist = -1*maxdist; int[][] twoMarkerHaplos = new int[3][3]; totalComps = (Chromosome.getSize()*(Chromosome.getSize()-1))/2; System.out.println(totalComps); compsDone =0; //loop through all marker pairs for (int pos2 = 1; pos2 < dPrimeTable.length; pos2++){ //clear the array for (int pos1 = 0; pos1 < pos2; pos1++){ compsDone++; long sep = Chromosome.getMarker(pos1).getPosition() - Chromosome.getMarker(pos2).getPosition(); if (maxdist > 0){ if ((sep > maxdist || sep < negMaxdist)){ dPrimeTable[pos1][pos2] = new PairwiseLinkage(1,0,0,0,0,new double[0]); continue; } } for (int i = 0; i < twoMarkerHaplos.length; i++){ for (int j = 0; j < twoMarkerHaplos[i].length; j++){ twoMarkerHaplos[i][j] = 0; } } doublehet = 0; //get the alleles for the markers int m1a1 = 0; int m1a2 = 0; int m2a1 = 0; int m2a2 = 0; int m1H = 0; int m2H = 0; for (int i = 0; i < chromosomes.size(); i++){ byte a1 = ((Chromosome) chromosomes.elementAt(i)).getGenotype(pos1); byte a2 = ((Chromosome) chromosomes.elementAt(i)).getGenotype(pos2); if (m1a1 > 0){ if (m1a2 == 0 && !(a1 == 5) && !(a1 == 0) && a1 != m1a1) m1a2 = a1; } else if (!(a1 == 5) && !(a1 == 0)) m1a1=a1; if (m2a1 > 0){ if (m2a2 == 0 && !(a2 == 5) && !(a2 == 0) && a2 != m2a1) m2a2 = a2; } else if (!(a2 == 5) && !(a2 == 0)) m2a1=a2; if (a1 == 5) m1H++; if (a2 == 5) m2H++; } //check for non-polymorphic markers if (m1a2==0){ if (m1H==0){ dPrimeTable[pos1][pos2] = new PairwiseLinkage(1,0,0,0,0,new double[0]);//new PairwiseLinkage(0,0,0,0,0,nullArray); continue; } else { if (m1a1 == 1){ m1a2=2; } else { m1a2 = 1; } } } if (m2a2==0){ if (m2H==0){ dPrimeTable[pos1][pos2] = new PairwiseLinkage(1,0,0,0,0,new double[0]);//new PairwiseLinkage(0,0,0,0,0,nullArray); continue; } else { if (m2a1 == 1){ m2a2=2; } else { m2a2 = 1; } } } int[] marker1num = new int[5]; int[] marker2num = new int[5]; marker1num[0]=0; marker1num[m1a1]=1; marker1num[m1a2]=2; marker2num[0]=0; marker2num[m2a1]=1; marker2num[m2a2]=2; //iterate through all chromosomes in dataset for (int i = 0; i < chromosomes.size(); i++){ //System.out.println(i + " " + pos1 + " " + pos2); //assign alleles for each of a pair of chromosomes at a marker to four variables byte a1 = ((Chromosome) chromosomes.elementAt(i)).getGenotype(pos1); byte a2 = ((Chromosome) chromosomes.elementAt(i)).getGenotype(pos2); byte b1 = ((Chromosome) chromosomes.elementAt(++i)).getGenotype(pos1); byte b2 = ((Chromosome) chromosomes.elementAt(i)).getGenotype(pos2); if (a1 == 0 || a2 == 0 || b1 == 0 || b2 == 0){ //skip missing data } else if ((a1 == 5 && a2 == 5) || (a1 == 5 && !(a2 == b2)) || (a2 == 5 && !(a1 == b1))) doublehet++; //find doublehets and resolved haplotypes else if (a1 == 5){ twoMarkerHaplos[1][marker2num[a2]]++; twoMarkerHaplos[2][marker2num[a2]]++; } else if (a2 == 5){ twoMarkerHaplos[marker1num[a1]][1]++; twoMarkerHaplos[marker1num[a1]][2]++; } else { twoMarkerHaplos[marker1num[a1]][marker2num[a2]]++; twoMarkerHaplos[marker1num[b1]][marker2num[b2]]++; } } //another monomorphic marker check int r1, r2, c1, c2; r1 = twoMarkerHaplos[1][1] + twoMarkerHaplos[1][2]; r2 = twoMarkerHaplos[2][1] + twoMarkerHaplos[2][2]; c1 = twoMarkerHaplos[1][1] + twoMarkerHaplos[2][1]; c2 = twoMarkerHaplos[1][2] + twoMarkerHaplos[2][2]; if ( (r1==0 || r2==0 || c1==0 || c2==0) && doublehet == 0){ dPrimeTable[pos1][pos2] = new PairwiseLinkage(1,0,0,0,0,new double[0]);//new PairwiseLinkage(0,0,0,0,0,nullArray); continue; } //compute D Prime for this pair of markers. //return is a tab delimited string of d', lod, r^2, CI(low), CI(high) dPrimeTable[pos1][pos2] = computeDPrime(twoMarkerHaplos[1][1], twoMarkerHaplos[1][2], twoMarkerHaplos[2][1], twoMarkerHaplos[2][2], doublehet, 0.1); this.realCompsDone++; } } }
| 1,109,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; System.out.println("well, i made it this far"); for (int k = 0; k < blocks.size(); k++){ this.blocksDone++; int[] theBlock = (int[])blocks.elementAt(k); int[] hetcount = new int[theBlock.length]; int[][] loc = new int[theBlock.length][5]; int[][] convert = new int[theBlock.length][5]; int[][] unconvert = new int[theBlock.length][5]; //int totalHaps = 0; //parse genotypes for unresolved heterozygotes for (int i = 0; i < chromosomes.size(); i++){ Chromosome thisChrom = (Chromosome)chromosomes.elementAt(i); for (int j = 0; j < theBlock.length; j++){ byte theGeno = thisChrom.getFilteredGenotype(theBlock[j]); if (theGeno == 5){ hetcount[j]++; } else { loc[j][theGeno]++; } } //totalHaps ++; } for (int j = 0; j < theBlock.length; j++){ int a = 1; for (int m = 1; m <= 4; m++){ if (loc[j][m] > 0){ convert[j][m]=a; unconvert[j][a]=m; loc[j][m]+=(hetcount[j]/2); a++; } else { convert[j][m] = 0; unconvert[j][a] = 8; } } if (unconvert[j][2] == 0) unconvert[j][2] = 8; } String hapstr = ""; Vector inputHaploVector = new Vector(); for (int i = 0; i < chromosomes.size(); i++){ 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 theGeno = thisChrom.getFilteredGenotype(theBlock[j]); if (theGeno == 5){ hapstr = hapstr + "h"; } else { hapstr = hapstr + convert[j][theGeno]; } } inputHaploVector.add(hapstr); hapstr = ""; for (int j = 0; j < theBlock.length; j++){ byte nextGeno = nextChrom.getFilteredGenotype(theBlock[j]); if (nextGeno == 5){ hapstr = hapstr + "h"; }else{ hapstr = hapstr + convert[j][nextGeno]; } } inputHaploVector.add(hapstr); hapstr = ""; } } String[] input_haplos = (String[])inputHaploVector.toArray(new String[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(); char[][] input_haplos2 = new char[input_haplos.length][]; for (int j = 0; j < input_haplos.length; j++){ input_haplos2[j] = input_haplos[j].toCharArray(); } //kirby patch EM theEM = new EM(); theEM.full_em_breakup(input_haplos2, 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++){ //System.out.println(j + " " + aString.length() + " " + k); genos[j] = unconvert[j][Integer.parseInt(aString.substring(j, j+1))]; } double tempPerc = Double.parseDouble(st.nextToken()); if (tempPerc*100 > hapthresh){ tempArray[p] = new Haplotype(genos, tempPerc, theBlock); 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[] theBlock = (int[])blocks.elementAt(k); int[] hetcount = new int[theBlock.length]; int[][] loc = new int[theBlock.length][5]; int[][] convert = new int[theBlock.length][5]; int[][] unconvert = new int[theBlock.length][5]; //int totalHaps = 0; //parse genotypes for unresolved heterozygotes for (int i = 0; i < chromosomes.size(); i++){ Chromosome thisChrom = (Chromosome)chromosomes.elementAt(i); for (int j = 0; j < theBlock.length; j++){ byte theGeno = thisChrom.getFilteredGenotype(theBlock[j]); if (theGeno == 5){ hetcount[j]++; } else { loc[j][theGeno]++; } } //totalHaps ++; } for (int j = 0; j < theBlock.length; j++){ int a = 1; for (int m = 1; m <= 4; m++){ if (loc[j][m] > 0){ convert[j][m]=a; unconvert[j][a]=m; loc[j][m]+=(hetcount[j]/2); a++; } else { convert[j][m] = 0; unconvert[j][a] = 8; } } if (unconvert[j][2] == 0) unconvert[j][2] = 8; } String hapstr = ""; Vector inputHaploVector = new Vector(); for (int i = 0; i < chromosomes.size(); i++){ 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 theGeno = thisChrom.getFilteredGenotype(theBlock[j]); if (theGeno == 5){ hapstr = hapstr + "h"; } else { hapstr = hapstr + convert[j][theGeno]; } } inputHaploVector.add(hapstr); hapstr = ""; for (int j = 0; j < theBlock.length; j++){ byte nextGeno = nextChrom.getFilteredGenotype(theBlock[j]); if (nextGeno == 5){ hapstr = hapstr + "h"; }else{ hapstr = hapstr + convert[j][nextGeno]; } } inputHaploVector.add(hapstr); hapstr = ""; } } String[] input_haplos = (String[])inputHaploVector.toArray(new String[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(); char[][] input_haplos2 = new char[input_haplos.length][]; for (int j = 0; j < input_haplos.length; j++){ input_haplos2[j] = input_haplos[j].toCharArray(); } //kirby patch EM theEM = new EM(); theEM.full_em_breakup(input_haplos2, 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++){ //System.out.println(j + " " + aString.length() + " " + k); genos[j] = unconvert[j][Integer.parseInt(aString.substring(j, j+1))]; } double tempPerc = Double.parseDouble(st.nextToken()); if (tempPerc*100 > hapthresh){ tempArray[p] = new Haplotype(genos, tempPerc, theBlock); 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,109,058
|
public ObjectName getObjectName() { try { final String objectNameString = request.getParameter(RequestParams.OBJECT_NAME); return new ObjectName(objectNameString); } catch (MalformedObjectNameException e) { throw new RuntimeException(e); } }
|
public ObjectName getObjectName() { try { final String objectNameString = request.getParameter(RequestParams.OBJECT_NAME); if(objectNameString != null){ return new ObjectName(objectNameString); }else{ return null; } } catch (MalformedObjectNameException e) { throw new RuntimeException(e); } }
| 1,109,060
|
public Config(List<ApplicationConfig> applications, List<DashboardConfig> dashboards){ this.applications = applications; this.dashboards = dashboards; }
|
public Config(List<ApplicationConfig> applications){ this.applications = applications; this.dashboards = dashboards; }
| 1,109,061
|
public Config(List<ApplicationConfig> applications, List<DashboardConfig> dashboards){ this.applications = applications; this.dashboards = dashboards; }
|
public Config(List<ApplicationConfig> applications, List<DashboardConfig> dashboards){ this.applications = applications; }
| 1,109,062
|
public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { ApplicationClusterForm clusterForm = (ApplicationClusterForm)actionForm; String[] childAppIds = Utils.csvToStringArray(clusterForm.getSelectedChildApplications()); /* build list of new child applications */ List newChildApplications = getNewChildApplications(childAppIds); String applicationId = clusterForm.getApplicationId(); if(applicationId != null){ /* update existing application */ ApplicationClusterConfig clusterConfig = (ApplicationClusterConfig) ApplicationConfigManager.getApplicationConfig(applicationId); assert clusterConfig != null; clusterConfig.setName(clusterForm.getName()); final List oldChildApplications = clusterConfig.getApplications(); /* add applications outside the cluster (applications that are no longer in the cluster) */ for(Iterator it=oldChildApplications.iterator();it.hasNext();){ ApplicationConfig appConfig = (ApplicationConfig)it.next(); if(!newChildApplications.contains(appConfig)){ ApplicationConfigManager.addApplication(appConfig); appConfig.setClusterConfig(null); } } /* remove applications outside the cluster (applications that are now part of cluster) */ for(Iterator it=newChildApplications.iterator();it.hasNext();){ ApplicationConfig appConfig = (ApplicationConfig)it.next(); if(!oldChildApplications.contains(appConfig)){ ApplicationConfigManager.deleteApplication(appConfig); appConfig.setClusterConfig(clusterConfig); } } clusterConfig.setApplications(newChildApplications); ApplicationConfigManager.updateApplication(clusterConfig); UserActivityLogger.getInstance().logActivity( context.getUser().getUsername(), "Updated application cluster "+ "\""+clusterConfig.getName()+"\""); }else{ /* add new application cluster */ ApplicationClusterConfig clusterConfig = new ApplicationClusterConfig( ApplicationConfig.getNextApplicationId(), clusterForm.getName()); for(Iterator it=newChildApplications.iterator();it.hasNext();){ ApplicationConfig appConfig = (ApplicationConfig)it.next(); appConfig.setClusterConfig(clusterConfig); ApplicationConfigManager.deleteApplication(appConfig); } clusterConfig.setApplications(newChildApplications); /* remove from stand-alone list */ ApplicationConfigManager.addApplication(clusterConfig); UserActivityLogger.getInstance().logActivity( context.getUser().getUsername(), "Added application cluster "+ "\""+clusterConfig.getName()+"\""); } return mapping.findForward(Forwards.SUCCESS); }
|
public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { ApplicationClusterForm clusterForm = (ApplicationClusterForm)actionForm; String[] childAppIds = StringUtils.csvToStringArray(clusterForm.getSelectedChildApplications()); /* build list of new child applications */ List newChildApplications = getNewChildApplications(childAppIds); String applicationId = clusterForm.getApplicationId(); if(applicationId != null){ /* update existing application */ ApplicationClusterConfig clusterConfig = (ApplicationClusterConfig) ApplicationConfigManager.getApplicationConfig(applicationId); assert clusterConfig != null; clusterConfig.setName(clusterForm.getName()); final List oldChildApplications = clusterConfig.getApplications(); /* add applications outside the cluster (applications that are no longer in the cluster) */ for(Iterator it=oldChildApplications.iterator();it.hasNext();){ ApplicationConfig appConfig = (ApplicationConfig)it.next(); if(!newChildApplications.contains(appConfig)){ ApplicationConfigManager.addApplication(appConfig); appConfig.setClusterConfig(null); } } /* remove applications outside the cluster (applications that are now part of cluster) */ for(Iterator it=newChildApplications.iterator();it.hasNext();){ ApplicationConfig appConfig = (ApplicationConfig)it.next(); if(!oldChildApplications.contains(appConfig)){ ApplicationConfigManager.deleteApplication(appConfig); appConfig.setClusterConfig(clusterConfig); } } clusterConfig.setApplications(newChildApplications); ApplicationConfigManager.updateApplication(clusterConfig); UserActivityLogger.getInstance().logActivity( context.getUser().getUsername(), "Updated application cluster "+ "\""+clusterConfig.getName()+"\""); }else{ /* add new application cluster */ ApplicationClusterConfig clusterConfig = new ApplicationClusterConfig( ApplicationConfig.getNextApplicationId(), clusterForm.getName()); for(Iterator it=newChildApplications.iterator();it.hasNext();){ ApplicationConfig appConfig = (ApplicationConfig)it.next(); appConfig.setClusterConfig(clusterConfig); ApplicationConfigManager.deleteApplication(appConfig); } clusterConfig.setApplications(newChildApplications); /* remove from stand-alone list */ ApplicationConfigManager.addApplication(clusterConfig); UserActivityLogger.getInstance().logActivity( context.getUser().getUsername(), "Added application cluster "+ "\""+clusterConfig.getName()+"\""); } return mapping.findForward(Forwards.SUCCESS); }
| 1,109,063
|
public DBListClass(PropertyMetaClass wclass) { super("dblist", "DB List", wclass); }
|
public DBListClass(PropertyMetaClass wclass) { super("dblist", "DB List", wclass); }
| 1,109,065
|
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command == READ_GENOTYPES){ ReadDataDialog readDialog = new ReadDataDialog("Open new data", this); readDialog.pack(); readDialog.setVisible(true); } else if (command == READ_MARKERS){ JFileChooser fc = new JFileChooser(System.getProperty("user.dir")); fc.setSelectedFile(null); int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { readMarkers(fc.getSelectedFile()); } }else if (command == CUST_BLOCKS){ TweakBlockDefsDialog tweakDialog = new TweakBlockDefsDialog("Customize Blocks", this); tweakDialog.pack(); tweakDialog.setVisible(true); }else if (command == CLEAR_BLOCKS){ colorMenuItems[0].setSelected(true); for (int i = 1; i< colorMenuItems.length; i++){ colorMenuItems[i].setEnabled(false); } changeBlocks(3,1); //blockdef clauses }else if (command.startsWith("block")){ int method = Integer.valueOf(command.substring(5)).intValue(); changeBlocks(method,1); for (int i = 1; i < colorMenuItems.length; i++){ if (method+1 == i){ colorMenuItems[i].setEnabled(true); }else{ colorMenuItems[i].setEnabled(false); } } colorMenuItems[0].setSelected(true); //zooming clauses }else if (command.startsWith("zoom")){ dPrimeDisplay.zoom(Integer.valueOf(command.substring(4)).intValue()); //coloring clauses }else if (command.startsWith("color")){ dPrimeDisplay.refresh(Integer.valueOf(command.substring(5)).intValue()+1); changeKey(Integer.valueOf(command.substring(5)).intValue()+1); //exporting clauses }else if (command == EXPORT_PNG){ JFileChooser fc = new JFileChooser(System.getProperty("user.dir")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ export(tabs.getSelectedIndex(), PNG_MODE, fc.getSelectedFile()); } }else if (command == EXPORT_TEXT){ JFileChooser fc = new JFileChooser(System.getProperty("user.dir")); if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ export(tabs.getSelectedIndex(), TXT_MODE, fc.getSelectedFile()); } }else if (command == "Select All"){ checkPanel.selectAll(); }else if (command == "Rescore Markers"){ String cut = hwcut.getText(); if (cut.equals("")){ cut = "0"; } CheckData.hwCut = Double.parseDouble(cut); cut = genocut.getText(); if (cut.equals("")){ cut="0"; } CheckData.failedGenoCut = Integer.parseInt(cut); cut = mendcut.getText(); if (cut.equals("")){ cut="0"; } CheckData.numMendErrCut = Integer.parseInt(cut); checkPanel.redoRatings(); }else if (command == "Tutorial"){ showHelp(); } else if (command == QUIT){ quit(); } else { for (int i = 0; i < viewItems.length; i++) { if (command == viewItems[i]) tabs.setSelectedIndex(i); } } }
|
public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command == READ_GENOTYPES){ ReadDataDialog readDialog = new ReadDataDialog("Open new data", this); readDialog.pack(); readDialog.setVisible(true); } else if (command == READ_MARKERS){ fc.setSelectedFile(null); int returnVal = fc.showOpenDialog(this); if (returnVal == JFileChooser.APPROVE_OPTION) { readMarkers(fc.getSelectedFile()); } }else if (command == CUST_BLOCKS){ TweakBlockDefsDialog tweakDialog = new TweakBlockDefsDialog("Customize Blocks", this); tweakDialog.pack(); tweakDialog.setVisible(true); }else if (command == CLEAR_BLOCKS){ colorMenuItems[0].setSelected(true); for (int i = 1; i< colorMenuItems.length; i++){ colorMenuItems[i].setEnabled(false); } changeBlocks(3,1); //blockdef clauses }else if (command.startsWith("block")){ int method = Integer.valueOf(command.substring(5)).intValue(); changeBlocks(method,1); for (int i = 1; i < colorMenuItems.length; i++){ if (method+1 == i){ colorMenuItems[i].setEnabled(true); }else{ colorMenuItems[i].setEnabled(false); } } colorMenuItems[0].setSelected(true); //zooming clauses }else if (command.startsWith("zoom")){ dPrimeDisplay.zoom(Integer.valueOf(command.substring(4)).intValue()); //coloring clauses }else if (command.startsWith("color")){ dPrimeDisplay.refresh(Integer.valueOf(command.substring(5)).intValue()+1); changeKey(Integer.valueOf(command.substring(5)).intValue()+1); //exporting clauses }else if (command == EXPORT_PNG){ if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ export(tabs.getSelectedIndex(), PNG_MODE, fc.getSelectedFile()); } }else if (command == EXPORT_TEXT){ if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION){ export(tabs.getSelectedIndex(), TXT_MODE, fc.getSelectedFile()); } }else if (command == "Select All"){ checkPanel.selectAll(); }else if (command == "Rescore Markers"){ String cut = hwcut.getText(); if (cut.equals("")){ cut = "0"; } CheckData.hwCut = Double.parseDouble(cut); cut = genocut.getText(); if (cut.equals("")){ cut="0"; } CheckData.failedGenoCut = Integer.parseInt(cut); cut = mendcut.getText(); if (cut.equals("")){ cut="0"; } CheckData.numMendErrCut = Integer.parseInt(cut); checkPanel.redoRatings(); }else if (command == "Tutorial"){ showHelp(); } else if (command == QUIT){ quit(); } else { for (int i = 0; i < viewItems.length; i++) { if (command == viewItems[i]) tabs.setSelectedIndex(i); } } }
| 1,109,067
|
public Object evaluate(Context context) { try { interpreter.setContext(context); if ( log.isDebugEnabled() ) { log.debug( "Evaluating EL: " + text ); } return interpreter.eval( text ); } catch (Exception e) { log.warn( "Caught exception evaluating: " + text + ". Reason: " + e, e ); return null; } }
|
public Object evaluate(JellyContext context) { try { interpreter.setContext(context); if ( log.isDebugEnabled() ) { log.debug( "Evaluating EL: " + text ); } return interpreter.eval( text ); } catch (Exception e) { log.warn( "Caught exception evaluating: " + text + ". Reason: " + e, e ); return null; } }
| 1,109,068
|
public Object evaluate(Context context) { try { interpreter.setContext(context); if ( log.isDebugEnabled() ) { log.debug( "Evaluating EL: " + text ); } return interpreter.eval( text ); } catch (Exception e) { log.warn( "Caught exception evaluating: " + text + ". Reason: " + e, e ); return null; } }
|
public Object evaluate(Context context) { try { interpreter.setJellyContext(context); if ( log.isDebugEnabled() ) { log.debug( "Evaluating EL: " + text ); } return interpreter.eval( text ); } catch (Exception e) { log.warn( "Caught exception evaluating: " + text + ". Reason: " + e, e ); return null; } }
| 1,109,069
|
public void dragGestureRecognized(DragGestureEvent dge) { logger.info("Drag gesture event: "+dge); // we only start drags on left-click drags InputEvent ie = dge.getTriggerEvent(); if ( (ie.getModifiers() & InputEvent.BUTTON1_MASK) == 0) { return; } DBTree t = (DBTree) dge.getComponent(); TreePath[] p = t.getSelectionPaths(); if (p == null || p.length == 0) { // nothing to export return; } else if (p.length == 1) { // export single node logger.info("DBTree: exporting single node"); SQLObject data = (SQLObject) p[0].getLastPathComponent(); dge.getDragSource().startDrag (dge, DragSource.DefaultCopyNoDrop, new SQLObjectTransferable(data), t); } else { // export list of nodes logger.info("DBTree: exporting list of nodes"); SQLObject[] nodes = new SQLObject[p.length]; for (int i = 0; i < p.length; i++) { nodes[i] = (SQLObject) p[i].getLastPathComponent(); } dge.getDragSource().startDrag (dge, DragSource.DefaultCopyNoDrop, new SQLObjectListTransferable(nodes), t); } }
|
public void dragGestureRecognized(DragGestureEvent dge) { logger.info("Drag gesture event: "+dge); // we only start drags on left-click drags InputEvent ie = dge.getTriggerEvent(); if ( (ie.getModifiers() & InputEvent.BUTTON1_MASK) == 0) { return; } DBTree t = (DBTree) dge.getComponent(); TreePath[] p = t.getSelectionPaths(); if (p == null || p.length == 0) { // nothing to export return; } else if (p.length == 1) { // export single node SQLObject data = (SQLObject) p[0].getLastPathComponent(); dge.getDragSource().startDrag (dge, DragSource.DefaultCopyNoDrop, new SQLObjectTransferable(data), t); } else { // export list of nodes logger.info("DBTree: exporting list of nodes"); SQLObject[] nodes = new SQLObject[p.length]; for (int i = 0; i < p.length; i++) { nodes[i] = (SQLObject) p[i].getLastPathComponent(); } dge.getDragSource().startDrag (dge, DragSource.DefaultCopyNoDrop, new SQLObjectListTransferable(nodes), t); } }
| 1,109,070
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.