rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
if (start==end) break;
public void write(FastWriter out, Context context) throws PropertyException, IOException { int start=_start, end=_end, step = _step; Object tmp; // if necessary, do run-time evaluation of our // start, end, and step objects. if ( (tmp = _objStart) != null) { while (tmp instanceof Macro) tmp = ((Macro) tmp).evaluate(context); if (tmp != null) start = Integer.parseInt(tmp.toString()); else throw new PropertyException ("Starting value cannot be null"); } if ( (tmp = _objEnd) != null) { while (tmp instanceof Macro) tmp = ((Macro) tmp).evaluate(context); if (tmp != null) end = Integer.parseInt(tmp.toString()); else throw new PropertyException ("Ending value cannot be null"); } if ( (tmp = _objStep) != null) { while (tmp instanceof Macro) tmp = ((Macro) tmp).evaluate(context); if (tmp != null) step = Integer.parseInt(tmp.toString()); else throw new PropertyException ("Step value cannot be null"); } // negate the step, if necessary if ((start > end && step > 0) || (start < end && step < 0)) step = -step; // just do it for (; ; start+=step) { _iterator.setValue(context, new Integer(start)); _body.write(out, context); if (start==end) break; } }
e.printStackTrace();
log("Error handling request", e);
public final Template handle(WebContext wc) throws HandlerException { String pageName = null; WikiPage wikiPage = null; // who is trying to do something? WikiUser user = getUser (wc); // which action wants to respond to this request? PageAction action = _actionManager.getAction (wc, user); // use the action to determine which WikiPage // we should be dealing with if (action != null) pageName = action.getWikiPageName (_wiki, wc); if (pageName != null) wikiPage = _wiki.getPage (pageName); // stuff the webcontext with useful stuff stuffContext (wc, wikiPage, user, pageName); if (action == null) throw new HandlerException ("Unable to find a PageAction to handle" + " this request."); try { // attempt to perform the action against the page action.perform (_wiki, wc, user, wikiPage); } catch (PageAction.RedirectException re) { // action wants us to redirect somewhere else try { wc.getResponse().sendRedirect (re.getURL()); } catch (IOException ioe) { throw new HandlerException ("Cannot redirect to " + re.getURL(), ioe); } return null; } catch (Exception e) { // something bad happened while performing the action // TODO: Handle error and error template ourselves e.printStackTrace(); throw new HandlerException (e.toString()); } finally { if (user != null) _wiki.updateUser(user); } // the action performed successfully, so now return // the template it wants us to use try { // determine the template name and return String templateName = action.getTemplateName(_wiki, wikiPage); return getTemplate (templateName); } catch (ResourceException re) { throw new HandlerException ("Could not get template", re); } }
} if (packageBranchRate != null) { getJava().createArg().setValue("--packagebranch"); getJava().createArg().setValue(packageBranchRate); } if (packageLineRate != null) { getJava().createArg().setValue("--packageline"); getJava().createArg().setValue(packageLineRate);
public void execute() throws BuildException { if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } if (branchRate != null) { getJava().createArg().setValue("--branch"); getJava().createArg().setValue(branchRate); } if (lineRate != null) { getJava().createArg().setValue("--line"); getJava().createArg().setValue(lineRate); } if (totalBranchRate != null) { getJava().createArg().setValue("--totalbranch"); getJava().createArg().setValue(totalBranchRate); } if (totalLineRate != null) { getJava().createArg().setValue("--totalline"); getJava().createArg().setValue(totalLineRate); } Iterator iter = regexes.iterator(); while (iter.hasNext()) { getJava().createArg().setValue("--regex"); getJava().createArg().setValue(iter.next().toString()); } int returnCode = getJava().executeJava(); // Check the return code and print a message if (returnCode == 0) { System.out.println("All checks passed."); } else { if (haltOnFailure) throw new BuildException( "Coverage check failed. See messages above."); else if (failureProperty != null) getProject().setProperty(failureProperty, "true"); else System.err .println("Coverage check failed. See messages above."); } }
classes = packageData.getChildren();
classes = packageData.getClasses();
private void generateClassList(PackageData packageData) throws IOException { String filename; Collection classes; if (packageData == null) { filename = "frame-classes.html"; classes = projectData.getClasses(); } else { filename = "frame-classes-" + packageData.getName() + ".html"; classes = packageData.getChildren(); } 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 Classes</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out.println("</head>"); out.println("<body>"); out.println("<h5>"); out.println(packageData == null ? "All Packages" : generatePackageName(packageData)); out.println("</h5>"); out.println("<h5>Classes</h5>"); out.println("<table width=\"100%\">"); Map sortedClassList = new TreeMap(); for (Iterator iter = classes.iterator(); iter.hasNext();) { ClassData classData = (ClassData)iter.next(); sortedClassList.put(classData.getBaseName(), classData); } for (Iterator iter = sortedClassList.values().iterator(); iter .hasNext();) { ClassData classData = (ClassData)iter.next(); out.println("<tr>"); String percentCovered; if (classData.getNumberOfValidLines() > 0) percentCovered = getPercentValue(classData .getLineCoverageRate()); else percentCovered = "N/A"; out .println("<td nowrap=\"nowrap\"><a target=\"summary\" href=\"" + classData.getName() + ".html\">" + classData.getBaseName() + "</a> <i>(" + percentCovered + ")</i></td>"); out.println("</tr>"); } out.println("</td>"); out.println("</tr>"); out.println("</table>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } }
classes = packageData.getChildren();
classes = packageData.getClasses();
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.getChildren(); } // 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 (query.startsWith("/")) { query = query.substring(1); }
public Template load(String query, CacheElement ce) throws ResourceException { URL url = loader.getResource(path.concat(query)); if (url != null && log.loggingDebug()) { log.debug("ClassPathTemplateProvider: Found Template " + url.toString()); } return (url != null) ? helper.load(url, ce) : null; }
if (config.startsWith("/")) { config = config.substring(1); }
public void setConfig(String config) { // as we'll later use this as a prefix, it should end with a slash if (config.length() > 0 && !config.endsWith("/")) { if (log.loggingInfo()) log.info("ClassPathTemplateLoader: appending \"/\" to path " + config); config = config.concat("/"); } // It isn't clear from the javadocs, whether ClassLoader.getResource() // needs a starting slash, so won't add one at the moment. this.path = config; }
if (log != null) log = new StringBuffer();
private void addTool(String key, String className, String suffix) { Class c; try { c = _broker.classForName(className); } catch (ClassNotFoundException e) { _log.warning("Context: Could not locate class for context tool " + className); return; } if (key == null || key.equals("")) { key = className; int start = 0; int end = key.length(); int lastDot = key.lastIndexOf('.'); if (lastDot != -1) { start = lastDot + 1; } if (key.endsWith(suffix)) { end -= suffix.length(); } key = key.substring(start, end); } Object instance = null; StringBuffer log = null; try { Constructor ctor = c.getConstructor(_ctorArgs1); Object[] args = new Object[2]; args[0] = key; args[1] = new SubSettings(_broker.getSettings(), key); instance = ctor.newInstance(args); } catch (Exception e) { log = new StringBuffer(); log.append("Error loading component key="); log.append(key); log.append(" class="); log.append(c.toString()); log.append("\n"); log.append("Trying 2-argument constructor: "); log.append(e.toString()); log.append("\n"); } if (instance == null) { try { Constructor ctor = c.getConstructor(_ctorArgs2); Object[] args = new Object[1]; args[0] = key; instance = ctor.newInstance(args); } catch (Exception e) { log.append("Trying 1-argument constructor: "); log.append(e.toString()); log.append("\n"); } } if (instance == null) { try { instance = c.newInstance(); } catch (Exception e) { log.append("Trying 0-argument constructor: "); log.append(e.toString()); log.append("\n"); _log.warning(log.toString()); return; } } _tools.put(key, instance); _log.info("Registered ContextTool " + key); }
static private String makeName(Object[] names) {
static protected String makeName(Object[] names) {
static private String makeName(Object[] names) { StringBuffer buf = new StringBuffer(); buf.append("$("); for (int i = 0; i < names.length; i++) { if (i != 0) buf.append("."); buf.append((names[i] != null) ? names[i] : "NULL"); } buf.append(")"); return buf.toString(); }
ClassLoader beanClassLoader = getBeanDefinitionReader().getBeanClassLoader(); if (beanClassLoader != null) { try { return beanClassLoader.loadClass(name); } catch (ClassNotFoundException e) { } }
protected Class loadClass(String name) throws ClassNotFoundException { ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); if (contextClassLoader != null) { try { return contextClassLoader.loadClass(name); } catch (ClassNotFoundException e) { } } return getClass().getClassLoader().loadClass(name); }
private UnregisterServiceManager(ServiceManager serviceManager, StopStrategy stopStrategy, Throwable[] futureThrowable) {
private UnregisterServiceManager(ServiceManager serviceManager, StopStrategy stopStrategy) {
private UnregisterServiceManager(ServiceManager serviceManager, StopStrategy stopStrategy, Throwable[] futureThrowable) { this.serviceManager = serviceManager; this.stopStrategy = stopStrategy; this.futureThrowable = futureThrowable; }
this.futureThrowable = futureThrowable;
private UnregisterServiceManager(ServiceManager serviceManager, StopStrategy stopStrategy, Throwable[] futureThrowable) { this.serviceManager = serviceManager; this.stopStrategy = stopStrategy; this.futureThrowable = futureThrowable; }
synchronized (futureThrowable) { futureThrowable[0] = e;
synchronized (this) { throwable = e;
public Object call() { try { serviceManager.destroy(stopStrategy); synchronized (serviceManagers) { serviceManagers.remove(serviceManager.getServiceName()); } return null; } catch (Throwable e) { // we did not destroy the service... save the exception and return the service manager // so it remains registered with the kernel synchronized (futureThrowable) { futureThrowable[0] = e; } return serviceManager; } }
stop();
final public synchronized void destroy() { _wm.destroy(); _wm = null; _started = false; super.destroy(); }
public DisplayedNote(NoteTreeNode treeNode, Note note) { this.treeNode = treeNode;
public DisplayedNote(DisplayedNote parent, Note note) {
public DisplayedNote(NoteTreeNode treeNode, Note note) { this.treeNode = treeNode; this.note = note; }
this.treeNode = new NoteTreeNode(parent.treeNode, this); for (Note n : note.getChildren()) { new DisplayedNote(this, n); }
public DisplayedNote(NoteTreeNode treeNode, Note note) { this.treeNode = treeNode; this.note = note; }
if (constructorMetadata.getProperties().containsKey("always-use")) { return constructorMetadata; } List constructorArgNames = getConstructorArgNames(constructorMetadata); if (constructorArgNames != null && propertyNames.containsAll(constructorArgNames)) {
if (isUsableConstructor(constructorMetadata, propertyNames)) {
private ConstructorMetadata getConstructor(RootBeanDefinition rootBeanDefinition) { Class beanType = rootBeanDefinition.getBeanClass(); // try to get the class metadata ClassMetadata classMetadata = metadataManager.getClassMetadata(beanType); // get a set containing the names of the defined properties Set propertyNames = new HashSet(); PropertyValue[] values = rootBeanDefinition.getPropertyValues().getPropertyValues(); for (int i = 0; i < values.length; i++) { propertyNames.add(values[i].getName()); } // get the constructors sorted by longest arg length first List constructors = new ArrayList(classMetadata.getConstructors()); Collections.sort(constructors, new ArgLengthComparator()); // try to find a constructor for which we have all of the properties defined for (Iterator iterator = constructors.iterator(); iterator.hasNext();) { ConstructorMetadata constructorMetadata = (ConstructorMetadata) iterator.next(); if (constructorMetadata.getProperties().containsKey("always-use")) { return constructorMetadata; } List constructorArgNames = getConstructorArgNames(constructorMetadata); if (constructorArgNames != null && propertyNames.containsAll(constructorArgNames)) { return constructorMetadata; } } return null; }
public void visitBeanDefinition(BeanDefinition beanDefinition) throws BeansException { super.visitBeanDefinition(beanDefinition);
public void visitBeanDefinition(BeanDefinition beanDefinition, Object data) throws BeansException { super.visitBeanDefinition(beanDefinition, data);
public void visitBeanDefinition(BeanDefinition beanDefinition) throws BeansException { super.visitBeanDefinition(beanDefinition); if (!(beanDefinition instanceof RootBeanDefinition)) { return; } RootBeanDefinition rootBeanDefinition = ((RootBeanDefinition) beanDefinition); parametersToConstructorArgs(rootBeanDefinition); }
parametersToConstructorArgs(rootBeanDefinition);
processParameters(rootBeanDefinition);
public void visitBeanDefinition(BeanDefinition beanDefinition) throws BeansException { super.visitBeanDefinition(beanDefinition); if (!(beanDefinition instanceof RootBeanDefinition)) { return; } RootBeanDefinition rootBeanDefinition = ((RootBeanDefinition) beanDefinition); parametersToConstructorArgs(rootBeanDefinition); }
r = (TimedReference) _cache.get(query);
public Object get(final String query) throws NotFoundException { TimedReference r; try { r = (TimedReference) _cache.get(query); } catch (NullPointerException e) { throw new NotFoundException(this + " is not initialized", e); } Object o = null; if (r != null) { o = r.get(); } if (o == null) { // DOUBLE CHECKED LOCKING IS DANGEROUS IN JAVA: // this looks like double-checked locking but it isn't, we // synchrnoized on a less expensive lock inside _cache.get() // the following ilne lets us simultaneously load up to // writeLocks.length resources. int lockIndex = Math.abs(query.hashCode()) % _writeLocks.length; synchronized(_writeLocks[lockIndex]) { if (r != null){ o = r.get(); } if (o == null) { r = load(query); if (r != null) { _cache.put(query,r); } o = r.get(); try { _log.debug("cached: " + query + " for " + r.getTimeout()); _tl.scheduleTime( new Runnable() { public void run() { _cache.remove(query); _log.debug("cache expired: " + query); } }, r.getTimeout()); } catch (Exception e) { _log.error("CachingProvider caught an exception", e); } } } } return o; }
URL u = new URL(evt.getName());
String name = evt.getName(); URL u; if (name.indexOf(":") < 3) { u = new URL("file",null,-1,name); } else { u = new URL(name); }
final public void resourceRequest(RequestResourceEvent evt) throws NotFoundException { try { URL u = new URL(evt.getName()); Reader in = new InputStreamReader(u.openStream()); char buf[] = new char[512]; StringWriter sw = new StringWriter(); int num; while ( (num = in.read(buf)) != -1 ) { sw.write(buf, 0, num); } evt.set(sw.toString()); in.close(); } catch (Exception e) { _log.exception(e); throw new NotFoundException( "Reactor: Unable to load URL " + evt.getName() + ":" + e); } }
if (branchCoverageRate != null) { getJava().createArg().setValue("--branch"); getJava().createArg().setValue(branchCoverageRate); }
public void execute() throws BuildException { if (branchCoverageRate != null) { getJava().createArg().setValue("--branch"); getJava().createArg().setValue(branchCoverageRate); } if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } Iterator i = regexes.iterator(); while (i.hasNext()) { getJava().createArg().setValue("--ignore"); getJava().createArg().setValue(i.next().toString()); } if (lineCoverageRate != null) { getJava().createArg().setValue("--line"); getJava().createArg().setValue(lineCoverageRate); } if (getJava().executeJava() != 0) { throw new BuildException(); } }
Iterator i = regexes.iterator(); while (i.hasNext())
if (branchCoverageRate != null)
public void execute() throws BuildException { if (branchCoverageRate != null) { getJava().createArg().setValue("--branch"); getJava().createArg().setValue(branchCoverageRate); } if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } Iterator i = regexes.iterator(); while (i.hasNext()) { getJava().createArg().setValue("--ignore"); getJava().createArg().setValue(i.next().toString()); } if (lineCoverageRate != null) { getJava().createArg().setValue("--line"); getJava().createArg().setValue(lineCoverageRate); } if (getJava().executeJava() != 0) { throw new BuildException(); } }
getJava().createArg().setValue("--ignore"); getJava().createArg().setValue(i.next().toString());
getJava().createArg().setValue("--branch"); getJava().createArg().setValue(branchCoverageRate);
public void execute() throws BuildException { if (branchCoverageRate != null) { getJava().createArg().setValue("--branch"); getJava().createArg().setValue(branchCoverageRate); } if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } Iterator i = regexes.iterator(); while (i.hasNext()) { getJava().createArg().setValue("--ignore"); getJava().createArg().setValue(i.next().toString()); } if (lineCoverageRate != null) { getJava().createArg().setValue("--line"); getJava().createArg().setValue(lineCoverageRate); } if (getJava().executeJava() != 0) { throw new BuildException(); } }
if (getJava().executeJava() != 0)
if (totalBranchCoverageRate != null)
public void execute() throws BuildException { if (branchCoverageRate != null) { getJava().createArg().setValue("--branch"); getJava().createArg().setValue(branchCoverageRate); } if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } Iterator i = regexes.iterator(); while (i.hasNext()) { getJava().createArg().setValue("--ignore"); getJava().createArg().setValue(i.next().toString()); } if (lineCoverageRate != null) { getJava().createArg().setValue("--line"); getJava().createArg().setValue(lineCoverageRate); } if (getJava().executeJava() != 0) { throw new BuildException(); } }
throw new BuildException();
getJava().createArg().setValue("--totalbranch"); getJava().createArg().setValue(totalBranchCoverageRate);
public void execute() throws BuildException { if (branchCoverageRate != null) { getJava().createArg().setValue("--branch"); getJava().createArg().setValue(branchCoverageRate); } if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } Iterator i = regexes.iterator(); while (i.hasNext()) { getJava().createArg().setValue("--ignore"); getJava().createArg().setValue(i.next().toString()); } if (lineCoverageRate != null) { getJava().createArg().setValue("--line"); getJava().createArg().setValue(lineCoverageRate); } if (getJava().executeJava() != 0) { throw new BuildException(); } }
if (totalLineCoverageRate != null) { getJava().createArg().setValue("--totalline"); getJava().createArg().setValue(totalLineCoverageRate); } Iterator iter = regexes.iterator(); while (iter.hasNext()) { getJava().createArg().setValue("--regex"); getJava().createArg().setValue(iter.next().toString()); } int returnCode = getJava().executeJava(); if (returnCode == 0) System.out.println("All checks passed."); else if (haltOnFailure) throw new BuildException( "Coverage check failed. See messages above."); else System.err.println("Coverage check failed. See messages above.");
public void execute() throws BuildException { if (branchCoverageRate != null) { getJava().createArg().setValue("--branch"); getJava().createArg().setValue(branchCoverageRate); } if (dataFile != null) { getJava().createArg().setValue("--datafile"); getJava().createArg().setValue(dataFile); } Iterator i = regexes.iterator(); while (i.hasNext()) { getJava().createArg().setValue("--ignore"); getJava().createArg().setValue(i.next().toString()); } if (lineCoverageRate != null) { getJava().createArg().setValue("--line"); getJava().createArg().setValue(lineCoverageRate); } if (getJava().executeJava() != 0) { throw new BuildException(); } }
KeyStroke appleStroke = KeyStroke.getKeyStroke(Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), 0); String appleString = org.jivesoftware.spark.util.StringUtils.keyStroke2String(appleStroke); this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(appleString + "w"), "appleStroke"); this.getActionMap().put("appleStroke", new AbstractAction("appleStroke") { public void actionPerformed(ActionEvent evt) { closeActiveRoom(); } });
private void addKeyNavigation() { KeyStroke leftStroke = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0); String leftStrokeString = org.jivesoftware.spark.util.StringUtils.keyStroke2String(leftStroke); // Handle Left Arrow this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("alt " + leftStrokeString + ""), "navigateLeft"); this.getActionMap().put("navigateLeft", new AbstractAction("navigateLeft") { public void actionPerformed(ActionEvent evt) { int selectedIndex = getSelectedIndex(); if (selectedIndex > 0) { setSelectedIndex(selectedIndex - 1); } else { setSelectedIndex(getTabCount() - 1); } } }); KeyStroke rightStroke = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0); String rightStrokeString = org.jivesoftware.spark.util.StringUtils.keyStroke2String(rightStroke); // Handle Right Arrow this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("alt " + rightStrokeString + ""), "navigateRight"); this.getActionMap().put("navigateRight", new AbstractAction("navigateRight") { public void actionPerformed(ActionEvent evt) { int selectedIndex = getSelectedIndex(); if (selectedIndex > -1) { int count = getTabCount(); if (selectedIndex == (count - 1)) { setSelectedIndex(0); } else { setSelectedIndex(selectedIndex + 1); } } } }); this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "escape"); this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("control W"), "escape"); this.getActionMap().put("escape", new AbstractAction("escape") { public void actionPerformed(ActionEvent evt) { closeActiveRoom(); } }); }
if (index == -1) { return; }
private void checkForStaleRooms() { int delay = 1000; // delay for 1 minute int period = 60000; // repeat every 30 seconds. Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { public void run() { for (ChatRoom chatRoom : getStaleChatRooms()) { // Turn tab gray int index = indexOfComponent(chatRoom); SparkTab tab = getTabAt(index); final JLabel titleLabel = tab.getTitleLabel(); titleLabel.setForeground(Color.gray); titleLabel.setFont(tab.getDefaultFont()); String jid = ((ChatRoomImpl)chatRoom).getParticipantJID(); Presence presence = SparkManager.getConnection().getRoster().getPresence(jid); if (presence == null || presence.getType() == Presence.Type.unavailable) { tab.setIcon(SparkRes.getImageIcon(SparkRes.IM_UNAVAILABLE_STALE_IMAGE)); } else if (presence != null) { Presence.Mode mode = presence.getMode(); if (mode == Presence.Mode.available) { tab.setIcon(SparkRes.getImageIcon(SparkRes.IM_AVAILABLE_STALE_IMAGE)); } else if (mode == Presence.Mode.away) { tab.setIcon(SparkRes.getImageIcon(SparkRes.IM_AWAY_STALE_IMAGE)); } else if (mode == Presence.Mode.chat) { tab.setIcon(SparkRes.getImageIcon(SparkRes.IM_FREE_CHAT_STALE_IMAGE)); } else if (mode == Presence.Mode.dnd) { tab.setIcon(SparkRes.getImageIcon(SparkRes.IM_DND_STALE_IMAGE)); } else if (mode == Presence.Mode.xa) { tab.setIcon(SparkRes.getImageIcon(SparkRes.IM_DND_STALE_IMAGE)); } } titleLabel.validate(); titleLabel.repaint(); } } }, delay, period); }
if (c == '$') {
if ((c == '$') && !in.isEscaped()) {
static public Object parseQuotedString(ParseTool in) throws ParseException, IOException { int quoteChar = in.getChar(); boolean isMacro = false; if ((quoteChar != '\'') && (quoteChar != '\"')) { return null; // undefined quote char } StringBuffer str = new StringBuffer(96); QuotedStringBuilder qString = new QuotedStringBuilder(); int c = in.nextChar(); while ((c != quoteChar) && (c != in.EOF)) { if (c == '$') { Object child = parseVariable(in); // may return a string c = in.getChar(); if (child instanceof String) { str.append(child); } else { qString.addElement(str.toString()); qString.addElement(child); str.setLength(0); } } else { str.append((char) c); c = in.nextChar(); } } if (str.length() != 0) { qString.addElement(str.toString()); } str = null; if (c == quoteChar) { in.nextChar(); } else { throw new ParseException(in, "Expected closing quote: " + (char) quoteChar); } if ((qString.size() == 1) && !(qString.elementAt(0) instanceof Builder)) { // XXX: #use directive fails without this, because it needs to // access target and source during the parse phase, before the // build has been completed. return qString.elementAt(0); } else { return qString; } }
ParseTool(String name, Reader inputStream) { _escaped = false; _name = name; LineNumberReader in = new LineNumberReader(inputStream); _cur = _last = _len = _pos = EOF; _buf = ""; _in = in; for (int i = 0; i < MAX_MARKS; i++) { _marks[i] = new Mark(); } read();
ParseTool(String name, InputStream in) throws IOException { this(name, new InputStreamReader(in));
ParseTool(String name, Reader inputStream) { _escaped = false; _name = name; LineNumberReader in = new LineNumberReader(inputStream); _cur = _last = _len = _pos = EOF; _buf = ""; // must be non-null or we will abort before we start _in = in; for (int i = 0; i < MAX_MARKS; i++) { _marks[i] = new Mark(); } read(); // get it started (read the extra newline) }
public final void parseUntil(StringBuffer buf, String marker) throws ParseException
public final boolean parseUntil(StringBuffer buf, char c) throws IOException
public final void parseUntil(StringBuffer buf, String marker) throws ParseException { if (marker == null) { return; } if (marker.length() < 1) { return; } char start = marker.charAt(0); int mark = DUMMY_MARK; buf.setLength(0); LOOKING: while(_cur != EOF) { if (_cur == start) { mark = mark(); try { for (int i = 0; i < marker.length(); i++) { if (_cur != marker.charAt(i)) { rewind(mark); buf.append((char) _cur); read(); continue LOOKING; } read(); } buf.append(marker); return; } finally { clearMark(mark); } } buf.append((char) _cur); read(); } clearMark(mark); throw new ParseException(this,"Expected " + marker + " but reached end of file"); }
if (marker == null) { return; } if (marker.length() < 1) { return; } char start = marker.charAt(0); int mark = DUMMY_MARK; buf.setLength(0); LOOKING: while(_cur != EOF) { if (_cur == start) { mark = mark(); try { for (int i = 0; i < marker.length(); i++) { if (_cur != marker.charAt(i)) { rewind(mark); buf.append((char) _cur); read(); continue LOOKING; } read(); } buf.append(marker); return; } finally { clearMark(mark); } }
boolean readSome = false; while (((_cur != c) || _escaped) && (_cur != EOF)) {
public final void parseUntil(StringBuffer buf, String marker) throws ParseException { if (marker == null) { return; } if (marker.length() < 1) { return; } char start = marker.charAt(0); int mark = DUMMY_MARK; buf.setLength(0); LOOKING: while(_cur != EOF) { if (_cur == start) { mark = mark(); try { for (int i = 0; i < marker.length(); i++) { if (_cur != marker.charAt(i)) { rewind(mark); buf.append((char) _cur); read(); continue LOOKING; } read(); } buf.append(marker); return; } finally { clearMark(mark); } } buf.append((char) _cur); read(); } clearMark(mark); throw new ParseException(this,"Expected " + marker + " but reached end of file"); }
clearMark(mark); throw new ParseException(this,"Expected " + marker + " but reached end of file");
return readSome;
public final void parseUntil(StringBuffer buf, String marker) throws ParseException { if (marker == null) { return; } if (marker.length() < 1) { return; } char start = marker.charAt(0); int mark = DUMMY_MARK; buf.setLength(0); LOOKING: while(_cur != EOF) { if (_cur == start) { mark = mark(); try { for (int i = 0; i < marker.length(); i++) { if (_cur != marker.charAt(i)) { rewind(mark); buf.append((char) _cur); read(); continue LOOKING; } read(); } buf.append(marker); return; } finally { clearMark(mark); } } buf.append((char) _cur); read(); } clearMark(mark); throw new ParseException(this,"Expected " + marker + " but reached end of file"); }
public final boolean isNameStartChar() { return isNameStartChar(_cur);
static public final boolean isNameStartChar(int c) { return ((c != '$') && (Character.isJavaIdentifierStart((char) c)));
public final boolean isNameStartChar() { return isNameStartChar(_cur); }
e.printStackTrace();
public final Template handle(WebContext wc) throws HandlerException { String pageName = null; WikiPage wikiPage = null; // who is trying to do something? WikiUser user = getUser (wc); // which action wants to respond to this request? PageAction action = _actionManager.getAction (wc, user); // use the action to determine which WikiPage // we should be dealing with if (action != null) pageName = action.getWikiPageName (_wiki, wc); if (pageName != null) wikiPage = _wiki.getPage (pageName); // stuff the webcontext with useful stuff stuffContext (wc, wikiPage, user, pageName); if (action == null) throw new HandlerException ("Unable to find a PageAction to handle" + " this request."); try { // attempt to perform the action against the page action.perform (_wiki, wc, user, wikiPage); } catch (PageAction.RedirectException re) { // action wants us to redirect somewhere else try { wc.getResponse().sendRedirect (re.getURL()); } catch (IOException ioe) { throw new HandlerException ("Cannot redirect to " + re.getURL(), ioe); } return null; } catch (Exception e) { // something bad happened while performing the action // TODO: Handle error and error template ourselves throw new HandlerException (e.toString()); } finally { if (user != null) _wiki.updateUser(user); } // the action performed successfully, so now return // the template it wants us to use try { // determine the template name and return String templateName = action.getTemplateName(_wiki, wikiPage); return getTemplate (templateName); } catch (ResourceException re) { throw new HandlerException ("Could not get template", re); } }
public MockServiceFactory() throws NullPointerException {
private MockServiceFactory() throws NullPointerException {
public MockServiceFactory() throws NullPointerException { super(SERVICE); }
preferences.showDatesInChat(showTime); return preferences;
return pref;
public Object getData() { LocalPreferences pref = SettingsManager.getLocalPreferences(); String nickname = pref.getDefaultNickname(); if (nickname == null) { nickname = SparkManager.getSessionManager().getUsername(); } boolean showTime = pref.isTimeDisplayedInChat(); preferences.showDatesInChat(showTime); return preferences; }
Object o = enum.nextElement(); hasNext = enum.hasMoreElements();
Object o = enumeration.nextElement(); hasNext = enumeration.hasMoreElements();
final public Object next () throws NoSuchElementException { if (!hasNext) { throw new NoSuchElementException("advanced past end of list"); } Object o = enum.nextElement(); hasNext = enum.hasMoreElements(); return o; }
for (DisplayedNote removeMe : dd.getTree().getSelectedNotes()) {
while (dd.getTree().getSelectedNotes().size() > 0) { DisplayedNote removeMe = dd.getTree().getSelectedNotes().get(0);
public void removeNotes(Event e) { for (DisplayedNote removeMe : dd.getTree().getSelectedNotes()) { removeMe.deleteSelfAndChildren(); } }
tmpl = "#if (true)\n { pass\n }\n #else\n { fail\n }"; assertStringTemplateEquals (tmpl, " pass\n ");
public void testBeginEnd () throws Exception { String tmpl = "#if (true) #begin pass #end #else #begin fail #end"; assertStringTemplateEquals (tmpl, "pass"); tmpl = "#if (true)\n #begin pass\n #end\n #else\n #begin fail\n #end"; assertStringTemplateEquals (tmpl, "pass\n"); }
if (!name.startsWith("/")) name = "/" + name; URL u = _servletContext.getResource(name);
String contextName = name; if (name.startsWith("/")) { name = name.substring(1); } else { StringBuffer b = new StringBuffer(name.length()+1); b.append("/"); b.append(name); contextName = b.toString(); } URL u = _servletContext.getResource(contextName);
public URL getResource(String name) { try { // NOTE: Tomcat4 needs a leading '/'. // If this doesn't work with your 2.2+ container, try commenting out the following line if (!name.startsWith("/")) name = "/" + name; URL u = _servletContext.getResource(name); if (u != null && u.getProtocol().equals("file")) { File f = new File(u.getFile()); if (!f.exists()) u = null; } if (u == null) u = _servletClassLoader.getResource(name); if (u == null) u = super.getResource(name); return u; } catch (MalformedURLException e) { _log.warning("MalformedURLException caught in " + "ServletBroker.getResource for " + name); return null; } }
if (u == null)
if (u == null) {
public URL getResource(String name) { try { // NOTE: Tomcat4 needs a leading '/'. // If this doesn't work with your 2.2+ container, try commenting out the following line if (!name.startsWith("/")) name = "/" + name; URL u = _servletContext.getResource(name); if (u != null && u.getProtocol().equals("file")) { File f = new File(u.getFile()); if (!f.exists()) u = null; } if (u == null) u = _servletClassLoader.getResource(name); if (u == null) u = super.getResource(name); return u; } catch (MalformedURLException e) { _log.warning("MalformedURLException caught in " + "ServletBroker.getResource for " + name); return null; } }
if (u == null)
} if (u == null)
public URL getResource(String name) { try { // NOTE: Tomcat4 needs a leading '/'. // If this doesn't work with your 2.2+ container, try commenting out the following line if (!name.startsWith("/")) name = "/" + name; URL u = _servletContext.getResource(name); if (u != null && u.getProtocol().equals("file")) { File f = new File(u.getFile()); if (!f.exists()) u = null; } if (u == null) u = _servletClassLoader.getResource(name); if (u == null) u = super.getResource(name); return u; } catch (MalformedURLException e) { _log.warning("MalformedURLException caught in " + "ServletBroker.getResource for " + name); return null; } }
SparkManager.getMessageEventManager().removeMessageEventRequestListener(messageEventRequestListener);
public void closeChatRoom() { super.closeChatRoom(); SparkManager.getMessageEventManager().removeMessageEventRequestListener(messageEventRequestListener); SparkManager.getChatManager().removeChat(this); SparkManager.getConnection().removePacketListener(this); }
typingTimer.stop();
public void closeChatRoom() { super.closeChatRoom(); SparkManager.getMessageEventManager().removeMessageEventRequestListener(messageEventRequestListener); SparkManager.getChatManager().removeChat(this); SparkManager.getConnection().removePacketListener(this); }
if (sendTypingNotification) { SparkManager.getMessageEventManager().sendComposingNotification(getParticipantJID(), threadID); }
SparkManager.getMessageEventManager().sendComposingNotification(getParticipantJID(), threadID);
public void insertUpdate(DocumentEvent e) { checkForText(e); lastTypedCharTime = System.currentTimeMillis(); // If the user pauses for more than two seconds, send out a new notice. if (sendNotification) { try { if (sendTypingNotification) { SparkManager.getMessageEventManager().sendComposingNotification(getParticipantJID(), threadID); } sendNotification = false; } catch (Exception exception) { Log.error("Error updating", exception); } } }
transport = TransportManager.getTransport(serviceName);
transport = TransportUtils.getTransport(serviceName);
public TransportRegistrationDialog(String serviceName) { setLayout(new GridBagLayout()); this.serviceName = serviceName; ResourceUtils.resButton(registerButton, Res.getString("button.register")); ResourceUtils.resButton(cancelButton, Res.getString("button.cancel")); final JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); buttonPanel.add(registerButton); registerButton.requestFocus(); buttonPanel.add(cancelButton); transport = TransportManager.getTransport(serviceName); final TitlePanel titlePanel = new TitlePanel(transport.getTitle(), transport.getInstructions(), transport.getIcon(), true); add(titlePanel, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); final JLabel usernameLabel = new JLabel(); usernameLabel.setFont(new Font("Dialog", Font.BOLD, 11)); ResourceUtils.resLabel(usernameLabel, usernameField, Res.getString("label.username") + ":"); add(usernameLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(usernameField, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); final JLabel passwordLabel = new JLabel(); passwordLabel.setFont(new Font("Dialog", Font.BOLD, 11)); ResourceUtils.resLabel(passwordLabel, passwordField, Res.getString("label.password") + ":"); add(passwordLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); add(passwordField, new GridBagConstraints(1, 2, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); add(buttonPanel, new GridBagConstraints(0, 3, 2, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); }
for (Enumeration enum = _request.getParameterNames(); enum.hasMoreElements();)
for (Enumeration enumeration = _request.getParameterNames(); enumeration.hasMoreElements();)
final public String toString () { StringBuffer sb = new StringBuffer(); String eol = java.lang.System.getProperty("line.separator"); for (Enumeration enum = _request.getParameterNames(); enum.hasMoreElements();) { String key = (String) enum.nextElement(); String[] value = _request.getParameterValues(key); for (int x = 0; value != null && x < value.length; x++) { sb.append(key).append("=").append(value[x]).append(eol); } }
String key = (String) enum.nextElement();
String key = (String) enumeration.nextElement();
final public String toString () { StringBuffer sb = new StringBuffer(); String eol = java.lang.System.getProperty("line.separator"); for (Enumeration enum = _request.getParameterNames(); enum.hasMoreElements();) { String key = (String) enum.nextElement(); String[] value = _request.getParameterValues(key); for (int x = 0; value != null && x < value.length; x++) { sb.append(key).append("=").append(value[x]).append(eol); } }
return sb.toString(); }
final public String toString () { StringBuffer sb = new StringBuffer(); String eol = java.lang.System.getProperty("line.separator"); for (Enumeration enum = _request.getParameterNames(); enum.hasMoreElements();) { String key = (String) enum.nextElement(); String[] value = _request.getParameterValues(key); for (int x = 0; value != null && x < value.length; x++) { sb.append(key).append("=").append(value[x]).append(eol); } }
int numberOfMillisecondsInTheFuture = 5000;
int numberOfMillisecondsInTheFuture = 10000;
public void loadPlugins() { // Add presence and message listeners // we listen for these to force open a 1-1 peer chat window from other operators if // one isn't already open PacketFilter workspaceMessageFilter = new PacketTypeFilter(Message.class); // Add the packetListener to this instance SparkManager.getSessionManager().getConnection().addPacketListener(this, workspaceMessageFilter); // Make presence available to anonymous requests, if from anonymous user in the system. PacketListener workspacePresenceListener = new PacketListener() { public void processPacket(Packet packet) { Presence presence = (Presence)packet; if (presence != null && presence.getProperty("anonymous") != null) { boolean isAvailable = statusBox.getPresence().getMode() == Presence.Mode.available; Presence reply = new Presence(Presence.Type.available); if (!isAvailable) { reply.setType(Presence.Type.unavailable); } reply.setTo(presence.getFrom()); SparkManager.getSessionManager().getConnection().sendPacket(reply); } } }; SparkManager.getSessionManager().getConnection().addPacketListener(workspacePresenceListener, new PacketTypeFilter(Presence.class)); // Send Available status final Presence presence = SparkManager.getWorkspace().getStatusBar().getPresence(); SparkManager.getSessionManager().changePresence(presence); // Load Plugins SwingWorker worker = new SwingWorker() { public Object construct() { try { Thread.sleep(100); } catch (InterruptedException e) { Log.error("Unable to sleep thread.", e); } return "ok"; } public void finished() { final PluginManager pluginManager = PluginManager.getInstance(); pluginManager.loadPlugins(); pluginManager.initializePlugins(); } }; worker.start(); int numberOfMillisecondsInTheFuture = 5000; // 5 sec Date timeToRun = new Date(System.currentTimeMillis() + numberOfMillisecondsInTheFuture); Timer timer = new Timer(); timer.schedule(new TimerTask() { public void run() { SwingUtilities.invokeLater(new Runnable() { public void run() { final Iterator offlineMessage = offlineMessages.iterator(); while (offlineMessage.hasNext()) { Message offline = (Message)offlineMessage.next(); handleOfflineMessage(offline); } } }); } }, timeToRun); }
getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("control N"), "searchContacts"); getActionMap().put("searchContacts", new AbstractAction("searchContacts") { public void actionPerformed(ActionEvent evt) { SparkManager.getUserManager().searchContacts("", SparkManager.getChatManager().getChatContainer()); } });
private void addKeyNavigation() { KeyStroke leftStroke = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0); String leftStrokeString = org.jivesoftware.spark.util.StringUtils.keyStroke2String(leftStroke); // Handle Left Arrow this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("alt " + leftStrokeString + ""), "navigateLeft"); this.getActionMap().put("navigateLeft", new AbstractAction("navigateLeft") { public void actionPerformed(ActionEvent evt) { int selectedIndex = getSelectedIndex(); if (selectedIndex > 0) { setSelectedIndex(selectedIndex - 1); } else { setSelectedIndex(getTabCount() - 1); } } }); KeyStroke rightStroke = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0); String rightStrokeString = org.jivesoftware.spark.util.StringUtils.keyStroke2String(rightStroke); // Handle Right Arrow this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("alt " + rightStrokeString + ""), "navigateRight"); this.getActionMap().put("navigateRight", new AbstractAction("navigateRight") { public void actionPerformed(ActionEvent evt) { int selectedIndex = getSelectedIndex(); if (selectedIndex > -1) { int count = getTabCount(); if (selectedIndex == (count - 1)) { setSelectedIndex(0); } else { setSelectedIndex(selectedIndex + 1); } } } }); this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"), "escape"); this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("Ctrl W"), "escape"); this.getActionMap().put("escape", new AbstractAction("escape") { public void actionPerformed(ActionEvent evt) { closeActiveRoom(); } }); KeyStroke appleStroke = KeyStroke.getKeyStroke(Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), 0); String appleString = org.jivesoftware.spark.util.StringUtils.keyStroke2String(appleStroke); // Handle Apple Key W this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(appleString + "w"), "appleStroke"); this.getActionMap().put("appleStroke", new AbstractAction("appleStroke") { public void actionPerformed(ActionEvent evt) { closeActiveRoom(); } }); }
: "UNKNOWN. Throwing exceptin"));
: "UNKNOWN. Throwing exception"));
public void write(FastWriter out, Context context) throws PropertyException, IOException { Broker broker = context.getBroker(); // the filename arg passed to us was a Macro, so // evaluate and check it now if (_macFilename != null) { _strFilename = _macFilename.evaluate(context).toString(); if (_strFilename == null || _strFilename.length() == 0) { throw makePropertyException("Filename cannot be null or empty"); } } if (_log.loggingDebug() && context.getCurrentLocation().indexOf(_strFilename) > -1) { // when in debug mode, output a warning if a template tries to include itself // there are situtations where this is desired, but it's good to make // the user aware of what they're doing _log.warning(context.getCurrentLocation() + " includes itself."); } // this should only be true if StrictCompatibility is set to false // and "as <something>" wasn't specified in the arg list if (_type == TYPE_DYNAMIC) _type = guessType(broker, _strFilename); if (_log.loggingDebug()) { _log.debug("Including '" + _strFilename + "' as " + ((_type == TYPE_MACRO) ? "MACRO" : (_type == TYPE_TEMPLATE) ? "TEMPLATE" : (_type == TYPE_TEXT) ? "TEXT" : "UNKNOWN. Throwing exceptin")); } Object toInclude = getThingToInclude(broker, _type, _strFilename); switch (_type) { case TYPE_MACRO: // during runtime evaluation of a template, // a TYPE_MACRO doesn't really work as expected. // we logged a warning above in build(), but // we still need to write it out as a template // so just fall through case TYPE_TEMPLATE: ((Template) toInclude).write(out, context); break; case TYPE_TEXT: // static types are strings out.write(toInclude.toString()); break; default: // should never happen throw makePropertyException("Unrecognized file type: " + _type); } }
FastWriter w = new FastWriter(System.out, "UTF8");
FastWriter w = new FastWriter(System.out, context.getEncoding());
public static void main(String arg[]) { Log.traceExceptions(true); Log.setLevel(Log.ALL); Log.setTarget(System.err); if (arg.length != 0) { System.out.println("Enabling log types"); Log.enableTypes(arg); } // Build a context WebMacro wm = null; Context context = null; try { wm = new WM(); context = wm.getContext(); Object names[] = { "prop" }; context.setProperty(names, "Example property"); } catch (Exception e) { e.printStackTrace(); } try { context.put("helloworld", "Hello World"); context.put("hello", "Hello"); context.put("file", "include.txt"); context.put("today", new Date()); TestObject[] fruits = { new TestObject("apple",false), new TestObject("lemon",true), new TestObject("pear",false), new TestObject("orange",true), new TestObject("watermelon",false), new TestObject("peach",false), new TestObject("lime",true) }; SelectList sl = new SelectList(fruits, 3); context.put("sl-fruits", sl); context.put("fruits", fruits); context.put("flipper", new TestObject("flip",false)); System.out.println("- - - - - - - - - - - - - - - - - - - -"); System.out.println("Context contains: helloWorld, hello, file, TestObject[] fruits, SelectList sl(fruits, 3), TestObject flipper"); System.out.println("- - - - - - - - - - - - - - - - - - - -"); Template t1 = new StreamTemplate(wm.getBroker(), new InputStreamReader(System.in)); t1.parse(); FastWriter w = new FastWriter(System.out, "UTF8"); System.out.println("*** RESULT ***"); t1.write(w,context); w.close(); System.out.println("*** DONE ***"); //System.out.println(result); } catch (Exception e) { e.printStackTrace(); } }
Class type = PropertyEditorHelper.loadClass("org.apache.xbean.spring.context.impl.QNameHelper"); if (type != null) { Method[] methods = type.getMethods(); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; if (method.getName().equals(name)) { return method;
try { Class type = PropertyEditorHelper.loadClass("org.apache.xbean.spring.context.impl.QNameHelper"); if (type != null) { Method[] methods = type.getMethods(); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; if (method.getName().equals(name)) { return method; }
protected static Method findMethod(String name) { Class type = PropertyEditorHelper.loadClass("org.apache.xbean.spring.context.impl.QNameHelper"); if (type != null) { Method[] methods = type.getMethods(); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; if (method.getName().equals(name)) { return method; } } } return null; }
} catch (Throwable t) {
protected static Method findMethod(String name) { Class type = PropertyEditorHelper.loadClass("org.apache.xbean.spring.context.impl.QNameHelper"); if (type != null) { Method[] methods = type.getMethods(); for (int i = 0; i < methods.length; i++) { Method method = methods[i]; if (method.getName().equals(name)) { return method; } } } return null; }
removeContactItem(jid);
RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; if (getContactGroup(group.getName()) == null) { ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = offlineGroup.getContactItemByJID(jid); if (item == null) { item = contactGroup.getContactItemByJID(jid); } if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } else { offlineGroup.addContactItem(item); offlineGroup.fireContactGroupUpdated(); } } else { Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); contactGroup.fireContactGroupUpdated(); } } } final Set<String> groupSet = new HashSet<String>(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } }
public void run() { Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); removeContactItem(jid); } }
SwingUtilities.invokeLater(new Runnable() { public void run() { Roster roster = SparkManager.getConnection().getRoster(); Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; if (getContactGroup(group.getName()) == null) { ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = contactGroup.getContactItemByJID(jid); if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } } else { Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); contactGroup.fireContactGroupUpdated(); } } } Set groupSet = new HashSet(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } } } } });
handleEntriesUpdated(addresses);
public void entriesUpdated(final Collection addresses) { SwingUtilities.invokeLater(new Runnable() { public void run() { Roster roster = SparkManager.getConnection().getRoster(); Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { // Check for new Roster Groups and add them if they do not exist. boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; // Handle if this is a new Entry in a new Group. if (getContactGroup(group.getName()) == null) { // Create group. ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = contactGroup.getContactItemByJID(jid); // Check to see if this entry is new to a pre-existing group. if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } } // If not, just update their presence. else { Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); contactGroup.fireContactGroupUpdated(); } } } // Now check to see if groups have been modified or removed. This is used // to check if Contact Groups have been renamed or removed. Set groupSet = new HashSet(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { // Remove from offlineItem and add to unfiledItem. offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } } } } }); }
Roster roster = SparkManager.getConnection().getRoster();
public void run() { Roster roster = SparkManager.getConnection().getRoster(); Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { // Check for new Roster Groups and add them if they do not exist. boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; // Handle if this is a new Entry in a new Group. if (getContactGroup(group.getName()) == null) { // Create group. ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = contactGroup.getContactItemByJID(jid); // Check to see if this entry is new to a pre-existing group. if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } } // If not, just update their presence. else { Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); contactGroup.fireContactGroupUpdated(); } } } // Now check to see if groups have been modified or removed. This is used // to check if Contact Groups have been renamed or removed. Set groupSet = new HashSet(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { // Remove from offlineItem and add to unfiledItem. offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } } } }
RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; if (getContactGroup(group.getName()) == null) { ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = contactGroup.getContactItemByJID(jid); if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } } else { Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); contactGroup.fireContactGroupUpdated(); } } } Set groupSet = new HashSet(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } }
removeContactItem(jid);
public void run() { Roster roster = SparkManager.getConnection().getRoster(); Iterator jids = addresses.iterator(); while (jids.hasNext()) { String jid = (String)jids.next(); RosterEntry rosterEntry = roster.getEntry(jid); if (rosterEntry != null) { // Check for new Roster Groups and add them if they do not exist. boolean isUnfiled = true; for (RosterGroup group : rosterEntry.getGroups()) { isUnfiled = false; // Handle if this is a new Entry in a new Group. if (getContactGroup(group.getName()) == null) { // Create group. ContactGroup contactGroup = addContactGroup(group.getName()); contactGroup.setVisible(false); contactGroup = getContactGroup(group.getName()); String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } ContactItem contactItem = new ContactItem(name, rosterEntry.getUser()); contactGroup.addContactItem(contactItem); Presence presence = roster.getPresence(jid); contactItem.setPresence(presence); if (presence != null) { contactGroup.setVisible(true); } } else { ContactGroup contactGroup = getContactGroup(group.getName()); ContactItem item = contactGroup.getContactItemByJID(jid); // Check to see if this entry is new to a pre-existing group. if (item == null) { String name = rosterEntry.getName(); if (name == null) { name = rosterEntry.getUser(); } item = new ContactItem(name, rosterEntry.getUser()); Presence presence = roster.getPresence(jid); item.setPresence(presence); if (presence != null) { contactGroup.addContactItem(item); contactGroup.fireContactGroupUpdated(); } } // If not, just update their presence. else { Presence presence = roster.getPresence(jid); item.setPresence(presence); updateUserPresence(presence); contactGroup.fireContactGroupUpdated(); } } } // Now check to see if groups have been modified or removed. This is used // to check if Contact Groups have been renamed or removed. Set groupSet = new HashSet(); jids = addresses.iterator(); while (jids.hasNext()) { jid = (String)jids.next(); rosterEntry = roster.getEntry(jid); for (RosterGroup g : rosterEntry.getGroups()) { groupSet.add(g.getName()); } for (ContactGroup group : new ArrayList<ContactGroup>(getContactGroups())) { if (group.getContactItemByJID(jid) != null && group != unfiledGroup && group != offlineGroup) { if (!groupSet.contains(group.getGroupName())) { removeContactGroup(group); } } } } if (!isUnfiled) { return; } ContactItem unfiledItem = unfiledGroup.getContactItemByJID(jid); if (unfiledItem != null) { } else { ContactItem offlineItem = offlineGroup.getContactItemByJID(jid); if (offlineItem != null) { if ((rosterEntry.getType() == RosterPacket.ItemType.NONE || rosterEntry.getType() == RosterPacket.ItemType.FROM) && RosterPacket.ItemStatus.SUBSCRIPTION_PENDING == rosterEntry.getStatus()) { // Remove from offlineItem and add to unfiledItem. offlineGroup.removeContactItem(offlineItem); unfiledGroup.addContactItem(offlineItem); unfiledGroup.fireContactGroupUpdated(); unfiledGroup.setVisible(true); } } } } } }
final JFrame dialog = new JFrame("Subscription Request"); dialog.setIconImage(SparkManager.getMainWindow().getIconImage()); JPanel layoutPanel = new JPanel();
final JPanel layoutPanel = new JPanel(); layoutPanel.setBackground(Color.white);
private void subscriptionRequest(final String jid) { final Roster roster = SparkManager.getConnection().getRoster(); RosterEntry entry = roster.getEntry(jid); if (entry != null && entry.getType() == RosterPacket.ItemType.TO) { Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); return; } String message = jid + " would like to see your online presence and add you to their roster. Do you accept?"; final JFrame dialog = new JFrame("Subscription Request"); dialog.setIconImage(SparkManager.getMainWindow().getIconImage()); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); WrappedLabel messageLabel = new WrappedLabel(); messageLabel.setText(message); layoutPanel.add(messageLabel, new GridBagConstraints(0, 0, 5, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); JButton acceptButton = new JButton("Accept"); JButton viewInfoButton = new JButton("Profile"); JButton denyButton = new JButton("Deny"); layoutPanel.add(acceptButton, new GridBagConstraints(2, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); layoutPanel.add(viewInfoButton, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); layoutPanel.add(denyButton, new GridBagConstraints(4, 1, 1, 1, 0.0, 1.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); acceptButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); int ok = JOptionPane.showConfirmDialog(getGUI(), "Would you like to add the user to your roster?", "Add To Roster", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(jid); rosterDialog.showRosterDialog(); } } }); denyButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Send subscribed Presence response = new Presence(Presence.Type.unsubscribe); response.setTo(jid); SparkManager.getConnection().sendPacket(response); dialog.dispose(); } }); viewInfoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SparkManager.getVCardManager().viewProfile(jid, getGUI()); } }); // show dialog dialog.getContentPane().add(layoutPanel); dialog.pack(); dialog.setSize(450, 125); dialog.setLocationRelativeTo(SparkManager.getMainWindow()); SparkManager.getChatManager().getChatContainer().blinkFrameIfNecessary(dialog); }
JButton acceptButton = new JButton("Accept"); JButton viewInfoButton = new JButton("Profile"); JButton denyButton = new JButton("Deny");
RolloverButton acceptButton = new RolloverButton("Accept"); RolloverButton viewInfoButton = new RolloverButton("Profile"); RolloverButton denyButton = new RolloverButton("Deny");
private void subscriptionRequest(final String jid) { final Roster roster = SparkManager.getConnection().getRoster(); RosterEntry entry = roster.getEntry(jid); if (entry != null && entry.getType() == RosterPacket.ItemType.TO) { Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); return; } String message = jid + " would like to see your online presence and add you to their roster. Do you accept?"; final JFrame dialog = new JFrame("Subscription Request"); dialog.setIconImage(SparkManager.getMainWindow().getIconImage()); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); WrappedLabel messageLabel = new WrappedLabel(); messageLabel.setText(message); layoutPanel.add(messageLabel, new GridBagConstraints(0, 0, 5, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); JButton acceptButton = new JButton("Accept"); JButton viewInfoButton = new JButton("Profile"); JButton denyButton = new JButton("Deny"); layoutPanel.add(acceptButton, new GridBagConstraints(2, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); layoutPanel.add(viewInfoButton, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); layoutPanel.add(denyButton, new GridBagConstraints(4, 1, 1, 1, 0.0, 1.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); acceptButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); int ok = JOptionPane.showConfirmDialog(getGUI(), "Would you like to add the user to your roster?", "Add To Roster", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(jid); rosterDialog.showRosterDialog(); } } }); denyButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Send subscribed Presence response = new Presence(Presence.Type.unsubscribe); response.setTo(jid); SparkManager.getConnection().sendPacket(response); dialog.dispose(); } }); viewInfoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SparkManager.getVCardManager().viewProfile(jid, getGUI()); } }); // show dialog dialog.getContentPane().add(layoutPanel); dialog.pack(); dialog.setSize(450, 125); dialog.setLocationRelativeTo(SparkManager.getMainWindow()); SparkManager.getChatManager().getChatContainer().blinkFrameIfNecessary(dialog); }
dialog.dispose();
SparkManager.getWorkspace().removeAlert(layoutPanel);
private void subscriptionRequest(final String jid) { final Roster roster = SparkManager.getConnection().getRoster(); RosterEntry entry = roster.getEntry(jid); if (entry != null && entry.getType() == RosterPacket.ItemType.TO) { Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); return; } String message = jid + " would like to see your online presence and add you to their roster. Do you accept?"; final JFrame dialog = new JFrame("Subscription Request"); dialog.setIconImage(SparkManager.getMainWindow().getIconImage()); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); WrappedLabel messageLabel = new WrappedLabel(); messageLabel.setText(message); layoutPanel.add(messageLabel, new GridBagConstraints(0, 0, 5, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); JButton acceptButton = new JButton("Accept"); JButton viewInfoButton = new JButton("Profile"); JButton denyButton = new JButton("Deny"); layoutPanel.add(acceptButton, new GridBagConstraints(2, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); layoutPanel.add(viewInfoButton, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); layoutPanel.add(denyButton, new GridBagConstraints(4, 1, 1, 1, 0.0, 1.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); acceptButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); int ok = JOptionPane.showConfirmDialog(getGUI(), "Would you like to add the user to your roster?", "Add To Roster", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(jid); rosterDialog.showRosterDialog(); } } }); denyButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Send subscribed Presence response = new Presence(Presence.Type.unsubscribe); response.setTo(jid); SparkManager.getConnection().sendPacket(response); dialog.dispose(); } }); viewInfoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SparkManager.getVCardManager().viewProfile(jid, getGUI()); } }); // show dialog dialog.getContentPane().add(layoutPanel); dialog.pack(); dialog.setSize(450, 125); dialog.setLocationRelativeTo(SparkManager.getMainWindow()); SparkManager.getChatManager().getChatContainer().blinkFrameIfNecessary(dialog); }
dialog.dispose();
private void subscriptionRequest(final String jid) { final Roster roster = SparkManager.getConnection().getRoster(); RosterEntry entry = roster.getEntry(jid); if (entry != null && entry.getType() == RosterPacket.ItemType.TO) { Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); return; } String message = jid + " would like to see your online presence and add you to their roster. Do you accept?"; final JFrame dialog = new JFrame("Subscription Request"); dialog.setIconImage(SparkManager.getMainWindow().getIconImage()); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); WrappedLabel messageLabel = new WrappedLabel(); messageLabel.setText(message); layoutPanel.add(messageLabel, new GridBagConstraints(0, 0, 5, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); JButton acceptButton = new JButton("Accept"); JButton viewInfoButton = new JButton("Profile"); JButton denyButton = new JButton("Deny"); layoutPanel.add(acceptButton, new GridBagConstraints(2, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); layoutPanel.add(viewInfoButton, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); layoutPanel.add(denyButton, new GridBagConstraints(4, 1, 1, 1, 0.0, 1.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); acceptButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); int ok = JOptionPane.showConfirmDialog(getGUI(), "Would you like to add the user to your roster?", "Add To Roster", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(jid); rosterDialog.showRosterDialog(); } } }); denyButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Send subscribed Presence response = new Presence(Presence.Type.unsubscribe); response.setTo(jid); SparkManager.getConnection().sendPacket(response); dialog.dispose(); } }); viewInfoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SparkManager.getVCardManager().viewProfile(jid, getGUI()); } }); // show dialog dialog.getContentPane().add(layoutPanel); dialog.pack(); dialog.setSize(450, 125); dialog.setLocationRelativeTo(SparkManager.getMainWindow()); SparkManager.getChatManager().getChatContainer().blinkFrameIfNecessary(dialog); }
dialog.getContentPane().add(layoutPanel); dialog.pack(); dialog.setSize(450, 125); dialog.setLocationRelativeTo(SparkManager.getMainWindow()); SparkManager.getChatManager().getChatContainer().blinkFrameIfNecessary(dialog);
SparkManager.getWorkspace().addAlert(layoutPanel); SparkManager.getAlertManager().flashWindowStopOnFocus(SparkManager.getMainWindow());
private void subscriptionRequest(final String jid) { final Roster roster = SparkManager.getConnection().getRoster(); RosterEntry entry = roster.getEntry(jid); if (entry != null && entry.getType() == RosterPacket.ItemType.TO) { Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); return; } String message = jid + " would like to see your online presence and add you to their roster. Do you accept?"; final JFrame dialog = new JFrame("Subscription Request"); dialog.setIconImage(SparkManager.getMainWindow().getIconImage()); JPanel layoutPanel = new JPanel(); layoutPanel.setLayout(new GridBagLayout()); WrappedLabel messageLabel = new WrappedLabel(); messageLabel.setText(message); layoutPanel.add(messageLabel, new GridBagConstraints(0, 0, 5, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); JButton acceptButton = new JButton("Accept"); JButton viewInfoButton = new JButton("Profile"); JButton denyButton = new JButton("Deny"); layoutPanel.add(acceptButton, new GridBagConstraints(2, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); layoutPanel.add(viewInfoButton, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); layoutPanel.add(denyButton, new GridBagConstraints(4, 1, 1, 1, 0.0, 1.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); acceptButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dialog.dispose(); Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); int ok = JOptionPane.showConfirmDialog(getGUI(), "Would you like to add the user to your roster?", "Add To Roster", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(jid); rosterDialog.showRosterDialog(); } } }); denyButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // Send subscribed Presence response = new Presence(Presence.Type.unsubscribe); response.setTo(jid); SparkManager.getConnection().sendPacket(response); dialog.dispose(); } }); viewInfoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SparkManager.getVCardManager().viewProfile(jid, getGUI()); } }); // show dialog dialog.getContentPane().add(layoutPanel); dialog.pack(); dialog.setSize(450, 125); dialog.setLocationRelativeTo(SparkManager.getMainWindow()); SparkManager.getChatManager().getChatContainer().blinkFrameIfNecessary(dialog); }
dialog.dispose();
SparkManager.getWorkspace().removeAlert(layoutPanel);
public void actionPerformed(ActionEvent e) { dialog.dispose(); Presence response = new Presence(Presence.Type.subscribed); response.setTo(jid); SparkManager.getConnection().sendPacket(response); int ok = JOptionPane.showConfirmDialog(getGUI(), "Would you like to add the user to your roster?", "Add To Roster", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); if (ok == JOptionPane.OK_OPTION) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(jid); rosterDialog.showRosterDialog(); } }
dialog.dispose();
public void actionPerformed(ActionEvent e) { // Send subscribed Presence response = new Presence(Presence.Type.unsubscribe); response.setTo(jid); SparkManager.getConnection().sendPacket(response); dialog.dispose(); }
while (initArgObj instanceof Macro)
while (initArgObj instanceof Macro && initArgObj != UNDEF)
public void write(FastWriter out, Context context) throws PropertyException, IOException { Map globalBeans = BeanConf.globalBeans; Map appBeans = beanConf.appBeans; boolean isNew = false; try { while (initArgObj instanceof Macro) initArgObj = ((Macro) initArgObj).evaluate(context); // store init args in array if (initArgObj == null || initArgObj.getClass().isArray()){ initArgs = (Object[])initArgObj; } else { initArgs = new Object[1]; initArgs[0] = initArgObj; } Object o = null; Class c = null; switch (scope){ case BEAN_SCOPE_GLOBAL: synchronized (globalBeans){ o = globalBeans.get(targetName); if (o == null){ if (isStaticClass){ c = context.getBroker().classForName(_className); o = new org.webmacro.engine.StaticClassWrapper(c); } else { //c = Class.forName(_className); //o = c.newInstance(); o = instantiate(_className, initArgs); } isNew = true; globalBeans.put(targetName,o); } } break; case BEAN_SCOPE_APPLICATION: synchronized (appBeans){ o = appBeans.get(targetName); if (o == null){ o = instantiate(_className, initArgs); isNew = true; appBeans.put(targetName, o); } } break; case BEAN_SCOPE_SESSION: javax.servlet.http.HttpSession session = (javax.servlet.http.HttpSession)context.getProperty("Session"); //if (context instanceof WebContext){ if (session != null){ synchronized(session){ o = session.getAttribute(targetName); if (o == null){ o = instantiate(_className, initArgs); isNew = true; session.setAttribute(targetName, o); } } } else { PropertyException e = new PropertyException( "#bean usage error: session scope is only valid with servlets!"); _broker.getEvaluationExceptionHandler().evaluate( target, context, e); } break; default: // make "page" the default scope //case BEAN_SCOPE_PAGE: // NOTE: page beans always overwrite anything in the context // with the same name o = instantiate(_className, initArgs); isNew = true; if (o != null){ Class[] paramTypes = { Context.class }; try { java.lang.reflect.Method m = o.getClass().getMethod("init", paramTypes); if (m != null){ Object[] args = { context }; m.invoke(o, args); } } catch (Exception e){ // ignore } } break; } _log.debug("BeanDirective: Class " + _className + " loaded."); target.setValue(context, o); } catch (PropertyException e) { this._broker.getEvaluationExceptionHandler().evaluate(target, context, e); } catch (Exception e) { String errorText = "BeanDirective: Unable to load bean " + target + " of type " + _className; _log.error(errorText, e); writeWarning(errorText, context, out); } if (isNew && onNewBlock != null) onNewBlock.write(out, context); }
public Dispatcher(DisplayedDocument dd) { controllers = new LinkedList<Controller>(); controllers.add(new MainController(dd)); controllers.add(new MainMenuController(dd)); controllers.add(new TreeContextMenuController(dd)); controllers.add(new TreeController(dd));
public Dispatcher() { controllers = new HashMap<String, Controller>();
public Dispatcher(DisplayedDocument dd) { controllers = new LinkedList<Controller>(); controllers.add(new MainController(dd)); controllers.add(new MainMenuController(dd)); controllers.add(new TreeContextMenuController(dd)); controllers.add(new TreeController(dd)); }
Controller controller = null; Method method = null; Iterator<Controller> iter = controllers.iterator(); while (iter.hasNext() && (method == null)) { controller = iter.next(); method = controller.getMethod(methodDescriptor);
Controller controller = controllers.get(Controller.getControllerSignature(methodDescriptor)); if (controller == null) { throw new KoalaException("Koala Notes could not find controller '" + Controller.getControllerSignature(methodDescriptor) + "'.");
public void invokeControllerMethod(String methodDescriptor, Event e) { // Get the controller and method. Controller controller = null; Method method = null; Iterator<Controller> iter = controllers.iterator(); while (iter.hasNext() && (method == null)) { controller = iter.next(); method = controller.getMethod(methodDescriptor); } if (method == null) { throw new KoalaException("Koala Notes could not find method '" + methodDescriptor + "'."); } // Invoke the method. try { method.invoke(controller, new Object[] {e}); } catch (IllegalAccessException iaex) { throw new KoalaException("Koala Notes could not access method '" + methodDescriptor + "'.", iaex); } catch (InvocationTargetException itex) { if (itex.getCause() instanceof RuntimeException) { throw (RuntimeException) itex.getCause(); } else throw new KoalaException(itex.getCause()); } }
Method method = controller.getMethod(methodDescriptor);
public void invokeControllerMethod(String methodDescriptor, Event e) { // Get the controller and method. Controller controller = null; Method method = null; Iterator<Controller> iter = controllers.iterator(); while (iter.hasNext() && (method == null)) { controller = iter.next(); method = controller.getMethod(methodDescriptor); } if (method == null) { throw new KoalaException("Koala Notes could not find method '" + methodDescriptor + "'."); } // Invoke the method. try { method.invoke(controller, new Object[] {e}); } catch (IllegalAccessException iaex) { throw new KoalaException("Koala Notes could not access method '" + methodDescriptor + "'.", iaex); } catch (InvocationTargetException itex) { if (itex.getCause() instanceof RuntimeException) { throw (RuntimeException) itex.getCause(); } else throw new KoalaException(itex.getCause()); } }
final protected void doPost (HttpServletRequest req, HttpServletResponse resp)
protected void doPost (HttpServletRequest req, HttpServletResponse resp)
final protected void doPost (HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doRequest (req,resp); }
fw = FastWriter.getInstance (_broker, resp.getOutputStream (), encoding);
fw = FastWriter.getInstance (_broker, encoding);
final protected void execute (Template tmpl, WebContext c) { FastWriter fw = null; boolean timing = Flags.PROFILE && c.isTiming (); try { if (timing) c.startTiming ("Template.write", tmpl); try { HttpServletResponse resp= c.getResponse (); Locale locale = (Locale) tmpl.getParam ( WMConstants.TEMPLATE_LOCALE); if (_log.loggingDebug ()) _log.debug ("TemplateLocale="+locale); if (locale != null) { setLocale (resp, locale); } String encoding = (String) tmpl.getParam ( WMConstants.TEMPLATE_OUTPUT_ENCODING); if (encoding==null) { encoding = resp.getCharacterEncoding (); } if (_log.loggingDebug ()) _log.debug ("Using output encoding "+encoding); fw = FastWriter.getInstance (_broker, resp.getOutputStream (), encoding); tmpl.write (fw, c); } finally { if (timing) c.stopTiming (); } if (timing) c.startTiming ("FastWriter.close()"); try { fw.close (); fw = null; } finally { if (timing) c.stopTiming (); } } catch (IOException e) { // ignore disconnect } catch (Exception e) { String error = "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": " + e + "\n") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")); _log.warning (error,e); try { Template errorTemplate = error (c, "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": ") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")) + "\n<pre>" + e + "</pre>\n"); fw.reset (fw.getOutputStream ()); errorTemplate.write (fw, c); } catch (Exception ignore) { } } finally { try { if (fw != null) { fw.flush (); fw.close (); fw = null; } } catch (Exception e3) { // ignore disconnect } } }
} finally {
fw.writeTo (c.getResponse().getOutputStream ()); } finally {
final protected void execute (Template tmpl, WebContext c) { FastWriter fw = null; boolean timing = Flags.PROFILE && c.isTiming (); try { if (timing) c.startTiming ("Template.write", tmpl); try { HttpServletResponse resp= c.getResponse (); Locale locale = (Locale) tmpl.getParam ( WMConstants.TEMPLATE_LOCALE); if (_log.loggingDebug ()) _log.debug ("TemplateLocale="+locale); if (locale != null) { setLocale (resp, locale); } String encoding = (String) tmpl.getParam ( WMConstants.TEMPLATE_OUTPUT_ENCODING); if (encoding==null) { encoding = resp.getCharacterEncoding (); } if (_log.loggingDebug ()) _log.debug ("Using output encoding "+encoding); fw = FastWriter.getInstance (_broker, resp.getOutputStream (), encoding); tmpl.write (fw, c); } finally { if (timing) c.stopTiming (); } if (timing) c.startTiming ("FastWriter.close()"); try { fw.close (); fw = null; } finally { if (timing) c.stopTiming (); } } catch (IOException e) { // ignore disconnect } catch (Exception e) { String error = "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": " + e + "\n") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")); _log.warning (error,e); try { Template errorTemplate = error (c, "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": ") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")) + "\n<pre>" + e + "</pre>\n"); fw.reset (fw.getOutputStream ()); errorTemplate.write (fw, c); } catch (Exception ignore) { } } finally { try { if (fw != null) { fw.flush (); fw.close (); fw = null; } } catch (Exception e3) { // ignore disconnect } } }
catch (Exception ignore) { } } finally {
} finally {
final protected void execute (Template tmpl, WebContext c) { FastWriter fw = null; boolean timing = Flags.PROFILE && c.isTiming (); try { if (timing) c.startTiming ("Template.write", tmpl); try { HttpServletResponse resp= c.getResponse (); Locale locale = (Locale) tmpl.getParam ( WMConstants.TEMPLATE_LOCALE); if (_log.loggingDebug ()) _log.debug ("TemplateLocale="+locale); if (locale != null) { setLocale (resp, locale); } String encoding = (String) tmpl.getParam ( WMConstants.TEMPLATE_OUTPUT_ENCODING); if (encoding==null) { encoding = resp.getCharacterEncoding (); } if (_log.loggingDebug ()) _log.debug ("Using output encoding "+encoding); fw = FastWriter.getInstance (_broker, resp.getOutputStream (), encoding); tmpl.write (fw, c); } finally { if (timing) c.stopTiming (); } if (timing) c.startTiming ("FastWriter.close()"); try { fw.close (); fw = null; } finally { if (timing) c.stopTiming (); } } catch (IOException e) { // ignore disconnect } catch (Exception e) { String error = "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": " + e + "\n") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")); _log.warning (error,e); try { Template errorTemplate = error (c, "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": ") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")) + "\n<pre>" + e + "</pre>\n"); fw.reset (fw.getOutputStream ()); errorTemplate.write (fw, c); } catch (Exception ignore) { } } finally { try { if (fw != null) { fw.flush (); fw.close (); fw = null; } } catch (Exception e3) { // ignore disconnect } } }
if (fw != null) { fw.flush (); fw.close (); fw = null; } } catch (Exception e3) {
if (fw != null) { fw.flush (); fw.close (); fw = null;
final protected void execute (Template tmpl, WebContext c) { FastWriter fw = null; boolean timing = Flags.PROFILE && c.isTiming (); try { if (timing) c.startTiming ("Template.write", tmpl); try { HttpServletResponse resp= c.getResponse (); Locale locale = (Locale) tmpl.getParam ( WMConstants.TEMPLATE_LOCALE); if (_log.loggingDebug ()) _log.debug ("TemplateLocale="+locale); if (locale != null) { setLocale (resp, locale); } String encoding = (String) tmpl.getParam ( WMConstants.TEMPLATE_OUTPUT_ENCODING); if (encoding==null) { encoding = resp.getCharacterEncoding (); } if (_log.loggingDebug ()) _log.debug ("Using output encoding "+encoding); fw = FastWriter.getInstance (_broker, resp.getOutputStream (), encoding); tmpl.write (fw, c); } finally { if (timing) c.stopTiming (); } if (timing) c.startTiming ("FastWriter.close()"); try { fw.close (); fw = null; } finally { if (timing) c.stopTiming (); } } catch (IOException e) { // ignore disconnect } catch (Exception e) { String error = "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": " + e + "\n") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")); _log.warning (error,e); try { Template errorTemplate = error (c, "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": ") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")) + "\n<pre>" + e + "</pre>\n"); fw.reset (fw.getOutputStream ()); errorTemplate.write (fw, c); } catch (Exception ignore) { } } finally { try { if (fw != null) { fw.flush (); fw.close (); fw = null; } } catch (Exception e3) { // ignore disconnect } } }
} catch (Exception e3) { }
final protected void execute (Template tmpl, WebContext c) { FastWriter fw = null; boolean timing = Flags.PROFILE && c.isTiming (); try { if (timing) c.startTiming ("Template.write", tmpl); try { HttpServletResponse resp= c.getResponse (); Locale locale = (Locale) tmpl.getParam ( WMConstants.TEMPLATE_LOCALE); if (_log.loggingDebug ()) _log.debug ("TemplateLocale="+locale); if (locale != null) { setLocale (resp, locale); } String encoding = (String) tmpl.getParam ( WMConstants.TEMPLATE_OUTPUT_ENCODING); if (encoding==null) { encoding = resp.getCharacterEncoding (); } if (_log.loggingDebug ()) _log.debug ("Using output encoding "+encoding); fw = FastWriter.getInstance (_broker, resp.getOutputStream (), encoding); tmpl.write (fw, c); } finally { if (timing) c.stopTiming (); } if (timing) c.startTiming ("FastWriter.close()"); try { fw.close (); fw = null; } finally { if (timing) c.stopTiming (); } } catch (IOException e) { // ignore disconnect } catch (Exception e) { String error = "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": " + e + "\n") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")); _log.warning (error,e); try { Template errorTemplate = error (c, "WebMacro encountered an error while executing a template:\n" + ((tmpl != null) ? (tmpl + ": ") : ("The template failed to load; double check the " + "TemplatePath in your webmacro.properties file.")) + "\n<pre>" + e + "</pre>\n"); fw.reset (fw.getOutputStream ()); errorTemplate.write (fw, c); } catch (Exception ignore) { } } finally { try { if (fw != null) { fw.flush (); fw.close (); fw = null; } } catch (Exception e3) { // ignore disconnect } } }
Thread.sleep(10000);
public void initialize() { SwingWorker thread = new SwingWorker() { public Object construct() { try { Thread.sleep(10000); populateTransports(SparkManager.getConnection()); for (final Transport transport : TransportManager.getTransports()) { addTransport(transport); } } catch (Exception e) { Log.error(e); return false; } return true; } public void finished() { Boolean transportExists = (Boolean)get(); if (!transportExists) { return; } // Register presences. registerPresences(); } }; thread.start(); }
Thread.sleep(10000);
public Object construct() { try { Thread.sleep(10000); populateTransports(SparkManager.getConnection()); for (final Transport transport : TransportManager.getTransports()) { addTransport(transport); } } catch (Exception e) { Log.error(e); return false; } return true; }
boolean handle = handlePresence(contactItem, presence); if(handle){ contactGroup.fireContactGroupUpdated();
if (presence != null) { String domain = StringUtils.parseServer(presence.getFrom()); Transport transport = TransportManager.getTransport(domain); if (transport != null) { handlePresence(contactItem, presence); contactGroup.fireContactGroupUpdated(); }
private void registerPresences() { SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { Presence presence = (Presence)packet; Transport transport = TransportManager.getTransport(packet.getFrom()); if (transport != null) { boolean registered = presence != null && presence.getMode() != null; if (presence.getType() == Presence.Type.unavailable) { registered = false; } RolloverButton button = uiMap.get(transport); if (!registered) { button.setIcon(transport.getInactiveIcon()); } else { button.setIcon(transport.getIcon()); } } } }, new PacketTypeFilter(Presence.class)); ChatManager chatManager = SparkManager.getChatManager(); chatManager.addContactItemHandler(this); // Iterate through Contacts and check for final ContactList contactList = SparkManager.getWorkspace().getContactList(); for(ContactGroup contactGroup : contactList.getContactGroups()){ for(ContactItem contactItem : contactGroup.getContactItems()){ Presence presence = contactItem.getPresence(); boolean handle = handlePresence(contactItem, presence); if(handle){ contactGroup.fireContactGroupUpdated(); } } } }
label_7:
label_8:
final public Object AExpression() throws ParseException { Object e, e2; Token op; e = Factor(); label_7: while (true) { if (jj_2_12(2)) { ; } else { break label_7; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[58] = jj_gen; ; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case OP_PLUS: op = jj_consume_token(OP_PLUS); break; case OP_MINUS: op = jj_consume_token(OP_MINUS); break; default: jj_la1[59] = jj_gen; jj_consume_token(-1); throw new ParseException(); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[60] = jj_gen; ; } e2 = Factor(); if (op.kind == OP_PLUS) e = new Expression.AddBuilder(e, e2); else if (op.kind == OP_MINUS) e = new Expression.SubtractBuilder(e, e2); else {if (true) throw new ParseException("internal parser error in AExpression()");} } {if (true) return e;} throw new Error("Missing return statement in function"); }
break label_7;
break label_8;
final public Object AExpression() throws ParseException { Object e, e2; Token op; e = Factor(); label_7: while (true) { if (jj_2_12(2)) { ; } else { break label_7; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[58] = jj_gen; ; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case OP_PLUS: op = jj_consume_token(OP_PLUS); break; case OP_MINUS: op = jj_consume_token(OP_MINUS); break; default: jj_la1[59] = jj_gen; jj_consume_token(-1); throw new ParseException(); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[60] = jj_gen; ; } e2 = Factor(); if (op.kind == OP_PLUS) e = new Expression.AddBuilder(e, e2); else if (op.kind == OP_MINUS) e = new Expression.SubtractBuilder(e, e2); else {if (true) throw new ParseException("internal parser error in AExpression()");} } {if (true) return e;} throw new Error("Missing return statement in function"); }
jj_la1[58] = jj_gen;
jj_la1[59] = jj_gen;
final public Object AExpression() throws ParseException { Object e, e2; Token op; e = Factor(); label_7: while (true) { if (jj_2_12(2)) { ; } else { break label_7; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[58] = jj_gen; ; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case OP_PLUS: op = jj_consume_token(OP_PLUS); break; case OP_MINUS: op = jj_consume_token(OP_MINUS); break; default: jj_la1[59] = jj_gen; jj_consume_token(-1); throw new ParseException(); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[60] = jj_gen; ; } e2 = Factor(); if (op.kind == OP_PLUS) e = new Expression.AddBuilder(e, e2); else if (op.kind == OP_MINUS) e = new Expression.SubtractBuilder(e, e2); else {if (true) throw new ParseException("internal parser error in AExpression()");} } {if (true) return e;} throw new Error("Missing return statement in function"); }
jj_la1[59] = jj_gen;
jj_la1[60] = jj_gen;
final public Object AExpression() throws ParseException { Object e, e2; Token op; e = Factor(); label_7: while (true) { if (jj_2_12(2)) { ; } else { break label_7; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[58] = jj_gen; ; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case OP_PLUS: op = jj_consume_token(OP_PLUS); break; case OP_MINUS: op = jj_consume_token(OP_MINUS); break; default: jj_la1[59] = jj_gen; jj_consume_token(-1); throw new ParseException(); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[60] = jj_gen; ; } e2 = Factor(); if (op.kind == OP_PLUS) e = new Expression.AddBuilder(e, e2); else if (op.kind == OP_MINUS) e = new Expression.SubtractBuilder(e, e2); else {if (true) throw new ParseException("internal parser error in AExpression()");} } {if (true) return e;} throw new Error("Missing return statement in function"); }
jj_la1[60] = jj_gen;
jj_la1[61] = jj_gen;
final public Object AExpression() throws ParseException { Object e, e2; Token op; e = Factor(); label_7: while (true) { if (jj_2_12(2)) { ; } else { break label_7; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[58] = jj_gen; ; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case OP_PLUS: op = jj_consume_token(OP_PLUS); break; case OP_MINUS: op = jj_consume_token(OP_MINUS); break; default: jj_la1[59] = jj_gen; jj_consume_token(-1); throw new ParseException(); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[60] = jj_gen; ; } e2 = Factor(); if (op.kind == OP_PLUS) e = new Expression.AddBuilder(e, e2); else if (op.kind == OP_MINUS) e = new Expression.SubtractBuilder(e, e2); else {if (true) throw new ParseException("internal parser error in AExpression()");} } {if (true) return e;} throw new Error("Missing return statement in function"); }
label_8:
label_9:
final public Object AndExpression() throws ParseException { Object e, e2; e = CExpression(); label_8: while (true) { if (jj_2_14(2)) { ; } else { break label_8; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[64] = jj_gen; ; } jj_consume_token(OP_AND); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[65] = jj_gen; ; } e2 = CExpression(); e = new Expression.AndBuilder(e, e2); } {if (true) return e;} throw new Error("Missing return statement in function"); }
break label_8;
break label_9;
final public Object AndExpression() throws ParseException { Object e, e2; e = CExpression(); label_8: while (true) { if (jj_2_14(2)) { ; } else { break label_8; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[64] = jj_gen; ; } jj_consume_token(OP_AND); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[65] = jj_gen; ; } e2 = CExpression(); e = new Expression.AndBuilder(e, e2); } {if (true) return e;} throw new Error("Missing return statement in function"); }
jj_la1[64] = jj_gen;
jj_la1[65] = jj_gen;
final public Object AndExpression() throws ParseException { Object e, e2; e = CExpression(); label_8: while (true) { if (jj_2_14(2)) { ; } else { break label_8; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[64] = jj_gen; ; } jj_consume_token(OP_AND); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[65] = jj_gen; ; } e2 = CExpression(); e = new Expression.AndBuilder(e, e2); } {if (true) return e;} throw new Error("Missing return statement in function"); }
jj_la1[65] = jj_gen;
jj_la1[66] = jj_gen;
final public Object AndExpression() throws ParseException { Object e, e2; e = CExpression(); label_8: while (true) { if (jj_2_14(2)) { ; } else { break label_8; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[64] = jj_gen; ; } jj_consume_token(OP_AND); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[65] = jj_gen; ; } e2 = CExpression(); e = new Expression.AndBuilder(e, e2); } {if (true) return e;} throw new Error("Missing return statement in function"); }
jj_la1[37] = jj_gen;
jj_la1[38] = 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 SQUOTE: case NULL: case TRUE: case FALSE: case UNDEFINED: case WS: case LPAREN: case LBRACKET: case OP_MINUS: case OP_NOT: case NUMBER: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[37] = jj_gen; ; } e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[38] = jj_gen; ; } list.addElement(e); label_4: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: jj_la1[39] = jj_gen; break label_4; } jj_consume_token(COMMA); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[40] = jj_gen; ; } e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[41] = jj_gen; ; } list.addElement(e); } break; default: jj_la1[42] = jj_gen; ; } {if (true) return list;} throw new Error("Missing return statement in function"); }
jj_la1[38] = jj_gen;
jj_la1[39] = 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 SQUOTE: case NULL: case TRUE: case FALSE: case UNDEFINED: case WS: case LPAREN: case LBRACKET: case OP_MINUS: case OP_NOT: case NUMBER: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[37] = jj_gen; ; } e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[38] = jj_gen; ; } list.addElement(e); label_4: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: jj_la1[39] = jj_gen; break label_4; } jj_consume_token(COMMA); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[40] = jj_gen; ; } e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[41] = jj_gen; ; } list.addElement(e); } break; default: jj_la1[42] = jj_gen; ; } {if (true) return list;} throw new Error("Missing return statement in function"); }
label_4:
label_5:
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 SQUOTE: case NULL: case TRUE: case FALSE: case UNDEFINED: case WS: case LPAREN: case LBRACKET: case OP_MINUS: case OP_NOT: case NUMBER: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[37] = jj_gen; ; } e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[38] = jj_gen; ; } list.addElement(e); label_4: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: jj_la1[39] = jj_gen; break label_4; } jj_consume_token(COMMA); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[40] = jj_gen; ; } e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[41] = jj_gen; ; } list.addElement(e); } break; default: jj_la1[42] = jj_gen; ; } {if (true) return list;} throw new Error("Missing return statement in function"); }
jj_la1[39] = jj_gen; break label_4;
jj_la1[40] = jj_gen; break label_5;
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 SQUOTE: case NULL: case TRUE: case FALSE: case UNDEFINED: case WS: case LPAREN: case LBRACKET: case OP_MINUS: case OP_NOT: case NUMBER: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[37] = jj_gen; ; } e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[38] = jj_gen; ; } list.addElement(e); label_4: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: jj_la1[39] = jj_gen; break label_4; } jj_consume_token(COMMA); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[40] = jj_gen; ; } e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[41] = jj_gen; ; } list.addElement(e); } break; default: jj_la1[42] = jj_gen; ; } {if (true) return list;} throw new Error("Missing return statement in function"); }
jj_la1[40] = jj_gen;
jj_la1[41] = 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 SQUOTE: case NULL: case TRUE: case FALSE: case UNDEFINED: case WS: case LPAREN: case LBRACKET: case OP_MINUS: case OP_NOT: case NUMBER: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[37] = jj_gen; ; } e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[38] = jj_gen; ; } list.addElement(e); label_4: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: jj_la1[39] = jj_gen; break label_4; } jj_consume_token(COMMA); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[40] = jj_gen; ; } e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[41] = jj_gen; ; } list.addElement(e); } break; default: jj_la1[42] = jj_gen; ; } {if (true) return list;} throw new Error("Missing return statement in function"); }
jj_la1[41] = jj_gen;
jj_la1[42] = 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 SQUOTE: case NULL: case TRUE: case FALSE: case UNDEFINED: case WS: case LPAREN: case LBRACKET: case OP_MINUS: case OP_NOT: case NUMBER: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[37] = jj_gen; ; } e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[38] = jj_gen; ; } list.addElement(e); label_4: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: jj_la1[39] = jj_gen; break label_4; } jj_consume_token(COMMA); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[40] = jj_gen; ; } e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[41] = jj_gen; ; } list.addElement(e); } break; default: jj_la1[42] = jj_gen; ; } {if (true) return list;} throw new Error("Missing return statement in function"); }
jj_la1[42] = jj_gen;
jj_la1[43] = 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 SQUOTE: case NULL: case TRUE: case FALSE: case UNDEFINED: case WS: case LPAREN: case LBRACKET: case OP_MINUS: case OP_NOT: case NUMBER: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[37] = jj_gen; ; } e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[38] = jj_gen; ; } list.addElement(e); label_4: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COMMA: ; break; default: jj_la1[39] = jj_gen; break label_4; } jj_consume_token(COMMA); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[40] = jj_gen; ; } e = Expression(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case WS: jj_consume_token(WS); break; default: jj_la1[41] = jj_gen; ; } list.addElement(e); } break; default: jj_la1[42] = jj_gen; ; } {if (true) return list;} throw new Error("Missing return statement in function"); }
label_12:
label_13:
final public BlockBuilder Block(Subdirective[] subdirectives) throws ParseException { ParserBlockBuilder block = new ParserBlockBuilder(templateName); Token t; blockStack.push(subdirectives); if (jj_2_23(2147483647)) { jj_consume_token(LBRACE); EatWsNlIfNl(block); label_12: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STUFF: case END: case BEGIN: case POUNDPOUND: case DOLLAR: case QCHAR: case SLASH: case POUND: ; break; default: jj_la1[83] = jj_gen; break label_12; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STUFF: case POUNDPOUND: case DOLLAR: case QCHAR: case SLASH: case POUND: WMContent(block); break; case END: case BEGIN: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BEGIN: t = jj_consume_token(BEGIN); break; case END: t = jj_consume_token(END); break; default: jj_la1[84] = jj_gen; jj_consume_token(-1); throw new ParseException(); } block.addElement(t.image); break; default: jj_la1[85] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } jj_consume_token(RBRACE); } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BEGIN: jj_consume_token(BEGIN); EatWsNlOrSpace(block); break; default: jj_la1[86] = jj_gen; ; } label_13: while (true) { if (jj_2_21(1)) { ; } else { break label_13; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STUFF: case POUNDPOUND: case DOLLAR: case QCHAR: case SLASH: WMContentNoDirective(block); break; case RBRACE: case LBRACE: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACE: t = jj_consume_token(LBRACE); break; case RBRACE: t = jj_consume_token(RBRACE); break; default: jj_la1[87] = jj_gen; jj_consume_token(-1); throw new ParseException(); } block.addElement(t.image); break; default: jj_la1[88] = jj_gen; if (jj_2_22(2147483647) && (lookahead_not_breaking_subd())) { Directive(block); } else { jj_consume_token(-1); throw new ParseException(); } } } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case END: jj_consume_token(END); block.eatOneWs(); break; default: jj_la1[89] = jj_gen; ; } } blockStack.pop(); {if (true) return block;} throw new Error("Missing return statement in function"); }
jj_la1[83] = jj_gen; break label_12;
jj_la1[84] = jj_gen; break label_13;
final public BlockBuilder Block(Subdirective[] subdirectives) throws ParseException { ParserBlockBuilder block = new ParserBlockBuilder(templateName); Token t; blockStack.push(subdirectives); if (jj_2_23(2147483647)) { jj_consume_token(LBRACE); EatWsNlIfNl(block); label_12: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STUFF: case END: case BEGIN: case POUNDPOUND: case DOLLAR: case QCHAR: case SLASH: case POUND: ; break; default: jj_la1[83] = jj_gen; break label_12; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STUFF: case POUNDPOUND: case DOLLAR: case QCHAR: case SLASH: case POUND: WMContent(block); break; case END: case BEGIN: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BEGIN: t = jj_consume_token(BEGIN); break; case END: t = jj_consume_token(END); break; default: jj_la1[84] = jj_gen; jj_consume_token(-1); throw new ParseException(); } block.addElement(t.image); break; default: jj_la1[85] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } jj_consume_token(RBRACE); } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BEGIN: jj_consume_token(BEGIN); EatWsNlOrSpace(block); break; default: jj_la1[86] = jj_gen; ; } label_13: while (true) { if (jj_2_21(1)) { ; } else { break label_13; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STUFF: case POUNDPOUND: case DOLLAR: case QCHAR: case SLASH: WMContentNoDirective(block); break; case RBRACE: case LBRACE: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACE: t = jj_consume_token(LBRACE); break; case RBRACE: t = jj_consume_token(RBRACE); break; default: jj_la1[87] = jj_gen; jj_consume_token(-1); throw new ParseException(); } block.addElement(t.image); break; default: jj_la1[88] = jj_gen; if (jj_2_22(2147483647) && (lookahead_not_breaking_subd())) { Directive(block); } else { jj_consume_token(-1); throw new ParseException(); } } } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case END: jj_consume_token(END); block.eatOneWs(); break; default: jj_la1[89] = jj_gen; ; } } blockStack.pop(); {if (true) return block;} throw new Error("Missing return statement in function"); }
jj_la1[84] = jj_gen;
jj_la1[85] = jj_gen;
final public BlockBuilder Block(Subdirective[] subdirectives) throws ParseException { ParserBlockBuilder block = new ParserBlockBuilder(templateName); Token t; blockStack.push(subdirectives); if (jj_2_23(2147483647)) { jj_consume_token(LBRACE); EatWsNlIfNl(block); label_12: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STUFF: case END: case BEGIN: case POUNDPOUND: case DOLLAR: case QCHAR: case SLASH: case POUND: ; break; default: jj_la1[83] = jj_gen; break label_12; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STUFF: case POUNDPOUND: case DOLLAR: case QCHAR: case SLASH: case POUND: WMContent(block); break; case END: case BEGIN: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BEGIN: t = jj_consume_token(BEGIN); break; case END: t = jj_consume_token(END); break; default: jj_la1[84] = jj_gen; jj_consume_token(-1); throw new ParseException(); } block.addElement(t.image); break; default: jj_la1[85] = jj_gen; jj_consume_token(-1); throw new ParseException(); } } jj_consume_token(RBRACE); } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case BEGIN: jj_consume_token(BEGIN); EatWsNlOrSpace(block); break; default: jj_la1[86] = jj_gen; ; } label_13: while (true) { if (jj_2_21(1)) { ; } else { break label_13; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case STUFF: case POUNDPOUND: case DOLLAR: case QCHAR: case SLASH: WMContentNoDirective(block); break; case RBRACE: case LBRACE: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LBRACE: t = jj_consume_token(LBRACE); break; case RBRACE: t = jj_consume_token(RBRACE); break; default: jj_la1[87] = jj_gen; jj_consume_token(-1); throw new ParseException(); } block.addElement(t.image); break; default: jj_la1[88] = jj_gen; if (jj_2_22(2147483647) && (lookahead_not_breaking_subd())) { Directive(block); } else { jj_consume_token(-1); throw new ParseException(); } } } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case END: jj_consume_token(END); block.eatOneWs(); break; default: jj_la1[89] = jj_gen; ; } } blockStack.pop(); {if (true) return block;} throw new Error("Missing return statement in function"); }