Hi,
I'm trying to run xwiki-enterprise-manager-mysql-2.0.4 jetty version on
mysql db xwiki2, username xwiki2, passw xwiki2, but it keeps trying to
access database xwiki, and not xwiki2.
See exception here:
Wrapped Exception: Access denied for user 'xwiki2'@'localhost' to database
'xwiki'
http://ana-s-private-labs.pastebin.com/m20b049f4
My hibernate.cfg.xml is here:
http://ana-s-private-labs.pastebin.com/m3861ac33
1. <!-- MySQL configuration.
2. Uncomment if you want to use MySQL and comment out other
database configurations.
3. We need to set the sql_mode to a less strict value, see
XWIKI-1945
4. -->
5. <property
name="connection.url">jdbc:mysql://localhost/xwiki2?useServerPrepStmts=false&useUnicode=true&characterEncoding=UTF-8&sessionVariables=sql_mode=''</property>
6. <property name="connection.username">xwiki2</property>
7. <property name="connection.password">xwiki2</property>
8. <property
name="connection.driver_class">com.mysql.jdbc.Driver</property>
9. <property
name="dialect">org.hibernate.dialect.MySQLDialect</property>
10. <property
name="connection.provider_class">com.xpn.xwiki.store.DBCPConnectionProvider</property>
11. <property name="connection.pool_size">2</property>
12. <property name="statement_cache.size">2</property>
13. <mapping resource="xwiki.hbm.xml"/>
14. <mapping resource="feeds.hbm.xml"/>
15. <mapping resource="activitystream.hbm.xml"/>
I then just changed the hibernate.cfg.xml to try to connect to a xwiki4 db
(without actually creating it), and it tries to connect to db xwiki4,
getting this exception this time:
org.apache.commons.dbcp.SQLNestedException: Cannot create
PoolableConnectionFactory (Access denied for user 'xwiki2'@'localhost'
to database 'xwiki4')
http://ana-s-private-labs.pastebin.com/m129d56b2
But after I actually create the database xwiki4, and give all rights to user
xwiki2, I get again the first exception, trying to connect to db xwiki, and
not xwiki4.
What am I doing wrong?
Thanks,
Anamaria
Hi everyone,
Just to let you know I'm creating the 2.1 branches for core, web and
XE. Make sure you commit on both branch + trunk in case you are fixing
a blocking bug that must go in the 2.1 release.
Thanks
-Vincent
The XWiki development team is pleased to announce the release of XWiki
Enterprise 2.1 Release Candidate 1.
Go grab it at http://www.xwiki.org/xwiki/bin/view/Main/Download
It's the first and hopefully only release candidate of the 2.1 version.
Main changes from 2.1 Milestone 1:
* The Blog application is now using the xwiki/2.0 syntax and the new
WYSIWYG editor
* Allow XWiki.XWikiAllGroup to be an implicit group, containing all
the users without explicitly listing them as objects
* When renaming a page, also update the "parent" field of subpages
(Patch from Caleb James De Lisle)
* [Platform] Ability to register a component for the current user or
for the current wiki instead of globally. Note that this will be used
in the near future to allow registering Wiki Macros in multiwiki mode
without the macros being visible in other wikis.
* Updated translations : de (including WYSIWYG), es, fr (including
WYSIWYG), gl, lv, nl, pl, ro, sv, zh
* All Features and Improvements also present in XWiki Enterprise 2.0.4
For more information see the Release notes at:
http://www.xwiki.org/xwiki/bin/view/Main/ReleaseNotesXWikiEnterprise21RC1
Thanks
-The XWiki dev team
Hi devs,
Currently when you attach or delete a new file on a document it does
not produce any document related event. Thing is it does modify the
document but since it bypass XWiki#saveDocument it does not produce
any event.Whic mean currently to know that an attachment as been added
you can only listen to upload action event (and it works only if it
has been done with the UI).
I propose to make attachment modification also produce document
modification events.
WDYT ?
Here is my +1
--
Thomas Mortagne
I just got my Google
Wave<http://mashable.com/2009/05/28/google-wave-guide/>invite and have
been trying to understand how I can use it with my
Xwiki <http://xwiki.org>-based application (soon launching on
http://trainspodder.com see
example-screen<http://nielsmayer.com/prototype-11-17-2009.jpg>: my
interest in Wave is because my site, in google-parlance, is basically
a
"wave for deep-linking/commenting/annotating/transcluding&mashing streaming
audio&video media").
One of the areas that I think Wave would help Xwiki-based applications (and
wikis/sites) is with "Viral commenting" so that Wave becomes a central place
for comments and conversations on web pages. As it "socially networks"
comments, this enables FOAFs to more easily find out about internet
conversations that might otherwise be hidden away on a website that nobody
knows about.. Thus, Wave provides a viral commenting mechanism for Xwiki
pages that is potentially superior to the other alternatives previously
available, e.g.
http://massol.myxwiki.org/xwiki/bin/view/Blog/AnonymousComments :
> XWiki Enterprise allows users to leave comments on pages. However in order
> to prevent spam on your public wiki instance you usually only want to allow
> registered users the right to add comments. Thus we need a solution that
> still allows guest users to leave comments while preventing spam.
>
> I'm proposing 2 solutions that I've both tried on this blog and that have
> worked well: Solution 1: create a special guest account that can be used
> transparently to leave comments. This can be achieved by creating a custom
> skin and tweaking the comments form Solution 2: integrate with an external
> comment web service such as IntenseDebate <http://www.intensedebate.com/>.
> This also requires a custom skin in order to override some templates.
>
It also solves the "commenting" issues in Xwiki that include (1) controlling
comment spam by forcing commenters to login with real Xwiki accounts to post
comments; (2) the lack of well-integrated and "working right out of the box"
captcha support in Xwiki to prevent comment spam w/o authentication/login;
(3) lack of "out of the box" OpenID support which would allow easy
authentication of public users wanting to leave comments; (4) users wanting
to leave comments constantly forgetting the accounts and passwords under
which they left comments, as well as not having a centralized place to
follow-up on comments they've left, or conversations they've been involved
in.
Wave seems to solve some of the problems, and might help side-step a lot of
others in Xwiki.... for example, why spend a huge amount of effort tightly
integrating OpenID or some other certificate/2FA/SSO-based auth system for
the class of wikis that comprise a small number of editors and site
maintainers, and a large number of commenters and public that you want to
authenticate, identify, and spam-control -- perhaps Xwiki's login/auth
system is perfectly adequate for this class of sites, but becomes
"overwhelmed" by logins and accounts that have been created automatically,
or just for the purpose of posting a single comment (if people even bother
to create an account to leave a comment...). Integrating Wave or
IntenseDebate <http://www.intensedebate.com/> into Xwiki might give the user
experience desired, without the complexity....
Yesterday, I posted the following to an "Xwiki wave" I started:
https://wave.google.com/wave/#restored:wave:googlewave.com!w%252Bedlc50w0G<https://wave.google.com/wave/#restored:wave:googlewave.com%21w%252Bedlc50w0G>(please
join and lets try this thing out!!)
...................................
FYI, here are some ways Wave has been integrated into other platforms (note
MediaWiki integration, can it be leveraged for Xwiki?)
Taken from http://wave.google.com/help/wave/extensions.html
(1) MediaWiki integration:
My Wave wet dream<http://mediawikiwave.blogspot.com/2009/10/my-wave-wet-dream.html>
I have been asked several times where I see Wave
<https://wave.google.com/>go. The last time I was asked where I see
Wave in 5 years time.. not
Internet years. What I did was look hard at Wave for what it does, and look
at Google <http://google.com/> for the kind of things it has been doing.
For me, Wave is an environment where the functionality of e-mail, chat, wiki
comes together. What we have done in the
MediaWikiWave<http://mediawikiwave.org/>project is provide Wave with a
publishing back end. This is something that
MediaWiki <http://mediawiki.org/> does really well. I expect that Wave will
continue to integrate parts of the puzzle that is computer software and
data.
Google is getting into operating systems with its Chrome
OS<http://googleblog.blogspot.com/2009/07/introducing-google-chrome-os.html>.
Add to this Moore's law <http://en.wikipedia.org/wiki/Moore%27s_law> and in
five years time a computer with Chrome OS, with over a terabyte of storage
is not a wild idea at all.
When something like a terabyte is used for caching, I can imagine that this
cache is maintained by Wave. In this cache you find e-mail, Wavelets, Wiki
pages and other information that is of interest to a user. Wave being Wave,
will cache this information and updates it in the background. This
information will be available on request.
Wave in its architecture allows for multiple servers. It is not necessary to
know on what server a particular Wavelet is available. I think that a user
is not that interested in any particular server, he is interested in the
data being available. Only when the data is manipulated is there a need for
immediate feed back to servers or other computers.
I think this is doable. Part of the cache is already there in Google
Gears<http://gears.google.com/>and this makes this vision evolutionary
progress.
Thanks,
GerardM
(2) SAP integration:
Gravity – Collaborative Business Process Modelling within Google
Wave<http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/15618>
Gravity is a prototype developed by SAP Research in Brisbane, Australia and
SAP NetWeaver Development providing real-time, cloud-based collaborative
business process modelling within Google Wave <http://wave.google.com/>.
Google Wave is Google's new real-time collaboration platform that combines
features of e-mail, social networking, wikis and instant messaging in one
integrated browser-based client. Google Wave offers rich developer APIs to
extend the core functionality with custom components. We have embedded
Gravity as a Google Wave "gadget" that can be added within the Google Wave
client. Leveraging the collaborative features of Google Wave, all business
process modelling activities get propagated in near real-time to all other
participants of the Wave. In addition, participants of the Wave can use all
other features provided by Google and its developer community to enrich the
collaborative modelling experience.
In the demo we see how Gravity can be used to facilitate the development of
high level process descriptions for two merging companies, BCD South Bank
and FH Insurance. These two companies are merging in a tough economic
climate and management need to quickly re-engineer their business processes
in order to capitalise from cross-selling opportunities between banking and
insurance products. In addition to the near real-time propagation of model
content to all participants of a Wave, various features of true real-time
collaboration are shown, such as different colour-coding for each individual
modeller, history of a model, asynchronous and synchronous editing, and
more. The demo also shows how robots (automated components that act as Wave
participants) can be leveraged in order to syntactically correct the model
on the fly. In the end, we will see how models are exported using BPMN 2.0
XML. They will then be imported into SAP Netweaver BPM for further
refinement and execution.
The demo shows how new technology can be systematically leveraged in order
to facilitate what Business Process Management is really about: business
user collaboration within and across departments of one or more
organisations.
Please check out the high resolution
screencam<https://www.sdn.sap.com/irj/scn/elearn?rid=/library/uuid/e03471b6-db79-2c10…>by
clicking on the Gravity screenshot above. If you experience problems with
the Podcast, please click here for more versions including a low resolution
of the screencam<https://www.sdn.sap.com/irj/scn/elearn?rid=/library/uuid/705d166b-dd79-2c10…>or
view the embedded screencam below.
(3) Salesforce.com <http://salesforce.com/> integration:
Getting in Front of the
Wave<http://blog.sforce.com/sforce/2009/09/getting-in-front-of-the-wave.html>
On Wednesday, September 30th, Google will open up their
Wave<http://wave.google.com/>preview to about 100,000 people. Details
are at Google
Wave Developer Blog<http://googlewavedev.blogspot.com/2009/09/what-happened-in-wave-sandbox.html>and
The
Official Google
Blog<http://googleblog.blogspot.com/2009/09/surfs-up-wednesday-google-wave-updat…>I
am excited to announce that we have put together a new
demo <http://www.youtube.com/watch?v=TQ0b1CVRZHs> on how you might leverage
the Wave platform on salesforce.com and how you might leverage
salesforce.com from Wave.
Wave is a truly exciting and seminal Cloud technology. Google Wave was
invented by two brothers Jens
Rasmussen<http://www.crunchbase.com/person/jens-rasmussen>andLars
Rasmussen <http://www.crunchbase.com/person/lars-rasmussen> at Google that
builds on the concepts of AJAX combined with fresh look at Operation
Transformation <http://en.wikipedia.org/wiki/Operational_transformation>.
It's difficult at this point in time to fully understand the ways in which
this technology may transform web based communication. It will be up to the
community of developers working within and without the enterprise to realize
the evident potential of Wave.
>From a technical perspective, Wave has the ability to interact with other
cloud platforms, like the Force.com <http://developer.force.com/> platform.
It is this interaction that we have demonstrated in relatively short time
frame in the demonstration announced in this post.
The use case for the demo is a fictitious Mobile Services Company named
Booyah. This company asks customers to register the products that they
purchase and one piece of information that is returned upon registration is
an email address for support. The email address is actually to a Wave robot
created by the company's service and support organization. When a customer
encounters a problem with their product, they can begin the process of
resolution by contacting the robot from Google Wave.
This initial contact begins an interaction to provide results from the
company's knowledge base, which of course is implemented using
salesforce.com's Service
Cloud<http://www.salesforce.com/crm/customer-service-support/>.
Through a short series of questions and responses a list of possible
solutions to the customers problem can be presented.
Behind the scenes, the robot identifies the customer by her Wave id and can
tailor the interaction based on the customers purchase and support history
providing a personalized yet automated path to resolution. The robot also
creates a case on the salesforce.com side so that this support interaction
can be managed by Booyah.
To take the experience beyond a simple knowledge base search, the customer
also has the option of requesting a live chat with an available support
representative. This is where Google Wave really starts to shine. If none of
the suggested solutions work for the customer, she can simply click a link
to request a chat. Wave sends this request to the robot which in turn makes
a request to salesforce.com to find an available representative. That
representative is then added to the wave as a participant and the
personalized service begins.
Behind the scenes the robot request is evaluated by a salesforce.com web
service built in Force.com <http://force.com/> Code. When the representative
is found the web service creates a task and a reminder for the task and
assigns it to the representative. The representative is, of course, working
in the salesforce.com UI and sees an alert window as the reminder is
triggered. The representative can simply click on the link to the case shown
in the alert window to access the case.
The cool part about this is that when the case was created, enough
information about the wave was included so that the active wave could be
embedded directly into the layout of the Case detail page. This embedded
Wave has full interactive capability so that the support representative can
carry on the conversation with the customer from the Case detail page. And,
the wave, which was the original channel for the support case can be
accessed at any point in time later, including all the interaction with the
customer.
I'm confident that with the creative minds in the
Force.com<http://force.com/>community, as evidenced by the fantastic
Sites created during our Sites
contest, that many more and truly valuable use cases can be implemented by
combining these two amazing platforms.
If you want to learn more about creating Force.com <http://force.com/> and
Wave solutions be sure to attend the Riding the (Google)
Wave<http://www.salesforce.com/dreamforce/DF09/site/learn/tracks/a1y300000004CGe…>session
at
Dreamforce <http://www.salesforce.com/dreamforce/DF09/site/> this year.
Niels
http://nielsmayer.com
*Hi,*
*
*
*I try to implement this tutorial : *
http://dev.xwiki.org/xwiki/bin/view/Drafts/DynamicCustomMapping*
*
*But when i try to execute this query *
{{groovy}}
xc = xcontext.getContext();
for(String name : xc.getWiki().search("SELECT e.familyName from Employee e",xc
));
println(name);
}
{{/groovy}}
*i get this exception :*
Caused by: com.xpn.xwiki.XWikiException: Error number 3223 in 3: Exception
while searching documents with sql SELECT familyName from Employee
Wrapped Exception: Employee is not mapped [SELECT familyName from Employee]
at
com.xpn.xwiki.store.XWikiHibernateStore.search(XWikiHibernateStore.java:2142)
at
com.xpn.xwiki.store.XWikiHibernateStore.search(XWikiHibernateStore.java:2072)
at
com.xpn.xwiki.store.XWikiHibernateStore.search(XWikiHibernateStore.java:2061)
at com.xpn.xwiki.store.XWikiCacheStore.search(XWikiCacheStore.java:581)
at com.xpn.xwiki.XWiki.search(XWiki.java:1569)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:389)
at
org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:378)
at
org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270)
... 100 more
*Any ideas ?*
--
Farouk Korteby
Hi Devs,
Among many things jruby-1.4.0 release bundles JSR223 support. See full
release notes at http://www.jruby.org/2009/11/02/jruby-1-4-0
I was planning to this upgrade in 2.1 time frame but got a little packed and
now we are at 2.1 RC1. However I think it's still safe to do this upgrade
with adequate testing (note that jruby-macro is not budled with XE by
default).
Please let me know if you think this is unwise.
Extremely sorry about not doing this sooner.
Thanks.
- Asiri
On Fri, Dec 4, 2009 at 16:25, lucaa <contrib-notifications(a)xwiki.org> wrote:
> Author: lucaa
> Date: 2009-12-04 16:25:46 +0100 (Fri, 04 Dec 2009)
> New Revision: 25544
>
> Added:
> contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/content/WhiteSpaceContentAlterer.java
> contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/content/filter/WhiteSpaceFilter.java
> contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/renderer/
> contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/renderer/AnnotationGeneratorChainingListener.java
> contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/renderer/XHTMLAnnotationChainingPrintRenderer.java
> contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/renderer/XHTMLAnnotationRenderer.java
XHTMLAnnotationRenderer seems wrong, it's a specialized XHTML renderer
so it should be the other way around: AnnotationXHTMLRenderer
> contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/renderer/
> contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/renderer/AbstractAnnotationRenderer.java
> contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/renderer/AnnotationChainingPrintRenderer.java
> contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/renderer/AnnotationListener.java
> contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/renderer/AnnotationPrintRenderer.java
> contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/test/java/org/xwiki/annotation/content/
> contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/test/java/org/xwiki/annotation/content/WhiteSpaceContentAltererTest.java
> contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/test/java/org/xwiki/annotation/renderer/
> contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/test/java/org/xwiki/annotation/renderer/XHTMLAnnotationRendererTest.java
> Modified:
> contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/pom.xml
> contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/resources/META-INF/components.txt
> Log:
> First prototype for the annotations renderer API with the default XHTML renderer.
>
>
> Modified: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/pom.xml
> ===================================================================
> --- contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/pom.xml 2009-12-04 15:18:58 UTC (rev 25543)
> +++ contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/pom.xml 2009-12-04 15:25:46 UTC (rev 25544)
> @@ -21,11 +21,17 @@
> </dependency>
> <dependency>
> <groupId>org.xwiki.platform</groupId>
> - <artifactId>xwiki-core-observation-local</artifactId>
> + <artifactId>xwiki-core-rendering-api</artifactId>
> <version>${platform.core.version}</version>
> <scope>provided</scope>
> </dependency>
> <dependency>
> + <groupId>org.xwiki.platform</groupId>
> + <artifactId>xwiki-core-rendering-syntax-wikimodel</artifactId>
> + <version>${platform.core.version}</version>
> + <scope>provided</scope>
> + </dependency>
> + <dependency>
> <groupId>org.xwiki.platform</groupId>
> <artifactId>xwiki-core-shared-tests</artifactId>
> <version>${platform.core.version}</version>
> @@ -52,7 +58,8 @@
> <configuration>
> <excludes>
> org/xwiki/annotation/Annotation.java,
> - org/xwiki/annotation/internal/target/DefaultDocumentContentTarget.java
> + org/xwiki/annotation/internal/target/DefaultDocumentContentTarget.java,
> + org/xwiki/annotation/internal/renderer/AnnotationGeneratorChainingListener.java
> </excludes>
> </configuration>
> </plugin>
>
> Added: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/content/WhiteSpaceContentAlterer.java
> ===================================================================
> --- contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/content/WhiteSpaceContentAlterer.java (rev 0)
> +++ contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/content/WhiteSpaceContentAlterer.java 2009-12-04 15:25:46 UTC (rev 25544)
> @@ -0,0 +1,51 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package org.xwiki.annotation.internal.content;
> +
> +import org.xwiki.annotation.content.filter.Filter;
> +import org.xwiki.component.annotation.Component;
> +import org.xwiki.component.annotation.Requirement;
> +
> +/**
> + * Content alterer that filters out all spaces.
> + *
> + * @version $Id$
> + */
> +@Component("whitespace")
> +public class WhiteSpaceContentAlterer extends AbstractFilterContentAlterer
> +{
> + /**
> + * Whitespace filter used by this alterer.
> + */
> + @Requirement("whitespace")
> + private Filter whiteSpaceFilter;
> +
> + /**
> + * {@inheritDoc}
> + *
> + * @see org.xwiki.annotation.internal.content.AbstractFilterContentAlterer#getFilter()
> + */
> + @Override
> + protected Filter getFilter()
> + {
> + return whiteSpaceFilter;
> + }
> +
> +}
>
>
> Property changes on: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/content/WhiteSpaceContentAlterer.java
> ___________________________________________________________________
> Name: svn:keywords
> + Author Id Revision HeadURL
> Name: svn:eol-style
> + native
>
> Added: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/content/filter/WhiteSpaceFilter.java
> ===================================================================
> --- contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/content/filter/WhiteSpaceFilter.java (rev 0)
> +++ contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/content/filter/WhiteSpaceFilter.java 2009-12-04 15:25:46 UTC (rev 25544)
> @@ -0,0 +1,43 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package org.xwiki.annotation.internal.content.filter;
> +
> +import org.xwiki.annotation.content.filter.Filter;
> +import org.xwiki.component.annotation.Component;
> +
> +/**
> + * Filters white spaces out of a text.
> + *
> + * @version $Id$
> + */
> +@Component("whitespace")
> +public class WhiteSpaceFilter implements Filter
> +{
> + /**
> + * {@inheritDoc}
> + *
> + * @see org.xwiki.annotation.content.filter.Filter#accept(java.lang.Character)
> + */
> + public boolean accept(Character c)
> + {
> + // check it not to be a whitespace but also not a space (should cover all whitespaces + unbreakable spaces)
> + return !Character.isWhitespace(c) && !Character.isSpaceChar(c);
> + }
> +}
>
>
> Property changes on: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/content/filter/WhiteSpaceFilter.java
> ___________________________________________________________________
> Name: svn:keywords
> + Author Id Revision HeadURL
> Name: svn:eol-style
> + native
>
> Added: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/renderer/AnnotationGeneratorChainingListener.java
> ===================================================================
> --- contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/renderer/AnnotationGeneratorChainingListener.java (rev 0)
> +++ contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/renderer/AnnotationGeneratorChainingListener.java 2009-12-04 15:25:46 UTC (rev 25544)
> @@ -0,0 +1,372 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package org.xwiki.annotation.internal.renderer;
> +
> +import java.util.ArrayList;
> +import java.util.Collection;
> +import java.util.Collections;
> +import java.util.HashMap;
> +import java.util.Iterator;
> +import java.util.Map;
> +import java.util.SortedMap;
> +import java.util.TreeMap;
> +
> +import org.xwiki.annotation.Annotation;
> +import org.xwiki.annotation.content.AlteredContent;
> +import org.xwiki.annotation.content.ContentAlterer;
> +import org.xwiki.annotation.renderer.AnnotationListener;
> +import org.xwiki.rendering.internal.renderer.BasicLinkRenderer;
> +import org.xwiki.rendering.listener.Link;
> +import org.xwiki.rendering.listener.LinkType;
> +import org.xwiki.rendering.listener.Listener;
> +import org.xwiki.rendering.listener.QueueListener;
> +import org.xwiki.rendering.listener.chaining.ChainingListener;
> +import org.xwiki.rendering.listener.chaining.EmptyBlockChainingListener;
> +import org.xwiki.rendering.listener.chaining.ListenerChain;
> +import org.xwiki.rendering.renderer.LinkLabelGenerator;
> +import org.xwiki.rendering.syntax.Syntax;
> +
> +/**
> + * Generates annotation events (as per the {@link AnnotationListener} specification) in a chain, to the next listener in
> + * the chain. <br />
> + * It operates by buffering all events, creating the plain text representation of the listened content, mapping the
> + * annotations on this content and identifying the events in the stream that hold the start and end of the annotations.
> + * On sending the buffered events, the events containing annotations will be split and annotation events will be sent
> + * for them.
> + *
> + * @version $Id$
> + */
> +public class AnnotationGeneratorChainingListener extends QueueListener implements ChainingListener
> +{
> + /**
> + * Version number of this class.
> + */
> + private static final long serialVersionUID = -2790330640900288463L;
> +
> + /**
> + * To generate a string representation of a link that we output when no link label generator exist or when the link
> + * is an external link (ie not a document link).
> + */
> + private BasicLinkRenderer linkRenderer = new BasicLinkRenderer();
> +
> + /**
> + * Generate link label.
> + */
> + private LinkLabelGenerator linkLabelGenerator;
> +
> + /**
> + * The chain listener from which this listener is part of.
> + */
> + private ListenerChain chain;
> +
> + /**
> + * Buffer to store the plain text version of the content to be rendered, so that annotations are mapped on it.
> + */
> + private StringBuffer plainTextContent = new StringBuffer();
> +
> + /**
> + * Map to store the ranges in the plainTextContent and their corresponding events. The ranges will be stored by
> + * their end index (inclusive) and ordered from smallest to biggest.
> + */
> + private SortedMap<Integer, Event> eventsMapping = new TreeMap<Integer, Event>();
> +
> + /**
> + * The collection of annotations to generate annotation events for, by default the empty list.
> + */
> + private Collection<Annotation> annotations = Collections.<Annotation> emptyList();
> +
> + /**
> + * Cleaner for the annotation selection text, so that it can be mapped on the content.
> + */
> + private ContentAlterer selectionAlterer;
> +
> + /**
> + * Map holding the collection of annotations starting in the specified event. Used to send annotation events in the
> + * events stream when consuming queued events.
> + */
> + private Map<Event, Collection<Annotation>> startEvents = new HashMap<Event, Collection<Annotation>>();
> +
> + /**
> + * Map holding the collection of annotations ending in the specified event. Used to send annotation events in the
> + * events stream when consuming queued events.
> + */
> + private Map<Event, Collection<Annotation>> endEvents = new HashMap<Event, Collection<Annotation>>();
> +
> + /**
> + * Builds an annotation generator listener from the passed link generator in the passed chain.
> + *
> + * @param linkLabelGenerator the generator for link labels so that the annotation text can be recognized.
> + * @param selectionAlterer cleaner for the annotation selection text, so that it can be mapped on the content
> + * @param listenerChain the chain in which this listener is part of
> + */
> + public AnnotationGeneratorChainingListener(LinkLabelGenerator linkLabelGenerator, ContentAlterer selectionAlterer,
> + ListenerChain listenerChain)
> + {
> + this.linkLabelGenerator = linkLabelGenerator;
> + this.chain = listenerChain;
> + this.selectionAlterer = selectionAlterer;
> + }
> +
> + /**
> + * @return the state of the current empty block.
> + */
> + protected EmptyBlockChainingListener getEmptyBlockState()
> + {
> + return (EmptyBlockChainingListener) getListenerChain().getListener(EmptyBlockChainingListener.class);
> + }
> +
> + /**
> + * {@inheritDoc}
> + *
> + * @see org.xwiki.rendering.listener.QueueListener#onWord(java.lang.String)
> + */
> + @Override
> + public void onWord(String word)
> + {
> + // queue this event
> + super.onWord(word);
> + // put it in the buffer
> + plainTextContent.append(word);
> + // store the mapping of the range to the just added event
> + eventsMapping.put(plainTextContent.length() - 1, getLast());
> + }
> +
> + /**
> + * {@inheritDoc}
> + *
> + * @see org.xwiki.rendering.listener.QueueListener#onSpecialSymbol(char)
> + */
> + @Override
> + public void onSpecialSymbol(char symbol)
> + {
> + super.onSpecialSymbol(symbol);
> + plainTextContent.append("" + symbol);
> + eventsMapping.put(plainTextContent.length() - 1, getLast());
> + }
> +
> + /**
> + * {@inheritDoc}
> + *
> + * @see org.xwiki.rendering.listener.QueueListener#onVerbatim(java.lang.String, boolean, java.util.Map)
> + */
> + @Override
> + public void onVerbatim(String protectedString, boolean isInline, Map<String, String> parameters)
> + {
> + super.onVerbatim(protectedString, isInline, parameters);
> + plainTextContent.append(protectedString);
> + eventsMapping.put(plainTextContent.length() - 1, getLast());
> + }
> +
> + /**
> + * {@inheritDoc}
> + *
> + * @see org.xwiki.rendering.listener.QueueListener#onRawText(java.lang.String, org.xwiki.rendering.syntax.Syntax)
> + */
> + @Override
> + public void onRawText(String text, Syntax syntax)
> + {
> + // Store the raw text as it is ftm. Should handle syntax in the future
> + super.onRawText(text, syntax);
> + plainTextContent.append(text);
> + eventsMapping.put(plainTextContent.length() - 1, getLast());
> + }
> +
> + /**
> + * {@inheritDoc}
> + *
> + * @see org.xwiki.rendering.listener.chaining.AbstractChainingListener#endLink(org.xwiki.rendering.listener.Link,
> + * boolean, java.util.Map)
> + */
> + @Override
> + public void endLink(Link link, boolean isFreeStandingURI, Map<String, String> parameters)
> + {
> + super.endLink(link, isFreeStandingURI, parameters);
> + // special handling only if the link is empty
> + if (getEmptyBlockState().isCurrentContainerBlockEmpty()) {
> + String linkPlainText = "";
> + if (link.getType() == LinkType.DOCUMENT && this.linkLabelGenerator != null) {
> + linkPlainText = this.linkLabelGenerator.generate(link);
> + } else {
> + linkPlainText = this.linkRenderer.renderLinkReference(link);
> + }
> + // TODO: should clean spaces out of the linkPlainText (but then the event offset inside this event wouldn't
> + // work anymore)
> + plainTextContent.append(linkPlainText);
> + // TODO: maybe should store the begin link event...
> + eventsMapping.put(plainTextContent.length() - 1, getLast());
> + }
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + @Override
> + public void endDocument(Map<String, String> parameters)
> + {
> + super.endDocument(parameters);
> +
> + mapAnnotations();
> +
> + // now get the next listener in the chain and consume all events to it
> + ChainingListener renderer = chain.getNextListener(getClass());
> +
> + // consumeEvents should check if the listener is annotation listener or not and send annotation events
> + consumeEvents(renderer);
> + }
> +
> + /**
> + * Helper method to map the annotations on the plainTextContent and identify the events where annotations start and
> + * end.
> + */
> + private void mapAnnotations()
> + {
> + for (Annotation ann : annotations) {
> + // clean it up and its context
> + AlteredContent cleanedContext = selectionAlterer.alter(ann.getSelectionContext());
> + // find it in the plaintextContent
> + int contextIndex = plainTextContent.indexOf(cleanedContext.getContent().toString());
> + // find the selection inside the context in the plainTextContent
> + // assume at this point that the selection appears only once in the context
> + String alteredSelection = selectionAlterer.alter(ann.getInitialSelection()).getContent().toString();
> + int selectionIndexInContext = cleanedContext.getContent().toString().indexOf(alteredSelection);
> + // check that the context is in the plainText representation and selection was found inside it
> + if (contextIndex >= 0 && selectionIndexInContext >= 0) {
> + // compute annotation index in the plain text repr
> + int annotationIndex = contextIndex + selectionIndexInContext;
> + // get the start and end events for the annotation
> + // TODO: should also store the offsets of the start and end annotation in the event
> + Event startEvt = getEventForIndex(annotationIndex).getValue();
> + Event endEvt = getEventForIndex(annotationIndex + alteredSelection.length() - 1).getValue();
> + if (startEvt != null & endEvt != null) {
> + // store them in the maps
> + addEventMapping(startEvt, ann, startEvents);
> + addEventMapping(endEvt, ann, endEvents);
> + } else {
> + // cannot find the events for the start and / or end of annotation, ignore it
> + // TODO: mark it somehow...
> + continue;
> + }
> + } else {
> + // cannot find the context of the annotation or the annotation selection cannot be found in the
> + // annotation context, ignore it
> + // TODO: mark it somehow...
> + continue;
> + }
> + }
> + }
> +
> + /**
> + * Adds a mapping for the passed event and annotation in the specified map.
> + *
> + * @param event the event to add mapping for
> + * @param annotation the annotation to add mapping for
> + * @param map the map in which to add mapping
> + */
> + private void addEventMapping(Event event, Annotation annotation, Map<Event, Collection<Annotation>> map)
> + {
> + Collection<Annotation> mappedCollection = endEvents.get(event);
> + if (mappedCollection == null) {
> + mappedCollection = new ArrayList<Annotation>();
> + map.put(event, mappedCollection);
> + }
> + mappedCollection.add(annotation);
> + }
> +
> + /**
> + * Finds and returns the event in whose range (generated text in the plainTextRepresentation) the passed index is
> + * falling.
> + *
> + * @param index the index to find event for
> + * @return the pair of startIndex, Event in whose range index falls
> + */
> + private Map.Entry<Integer, Event> getEventForIndex(int index)
> + {
> + // iterate through all the mappings, for start index and event
> + Iterator<Map.Entry<Integer, Event>> rangeIt = eventsMapping.entrySet().iterator();
> + Map.Entry<Integer, Event> range = rangeIt.next();
> + while (rangeIt.hasNext() && range.getKey() < index) {
> + // while there is a next event and the index to find is after behind the end position, try the next range
> + range = rangeIt.next();
> + }
> + return range;
> + }
> +
> + /**
> + * {@inheritDoc}
> + *
> + * @see org.xwiki.rendering.listener.QueueListener#consumeEvents(org.xwiki.rendering.listener.Listener)
> + */
> + @Override
> + public void consumeEvents(Listener listener)
> + {
> + if (listener instanceof AnnotationListener) {
> + consumeAnnotationEvents((AnnotationListener) listener);
> + } else {
> + super.consumeEvents(listener);
> + }
> + }
> +
> + /**
> + * Helper function to consume the events queued in this listener with annotation awareness, i.e. send annotation
> + * events to the passed listener.
> + *
> + * @param listener the annotation listener to send the annotation events to
> + */
> + private void consumeAnnotationEvents(AnnotationListener listener)
> + {
> + // FIXME: take annotation offsets into account and split events
> + while (!isEmpty()) {
> + Event event = remove();
> + // annotations starting before
> + if (startEvents.get(event) != null) {
> + for (Annotation startAnn : startEvents.get(event)) {
> + listener.beginAnnotation(startAnn);
> + }
> + }
> + event.eventType.fireEvent(listener, event.eventParameters);
> + // annotations ending after
> + if (endEvents.get(event) != null) {
> + for (Annotation endAnn : endEvents.get(event)) {
> + listener.endAnnotation(endAnn);
> + }
> + }
> + }
> + }
> +
> + /**
> + * {@inheritDoc}
> + *
> + * @see org.xwiki.rendering.listener.chaining.ChainingListener#getListenerChain()
> + */
> + public ListenerChain getListenerChain()
> + {
> + return chain;
> + }
> +
> + /**
> + * Sets the collections of annotations to identify on the listened content and send notifications for.
> + *
> + * @param annotations the collection of annotations to generate events for
> + */
> + public void setAnnotations(Collection<Annotation> annotations)
> + {
> + this.annotations = annotations;
> + }
> +}
>
>
> Property changes on: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/renderer/AnnotationGeneratorChainingListener.java
> ___________________________________________________________________
> Name: svn:keywords
> + Author Id Revision HeadURL
> Name: svn:eol-style
> + native
>
> Added: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/renderer/XHTMLAnnotationChainingPrintRenderer.java
> ===================================================================
> --- contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/renderer/XHTMLAnnotationChainingPrintRenderer.java (rev 0)
> +++ contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/renderer/XHTMLAnnotationChainingPrintRenderer.java 2009-12-04 15:25:46 UTC (rev 25544)
> @@ -0,0 +1,94 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package org.xwiki.annotation.internal.renderer;
> +
> +import java.util.LinkedHashMap;
> +import java.util.Map;
> +
> +import org.xwiki.annotation.Annotation;
> +import org.xwiki.annotation.renderer.AnnotationChainingPrintRenderer;
> +import org.xwiki.rendering.internal.renderer.xhtml.XHTMLChainingRenderer;
> +import org.xwiki.rendering.listener.chaining.ListenerChain;
> +import org.xwiki.rendering.renderer.xhtml.XHTMLImageRenderer;
> +import org.xwiki.rendering.renderer.xhtml.XHTMLLinkRenderer;
> +
> +/**
> + * Extends the default XHTML renderer to add handling of annotations.<br />
> + * FIXME: this implementation is a very simple handling of annotation events, it should handle annotation markers
> + * splitting & nesting in other elements.
> + *
> + * @version $Id$
> + */
> +public class XHTMLAnnotationChainingPrintRenderer extends XHTMLChainingRenderer implements
> + AnnotationChainingPrintRenderer
> +{
> + /**
> + * The annotation marker element in HTML.
> + */
> + private static final String ANNOTATION_MARKER = "span";
> +
> + /**
> + * Constructor from super class.
> + *
> + * @param linkRenderer the renderer for links
> + * @param imageRenderer the renderer for images
> + * @param listenerChain the listener chain in which to add this listener
> + */
> + public XHTMLAnnotationChainingPrintRenderer(XHTMLLinkRenderer linkRenderer, XHTMLImageRenderer imageRenderer,
> + ListenerChain listenerChain)
> + {
> + super(linkRenderer, imageRenderer, listenerChain);
> + }
> +
> + /**
> + * {@inheritDoc}
> + *
> + * @see org.xwiki.annotation.renderer.AnnotationListener#beginAnnotation(Annotation)
> + */
> + public void beginAnnotation(Annotation annotation)
> + {
> + Map<String, String> attributes = new LinkedHashMap<String, String>();
> +
> + attributes.put("class", createAnnotationClass(annotation.getId()));
why don't you put the annotationId as an id instead of class if it's a
unique id ?
> + attributes.put("title", annotation.getAnnotation().toString());
I generally try to avoid as much as possible using Object#toString()
for anything else that debugging. If Annotation officially has a title
it should have a getTitle() method or something like that.
> + getXHTMLWikiPrinter().printXMLStartElement(ANNOTATION_MARKER, attributes);
> + }
> +
> + /**
> + * Creates the class value of the annotation.
> + *
> + * @param annotationId the id of the annotation
> + * @return the class value for the passed annotation
> + */
> + private String createAnnotationClass(int annotationId)
> + {
> + return "annotation ID" + annotationId;
> + }
> +
> + /**
> + * {@inheritDoc}
> + *
> + * @see org.xwiki.annotation.renderer.AnnotationListener#endAnnotation(Annotation)
> + */
> + public void endAnnotation(Annotation annotation)
> + {
> + getXHTMLWikiPrinter().printXMLEndElement(ANNOTATION_MARKER);
> + }
> +}
>
>
> Property changes on: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/renderer/XHTMLAnnotationChainingPrintRenderer.java
> ___________________________________________________________________
> Name: svn:keywords
> + Author Id Revision HeadURL
> Name: svn:eol-style
> + native
>
> Added: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/renderer/XHTMLAnnotationRenderer.java
> ===================================================================
> --- contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/renderer/XHTMLAnnotationRenderer.java (rev 0)
> +++ contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/renderer/XHTMLAnnotationRenderer.java 2009-12-04 15:25:46 UTC (rev 25544)
> @@ -0,0 +1,68 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package org.xwiki.annotation.internal.renderer;
> +
> +import org.xwiki.annotation.renderer.AbstractAnnotationRenderer;
> +import org.xwiki.annotation.renderer.AnnotationChainingPrintRenderer;
> +import org.xwiki.component.annotation.Component;
> +import org.xwiki.component.annotation.InstantiationStrategy;
> +import org.xwiki.component.annotation.Requirement;
> +import org.xwiki.component.descriptor.ComponentInstantiationStrategy;
> +import org.xwiki.rendering.listener.chaining.ListenerChain;
> +import org.xwiki.rendering.renderer.xhtml.XHTMLImageRenderer;
> +import org.xwiki.rendering.renderer.xhtml.XHTMLLinkRenderer;
> +
> +/**
> + * Renders annotations in the XHTML format.
> + *
> + * @version $Id$
> + */
> +@Component("annotations/xhtml/1.0")
You should not use / in the syntax name since it's the syntax
name/syntax version separator also AnnotatedXHTMLBlockRenderer use
"annotatedxhtml/1.0" so it's not consistant
> +(a)InstantiationStrategy(ComponentInstantiationStrategy.PER_LOOKUP)
> +public class XHTMLAnnotationRenderer extends AbstractAnnotationRenderer
> +{
> + /**
> + * To render link events into XHTML. This is done so that it's pluggable because link rendering depends on how the
> + * underlying system wants to handle it. For example for XWiki we check if the document exists, we get the document
> + * URL, etc.
> + */
> + @Requirement
> + private XHTMLLinkRenderer linkRenderer;
> +
> + /**
> + * To render image events into XHTML. This is done so that it's pluggable because image rendering depends on how the
> + * underlying system wants to handle it. For example for XWiki we check if the image exists as a document
> + * attachments, we get its URL, etc.
> + */
> + @Requirement
> + private XHTMLImageRenderer imageRenderer;
> +
> + /**
> + * {@inheritDoc}
> + *
> + * @see org.xwiki.annotation.renderer.AbstractAnnotationRenderer#getAnnotationPrintRenderer(ListenerChain)
> + */
> + @Override
> + public AnnotationChainingPrintRenderer getAnnotationPrintRenderer(ListenerChain chain)
> + {
> + return new XHTMLAnnotationChainingPrintRenderer(linkRenderer, imageRenderer, chain);
> + }
> +
> +}
>
>
> Property changes on: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/internal/renderer/XHTMLAnnotationRenderer.java
> ___________________________________________________________________
> Name: svn:keywords
> + Author Id Revision HeadURL
> Name: svn:eol-style
> + native
>
> Added: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/renderer/AbstractAnnotationRenderer.java
> ===================================================================
> --- contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/renderer/AbstractAnnotationRenderer.java (rev 0)
> +++ contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/renderer/AbstractAnnotationRenderer.java 2009-12-04 15:25:46 UTC (rev 25544)
> @@ -0,0 +1,107 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package org.xwiki.annotation.renderer;
> +
> +import java.util.Collection;
> +
> +import org.xwiki.annotation.Annotation;
> +import org.xwiki.annotation.content.ContentAlterer;
> +import org.xwiki.annotation.internal.renderer.AnnotationGeneratorChainingListener;
> +import org.xwiki.component.annotation.Requirement;
> +import org.xwiki.component.phase.Initializable;
> +import org.xwiki.component.phase.InitializationException;
> +import org.xwiki.rendering.listener.chaining.EmptyBlockChainingListener;
> +import org.xwiki.rendering.listener.chaining.ListenerChain;
> +import org.xwiki.rendering.renderer.AbstractChainingPrintRenderer;
> +import org.xwiki.rendering.renderer.LinkLabelGenerator;
> +
> +/**
> + * Abstract class for annotation renderer, any specific syntax renderer should implement this class and provide the
> + * specific annotation listener.
> + *
> + * @version $Id$
> + */
> +public abstract class AbstractAnnotationRenderer extends AbstractChainingPrintRenderer implements Initializable,
> + AnnotationPrintRenderer
> +{
> + /**
> + * The link label generator for this renderer.
> + */
> + @Requirement
> + protected LinkLabelGenerator linkLabelGenerator;
> +
> + /**
> + * Selection cleaner so that the selection can be mapped on the content. <br />
> + * TODO: not really sure if this is the right place for this pull, but the annotations generator is not a component
> + * so it cannot 'require' it.
> + */
> + @Requirement("whitespace")
> + protected ContentAlterer selectionAlterer;
> +
> + /**
> + * The annotations generator listener to use in this renderer.
> + */
> + private AnnotationGeneratorChainingListener annotationsGenerator;
> +
> + /**
> + * {@inheritDoc}
> + *
> + * @see org.xwiki.component.phase.Initializable#initialize()
> + */
> + public void initialize() throws InitializationException
> + {
> + ListenerChain chain = new ListenerChain();
> + setListenerChain(chain);
> +
> + // Construct the listener chain in the right order. Listeners early in the chain are called before listeners
> + // placed later in the chain.
> + chain.addListener(this);
> + chain.addListener(new EmptyBlockChainingListener(chain));
> + // will generate annotation events to the next listener in chain
> +
> + // TODO: could also have the annotation listener passed to the annotationgenerator chaininglistener (which would
> + // become a print renderer and delegate all printing functions to the aggregated annotation print renderer).
> + // All buffered events will be consumed to this aggregated listener. This way the next element in chain is
> + // better coupled in the listener that knows how to send such events and we don't need to test in the annotation
> + // generator that the next listener in the chain can receive annotation events. However I like the chaining idea
> + // more (because one could add any number of other annotation listeners after this generator in the chain).
> + annotationsGenerator = new AnnotationGeneratorChainingListener(linkLabelGenerator, selectionAlterer, chain);
> + chain.addListener(annotationsGenerator);
> + // the actual annotations renderer
> + chain.addListener(getAnnotationPrintRenderer(chain));
> + }
> +
> + /**
> + * @param chain the chain in which the renderer needs to be added.
> + * @return the annotation listener to which the annotation events generated by this renderer should be sent (the
> + * actual renderer of annotated content)
> + */
> + public abstract AnnotationChainingPrintRenderer getAnnotationPrintRenderer(ListenerChain chain);
> +
> + /**
> + * {@inheritDoc}
> + *
> + * @see org.xwiki.annotation.renderer.AnnotationPrintRenderer#setAnnotations(java.util.Collection)
> + */
> + public void setAnnotations(Collection<Annotation> annotations)
> + {
> + this.annotationsGenerator.setAnnotations(annotations);
> + }
> +}
>
>
> Property changes on: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/renderer/AbstractAnnotationRenderer.java
> ___________________________________________________________________
> Name: svn:keywords
> + Author Id Revision HeadURL
> Name: svn:eol-style
> + native
>
> Added: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/renderer/AnnotationChainingPrintRenderer.java
> ===================================================================
> --- contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/renderer/AnnotationChainingPrintRenderer.java (rev 0)
> +++ contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/renderer/AnnotationChainingPrintRenderer.java 2009-12-04 15:25:46 UTC (rev 25544)
> @@ -0,0 +1,34 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package org.xwiki.annotation.renderer;
> +
> +import org.xwiki.rendering.listener.chaining.ChainingListener;
> +import org.xwiki.rendering.renderer.PrintRenderer;
> +
> +/**
> + * Define the chaining annotation print renderer. To be implemented by extending a ChainingPrintRenderer and
> + * implementing the functions in the {@link AnnotationListener} interface.
> + *
> + * @version $Id$
> + */
> +public interface AnnotationChainingPrintRenderer extends AnnotationListener, ChainingListener, PrintRenderer
> +{
> +
> +}
>
>
> Property changes on: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/renderer/AnnotationChainingPrintRenderer.java
> ___________________________________________________________________
> Name: svn:keywords
> + Author Id Revision HeadURL
> Name: svn:eol-style
> + native
>
> Added: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/renderer/AnnotationListener.java
> ===================================================================
> --- contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/renderer/AnnotationListener.java (rev 0)
> +++ contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/renderer/AnnotationListener.java 2009-12-04 15:25:46 UTC (rev 25544)
> @@ -0,0 +1,49 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package org.xwiki.annotation.renderer;
> +
> +import org.xwiki.annotation.Annotation;
> +import org.xwiki.rendering.listener.Listener;
> +
> +/**
> + * Extends the standard XWiki events listener by adding a set of events for start and end of an annotation.
> + *
> + * @version $Id$
> + */
> +public interface AnnotationListener extends Listener
> +{
> + /**
> + * Signals the start of an annotation. Note that this event will only be fired once, splitting the annotation
> + * markers in multiple pieces and correctly imbricating them in the rendered syntax (such as multiple spans across
> + * multiple block elements in the XHTML renderer) is the responsibility of the renderer.
> + *
> + * @param annotation the annotation whose selected text starts
> + */
> + void beginAnnotation(Annotation annotation);
> +
> + /**
> + * Signals the end of an annotation. Note that this event will only be fired once, splitting the annotation markers
> + * in multiple pieces and correctly imbricating them in the rendered syntax (such as multiple spans across multiple
> + * block elements in the XHTML renderer) is the responsibility of the renderer.
> + *
> + * @param annotation the annotation whose selected text ends
> + */
> + void endAnnotation(Annotation annotation);
> +}
>
>
> Property changes on: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/renderer/AnnotationListener.java
> ___________________________________________________________________
> Name: svn:keywords
> + Author Id Revision HeadURL
> Name: svn:eol-style
> + native
>
> Added: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/renderer/AnnotationPrintRenderer.java
> ===================================================================
> --- contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/renderer/AnnotationPrintRenderer.java (rev 0)
> +++ contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/renderer/AnnotationPrintRenderer.java 2009-12-04 15:25:46 UTC (rev 25544)
> @@ -0,0 +1,42 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package org.xwiki.annotation.renderer;
> +
> +import java.util.Collection;
> +
> +import org.xwiki.annotation.Annotation;
> +import org.xwiki.component.annotation.ComponentRole;
> +import org.xwiki.rendering.renderer.PrintRenderer;
> +
> +/**
> + * An annotations print renderer is a {@link PrintRenderer} that also renders annotations on the content.
> + *
> + * @version $Id$
> + */
> +@ComponentRole
> +public interface AnnotationPrintRenderer extends PrintRenderer
> +{
> + /**
> + * Sets the annotations to render on the content.
> + *
> + * @param annotations the collection of annotations to render
> + */
> + void setAnnotations(Collection<Annotation> annotations);
> +}
>
>
> Property changes on: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/java/org/xwiki/annotation/renderer/AnnotationPrintRenderer.java
> ___________________________________________________________________
> Name: svn:keywords
> + Author Id Revision HeadURL
> Name: svn:eol-style
> + native
>
> Modified: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/resources/META-INF/components.txt
> ===================================================================
> --- contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/resources/META-INF/components.txt 2009-12-04 15:18:58 UTC (rev 25543)
> +++ contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/main/resources/META-INF/components.txt 2009-12-04 15:25:46 UTC (rev 25544)
> @@ -1,5 +1,8 @@
> org.xwiki.annotation.internal.DefaultAnnotationService
> org.xwiki.annotation.internal.content.XWiki20SyntaxContentAlterer
> +org.xwiki.annotation.internal.content.WhiteSpaceContentAlterer
> org.xwiki.annotation.internal.content.filter.XWiki20SyntaxFilter
> +org.xwiki.annotation.internal.content.filter.WhiteSpaceFilter
> org.xwiki.annotation.internal.target.DefaultDocumentContentTarget
> -org.xwiki.annotation.internal.selection.DefaultSelectionService
> \ No newline at end of file
> +org.xwiki.annotation.internal.selection.DefaultSelectionService
> +org.xwiki.annotation.internal.renderer.XHTMLAnnotationRenderer
> \ No newline at end of file
>
> Added: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/test/java/org/xwiki/annotation/content/WhiteSpaceContentAltererTest.java
> ===================================================================
> --- contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/test/java/org/xwiki/annotation/content/WhiteSpaceContentAltererTest.java (rev 0)
> +++ contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/test/java/org/xwiki/annotation/content/WhiteSpaceContentAltererTest.java 2009-12-04 15:25:46 UTC (rev 25544)
> @@ -0,0 +1,105 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package org.xwiki.annotation.content;
> +
> +import static org.junit.Assert.assertEquals;
> +
> +import java.util.ArrayList;
> +import java.util.Collection;
> +
> +import org.junit.Test;
> +import org.junit.runner.RunWith;
> +import org.junit.runners.Parameterized;
> +import org.junit.runners.Parameterized.Parameters;
> +import org.xwiki.test.AbstractComponentTestCase;
> +
> +/**
> + * @version $Id$
> + */
> +(a)RunWith(Parameterized.class)
> +public class WhiteSpaceContentAltererTest extends AbstractComponentTestCase
> +{
> + /**
> + * The initial String to alter.
> + */
> + private String initial;
> +
> + /**
> + * The expected altered string.
> + */
> + private String altered;
> +
> + /**
> + * The content alterer to test.
> + */
> + private ContentAlterer alterer;
> +
> + /**
> + * @param initial the original string
> + * @param altered the altered string after being whitespace filtered
> + */
> + public WhiteSpaceContentAltererTest(String initial, String altered)
> + {
> + this.initial = initial;
> + this.altered = altered;
> + }
> +
> + /**
> + * {@inheritDoc}
> + *
> + * @see org.xwiki.test.AbstractComponentTestCase#setUp()
> + */
> + @Override
> + public void setUp() throws Exception
> + {
> + super.setUp();
> + alterer = getComponentManager().lookup(ContentAlterer.class, "whitespace");
> + }
> +
> + /**
> + * @return list of corpus files to instantiate tests for
> + */
> + @Parameters
> + public static Collection<String[]> data()
> + {
> + Collection<String[]> params = new ArrayList<String[]>();
> + // unbreakable space
> + params.add(new String[] {"not to be", "nottobe"});
> + // tabs
> + params.add(new String[] {"to be or not\tto be", "tobeornottobe"});
> + // commas, signs with regular spaces
> + params.add(new String[] {"roses, see I in her cheeks;", "roses,seeIinhercheeks;"});
> + // new lines
> + params.add(new String[] {"eyes nothing\nlike the sun", "eyesnothinglikethesun"});
> + // new line carriage return
> + params.add(new String[] {"eyes\n\rnothing", "eyesnothing"});
> + return params;
> + }
> +
> + /**
> + * Tests that the content alterer filters correctly the characters out of the Strings.
> + */
> + @Test
> + public void testFiltering()
> + {
> + AlteredContent alteredContent = alterer.alter(initial);
> + assertEquals(altered, alteredContent.getContent().toString());
> + }
> +}
>
>
> Property changes on: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/test/java/org/xwiki/annotation/content/WhiteSpaceContentAltererTest.java
> ___________________________________________________________________
> Name: svn:keywords
> + Author Id Revision HeadURL
> Name: svn:eol-style
> + native
>
> Added: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/test/java/org/xwiki/annotation/renderer/XHTMLAnnotationRendererTest.java
> ===================================================================
> --- contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/test/java/org/xwiki/annotation/renderer/XHTMLAnnotationRendererTest.java (rev 0)
> +++ contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/test/java/org/xwiki/annotation/renderer/XHTMLAnnotationRendererTest.java 2009-12-04 15:25:46 UTC (rev 25544)
> @@ -0,0 +1,166 @@
> +/*
> + * See the NOTICE file distributed with this work for additional
> + * information regarding copyright ownership.
> + *
> + * This is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU Lesser General Public License as
> + * published by the Free Software Foundation; either version 2.1 of
> + * the License, or (at your option) any later version.
> + *
> + * This software is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this software; if not, write to the Free
> + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> + * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
> + */
> +package org.xwiki.annotation.renderer;
> +
> +import static org.junit.Assert.assertEquals;
> +
> +import java.io.StringReader;
> +import java.util.ArrayList;
> +import java.util.Collection;
> +
> +import org.junit.Test;
> +import org.junit.runner.RunWith;
> +import org.junit.runners.Parameterized;
> +import org.junit.runners.Parameterized.Parameters;
> +import org.xwiki.annotation.TestDocumentFactory;
> +import org.xwiki.rendering.block.XDOM;
> +import org.xwiki.rendering.parser.Parser;
> +import org.xwiki.rendering.renderer.printer.DefaultWikiPrinter;
> +import org.xwiki.rendering.renderer.printer.WikiPrinter;
> +import org.xwiki.rendering.syntax.Syntax;
> +import org.xwiki.rendering.transformation.TransformationManager;
> +import org.xwiki.test.AbstractComponentTestCase;
> +
> +/**
> + * Renderer tests for the XHTML annotations renderer, from the test files.
> + *
> + * @version $Id$
> + */
> +(a)RunWith(Parameterized.class)
> +public class XHTMLAnnotationRendererTest extends AbstractComponentTestCase
> +{
> + /**
> + * Document description files to run this test for.
> + */
> + private static Collection<String[]> files = new ArrayList<String[]>();
> +
> + /**
> + * The annotations renderer hint.
> + */
> + private static final String ANNOTATIONS_RENDERER_HINT = "annotations/xhtml/1.0";
> +
> + /**
> + * Mock document to run tests for.
> + */
> + protected String docName;
> +
> + static {
> + // FIXME: checkstyle is so gonna shout when this will be longer than 30 files
> + addFileToTest("Document1");
> + addFileToTest("Document2");
> + addFileToTest("Document3");
> + addFileToTest("Document4");
> + addFileToTest("Document5");
> + addFileToTest("Document6");
> + addFileToTest("Document7");
> + addFileToTest("Document8");
> + addFileToTest("Document9");
> + addFileToTest("Document10");
> + addFileToTest("Document11");
> + addFileToTest("Document12");
> + addFileToTest("Document13");
> + addFileToTest("Document14");
> + addFileToTest("Document15");
> + addFileToTest("Document16");
> + addFileToTest("Document17");
> + addFileToTest("Document18");
> + }
> +
> + /**
> + * Creates a test for the passed document. Will be instantiated by the parameterized runner for all the parameters.
> + *
> + * @param docName the document (and corpus filename) to run tests for
> + */
> + public XHTMLAnnotationRendererTest(String docName)
> + {
> + this.docName = docName;
> + }
> +
> + /**
> + * Adds a file to the list of files to run tests for.
> + *
> + * @param docName the name of the document / file to test
> + */
> + private static void addFileToTest(String docName)
> + {
> + files.add(new String[] {docName});
> + }
> +
> + /**
> + * @return list of corpus files to instantiate tests for
> + */
> + @Parameters
> + public static Collection<String[]> data()
> + {
> + return files;
> + }
> +
> + /**
> + * Test rendering the annotations in the document description file results in the annotated html.
> + *
> + * @throws Exception in case something goes wrong looking up components and rendering
> + */
> + @Test
> + public void getAnnotatedHTML() throws Exception
> + {
> + Parser parser = getComponentManager().lookup(Parser.class, Syntax.XWIKI_2_0.toIdString());
> + XDOM xdom = parser.parse(new StringReader(TestDocumentFactory.getDocument(docName).getSource()));
> +
> + // run transformations
> + TransformationManager transformationManager = getComponentManager().lookup(TransformationManager.class);
> + transformationManager.performTransformations(xdom, Syntax.XWIKI_2_0);
> +
> + AnnotationPrintRenderer renderer =
> + getComponentManager().lookup(AnnotationPrintRenderer.class, ANNOTATIONS_RENDERER_HINT);
> + WikiPrinter printer = new DefaultWikiPrinter();
> + renderer.setPrinter(printer);
> + // set the annotations for this renderer
> + renderer.setAnnotations(TestDocumentFactory.getDocument(docName).getSafeAnnotations());
> +
> + xdom.traverse(renderer);
> +
> + assertEquals(TestDocumentFactory.getDocument(docName).getAnnotatedContent(), printer.toString());
> + }
> +
> + /**
> + * Test rendering with the annotations renderer but without annotations doesn't alter the content.
> + *
> + * @throws Exception in case something goes wrong looking up components and rendering
> + */
> + @Test
> + public void getAnnotatedHTMLWithoutAnnotations() throws Exception
> + {
> + Parser parser = getComponentManager().lookup(Parser.class, Syntax.XWIKI_2_0.toIdString());
> + XDOM xdom = parser.parse(new StringReader(TestDocumentFactory.getDocument(docName).getSource()));
> +
> + // run transformations
> + TransformationManager transformationManager = getComponentManager().lookup(TransformationManager.class);
> + transformationManager.performTransformations(xdom, Syntax.XWIKI_2_0);
> +
> + AnnotationPrintRenderer renderer =
> + getComponentManager().lookup(AnnotationPrintRenderer.class, ANNOTATIONS_RENDERER_HINT);
> + WikiPrinter printer = new DefaultWikiPrinter();
> + renderer.setPrinter(printer);
> +
> + xdom.traverse(renderer);
> +
> + assertEquals(TestDocumentFactory.getDocument(docName).getRenderedContent(), printer.toString());
> + }
> +}
>
>
> Property changes on: contrib/sandbox/xwiki-annotation-parent/xwiki-annotation-core/src/test/java/org/xwiki/annotation/renderer/XHTMLAnnotationRendererTest.java
> ___________________________________________________________________
> Name: svn:keywords
> + Author Id Revision HeadURL
> Name: svn:eol-style
> + native
>
> _______________________________________________
> notifications mailing list
> notifications(a)xwiki.org
> http://lists.xwiki.org/mailman/listinfo/notifications
>
--
Thomas Mortagne
Too bad it must be done by hand, I didn't know that, thanks for the addition.
We should create the files+mapping for all the languages available in XE.
Is there really no way to have prop files discovered automatically ?
JV.
On Thu, Dec 3, 2009 at 4:12 PM, mflorea
<platform-notifications(a)xwiki.org> wrote:
> Author: mflorea
> Date: 2009-12-03 16:12:38 +0100 (Thu, 03 Dec 2009)
> New Revision: 25433
>
> Modified:
> platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/server/plugin/macro/XWikiMacroService.java
> platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/Wysiwyg.gwt.xml
> Log:
> XWIKI-4612: Wiki Macro parameter display in wysiwyg do not respect the order of parameters
> Also enabled the German language.
>
>
> Modified: platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/server/plugin/macro/XWikiMacroService.java
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/server/plugin/macro/XWikiMacroService.java 2009-12-03 15:12:09 UTC (rev 25432)
> +++ platform/web/trunk/wysiwyg/src/main/java/com/xpn/xwiki/wysiwyg/server/plugin/macro/XWikiMacroService.java 2009-12-03 15:12:38 UTC (rev 25433)
> @@ -23,7 +23,7 @@
> import java.util.Arrays;
> import java.util.Collections;
> import java.util.Comparator;
> -import java.util.HashMap;
> +import java.util.LinkedHashMap;
> import java.util.List;
> import java.util.Map;
>
> @@ -95,7 +95,8 @@
> contentDescriptor.setMandatory(descriptor.getContentDescriptor().isMandatory());
> }
>
> - Map<String, ParameterDescriptor> parameterDescriptorMap = new HashMap<String, ParameterDescriptor>();
> + // We use a linked hash map to preserve the order of the macro parameters.
> + Map<String, ParameterDescriptor> parameterDescriptorMap = new LinkedHashMap<String, ParameterDescriptor>();
> for (Map.Entry<String, org.xwiki.rendering.macro.descriptor.ParameterDescriptor> entry : descriptor
> .getParameterDescriptorMap().entrySet()) {
> parameterDescriptorMap.put(entry.getKey(), createMacroParameterDescriptor(entry.getValue()));
>
> Modified: platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/Wysiwyg.gwt.xml
> ===================================================================
> --- platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/Wysiwyg.gwt.xml 2009-12-03 15:12:09 UTC (rev 25432)
> +++ platform/web/trunk/wysiwyg/src/main/resources/com/xpn/xwiki/wysiwyg/Wysiwyg.gwt.xml 2009-12-03 15:12:38 UTC (rev 25433)
> @@ -28,7 +28,7 @@
> <stylesheet src="stylesheets/Wysiwyg.css"/>
> <entry-point class="com.xpn.xwiki.wysiwyg.client.Wysiwyg"/>
>
> - <extend-property name="locale" values="fr"/>
> + <extend-property name="locale" values="fr,de"/>
>
> <!-- BackColorExecutable -->
> <replace-with class="com.xpn.xwiki.wysiwyg.client.plugin.color.exec.BackColorExecutable">
>
> _______________________________________________
> notifications mailing list
> notifications(a)xwiki.org
> http://lists.xwiki.org/mailman/listinfo/notifications
>
On 12/02/2009 06:03 PM, vmassol (SVN) wrote:
> Author: vmassol
> Date: 2009-12-02 18:03:27 +0100 (Wed, 02 Dec 2009)
> New Revision: 25408
>
> Added:
This is not the right location.
> platform/skins/trunk/xwiki-skin-dodo/
> Removed:
> platform/skins/trunk/dodo/
> Log:
> Move Dodo and Finch skin to the contrib/retired location. Could be resurrected later on if someone is interested in doing so.
>
> Copied: platform/skins/trunk/xwiki-skin-dodo (from rev 25407, platform/skins/trunk/dodo)
--
Sergiu Dumitriu
http://purl.org/net/sergiu/