rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
getBody().run(context, output); | invokeBody(output); | public void doTag(XMLOutput output) throws Exception { tagLibrary = new DynamicTagLibrary( getUri() ); context.registerTagLibrary( getUri(), tagLibrary ); getBody().run(context, output); tagLibrary = null; } |
public void run(Context context, XMLOutput output) throws Exception { if ( log.isDebugEnabled() ) { log.debug( "running with items: " + items ); } if ( items != null ) { Iterator iter = items.evaluateAsIterator( context ); if ( log.isDebugEnabled() ) { log.debug( "Iterating through: " + iter ); } for ( index = begin; iter.hasNext() && index < end; index += step ) { Object value = iter.next(); if (var != null) { context.setVariable( var, value ); } if ( indexVar != null ) { context.setVariable( indexVar, new Integer(index) ); } getBody().run( context, output ); } } } | public void run(JellyContext context, XMLOutput output) throws Exception { if (log.isDebugEnabled()) { log.debug("running with items: " + items); } if (items != null) { Iterator iter = items.evaluateAsIterator(context); if (log.isDebugEnabled()) { log.debug("Iterating through: " + iter); } for (index = begin; iter.hasNext() && index < end; index += step) { Object value = iter.next(); if (var != null) { context.setVariable(var, value); } if (indexVar != null) { context.setVariable(indexVar, new Integer(index)); } getBody().run(context, output); } } } | public void run(Context context, XMLOutput output) throws Exception { if ( log.isDebugEnabled() ) { log.debug( "running with items: " + items ); } if ( items != null ) { Iterator iter = items.evaluateAsIterator( context ); if ( log.isDebugEnabled() ) { log.debug( "Iterating through: " + iter ); } for ( index = begin; iter.hasNext() && index < end; index += step ) { Object value = iter.next(); if (var != null) { context.setVariable( var, value ); } if ( indexVar != null ) { context.setVariable( indexVar, new Integer(index) ); } getBody().run( context, output ); } } } |
expression += tokenizer.nextToken(); | expression += "," + tokenizer.nextToken(); | private List parse(String attributes){ List exprList = new LinkedList(); StringTokenizer tokenizer = new StringTokenizer(attributes, ","); while(tokenizer.hasMoreTokens()){ String expression = tokenizer.nextToken(); assert expression.startsWith("["); while(!expression.endsWith("]")){ assert tokenizer.hasMoreTokens(); expression += tokenizer.nextToken(); } expression = expression.substring(1, expression.length()-1); exprList.add(new Expression(expression)); } return exprList; } |
_httpClient = new HttpClient(); | public void doTag(XMLOutput xmlOutput) throws JellyTagException { if (isProxyAvailable()) { _httpClient = new HttpClient(); _httpClient.getHostConfiguration().setProxy(getProxyHost(), getProxyPort()); } else { _httpClient = new HttpClient(); } invokeBody(xmlOutput); } |
|
} else { _httpClient = new HttpClient(); | public void doTag(XMLOutput xmlOutput) throws JellyTagException { if (isProxyAvailable()) { _httpClient = new HttpClient(); _httpClient.getHostConfiguration().setProxy(getProxyHost(), getProxyPort()); } else { _httpClient = new HttpClient(); } invokeBody(xmlOutput); } |
|
out.println("-- Would Create Database "+db.getName()+" here. --"); | println("-- Would Create Database "+db.getName()+" here. --"); | public void writeCreateDB(SQLDatabase db) { out.println("-- Would Create Database "+db.getName()+" here. --"); } |
out.println(""); out.println("ALTER TABLE "+rel.getFkTable().getName() | println(""); println("ALTER TABLE "+rel.getFkTable().getName() | protected void writeExportedRelationships(SQLTable t) throws ArchitectException { Iterator it = t.getExportedKeys().iterator(); while (it.hasNext()) { SQLRelationship rel = (SQLRelationship) it.next(); out.println(""); out.println("ALTER TABLE "+rel.getFkTable().getName() +" ADD CONSTRAINT "+rel.getName()); out.print("FOREIGN KEY ("); StringBuffer pkCols = new StringBuffer(); StringBuffer fkCols = new StringBuffer(); boolean firstCol = true; Iterator mappings = rel.getChildren().iterator(); while (mappings.hasNext()) { SQLRelationship.ColumnMapping cmap = (SQLRelationship.ColumnMapping) mappings.next(); if (!firstCol) { pkCols.append(", "); fkCols.append(", "); } pkCols.append(cmap.getPkColumn().getName()); fkCols.append(cmap.getFkColumn().getName()); firstCol = false; } out.print(fkCols.toString()); out.println(")"); out.print("REFERENCES "+rel.getPkTable().getName()+" ("); out.print(pkCols.toString()); out.print(")"); writeStatementTerminator(); out.println(""); } } |
out.print("FOREIGN KEY ("); | print("FOREIGN KEY ("); | protected void writeExportedRelationships(SQLTable t) throws ArchitectException { Iterator it = t.getExportedKeys().iterator(); while (it.hasNext()) { SQLRelationship rel = (SQLRelationship) it.next(); out.println(""); out.println("ALTER TABLE "+rel.getFkTable().getName() +" ADD CONSTRAINT "+rel.getName()); out.print("FOREIGN KEY ("); StringBuffer pkCols = new StringBuffer(); StringBuffer fkCols = new StringBuffer(); boolean firstCol = true; Iterator mappings = rel.getChildren().iterator(); while (mappings.hasNext()) { SQLRelationship.ColumnMapping cmap = (SQLRelationship.ColumnMapping) mappings.next(); if (!firstCol) { pkCols.append(", "); fkCols.append(", "); } pkCols.append(cmap.getPkColumn().getName()); fkCols.append(cmap.getFkColumn().getName()); firstCol = false; } out.print(fkCols.toString()); out.println(")"); out.print("REFERENCES "+rel.getPkTable().getName()+" ("); out.print(pkCols.toString()); out.print(")"); writeStatementTerminator(); out.println(""); } } |
out.print(fkCols.toString()); out.println(")"); out.print("REFERENCES "+rel.getPkTable().getName()+" ("); out.print(pkCols.toString()); out.print(")"); | print(fkCols.toString()); println(")"); print("REFERENCES "+rel.getPkTable().getName()+" ("); print(pkCols.toString()); print(")"); | protected void writeExportedRelationships(SQLTable t) throws ArchitectException { Iterator it = t.getExportedKeys().iterator(); while (it.hasNext()) { SQLRelationship rel = (SQLRelationship) it.next(); out.println(""); out.println("ALTER TABLE "+rel.getFkTable().getName() +" ADD CONSTRAINT "+rel.getName()); out.print("FOREIGN KEY ("); StringBuffer pkCols = new StringBuffer(); StringBuffer fkCols = new StringBuffer(); boolean firstCol = true; Iterator mappings = rel.getChildren().iterator(); while (mappings.hasNext()) { SQLRelationship.ColumnMapping cmap = (SQLRelationship.ColumnMapping) mappings.next(); if (!firstCol) { pkCols.append(", "); fkCols.append(", "); } pkCols.append(cmap.getPkColumn().getName()); fkCols.append(cmap.getFkColumn().getName()); firstCol = false; } out.print(fkCols.toString()); out.println(")"); out.print("REFERENCES "+rel.getPkTable().getName()+" ("); out.print(pkCols.toString()); out.print(")"); writeStatementTerminator(); out.println(""); } } |
out.println(""); | println(""); | protected void writeExportedRelationships(SQLTable t) throws ArchitectException { Iterator it = t.getExportedKeys().iterator(); while (it.hasNext()) { SQLRelationship rel = (SQLRelationship) it.next(); out.println(""); out.println("ALTER TABLE "+rel.getFkTable().getName() +" ADD CONSTRAINT "+rel.getName()); out.print("FOREIGN KEY ("); StringBuffer pkCols = new StringBuffer(); StringBuffer fkCols = new StringBuffer(); boolean firstCol = true; Iterator mappings = rel.getChildren().iterator(); while (mappings.hasNext()) { SQLRelationship.ColumnMapping cmap = (SQLRelationship.ColumnMapping) mappings.next(); if (!firstCol) { pkCols.append(", "); fkCols.append(", "); } pkCols.append(cmap.getPkColumn().getName()); fkCols.append(cmap.getFkColumn().getName()); firstCol = false; } out.print(fkCols.toString()); out.println(")"); out.print("REFERENCES "+rel.getPkTable().getName()+" ("); out.print(pkCols.toString()); out.print(")"); writeStatementTerminator(); out.println(""); } } |
out.println("-- Created by SQLPower Generic DDL Generator "+GENERATOR_VERSION+" --"); | println("-- Created by SQLPower Generic DDL Generator "+GENERATOR_VERSION+" --"); | public void writeHeader() { out.println("-- Created by SQLPower Generic DDL Generator "+GENERATOR_VERSION+" --"); } |
out.println(""); out.println("ALTER TABLE "+t.getName() | println(""); println("ALTER TABLE "+t.getName() | protected void writePrimaryKey(SQLTable t) throws ArchitectException { boolean firstCol = true; Iterator it = t.getColumns().iterator(); while (it.hasNext()) { SQLColumn col = (SQLColumn) it.next(); if (col.getPrimaryKeySeq() == null) break; if (firstCol) { out.println(""); out.println("ALTER TABLE "+t.getName() +" ADD CONSTRAINT "+t.getPrimaryKeyName()); out.print("PRIMARY KEY ("); firstCol = false; } else { out.print(", "); } out.print(col.getName()); } out.print(")"); writeStatementTerminator(); out.println(""); } |
out.print("PRIMARY KEY ("); | print("PRIMARY KEY ("); | protected void writePrimaryKey(SQLTable t) throws ArchitectException { boolean firstCol = true; Iterator it = t.getColumns().iterator(); while (it.hasNext()) { SQLColumn col = (SQLColumn) it.next(); if (col.getPrimaryKeySeq() == null) break; if (firstCol) { out.println(""); out.println("ALTER TABLE "+t.getName() +" ADD CONSTRAINT "+t.getPrimaryKeyName()); out.print("PRIMARY KEY ("); firstCol = false; } else { out.print(", "); } out.print(col.getName()); } out.print(")"); writeStatementTerminator(); out.println(""); } |
out.print(", "); | print(", "); | protected void writePrimaryKey(SQLTable t) throws ArchitectException { boolean firstCol = true; Iterator it = t.getColumns().iterator(); while (it.hasNext()) { SQLColumn col = (SQLColumn) it.next(); if (col.getPrimaryKeySeq() == null) break; if (firstCol) { out.println(""); out.println("ALTER TABLE "+t.getName() +" ADD CONSTRAINT "+t.getPrimaryKeyName()); out.print("PRIMARY KEY ("); firstCol = false; } else { out.print(", "); } out.print(col.getName()); } out.print(")"); writeStatementTerminator(); out.println(""); } |
out.print(col.getName()); | print(col.getName()); | protected void writePrimaryKey(SQLTable t) throws ArchitectException { boolean firstCol = true; Iterator it = t.getColumns().iterator(); while (it.hasNext()) { SQLColumn col = (SQLColumn) it.next(); if (col.getPrimaryKeySeq() == null) break; if (firstCol) { out.println(""); out.println("ALTER TABLE "+t.getName() +" ADD CONSTRAINT "+t.getPrimaryKeyName()); out.print("PRIMARY KEY ("); firstCol = false; } else { out.print(", "); } out.print(col.getName()); } out.print(")"); writeStatementTerminator(); out.println(""); } |
out.print(")"); | print(")"); | protected void writePrimaryKey(SQLTable t) throws ArchitectException { boolean firstCol = true; Iterator it = t.getColumns().iterator(); while (it.hasNext()) { SQLColumn col = (SQLColumn) it.next(); if (col.getPrimaryKeySeq() == null) break; if (firstCol) { out.println(""); out.println("ALTER TABLE "+t.getName() +" ADD CONSTRAINT "+t.getPrimaryKeyName()); out.print("PRIMARY KEY ("); firstCol = false; } else { out.print(", "); } out.print(col.getName()); } out.print(")"); writeStatementTerminator(); out.println(""); } |
out.println(""); | println(""); | protected void writePrimaryKey(SQLTable t) throws ArchitectException { boolean firstCol = true; Iterator it = t.getColumns().iterator(); while (it.hasNext()) { SQLColumn col = (SQLColumn) it.next(); if (col.getPrimaryKeySeq() == null) break; if (firstCol) { out.println(""); out.println("ALTER TABLE "+t.getName() +" ADD CONSTRAINT "+t.getPrimaryKeyName()); out.print("PRIMARY KEY ("); firstCol = false; } else { out.print(", "); } out.print(col.getName()); } out.print(")"); writeStatementTerminator(); out.println(""); } |
out.print(";"); | print(";"); | public void writeStatementTerminator() { out.print(";"); } |
public void writeTable(SQLTable t) throws SQLException, IOException, ArchitectException { out.println("\nCREATE TABLE "+t.getName()+" ("); | public void writeTable(SQLTable t) throws SQLException, ArchitectException { println("\nCREATE TABLE "+t.getName()+" ("); | public void writeTable(SQLTable t) throws SQLException, IOException, ArchitectException { out.println("\nCREATE TABLE "+t.getName()+" ("); boolean firstCol = true; Iterator it = t.getColumns().iterator(); while (it.hasNext()) { SQLColumn c = (SQLColumn) it.next(); GenericTypeDescriptor td = (GenericTypeDescriptor) typeMap.get(new Integer(c.getType())); if (td == null) { throw new UnsupportedOperationException ("No type for "+c.getType()+" is available in the target database platform." +"\nPlease choose a different type."); } if (!firstCol) out.println(","); out.print(" "); out.print(c.getName()); out.print(" "); out.print(td.getName()); if (td.getHasScale()) { out.print("("+c.getScale()); if (td.getHasPrecision()) { out.print(","+c.getPrecision()); } out.print(")"); } if (c.isNullable()) { if (! td.isNullable()) { throw new UnsupportedOperationException ("The data type "+td.getName()+" is not nullable on the target database platform."); } out.print(" NULL"); } else { out.print(" NOT NULL"); } // XXX: default values? firstCol = false; } out.println(); out.print(")"); writeStatementTerminator(); out.println(""); } |
if (!firstCol) out.println(","); out.print(" "); out.print(c.getName()); out.print(" "); out.print(td.getName()); | if (!firstCol) println(","); print(" "); print(c.getName()); print(" "); print(td.getName()); | public void writeTable(SQLTable t) throws SQLException, IOException, ArchitectException { out.println("\nCREATE TABLE "+t.getName()+" ("); boolean firstCol = true; Iterator it = t.getColumns().iterator(); while (it.hasNext()) { SQLColumn c = (SQLColumn) it.next(); GenericTypeDescriptor td = (GenericTypeDescriptor) typeMap.get(new Integer(c.getType())); if (td == null) { throw new UnsupportedOperationException ("No type for "+c.getType()+" is available in the target database platform." +"\nPlease choose a different type."); } if (!firstCol) out.println(","); out.print(" "); out.print(c.getName()); out.print(" "); out.print(td.getName()); if (td.getHasScale()) { out.print("("+c.getScale()); if (td.getHasPrecision()) { out.print(","+c.getPrecision()); } out.print(")"); } if (c.isNullable()) { if (! td.isNullable()) { throw new UnsupportedOperationException ("The data type "+td.getName()+" is not nullable on the target database platform."); } out.print(" NULL"); } else { out.print(" NOT NULL"); } // XXX: default values? firstCol = false; } out.println(); out.print(")"); writeStatementTerminator(); out.println(""); } |
out.print("("+c.getScale()); | print("("+c.getScale()); | public void writeTable(SQLTable t) throws SQLException, IOException, ArchitectException { out.println("\nCREATE TABLE "+t.getName()+" ("); boolean firstCol = true; Iterator it = t.getColumns().iterator(); while (it.hasNext()) { SQLColumn c = (SQLColumn) it.next(); GenericTypeDescriptor td = (GenericTypeDescriptor) typeMap.get(new Integer(c.getType())); if (td == null) { throw new UnsupportedOperationException ("No type for "+c.getType()+" is available in the target database platform." +"\nPlease choose a different type."); } if (!firstCol) out.println(","); out.print(" "); out.print(c.getName()); out.print(" "); out.print(td.getName()); if (td.getHasScale()) { out.print("("+c.getScale()); if (td.getHasPrecision()) { out.print(","+c.getPrecision()); } out.print(")"); } if (c.isNullable()) { if (! td.isNullable()) { throw new UnsupportedOperationException ("The data type "+td.getName()+" is not nullable on the target database platform."); } out.print(" NULL"); } else { out.print(" NOT NULL"); } // XXX: default values? firstCol = false; } out.println(); out.print(")"); writeStatementTerminator(); out.println(""); } |
out.print(","+c.getPrecision()); | print(","+c.getPrecision()); | public void writeTable(SQLTable t) throws SQLException, IOException, ArchitectException { out.println("\nCREATE TABLE "+t.getName()+" ("); boolean firstCol = true; Iterator it = t.getColumns().iterator(); while (it.hasNext()) { SQLColumn c = (SQLColumn) it.next(); GenericTypeDescriptor td = (GenericTypeDescriptor) typeMap.get(new Integer(c.getType())); if (td == null) { throw new UnsupportedOperationException ("No type for "+c.getType()+" is available in the target database platform." +"\nPlease choose a different type."); } if (!firstCol) out.println(","); out.print(" "); out.print(c.getName()); out.print(" "); out.print(td.getName()); if (td.getHasScale()) { out.print("("+c.getScale()); if (td.getHasPrecision()) { out.print(","+c.getPrecision()); } out.print(")"); } if (c.isNullable()) { if (! td.isNullable()) { throw new UnsupportedOperationException ("The data type "+td.getName()+" is not nullable on the target database platform."); } out.print(" NULL"); } else { out.print(" NOT NULL"); } // XXX: default values? firstCol = false; } out.println(); out.print(")"); writeStatementTerminator(); out.println(""); } |
out.print(")"); | print(")"); | public void writeTable(SQLTable t) throws SQLException, IOException, ArchitectException { out.println("\nCREATE TABLE "+t.getName()+" ("); boolean firstCol = true; Iterator it = t.getColumns().iterator(); while (it.hasNext()) { SQLColumn c = (SQLColumn) it.next(); GenericTypeDescriptor td = (GenericTypeDescriptor) typeMap.get(new Integer(c.getType())); if (td == null) { throw new UnsupportedOperationException ("No type for "+c.getType()+" is available in the target database platform." +"\nPlease choose a different type."); } if (!firstCol) out.println(","); out.print(" "); out.print(c.getName()); out.print(" "); out.print(td.getName()); if (td.getHasScale()) { out.print("("+c.getScale()); if (td.getHasPrecision()) { out.print(","+c.getPrecision()); } out.print(")"); } if (c.isNullable()) { if (! td.isNullable()) { throw new UnsupportedOperationException ("The data type "+td.getName()+" is not nullable on the target database platform."); } out.print(" NULL"); } else { out.print(" NOT NULL"); } // XXX: default values? firstCol = false; } out.println(); out.print(")"); writeStatementTerminator(); out.println(""); } |
out.print(" NULL"); | print(" NULL"); | public void writeTable(SQLTable t) throws SQLException, IOException, ArchitectException { out.println("\nCREATE TABLE "+t.getName()+" ("); boolean firstCol = true; Iterator it = t.getColumns().iterator(); while (it.hasNext()) { SQLColumn c = (SQLColumn) it.next(); GenericTypeDescriptor td = (GenericTypeDescriptor) typeMap.get(new Integer(c.getType())); if (td == null) { throw new UnsupportedOperationException ("No type for "+c.getType()+" is available in the target database platform." +"\nPlease choose a different type."); } if (!firstCol) out.println(","); out.print(" "); out.print(c.getName()); out.print(" "); out.print(td.getName()); if (td.getHasScale()) { out.print("("+c.getScale()); if (td.getHasPrecision()) { out.print(","+c.getPrecision()); } out.print(")"); } if (c.isNullable()) { if (! td.isNullable()) { throw new UnsupportedOperationException ("The data type "+td.getName()+" is not nullable on the target database platform."); } out.print(" NULL"); } else { out.print(" NOT NULL"); } // XXX: default values? firstCol = false; } out.println(); out.print(")"); writeStatementTerminator(); out.println(""); } |
out.print(" NOT NULL"); | print(" NOT NULL"); | public void writeTable(SQLTable t) throws SQLException, IOException, ArchitectException { out.println("\nCREATE TABLE "+t.getName()+" ("); boolean firstCol = true; Iterator it = t.getColumns().iterator(); while (it.hasNext()) { SQLColumn c = (SQLColumn) it.next(); GenericTypeDescriptor td = (GenericTypeDescriptor) typeMap.get(new Integer(c.getType())); if (td == null) { throw new UnsupportedOperationException ("No type for "+c.getType()+" is available in the target database platform." +"\nPlease choose a different type."); } if (!firstCol) out.println(","); out.print(" "); out.print(c.getName()); out.print(" "); out.print(td.getName()); if (td.getHasScale()) { out.print("("+c.getScale()); if (td.getHasPrecision()) { out.print(","+c.getPrecision()); } out.print(")"); } if (c.isNullable()) { if (! td.isNullable()) { throw new UnsupportedOperationException ("The data type "+td.getName()+" is not nullable on the target database platform."); } out.print(" NULL"); } else { out.print(" NOT NULL"); } // XXX: default values? firstCol = false; } out.println(); out.print(")"); writeStatementTerminator(); out.println(""); } |
out.println(); out.print(")"); | println(""); print(")"); | public void writeTable(SQLTable t) throws SQLException, IOException, ArchitectException { out.println("\nCREATE TABLE "+t.getName()+" ("); boolean firstCol = true; Iterator it = t.getColumns().iterator(); while (it.hasNext()) { SQLColumn c = (SQLColumn) it.next(); GenericTypeDescriptor td = (GenericTypeDescriptor) typeMap.get(new Integer(c.getType())); if (td == null) { throw new UnsupportedOperationException ("No type for "+c.getType()+" is available in the target database platform." +"\nPlease choose a different type."); } if (!firstCol) out.println(","); out.print(" "); out.print(c.getName()); out.print(" "); out.print(td.getName()); if (td.getHasScale()) { out.print("("+c.getScale()); if (td.getHasPrecision()) { out.print(","+c.getPrecision()); } out.print(")"); } if (c.isNullable()) { if (! td.isNullable()) { throw new UnsupportedOperationException ("The data type "+td.getName()+" is not nullable on the target database platform."); } out.print(" NULL"); } else { out.print(" NOT NULL"); } // XXX: default values? firstCol = false; } out.println(); out.print(")"); writeStatementTerminator(); out.println(""); } |
out.println(""); | println(""); | public void writeTable(SQLTable t) throws SQLException, IOException, ArchitectException { out.println("\nCREATE TABLE "+t.getName()+" ("); boolean firstCol = true; Iterator it = t.getColumns().iterator(); while (it.hasNext()) { SQLColumn c = (SQLColumn) it.next(); GenericTypeDescriptor td = (GenericTypeDescriptor) typeMap.get(new Integer(c.getType())); if (td == null) { throw new UnsupportedOperationException ("No type for "+c.getType()+" is available in the target database platform." +"\nPlease choose a different type."); } if (!firstCol) out.println(","); out.print(" "); out.print(c.getName()); out.print(" "); out.print(td.getName()); if (td.getHasScale()) { out.print("("+c.getScale()); if (td.getHasPrecision()) { out.print(","+c.getPrecision()); } out.print(")"); } if (c.isNullable()) { if (! td.isNullable()) { throw new UnsupportedOperationException ("The data type "+td.getName()+" is not nullable on the target database platform."); } out.print(" NULL"); } else { out.print(" NOT NULL"); } // XXX: default values? firstCol = false; } out.println(); out.print(")"); writeStatementTerminator(); out.println(""); } |
theData.generateDPrimeTable(maxCompDist); theData.guessBlocks(BLOX_GABRIEL); | theData.generateDPrimeTable(); theData.guessBlocks(BLOX_NONE); | void processData(final String[][] hminfo, String[] in) { final String[] inputOptions = in; if (inputOptions[2].equals("")){ inputOptions[2] = "0"; } maxCompDist = Long.parseLong(inputOptions[2])*1000; this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); final SwingWorker worker = new SwingWorker(){ public Object construct(){ dPrimeDisplay=null; theData.infoKnown = false; File markerFile; if (inputOptions[1].equals("")){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } readMarkers(markerFile, hminfo); theData.generateDPrimeTable(maxCompDist); 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(theData); 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 + " -- " + inputOptions[0]); 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(); } |
theData.generateDPrimeTable(maxCompDist); theData.guessBlocks(BLOX_GABRIEL); | theData.generateDPrimeTable(); theData.guessBlocks(BLOX_NONE); | public Object construct(){ dPrimeDisplay=null; theData.infoKnown = false; File markerFile; if (inputOptions[1].equals("")){ markerFile = null; }else{ markerFile = new File(inputOptions[1]); } readMarkers(markerFile, hminfo); theData.generateDPrimeTable(maxCompDist); 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(theData); 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 + " -- " + inputOptions[0]); return null; } |
w = xformImage.getWidth(); h = xformImage.getHeight(); | if ( xformImage != null ) { w = xformImage.getWidth(); h = xformImage.getHeight(); } | public Dimension getPreferredSize() { int w = 0; int h = 0; if ( origImage != null ) { if ( xformImage == null ) { buildXformImage(); } w = xformImage.getWidth(); h = xformImage.getHeight(); } return new Dimension( w, h ); } |
String tagName, | TagScript tagScript, | public Expression createExpression( ExpressionFactory factory, String tagName, String attributeName, String attributeValue) throws Exception { // #### may need to include some namespace URI information in the XPath instance? if (attributeName.equals("select")) { if ( log.isDebugEnabled() ) { log.debug( "Parsing XPath expression: " + attributeValue ); } try { XPath xpath = new Dom4jXPath(attributeValue); return new XPathExpression(xpath); } catch (JaxenException e) { throw new JellyException( "Could not parse XPath expression: \"" + attributeValue + "\" reason: " + e, e ); } } // will use the default expression instead return super.createExpression(factory, tagName, attributeName, attributeValue); } |
return new XPathExpression(xpath); | return new XPathExpression(xpath, tagScript); | public Expression createExpression( ExpressionFactory factory, String tagName, String attributeName, String attributeValue) throws Exception { // #### may need to include some namespace URI information in the XPath instance? if (attributeName.equals("select")) { if ( log.isDebugEnabled() ) { log.debug( "Parsing XPath expression: " + attributeValue ); } try { XPath xpath = new Dom4jXPath(attributeValue); return new XPathExpression(xpath); } catch (JaxenException e) { throw new JellyException( "Could not parse XPath expression: \"" + attributeValue + "\" reason: " + e, e ); } } // will use the default expression instead return super.createExpression(factory, tagName, attributeName, attributeValue); } |
return super.createExpression(factory, tagName, attributeName, attributeValue); | return super.createExpression(factory, tagScript, attributeName, attributeValue); | public Expression createExpression( ExpressionFactory factory, String tagName, String attributeName, String attributeValue) throws Exception { // #### may need to include some namespace URI information in the XPath instance? if (attributeName.equals("select")) { if ( log.isDebugEnabled() ) { log.debug( "Parsing XPath expression: " + attributeValue ); } try { XPath xpath = new Dom4jXPath(attributeValue); return new XPathExpression(xpath); } catch (JaxenException e) { throw new JellyException( "Could not parse XPath expression: \"" + attributeValue + "\" reason: " + e, e ); } } // will use the default expression instead return super.createExpression(factory, tagName, attributeName, attributeValue); } |
curRes.tallyInd(allele1T,allele1U); curRes.tallyInd(allele2T,allele2U); | if(!(allele1T == 5 && allele1U == 5 && allele2T !=5 && allele2U != 5) && !(allele1T != 5 && allele1U != 5 && allele2T ==5 && allele2U == 5)) { curRes.tallyInd(allele1T,allele1U); curRes.tallyInd(allele2T,allele2U); } | public static Vector calcTDT(Vector chromosomes) { Vector results = new Vector(); int numMarkers = Chromosome.getSize(); for(int k=0;k<numMarkers;k++){ results.add(new TDTResult(Chromosome.getMarker(k))); } for(int i=0;i<chromosomes.size()-3;i++){ Chromosome chrom1T = (Chromosome)chromosomes.get(i); i++; Chromosome chrom1U = (Chromosome)chromosomes.get(i); i++; Chromosome chrom2T = (Chromosome)chromosomes.get(i); i++; Chromosome chrom2U = (Chromosome)chromosomes.get(i); //System.out.println("ind1T: " + chrom1T.getPed() + "\t" + chrom1T.getIndividual() ); //System.out.println("ind1U: " + chrom1U.getPed() + "\t" + chrom1U.getIndividual() ); //System.out.println("ind2T: " + chrom2T.getPed() + "\t" + chrom2T.getIndividual() ); //System.out.println("ind2U: " + chrom2U.getPed() + "\t" + chrom2U.getIndividual() ); for(int j=0;j<numMarkers;j++){ byte allele1T = chrom1T.getGenotype(j); byte allele1U = chrom1U.getGenotype(j); byte allele2T = chrom2T.getGenotype(j); byte allele2U = chrom2U.getGenotype(j); TDTResult curRes = (TDTResult)results.get(j); //System.out.println("marker "+ j + ":\t " + allele1T + "\t" + allele1U + "\t" + allele2T + "\t" + allele2U); curRes.tallyInd(allele1T,allele1U); curRes.tallyInd(allele2T,allele2U); } } for(int i=0;i<results.size();i++){ TDTResult tempRes = (TDTResult)results.get(i); int[][] counts = tempRes.counts; //System.out.println( counts[0][0] + "\t" + counts[1][1] + "\t" + counts[0][1] + "\t" + counts[1][0]); } return results; } |
newContext.setExportLibraries(false); newContext.setExport(false); | public void doTag(final XMLOutput output) throws Exception { String name = getName(); if ( name == null ) { name = toString(); } // #### we need to redirect the output to a TestListener // or something? TestCase testCase = new TestCase(name) { protected void runTest() throws Throwable { // create a new child context so that each test case // will have its own variable scopes JellyContext newContext = new JellyContext( context ); // invoke the test case getBody().run(newContext, output); } }; // lets find the test suite TestSuite suite = getSuite(); if ( suite == null ) { throw new JellyException( "Could not find a TestSuite to add this test to. This tag should be inside a <test:suite> tag" ); } suite.addTest(testCase); } |
|
newContext.setExportLibraries(false); newContext.setExport(false); | protected void runTest() throws Throwable { // create a new child context so that each test case // will have its own variable scopes JellyContext newContext = new JellyContext( context ); // invoke the test case getBody().run(newContext, output); } |
|
highY = exportStop; | highY = exportStop+1; | public void paintComponent(Graphics g){ DPrimeTable dPrimeTable = theData.dpTable; if (Chromosome.getSize() < 2){ //if there zero or only one valid marker return; } Vector blocks = theData.blocks; Rectangle visRect = getVisibleRect(); //deal with zooming if (chartSize.getWidth() > (3*visRect.width)){ showWM = true; }else{ showWM = false; } if (zoomLevel != 0 || Options.getLDColorScheme() == WMF_SCHEME || Options.getLDColorScheme() == RSQ_SCHEME){ printDPrimeValues = false; } else{ printDPrimeValues = true; } Graphics2D g2 = (Graphics2D) g; Dimension size = getSize(); Dimension pref = getPreferredSize(); g2.setColor(BG_GREY); //if it's a big dataset, resize properly, if it's small make sure to fill whole background if (size.height < pref.height){ g2.fillRect(0,0,pref.width,pref.height); setSize(pref); }else{ g2.fillRect(0,0,size.width, size.height); } g2.setColor(Color.black); //okay so this dumb if block is to prevent the ugly repainting //bug when loading markers after the data are already being displayed, //results in a little off-centering for small datasets, but not too bad. if (!forExport){ if (!theData.infoKnown){ g2.translate((size.width - pref.width) / 2, (size.height - pref.height) / 2); } else { g2.translate((size.width - pref.width) / 2, 0); } } FontMetrics boxFontMetrics = g2.getFontMetrics(boxFont); int diamondX[] = new int[4]; int diamondY[] = new int[4]; Polygon diamond; double lineSpan = alignedPositions[alignedPositions.length-1] - alignedPositions[0]; long minpos = Chromosome.getMarker(0).getPosition(); long maxpos = Chromosome.getMarker(Chromosome.getSize()-1).getPosition(); double spanpos = maxpos - minpos; //See http://www.hapmap.org/cgi-perl/gbrowse/gbrowse_img //for more info on GBrowse img. int imgHeight = 0; if (Options.isGBrowseShown() && Chromosome.getDataChrom() != null){ g2.drawImage(gBrowseImage,H_BORDER-GBROWSE_MARGIN,V_BORDER,this); imgHeight = gBrowseImage.getHeight(this) + TRACK_GAP; // get height so we can shift everything down } left = H_BORDER; top = V_BORDER + imgHeight; // push the haplotype display down to make room for gbrowse image. if (forExport){ left -= exportStart * boxSize; } FontMetrics metrics; int ascent; g2.setFont(boldMarkerNameFont); metrics = g2.getFontMetrics(); ascent = metrics.getAscent(); //the following values are the bounds on the boxes we want to //display given that the current window is 'visRect' lowX = getBoundaryMarker(visRect.x-clickXShift-(visRect.y +visRect.height-clickYShift)) - 1; highX = getBoundaryMarker(visRect.x + visRect.width); lowY = getBoundaryMarker((visRect.x-clickXShift)+(visRect.y-clickYShift)) - 1; highY = getBoundaryMarker((visRect.x-clickXShift+visRect.width) + (visRect.y-clickYShift+visRect.height)); if (lowX < 0) { lowX = 0; } if (highX > Chromosome.getSize()-1){ highX = Chromosome.getSize()-1; } if (lowY < lowX+1){ lowY = lowX+1; } if (highY > Chromosome.getSize()){ highY = Chromosome.getSize(); } if (forExport){ lowX = exportStart; lowY = exportStart; highX = exportStop; highY = exportStop; } if (theData.trackExists){ //draw the analysis track above where the marker positions will be marked g2.setColor(Color.white); g2.fill(new Rectangle2D.Double(left, top, lineSpan, TRACK_HEIGHT)); g2.setColor(Color.black); g2.drawRect(left,top,(int)lineSpan,TRACK_HEIGHT); //get the data into an easier format double positions[] = new double[theData.analysisPositions.size()]; double values[] = new double[theData.analysisPositions.size()]; for (int x = 0; x < positions.length; x++){ positions[x] = ((Double)theData.analysisPositions.elementAt(x)).doubleValue(); values[x] = ((Double)theData.analysisValues.elementAt(x)).doubleValue(); } g2.setColor(Color.black); double min = Double.MAX_VALUE; double max = -min; for (int x = 0; x < positions.length; x++){ if(values[x] < min){ min = values[x]; } if (values[x] > max){ max = values[x]; } } double range = max-min; //todo: this is kinda hideous for (int x = 0; x < positions.length - 1; x++){ if (positions[x] >= minpos && positions[x+1] <= maxpos){ g2.draw(new Line2D.Double(lineSpan * Math.abs((positions[x] - minpos)/spanpos) + left, top + TRACK_PALETTE + TRACK_BUMPER - (TRACK_PALETTE * Math.abs((values[x] - min)/range)), lineSpan * Math.abs((positions[x+1] - minpos)/spanpos) + left, top + TRACK_PALETTE + TRACK_BUMPER - (TRACK_PALETTE * Math.abs((values[x+1] - min)/range)))); } } top += TRACK_HEIGHT + TRACK_GAP; } if (theData.infoKnown) { Color green = new Color(0, 127, 0); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); //// draw the marker locations g2.setStroke(thinnerStroke); g2.setColor(Color.white); g2.fill(new Rectangle2D.Double(left+1, top+1, lineSpan-1, TICK_HEIGHT-1)); g2.setColor(Color.black); g2.draw(new Rectangle2D.Double(left, top, lineSpan, TICK_HEIGHT)); for (int i = 0; i < Chromosome.getSize(); i++){ double pos = (Chromosome.getMarker(i).getPosition() - minpos) / spanpos; double xx = left + lineSpan*pos; // if we're zoomed, use the line color to indicate whether there is extra data available // (since the marker names are not displayed when zoomed) if (Chromosome.getMarker(i).getExtra() != null && zoomLevel != 0) g2.setColor(green); //draw tick g2.setStroke(thickerStroke); g2.draw(new Line2D.Double(xx, top, xx, top + TICK_HEIGHT)); if (Chromosome.getMarker(i).getExtra() != null && zoomLevel != 0) g2.setStroke(thickerStroke); else g2.setStroke(thinnerStroke); //draw connecting line g2.draw(new Line2D.Double(xx, top + TICK_HEIGHT, left + alignedPositions[i], top+TICK_BOTTOM)); if (Chromosome.getMarker(i).getExtra() != null && zoomLevel != 0) g2.setColor(Color.black); } top += TICK_BOTTOM + TICK_HEIGHT; //// draw the marker names if (printMarkerNames){ widestMarkerName = metrics.stringWidth(Chromosome.getMarker(0).getName()); for (int x = 1; x < Chromosome.getSize(); x++) { int thiswide = metrics.stringWidth(Chromosome.getMarker(x).getName()); if (thiswide > widestMarkerName) widestMarkerName = thiswide; } g2.translate(left, top + widestMarkerName); g2.rotate(-Math.PI / 2.0); for (int x = 0; x < Chromosome.getSize(); x++) { if (theData.isInBlock[x]){ g2.setFont(boldMarkerNameFont); }else{ g2.setFont(markerNameFont); } if (Chromosome.getMarker(x).getExtra() != null) g2.setColor(green); g2.drawString(Chromosome.getMarker(x).getName(),(float)TEXT_GAP, (float)alignedPositions[x] + ascent/3); if (Chromosome.getMarker(x).getExtra() != null) g2.setColor(Color.black); } g2.rotate(Math.PI / 2.0); g2.translate(-left, -(top + widestMarkerName)); // move everybody down top += widestMarkerName + TEXT_GAP; } g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); } top += blockDispHeight; //// draw the marker numbers if (printMarkerNames){ g2.setFont(markerNumFont); metrics = g2.getFontMetrics(); ascent = metrics.getAscent(); for (int x = 0; x < Chromosome.getSize(); x++) { String mark = String.valueOf(Chromosome.realIndex[x] + 1); g2.drawString(mark, (float)(left + alignedPositions[x] - metrics.stringWidth(mark)/2), (float)(top + ascent)); } top += boxRadius/2; // give a little space between numbers and boxes } //clickxshift and clickyshift are used later to translate from x,y coords //to the pair of markers comparison at those coords if (!(theData.infoKnown)){ clickXShift = left + (size.width-pref.width)/2; clickYShift = top + (size.height - pref.height)/2; } else { clickXShift = left + (size.width-pref.width)/2; clickYShift = top; } // draw table column by column for (int x = lowX; x < highX; x++) { //always draw the fewest possible boxes if (lowY < x+1){ lowY = x+1; } for (int y = lowY; y < highY; y++) { if (dPrimeTable.getLDStats(x,y) == null){ continue; } double d = dPrimeTable.getLDStats(x,y).getDPrime(); //double l = dPrimeTable.getLDStats(x,y).getLOD(); Color boxColor = dPrimeTable.getLDStats(x,y).getColor(); // draw markers above int xx = left + (int)((alignedPositions[x] + alignedPositions[y])/2); int yy = top + (int)((alignedPositions[y] - alignedPositions[x]) / 2); diamondX[0] = xx; diamondY[0] = yy - boxRadius; diamondX[1] = xx + boxRadius; diamondY[1] = yy; diamondX[2] = xx; diamondY[2] = yy + boxRadius; diamondX[3] = xx - boxRadius; diamondY[3] = yy; diamond = new Polygon(diamondX, diamondY, 4); g2.setColor(boxColor); g2.fillPolygon(diamond); if(printDPrimeValues){ g2.setFont(boxFont); ascent = boxFontMetrics.getAscent(); int val = (int) (d * 100); g2.setColor((val < 50) ? Color.gray : Color.black); if (boxColor == Color.darkGray){ g2.setColor(Color.white); } if (val != 100) { String valu = String.valueOf(val); int widf = boxFontMetrics.stringWidth(valu); g.drawString(valu, xx - widf/2, yy + ascent/2); } } } } //highlight blocks g2.setFont(markerNameFont); ascent = g2.getFontMetrics().getAscent(); //g.setColor(new Color(153,255,153)); g2.setColor(Color.black); //g.setColor(new Color(51,153,51)); for (int i = 0; i < blocks.size(); i++){ int[] theBlock = (int[])blocks.elementAt(i); int first = theBlock[0]; int last = theBlock[theBlock.length-1]; //big vee around whole thing g2.setStroke(fatStroke); g2.draw(new Line2D.Double(left + alignedPositions[first] - boxRadius, top, left + (alignedPositions[first] + alignedPositions[last])/2, top + (alignedPositions[last] - alignedPositions[first])/2 + boxRadius)); g2.draw(new Line2D.Double(left + (alignedPositions[first] + alignedPositions[last])/2, top + (alignedPositions[last] - alignedPositions[first])/2 + boxRadius, left + alignedPositions[last] + boxRadius, top)); for (int j = first; j < last; j++){ g2.setStroke(fatStroke); if (theData.isInBlock[j]){ g2.draw(new Line2D.Double(left+alignedPositions[j]-boxSize/2, top-blockDispHeight, left+alignedPositions[j+1]-boxSize/2, top-blockDispHeight)); }else{ g2.draw(new Line2D.Double(left + alignedPositions[j] + boxSize/2, top-blockDispHeight, left+alignedPositions[j+1]-boxSize/2, top-blockDispHeight)); g2.setStroke(dashedFatStroke); g2.draw(new Line2D.Double(left+alignedPositions[j] - boxSize/2, top-blockDispHeight, left+alignedPositions[j] + boxSize/2, top-blockDispHeight)); } } //cap off the end of the block g2.setStroke(fatStroke); g2.draw(new Line2D.Double(left+alignedPositions[last]-boxSize/2, top-blockDispHeight, left+alignedPositions[last]+boxSize/2, top-blockDispHeight)); //lines to connect to block display g2.setStroke(fatStroke); g2.draw(new Line2D.Double(left + alignedPositions[first]-boxSize/2, top-1, left+alignedPositions[first]-boxSize/2, top-blockDispHeight)); g2.draw(new Line2D.Double(left+alignedPositions[last]+boxSize/2, top-1, left+alignedPositions[last]+boxSize/2, top-blockDispHeight)); if (printMarkerNames){ String labelString = new String ("Block " + (i+1)); if (theData.infoKnown){ long blockSize = Chromosome.getMarker(last).getPosition() - Chromosome.getMarker(first).getPosition(); labelString += " (" + blockSize/1000 + " kb)"; } g2.drawString(labelString, (float)(left+alignedPositions[first]-boxSize/2+TEXT_GAP), (float)(top-boxSize/3)); } } g2.setStroke(thickerStroke); if (showWM && !forExport){ //dataset is big enough to require worldmap if (wmMaxWidth == 0){ wmMaxWidth = visRect.width/3; } double scalefactor; scalefactor = (double)(chartSize.width)/wmMaxWidth; double prefBoxSize = boxSize/(scalefactor*((double)wmMaxWidth/(double)(wmMaxWidth))); //stick WM_BD in the middle of the blank space at the top of the worldmap final int WM_BD_GAP = (int)(infoHeight/(scalefactor*2)); final int WM_BD_HEIGHT = 2; CompoundBorder wmBorder = new CompoundBorder(BorderFactory.createRaisedBevelBorder(), BorderFactory.createLoweredBevelBorder()); if (noImage){ //first time through draw a worldmap if dataset is big: worldmap = new BufferedImage((int)(chartSize.width/scalefactor)+wmBorder.getBorderInsets(this).left*2, (int)(chartSize.height/scalefactor)+wmBorder.getBorderInsets(this).top*2, BufferedImage.TYPE_3BYTE_BGR); Graphics gw = worldmap.getGraphics(); Graphics2D gw2 = (Graphics2D)(gw); gw2.setColor(BG_GREY); gw2.fillRect(1,1,worldmap.getWidth()-1,worldmap.getHeight()-1); //make a pretty border gw2.setColor(Color.black); wmBorder.paintBorder(this,gw2,0,0,worldmap.getWidth(),worldmap.getHeight()); wmInteriorRect = wmBorder.getInteriorRectangle(this,0,0,worldmap.getWidth(), worldmap.getHeight()); float[] smallDiamondX = new float[4]; float[] smallDiamondY = new float[4]; GeneralPath gp; for (int x = 0; x < Chromosome.getSize()-1; x++){ for (int y = x+1; y < Chromosome.getSize(); y++){ if (dPrimeTable.getLDStats(x,y) == null){ continue; } double xx = ((alignedPositions[y] + alignedPositions[x])/(scalefactor*2)) + wmBorder.getBorderInsets(this).left; double yy = ((alignedPositions[y] - alignedPositions[x] + infoHeight*2)/(scalefactor*2)) + wmBorder.getBorderInsets(this).top; smallDiamondX[0] = (float)xx; smallDiamondY[0] = (float)(yy - prefBoxSize/2); smallDiamondX[1] = (float)(xx + prefBoxSize/2); smallDiamondY[1] = (float)yy; smallDiamondX[2] = (float)xx; smallDiamondY[2] = (float)(yy + prefBoxSize/2); smallDiamondX[3] = (float)(xx - prefBoxSize/2); smallDiamondY[3] = (float)yy; gp = new GeneralPath(GeneralPath.WIND_EVEN_ODD, smallDiamondX.length); gp.moveTo(smallDiamondX[0],smallDiamondY[0]); for (int i = 1; i < smallDiamondX.length; i++){ gp.lineTo(smallDiamondX[i], smallDiamondY[i]); } gp.closePath(); gw2.setColor(dPrimeTable.getLDStats(x,y).getColor()); gw2.fill(gp); } } noImage = false; } //draw block display in worldmap Graphics gw = worldmap.getGraphics(); Graphics2D gw2 = (Graphics2D)(gw); gw2.setColor(BG_GREY); gw2.fillRect(wmBorder.getBorderInsets(this).left, wmBorder.getBorderInsets(this).top+WM_BD_GAP, wmInteriorRect.width, WM_BD_HEIGHT); gw2.setColor(Color.black); boolean even = true; for (int i = 0; i < blocks.size(); i++){ int first = ((int[])blocks.elementAt(i))[0]; int last = ((int[])blocks.elementAt(i))[((int[])blocks.elementAt(i)).length-1]; int voffset; if (even){ voffset = 0; }else{ voffset = WM_BD_HEIGHT/2; } gw2.fillRect(wmBorder.getBorderInsets(this).left - (int)prefBoxSize/2 + (int)(alignedPositions[first]/scalefactor), wmBorder.getBorderInsets(this).top+voffset+WM_BD_GAP, (int)(prefBoxSize + (alignedPositions[last] - alignedPositions[first])/scalefactor), WM_BD_HEIGHT/2); even = !even; } wmResizeCorner = new Rectangle(visRect.x + worldmap.getWidth() - (worldmap.getWidth()-wmInteriorRect.width)/2, visRect.y + visRect.height - worldmap.getHeight(), (worldmap.getWidth()-wmInteriorRect.width)/2, (worldmap.getHeight() -wmInteriorRect.height)/2); g2.drawImage(worldmap,visRect.x, visRect.y + visRect.height - worldmap.getHeight(), this); wmInteriorRect.x = visRect.x + (worldmap.getWidth() - wmInteriorRect.width)/2; wmInteriorRect.y = visRect.y+visRect.height-worldmap.getHeight() + (worldmap.getHeight() - wmInteriorRect.height)/2; //draw the outline of the viewport g2.setColor(Color.black); double hRatio = wmInteriorRect.getWidth()/pref.getWidth(); double vRatio = wmInteriorRect.getHeight()/pref.getHeight(); int hBump = worldmap.getWidth()-wmInteriorRect.width; int vBump = worldmap.getHeight()-wmInteriorRect.height; //bump a few pixels to avoid drawing on the border g2.drawRect((int)(visRect.x*hRatio)+hBump/2+visRect.x, (int)(visRect.y*vRatio)+vBump/2+(visRect.y + visRect.height - worldmap.getHeight()), (int)(visRect.width*hRatio), (int)(visRect.height*vRatio)); } //see if the user has right-clicked to popup some marker info if(popupDrawRect != null){ //dumb bug where little datasets popup the box in the wrong place int smallDatasetSlopH = 0; int smallDatasetSlopV = 0; if (pref.getHeight() < visRect.height){ smallDatasetSlopV = (int)(visRect.height - pref.getHeight())/2; } if (pref.getWidth() < visRect.width){ smallDatasetSlopH = (int)(visRect.width - pref.getWidth())/2; } g2.setColor(Color.white); g2.fillRect(popupDrawRect.x+1-smallDatasetSlopH, popupDrawRect.y+1-smallDatasetSlopV, popupDrawRect.width-1, popupDrawRect.height-1); g2.setColor(Color.black); g2.drawRect(popupDrawRect.x-smallDatasetSlopH, popupDrawRect.y-smallDatasetSlopV, popupDrawRect.width, popupDrawRect.height); g.setFont(popupFont); for (int x = 0; x < displayStrings.size(); x++){ g.drawString((String)displayStrings.elementAt(x),popupDrawRect.x + popupLeftMargin-smallDatasetSlopH, popupDrawRect.y+((x+1)*metrics.getHeight())-smallDatasetSlopV); } } //see if we're drawing a worldmap resize rect if (resizeWMRect != null){ g2.setColor(Color.black); g2.drawRect(resizeWMRect.x, resizeWMRect.y, resizeWMRect.width, resizeWMRect.height); } //see if we're drawing a block selector rect if (blockRect != null){ g2.setColor(Color.black); g2.setStroke(dashedThinStroke); g2.drawRect(blockRect.x, blockRect.y, blockRect.width, blockRect.height); } } |
lastModified = userConfigFile.lastModified(); | private UserManager(File userConfigFile){ try{ lastModified = userConfigFile.lastModified(); Document userConfig = new SAXBuilder().build(userConfigFile); users = loadUsers(userConfig); }catch(JDOMException jdEx){ logger.info("Error reading user info "+USER_CONFIG_FILE_NAME); jdEx.printStackTrace(); } } |
|
File userConfiguration = new File(USER_CONFIG_FILE_NAME); if(lastModified < userConfiguration.lastModified()){ userManager = new UserManager(userConfiguration); } | public static UserManager getInstance(){ File userConfiguration = new File(USER_CONFIG_FILE_NAME); if(lastModified < userConfiguration.lastModified()){ /* Refresh the cache */ userManager = new UserManager(userConfiguration); } return userManager; } |
|
assert user.getStatus() != null && (user.getStatus().equals(User.STATUS_ACTIVE) || user.getStatus().equals(User.STATUS_LOCKED)); | private void saveUser(){ try { Document doc = new Document(); Element rootElement = new Element(AuthConstants.JM_USERS); for(Iterator it=users.values().iterator(); it.hasNext();){ User user = (User)it.next(); /* create a user element */ Element userElement = new Element(AuthConstants.USER); userElement.setAttribute(AuthConstants.NAME, user.getUsername()); userElement.setAttribute(AuthConstants.PASSWORD, user.getPassword()); userElement.setAttribute(AuthConstants.STATUS, user.getStatus() != null ? user.getStatus() : User.STATUS_ACTIVE); userElement.setAttribute(AuthConstants.LOCK_COUNT, String.valueOf(user.getStatus() != null ? user.getLockCount() : 0)); /* add roles */ for(Iterator iterator = user.getRoles().iterator(); iterator.hasNext();){ Role role = (Role)iterator.next(); Element roleElement = new Element(AuthConstants.ROLE); roleElement.setText(role.getName()); userElement.addContent(roleElement); } rootElement.addContent(userElement); } doc.setRootElement(rootElement); /* write to the disc */ XMLOutputter writer = new XMLOutputter(); writer.output(doc, new FileOutputStream(AuthConstants.USER_CONFIG_FILE_NAME)); } catch (Exception e) { throw new RuntimeException(e); } } |
|
public QueryFulltextCriteria( QueryField field, String text ) { | public QueryFulltextCriteria( QueryField field ) { | public QueryFulltextCriteria( QueryField field, String text ) { this.field = field; this.text = text; } |
this.text = text; | public QueryFulltextCriteria( QueryField field, String text ) { this.field = field; this.text = text; } |
|
System.out.println( sql ); | log.debug( sql ); | public void setupQuery( Criteria crit ) { String sql = "MATCH(" + field.getName() + ") AGAINST('" + text + "')"; System.out.println( sql ); crit.addSql( sql ); System.out.println( "Added" ); } |
System.out.println( "Added" ); | log.debug( "Added" ); | public void setupQuery( Criteria crit ) { String sql = "MATCH(" + field.getName() + ") AGAINST('" + text + "')"; System.out.println( sql ); crit.addSql( sql ); System.out.println( "Added" ); } |
= new ProgressMonitor(null, | = new ProgressMonitor(this, | public synchronized void addObjects(List list, Point preferredLocation, ArchitectSwingWorker nextProcess) throws ArchitectException { ProgressMonitor pm = new ProgressMonitor(null, "Copying objects to the playpen", "...", 0, 100); AddObjectsTask t = new AddObjectsTask(list, preferredLocation, pm, null); t.setNextProcess(nextProcess); new Thread(t, "Objects-Adder").start(); } |
if (ignoreReset) { | if (playPenDatabase) { | protected void reset() { if (ignoreReset) { // preserve the objects that are in the Target system when // the connection spec changes logger.debug("Ignoring Reset request for: " + getDataSource()); populated = true; } else { // discard everything and reload (this is generally for source systems) logger.debug("Resetting: " + getDataSource() ); // tear down old connection stuff List old = children; if (old != null && old.size() > 0) { int[] oldIndices = new int[old.size()]; for (int i = 0, n = old.size(); i < n; i++) { oldIndices[i] = i; } fireDbChildrenRemoved(oldIndices, old); } children = new ArrayList(); populated = false; } // reset connection in either case if (connection != null) { try { connection.close(); } catch (SQLException e) { e.printStackTrace(); } } connection = null; } |
if (clickCol == COLUMN_INDEX_TITLE) { | if (clickCol == COLUMN_INDEX_TITLE && !ArchitectFrame.getMainInstance().createRelationshipIsActive()) { | public void mousePressed(MouseEvent evt) { evt.getComponent().requestFocus(); // make sure it was a left click? if ((evt.getModifiersEx() & MouseEvent.BUTTON1_DOWN_MASK) != 0) { TablePane tp = (TablePane) evt.getSource(); // dragging try { PlayPen pp = (PlayPen) tp.getPlayPen(); int clickCol = tp.pointToColumnIndex(evt.getPoint()); logger.debug("MP: clickCol="+clickCol+",columnsSize="+tp.model.getColumns().size()); if ( (evt.getModifiersEx() & (InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK)) == 0) { // 1. unconditionally de-select everything if this table is unselected // 2. if the table was selected, de-select everything if the click was not on the // column header of the table if (!tp.isSelected() || (clickCol > COLUMN_INDEX_TITLE && clickCol < tp.model.getColumns().size()) ) { pp.selectNone(); } } // re-select the table pane (fire new selection event when appropriate) tp.setSelected(true); // de-select columns if shift and ctrl were not pressed if ( (evt.getModifiersEx() & (InputEvent.SHIFT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK)) == 0) { tp.selectNone(); } // select current column unconditionally if (clickCol < tp.model.getColumns().size()) { tp.selectColumn(clickCol); } // handle drag if (clickCol == COLUMN_INDEX_TITLE) { Iterator it = getPlayPen().getSelectedTables().iterator(); logger.debug("event point: " + evt.getPoint()); logger.debug("zoomed event point: " + getPlayPen().zoomPoint(evt.getPoint())); while (it.hasNext()) { // create FloatingTableListener for each selected item TablePane t3 = (TablePane)it.next(); logger.debug("(" + t3.getModel().getTableName() + ") zoomed selected table point: " + t3.getLocationOnScreen()); logger.debug("(" + t3.getModel().getTableName() + ") unzoomed selected table point: " + getPlayPen().unzoomPoint(t3.getLocationOnScreen())); /* the floating table listener expects zoomed handles which are relative to the location of the table column which was clicked on. */ Point clickedColumn = tp.getLocationOnScreen(); Point otherTable = t3.getLocationOnScreen(); Point handle = getPlayPen().zoomPoint(new Point(evt.getPoint())); logger.debug("(" + t3.getModel().getTableName() + ") translation x=" + (otherTable.getX() - clickedColumn.getX()) + ",y=" + (otherTable.getY() - clickedColumn.getY())); handle.translate((int)(clickedColumn.getX() - otherTable.getX()), (int) (clickedColumn.getY() - otherTable.getY())); new PlayPen.FloatingTableListener(getPlayPen(), t3, handle); } } } catch (ArchitectException e) { logger.error("Exception converting point to column", e); } } maybeShowPopup(evt); } |
logger.info("Start Request Path:" + requestPath); | logger.fine("Start Request Path:" + requestPath); | protected ActionForward processActionPerform(HttpServletRequest request, HttpServletResponse response, Action action, ActionForm form, ActionMapping mapping) throws IOException, ServletException{ final String requestPath = mapping.getPath(); logger.info("Start Request Path:" + requestPath); ActionForward resultForward = null; try{ /* execute the action */ resultForward = action.execute(mapping, form, request, response); }catch (Exception e){ logger.log(Level.INFO, "Exception on Request: " + requestPath, e); /* process exception */ resultForward = processException(request, response, e, form, mapping); }finally{ String resultForwardPath = (resultForward == null) ? "none" : resultForward.getPath(); if(resultForwardPath == null){ /* the path attribute of resultForward was null */ resultForwardPath = "none"; } logger.info("End Request:" + requestPath + " Forward:" + resultForwardPath); } /* handle debug mode*/ resultForward = handleDebugMode(request, response, resultForward); return resultForward; } |
resultForward = action.execute(mapping, form, request, response); | resultForward = ensureLoggedIn(request, response, mapping); if(resultForward == null){ resultForward = action.execute(mapping, form, request, response); } | protected ActionForward processActionPerform(HttpServletRequest request, HttpServletResponse response, Action action, ActionForm form, ActionMapping mapping) throws IOException, ServletException{ final String requestPath = mapping.getPath(); logger.info("Start Request Path:" + requestPath); ActionForward resultForward = null; try{ /* execute the action */ resultForward = action.execute(mapping, form, request, response); }catch (Exception e){ logger.log(Level.INFO, "Exception on Request: " + requestPath, e); /* process exception */ resultForward = processException(request, response, e, form, mapping); }finally{ String resultForwardPath = (resultForward == null) ? "none" : resultForward.getPath(); if(resultForwardPath == null){ /* the path attribute of resultForward was null */ resultForwardPath = "none"; } logger.info("End Request:" + requestPath + " Forward:" + resultForwardPath); } /* handle debug mode*/ resultForward = handleDebugMode(request, response, resultForward); return resultForward; } |
logger.log(Level.INFO, "Exception on Request: " + requestPath, e); | logger.log(Level.FINE, "Exception on Request: " + requestPath, e); | protected ActionForward processActionPerform(HttpServletRequest request, HttpServletResponse response, Action action, ActionForm form, ActionMapping mapping) throws IOException, ServletException{ final String requestPath = mapping.getPath(); logger.info("Start Request Path:" + requestPath); ActionForward resultForward = null; try{ /* execute the action */ resultForward = action.execute(mapping, form, request, response); }catch (Exception e){ logger.log(Level.INFO, "Exception on Request: " + requestPath, e); /* process exception */ resultForward = processException(request, response, e, form, mapping); }finally{ String resultForwardPath = (resultForward == null) ? "none" : resultForward.getPath(); if(resultForwardPath == null){ /* the path attribute of resultForward was null */ resultForwardPath = "none"; } logger.info("End Request:" + requestPath + " Forward:" + resultForwardPath); } /* handle debug mode*/ resultForward = handleDebugMode(request, response, resultForward); return resultForward; } |
logger.info("End Request:" + requestPath + | logger.fine("End Request:" + requestPath + | protected ActionForward processActionPerform(HttpServletRequest request, HttpServletResponse response, Action action, ActionForm form, ActionMapping mapping) throws IOException, ServletException{ final String requestPath = mapping.getPath(); logger.info("Start Request Path:" + requestPath); ActionForward resultForward = null; try{ /* execute the action */ resultForward = action.execute(mapping, form, request, response); }catch (Exception e){ logger.log(Level.INFO, "Exception on Request: " + requestPath, e); /* process exception */ resultForward = processException(request, response, e, form, mapping); }finally{ String resultForwardPath = (resultForward == null) ? "none" : resultForward.getPath(); if(resultForwardPath == null){ /* the path attribute of resultForward was null */ resultForwardPath = "none"; } logger.info("End Request:" + requestPath + " Forward:" + resultForwardPath); } /* handle debug mode*/ resultForward = handleDebugMode(request, response, resultForward); return resultForward; } |
logger.debug("Columns removed. Syncing select/highlight lists. Removed indices="+Arrays.asList(ci)); | public void dbChildrenRemoved(SQLObjectEvent e) { if (e.getSource() == this.model.getColumnsFolder()) { int ci[] = e.getChangedIndices(); for (int i = 0; i < ci.length; i++) { columnSelection.remove(ci[i]); columnHighlight.remove(ci[i]); } if (columnSelection.size() > 0) { selectNone(); columnSelection.set(Math.min(ci[0], columnSelection.size()-1), Boolean.TRUE); } } try { ArchitectUtils.unlistenToHierarchy(this, e.getChildren()); if (columnSelection.size() != this.model.getColumns().size()) { logger.error("Repairing out-of-sync selection list: selection="+columnSelection+"; children="+this.model.getColumns()); columnSelection = new ArrayList(); for (int j = 0; j < model.getColumns().size(); j++) { columnSelection.add(Boolean.FALSE); } } if (columnHighlight.size() != this.model.getColumns().size()) { logger.error("Repairing out-of-sync highlight list: highlights="+columnHighlight+"; children="+this.model.getColumns()); columnHighlight = new ArrayList(); for (int j = 0; j < model.getColumns().size(); j++) { columnHighlight.add(null); } } } catch (ArchitectException ex) { logger.error("Couldn't remove children", ex); JOptionPane.showMessageDialog(getPlayPen(), "Couldn't delete column: "+ex.getMessage()); } firePropertyChange("model.children", null, null); revalidate(); } |
|
dbcsPanel.applyChanges(); DBConnectionSpec dbcs = dbcsPanel.getDbcs(); ASUtils.LabelValueBean connLvb = ASUtils.lvb(dbcs.getDisplayName(), dbcs); connectionsBox.addItem(connLvb); connectionsBox.setSelectedItem(connLvb); ArchitectFrame.getMainInstance().getUserSettings().getConnections().add(dbcs); d.setVisible(false); | if (PLUtils.plDotIniHasChanged(plDotIniPath)) { SwingUtilities.invokeLater(new Runnable() { public void run() { refreshPlOdbcTargets(); | public void actionPerformed(ActionEvent evt) { dbcsPanel.applyChanges(); DBConnectionSpec dbcs = dbcsPanel.getDbcs(); ASUtils.LabelValueBean connLvb = ASUtils.lvb(dbcs.getDisplayName(), dbcs); connectionsBox.addItem(connLvb); connectionsBox.setSelectedItem(connLvb); ArchitectFrame.getMainInstance().getUserSettings().getConnections().add(dbcs); d.setVisible(false); } |
}); } } | public void actionPerformed(ActionEvent evt) { dbcsPanel.applyChanges(); DBConnectionSpec dbcs = dbcsPanel.getDbcs(); ASUtils.LabelValueBean connLvb = ASUtils.lvb(dbcs.getDisplayName(), dbcs); connectionsBox.addItem(connLvb); connectionsBox.setSelectedItem(connLvb); ArchitectFrame.getMainInstance().getUserSettings().getConnections().add(dbcs); d.setVisible(false); } |
|
plUserName.setText(null); plPassword.setText(null); | public void actionPerformed(ActionEvent e) { ASUtils.LabelValueBean lvb = (ASUtils.LabelValueBean) plOdbcTargetRepositoryBox.getSelectedItem(); if (lvb.getValue() == null) { runPLEngine.setSelected(false); runPLEngine.setEnabled(false); plRepOwner.setText(null); } else { runPLEngine.setEnabled(true); PLConnectionSpec pldbcon = (PLConnectionSpec) lvb.getValue(); plRepOwner.setText(pldbcon.getPlsOwner()); plUserName.setText(pldbcon.getUid()); plPassword.setText(pldbcon.getPwd()); } } |
|
String plIniPath = af.getUserSettings().getETLUserSettings().getPlDotIniPath(); List plConnectionSpecs = new ArrayList(); try { if (plIniPath != null) { plConnectionSpecs = PLUtils.parsePlDotIni(plIniPath); } else { JOptionPane.showMessageDialog (this, "Warning: You have not set the PL.INI file location." +"\nThe list of PL Connections will be empty."); } } catch (FileNotFoundException ie) { JOptionPane.showMessageDialog (this, "PL database config file not found in specified path:\n" +plIniPath+"\nThe list of PL Connections will be empty."); } catch (IOException ie){ JOptionPane.showMessageDialog(this, "Error reading PL.ini file "+plIniPath +"\nThe list of PL Connections will be empty."); } | public PLExportPanel() { setLayout(new GridLayout(1,2)); ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); projName = new String(project.getName()); newConnButton= new JButton("New"); newConnButton.addActionListener(new NewConnectionListener()); String plIniPath = af.getUserSettings().getETLUserSettings().getPlDotIniPath(); List plConnectionSpecs = new ArrayList(); try { if (plIniPath != null) { plConnectionSpecs = PLUtils.parsePlDotIni(plIniPath); } else { JOptionPane.showMessageDialog (this, "Warning: You have not set the PL.INI file location." +"\nThe list of PL Connections will be empty."); } } catch (FileNotFoundException ie) { JOptionPane.showMessageDialog (this, "PL database config file not found in specified path:\n" +plIniPath+"\nThe list of PL Connections will be empty."); } catch (IOException ie){ JOptionPane.showMessageDialog(this, "Error reading PL.ini file "+plIniPath +"\nThe list of PL Connections will be empty."); } connections = new Vector(); connections.add(ASUtils.lvb("(Select Architect Connection)", null)); Iterator it = af.getUserSettings().getConnections().iterator(); while (it.hasNext()) { DBConnectionSpec spec = (DBConnectionSpec) it.next(); connections.add(ASUtils.lvb(spec.getDisplayName(), spec)); } connectionsBox = new JComboBox(connections); plodbc = new Vector(); plodbc.add(ASUtils.lvb("(Select PL ODBC Connection)", null)); it = plConnectionSpecs.iterator(); while (it.hasNext()) { PLConnectionSpec plcon = (PLConnectionSpec) it.next(); plodbc.add(ASUtils.lvb(plcon.getLogical(), plcon)); } plOdbcTargetRepositoryBox = new JComboBox(plodbc); plOdbcTargetRepositoryBox.addActionListener(new OdbcTargetRepositoryListener()); runPLEngine = new JCheckBox(); runPLEngine.setEnabled(false); JPanel jdbcPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); jdbcPanel.add(connectionsBox); jdbcPanel.add(newConnButton); JComponent[] jdbcFields = new JComponent[] {jdbcPanel, plRepOwner = new JTextField(), plFolderName = new JTextField(), plJobId = new JTextField(), plJobDescription = new JTextField(), plJobComment = new JTextField(), plOutputTableOwner = new JTextField()}; String[] jdbcLabels = new String[] {"Architect Connection Name", "PL Repository Owner", "PL Folder Name", "PL Job Id", "PL Job Description", "PL Job Comment", "Target Schema Owner"}; char[] jdbcMnemonics = new char[] {'t', 'r', 'f', 'i', 'd', 'c', 'o'}; int[] jdbcWidths = new int[] {18, 18, 18, 18, 18, 18, 18, 18,10}; String[] jdbcTips = new String[] {"Target database and PL repository", "Owner of PL Repository", "The folder name for transactions", "The Job unique Id", "The Job Description", "Comment about the Job", "Owner (Schema) for output transaction tables"}; TextPanel jdbcForm = new TextPanel(jdbcFields, jdbcLabels, jdbcMnemonics, jdbcWidths, jdbcTips); JComponent[] engineFields = new JComponent[] {plOdbcTargetRepositoryBox, plUserName = new JTextField(), plPassword = new JPasswordField(), runPLEngine}; String[] engineLabels = new String[] {"PL.INI Logical Database Name", "PL User Name", "PL Password", "Run Engine"}; char[] engineMnemonics = new char[] {'l', 'u', 'p', 'e'}; int[] engineWidths = new int[] {18, 18, 18, 10}; String[] engineTips = new String[] {"ODBC Source Name connection for PL", "PowerLoader User Name", "PowerLoader Password", "Run PL Engine immediately?"}; TextPanel engineForm = new TextPanel(engineFields, engineLabels, engineMnemonics, engineWidths, engineTips); add(jdbcForm); add(engineForm); } |
|
plodbc = new Vector(); plodbc.add(ASUtils.lvb("(Select PL ODBC Connection)", null)); it = plConnectionSpecs.iterator(); while (it.hasNext()) { PLConnectionSpec plcon = (PLConnectionSpec) it.next(); plodbc.add(ASUtils.lvb(plcon.getLogical(), plcon)); } plOdbcTargetRepositoryBox = new JComboBox(plodbc); | plOdbcTargetRepositoryBox = new JComboBox(new DefaultComboBoxModel(getPlOdbcTargets())); | public PLExportPanel() { setLayout(new GridLayout(1,2)); ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); projName = new String(project.getName()); newConnButton= new JButton("New"); newConnButton.addActionListener(new NewConnectionListener()); String plIniPath = af.getUserSettings().getETLUserSettings().getPlDotIniPath(); List plConnectionSpecs = new ArrayList(); try { if (plIniPath != null) { plConnectionSpecs = PLUtils.parsePlDotIni(plIniPath); } else { JOptionPane.showMessageDialog (this, "Warning: You have not set the PL.INI file location." +"\nThe list of PL Connections will be empty."); } } catch (FileNotFoundException ie) { JOptionPane.showMessageDialog (this, "PL database config file not found in specified path:\n" +plIniPath+"\nThe list of PL Connections will be empty."); } catch (IOException ie){ JOptionPane.showMessageDialog(this, "Error reading PL.ini file "+plIniPath +"\nThe list of PL Connections will be empty."); } connections = new Vector(); connections.add(ASUtils.lvb("(Select Architect Connection)", null)); Iterator it = af.getUserSettings().getConnections().iterator(); while (it.hasNext()) { DBConnectionSpec spec = (DBConnectionSpec) it.next(); connections.add(ASUtils.lvb(spec.getDisplayName(), spec)); } connectionsBox = new JComboBox(connections); plodbc = new Vector(); plodbc.add(ASUtils.lvb("(Select PL ODBC Connection)", null)); it = plConnectionSpecs.iterator(); while (it.hasNext()) { PLConnectionSpec plcon = (PLConnectionSpec) it.next(); plodbc.add(ASUtils.lvb(plcon.getLogical(), plcon)); } plOdbcTargetRepositoryBox = new JComboBox(plodbc); plOdbcTargetRepositoryBox.addActionListener(new OdbcTargetRepositoryListener()); runPLEngine = new JCheckBox(); runPLEngine.setEnabled(false); JPanel jdbcPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); jdbcPanel.add(connectionsBox); jdbcPanel.add(newConnButton); JComponent[] jdbcFields = new JComponent[] {jdbcPanel, plRepOwner = new JTextField(), plFolderName = new JTextField(), plJobId = new JTextField(), plJobDescription = new JTextField(), plJobComment = new JTextField(), plOutputTableOwner = new JTextField()}; String[] jdbcLabels = new String[] {"Architect Connection Name", "PL Repository Owner", "PL Folder Name", "PL Job Id", "PL Job Description", "PL Job Comment", "Target Schema Owner"}; char[] jdbcMnemonics = new char[] {'t', 'r', 'f', 'i', 'd', 'c', 'o'}; int[] jdbcWidths = new int[] {18, 18, 18, 18, 18, 18, 18, 18,10}; String[] jdbcTips = new String[] {"Target database and PL repository", "Owner of PL Repository", "The folder name for transactions", "The Job unique Id", "The Job Description", "Comment about the Job", "Owner (Schema) for output transaction tables"}; TextPanel jdbcForm = new TextPanel(jdbcFields, jdbcLabels, jdbcMnemonics, jdbcWidths, jdbcTips); JComponent[] engineFields = new JComponent[] {plOdbcTargetRepositoryBox, plUserName = new JTextField(), plPassword = new JPasswordField(), runPLEngine}; String[] engineLabels = new String[] {"PL.INI Logical Database Name", "PL User Name", "PL Password", "Run Engine"}; char[] engineMnemonics = new char[] {'l', 'u', 'p', 'e'}; int[] engineWidths = new int[] {18, 18, 18, 10}; String[] engineTips = new String[] {"ODBC Source Name connection for PL", "PowerLoader User Name", "PowerLoader Password", "Run PL Engine immediately?"}; TextPanel engineForm = new TextPanel(engineFields, engineLabels, engineMnemonics, engineWidths, engineTips); add(jdbcForm); add(engineForm); } |
timer = new javax.swing.Timer(1000, new ActionListener() { public void actionPerformed(ActionEvent evt) { if (PLUtils.plDotIniHasChanged(plDotIniPath)) { SwingUtilities.invokeLater(new Runnable() { public void run() { refreshPlOdbcTargets(); } }); } } }); timer.start(); | public PLExportPanel() { setLayout(new GridLayout(1,2)); ArchitectFrame af = ArchitectFrame.getMainInstance(); SwingUIProject project = af.getProject(); projName = new String(project.getName()); newConnButton= new JButton("New"); newConnButton.addActionListener(new NewConnectionListener()); String plIniPath = af.getUserSettings().getETLUserSettings().getPlDotIniPath(); List plConnectionSpecs = new ArrayList(); try { if (plIniPath != null) { plConnectionSpecs = PLUtils.parsePlDotIni(plIniPath); } else { JOptionPane.showMessageDialog (this, "Warning: You have not set the PL.INI file location." +"\nThe list of PL Connections will be empty."); } } catch (FileNotFoundException ie) { JOptionPane.showMessageDialog (this, "PL database config file not found in specified path:\n" +plIniPath+"\nThe list of PL Connections will be empty."); } catch (IOException ie){ JOptionPane.showMessageDialog(this, "Error reading PL.ini file "+plIniPath +"\nThe list of PL Connections will be empty."); } connections = new Vector(); connections.add(ASUtils.lvb("(Select Architect Connection)", null)); Iterator it = af.getUserSettings().getConnections().iterator(); while (it.hasNext()) { DBConnectionSpec spec = (DBConnectionSpec) it.next(); connections.add(ASUtils.lvb(spec.getDisplayName(), spec)); } connectionsBox = new JComboBox(connections); plodbc = new Vector(); plodbc.add(ASUtils.lvb("(Select PL ODBC Connection)", null)); it = plConnectionSpecs.iterator(); while (it.hasNext()) { PLConnectionSpec plcon = (PLConnectionSpec) it.next(); plodbc.add(ASUtils.lvb(plcon.getLogical(), plcon)); } plOdbcTargetRepositoryBox = new JComboBox(plodbc); plOdbcTargetRepositoryBox.addActionListener(new OdbcTargetRepositoryListener()); runPLEngine = new JCheckBox(); runPLEngine.setEnabled(false); JPanel jdbcPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); jdbcPanel.add(connectionsBox); jdbcPanel.add(newConnButton); JComponent[] jdbcFields = new JComponent[] {jdbcPanel, plRepOwner = new JTextField(), plFolderName = new JTextField(), plJobId = new JTextField(), plJobDescription = new JTextField(), plJobComment = new JTextField(), plOutputTableOwner = new JTextField()}; String[] jdbcLabels = new String[] {"Architect Connection Name", "PL Repository Owner", "PL Folder Name", "PL Job Id", "PL Job Description", "PL Job Comment", "Target Schema Owner"}; char[] jdbcMnemonics = new char[] {'t', 'r', 'f', 'i', 'd', 'c', 'o'}; int[] jdbcWidths = new int[] {18, 18, 18, 18, 18, 18, 18, 18,10}; String[] jdbcTips = new String[] {"Target database and PL repository", "Owner of PL Repository", "The folder name for transactions", "The Job unique Id", "The Job Description", "Comment about the Job", "Owner (Schema) for output transaction tables"}; TextPanel jdbcForm = new TextPanel(jdbcFields, jdbcLabels, jdbcMnemonics, jdbcWidths, jdbcTips); JComponent[] engineFields = new JComponent[] {plOdbcTargetRepositoryBox, plUserName = new JTextField(), plPassword = new JPasswordField(), runPLEngine}; String[] engineLabels = new String[] {"PL.INI Logical Database Name", "PL User Name", "PL Password", "Run Engine"}; char[] engineMnemonics = new char[] {'l', 'u', 'p', 'e'}; int[] engineWidths = new int[] {18, 18, 18, 10}; String[] engineTips = new String[] {"ODBC Source Name connection for PL", "PowerLoader User Name", "PowerLoader Password", "Run PL Engine immediately?"}; TextPanel engineForm = new TextPanel(engineFields, engineLabels, engineMnemonics, engineWidths, engineTips); add(jdbcForm); add(engineForm); } |
|
plLastReadTimestamp = new Date(inputFile.lastModified()); | public static List parsePlDotIni(String plDotIniPath) throws FileNotFoundException, IOException { List plSpecs = new ArrayList(); PLConnectionSpec currentSpec = null; File inputFile = new File(plDotIniPath); BufferedReader in = new BufferedReader(new FileReader(inputFile)); String line = null; while ((line = in.readLine()) != null) { if (line.startsWith("[Databases")) { currentSpec = new PLConnectionSpec(); plSpecs.add(currentSpec); } else if (currentSpec != null) { int equalsIdx = line.indexOf('='); if (equalsIdx > 0) { String key = line.substring(0, equalsIdx); String value = line.substring(equalsIdx+1, line.length()); currentSpec.setProperty(key, value); } else { logger.debug("pl.ini entry lacks = sign: "+line); } } else { logger.debug("Skipping "+line); } } in.close(); return plSpecs; } |
|
if (checkPanel.changed){ | if (checkPanel != null && checkPanel.changed){ | public void stateChanged(ChangeEvent e) { viewMenuItems[tabs.getSelectedIndex()].setSelected(true); if (checkPanel.changed){ window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); JTable table = checkPanel.getTable(); boolean[] markerResults = new boolean[table.getRowCount()]; for (int i = 0; i < table.getRowCount(); i++){ markerResults[i] = ((Boolean)table.getValueAt(i,7)).booleanValue(); } int count = 0; for (int i = 0; i < Chromosome.getSize(); i++){ if (markerResults[i]){ count++; } } Chromosome.realIndex = new int[count]; int k = 0; for (int i =0; i < Chromosome.getSize(); i++){ if (markerResults[i]){ Chromosome.realIndex[k] = i; k++; } } dPrimeDisplay.dPrimeTable = theData.getFilteredTable(theData.dPrimeTable); theData.guessBlocks(currentBlockDef); dPrimeDisplay.refreshBlocks(theData.blocks); //hack-y way to refresh the image dPrimeDisplay.setVisible(false); dPrimeDisplay.setVisible(true); hapDisplay.theData = theData; try{ hapDisplay.getHaps(); }catch(HaploViewException hv){ JOptionPane.showMessageDialog(window, hv.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); checkPanel.changed=false; } } |
List objectNameList = (List)domainToObjectNameListMap.get(domain); | Set objectNameList = (Set)domainToObjectNameListMap.get(domain); | public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { MBeanQueryForm queryForm = (MBeanQueryForm)actionForm; final String queryObjectName = queryForm.getObjectName(); ServerConnection serverConnection = context.getServerConnection(); // TODO: change to use queryNames Set mbeans = serverConnection.queryObjects(new ObjectName(queryObjectName)); Map domainToObjectNameListMap = new TreeMap(); ObjectNameTuple tuple = new ObjectNameTuple(); for(Iterator it=mbeans.iterator(); it.hasNext();){ ObjectInstance oi = (ObjectInstance)it.next(); tuple.setObjectName(oi.getObjectName()); String domain = tuple.getDomain(); String name = tuple.getName(); List objectNameList = (List)domainToObjectNameListMap.get(domain); if(objectNameList == null){ objectNameList = new LinkedList(); domainToObjectNameListMap.put(domain, objectNameList); } objectNameList.add(name); } request.setAttribute("domainToObjectNameListMap", domainToObjectNameListMap); return mapping.findForward(Forwards.SUCCESS); } |
objectNameList = new LinkedList(); | objectNameList = new TreeSet(); | public ActionForward execute(WebContext context, ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws Exception { MBeanQueryForm queryForm = (MBeanQueryForm)actionForm; final String queryObjectName = queryForm.getObjectName(); ServerConnection serverConnection = context.getServerConnection(); // TODO: change to use queryNames Set mbeans = serverConnection.queryObjects(new ObjectName(queryObjectName)); Map domainToObjectNameListMap = new TreeMap(); ObjectNameTuple tuple = new ObjectNameTuple(); for(Iterator it=mbeans.iterator(); it.hasNext();){ ObjectInstance oi = (ObjectInstance)it.next(); tuple.setObjectName(oi.getObjectName()); String domain = tuple.getDomain(); String name = tuple.getName(); List objectNameList = (List)domainToObjectNameListMap.get(domain); if(objectNameList == null){ objectNameList = new LinkedList(); domainToObjectNameListMap.put(domain, objectNameList); } objectNameList.add(name); } request.setAttribute("domainToObjectNameListMap", domainToObjectNameListMap); return mapping.findForward(Forwards.SUCCESS); } |
openProjectAction = new AbstractAction("Open Project...", ASUtils.createJLFIcon("general/Open", "Open Project", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { if (promptForUnsavedModifications()) { JFileChooser chooser = new JFileChooser(); chooser.addChoosableFileFilter(ASUtils.ARCHITECT_FILE_FILTER); int returnVal = chooser.showOpenDialog(ArchitectFrame.this); if (returnVal == JFileChooser.APPROVE_OPTION) { final File file = chooser.getSelectedFile(); new Thread() { public void run() { InputStream in = null; try { closeProject(getProject()); SwingUIProject project = new SwingUIProject("Loading..."); project.setFile(file); in = new BufferedInputStream (new ProgressMonitorInputStream (ArchitectFrame.this, "Reading " + file.getName(), new FileInputStream(file))); project.load(in); setProject(project); } catch (Exception ex) { JOptionPane.showMessageDialog (ArchitectFrame.this, "Can't open project: "+ex.getMessage()); logger.error("Got exception while opening project", ex); } finally { try { if (in != null) { in.close(); } } catch (IOException ie) { logger.error("got exception while closing project file", ie); } } } }.start(); } } } }; openProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Open"); openProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O, accelMask)); | openProjectAction = new OpenProjectAction(); | protected void init() throws ArchitectException { int accelMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(); UserSettings us; // must be done right away, because a static // initializer in this class effects BeanUtils // behaviour which the XML Digester relies // upon heavily //TypeMap.getInstance(); contentPane = (JComponent)getContentPane(); try { ConfigFile cf = ConfigFile.getDefaultInstance(); us = cf.read(); architectSession.setUserSettings(us); sprefs = architectSession.getUserSettings().getSwingSettings(); } catch (IOException e) { throw new ArchitectException("prefs.read", e); } while (us.getPlDotIni() == null) { String message; String[] options = new String[] {"Browse", "Create"}; if (us.getPlDotIniPath() == null) { message = "location is not set"; } else if (new File(us.getPlDotIniPath()).isFile()) { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n could not be read"; } else { message = "file \n\n\""+us.getPlDotIniPath()+"\"\n\n does not exist"; } int choice = JOptionPane.showOptionDialog(null, "The Architect keeps its list of database connections" + "\nin a file called PL.INI. Your PL.INI "+message+"." + "\n\nYou can browse for an existing PL.INI file on your system" + "\nor allow the Architect to create a new one in your home directory." + "\n\nHint: If you are a Power*Loader Suite user, you should browse for" + "\nan existing PL.INI in your Power*Loader installation directory.", "Missing PL.INI", 0, JOptionPane.INFORMATION_MESSAGE, null, options, null); File newPlIniFile; if (choice == 0) { JFileChooser fc = new JFileChooser(); fc.setFileFilter(ASUtils.INI_FILE_FILTER); fc.setDialogTitle("Locate your PL.INI file"); int fcChoice = fc.showOpenDialog(null); if (fcChoice == JFileChooser.APPROVE_OPTION) { newPlIniFile = fc.getSelectedFile(); } else { newPlIniFile = null; } } else { newPlIniFile = new File(System.getProperty("user.home"), "pl.ini"); } if (newPlIniFile != null) try { newPlIniFile.createNewFile(); us.setPlDotIniPath(newPlIniFile.getPath()); } catch (IOException e1) { logger.error("Caught IO exception while creating empty PL.INI at \"" +newPlIniFile.getPath()+"\"", e1); JOptionPane.showMessageDialog(null, "Failed to create file \""+newPlIniFile.getPath()+"\":\n"+e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } // Create actions aboutAction = new AboutAction(); newProjectAction = new AbstractAction("New Project", ASUtils.createJLFIcon("general/New","New Project",sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { if (promptForUnsavedModifications()) { try { closeProject(getProject()); setProject(new SwingUIProject("New Project")); logger.debug("Glass pane is "+getGlassPane()); getGlassPane().setVisible(true); } catch (Exception ex) { JOptionPane.showMessageDialog(ArchitectFrame.this, "Can't create new project: "+ex.getMessage()); logger.error("Got exception while creating new project", ex); } } } }; newProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "New"); newProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_N, accelMask)); openProjectAction = new AbstractAction("Open Project...", ASUtils.createJLFIcon("general/Open", "Open Project", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { if (promptForUnsavedModifications()) { JFileChooser chooser = new JFileChooser(); chooser.addChoosableFileFilter(ASUtils.ARCHITECT_FILE_FILTER); int returnVal = chooser.showOpenDialog(ArchitectFrame.this); if (returnVal == JFileChooser.APPROVE_OPTION) { final File file = chooser.getSelectedFile(); new Thread() { public void run() { InputStream in = null; try { closeProject(getProject()); SwingUIProject project = new SwingUIProject("Loading..."); project.setFile(file); in = new BufferedInputStream (new ProgressMonitorInputStream (ArchitectFrame.this, "Reading " + file.getName(), new FileInputStream(file))); project.load(in); setProject(project); } catch (Exception ex) { JOptionPane.showMessageDialog (ArchitectFrame.this, "Can't open project: "+ex.getMessage()); logger.error("Got exception while opening project", ex); } finally { try { if (in != null) { in.close(); } } catch (IOException ie) { logger.error("got exception while closing project file", ie); } } } }.start(); } } } }; openProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Open"); openProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O, accelMask)); saveProjectAction = new AbstractAction("Save Project", ASUtils.createJLFIcon("general/Save", "Save Project", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(false, true); } }; saveProjectAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save"); saveProjectAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, accelMask)); saveProjectAsAction = new AbstractAction("Save Project As...", ASUtils.createJLFIcon("general/SaveAs", "Save Project As...", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { saveOrSaveAs(true, true); } }; saveProjectAsAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Save As"); prefAction = new PreferencesAction(); projectSettingsAction = new ProjectSettingsAction(); projectSettingsAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_COMMA, accelMask)); printAction = new PrintAction(); printAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_P, accelMask)); zoomInAction = new ZoomAction(ZOOM_STEP); zoomOutAction = new ZoomAction(ZOOM_STEP * -1.0); zoomNormalAction = new AbstractAction("Reset Zoom", ASUtils.createJLFIcon("general/Zoom", "Reset Zoom", sprefs.getInt(SwingUserSettings.ICON_SIZE, 24))) { public void actionPerformed(ActionEvent e) { playpen.setZoom(1.0); } }; zoomNormalAction.putValue(AbstractAction.SHORT_DESCRIPTION, "Reset Zoom"); undoAction = new UndoAction(); redoAction = new RedoAction(); autoLayoutAction = new AutoLayoutAction(); autoLayout = new FruchtermanReingoldForceLayout(); autoLayoutAction.setLayout(autoLayout); exportDDLAction = new ExportDDLAction(); compareDMAction = new CompareDMAction(); exportPLTransAction = new ExportPLTransAction(); quickStartAction = new QuickStartAction(); deleteSelectedAction = new DeleteSelectedAction(); createIdentifyingRelationshipAction = new CreateRelationshipAction(true); createNonIdentifyingRelationshipAction = new CreateRelationshipAction(false); editRelationshipAction = new EditRelationshipAction(); createTableAction = new CreateTableAction(); editColumnAction = new EditColumnAction(); insertColumnAction = new InsertColumnAction(); editTableAction = new EditTableAction(); searchReplaceAction = new SearchReplaceAction(); searchReplaceAction.putValue(AbstractAction.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F, accelMask)); menuBar = new JMenuBar(); //Settingup JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic('f'); fileMenu.add(new JMenuItem(newProjectAction)); fileMenu.add(new JMenuItem(openProjectAction)); fileMenu.add(new JMenuItem(saveProjectAction)); fileMenu.add(new JMenuItem(saveProjectAsAction)); fileMenu.add(new JMenuItem(printAction)); fileMenu.add(new JMenuItem(prefAction)); fileMenu.add(new JMenuItem(projectSettingsAction)); fileMenu.add(new JMenuItem(saveSettingsAction)); fileMenu.add(new JMenuItem(exitAction)); menuBar.add(fileMenu); JMenu editMenu = new JMenu("Edit"); editMenu.setMnemonic('e'); editMenu.add(undoAction); editMenu.add(redoAction); editMenu.addSeparator(); editMenu.add(new JMenuItem(searchReplaceAction)); menuBar.add(editMenu); // the connections menu is set up when a new project is created (because it depends on the current DBTree) connectionsMenu = new JMenu("Connections"); connectionsMenu.setMnemonic('c'); menuBar.add(connectionsMenu); JMenu etlMenu = new JMenu("ETL"); etlMenu.setMnemonic('l'); JMenu etlSubmenuOne = new JMenu("Power*Loader"); etlSubmenuOne.add(new JMenuItem(exportPLTransAction)); etlSubmenuOne.add(new JMenuItem("PL Transaction File Export")); etlSubmenuOne.add(new JMenuItem("Run Power*Loader")); etlSubmenuOne.add(new JMenuItem(quickStartAction)); etlMenu.add(etlSubmenuOne); menuBar.add(etlMenu); JMenu toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic('t'); toolsMenu.add(new JMenuItem(exportDDLAction)); toolsMenu.add(new JMenuItem(compareDMAction)); menuBar.add(toolsMenu); JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic('h'); helpMenu.add(new JMenuItem(aboutAction)); menuBar.add(helpMenu); setJMenuBar(menuBar); projectBar = new JToolBar(JToolBar.HORIZONTAL); ppBar = new JToolBar(JToolBar.VERTICAL); projectBar.add(newProjectAction); projectBar.add(openProjectAction); projectBar.add(saveProjectAction); projectBar.addSeparator(); projectBar.add(printAction); projectBar.addSeparator(); projectBar.add(undoAction); projectBar.add(redoAction); projectBar.addSeparator(); projectBar.add(exportDDLAction); projectBar.addSeparator(); projectBar.add(compareDMAction); projectBar.addSeparator(); projectBar.add(autoLayoutAction); JButton tempButton = null; // shared actions need to report where they are coming from ppBar.add(zoomInAction); ppBar.add(zoomOutAction); ppBar.add(zoomNormalAction); ppBar.addSeparator(); tempButton = ppBar.add(deleteSelectedAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(createTableAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); tempButton = ppBar.add(insertColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); tempButton = ppBar.add(editColumnAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); ppBar.addSeparator(); ppBar.add(createNonIdentifyingRelationshipAction); ppBar.add(createIdentifyingRelationshipAction); tempButton = ppBar.add(editRelationshipAction); tempButton.setActionCommand(ArchitectSwingConstants.ACTION_COMMAND_SRC_PLAYPEN); Container projectBarPane = getContentPane(); projectBarPane.setLayout(new BorderLayout()); projectBarPane.add(projectBar, BorderLayout.NORTH); JPanel cp = new JPanel(new BorderLayout()); cp.add(ppBar, BorderLayout.EAST); projectBarPane.add(cp, BorderLayout.CENTER); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); cp.add(splitPane, BorderLayout.CENTER); logger.debug("Added splitpane to content pane"); splitPane.setDividerLocation (sprefs.getInt(SwingUserSettings.DIVIDER_LOCATION, 150)); //dbTree.getPreferredSize().width)); Rectangle bounds = new Rectangle(); bounds.x = sprefs.getInt(SwingUserSettings.MAIN_FRAME_X, 40); bounds.y = sprefs.getInt(SwingUserSettings.MAIN_FRAME_Y, 40); bounds.width = sprefs.getInt(SwingUserSettings.MAIN_FRAME_WIDTH, 600); bounds.height = sprefs.getInt(SwingUserSettings.MAIN_FRAME_HEIGHT, 440); setBounds(bounds); addWindowListener(afWindowListener = new ArchitectFrameWindowListener()); setProject(new SwingUIProject("New Project")); } |
if (promptForUnsavedModifications()) { JFileChooser chooser = new JFileChooser(); chooser.addChoosableFileFilter(ASUtils.ARCHITECT_FILE_FILTER); int returnVal = chooser.showOpenDialog(ArchitectFrame.this); if (returnVal == JFileChooser.APPROVE_OPTION) { final File file = chooser.getSelectedFile(); new Thread() { public void run() { InputStream in = null; try { closeProject(getProject()); SwingUIProject project = new SwingUIProject("Loading..."); project.setFile(file); in = new BufferedInputStream (new ProgressMonitorInputStream (ArchitectFrame.this, "Reading " + file.getName(), new FileInputStream(file))); project.load(in); setProject(project); } catch (Exception ex) { JOptionPane.showMessageDialog (ArchitectFrame.this, "Can't open project: "+ex.getMessage()); logger.error("Got exception while opening project", ex); } finally { try { if (in != null) { in.close(); } } catch (IOException ie) { logger.error("got exception while closing project file", ie); } } } }.start(); } } | saveOrSaveAs(false, true); | public void actionPerformed(ActionEvent e) { if (promptForUnsavedModifications()) { JFileChooser chooser = new JFileChooser(); chooser.addChoosableFileFilter(ASUtils.ARCHITECT_FILE_FILTER); int returnVal = chooser.showOpenDialog(ArchitectFrame.this); if (returnVal == JFileChooser.APPROVE_OPTION) { final File file = chooser.getSelectedFile(); new Thread() { public void run() { InputStream in = null; try { closeProject(getProject()); SwingUIProject project = new SwingUIProject("Loading..."); project.setFile(file); in = new BufferedInputStream (new ProgressMonitorInputStream (ArchitectFrame.this, "Reading " + file.getName(), new FileInputStream(file))); project.load(in); setProject(project); } catch (Exception ex) { JOptionPane.showMessageDialog (ArchitectFrame.this, "Can't open project: "+ex.getMessage()); logger.error("Got exception while opening project", ex); } finally { try { if (in != null) { in.close(); } } catch (IOException ie) { logger.error("got exception while closing project file", ie); } } } }.start(); } } } |
saveOrSaveAs(false, true); | playpen.setZoom(1.0); | public void actionPerformed(ActionEvent e) { saveOrSaveAs(false, true); } |
db.disconnect(); | protected void tearDown() throws Exception { db.disconnect(); db = null; } |
|
if ( dataSource != null ) { log.info( "Setting data source to: " + dataSource + " of type: " + dataSource.getClass() ); } else { log.info( "Setting data source to: " + dataSource ); } | public void setDataSource(Object dataSource) { if ( dataSource != null ) { log.info( "Setting data source to: " + dataSource + " of type: " + dataSource.getClass() ); } else { log.info( "Setting data source to: " + dataSource ); } this.rawDataSource = dataSource; this.dataSourceSpecified = true; } |
|
if (returnStrings[1].equals("")) returnStrings[1] = null; | public void actionPerformed(ActionEvent e) { String command = e.getActionCommand(); if (command==RAW_DATA){ load(PED); }else if (command == PHASED_DATA){ load(HAPS); }else if (command == HAPMAP_DATA){ load(HMP); }else if (command == BROWSE_GENO){ browse(GENO); }else if (command == BROWSE_INFO){ browse(INFO); }else if (command == "OK"){ HaploView caller = (HaploView)this.getParent(); if (doTDT.isSelected()){ if (trioButton.isSelected()){ caller.assocTest = 1; } else { caller.assocTest = 2; } }else{ caller.assocTest = 0; } String[] returnStrings = {genoFileField.getText(), infoFileField.getText(), maxComparisonDistField.getText()}; //if a dataset was previously loaded during this session, discard the display panes for it. if (caller.dPrimeDisplay != null){ caller.dPrimeDisplay.setVisible(false); caller.dPrimeDisplay = null; } if (caller.hapDisplay != null){ caller.hapDisplay.setVisible(false); caller.hapDisplay = null; } caller.readGenotypes(returnStrings, fileType); this.dispose(); }else if (command == "Cancel"){ this.dispose(); }else if (command == "tdt"){ if(this.doTDT.isSelected()){ trioButton.setEnabled(true); ccButton.setEnabled(true); }else{ trioButton.setEnabled(false); ccButton.setEnabled(false); } } } |
|
if (!populated) populate(); | populate(); | public SQLCatalog getCatalogByName(String catalogName) throws ArchitectException { if (!populated) populate(); if (children == null || children.size() == 0) { return null; } if (! (children.get(0) instanceof SQLCatalog) ) { // this database doesn't contain catalogs! return null; } Iterator childit = children.iterator(); while (childit.hasNext()) { SQLCatalog child = (SQLCatalog) childit.next(); if (child.getName().equalsIgnoreCase(catalogName)) { return child; } } return null; } |
if (!populated) populate(); | populate(); | public SQLSchema getSchemaByName(String schemaName) throws ArchitectException { if (!populated) populate(); if (children == null || children.size() == 0) { return null; } if (! (children.get(0) instanceof SQLSchema || children.get(0) instanceof SQLCatalog) ) { // this database doesn't contain schemas or catalogs! return null; } Iterator childit = children.iterator(); while (childit.hasNext()) { SQLObject child = (SQLObject) childit.next(); if (child instanceof SQLCatalog) { // children are tables or schemas SQLSchema schema = ((SQLCatalog) child).getSchemaByName(schemaName); if (schema != null) { return schema; } } else if (child instanceof SQLSchema) { if (child.getName().equalsIgnoreCase(schemaName)) { return (SQLSchema) child; } } else { throw new IllegalStateException("Database contains a mix of schemas or catalogs with other objects"); } } return null; } |
if (pn.equals("url") || pn.equals("driverClass") || pn.equals("user")) { | if ("url".equals(pn) || "driverClass".equals(pn) || "user".equals(pn)) { | public void propertyChange(PropertyChangeEvent e) { String pn = e.getPropertyName(); if ( (e.getOldValue() == null && e.getNewValue() != null) || (e.getOldValue() != null && e.getNewValue() == null) || (e.getOldValue() != null && e.getNewValue() != null && !e.getOldValue().equals(e.getNewValue())) ) { if (pn.equals("url") || pn.equals("driverClass") || pn.equals("user")) { reset(); } else if (pn.equals("displayName")) { fireDbObjectChanged("shortDisplayName"); } } } |
} else if (pn.equals("displayName")) { | } else if ("displayName".equals(pn)) { | public void propertyChange(PropertyChangeEvent e) { String pn = e.getPropertyName(); if ( (e.getOldValue() == null && e.getNewValue() != null) || (e.getOldValue() != null && e.getNewValue() == null) || (e.getOldValue() != null && e.getNewValue() != null && !e.getOldValue().equals(e.getNewValue())) ) { if (pn.equals("url") || pn.equals("driverClass") || pn.equals("user")) { reset(); } else if (pn.equals("displayName")) { fireDbObjectChanged("shortDisplayName"); } } } |
throw new IllegalArgumentException("The var attribute cannot be null"); | throw new MissingAttributeException( "var" ); | public void doTag(XMLOutput output) throws Exception { if (var == null) { throw new IllegalArgumentException("The var attribute cannot be null"); } Object xpathContext = getXPathContext(); if (select == null) { select = createXPathFromBody(xpathContext); } Object value = select.evaluate(xpathContext); context.setVariable(var, value); } |
Object xpathContext = getXPathContext(); | public void doTag(XMLOutput output) throws Exception { if (var == null) { throw new IllegalArgumentException("The var attribute cannot be null"); } Object xpathContext = getXPathContext(); if (select == null) { select = createXPathFromBody(xpathContext); } Object value = select.evaluate(xpathContext); context.setVariable(var, value); } |
|
select = createXPathFromBody(xpathContext); | throw new MissingAttributeException( "select" ); | public void doTag(XMLOutput output) throws Exception { if (var == null) { throw new IllegalArgumentException("The var attribute cannot be null"); } Object xpathContext = getXPathContext(); if (select == null) { select = createXPathFromBody(xpathContext); } Object value = select.evaluate(xpathContext); context.setVariable(var, value); } |
if(Options.getMaxDistance() == 0 || sep < Options.getMaxDistance() ) { | if(Options.getMaxDistance() == 0 || Math.abs(sep) < Options.getMaxDistance() ) { | public void saveDprimeToText(File dumpDprimeFile, int source, int start, int stop) throws IOException{ FileWriter saveDprimeWriter = new FileWriter(dumpDprimeFile); System.out.println("save dprime to text!"); //we use this LinkedList to store the dprime computations for a window of 5 markers //in either direction in the for loop farther down. //a tInt value is calculated for each marker which requires the dprime calculations //for the 5 markers before and 5 after the current marker, so we store these values while we need //them to avoid unnecesary recomputation. LinkedList savedDPrimes = new LinkedList(); long dist; if (infoKnown){ saveDprimeWriter.write("L1\tL2\tD'\tLOD\tr^2\tCIlow\tCIhi\tDist\tT-int\n"); }else{ saveDprimeWriter.write("L1\tL2\tD'\tLOD\tr^2\tCIlow\tCIhi\tT-int\n"); } boolean adj = false; if (start == -1 && stop == -1){ //user selected "adjacent markers" option start = 0; stop = Chromosome.getSize(); adj = true; } if (start < 0){ start = 0; } if (stop > Chromosome.getSize()){ stop = Chromosome.getSize(); } PairwiseLinkage currComp = null; //initialize the savedDPrimes linkedlist with 10 empty arrays of size 10 PairwiseLinkage[] pwlArray = new PairwiseLinkage[10]; savedDPrimes.add(pwlArray); for(int k=0;k<4;k++) { savedDPrimes.add(pwlArray.clone()); } PairwiseLinkage[] tempArray; if(source != TABLE_TYPE) { //savedDPrimes is a linkedlist which stores 5 arrays at all times. //it temporarily stores a set of computeDPrime() results so that we do not //do them over and over //each array contains 10 PairwiseLinkage objects. //each array contains the PairwiseLinkage objects for a marker being compared to the 10 previous markers. //if marker1 is some marker number, and tempArray is one of the arrays in savedDPrimes, then: // tempArray[0] = computeDPrime(marker1 - 10, marker1) // tempArray[9] = computeDPrime(marker1 - 1, marker1) //if the value of marker1 is less than 10, then the array is filled with nulls up the first valid comparison //that is, if marker1 = 5, then: // tempArray[0] through tempArray[4] are null // tempArray[5] = computeDPrime(marker1-5,marker1) for(int m=1;m<6;m++) { tempArray = (PairwiseLinkage[]) savedDPrimes.get(m-1); for(int n=1;n<11;n++){ if( (start+m) >= Chromosome.getSize() || (start+m-n)<0) { tempArray[10-n] = null; } else { //the next line used to have Chromosome.getUnfilteredMarker(Chromosome.realIndex[]) //but it seems like this should do the same thing long sep = Chromosome.getMarker(start+m).getPosition() - Chromosome.getMarker(start+m-n).getPosition(); if(Options.getMaxDistance() == 0 || sep < Options.getMaxDistance() ) { tempArray[10-n] = this.computeDPrime(Chromosome.realIndex[start+m-n],Chromosome.realIndex[start+m]); //tempArray[10-n] = "" + (start+m-n) + "," + (start+m) ; } } } } } for (int i = start; i < stop; i++){ if(source != TABLE_TYPE && i != start) { //here the first element of savedDPrimes is discarded. //the array of results for the marker (i+5) is then computed and added to the end of savedDPrimes tempArray = (PairwiseLinkage[]) savedDPrimes.removeFirst(); for(int m=0;m<10;m++) { tempArray[m] = null; } for(int n=1;n<11;n++){ if(i+5 < Chromosome.getSize() && (i+5-n) >=0) { long sep = Chromosome.getMarker(i+5).getPosition() - Chromosome.getMarker(i+5-n).getPosition(); if(Options.getMaxDistance() == 0 || sep < Options.getMaxDistance() ) { tempArray[10-n] = this.computeDPrime(Chromosome.realIndex[i+5-n],Chromosome.realIndex[i+5]); } } } savedDPrimes.addLast(tempArray); } for (int j = i+1; j < stop; j++){ if (adj){ if (!(i == j-1)){ continue; } } if (source == TABLE_TYPE){ currComp = dpTable.getLDStats(i,j); }else{ long sep = Chromosome.getMarker(i).getPosition() - Chromosome.getMarker(j).getPosition(); if(Options.getMaxDistance() == 0 || sep < Options.getMaxDistance() ) { currComp = this.computeDPrime(Chromosome.realIndex[i],Chromosome.realIndex[j]); } } if(currComp != null) { double LODSum = 0; String tInt = "-"; if (i == j-1){ //these are adjacent markers so we'll put in the t-int stat for (int x = 0; x < 5; x++){ for (int y = 1; y < 6; y++){ if (i-x < 0 || i+y >= Chromosome.getSize()){ continue; } tempArray = (PairwiseLinkage[]) savedDPrimes.get(y-1); PairwiseLinkage tintPair = null; if (source == TABLE_TYPE){ tintPair = dpTable.getLDStats(i-x,i+y); }else{ long sep = Chromosome.getUnfilteredMarker(Chromosome.realIndex[i-x]).getPosition() - Chromosome.getUnfilteredMarker(Chromosome.realIndex[i+y]).getPosition(); if(Options.getMaxDistance() == 0 || sep < Options.getMaxDistance() ) { tintPair = tempArray[9-x-y+1]; /*tintPair = this.computeDPrime(Chromosome.realIndex[i-x], Chromosome.realIndex[i+y]); if(tempArray[9-x-y+1] == null) { System.out.println("storage is null "); } if(tintPair == null) { System.out.println("tintPair is null"); } if(tempArray[9-x-y+1] == tintPair || (tintPair != null && tempArray[9-x-y+1] != null && tintPair.getLOD() == tempArray[9-x-y+1].getLOD())) { System.out.println("match"); } else { System.out.println("dont match"); }*/ } } if (tintPair != null){ LODSum += tintPair.getLOD(); } } } tInt = String.valueOf(roundDouble(LODSum)); } if (infoKnown){ dist = (Chromosome.getMarker(j)).getPosition() - (Chromosome.getMarker(i)).getPosition(); saveDprimeWriter.write(Chromosome.getMarker(i).getName() + "\t" + Chromosome.getMarker(j).getName() + "\t" + currComp.toString() + "\t" + dist + "\t" + tInt +"\n"); }else{ saveDprimeWriter.write((Chromosome.realIndex[i]+1) + "\t" + (Chromosome.realIndex[j]+1) + "\t" + currComp.toString() + "\t" + tInt + "\n"); } } } } saveDprimeWriter.close(); } |
public void handleEvent(Event event) { ApplicationDowntimeHistory downtimeHistory = getDowntimeHistory(event.getApplicationConfig()); | public void handleEvent(EventObject event) { if(!(event instanceof ApplicationEvent)){ throw new IllegalArgumentException("event must of type ApplicationEvent"); } ApplicationEvent appEvent = (ApplicationEvent)event; ApplicationDowntimeHistory downtimeHistory = getDowntimeHistory(appEvent.getApplicationConfig()); | public void handleEvent(Event event) { ApplicationDowntimeHistory downtimeHistory = getDowntimeHistory(event.getApplicationConfig()); assert downtimeHistory != null; if(event instanceof ApplicationUpEvent){ // application must have went down earlier assert downtimeHistory.getDowntimeBegin() != null; // log the downtime to the db recordDowntime(event.getApplicationConfig().getApplicationId(), downtimeHistory.getDowntimeBegin(), event.getTime()); downtimeHistory.applicationCameUp(event.getTime()); }else if(event instanceof ApplicationDownEvent){ downtimeHistory.applicationWentDown(event.getTime()); } } |
if(event instanceof ApplicationUpEvent){ | if(appEvent instanceof ApplicationUpEvent){ | public void handleEvent(Event event) { ApplicationDowntimeHistory downtimeHistory = getDowntimeHistory(event.getApplicationConfig()); assert downtimeHistory != null; if(event instanceof ApplicationUpEvent){ // application must have went down earlier assert downtimeHistory.getDowntimeBegin() != null; // log the downtime to the db recordDowntime(event.getApplicationConfig().getApplicationId(), downtimeHistory.getDowntimeBegin(), event.getTime()); downtimeHistory.applicationCameUp(event.getTime()); }else if(event instanceof ApplicationDownEvent){ downtimeHistory.applicationWentDown(event.getTime()); } } |
recordDowntime(event.getApplicationConfig().getApplicationId(), downtimeHistory.getDowntimeBegin(), event.getTime()); downtimeHistory.applicationCameUp(event.getTime()); | recordDowntime(appEvent.getApplicationConfig().getApplicationId(), downtimeHistory.getDowntimeBegin(), appEvent.getTime()); downtimeHistory.applicationCameUp(appEvent.getTime()); | public void handleEvent(Event event) { ApplicationDowntimeHistory downtimeHistory = getDowntimeHistory(event.getApplicationConfig()); assert downtimeHistory != null; if(event instanceof ApplicationUpEvent){ // application must have went down earlier assert downtimeHistory.getDowntimeBegin() != null; // log the downtime to the db recordDowntime(event.getApplicationConfig().getApplicationId(), downtimeHistory.getDowntimeBegin(), event.getTime()); downtimeHistory.applicationCameUp(event.getTime()); }else if(event instanceof ApplicationDownEvent){ downtimeHistory.applicationWentDown(event.getTime()); } } |
downtimeHistory.applicationWentDown(event.getTime()); | downtimeHistory.applicationWentDown(appEvent.getTime()); | public void handleEvent(Event event) { ApplicationDowntimeHistory downtimeHistory = getDowntimeHistory(event.getApplicationConfig()); assert downtimeHistory != null; if(event instanceof ApplicationUpEvent){ // application must have went down earlier assert downtimeHistory.getDowntimeBegin() != null; // log the downtime to the db recordDowntime(event.getApplicationConfig().getApplicationId(), downtimeHistory.getDowntimeBegin(), event.getTime()); downtimeHistory.applicationCameUp(event.getTime()); }else if(event instanceof ApplicationDownEvent){ downtimeHistory.applicationWentDown(event.getTime()); } } |
assert downtimeBegin == null; downtimeBegin = time; | if(downtimeBegin == null){ downtimeBegin = time; }else{ logger.fine("Downtime event fired again. Ignoring."); } | public void applicationWentDown(long time){ assert downtimeBegin == null; downtimeBegin = time; } |
if ( dragType == DRAG_TYPE_SELECT ) { | if ( dragType == DRAG_TYPE_SELECT && photoCollection != null ) { | public void mouseReleased(MouseEvent mouseEvent) { firstMouseEvent = null; if ( dragType == DRAG_TYPE_SELECT ) { // Find out thumbails inside the selection rectangle // First lets restrict search to those rows that intersect with selection int topRow = (int) dragSelectionRect.getMinY()/rowHeight; int bottomRow = ((int) dragSelectionRect.getMaxY()/rowHeight)+1; int startPhoto = topRow * columnsToPaint; int endPhoto = bottomRow * columnsToPaint; if ( endPhoto > photoCollection.getPhotoCount() ) { endPhoto = photoCollection.getPhotoCount(); } ODMGXAWrapper xa = new ODMGXAWrapper(); // Find out which photos are selected for ( int n = startPhoto; n < endPhoto; n++ ) { /* Performance optimization: Since getPhotoBounds() needs access to photo thumbnail which may not yet be loaded we will do first a rough check of if the table cell is in the selection area. */ Rectangle cellRect = getPhotoCellBounds( n ); if ( dragSelectionRect.intersects( cellRect ) ) { Rectangle photoRect = getPhotoBounds( n ); if ( dragSelectionRect.intersects( photoRect ) ) { selection.add( photoCollection.getPhoto( n ) ); repaintPhoto( photoCollection.getPhoto( n ) ); } } } fireSelectionChangeEvent(); xa.commit(); // Redrw the selection area so that the selection rectangle is not shown anymore Rectangle repaintRect = dragSelectionRect; if ( lastDragSelectionRect != null ) { repaintRect = dragSelectionRect.union( lastDragSelectionRect ); } repaint( (int) repaintRect.getX()-1, (int) repaintRect.getY()-1, (int) repaintRect.getWidth()+2, (int) repaintRect.getHeight()+2 ); dragSelectionRect = null; lastDragSelectionRect = null; // Notify the mouse click handler that it has to do nothing dragJustEnded = true; } } |
public TablePane() { | private TablePane() { | public TablePane() { setOpaque(true); dt = new DropTarget(this, new TablePaneDropListener(this)); dgl = new TablePaneDragGestureListener(); ds = new DragSource(); // dgr = getToolkit().createDragGestureRecognizer(MouseDragGestureRecognizer.class, ds, this, DnDConstants.ACTION_MOVE, dgl); dgr = ds.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_MOVE, dgl); logger.info("motion threshold is: " + getToolkit().getDesktopProperty("DnD.gestureMotionThreshold")); setInsertionPoint(COLUMN_INDEX_NONE); addMouseListener(this); updateUI(); } |
assert appName != null; | if (appName == null) return null; | public ApplicationConfig getApplicationConfig() { assert appName != null; return ServiceUtils.getApplicationConfigByName(appName); } |
assert mbeanName != null; | if (mbeanName == null) return null; | public ObjectName getObjectName() { assert mbeanName != null; String mbeanName = ServiceUtils.resolveMBeanName(getApplicationConfig(), this.mbeanName); return new ObjectName(mbeanName); } |
logger.debug("SQLSchema: populate finished"); | public void populate() throws ArchitectException { if (populated) return; int oldSize = children.size(); SQLObject databaseParent; SQLObject tmp = parent; if ( tmp instanceof SQLDatabase ) databaseParent = tmp; else { while ( true ) { databaseParent = tmp.getParent(); if ( databaseParent == null ) { databaseParent = tmp; break; } if ( databaseParent instanceof SQLDatabase ) break; else tmp = databaseParent; } } synchronized (databaseParent) { ResultSet rs = null; try { Connection con = ((SQLDatabase)databaseParent).getConnection(); DatabaseMetaData dbmd = con.getMetaData(); tmp = parent; if ( tmp instanceof SQLDatabase ) { rs = dbmd.getTables(null, getName(), "%", new String[] {"TABLE", "VIEW"}); } else if ( tmp instanceof SQLCatalog ) { rs = dbmd.getTables(tmp.getName(), getName(), "%", new String[] {"TABLE", "VIEW"}); } while (rs != null && rs.next()) { children.add(new SQLTable(this, rs.getString(3), rs.getString(5), rs.getString(4), false)); } } catch (SQLException e) { throw new ArchitectException("schema.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("schema.rs.close.fail", e2); } } } } |
|
hv.dPrimeDisplay.colorDPrime(hv.currentScheme); | private void doTweak() { String gt = gamThresh.getText(); if (gt.equals("")){ gt = "0"; } double gtVal = Double.parseDouble(gt); if (gtVal < 1){ FindBlocks.fourGameteCutoff = gtVal; } String cih = highLD.getText(); if (cih.equals("")){ cih = "0"; } double cihVal = Double.parseDouble(cih); if (cihVal < 1){ FindBlocks.cutHighCI = cihVal; } String cil = lowLD.getText(); if (cil.equals("")){ cil = "0"; } double cilVal = Double.parseDouble(cil); if (cilVal < 1){ FindBlocks.cutLowCI = cilVal; } String cirec = highRec.getText(); if (cirec.equals("")){ cirec = "0"; } double cirecVal = Double.parseDouble(cirec); if (cirecVal < 1){ FindBlocks.recHighCI = cirecVal; } String ifs = informFrac.getText(); if (ifs.equals("")){ ifs = "0"; } double ifsV = Double.parseDouble(ifs); if (ifsV < 1){ FindBlocks.informFrac = ifsV; } String mc = mafCut.getText(); if (mc.equals("")){ mc = "0"; } double mcV = Double.parseDouble(mc); if (mcV < 1){ FindBlocks.mafThresh = mcV; } String sdp = spinedp.getText(); if (sdp.equals("")){ sdp = "0"; } double sdpV = Double.parseDouble(sdp); if (sdpV < 1){ FindBlocks.spineDP = sdpV; } setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); hv.theData.guessBlocks(hv.getCurrentBlockDef()); hv.changeBlocks(hv.getCurrentBlockDef()); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } |
|
protected Action createAction() { | protected Action createAction(final StylesheetTag tag, final XMLOutput output) { | protected Action createAction() { return new Action() { public void run(Node node) throws Exception { xpathSource = node; if (log.isDebugEnabled()) { log.debug( "Firing template body for match: " + match + " and node: " + node ); } invokeBody(output); } }; } |
tag.setXPathSource( node ); | protected Action createAction() { return new Action() { public void run(Node node) throws Exception { xpathSource = node; if (log.isDebugEnabled()) { log.debug( "Firing template body for match: " + match + " and node: " + node ); } invokeBody(output); } }; } |
|
tag.setXPathSource( node ); | public void run(Node node) throws Exception { xpathSource = node; if (log.isDebugEnabled()) { log.debug( "Firing template body for match: " + match + " and node: " + node ); } invokeBody(output); } |
|
protected Rule createRule() { return new Rule( match, getAction() ); | protected Rule createRule(StylesheetTag tag, XMLOutput output) { return new Rule( match, createAction(tag, output) ); | protected Rule createRule() { return new Rule( match, getAction() ); } |
this.output = output; | public void doTag(XMLOutput output) throws Exception { // for use by inner classes this.output = output; StylesheetTag tag = (StylesheetTag) findAncestorWithClass( StylesheetTag.class ); if (tag == null) { throw new JellyException( "This <template> tag must be used inside a <stylesheet> tag" ); } if ( log.isDebugEnabled() ) { log.debug( "adding template rule for match: " + match ); } Rule rule = getRule(); if ( rule != null && tag != null) { rule.setMode( mode ); tag.addTemplate( rule ); } } |
|
Rule rule = getRule(); | Rule rule = createRule(tag, output); | public void doTag(XMLOutput output) throws Exception { // for use by inner classes this.output = output; StylesheetTag tag = (StylesheetTag) findAncestorWithClass( StylesheetTag.class ); if (tag == null) { throw new JellyException( "This <template> tag must be used inside a <stylesheet> tag" ); } if ( log.isDebugEnabled() ) { log.debug( "adding template rule for match: " + match ); } Rule rule = getRule(); if ( rule != null && tag != null) { rule.setMode( mode ); tag.addTemplate( rule ); } } |
URL url = this.getClass().getClassLoader().getResource(name); if (url == null) | URL resourceUrl = this.getClass().getClassLoader().getResource(name); if (resourceUrl == null) | protected URL resolveURL(String name) throws MalformedURLException { URL url = this.getClass().getClassLoader().getResource(name); if (url == null) { File file = new File(name); if (file.exists()) { return file.toURL(); } return new URL(name); } else { return url; } } |
return url; | return resourceUrl; | protected URL resolveURL(String name) throws MalformedURLException { URL url = this.getClass().getClassLoader().getResource(name); if (url == null) { File file = new File(name); if (file.exists()) { return file.toURL(); } return new URL(name); } else { return url; } } |
cp.validate(); | public void actionPerformed(ActionEvent e) { final JDialog d = new JDialog(ArchitectFrame.getMainInstance(), "Power*Architect Help"); JPanel cp = new JPanel(new BorderLayout(12,12)); cp.setBorder(BorderFactory.createEmptyBorder(12,12,12,12)); ArchitectPanelBuilder.makeJDialogCancellable( d, new CommonCloseAction(d)); d.setContentPane(cp); cp.add(buttonPanel, BorderLayout.NORTH); JScrollPane scrollableTextArea = new JScrollPane(editorPane); cp.add(scrollableTextArea, BorderLayout.CENTER); if ( editorPane.getPage() == null ) { try { editorPane.setPage(urlStr); history.add(urlStr); } catch (IOException e1) { e1.printStackTrace(); } } resetButtoms(); d.pack(); d.setLocationRelativeTo(ArchitectFrame.getMainInstance()); d.setVisible(true); } |
|
context.setVariable( var, getbody() ); | context.setVariable( var, getBody() ); | public void run(Context context, XMLOutput output) throws Exception { if ( var == null ) { throw new JellyException( "<define:script> must have a var attribute" ); } context.setVariable( var, getbody() ); } |
PhotovaultSettings.setConfiguration( "pv_test" ); String sqldbName = PhotovaultSettings.getConfProperty( "dbname" ); ODMG.initODMG("harri", "r1t1rat1", sqldbName); | public void setUp() { PhotovaultSettings.setConfiguration( "pv_test" ); String sqldbName = PhotovaultSettings.getConfProperty( "dbname" ); ODMG.initODMG("harri", "r1t1rat1", sqldbName); odmg = ODMG.getODMGImplementation(); db = ODMG.getODMGDatabase();// try {// db.open( "repository.xml", Database.OPEN_READ_WRITE );// } catch ( ODMGException e ) {// // log.warn( "Could not open database: " + e.getMessage() );// db = null;// }// tx = odmg.newTransaction();// tx.begin(); } |
|
|| !"A".equals(completeUser.getStatus())){ | || !User.STATUS_ACTIVE.equals(completeUser.getStatus())){ | private static void authenticate(ServiceContextImpl context, String className, String methodName){ User user = context.getUser(); if(user == null){ /* only the login method in AuthService is allowed without authentication */ if(!className.equals(AuthService.class.getName()) || !methodName.equals("login")){ throw new RuntimeException("Service method called without " + "User credentials"); } return; } /* User must have username and password specified */ assert user.getUsername() != null; assert user.getPassword() != null; UserManager userManager = UserManager.getInstance(); User completeUser = userManager.getUser(user.getUsername()); /* validate password */ if(!user.getPassword().equals(completeUser.getPassword()) || !"A".equals(completeUser.getStatus())){ throw new RuntimeException("Invalid user credentials."); } context .setUser(completeUser); } |
File f = new File( "c:\\java\\photovault\\testfiles\\test1.jpg" ); | File f = new File( testImgDir, "test1.jpg" ); | public void setUp() { File f = new File( "c:\\java\\photovault\\testfiles\\test1.jpg" ); try { source = ImageIO.read( f ); } catch ( IOException e ) { System.err.println( "Error reading image: " + e.getMessage() ); return; } testDir = new File( "c:\\java\\photovault\\tests\\images\\photovault\\image\\ImageXform" ); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.