rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
if (filesToMerge.size() == 0)
if (filesToMerge.isEmpty())
public Main(String[] args) { File dataFile = CoverageDataFileHandler.getDefaultDataFile(); String baseDir = "."; Vector filesToMerge = new Vector(); // Go through all the parameters for (int i = 0; i < args.length; i++) { if (args[i].equals("--datafile")) dataFile = new File(args[++i]); else if (args[i].equals("--basedir")) baseDir = args[++i]; else filesToMerge.add(baseDir + File.separator + args[i]); } // Load coverage data ProjectData projectData = null; if (dataFile.isFile()) projectData = CoverageDataFileHandler.loadCoverageData(dataFile); if (projectData == null) projectData = new ProjectData(); if (filesToMerge.size() == 0) { System.err.println("Error: No files were specified for merging."); System.exit(1); } // Merge everything Iterator iter = filesToMerge.iterator(); while (iter.hasNext()) { String newDataFileName = (String)iter.next(); File newDataFile = new File(newDataFileName); ProjectData projectDataNew = CoverageDataFileHandler .loadCoverageData(newDataFile); if (projectDataNew != null) projectData.merge(projectDataNew); } // Save the combined data file CoverageDataFileHandler.saveCoverageData(projectData, dataFile); }
String newDataFileName = (String)iter.next(); File newDataFile = new File(newDataFileName);
File newDataFile = (File)iter.next();
public Main(String[] args) { File dataFile = CoverageDataFileHandler.getDefaultDataFile(); String baseDir = "."; Vector filesToMerge = new Vector(); // Go through all the parameters for (int i = 0; i < args.length; i++) { if (args[i].equals("--datafile")) dataFile = new File(args[++i]); else if (args[i].equals("--basedir")) baseDir = args[++i]; else filesToMerge.add(baseDir + File.separator + args[i]); } // Load coverage data ProjectData projectData = null; if (dataFile.isFile()) projectData = CoverageDataFileHandler.loadCoverageData(dataFile); if (projectData == null) projectData = new ProjectData(); if (filesToMerge.size() == 0) { System.err.println("Error: No files were specified for merging."); System.exit(1); } // Merge everything Iterator iter = filesToMerge.iterator(); while (iter.hasNext()) { String newDataFileName = (String)iter.next(); File newDataFile = new File(newDataFileName); ProjectData projectDataNew = CoverageDataFileHandler .loadCoverageData(newDataFile); if (projectDataNew != null) projectData.merge(projectDataNew); } // Save the combined data file CoverageDataFileHandler.saveCoverageData(projectData, dataFile); }
else {
else
private String handleError( Variable variable, Context context, Exception problem ) { String strError; ArrayList arlErrors = null; PropertyException propEx = null; if (problem instanceof PropertyException) propEx = (PropertyException)problem; else { propEx = new PropertyException( "Error expanding $" + variable.getVariableName()); propEx.setContextLocation(context.getCurrentLocation()); } strError = propEx.getMessage(); if ( context.containsKey( "WMERROR" ) ) { arlErrors = ( ArrayList ) context.get( "WMERROR" ); } else { arlErrors = new ArrayList(); context.put( "WMERROR", arlErrors ); } arlErrors.add( strError ); if ( _log != null ) { _log.warning( strError, problem ); } return errorString( strError ); }
propEx.setContextLocation(context.getCurrentLocation()); }
propEx.setContextLocation(context.getCurrentLocation());
private String handleError( Variable variable, Context context, Exception problem ) { String strError; ArrayList arlErrors = null; PropertyException propEx = null; if (problem instanceof PropertyException) propEx = (PropertyException)problem; else { propEx = new PropertyException( "Error expanding $" + variable.getVariableName()); propEx.setContextLocation(context.getCurrentLocation()); } strError = propEx.getMessage(); if ( context.containsKey( "WMERROR" ) ) { arlErrors = ( ArrayList ) context.get( "WMERROR" ); } else { arlErrors = new ArrayList(); context.put( "WMERROR", arlErrors ); } arlErrors.add( strError ); if ( _log != null ) { _log.warning( strError, problem ); } return errorString( strError ); }
if (headingItem != null) headingItem.setEnabled(enabled);
if (headingItem != null && !headingItem.isDisposed()) headingItem.setEnabled(enabled);
public void setEnabled(boolean enabled) { if (this.enabled != enabled) { this.enabled = enabled; if (headingItem != null) headingItem.setEnabled(enabled); } }
if (headingItem != null && headingItem.isEnabled() != enabled) {
if (headingItem != null && !headingItem.isDisposed() && headingItem.isEnabled() != enabled) {
public void update() { super.update(); if (headingItem != null && headingItem.isEnabled() != enabled) { headingItem.setEnabled(enabled); } }
if (headingItem != null && headingItem.isEnabled() != enabled) {
if (headingItem != null && !headingItem.isDisposed() && headingItem.isEnabled() != enabled) {
public void updateAll(boolean arg0) { super.updateAll(arg0); if (headingItem != null && headingItem.isEnabled() != enabled) { headingItem.setEnabled(enabled); } }
inputStreamClosed = true;
private final void FillBuff() throws java.io.IOException { // Buffer fill logic: // If there is at least 2K left in this buffer, just read some more // Otherwise, if we're processing a token and it either // (a) starts in the other buffer (meaning it's filled both part of // the other buffer and some of this one, or // (b) starts in the first 2K of this buffer (meaning its taken up // most of this buffer // we expand this buffer. Otherwise, we swap buffers. // This guarantees we will be able to back up at least 2K characters. if (curBuf.size - curBuf.dataLen < 2048) { if (tokenBeginPos >= 0 && ((tokenBeginBuf == curBuf && tokenBeginPos < 2048) || tokenBeginBuf != curBuf)) { curBuf.expand(2048); } else { swapBuf(); curBuf.curPos = curBuf.dataLen = 0; } } try { int i = inputStream.read(curBuf.buffer, curBuf.dataLen, curBuf.size - curBuf.dataLen); if (i == -1) { inputStream.close(); throw new java.io.IOException(); } else curBuf.dataLen += i; return; } catch(java.io.IOException e) { if (curBuf.curPos > 0) --curBuf.curPos; if (tokenBeginPos == -1) { tokenBeginPos = curBuf.curPos; tokenBeginBuf = curBuf; } if (e.getClass().getName().equals("sun.io.MalformedInputException")) { // it's an ugly hack, but we want to pass this exception // through the JavaCC parser, since it has a bad // exception handling throw new ParserRuntimeException("MalformedInput",e); } throw e; } }
inputStreamClosed = false;
public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize) { inputStream = dstream; line = startline; column = startcolumn - 1; if (bufA == null || bufA.size != buffersize) bufA = new Buffer(buffersize); if (bufB == null || bufB.size != buffersize) bufB = new Buffer(buffersize); curBuf = bufA; otherBuf = bufB; curBuf.curPos = otherBuf.dataLen = -1; curBuf.dataLen = otherBuf.dataLen = 0; prevCharIsLF = prevCharIsCR = false; tokenBeginPos = -1; tokenBeginBuf = null; backupChars = 0; }
int addlChars = amount - 1 - curBuf.curPos;
int addlChars = amount - (inputStreamClosed? 0 : 1) - curBuf.curPos;
public final void backup(int amount) { backupChars += amount; if (curBuf.curPos - amount < 0) { int addlChars = amount - 1 - curBuf.curPos; curBuf.curPos = 0; swapBuf(); curBuf.curPos = curBuf.dataLen - addlChars - 1; } else { curBuf.curPos -= amount; } }
SettingsManager.saveSettings();
public void commit() { getData(); }
_broker = broker;
this(broker,"wm");
protected WMTemplate(Broker broker) { _broker = broker; }
return (Filter) myFilters.get(name);
return (Filter) _filters.get(name);
public Filter getFilter(String name) { return (Filter) myFilters.get(name); }
return myParameters.get(key);
return _parameters.get(key);
public Object getParam(String key) throws IOException, TemplateException { // perform double checked lock in case template has not yet // been parsed. try { return myParameters.get(key); } catch (NullPointerException e) { synchronized(this) { parse(); return myParameters.get(key); } } }
return myParameters;
return _parameters;
public HashMap getParameters() { return myParameters; }
Parser parser; try { parser = (Parser) _broker.getValue("parser","wm"); } catch (Exception e) { Engine.log.exception(e); throw new TemplateException("Could not load \"wm\" parser:" + e); }
Parser parser = getParser();
public final void parse() throws IOException, TemplateException { // thread policy: // // unsynchronized code elsewhere will access myContent. We must // ensure that any data copied into myContent is ready for public // use--which means dealing with two subtle issues. First, the Block // created by this method must be written back to main memory BEFORE // being referenced by myContent. Second, once we add it to myContent, // our copy of myContent has to be copied back to main memory as well. // // Therefore we synchronize around the access to myContent so as to // accomplish both these things. newContent will be written to main // memory at the start of the synchronized block, and myContent will // be written to main memory at the close. Block newContent = null; HashMap newParameters = null; Reader source = null; Hashtable newFilters = null; try { Parser parser; try { parser = (Parser) _broker.getValue("parser","wm"); } catch (Exception e) { Engine.log.exception(e); throw new TemplateException("Could not load \"wm\" parser:" + e); } Reader in = getReader(); BlockBuilder bb = parser.parseBlock(toString(),in); in.close(); BuildContext bc = new BuildContext(_broker); newParameters = bc.getLocalVariables(); newFilters = bc.getFilters(); newContent = (Block) bb.build(bc); } catch (BuildException be) { newContent = null; _log.error("Template contained invalid data: " + be); throw be; } catch (IOException e) { newContent = null; // don't let the old one survive _log.error("Template: Could not read template: " + this); throw e; } finally { try { source.close(); } catch (Exception e) { } synchronized(this) { myParameters = newParameters; myFilters = newFilters; myContent = newContent; } } }
myParameters = newParameters; myFilters = newFilters; myContent = newContent;
_parameters = newParameters; _filters = newFilters; _content = newContent;
public final void parse() throws IOException, TemplateException { // thread policy: // // unsynchronized code elsewhere will access myContent. We must // ensure that any data copied into myContent is ready for public // use--which means dealing with two subtle issues. First, the Block // created by this method must be written back to main memory BEFORE // being referenced by myContent. Second, once we add it to myContent, // our copy of myContent has to be copied back to main memory as well. // // Therefore we synchronize around the access to myContent so as to // accomplish both these things. newContent will be written to main // memory at the start of the synchronized block, and myContent will // be written to main memory at the close. Block newContent = null; HashMap newParameters = null; Reader source = null; Hashtable newFilters = null; try { Parser parser; try { parser = (Parser) _broker.getValue("parser","wm"); } catch (Exception e) { Engine.log.exception(e); throw new TemplateException("Could not load \"wm\" parser:" + e); } Reader in = getReader(); BlockBuilder bb = parser.parseBlock(toString(),in); in.close(); BuildContext bc = new BuildContext(_broker); newParameters = bc.getLocalVariables(); newFilters = bc.getFilters(); newContent = (Block) bb.build(bc); } catch (BuildException be) { newContent = null; _log.error("Template contained invalid data: " + be); throw be; } catch (IOException e) { newContent = null; // don't let the old one survive _log.error("Template: Could not read template: " + this); throw e; } finally { try { source.close(); } catch (Exception e) { } synchronized(this) { myParameters = newParameters; myFilters = newFilters; myContent = newContent; } } }
Block content = myContent;
Block content = _content;
public final void write(Writer out, Context data) throws IOException { // thread policy: Access to myContent is unsynchronized here at // the cost of having a slightly stale copy. This is OK, because // you might have requested it slightly earlier anyway. You will // always get a consistent copy--either the current one, or one // that was the current one a few milliseconds ago. This is because // a thread setting myContent may not update main memory immediately, // and this thread may not update its copy of myContent immediately // (it may have a stale copy it read earlier). Block content = myContent; // copy to a local var in case it changes // Make sure that all the contents of "content" are up to date--that // our thread is fully synchronized with main memory, so that we don't // have a half-created version. Synchronize on anything to do this: // we will use an object we don't share with any other thread. synchronized(data) { } if (content == null) { try { synchronized(this) { // double check under the lock if (myContent == null) { parse(); } content = myContent; } } catch (Exception e) { _log.exception(e); _log.error("Template: Unable to read template: " + this); out.write("<!--\n Template failed to read. Reason: "); out.write(e.toString()); out.write(" \n-->"); } } try { content.write(out,data); } catch (InvalidContextException e) { _log.exception(e); String warning = "Template: Missing data in Map passed to template " + this; _log.warning(warning); out.write("<!--\n Could not interpret template. Reason: "); out.write(warning); out.write(e.toString()); out.write(" \n-->"); } }
if (myContent == null) {
if (_content == null) {
public final void write(Writer out, Context data) throws IOException { // thread policy: Access to myContent is unsynchronized here at // the cost of having a slightly stale copy. This is OK, because // you might have requested it slightly earlier anyway. You will // always get a consistent copy--either the current one, or one // that was the current one a few milliseconds ago. This is because // a thread setting myContent may not update main memory immediately, // and this thread may not update its copy of myContent immediately // (it may have a stale copy it read earlier). Block content = myContent; // copy to a local var in case it changes // Make sure that all the contents of "content" are up to date--that // our thread is fully synchronized with main memory, so that we don't // have a half-created version. Synchronize on anything to do this: // we will use an object we don't share with any other thread. synchronized(data) { } if (content == null) { try { synchronized(this) { // double check under the lock if (myContent == null) { parse(); } content = myContent; } } catch (Exception e) { _log.exception(e); _log.error("Template: Unable to read template: " + this); out.write("<!--\n Template failed to read. Reason: "); out.write(e.toString()); out.write(" \n-->"); } } try { content.write(out,data); } catch (InvalidContextException e) { _log.exception(e); String warning = "Template: Missing data in Map passed to template " + this; _log.warning(warning); out.write("<!--\n Could not interpret template. Reason: "); out.write(warning); out.write(e.toString()); out.write(" \n-->"); } }
content = myContent;
content = _content;
public final void write(Writer out, Context data) throws IOException { // thread policy: Access to myContent is unsynchronized here at // the cost of having a slightly stale copy. This is OK, because // you might have requested it slightly earlier anyway. You will // always get a consistent copy--either the current one, or one // that was the current one a few milliseconds ago. This is because // a thread setting myContent may not update main memory immediately, // and this thread may not update its copy of myContent immediately // (it may have a stale copy it read earlier). Block content = myContent; // copy to a local var in case it changes // Make sure that all the contents of "content" are up to date--that // our thread is fully synchronized with main memory, so that we don't // have a half-created version. Synchronize on anything to do this: // we will use an object we don't share with any other thread. synchronized(data) { } if (content == null) { try { synchronized(this) { // double check under the lock if (myContent == null) { parse(); } content = myContent; } } catch (Exception e) { _log.exception(e); _log.error("Template: Unable to read template: " + this); out.write("<!--\n Template failed to read. Reason: "); out.write(e.toString()); out.write(" \n-->"); } } try { content.write(out,data); } catch (InvalidContextException e) { _log.exception(e); String warning = "Template: Missing data in Map passed to template " + this; _log.warning(warning); out.write("<!--\n Could not interpret template. Reason: "); out.write(warning); out.write(e.toString()); out.write(" \n-->"); } }
return (_globals != null) ? _globals.get(name) : null;
if (_globals != null) return _globals.get(name); if (_beanGet != null){ try { return _beanGet.invoke(_bean, new Object[]{ name }); } catch (Exception e){} } return null;
final public Object get(Object name) { return (_globals != null) ? _globals.get(name) : null; }
getGlobalVariables().put(name,value);
if (_beanPut != null){ try { _beanPut.invoke(_bean, new Object[]{ name, value }); } catch (Exception e){} } else { getGlobalVariables().put(name,value); }
final public void put(Object name, Object value) { if (_globals == null) { getGlobalVariables().put(name,value); } else { _globals.put(name,value); } }
try { _beanGet = bean.getClass().getMethod("get", new Class[]{ java.lang.Object.class }); _beanPut = bean.getClass().getMethod("put", new Class[]{ java.lang.Object.class, java.lang.Object.class }); } catch (Exception e){}
final public void setBean(Object bean) { _bean = bean; }
System.err.println ("render: >");
protected String renderGT() { return "&gt;"; }
System.err.println ("render: <");
protected String renderLT() { return "&lt;"; }
.append (text)
.append (replace (replace (text, "<", "&lt;"), ">", "&gt;"))
protected String renderQuotedBlock(String text) { StringBuffer sb = new StringBuffer (text.length()); sb.append ("<pre>") .append (text) .append ("</pre>"); return sb.toString (); }
return "<!-- " + data.getType() + " is an unknown WikiData type";
return "<!-- " + data.getType() + " is an unknown WikiData type -->";
protected String renderUnknown(WikiData data) { return "<!-- " + data.getType() + " is an unknown WikiData type"; }
if (room != groupChatRoom) { return; }
public void userHasLeft(ChatRoom room, String userid) { int index = getIndex(userid); if (index != -1) { model.removeElementAt(index); } }
public boolean isOwnerOrAdmin(Occupant occupant) {
public boolean isOwnerOrAdmin(GroupChatRoom groupChatRoom, String nickname) { Occupant occupant = getOccupant(groupChatRoom, nickname);
public boolean isOwnerOrAdmin(Occupant occupant) { if (occupant != null) { String affiliation = occupant.getAffiliation(); if ("owner".equals(affiliation) || "admin".equals(affiliation)) { return true; } } return false; }
public boolean isModerator(Occupant occupant) {
public boolean isModerator(GroupChatRoom groupChatRoom, String nickname) { Occupant occupant = getOccupant(groupChatRoom, nickname);
public boolean isModerator(Occupant occupant) { if (occupant != null) { String role = occupant.getRole(); if ("moderator".equals(role)) { return true; } } return false; }
return "1.1.9.6";
return "1.1.9.7";
public static String getVersion() { return "1.1.9.6"; }
String filePath=getArticleResourcePath(); String articleFolderPath = getArticlePath();
String filePath=getResourcePath(); String articleFolderPath=getArticlePath(); if(articleFolderPath!=null) { filePath=articleFolderPath+"/"+getArticleName(); }else { filePath=getArticleResourcePath(); articleFolderPath = getArticlePath(); }
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if (getHeadline().trim().equals("")) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; } if (getBody().trim().equals("")) { addErrorKey(KEY_ERROR_BODY_EMPTY); storeOk = false; } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } try { IWUserContext iwuc = IWContext.getInstance(); IWApplicationContext iwac = iwuc.getApplicationContext(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class);// IWSlideService service = (IWSlideService)IBOLookup.getServiceInstance(iwac,IWSlideService.class); WebdavRootResource rootResource = session.getWebdavRootResource(); IWSlideService slideService = (IWSlideService)IBOLookup.getServiceInstance(iwac,IWSlideService.class); String filePath=getArticleResourcePath(); String articleFolderPath = getArticlePath(); slideService.createAllFoldersInPath(articleFolderPath); rootResource.proppatchMethod(articleFolderPath,new PropertyName("IW:",CONTENT_TYPE),"LocalizedFile",true); String article = getAsXML();// System.out.println(article); //Conflict fix: uri for creating but path for updating if(session.getExistence(filePath)){ rootResource.putMethod(filePath,article); } else { rootResource.putMethod(session.getURI(filePath),article); } rootResource.proppatchMethod(filePath,new PropertyName("IW:",CONTENT_TYPE),ARTICLE_FILENAME_SCOPE,true); rootResource.close(); try { load(filePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (IOException e1) { storeOk = false; // TODO Auto-generated catch block e1.printStackTrace(); } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
rootResource.putMethod(filePath,article);
if(!rootResource.putMethod(filePath,article)) { rootResource.putMethod(session.getURI(filePath),article); }
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if (getHeadline().trim().equals("")) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; } if (getBody().trim().equals("")) { addErrorKey(KEY_ERROR_BODY_EMPTY); storeOk = false; } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } try { IWUserContext iwuc = IWContext.getInstance(); IWApplicationContext iwac = iwuc.getApplicationContext(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class);// IWSlideService service = (IWSlideService)IBOLookup.getServiceInstance(iwac,IWSlideService.class); WebdavRootResource rootResource = session.getWebdavRootResource(); IWSlideService slideService = (IWSlideService)IBOLookup.getServiceInstance(iwac,IWSlideService.class); String filePath=getArticleResourcePath(); String articleFolderPath = getArticlePath(); slideService.createAllFoldersInPath(articleFolderPath); rootResource.proppatchMethod(articleFolderPath,new PropertyName("IW:",CONTENT_TYPE),"LocalizedFile",true); String article = getAsXML();// System.out.println(article); //Conflict fix: uri for creating but path for updating if(session.getExistence(filePath)){ rootResource.putMethod(filePath,article); } else { rootResource.putMethod(session.getURI(filePath),article); } rootResource.proppatchMethod(filePath,new PropertyName("IW:",CONTENT_TYPE),ARTICLE_FILENAME_SCOPE,true); rootResource.close(); try { load(filePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (IOException e1) { storeOk = false; // TODO Auto-generated catch block e1.printStackTrace(); } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
rootResource.putMethod(session.getURI(filePath),article);
if(!rootResource.putMethod(session.getURI(filePath),article)) { rootResource.putMethod(filePath,article); }
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if (getHeadline().trim().equals("")) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; } if (getBody().trim().equals("")) { addErrorKey(KEY_ERROR_BODY_EMPTY); storeOk = false; } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } try { IWUserContext iwuc = IWContext.getInstance(); IWApplicationContext iwac = iwuc.getApplicationContext(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class);// IWSlideService service = (IWSlideService)IBOLookup.getServiceInstance(iwac,IWSlideService.class); WebdavRootResource rootResource = session.getWebdavRootResource(); IWSlideService slideService = (IWSlideService)IBOLookup.getServiceInstance(iwac,IWSlideService.class); String filePath=getArticleResourcePath(); String articleFolderPath = getArticlePath(); slideService.createAllFoldersInPath(articleFolderPath); rootResource.proppatchMethod(articleFolderPath,new PropertyName("IW:",CONTENT_TYPE),"LocalizedFile",true); String article = getAsXML();// System.out.println(article); //Conflict fix: uri for creating but path for updating if(session.getExistence(filePath)){ rootResource.putMethod(filePath,article); } else { rootResource.putMethod(session.getURI(filePath),article); } rootResource.proppatchMethod(filePath,new PropertyName("IW:",CONTENT_TYPE),ARTICLE_FILENAME_SCOPE,true); rootResource.close(); try { load(filePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (IOException e1) { storeOk = false; // TODO Auto-generated catch block e1.printStackTrace(); } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
public final static Macro createMacro(Object wrapMe)
public final static Macro createMacro(Object wrapMe, String encoding)
public final static Macro createMacro(Object wrapMe) throws BuildException { if (wrapMe == null) { throw new BuildException("Bug in WM: attempt to write null"); } if (wrapMe instanceof Macro) { return (Macro) wrapMe; } else { return new MacroAdapter(wrapMe); } }
public StringMacroAdapter(String wrapMe)
public StringMacroAdapter(String wrapMe, String encoding)
public StringMacroAdapter(String wrapMe) { try { _self = wrapMe.getBytes("UTF8"); } catch (Exception e) { e.printStackTrace(); } }
_self = wrapMe.getBytes("UTF8");
_self = wrapMe.getBytes(encoding);
public StringMacroAdapter(String wrapMe) { try { _self = wrapMe.getBytes("UTF8"); } catch (Exception e) { e.printStackTrace(); } }
_helper = new BrokerTemplateProviderHelper();
public void init(Broker b, Settings config) throws InitException { super.init(b, config); _helper.init(b, config); _helper.setReload(_cacheSupportsReload); _log = b.getLog("resource", "Object loading and caching"); }
String headline = WFUtil.getStringValue(ARTICLE_ITEM_BEAN_ID, "headline");
ArticleItemBean articleBean = (ArticleItemBean) WFUtil.getBeanInstance(ARTICLE_ITEM_BEAN_ID); String resourcePath = articleBean.getResourcePath();
private void selectComponent() { WFComponentSelector componentSelector = (WFComponentSelector) findComponent(COMPONENT_SELECTOR_ID); String headline = WFUtil.getStringValue(ARTICLE_ITEM_BEAN_ID, "headline"); if (componentSelector != null) { if (headline == null || headline.length() == 0) { componentSelector.setSelectedId(NO_ARTICLE_ID, true); componentSelector.setSelectedId(ARTICLE_LIST_ID, false); } else { componentSelector.setSelectedId(NO_ARTICLE_ID, false); componentSelector.setSelectedId(ARTICLE_LIST_ID, true); } } else { componentSelector.setSelectedId(NO_ARTICLE_ID, false); componentSelector.setSelectedId(ARTICLE_LIST_ID, true); System.out.println("Could not find the Component selector!!!"); } }
if (headline == null || headline.length() == 0) {
if (resourcePath == null || resourcePath.length() == 0) {
private void selectComponent() { WFComponentSelector componentSelector = (WFComponentSelector) findComponent(COMPONENT_SELECTOR_ID); String headline = WFUtil.getStringValue(ARTICLE_ITEM_BEAN_ID, "headline"); if (componentSelector != null) { if (headline == null || headline.length() == 0) { componentSelector.setSelectedId(NO_ARTICLE_ID, true); componentSelector.setSelectedId(ARTICLE_LIST_ID, false); } else { componentSelector.setSelectedId(NO_ARTICLE_ID, false); componentSelector.setSelectedId(ARTICLE_LIST_ID, true); } } else { componentSelector.setSelectedId(NO_ARTICLE_ID, false); componentSelector.setSelectedId(ARTICLE_LIST_ID, true); System.out.println("Could not find the Component selector!!!"); } }
assertStringTemplateEquals("$Text.HTMLEncode('&amp;')", "&");
assertStringTemplateEquals("$Text.HTMLEncode('&')", "&amp;");
public void testContextToolMethodCall() { assertStringTemplateEquals("$Text.HTMLEncode('&amp;')", "&"); }
t = new FileTemplate(_broker,tFile,encoding);
t = new FileTemplate(_broker,tFile,"UTF8");
final public Template get(String fileName, String encoding) { for (int i=0; i < _templateDirectory.length; i++) { Template t; String dir = _templateDirectory[i]; File tFile = new File(dir,fileName); if (tFile.canRead()) { try { t = new FileTemplate(_broker,tFile,encoding); t.parse(); return t; } catch (Exception e) { _log.warning("TemplateProvider: Could not load template: " + tFile, e); } } } return null; }
while (l instanceof Macro)
while (l instanceof Macro && l != UNDEF)
public void write(FastWriter out, Context context) throws PropertyException, IOException { Object l, limit, from; int loopLimit=-1, loopStart=1, loopIndex=0; l = list; while (l instanceof Macro) l = ((Macro) l).evaluate(context); if (limitExpr != null) { limit = limitExpr; while (limit instanceof Macro) limit = ((Macro) limit).evaluate(context); if (Expression.isNumber(limit)) loopLimit = (int) Expression.numberValue(limit); else { String warning = "#foreach: Cannot evaluate limit"; context.getLog("engine").warning(warning); writeWarning(warning, context, out); } } if (index != null && indexFromExpr != null) { from = indexFromExpr; while (from instanceof Macro) from = ((Macro) from).evaluate(context); if (Expression.isNumber(from)) loopStart = (int) Expression.numberValue(from); else { String warning = "#foreach: Cannot evaluate loop start"; context.getLog("engine").warning(warning); writeWarning(warning, context, out); } } Iterator iter; try { iter = context.getBroker()._propertyOperators.getIterator(l); } catch (Exception e) { String warning = "#foreach: list argument is not a list: " + l; context.getLog("engine").warning(warning + "; " + e); writeWarning(warning, context, out); return; } while(iter.hasNext() && ((loopLimit == -1) || (loopLimit > loopIndex))) { try { target.setValue(context, iter.next()); if (index != null) index.setValue(context, new Integer(loopIndex + loopStart)); } catch (PropertyException e) { String errorText = "#foreach: Unable to set list index"; context.getBroker().getLog("engine").error(errorText); writeWarning(errorText, context, out); } catch (Exception e) { throw new PropertyException ("Unable to iterate list", e); } body.write(out, context); ++loopIndex; } }
public NotVariableBuildException(String directive, Exception e) { super("#" + directive + ": Argument must be a variable", e);
public NotVariableBuildException(String directive) { super("#" + directive + ": Argument must be a variable");
public NotVariableBuildException(String directive, Exception e) { super("#" + directive + ": Argument must be a variable", e); }
return "ok";
return true;
private void addContactItem(final ContactGroup contactGroup, final ContactItem item) { ContactItem newContact = new ContactItem(item.getNickname(), item.getFullJID()); newContact.setPresence(item.getPresence()); newContact.setIcon(item.getIcon()); newContact.getNicknameLabel().setFont(item.getNicknameLabel().getFont()); contactGroup.addContactItem(newContact); contactGroup.clearSelection(); final ContactGroup oldGroup = getContactGroup(item.getGroupName()); SwingWorker worker = new SwingWorker() { public Object construct() { Roster roster = SparkManager.getConnection().getRoster(); RosterEntry entry = roster.getEntry(item.getFullJID()); RosterGroup groupFound = null; for(RosterGroup group : roster.getGroups()){ if (group.getName().equals(contactGroup.getGroupName())) { try { groupFound = group; group.addEntry(entry); } catch (XMPPException e1) { Log.error(e1); } } } // This is a new group if (groupFound == null) { groupFound = roster.createGroup(contactGroup.getGroupName()); try { groupFound.addEntry(entry); } catch (XMPPException e) { Log.error(e); } } return "ok"; } public void finished() { // Now try and remove the group from the old one. removeContactItem(oldGroup, item); } }; worker.start(); }
removeContactItem(oldGroup, item);
if ((Boolean)get()) { removeContactItem(oldGroup, item); }
private void addContactItem(final ContactGroup contactGroup, final ContactItem item) { ContactItem newContact = new ContactItem(item.getNickname(), item.getFullJID()); newContact.setPresence(item.getPresence()); newContact.setIcon(item.getIcon()); newContact.getNicknameLabel().setFont(item.getNicknameLabel().getFont()); contactGroup.addContactItem(newContact); contactGroup.clearSelection(); final ContactGroup oldGroup = getContactGroup(item.getGroupName()); SwingWorker worker = new SwingWorker() { public Object construct() { Roster roster = SparkManager.getConnection().getRoster(); RosterEntry entry = roster.getEntry(item.getFullJID()); RosterGroup groupFound = null; for(RosterGroup group : roster.getGroups()){ if (group.getName().equals(contactGroup.getGroupName())) { try { groupFound = group; group.addEntry(entry); } catch (XMPPException e1) { Log.error(e1); } } } // This is a new group if (groupFound == null) { groupFound = roster.createGroup(contactGroup.getGroupName()); try { groupFound.addEntry(entry); } catch (XMPPException e) { Log.error(e); } } return "ok"; } public void finished() { // Now try and remove the group from the old one. removeContactItem(oldGroup, item); } }; worker.start(); }
return "ok";
return true;
public Object construct() { Roster roster = SparkManager.getConnection().getRoster(); RosterEntry entry = roster.getEntry(item.getFullJID()); RosterGroup groupFound = null; for(RosterGroup group : roster.getGroups()){ if (group.getName().equals(contactGroup.getGroupName())) { try { groupFound = group; group.addEntry(entry); } catch (XMPPException e1) { Log.error(e1); } } } // This is a new group if (groupFound == null) { groupFound = roster.createGroup(contactGroup.getGroupName()); try { groupFound.addEntry(entry); } catch (XMPPException e) { Log.error(e); } } return "ok"; }
removeContactItem(oldGroup, item);
if ((Boolean)get()) { removeContactItem(oldGroup, item); }
public void finished() { // Now try and remove the group from the old one. removeContactItem(oldGroup, item); }
Message message = (Message)room.getTranscripts().get(size - 1);
if (size > 0) { Message message = (Message)room.getTranscripts().get(size - 1);
private void checkNotificationPreferences(final ChatRoom room) { LocalPreferences pref = SettingsManager.getLocalPreferences(); if (pref.getWindowTakesFocus()) { chatFrame.setState(Frame.NORMAL); chatFrame.setVisible(true); int tabLocation = indexOfComponent(room); setSelectedIndex(tabLocation); } if (pref.getShowToasterPopup()) { SparkToaster toaster = new SparkToaster(); toaster.setCustomAction(new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { chatFrame.setState(Frame.NORMAL); chatFrame.setVisible(true); int tabLocation = indexOfComponent(room); setSelectedIndex(tabLocation); } }); toaster.setDisplayTime(5000); toaster.setBorder(BorderFactory.createBevelBorder(0)); String nickname = ((ChatRoomImpl)room).getParticipantNickname(); toaster.setTitle(nickname); toaster.setToasterHeight(150); toaster.setToasterWidth(200); int size = room.getTranscripts().size(); Message message = (Message)room.getTranscripts().get(size - 1); toaster.showToaster(room.getTabIcon(), message.getBody()); } }
toaster.showToaster(room.getTabIcon(), message.getBody());
toaster.showToaster(room.getTabIcon(), message.getBody()); }
private void checkNotificationPreferences(final ChatRoom room) { LocalPreferences pref = SettingsManager.getLocalPreferences(); if (pref.getWindowTakesFocus()) { chatFrame.setState(Frame.NORMAL); chatFrame.setVisible(true); int tabLocation = indexOfComponent(room); setSelectedIndex(tabLocation); } if (pref.getShowToasterPopup()) { SparkToaster toaster = new SparkToaster(); toaster.setCustomAction(new AbstractAction() { public void actionPerformed(ActionEvent actionEvent) { chatFrame.setState(Frame.NORMAL); chatFrame.setVisible(true); int tabLocation = indexOfComponent(room); setSelectedIndex(tabLocation); } }); toaster.setDisplayTime(5000); toaster.setBorder(BorderFactory.createBevelBorder(0)); String nickname = ((ChatRoomImpl)room).getParticipantNickname(); toaster.setTitle(nickname); toaster.setToasterHeight(150); toaster.setToasterWidth(200); int size = room.getTranscripts().size(); Message message = (Message)room.getTranscripts().get(size - 1); toaster.showToaster(room.getTabIcon(), message.getBody()); } }
Header.print(System.out); System.out.println("instrumenting " + filenames.length + " " + (filenames.length == 1 ? "class" : "classes") + (toDir != null ? " to " + toDir : ""));
private void addFilenames(String[] filenames) { if (filenames.length == 0) { return; } for (int i = 0; i < filenames.length; i++) { getProject().log("Adding " + filenames[i] + " to list", Project.MSG_VERBOSE); addArg(filenames[i]); } Header.print(System.out); System.out.println("instrumenting " + filenames.length + " " + (filenames.length == 1 ? "class" : "classes") + (toDir != null ? " to " + toDir : "")); }
filenames.addAll(Arrays.asList(getFilenames(fileSet)));
String[] fileNames = getFilenames(fileSet); numberOfClasses += fileNames.length; addFilenames(getFilenames(fileSet));
private void handleFilesets() { Set filenames = new HashSet(); Iterator iter = fileSets.iterator(); while (iter.hasNext()) { FileSet fileSet = (FileSet)iter.next(); addArg("--basedir"); addArg(baseDir(fileSet)); filenames.addAll(Arrays.asList(getFilenames(fileSet))); } addFilenames((String[])filenames.toArray(new String[filenames.size()])); }
addFilenames((String[])filenames.toArray(new String[filenames.size()]));
Header.print(System.out); System.out.println("instrumenting " + numberOfClasses + " " + (numberOfClasses == 1 ? "class" : "classes") + (toDir != null ? " to " + toDir : ""));
private void handleFilesets() { Set filenames = new HashSet(); Iterator iter = fileSets.iterator(); while (iter.hasNext()) { FileSet fileSet = (FileSet)iter.next(); addArg("--basedir"); addArg(baseDir(fileSet)); filenames.addAll(Arrays.asList(getFilenames(fileSet))); } addFilenames((String[])filenames.toArray(new String[filenames.size()])); }
addTools(tools);
registerTools(tools);
public WebContext(final Broker broker) { super(broker); try { String tools = (String) broker.getValue("config","TemplateTools"); addTools(tools); } catch (InvalidTypeException it) { _log.exception(it); _log.error("config type not registered with broker!"); } catch (NotFoundException ne) { _log.exception(ne); _log.warning("could not load tools from config: " + ne); } }
updateNotesFromOpenNoteTabs();
dd.getTabFolder().saveNoteTabs();
public void fileSave(Event e) { updateNotesFromOpenNoteTabs(); dd.getDocument().saveNotes(); }
updateNotesFromOpenNoteTabs();
dd.getTabFolder().saveNoteTabs();
public void fileSaveAs(Event e) { FileDialog fileDialog = new FileDialog(dd.getShell(), SWT.SAVE); String filePath = fileDialog.open(); if (filePath != null) { File file = new File(filePath); updateNotesFromOpenNoteTabs(); dd.getDocument().saveNotes(file); dd.getShell().setText(file.getName() + " - Koala Notes"); } }
public Note loadNotes(File file) { this.file = file; return loadNotes();
public Note loadNotes() { org.jdom.Document jdomDocument = null; try { jdomDocument = new SAXBuilder().build(file); } catch (IOException ioex) { throw new KoalaException("Koala Notes could not read file '" + file.getName() + "'.", ioex); } catch (JDOMException jdomex) { throw new KoalaException("Koala Notes could not build a document from file '" + file.getName() + "'.", jdomex); } Element rootElement = jdomDocument.getRootElement(); root = createNoteFromElement(rootElement, null); return root;
public Note loadNotes(File file) { this.file = file; return loadNotes(); }
urls[iterator.previousIndex()] = repository.getResource(location);
URL url = repository.getResource(location); if (url == null) { throw new FatalBeanException("Unable to resolve classpath location " + location); } urls[iterator.previousIndex()] = url;
public void preprocess(SpringApplicationContext applicationContext, XmlBeanDefinitionReader reader, Document document) { // determine the classLoader ClassLoader classLoader; NodeList classpathElements = document.getDocumentElement().getElementsByTagName("classpath"); if (classpathElements.getLength() < 1) { classLoader = getClassLoader(applicationContext); } else if (classpathElements.getLength() > 1) { throw new FatalBeanException("Expected only classpath element but found " + classpathElements.getLength()); } else { Element classpathElement = (Element) classpathElements.item(0); // build the classpath List classpath = new ArrayList(); NodeList locations = classpathElement.getElementsByTagName("location"); for (int i = 0; i < locations.getLength(); i++) { Element locationElement = (Element) locations.item(i); String location = ((Text) locationElement.getFirstChild()).getData().trim(); classpath.add(location); } // convert the paths to URLS URL[] urls = new URL[classpath.size()]; for (ListIterator iterator = classpath.listIterator(); iterator.hasNext();) { String location = (String) iterator.next(); urls[iterator.previousIndex()] = repository.getResource(location); } // create the classloader ClassLoader parentLoader = getClassLoader(applicationContext); classLoader = new MultiParentClassLoader(applicationContext.getDisplayName(), urls, parentLoader); // remove the classpath element so Spring doesn't get confused document.getDocumentElement().removeChild(classpathElement); } // assign the class loader to the xml reader and the application context reader.setBeanClassLoader(classLoader); applicationContext.setClassLoader(classLoader); Thread.currentThread().setContextClassLoader(classLoader); }
dlg = new JDialog(SparkManager.getMainWindow(), "Downloads", false);
dlg = new JDialog(SparkManager.getMainWindow(), Res.getString("title.downloads"), false);
private Downloads() { ChatFrame frame = SparkManager.getChatManager().getChatContainer().getChatFrame(); dlg = new JDialog(SparkManager.getMainWindow(), "Downloads", false); dlg.setContentPane(mainPanel); dlg.pack(); dlg.setSize(400, 400); dlg.setResizable(true); dlg.setLocationRelativeTo(frame); pref = SettingsManager.getLocalPreferences(); downloadedDir = new File(pref.getDownloadDir()); downloadedDir.mkdirs(); pref.setDownloadDir(downloadedDir.getAbsolutePath()); list.setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 1, true, false)); list.setBackground(Color.white); mainPanel.setLayout(new GridBagLayout()); mainPanel.add(new JScrollPane(list), new GridBagConstraints(0, 0, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); JButton cleanUpButton = new JButton("Clean Up", SparkRes.getImageIcon(SparkRes.SMALL_DELETE)); JLabel locationLabel = new JLabel(); locationLabel.setText("All Files Downloaded To: "); RolloverButton userHomeButton = new RolloverButton("Downloads", null); Action openFolderAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { downloadedDir = new File(SparkManager.getUserDirectory(), "downloads"); if (!downloadedDir.exists()) { downloadedDir.mkdirs(); } openFile(downloadedDir); } }; userHomeButton.addActionListener(openFolderAction); mainPanel.add(locationLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); mainPanel.add(userHomeButton, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); mainPanel.add(cleanUpButton, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); // Remove all download panels cleanUpButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { list.removeAll(); list.validate(); list.repaint(); } }); }
Object ret = getLocal(names); if (ret == null) { ret = getTool(names); } return ret;
ret = getLocal(names);
public final Object getProperty(final Object[] names) throws PropertyException, ContextException { if (_bean == null) { Object ret = getLocal(names); if (ret == null) { ret = getTool(names); } return ret; } else { return PropertyOperator.getProperty(this,_bean,names); } }
return PropertyOperator.getProperty(this,_bean,names);
ret = PropertyOperator.getProperty(this,_bean,names);
public final Object getProperty(final Object[] names) throws PropertyException, ContextException { if (_bean == null) { Object ret = getLocal(names); if (ret == null) { ret = getTool(names); } return ret; } else { return PropertyOperator.getProperty(this,_bean,names); } }
if (ret == null){ ret = getTool(names); } return ret;
public final Object getProperty(final Object[] names) throws PropertyException, ContextException { if (_bean == null) { Object ret = getLocal(names); if (ret == null) { ret = getTool(names); } return ret; } else { return PropertyOperator.getProperty(this,_bean,names); } }
throw new InvalidContextException("The object used as the list of values in a foreach statement must have some way of returning a list type, or be a list type itself. See the documentation for PropertyOperator.getIterator() for more details. No such property was found on the supplied object: " + list);
throw new InvalidContextException("The object used as the list of values in a foreach statement must have some way of returning a list type, or be a list type itself. See the documentation for PropertyOperator.getIterator() for more details. No such property was found on the supplied object: " + list + ": " + e);
public void write(Writer out, Context context) throws InvalidContextException, IOException { // now clobber values outside the loop: // Map listMap = new HashMap(); // listMap.include(context); Object list = _list; if (_macro) { while (list instanceof Macro) { list = ((Macro) list).evaluate(context); } } Iterator iter; try { iter = PropertyOperator.getIterator(list); } catch (Exception e) { throw new InvalidContextException("The object used as the list of values in a foreach statement must have some way of returning a list type, or be a list type itself. See the documentation for PropertyOperator.getIterator() for more details. No such property was found on the supplied object: " + list); } Object listItem; // deals with an empty list substitute appropriate variables and // prints block out once if (iter == null) { listItem = "<!--\n " + _list + ": is empty \n-->"; try { _iterVar.setValue(context, listItem); } catch (InvalidContextException e) { Engine.log.exception(e); Engine.log.error("Unable to resolve list" + _list); out.write("<!--\n Unable to resolve list " + _list + " \n-->"); } _body.write(out, context); // iterates through all items including null ones which will // print error messages } else { while(iter.hasNext()) { if ((listItem = iter.next()) == null) { listItem = "<!--\n " + _list + ": contained a null item \n-->"; } try { _iterVar.setValue(context, listItem); _body.write(out, context); } catch (InvalidContextException e) { Engine.log.exception(e); Engine.log.error("unable to set a list item of list: " + _list); out.write("<!--\n Unable to resolve list " + _list + " \n-->"); } } } }
SparkManager.getAlertManager().flashWindow(SparkManager.getMainWindow());
SparkManager.getAlertManager().flashWindowStopOnFocus(SparkManager.getMainWindow());
private static void addInvitationListener() { // Add Invite Listener MultiUserChat.addInvitationListener(SparkManager.getConnection(), new InvitationListener() { public void invitationReceived(final XMPPConnection conn, final String room, final String inviter, final String reason, final String password, final Message message) { SwingUtilities.invokeLater(new Runnable() { public void run() { Collection listeners = new ArrayList(SparkManager.getChatManager().getInvitationListeners()); Iterator iter = listeners.iterator(); while (iter.hasNext()) { RoomInvitationListener listener = (RoomInvitationListener)iter.next(); boolean handle = listener.handleInvitation(conn, room, inviter, reason, password, message); if (handle) { return; } } // If no listeners handled the invitation, default to generic invite. final InvitationUI inviteDialog = new InvitationUI(conn, room, inviter, reason, password, message); SparkManager.getWorkspace().addAlert(inviteDialog); // Alert if necessary SparkManager.getAlertManager().flashWindow(SparkManager.getMainWindow()); } }); } }); }
SparkManager.getAlertManager().flashWindow(SparkManager.getMainWindow());
SparkManager.getAlertManager().flashWindowStopOnFocus(SparkManager.getMainWindow());
public void invitationReceived(final XMPPConnection conn, final String room, final String inviter, final String reason, final String password, final Message message) { SwingUtilities.invokeLater(new Runnable() { public void run() { Collection listeners = new ArrayList(SparkManager.getChatManager().getInvitationListeners()); Iterator iter = listeners.iterator(); while (iter.hasNext()) { RoomInvitationListener listener = (RoomInvitationListener)iter.next(); boolean handle = listener.handleInvitation(conn, room, inviter, reason, password, message); if (handle) { return; } } // If no listeners handled the invitation, default to generic invite. final InvitationUI inviteDialog = new InvitationUI(conn, room, inviter, reason, password, message); SparkManager.getWorkspace().addAlert(inviteDialog); // Alert if necessary SparkManager.getAlertManager().flashWindow(SparkManager.getMainWindow()); } }); }
SparkManager.getAlertManager().flashWindow(SparkManager.getMainWindow());
SparkManager.getAlertManager().flashWindowStopOnFocus(SparkManager.getMainWindow());
public void run() { Collection listeners = new ArrayList(SparkManager.getChatManager().getInvitationListeners()); Iterator iter = listeners.iterator(); while (iter.hasNext()) { RoomInvitationListener listener = (RoomInvitationListener)iter.next(); boolean handle = listener.handleInvitation(conn, room, inviter, reason, password, message); if (handle) { return; } } // If no listeners handled the invitation, default to generic invite. final InvitationUI inviteDialog = new InvitationUI(conn, room, inviter, reason, password, message); SparkManager.getWorkspace().addAlert(inviteDialog); // Alert if necessary SparkManager.getAlertManager().flashWindow(SparkManager.getMainWindow()); }
this.bookmarks = bookmarks;
public void setBookmarks(Collection bookmarks) { Iterator iter = bookmarks.iterator(); while (iter.hasNext()) { Bookmark bookmark = (Bookmark)iter.next(); String serviceName = bookmark.getServiceName(); String roomJID = bookmark.getRoomJID(); String roomName = bookmark.getRoomName(); // Get Service Node TreePath path = tree.findByName(tree, new String[]{rootNode.getUserObject().toString(), serviceName}); JiveTreeNode serviceNode = null; if (path == null) { serviceNode = addServiceToList(serviceName); path = tree.findByName(tree, new String[]{rootNode.getUserObject().toString(), serviceName}); } else { serviceNode = (JiveTreeNode)path.getLastPathComponent(); } addBookmark(serviceNode, roomName, roomJID); tree.expandPath(path); } SwingWorker worker = new SwingWorker() { public Object construct() { try { Thread.sleep(2000); } catch (InterruptedException e) { Log.error(e); } return getAutoJoins(); } public void finished() { Collection col = (Collection)get(); if (col != null) { joinTaggedRooms(col); } } }; worker.start(); }
assertNotNull(obj);
public void testFoo() { SomeOtherClass obj = new SomeOtherClass(); obj.incrementCounter(); obj.incrementCounter(); obj.incrementCounter(); obj.decrementCounter(); obj.decrementCounter(); obj.decrementCounter(); obj.decrementCounter(); obj.getCounter(); }
e = Expression();
final public ListBuilder ArgList() throws ParseException { ListBuilder list = new ListBuilder(); Object e; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case DOLLAR: case QUOTE: case NULL: case TRUE: case FALSE: case LPAREN: case LBRACKET: case OP_MINUS: case OP_NOT: case NUMBER: e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[29] = jj_gen; ; } list.addElement(e); label_3: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: jj_la1[30] = jj_gen; break label_3; } jj_consume_token(COMMA); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[31] = jj_gen; ; } e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[32] = jj_gen; ; } list.addElement(e); } break; default: jj_la1[33] = jj_gen; ; } {if (true) return list;} throw new Error("Missing return statement in function"); }
list.addElement(e);
e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[30] = jj_gen; ; } list.addElement(e);
final public ListBuilder ArgList() throws ParseException { ListBuilder list = new ListBuilder(); Object e; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case DOLLAR: case QUOTE: case NULL: case TRUE: case FALSE: case LPAREN: case LBRACKET: case OP_MINUS: case OP_NOT: case NUMBER: e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[29] = jj_gen; ; } list.addElement(e); label_3: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: jj_la1[30] = jj_gen; break label_3; } jj_consume_token(COMMA); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[31] = jj_gen; ; } e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[32] = jj_gen; ; } list.addElement(e); } break; default: jj_la1[33] = jj_gen; ; } {if (true) return list;} throw new Error("Missing return statement in function"); }
jj_la1[30] = jj_gen;
jj_la1[31] = jj_gen;
final public ListBuilder ArgList() throws ParseException { ListBuilder list = new ListBuilder(); Object e; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case DOLLAR: case QUOTE: case NULL: case TRUE: case FALSE: case LPAREN: case LBRACKET: case OP_MINUS: case OP_NOT: case NUMBER: e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[29] = jj_gen; ; } list.addElement(e); label_3: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: jj_la1[30] = jj_gen; break label_3; } jj_consume_token(COMMA); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[31] = jj_gen; ; } e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[32] = jj_gen; ; } list.addElement(e); } break; default: jj_la1[33] = jj_gen; ; } {if (true) return list;} throw new Error("Missing return statement in function"); }
jj_la1[31] = jj_gen;
jj_la1[32] = jj_gen;
final public ListBuilder ArgList() throws ParseException { ListBuilder list = new ListBuilder(); Object e; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case DOLLAR: case QUOTE: case NULL: case TRUE: case FALSE: case LPAREN: case LBRACKET: case OP_MINUS: case OP_NOT: case NUMBER: e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[29] = jj_gen; ; } list.addElement(e); label_3: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: jj_la1[30] = jj_gen; break label_3; } jj_consume_token(COMMA); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[31] = jj_gen; ; } e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[32] = jj_gen; ; } list.addElement(e); } break; default: jj_la1[33] = jj_gen; ; } {if (true) return list;} throw new Error("Missing return statement in function"); }
jj_la1[32] = jj_gen;
jj_la1[33] = jj_gen;
final public ListBuilder ArgList() throws ParseException { ListBuilder list = new ListBuilder(); Object e; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case DOLLAR: case QUOTE: case NULL: case TRUE: case FALSE: case LPAREN: case LBRACKET: case OP_MINUS: case OP_NOT: case NUMBER: e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[29] = jj_gen; ; } list.addElement(e); label_3: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: jj_la1[30] = jj_gen; break label_3; } jj_consume_token(COMMA); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[31] = jj_gen; ; } e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[32] = jj_gen; ; } list.addElement(e); } break; default: jj_la1[33] = jj_gen; ; } {if (true) return list;} throw new Error("Missing return statement in function"); }
jj_la1[33] = jj_gen;
jj_la1[34] = jj_gen;
final public ListBuilder ArgList() throws ParseException { ListBuilder list = new ListBuilder(); Object e; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case DOLLAR: case QUOTE: case NULL: case TRUE: case FALSE: case LPAREN: case LBRACKET: case OP_MINUS: case OP_NOT: case NUMBER: e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[29] = jj_gen; ; } list.addElement(e); label_3: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: jj_la1[30] = jj_gen; break label_3; } jj_consume_token(COMMA); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[31] = jj_gen; ; } e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[32] = jj_gen; ; } list.addElement(e); } break; default: jj_la1[33] = jj_gen; ; } {if (true) return list;} throw new Error("Missing return statement in function"); }
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[34] = jj_gen; ; }
final public ListBuilder BracketList() throws ParseException { ListBuilder list; jj_consume_token(LBRACKET); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[34] = jj_gen; ; } list = ArgList(); jj_consume_token(RBRACKET); {if (true) return list;} throw new Error("Missing return statement in function"); }
public void ReInit(java.io.Reader dstream)
public void ReInit(java.io.Reader dstream, int startline, int startcolumn, int buffersize)
public void ReInit(java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); }
ReInit(dstream, 1, 1, 4096);
inputStream = dstream; line = startline; column = startcolumn - 1; if (bufA == null || bufA.size != buffersize) bufA = new Buffer(buffersize); if (bufB == null || bufB.size != buffersize) bufB = new Buffer(buffersize); curBuf = bufA; otherBuf = bufB; curBuf.curPos = otherBuf.dataLen = -1; curBuf.dataLen = otherBuf.dataLen = 0; prevCharIsLF = prevCharIsCR = false; tokenBeginPos = -1; tokenBeginBuf = null; backupChars = 0;
public void ReInit(java.io.Reader dstream) { ReInit(dstream, 1, 1, 4096); }
FastWriter fw = new FastWriter(os, "UTF8");
FastWriter fw = new FastWriter(os, context.getEncoding());
public Object evaluate(Context context) throws ContextException { try { ByteArrayOutputStream os = new ByteArrayOutputStream(_content.length * 16 + 256); FastWriter fw = new FastWriter(os, "UTF8"); write(fw,context); fw.flush(); return os.toString("UTF8"); } catch (IOException e) { Engine.log.exception(e); Engine.log.error("StringWriter through an IOException!"); return null; } }
return os.toString("UTF8");
return os.toString(context.getEncoding());
public Object evaluate(Context context) throws ContextException { try { ByteArrayOutputStream os = new ByteArrayOutputStream(_content.length * 16 + 256); FastWriter fw = new FastWriter(os, "UTF8"); write(fw,context); fw.flush(); return os.toString("UTF8"); } catch (IOException e) { Engine.log.exception(e); Engine.log.error("StringWriter through an IOException!"); return null; } }
try { directive = (Directive) desc.dirClass.newInstance(); } catch (Exception e) { };
public DirectiveBuilder(DirectiveDescriptor desc) { this.desc = desc; if (desc.args != null && desc.args.length > 0) buildArgs = new ArgsHolder(desc.args); if (desc.subdirectives != null && desc.subdirectives.length > 0) subdirectives = new Object[desc.subdirectives.length]; try { directive = (Directive) desc.dirClass.newInstance(); } catch (Exception e) { // If directive is null, we'll throw a build exception when we build }; }
FileFinder finder) throws IOException
FileFinder finder, ComplexityCalculator complexity) throws IOException
public XMLReport(ProjectData projectData, File destinationDir, FileFinder finder) throws IOException { this.finder = finder; pw = new PrintWriter(new FileWriter(new File(destinationDir, "coverage.xml"))); try { println("<?xml version=\"1.0\"?>"); println("<!DOCTYPE coverage SYSTEM \"http://cobertura.sourceforge.net/xml/" + coverageDTD + "\">"); println(""); // TODO: Set a schema? //println("<coverage " + sourceDirectories.toString() + " xmlns=\"http://cobertura.sourceforge.net\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://cobertura.sourceforge.net/xml/coverage.xsd\">"); println("<coverage line-rate=\"" + projectData.getLineCoverageRate() + "\" branch-rate=\"" + projectData.getBranchCoverageRate() + "\" version=\"" + Header.version() + "\" timestamp=\"" + new Date().getTime() + "\">"); increaseIndentation(); dumpSources(); dumpPackages(projectData); decreaseIndentation(); println("</coverage>"); } finally { pw.close(); } }
this.complexity = complexity;
public XMLReport(ProjectData projectData, File destinationDir, FileFinder finder) throws IOException { this.finder = finder; pw = new PrintWriter(new FileWriter(new File(destinationDir, "coverage.xml"))); try { println("<?xml version=\"1.0\"?>"); println("<!DOCTYPE coverage SYSTEM \"http://cobertura.sourceforge.net/xml/" + coverageDTD + "\">"); println(""); // TODO: Set a schema? //println("<coverage " + sourceDirectories.toString() + " xmlns=\"http://cobertura.sourceforge.net\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://cobertura.sourceforge.net/xml/coverage.xsd\">"); println("<coverage line-rate=\"" + projectData.getLineCoverageRate() + "\" branch-rate=\"" + projectData.getBranchCoverageRate() + "\" version=\"" + Header.version() + "\" timestamp=\"" + new Date().getTime() + "\">"); increaseIndentation(); dumpSources(); dumpPackages(projectData); decreaseIndentation(); println("</coverage>"); } finally { pw.close(); } }
double ccn = Util.getCCN(finder.findFile(classData .getSourceFileName()), false);
private void dumpClass(ClassData classData) { logger.debug("Dumping class " + classData.getName()); double ccn = Util.getCCN(finder.findFile(classData .getSourceFileName()), false); println("<class name=\"" + classData.getName() + "\" filename=\"" + classData.getSourceFileName() + "\" line-rate=\"" + classData.getLineCoverageRate() + "\" branch-rate=\"" + classData.getBranchCoverageRate() + "\" complexity=\"" + ccn + "\"" + ">"); increaseIndentation(); dumpMethods(classData); dumpLines(classData); decreaseIndentation(); println("</class>"); }
+ ccn + "\"" + ">");
+ complexity.getCCNForClass(classData) + "\"" + ">");
private void dumpClass(ClassData classData) { logger.debug("Dumping class " + classData.getName()); double ccn = Util.getCCN(finder.findFile(classData .getSourceFileName()), false); println("<class name=\"" + classData.getName() + "\" filename=\"" + classData.getSourceFileName() + "\" line-rate=\"" + classData.getLineCoverageRate() + "\" branch-rate=\"" + classData.getBranchCoverageRate() + "\" complexity=\"" + ccn + "\"" + ">"); increaseIndentation(); dumpMethods(classData); dumpLines(classData); decreaseIndentation(); println("</class>"); }
double ccn = packageData.getCCN(finder);
private void dumpPackage(PackageData packageData) { logger.debug("Dumping package " + packageData.getName()); double ccn = packageData.getCCN(finder); println("<package name=\"" + packageData.getName() + "\" line-rate=\"" + packageData.getLineCoverageRate() + "\" branch-rate=\"" + packageData.getBranchCoverageRate() + "\" complexity=\"" + ccn + "\"" + ">"); increaseIndentation(); dumpSourceFiles(packageData); decreaseIndentation(); println("</package>"); }
+ "\" complexity=\"" + ccn + "\"" + ">");
+ "\" complexity=\"" + complexity.getCCNForPackage(packageData) + "\"" + ">");
private void dumpPackage(PackageData packageData) { logger.debug("Dumping package " + packageData.getName()); double ccn = packageData.getCCN(finder); println("<package name=\"" + packageData.getName() + "\" line-rate=\"" + packageData.getLineCoverageRate() + "\" branch-rate=\"" + packageData.getBranchCoverageRate() + "\" complexity=\"" + ccn + "\"" + ">"); increaseIndentation(); dumpSourceFiles(packageData); decreaseIndentation(); println("</package>"); }
private void dumpSource(File sourceDirectory)
private void dumpSource(String sourceDirectory)
private void dumpSource(File sourceDirectory) { println("<source>" + sourceDirectory.getAbsolutePath() + "</source>"); }
println("<source>" + sourceDirectory.getAbsolutePath() + "</source>");
println("<source>" + sourceDirectory + "</source>");
private void dumpSource(File sourceDirectory) { println("<source>" + sourceDirectory.getAbsolutePath() + "</source>"); }
for (Iterator it = finder.getBaseDirectories().iterator(); it.hasNext(); ) { File dir = (File) it.next();
for (Iterator it = finder.getSourceDirectoryList().iterator(); it.hasNext(); ) { String dir = (String) it.next();
private void dumpSources() { println("<sources>"); increaseIndentation(); for (Iterator it = finder.getBaseDirectories().iterator(); it.hasNext(); ) { File dir = (File) it.next(); dumpSource(dir); } decreaseIndentation(); println("</sources>"); }
template = props.getProperty (page.getTitle());
if (props.getProperty (page.getTitle()) != null) template = props.getProperty (page.getTitle());
public String getTemplateName(WikiSystem wiki, WikiPage page) { Properties props = wiki.getProperties(); String template = props.getProperty ("ViewPageAction.Template"); if (page != null) { template = props.getProperty (page.getTitle()); } return template; }
generateClassLists();
generateSourceFileLists();
public HTMLReport(ProjectData projectData, File outputDir, File sourceDir) throws Exception { this.destinationDir = outputDir; this.sourceDir = sourceDir; this.projectData = projectData; CopyFiles.copy(outputDir); generatePackageList(); generateClassLists(); generateOverviews(); generateSourceFiles(); }
Collection classes;
Collection sourceFiles;
private void generateOverview(PackageData packageData) throws IOException { Iterator iter; String filename; if (packageData == null) { filename = "frame-summary.html"; } else { filename = "frame-summary-" + packageData.getName() + ".html"; } File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/sortabletable.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out .println("<script type=\"text/javascript\" src=\"js/sortabletable.js\"></script>"); out .println("<script type=\"text/javascript\" src=\"js/customsorttypes.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); out.print(packageData == null ? "All Packages" : generatePackageName(packageData)); out.println("</h5>"); out.println("<p>"); out.println("<table class=\"report\" id=\"packageResults\">"); out.println("<thead>"); out.println("<tr>"); out.println(" <td class=\"heading\">Package</td>"); out.println(" <td class=\"heading\"># Classes</td>"); out.println(generateCommonTableColumns()); out.println("</tr>"); out.println("</thead>"); out.println("<tbody>"); Collection packages; if (packageData == null) { // Output a summary line for all packages out.println(generateTableRowForTotal()); // Get packages packages = projectData.getChildren(); } else { // Get subpackages packages = projectData.getSubPackages(packageData.getName()); } // Output a line for each package or subpackage iter = packages.iterator(); while (iter.hasNext()) { PackageData subPackageData = (PackageData)iter.next(); out.println(generateTableRowForPackage(subPackageData)); } out.println("</tbody>"); out.println("</table>"); out.println("<script type=\"text/javascript\">"); out .println("var packageTable = new SortableTable(document.getElementById(\"packageResults\"),"); out .println(" [\"String\", \"Number\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);"); out.println("packageTable.sort(0);"); out.println("</script>"); out.println("</p>"); // Get the list of classes in this package Collection classes; if (packageData == null) { classes = new TreeSet(); if (projectData.getNumberOfClasses() > 0) { iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); if (classData.getPackageName() == null) { classes.add(classData); } } } } else { classes = packageData.getClasses(); } // Output a line for each class if (classes.size() > 0) { out.println("<p>"); out.println("<table class=\"report\" id=\"classResults\">"); out.println(generateTableHeaderForClasses()); out.println("<tbody>"); iter = classes.iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); out.println(generateTableRowForClass(classData)); } out.println("</tbody>"); out.println("</table>"); out.println("<script type=\"text/javascript\">"); out .println("var classTable = new SortableTable(document.getElementById(\"classResults\"),"); out .println(" [\"String\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);"); out.println("classTable.sort(0);"); out.println("</script>"); out.println("</p>"); } out.println("<div class=\"footer\">"); out .println("Report generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } }
classes = new TreeSet(); if (projectData.getNumberOfClasses() > 0) { iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); if (classData.getPackageName() == null) { classes.add(classData); } } }
sourceFiles = projectData.getSourceFiles();
private void generateOverview(PackageData packageData) throws IOException { Iterator iter; String filename; if (packageData == null) { filename = "frame-summary.html"; } else { filename = "frame-summary-" + packageData.getName() + ".html"; } File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/sortabletable.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out .println("<script type=\"text/javascript\" src=\"js/sortabletable.js\"></script>"); out .println("<script type=\"text/javascript\" src=\"js/customsorttypes.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); out.print(packageData == null ? "All Packages" : generatePackageName(packageData)); out.println("</h5>"); out.println("<p>"); out.println("<table class=\"report\" id=\"packageResults\">"); out.println("<thead>"); out.println("<tr>"); out.println(" <td class=\"heading\">Package</td>"); out.println(" <td class=\"heading\"># Classes</td>"); out.println(generateCommonTableColumns()); out.println("</tr>"); out.println("</thead>"); out.println("<tbody>"); Collection packages; if (packageData == null) { // Output a summary line for all packages out.println(generateTableRowForTotal()); // Get packages packages = projectData.getChildren(); } else { // Get subpackages packages = projectData.getSubPackages(packageData.getName()); } // Output a line for each package or subpackage iter = packages.iterator(); while (iter.hasNext()) { PackageData subPackageData = (PackageData)iter.next(); out.println(generateTableRowForPackage(subPackageData)); } out.println("</tbody>"); out.println("</table>"); out.println("<script type=\"text/javascript\">"); out .println("var packageTable = new SortableTable(document.getElementById(\"packageResults\"),"); out .println(" [\"String\", \"Number\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);"); out.println("packageTable.sort(0);"); out.println("</script>"); out.println("</p>"); // Get the list of classes in this package Collection classes; if (packageData == null) { classes = new TreeSet(); if (projectData.getNumberOfClasses() > 0) { iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); if (classData.getPackageName() == null) { classes.add(classData); } } } } else { classes = packageData.getClasses(); } // Output a line for each class if (classes.size() > 0) { out.println("<p>"); out.println("<table class=\"report\" id=\"classResults\">"); out.println(generateTableHeaderForClasses()); out.println("<tbody>"); iter = classes.iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); out.println(generateTableRowForClass(classData)); } out.println("</tbody>"); out.println("</table>"); out.println("<script type=\"text/javascript\">"); out .println("var classTable = new SortableTable(document.getElementById(\"classResults\"),"); out .println(" [\"String\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);"); out.println("classTable.sort(0);"); out.println("</script>"); out.println("</p>"); } out.println("<div class=\"footer\">"); out .println("Report generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } }
classes = packageData.getClasses();
sourceFiles = packageData.getSourceFiles();
private void generateOverview(PackageData packageData) throws IOException { Iterator iter; String filename; if (packageData == null) { filename = "frame-summary.html"; } else { filename = "frame-summary-" + packageData.getName() + ".html"; } File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/sortabletable.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out .println("<script type=\"text/javascript\" src=\"js/sortabletable.js\"></script>"); out .println("<script type=\"text/javascript\" src=\"js/customsorttypes.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); out.print(packageData == null ? "All Packages" : generatePackageName(packageData)); out.println("</h5>"); out.println("<p>"); out.println("<table class=\"report\" id=\"packageResults\">"); out.println("<thead>"); out.println("<tr>"); out.println(" <td class=\"heading\">Package</td>"); out.println(" <td class=\"heading\"># Classes</td>"); out.println(generateCommonTableColumns()); out.println("</tr>"); out.println("</thead>"); out.println("<tbody>"); Collection packages; if (packageData == null) { // Output a summary line for all packages out.println(generateTableRowForTotal()); // Get packages packages = projectData.getChildren(); } else { // Get subpackages packages = projectData.getSubPackages(packageData.getName()); } // Output a line for each package or subpackage iter = packages.iterator(); while (iter.hasNext()) { PackageData subPackageData = (PackageData)iter.next(); out.println(generateTableRowForPackage(subPackageData)); } out.println("</tbody>"); out.println("</table>"); out.println("<script type=\"text/javascript\">"); out .println("var packageTable = new SortableTable(document.getElementById(\"packageResults\"),"); out .println(" [\"String\", \"Number\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);"); out.println("packageTable.sort(0);"); out.println("</script>"); out.println("</p>"); // Get the list of classes in this package Collection classes; if (packageData == null) { classes = new TreeSet(); if (projectData.getNumberOfClasses() > 0) { iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); if (classData.getPackageName() == null) { classes.add(classData); } } } } else { classes = packageData.getClasses(); } // Output a line for each class if (classes.size() > 0) { out.println("<p>"); out.println("<table class=\"report\" id=\"classResults\">"); out.println(generateTableHeaderForClasses()); out.println("<tbody>"); iter = classes.iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); out.println(generateTableRowForClass(classData)); } out.println("</tbody>"); out.println("</table>"); out.println("<script type=\"text/javascript\">"); out .println("var classTable = new SortableTable(document.getElementById(\"classResults\"),"); out .println(" [\"String\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);"); out.println("classTable.sort(0);"); out.println("</script>"); out.println("</p>"); } out.println("<div class=\"footer\">"); out .println("Report generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } }
if (classes.size() > 0)
if (sourceFiles.size() > 0)
private void generateOverview(PackageData packageData) throws IOException { Iterator iter; String filename; if (packageData == null) { filename = "frame-summary.html"; } else { filename = "frame-summary-" + packageData.getName() + ".html"; } File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/sortabletable.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out .println("<script type=\"text/javascript\" src=\"js/sortabletable.js\"></script>"); out .println("<script type=\"text/javascript\" src=\"js/customsorttypes.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); out.print(packageData == null ? "All Packages" : generatePackageName(packageData)); out.println("</h5>"); out.println("<p>"); out.println("<table class=\"report\" id=\"packageResults\">"); out.println("<thead>"); out.println("<tr>"); out.println(" <td class=\"heading\">Package</td>"); out.println(" <td class=\"heading\"># Classes</td>"); out.println(generateCommonTableColumns()); out.println("</tr>"); out.println("</thead>"); out.println("<tbody>"); Collection packages; if (packageData == null) { // Output a summary line for all packages out.println(generateTableRowForTotal()); // Get packages packages = projectData.getChildren(); } else { // Get subpackages packages = projectData.getSubPackages(packageData.getName()); } // Output a line for each package or subpackage iter = packages.iterator(); while (iter.hasNext()) { PackageData subPackageData = (PackageData)iter.next(); out.println(generateTableRowForPackage(subPackageData)); } out.println("</tbody>"); out.println("</table>"); out.println("<script type=\"text/javascript\">"); out .println("var packageTable = new SortableTable(document.getElementById(\"packageResults\"),"); out .println(" [\"String\", \"Number\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);"); out.println("packageTable.sort(0);"); out.println("</script>"); out.println("</p>"); // Get the list of classes in this package Collection classes; if (packageData == null) { classes = new TreeSet(); if (projectData.getNumberOfClasses() > 0) { iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); if (classData.getPackageName() == null) { classes.add(classData); } } } } else { classes = packageData.getClasses(); } // Output a line for each class if (classes.size() > 0) { out.println("<p>"); out.println("<table class=\"report\" id=\"classResults\">"); out.println(generateTableHeaderForClasses()); out.println("<tbody>"); iter = classes.iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); out.println(generateTableRowForClass(classData)); } out.println("</tbody>"); out.println("</table>"); out.println("<script type=\"text/javascript\">"); out .println("var classTable = new SortableTable(document.getElementById(\"classResults\"),"); out .println(" [\"String\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);"); out.println("classTable.sort(0);"); out.println("</script>"); out.println("</p>"); } out.println("<div class=\"footer\">"); out .println("Report generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } }
iter = classes.iterator();
iter = sourceFiles.iterator();
private void generateOverview(PackageData packageData) throws IOException { Iterator iter; String filename; if (packageData == null) { filename = "frame-summary.html"; } else { filename = "frame-summary-" + packageData.getName() + ".html"; } File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/sortabletable.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out .println("<script type=\"text/javascript\" src=\"js/sortabletable.js\"></script>"); out .println("<script type=\"text/javascript\" src=\"js/customsorttypes.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); out.print(packageData == null ? "All Packages" : generatePackageName(packageData)); out.println("</h5>"); out.println("<p>"); out.println("<table class=\"report\" id=\"packageResults\">"); out.println("<thead>"); out.println("<tr>"); out.println(" <td class=\"heading\">Package</td>"); out.println(" <td class=\"heading\"># Classes</td>"); out.println(generateCommonTableColumns()); out.println("</tr>"); out.println("</thead>"); out.println("<tbody>"); Collection packages; if (packageData == null) { // Output a summary line for all packages out.println(generateTableRowForTotal()); // Get packages packages = projectData.getChildren(); } else { // Get subpackages packages = projectData.getSubPackages(packageData.getName()); } // Output a line for each package or subpackage iter = packages.iterator(); while (iter.hasNext()) { PackageData subPackageData = (PackageData)iter.next(); out.println(generateTableRowForPackage(subPackageData)); } out.println("</tbody>"); out.println("</table>"); out.println("<script type=\"text/javascript\">"); out .println("var packageTable = new SortableTable(document.getElementById(\"packageResults\"),"); out .println(" [\"String\", \"Number\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);"); out.println("packageTable.sort(0);"); out.println("</script>"); out.println("</p>"); // Get the list of classes in this package Collection classes; if (packageData == null) { classes = new TreeSet(); if (projectData.getNumberOfClasses() > 0) { iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); if (classData.getPackageName() == null) { classes.add(classData); } } } } else { classes = packageData.getClasses(); } // Output a line for each class if (classes.size() > 0) { out.println("<p>"); out.println("<table class=\"report\" id=\"classResults\">"); out.println(generateTableHeaderForClasses()); out.println("<tbody>"); iter = classes.iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); out.println(generateTableRowForClass(classData)); } out.println("</tbody>"); out.println("</table>"); out.println("<script type=\"text/javascript\">"); out .println("var classTable = new SortableTable(document.getElementById(\"classResults\"),"); out .println(" [\"String\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);"); out.println("classTable.sort(0);"); out.println("</script>"); out.println("</p>"); } out.println("<div class=\"footer\">"); out .println("Report generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } }
ClassData classData = (ClassData)iter.next(); out.println(generateTableRowForClass(classData));
SourceFileData sourceFileData = (SourceFileData)iter .next(); out .println(generateTableRowForSourceFile(sourceFileData));
private void generateOverview(PackageData packageData) throws IOException { Iterator iter; String filename; if (packageData == null) { filename = "frame-summary.html"; } else { filename = "frame-summary-" + packageData.getName() + ".html"; } File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/sortabletable.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out .println("<script type=\"text/javascript\" src=\"js/sortabletable.js\"></script>"); out .println("<script type=\"text/javascript\" src=\"js/customsorttypes.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); out.print(packageData == null ? "All Packages" : generatePackageName(packageData)); out.println("</h5>"); out.println("<p>"); out.println("<table class=\"report\" id=\"packageResults\">"); out.println("<thead>"); out.println("<tr>"); out.println(" <td class=\"heading\">Package</td>"); out.println(" <td class=\"heading\"># Classes</td>"); out.println(generateCommonTableColumns()); out.println("</tr>"); out.println("</thead>"); out.println("<tbody>"); Collection packages; if (packageData == null) { // Output a summary line for all packages out.println(generateTableRowForTotal()); // Get packages packages = projectData.getChildren(); } else { // Get subpackages packages = projectData.getSubPackages(packageData.getName()); } // Output a line for each package or subpackage iter = packages.iterator(); while (iter.hasNext()) { PackageData subPackageData = (PackageData)iter.next(); out.println(generateTableRowForPackage(subPackageData)); } out.println("</tbody>"); out.println("</table>"); out.println("<script type=\"text/javascript\">"); out .println("var packageTable = new SortableTable(document.getElementById(\"packageResults\"),"); out .println(" [\"String\", \"Number\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);"); out.println("packageTable.sort(0);"); out.println("</script>"); out.println("</p>"); // Get the list of classes in this package Collection classes; if (packageData == null) { classes = new TreeSet(); if (projectData.getNumberOfClasses() > 0) { iter = projectData.getClasses().iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); if (classData.getPackageName() == null) { classes.add(classData); } } } } else { classes = packageData.getClasses(); } // Output a line for each class if (classes.size() > 0) { out.println("<p>"); out.println("<table class=\"report\" id=\"classResults\">"); out.println(generateTableHeaderForClasses()); out.println("<tbody>"); iter = classes.iterator(); while (iter.hasNext()) { ClassData classData = (ClassData)iter.next(); out.println(generateTableRowForClass(classData)); } out.println("</tbody>"); out.println("</table>"); out.println("<script type=\"text/javascript\">"); out .println("var classTable = new SortableTable(document.getElementById(\"classResults\"),"); out .println(" [\"String\", \"Percentage\", \"Percentage\", \"LocalizedNumber\"]);"); out.println("classTable.sort(0);"); out.println("</script>"); out.println("</p>"); } out.println("<div class=\"footer\">"); out .println("Report generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } }
.println("<td nowrap=\"nowrap\"><a href=\"frame-summary.html\" onClick='parent.classList.location.href=\"frame-classes.html\"' target=\"summary\">All</a></td>");
.println("<td nowrap=\"nowrap\"><a href=\"frame-summary.html\" onClick='parent.sourceFileList.location.href=\"frame-sourcefiles.html\"' target=\"summary\">All</a></td>");
private void generatePackageList() throws IOException { File file = new File(destinationDir, "frame-packages.html"); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out.println("</head>"); out.println("<body>"); out.println("<h5>Packages</h5>"); out.println("<table width=\"100%\">"); out.println("<tr>"); out .println("<td nowrap=\"nowrap\"><a href=\"frame-summary.html\" onClick='parent.classList.location.href=\"frame-classes.html\"' target=\"summary\">All</a></td>"); out.println("</tr>"); SortedSet sortedPackages = new TreeSet(); sortedPackages.addAll(projectData.getChildren()); Iterator iter = sortedPackages.iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); String url1 = "frame-summary-" + packageData.getName() + ".html"; String url2 = "frame-classes-" + packageData.getName() + ".html"; out.println("<tr>"); out.println("<td nowrap=\"nowrap\"><a href=\"" + url1 + "\" onClick='parent.classList.location.href=\"" + url2 + "\"' target=\"summary\">" + generatePackageName(packageData) + "</a></td>"); out.println("</tr>"); } out.println("</table>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } }
String url2 = "frame-classes-" + packageData.getName()
String url2 = "frame-sourcefiles-" + packageData.getName()
private void generatePackageList() throws IOException { File file = new File(destinationDir, "frame-packages.html"); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out.println("</head>"); out.println("<body>"); out.println("<h5>Packages</h5>"); out.println("<table width=\"100%\">"); out.println("<tr>"); out .println("<td nowrap=\"nowrap\"><a href=\"frame-summary.html\" onClick='parent.classList.location.href=\"frame-classes.html\"' target=\"summary\">All</a></td>"); out.println("</tr>"); SortedSet sortedPackages = new TreeSet(); sortedPackages.addAll(projectData.getChildren()); Iterator iter = sortedPackages.iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); String url1 = "frame-summary-" + packageData.getName() + ".html"; String url2 = "frame-classes-" + packageData.getName() + ".html"; out.println("<tr>"); out.println("<td nowrap=\"nowrap\"><a href=\"" + url1 + "\" onClick='parent.classList.location.href=\"" + url2 + "\"' target=\"summary\">" + generatePackageName(packageData) + "</a></td>"); out.println("</tr>"); } out.println("</table>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } }
out.println("<td nowrap=\"nowrap\"><a href=\"" + url1 + "\" onClick='parent.classList.location.href=\"" + url2 + "\"' target=\"summary\">" + generatePackageName(packageData) + "</a></td>");
out .println("<td nowrap=\"nowrap\"><a href=\"" + url1 + "\" onClick='parent.sourceFileList.location.href=\"" + url2 + "\"' target=\"summary\">" + generatePackageName(packageData) + "</a></td>");
private void generatePackageList() throws IOException { File file = new File(destinationDir, "frame-packages.html"); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out.println("</head>"); out.println("<body>"); out.println("<h5>Packages</h5>"); out.println("<table width=\"100%\">"); out.println("<tr>"); out .println("<td nowrap=\"nowrap\"><a href=\"frame-summary.html\" onClick='parent.classList.location.href=\"frame-classes.html\"' target=\"summary\">All</a></td>"); out.println("</tr>"); SortedSet sortedPackages = new TreeSet(); sortedPackages.addAll(projectData.getChildren()); Iterator iter = sortedPackages.iterator(); while (iter.hasNext()) { PackageData packageData = (PackageData)iter.next(); String url1 = "frame-summary-" + packageData.getName() + ".html"; String url2 = "frame-classes-" + packageData.getName() + ".html"; out.println("<tr>"); out.println("<td nowrap=\"nowrap\"><a href=\"" + url1 + "\" onClick='parent.classList.location.href=\"" + url2 + "\"' target=\"summary\">" + generatePackageName(packageData) + "</a></td>"); out.println("</tr>"); } out.println("</table>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } }