15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/src/test/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | log4j.rootCategory=INFO, A1
2 |
3 | # A1 is set to be a ConsoleAppender.
4 | log4j.appender.A1=org.apache.log4j.ConsoleAppender
5 |
6 | # A1 uses PatternLayout.
7 | log4j.appender.A1.layout=org.apache.log4j.PatternLayout
8 | log4j.appender.A1.layout.ConversionPattern=[%p] %c{1} %m%n
9 |
10 | # Service category names are the name of the defining module class
11 | # and then the service id.
12 | log4j.category.exanpe.t5.lib.demo.services.AppModule.TimingFilter=error
13 |
14 | # Exanpe modules
15 | log4j.category.fr.exanpe.t5.lib=DEBUG
16 |
--------------------------------------------------------------------------------
/src/test/resources/exanpe/t5/lib/demo/components/Layout.tml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Exanpe T5 Library Test App: ${title}
4 |
5 |
6 |
7 |
8 |
${title}
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | Back to index
17 |
18 |
19 | Reset page
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright 2011 EXANPE
2 |
3 | Licensed under the Apache License, Version 2.0 (the "License");
4 | you may not use this file except in compliance with the License.
5 | You may obtain a copy of the License at
6 |
7 | http://www.apache.org/licenses/LICENSE-2.0
8 |
9 | Unless required by applicable law or agreed to in writing, software
10 | distributed under the License is distributed on an "AS IS" BASIS,
11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | See the License for the specific language governing permissions and
13 | limitations under the License.
--------------------------------------------------------------------------------
/src/main/resources/fr/exanpe/t5/lib/components/GMap.tml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
19 |
20 |
--------------------------------------------------------------------------------
/src/main/resources/fr/exanpe/t5/lib/mixins/RichTextEditor.properties:
--------------------------------------------------------------------------------
1 | exanpe-rte-toolbar-buttons=bold,italic,underline,justifyleft,justifycenter,justifyright,createlink,insertimage,undo,redo,insertunorderedlist,insertorderedlist,heading,none,h1,h2,h3,h4,h5,h6,forecolor,backcolor
2 | bold=Bold
3 | italic=Italic
4 | underline=Underline
5 | justifyleft=Align Left
6 | justifycenter=Align Center
7 | justifyright=Align Right
8 | createlink=HTML Link
9 | insertimage=Insert Image
10 | undo=Undo
11 | redo=Redo
12 | insertunorderedlist=Create an Unordered List
13 | insertorderedlist=Create an Ordered List
14 | heading=Paragraph
15 | none=Normal
16 | h1=Header 1
17 | h2=Header 2
18 | h3=Header 3
19 | h4=Header 4
20 | h5=Header 5
21 | h6=Header 6
22 | forecolor=Font Color
23 | backcolor=Background Color
--------------------------------------------------------------------------------
/src/test/resources/exanpe/t5/lib/demo/pages/comp/AuthorizeAnnotationTest.tml:
--------------------------------------------------------------------------------
1 |
3 |
4 | Switch to ROLE_USER only
5 |
6 | Switch to ROLE_ADMIN only
7 |
8 | Click this link to trigger a server action according to your role
9 | Last triggered : ${roleInvoked }
10 |
11 |
12 | This page can only be accessed by admin
13 |
14 |
15 | This page can only be accessed by user
16 |
17 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/components/TooltipWrapper.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.components;
18 |
19 | public class TooltipWrapper
20 | {
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/AccordionTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.pages.comp;
18 |
19 |
20 | public class AccordionTest {
21 |
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/ResizableTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.pages.comp;
18 |
19 |
20 | public class ResizableTest
21 | {
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/constants/MenuEventTypeEnum.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package fr.exanpe.t5.lib.constants;
18 |
19 | public enum MenuEventTypeEnum{
20 | CLICK,
21 | HOVER;
22 | }
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/MenuTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.pages.comp;
18 |
19 | public class MenuTest
20 | {
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/constants/AccordionEventTypeEnum.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package fr.exanpe.t5.lib.constants;
18 |
19 | public enum AccordionEventTypeEnum{
20 | CLICK,
21 | HOVER;
22 | }
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/bug/AccordionBugTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.pages.bug;
18 |
19 | public class AccordionBugTest
20 | {
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/src/test/resources/exanpe/t5/lib/demo/pages/comp/SecurePasswordTest.tml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 | Secure Password on click, value persisting :
7 |
8 |
9 |
15 |
16 | Secure Password with other icon :
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/constants/SecurePasswordEventTypeEnum.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package fr.exanpe.t5.lib.constants;
18 |
19 | public enum SecurePasswordEventTypeEnum{
20 | CLICK,
21 | HOVER;
22 | }
--------------------------------------------------------------------------------
/src/site/xdoc/roadmap.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 | Roadmap - Exanpe T5 Lib
8 | Exanpe
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | The library is designed to help the use of Tapestry 5 as much as possible.
17 | Feel free to suggest any idea, improvement, or to report any problem in our GitHub space!
18 |
10 |
11 |
12 | This is the second menu item
13 | with long content
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/src/main/resources/fr/exanpe/t5/lib/components/AjaxLoader.tml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/TabViewTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.pages.comp;
18 |
19 |
20 | public class TabViewTest {
21 |
22 | public void onAction(){
23 |
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/resources/fr/exanpe/t5/lib/components/HideablePanel.tml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
16 | Exanpe is a French team eager to discover new frameworks and technologies related to Java EE.
17 | We are trying to help people, speed up and ease their development during our spare time.
18 |
19 |
20 | Feel free to report any mistake we could have made, we enjoy learning too ;).
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/test/resources/exanpe/t5/lib/demo/pages/comp/ContextPageResetTest.tml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 | Enter a value :
6 |
7 |
8 |
9 | Result :
10 | ${value}
11 |
5 | Tooltip on div element, content from block...
6 |
7 |
8 |
9 |
10 | Tooltip on p element, content from message...
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | The content of my Tooltip is rich...
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/main/resources/fr/exanpe/t5/lib/components/Border.tml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/security/AdminOnly.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.pages.security;
18 |
19 | import fr.exanpe.t5.lib.annotation.Authorize;
20 |
21 | @Authorize(all = "ROLE_ADMIN")
22 | public class AdminOnly
23 | {
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/security/UserOnly.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.pages.security;
18 |
19 | import fr.exanpe.t5.lib.annotation.Authorize;
20 |
21 | @Authorize(all = "ROLE_USER")
22 | public class UserOnly
23 | {
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/GMapTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.pages.comp;
18 |
19 | import fr.exanpe.t5.lib.components.GMap;
20 |
21 | /**
22 | * The demo page for {@link GMap} component
23 | *
24 | * @author lguerin
25 | */
26 | public class GMapTest
27 | {
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/resources/fr/exanpe/t5/lib/components/Slider.tml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 | 0
10 |
11 |
12 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/TooltipTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.pages.comp;
18 |
19 | import fr.exanpe.t5.lib.components.Tooltip;
20 |
21 | /**
22 | * The demo page for {@link Tooltip} component
23 | *
24 | * @author lguerin
25 | */
26 | public class TooltipTest
27 | {
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/main/resources/fr/exanpe/t5/lib/components/VerticalMenu.tml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
26 |
27 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/components/SubMenu.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package fr.exanpe.t5.lib.components;
18 |
19 | /**
20 | * Component allowing to group some {@link MenuItem} into a sub menu level.
21 | *
22 | * @see MenuItem
23 | * @author jmaupoux
24 | */
25 | public class SubMenu
26 | {
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/model/gmap/GMapPolyPointModel.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package fr.exanpe.t5.lib.model.gmap;
18 |
19 | /**
20 | * Model class for Google Map Polyline Point.
21 | *
22 | * @author lguerin
23 | * @since 1.2
24 | */
25 | public class GMapPolyPointModel extends GMapBaseModel
26 | {
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/BorderTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | /**
18 | *
19 | */
20 | package exanpe.t5.lib.demo.pages.comp;
21 |
22 | import fr.exanpe.t5.lib.components.Border;
23 |
24 | /**
25 | * The demo page for the {@link Border} component.
26 | *
27 | * @author jmaupoux
28 | */
29 | public class BorderTest{
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/SlideShowTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | /**
18 | *
19 | */
20 | package exanpe.t5.lib.demo.pages.comp;
21 |
22 | import fr.exanpe.t5.lib.components.HideablePanel;
23 |
24 | /**
25 | * The demo page for the {@link HideablePanel} component.
26 | *
27 | * @author jmaupoux
28 | */
29 | public class SlideShowTest{
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/HideablePanelTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | /**
18 | *
19 | */
20 | package exanpe.t5.lib.demo.pages.comp;
21 |
22 | import fr.exanpe.t5.lib.components.HideablePanel;
23 |
24 | /**
25 | * The demo page for the {@link HideablePanel} component.
26 | *
27 | * @author jmaupoux
28 | */
29 | public class HideablePanelTest{
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/test/resources/exanpe/t5/lib/demo/pages/comp/ResizableTest.tml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
11 |
12 |
23 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/test/resources/applicationContext-security.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/constants/SliderOrientationTypeEnum.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | /**
18 | *
19 | */
20 | package fr.exanpe.t5.lib.constants;
21 |
22 | import fr.exanpe.t5.lib.components.Slider;
23 |
24 | /**
25 | * The {@link Slider} component orientation.
26 | *
27 | * @author lguerin
28 | */
29 | public enum SliderOrientationTypeEnum
30 | {
31 | HORIZONTAL, VERTICAL;
32 |
33 | public String toString()
34 | {
35 | return super.toString().toLowerCase();
36 | };
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/constants/DialogRenderModeEnum.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | /**
18 | *
19 | */
20 | package fr.exanpe.t5.lib.constants;
21 |
22 | /**
23 | * Dialog render mode :
24 | * - CONFIRM : Confirm box with Yes/No buttons
25 | * - INFO : Info box: stop the current event
26 | *
27 | * @author lguerin
28 | */
29 | public enum DialogRenderModeEnum
30 | {
31 | CONFIRM, INFO;
32 |
33 | public String toString()
34 | {
35 | return super.toString().toLowerCase();
36 | };
37 | }
38 |
--------------------------------------------------------------------------------
/src/test/resources/exanpe/t5/lib/demo/pages/comp/PasswordStrengthCheckerTest.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 EXANPE
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | function dummyChecker(password) {
18 | var strength = "";
19 | if (password.length == 1)
20 | {
21 | strength = "veryweak";
22 | }
23 | if (password.length == 2)
24 | {
25 | strength = "weak";
26 | }
27 | if (password.length == 3)
28 | {
29 | strength = "strong";
30 | }
31 | if (password.length > 3)
32 | {
33 | strength = "strongest";
34 | }
35 | return strength;
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/resources/fr/exanpe/t5/lib/components/SecurePassword.tml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | ${caseValue}
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/src/test/resources/exanpe/t5/lib/demo/pages/comp/TabViewTest.tml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 | This is my tab 1 1 1
7 | content 11
8 |
9 |
10 | This is my tab 2 2 2
11 | content22
12 |
13 |
14 | This is my tab 3 2 2
15 | content23
16 |
17 |
18 |
19 |
20 |
21 |
22 | This is my tab 1 1 1
23 | content 11
24 |
25 |
26 | This is my tab 2 2 2
this
20 |
21 |
22 | show
23 |
24 |
25 |
26 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/constants/PasswordStrengthCheckerTypeEnum.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package fr.exanpe.t5.lib.constants;
18 |
19 | /**
20 | * Password complexity type :
21 | *
22 | *
VERYWEAK : Dummy password
23 | *
WEAK : Does not meet the minimum requirements.
24 | *
STRONG : Meets minimum requirements.
25 | *
STRONGEST : Check all complexity requirements.
26 | *
27 | *
28 | * @author lguerin
29 | */
30 | public enum PasswordStrengthCheckerTypeEnum
31 | {
32 | VERYWEAK, WEAK, STRONG, STRONGEST;
33 |
34 | public String toString()
35 | {
36 | return super.toString().toLowerCase();
37 | };
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/mixins/AuthorizeMixin.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package fr.exanpe.t5.lib.mixins;
18 |
19 | import org.apache.tapestry5.annotations.Mixin;
20 |
21 | import fr.exanpe.t5.lib.base.BaseAuthorize;
22 | import fr.exanpe.t5.lib.components.Authorize;
23 |
24 | /**
25 | * A mixin used to get control of a component according the roles of a user.
26 | * Depending on role, the component this mixin is applied on will, or won't be processed.
27 | * {@link Mixin} version of the {@link Authorize} component.
28 | *
29 | * @see BaseAuthorize
30 | * @see Authorize
31 | * @since 1.2
32 | * @author jmaupoux
33 | */
34 | public class AuthorizeMixin extends BaseAuthorize
35 | {
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/bean/City.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.bean;
18 |
19 | public class City
20 | {
21 | private String id;
22 | private String name;
23 |
24 | public City(String id, String name)
25 | {
26 | super();
27 | this.id = id;
28 | this.name = name;
29 | }
30 |
31 | public String getId()
32 | {
33 | return id;
34 | }
35 |
36 | public void setId(String id)
37 | {
38 | this.id = id;
39 | }
40 |
41 | public String getName()
42 | {
43 | return name;
44 | }
45 |
46 | public void setName(String name)
47 | {
48 | this.name = name;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/resources/fr/exanpe/t5/lib/components/TabView.tml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
39 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/constants/AjaxValidationResult.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package fr.exanpe.t5.lib.constants;
18 |
19 | import fr.exanpe.t5.lib.mixins.AjaxValidation;
20 |
21 | /**
22 | * Possible ajax validation result. Required as event methods cannot return Boolean values.
23 | *
24 | *
true
25 | *
false
26 | *
27 | *
28 | * @see AjaxValidation
29 | * @see ExanpeEventConstants#AJAXVALIDATION_EVENT
30 | * @author jmaupoux
31 | */
32 | public enum AjaxValidationResult
33 | {
34 | TRUE(Boolean.TRUE), FALSE(Boolean.FALSE);
35 |
36 | private Boolean bool;
37 |
38 | private AjaxValidationResult(Boolean bool)
39 | {
40 | this.bool = bool;
41 | }
42 |
43 | public Boolean toBoolean()
44 | {
45 | return bool;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/ColorPickerTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.pages.comp;
18 |
19 | import java.awt.Color;
20 |
21 | import org.apache.tapestry5.annotations.Persist;
22 | import org.apache.tapestry5.annotations.Property;
23 |
24 | import fr.exanpe.t5.lib.components.Tooltip;
25 |
26 | /**
27 | * The demo page for {@link Tooltip} component
28 | *
29 | * @author lguerin
30 | */
31 | public class ColorPickerTest
32 | {
33 | @Property
34 | @Persist
35 | private Color color;
36 |
37 | @Property
38 | @Persist
39 | private Color color2;
40 |
41 | public void onSubmit()
42 | {
43 | if (color != null)
44 | System.out.println("submit//" + Integer.toHexString(color.getRGB()));
45 | else
46 | System.out.println("submit null");
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/LocaleSessionTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.pages.comp;
18 |
19 | import java.util.Locale;
20 |
21 | import org.apache.tapestry5.ioc.Messages;
22 | import org.apache.tapestry5.ioc.annotations.Inject;
23 |
24 | import fr.exanpe.t5.lib.services.LocaleSessionService;
25 |
26 | public class LocaleSessionTest
27 | {
28 | @Inject
29 | private LocaleSessionService localeSessionService;
30 |
31 | @Inject
32 | private Messages msg;
33 |
34 | void onActionFromFr()
35 | {
36 | localeSessionService.setLocale(Locale.FRANCE);
37 | System.out.println(msg.get("test"));
38 | }
39 |
40 | void onActionFromEn()
41 | {
42 | localeSessionService.setLocale("en");
43 | System.out.println(msg.get("test"));
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/Index.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.pages;
18 |
19 | import org.apache.tapestry5.Link;
20 | import org.apache.tapestry5.annotations.OnEvent;
21 | import org.apache.tapestry5.ioc.annotations.Inject;
22 | import org.apache.tapestry5.services.PageRenderLinkSource;
23 |
24 | import exanpe.t5.lib.demo.pages.comp.PasswordStrengthCheckerTest;
25 |
26 | /**
27 | * Default index page for all the tests.
28 | *
29 | * @author lguerin
30 | */
31 | public class Index
32 | {
33 | @Inject
34 | private PageRenderLinkSource pageRender;
35 |
36 | @OnEvent(value = "passwordStrengthCheckerTest")
37 | Object goToPasswordStrengthCheckerTestPage()
38 | {
39 | Link link = pageRender.createPageRenderLink(PasswordStrengthCheckerTest.class);
40 | link.addParameter("param1", "test");
41 | return link;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/DialogTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.pages.comp;
18 |
19 | import org.apache.tapestry5.PersistenceConstants;
20 | import org.apache.tapestry5.annotations.Persist;
21 | import org.apache.tapestry5.annotations.Property;
22 |
23 | import fr.exanpe.t5.lib.mixins.Dialog;
24 |
25 | /**
26 | * The demo page for {@link Dialog} mixin
27 | *
28 | * @author lguerin
29 | */
30 | public class DialogTest
31 | {
32 | @Persist(PersistenceConstants.FLASH)
33 | @Property
34 | private String field1;
35 |
36 | public String getDisableClass()
37 | {
38 | return Dialog.DISABLE_CLASS;
39 | }
40 |
41 | void onAction()
42 | {
43 | System.out.println("Dialog validation ok");
44 | }
45 |
46 | void onSubmit()
47 | {
48 | System.out.println(">>> Thanks " + field1);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/model/AccordionInternalModel.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package fr.exanpe.t5.lib.model;
18 |
19 | import java.util.LinkedList;
20 | import java.util.List;
21 |
22 | import fr.exanpe.t5.lib.components.Accordion;
23 | import fr.exanpe.t5.lib.components.AccordionItem;
24 |
25 | /**
26 | * Internal model to allow the accordion items to register to the main accordion component
27 | *
28 | * @see Accordion
29 | * @see AccordionItem
30 | * @author jmaupoux
31 | */
32 | public class AccordionInternalModel
33 | {
34 | private List itemsId;
35 |
36 | public AccordionInternalModel()
37 | {
38 | itemsId = new LinkedList();
39 | }
40 |
41 | public List getItemsId()
42 | {
43 | return itemsId;
44 | }
45 |
46 | public void setItemsId(List itemsId)
47 | {
48 | this.itemsId = itemsId;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/SecurePasswordTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | /**
18 | *
19 | */
20 | package exanpe.t5.lib.demo.pages.comp;
21 |
22 | import org.apache.tapestry5.EventConstants;
23 | import org.apache.tapestry5.annotations.OnEvent;
24 | import org.apache.tapestry5.annotations.Persist;
25 | import org.apache.tapestry5.annotations.Property;
26 |
27 | import fr.exanpe.t5.lib.components.HideablePanel;
28 |
29 | /**
30 | * The demo page for the {@link HideablePanel} component.
31 | *
32 | * @author jmaupoux
33 | */
34 | public class SecurePasswordTest{
35 |
36 | @Property
37 | @Persist
38 | private String spwd;
39 |
40 | @Property
41 | private String spwd2;
42 |
43 | @Property
44 | private String spwd3;
45 |
46 | @OnEvent(value = EventConstants.SUBMIT)
47 | public void display(){
48 | System.out.println("1::"+spwd);
49 | System.out.println("2::"+spwd2);
50 | System.out.println("3::"+spwd3);
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/src/test/resources/exanpe/t5/lib/demo/pages/comp/RichTextEditorTest.tml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | richContent :
48 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/constants/GMapTypeEnum.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | /**
18 | *
19 | */
20 | package fr.exanpe.t5.lib.constants;
21 |
22 | /**
23 | * Types of maps you can display using the Google Maps Javascript API.
24 | *
25 | * @author lguerin
26 | * @since 1.2
27 | */
28 | public enum GMapTypeEnum
29 | {
30 | /**
31 | * Displays the normal, default 2D tiles of Google Maps
32 | */
33 | ROADMAP,
34 | /**
35 | * Displays photographic tiles
36 | */
37 | SATELLITE,
38 | /**
39 | * Displays a mix of photographic tiles and a tile layer for prominent features (roads, city
40 | * names)
41 | */
42 | HYBRID,
43 | /**
44 | * Displays physical relief tiles for displaying elevation and water features (mountains,
45 | * rivers, etc.)
46 | */
47 | TERRAIN;
48 |
49 | public String toString()
50 | {
51 | return super.toString().toUpperCase();
52 | };
53 | }
54 |
--------------------------------------------------------------------------------
/src/test/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | Exanpe T5 Library Test App
7 |
8 | tapestry.app-package
9 | exanpe.t5.lib.demo
10 |
11 |
12 |
13 | tapestry.use-external-spring-context
14 | true
15 |
16 |
17 |
18 | contextConfigLocation
19 |
20 | classpath:applicationContext-security.xml
21 |
22 |
23 |
24 |
25 |
26 | springSecurityFilterChain
27 | org.springframework.web.filter.DelegatingFilterProxy
28 |
29 |
30 |
31 | app
32 | org.apache.tapestry5.spring.TapestrySpringFilter
33 |
34 |
35 |
36 | springSecurityFilterChain
37 | /*
38 |
39 |
40 |
41 | app
42 | /*
43 |
44 |
45 |
46 | org.springframework.web.context.ContextLoaderListener
47 |
48 |
49 |
--------------------------------------------------------------------------------
/src/site/site.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exanpe T5 Lib
5 | http://maven.apache.org/images/apache-maven-project.png
6 | http://exanpe.github.com/exanpe-t5-lib/
7 |
8 |
9 | http://maven.apache.org/images/maven-small.gif
10 |
11 |
12 |
13 |
14 |
15 |
16 |
30 |
31 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/encoders/CountryEncoder.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.encoders;
18 |
19 | import org.apache.tapestry5.ValueEncoder;
20 |
21 | import exanpe.t5.lib.demo.bean.Country;
22 | import exanpe.t5.lib.demo.services.DataService;
23 |
24 | /**
25 | * Encoder for {@link Country} objects
26 | *
27 | * @author lguerin
28 | */
29 | public class CountryEncoder implements ValueEncoder
30 | {
31 |
32 | private DataService dataService;
33 |
34 | public CountryEncoder(DataService dataService)
35 | {
36 | this.dataService = dataService;
37 | }
38 |
39 | public String toClient(Country value)
40 | {
41 | return String.valueOf(value.getId());
42 | }
43 |
44 | public Country toValue(String clientValue)
45 | {
46 | if (clientValue != null && !"".equalsIgnoreCase(clientValue)) { return dataService.findCountryById(clientValue); }
47 | return null;
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/test/resources/exanpe/t5/lib/demo/pages/comp/AuthorizeMixinTest.tml:
--------------------------------------------------------------------------------
1 |
3 |
4 | Switch to ROLE_USER only
5 | Switch to ROLE_ADMIN only
6 | Switch to ROLE_NONE
7 |
8 |
18 |
19 |
20 |
21 |
31 |
32 |
33 |
34 |
45 |
46 |
47 |
48 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/components/Layout.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.components;
18 |
19 | import org.apache.tapestry5.BindingConstants;
20 | import org.apache.tapestry5.ComponentResources;
21 | import org.apache.tapestry5.annotations.Parameter;
22 | import org.apache.tapestry5.annotations.Property;
23 | import org.apache.tapestry5.ioc.annotations.Inject;
24 |
25 | /**
26 | * Minimal default Layout for Exanpe library demo pages.
27 | *
28 | * @author lguerin
29 | */
30 | public class Layout
31 | {
32 | @Inject
33 | private ComponentResources resources;
34 |
35 | @SuppressWarnings("unused")
36 | @Property
37 | @Parameter(defaultPrefix = BindingConstants.LITERAL)
38 | private String title;
39 |
40 | String defaulTitle()
41 | {
42 | return resources.getPageName();
43 | }
44 |
45 | /**
46 | * Dscard fields tagged by Persist
47 | */
48 | void onActionFromReset()
49 | {
50 | resources.discardPersistentFieldChanges();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/ListSorterTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | /**
18 | *
19 | */
20 | package exanpe.t5.lib.demo.pages.comp;
21 |
22 | import java.util.ArrayList;
23 | import java.util.List;
24 |
25 | import org.apache.tapestry5.annotations.Persist;
26 | import org.apache.tapestry5.annotations.Property;
27 |
28 | import fr.exanpe.t5.lib.components.ListSorter;
29 |
30 | /**
31 | * The demo page for the {@link ListSorter} component.
32 | *
33 | * @author jmaupoux
34 | */
35 | public class ListSorterTest
36 | {
37 | @Property
38 | @Persist
39 | private List list;
40 |
41 | @Property
42 | private String element;
43 |
44 | void onActivate()
45 | {
46 | if (list == null)
47 | {
48 | list = new ArrayList();
49 | list.add("String1");
50 | list.add("String2");
51 | list.add("String2S");
52 | list.add("String2SF");
53 | list.add("String2FDF");
54 |
55 | }
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/model/gmap/GMapBaseModel.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | /**
18 | *
19 | */
20 | package fr.exanpe.t5.lib.model.gmap;
21 |
22 | /**
23 | * Base classe for GMap models
24 | *
25 | * @author lguerin
26 | * @since 1.2
27 | */
28 | public abstract class GMapBaseModel
29 | {
30 | private String id;
31 | private String latitude;
32 | private String longitude;
33 |
34 | public String getId()
35 | {
36 | return id;
37 | }
38 |
39 | public void setId(String id)
40 | {
41 | this.id = id;
42 | }
43 |
44 | public String getLatitude()
45 | {
46 | return latitude;
47 | }
48 |
49 | public void setLatitude(String latitude)
50 | {
51 | this.latitude = latitude;
52 | }
53 |
54 | public String getLongitude()
55 | {
56 | return longitude;
57 | }
58 |
59 | public void setLongitude(String longitude)
60 | {
61 | this.longitude = longitude;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/test/resources/exanpe/t5/lib/demo/pages/comp/AuthorizeTest.tml:
--------------------------------------------------------------------------------
1 |
3 |
4 | Switch to ROLE_USER only
5 | Switch to ROLE_ADMIN only
6 | Switch to ROLE_NONE
7 |
8 |
16 |
17 |
18 |
19 |
27 |
28 |
29 |
30 |
38 |
39 |
40 |
41 |
49 |
50 |
51 |
52 |
58 |
59 |
60 | This is an external block
61 |
62 |
63 |
--------------------------------------------------------------------------------
/src/test/resources/exanpe/t5/lib/demo/pages/comp/GMapTest.tml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 | Cliquez sur les liens suivants :
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/model/gmap/GMapMarkerModel.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | /**
18 | *
19 | */
20 | package fr.exanpe.t5.lib.model.gmap;
21 |
22 | import org.apache.tapestry5.Asset;
23 |
24 | /**
25 | * Model class for Google Map Marker.
26 | *
27 | * @author lguerin
28 | * @since 1.2
29 | */
30 | public class GMapMarkerModel extends GMapBaseModel
31 | {
32 | private Asset icon;
33 | private String title;
34 | private String info;
35 |
36 | public String getTitle()
37 | {
38 | return title;
39 | }
40 |
41 | public void setTitle(String title)
42 | {
43 | this.title = title;
44 | }
45 |
46 | public Asset getIcon()
47 | {
48 | return icon;
49 | }
50 |
51 | public void setIcon(Asset asset)
52 | {
53 | this.icon = asset;
54 | }
55 |
56 | public String getInfo()
57 | {
58 | return info;
59 | }
60 |
61 | public void setInfo(String info)
62 | {
63 | this.info = info;
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/RichTextEditorTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.pages.comp;
18 |
19 | import org.apache.tapestry5.PersistenceConstants;
20 | import org.apache.tapestry5.annotations.Persist;
21 | import org.apache.tapestry5.annotations.Property;
22 | import org.apache.tapestry5.ioc.Messages;
23 | import org.apache.tapestry5.ioc.annotations.Inject;
24 |
25 | import fr.exanpe.t5.lib.mixins.RichTextEditor;
26 |
27 | /**
28 | * The demo page for {@link RichTextEditor} component
29 | *
30 | * @author lguerin
31 | */
32 | public class RichTextEditorTest
33 | {
34 | @Property
35 | @Persist(PersistenceConstants.FLASH)
36 | private String richContent;
37 |
38 | @Property
39 | @Persist(PersistenceConstants.FLASH)
40 | private String richContent2;
41 |
42 | @Inject
43 | @Property
44 | private Messages messages;
45 |
46 | void onSubmit()
47 | {
48 | System.out.println(">>> Rich content: " + richContent);
49 | System.out.println(">>> Rich content2: " + richContent2);
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/services/AuthorizeBusinessService.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package fr.exanpe.t5.lib.services;
18 |
19 | /**
20 | * This interface defines the services offered to all the library authorization elements
21 | * (component/mixin/worker).
22 | *
23 | * @author jmaupoux
24 | * @since 1.2
25 | */
26 | public interface AuthorizeBusinessService
27 | {
28 | /**
29 | * Apply the "any" rule
30 | *
31 | * @param any the roles to restrict on
32 | * @return true to grant access, false otherwise
33 | */
34 | public boolean applyAny(String[] any);
35 |
36 | /**
37 | * Apply the "all" rule
38 | *
39 | * @param any the roles to restrict on
40 | * @return true to grant access, false otherwise
41 | */
42 | public boolean applyAll(String[] all);
43 |
44 | /**
45 | * Apply the "any" rule
46 | *
47 | * @param any the roles to restrict on
48 | * @return true to grant access, false otherwise
49 | */
50 | public boolean applyNot(String[] not);
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/annotation/ContextPageReset.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package fr.exanpe.t5.lib.annotation;
18 |
19 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
20 |
21 | import java.lang.annotation.Documented;
22 | import java.lang.annotation.ElementType;
23 | import java.lang.annotation.Retention;
24 | import java.lang.annotation.Target;
25 |
26 | import fr.exanpe.t5.lib.constants.ExanpeSymbols;
27 |
28 | /**
29 | * Annotation to mark a method as reseting the page depending on a marker sent in the context.
30 | * If {@link ExanpeSymbols#CONTEXT_PAGE_RESET_MARKER} is found in the request, every method
31 | * containing this annotation, or named "void contextReset()", will be triggered.
32 | * For Tapestry 5.3, a package protected method "void onActivate()" have to be defined in the class.
33 | *
34 | * @author jmaupoux
35 | * @see ExanpeSymbols#CONTEXT_PAGE_RESET_MARKER
36 | * @since 1.2
37 | */
38 | @Target(
39 | { ElementType.METHOD })
40 | @Retention(RUNTIME)
41 | @Documented
42 | public @interface ContextPageReset
43 | {
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/bean/User.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.bean;
18 |
19 | import java.io.Serializable;
20 |
21 | import org.apache.tapestry5.beaneditor.NonVisual;
22 |
23 | public class User implements Serializable
24 | {
25 | @NonVisual
26 | private long id;
27 |
28 | private String firstName;
29 |
30 | private String lastName;
31 |
32 | private int age;
33 |
34 | public long getId()
35 | {
36 | return id;
37 | }
38 |
39 | public void setId(long id)
40 | {
41 | this.id = id;
42 | }
43 |
44 | public String getFirstName()
45 | {
46 | return firstName;
47 | }
48 |
49 | public void setFirstName(String firstName)
50 | {
51 | this.firstName = firstName;
52 | }
53 |
54 | public String getLastName()
55 | {
56 | return lastName;
57 | }
58 |
59 | public void setLastName(String lastName)
60 | {
61 | this.lastName = lastName;
62 | }
63 |
64 | public int getAge()
65 | {
66 | return age;
67 | }
68 |
69 | public void setAge(int age)
70 | {
71 | this.age = age;
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/ContextPageResetTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.pages.comp;
18 |
19 | import org.apache.tapestry5.PersistenceConstants;
20 | import org.apache.tapestry5.annotations.Persist;
21 | import org.apache.tapestry5.annotations.Property;
22 |
23 | import fr.exanpe.t5.lib.annotation.ContextPageReset;
24 |
25 | /**
26 | * The demo page for {@link ContextPageReset} component
27 | *
28 | * @author lguerin
29 | */
30 | public class ContextPageResetTest
31 | {
32 | @Property
33 | @Persist()
34 | private String value;
35 |
36 | @Property
37 | @Persist(PersistenceConstants.FLASH)
38 | private int realContext;
39 |
40 | void onActivate()
41 | {
42 | System.out.println("activate:: seul");
43 | }
44 |
45 | void onActivate(int context)
46 | {
47 | this.realContext = context;
48 | }
49 |
50 | void contextReset()
51 | {
52 | System.out.println("reset plz");
53 | value = null;
54 | }
55 |
56 | @ContextPageReset
57 | void onContextReset()
58 | {
59 | System.out.println("reset annot plz");
60 | value = null;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/test/resources/exanpe/t5/lib/demo/pages/comp/DialogTest.tml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 | link1
7 |
8 |
9 | link2
10 |
11 |
12 | Dialog disable
13 |
14 |
15 | Dialog disable with JS Handler
16 |
17 |
18 | Dialog from properties
19 |
20 |
21 |
22 |
23 |
24 | Thanks : ${field1}
25 |
26 |
27 | This is a RICH dialog !
28 | Nom:
29 |
30 |
31 |
32 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/bean/AjaxFormLoopEngine.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.bean;
18 |
19 | import java.util.ArrayList;
20 | import java.util.List;
21 |
22 | import org.apache.tapestry5.ValueEncoder;
23 |
24 | public abstract class AjaxFormLoopEngine
25 | {
26 | private List list = new ArrayList();
27 |
28 | private T t;
29 |
30 | public List getList()
31 | {
32 | return list;
33 | }
34 |
35 | public void setList(List list)
36 | {
37 | this.list = list;
38 | }
39 |
40 | public T getT()
41 | {
42 | return t;
43 | }
44 |
45 | public void setT(T t)
46 | {
47 | this.t = t;
48 | }
49 |
50 | public abstract ValueEncoder getEncoder();
51 |
52 | public T createNew()
53 | {
54 | T t = instanciate();
55 | list.add(t);
56 | return t;
57 | }
58 |
59 | protected abstract T instanciate();
60 |
61 | public void remove(T t)
62 | {
63 | if (!list.remove(t)) { throw new IllegalArgumentException("Impossible to remove the object " + t.toString()); }
64 | }
65 |
66 | public void clear()
67 | {
68 | list.clear();
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/components/Authorize.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package fr.exanpe.t5.lib.components;
18 |
19 | import org.apache.tapestry5.BindingConstants;
20 | import org.apache.tapestry5.Block;
21 | import org.apache.tapestry5.annotations.Parameter;
22 | import org.apache.tapestry5.annotations.Property;
23 |
24 | import fr.exanpe.t5.lib.base.BaseAuthorize;
25 | import fr.exanpe.t5.lib.mixins.AuthorizeMixin;
26 |
27 | /**
28 | * This component displays its body/block according to authorizations rules declared.
29 | * All rules will be applied if provided. If one fails, the body/block won't be rendered.
30 | * any/all/not must be filled with comma separated roles, as set into your session principal.
31 | * For easier maintenance, we advise you to fill only one of any/all/not parameter.
32 | *
33 | * @since 1.2
34 | * @see BaseAuthorize
35 | * @see AuthorizeMixin
36 | * @author jmaupoux
37 | */
38 | public class Authorize extends BaseAuthorize
39 | {
40 | /**
41 | * Block to render authorization. If not provided, the body of the component is rendered.
42 | */
43 | @SuppressWarnings("unused")
44 | @Property
45 | @Parameter(defaultPrefix = BindingConstants.PROP)
46 | private Block block;
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/VerticalMenuTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.pages.comp;
18 |
19 | import java.net.MalformedURLException;
20 | import java.net.URL;
21 |
22 | import org.apache.tapestry5.annotations.OnEvent;
23 | import org.apache.tapestry5.ioc.annotations.Inject;
24 | import org.slf4j.Logger;
25 |
26 | import fr.exanpe.t5.lib.constants.ExanpeEventConstants;
27 |
28 | public class VerticalMenuTest
29 | {
30 | @Inject
31 | private Logger logger;
32 |
33 | @OnEvent(ExanpeEventConstants.VERTICALMENU_EVENT)
34 | Object handleSelectMenu(String menuId)
35 | {
36 | System.out.println(">> select menu item id: " + menuId);
37 | String targetUrl = "http://www.google.fr";
38 | if ("external".equals(menuId))
39 | {
40 | URL external = null;
41 | try
42 | {
43 | external = new URL(targetUrl);
44 | }
45 | catch (MalformedURLException ex)
46 | {
47 | logger.error(String.format("Incorrect external url: %s", targetUrl));
48 | throw new RuntimeException(ex);
49 | }
50 | return external;
51 | }
52 | return this;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/services/LocaleSessionService.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package fr.exanpe.t5.lib.services;
18 |
19 | import java.util.Locale;
20 |
21 | import fr.exanpe.t5.lib.internal.localesession.LocaleSessionRequestFilter;
22 |
23 | /**
24 | * This interface defines the services offered to manipulate the locale in session (instead of in
25 | * url).
26 | * Note that your Locale have to be defined as a contribution of SymbolConstants#SUPPORTED_LOCALES
27 | *
28 | * @author jmaupoux
29 | * @since 1.2
30 | */
31 | public interface LocaleSessionService
32 | {
33 | /**
34 | * Set a locale in the session from name.
35 | * Automatically restored on request by contributing with {@link LocaleSessionRequestFilter}
36 | *
37 | * @param locale the locale String. null is allowed.
38 | */
39 | public void setLocale(String locale);
40 |
41 | /**
42 | * Set a locale in the session. Uses the toString() value of the Locale class.
43 | *
44 | * @param locale the Locale. null is allowed to reset the locale
45 | */
46 | public void setLocale(Locale locale);
47 |
48 | /**
49 | * Get a locale from the current session
50 | *
51 | * @return the locale String, as set by {@link #setLocale(String)}, or null if none
52 | */
53 | public String getLocale();
54 | }
55 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/exception/AuthorizeException.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package fr.exanpe.t5.lib.exception;
18 |
19 | import fr.exanpe.t5.lib.annotation.Authorize;
20 |
21 | /**
22 | * Exception thrown if an access denied detected by {@link Authorize} annotation occurs.
23 | * User and Page are recorded to allow fine-grained management.
24 | *
25 | * @author jmaupoux
26 | */
27 | public class AuthorizeException extends RuntimeException
28 | {
29 | /**
30 | * serial uid
31 | */
32 | private static final long serialVersionUID = -6093448612924317357L;
33 |
34 | private String page;
35 | private String username;
36 |
37 | public AuthorizeException(String page, String username)
38 | {
39 | super("Illegal access to page " + page + " for user " + username);
40 | this.page = page;
41 | this.username = username;
42 | }
43 |
44 | /**
45 | * The page which access has been denied
46 | *
47 | * @return the page which access has been denied
48 | */
49 | public String getPage()
50 | {
51 | return page;
52 | }
53 |
54 | /**
55 | * The username that initiated the exception
56 | *
57 | * @return the username that initiated the exception
58 | */
59 | public String getUsername()
60 | {
61 | return username;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/services/impl/LocaleSessionServiceImpl.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package fr.exanpe.t5.lib.services.impl;
18 |
19 | import java.util.Locale;
20 |
21 | import org.apache.tapestry5.ioc.annotations.Inject;
22 | import org.apache.tapestry5.services.RequestGlobals;
23 |
24 | import fr.exanpe.t5.lib.services.LocaleSessionService;
25 |
26 | /**
27 | * Implementation of the service
28 | *
29 | * @author jmaupoux
30 | */
31 | public class LocaleSessionServiceImpl implements LocaleSessionService
32 | {
33 |
34 | public static final String LOCALE_ATT_NAME = "__locale";
35 |
36 | @Inject
37 | private RequestGlobals request;
38 |
39 | public void setLocale(String locale)
40 | {
41 | innerSetLocale(locale);
42 | }
43 |
44 | public void setLocale(Locale locale)
45 | {
46 | if (locale == null)
47 | {
48 | innerSetLocale(null);
49 | }
50 | else
51 | {
52 | setLocale(locale.toString());
53 | }
54 | }
55 |
56 | private void innerSetLocale(String locale)
57 | {
58 | request.getRequest().getSession(true).setAttribute(LOCALE_ATT_NAME, locale);
59 | }
60 |
61 | public String getLocale()
62 | {
63 | return (String) request.getRequest().getSession(true).getAttribute(LOCALE_ATT_NAME);
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/SliderTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.pages.comp;
18 |
19 | import org.apache.tapestry5.annotations.InjectComponent;
20 | import org.apache.tapestry5.annotations.Log;
21 | import org.apache.tapestry5.annotations.OnEvent;
22 | import org.apache.tapestry5.annotations.Persist;
23 | import org.apache.tapestry5.annotations.Property;
24 | import org.apache.tapestry5.corelib.components.Zone;
25 |
26 | import fr.exanpe.t5.lib.components.Slider;
27 | import fr.exanpe.t5.lib.constants.ExanpeEventConstants;
28 |
29 | /**
30 | * The demo page for {@link Slider} component
31 | *
32 | * @author lguerin
33 | */
34 | public class SliderTest
35 | {
36 | @SuppressWarnings("unused")
37 | @Property
38 | @Persist
39 | private String sliderValue;
40 |
41 | @SuppressWarnings("unused")
42 | @Property
43 | @Persist
44 | private String sliderValue2;
45 |
46 | @SuppressWarnings("unused")
47 | @Property
48 | @Persist
49 | private String sliderValue3;
50 |
51 | @SuppressWarnings("unused")
52 | @Property
53 | @Persist
54 | private String sliderValue4;
55 |
56 | @InjectComponent
57 | private Zone zone;
58 |
59 | @Log
60 | @OnEvent(ExanpeEventConstants.SLIDER_EVENT)
61 | Object handleSliderAjaxEvent(String value)
62 | {
63 | System.out.println("Ajax value: " + value);
64 | return zone.getBody();
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/security/SameUserPasswordAP.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.security;
18 |
19 | import java.util.ArrayList;
20 | import java.util.List;
21 |
22 | import org.springframework.security.authentication.AuthenticationProvider;
23 | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
24 | import org.springframework.security.core.Authentication;
25 | import org.springframework.security.core.AuthenticationException;
26 | import org.springframework.security.core.GrantedAuthority;
27 | import org.springframework.security.core.authority.GrantedAuthorityImpl;
28 | import org.springframework.security.core.userdetails.User;
29 |
30 | public class SameUserPasswordAP implements AuthenticationProvider
31 | {
32 |
33 | public Authentication authenticate(Authentication authentication) throws AuthenticationException
34 | {
35 | String username = authentication.getName();
36 | GrantedAuthorityImpl ga = new GrantedAuthorityImpl("ROLE_" + username);
37 | List l = new ArrayList();
38 | l.add(ga);
39 |
40 | return new UsernamePasswordAuthenticationToken(new User(username, username, true, true, true, true, l), username, l);
41 | }
42 |
43 | public boolean supports(Class extends Object> authentication)
44 | {
45 | return true;
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/annotation/Authorize.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package fr.exanpe.t5.lib.annotation;
18 |
19 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
20 |
21 | import java.lang.annotation.Documented;
22 | import java.lang.annotation.ElementType;
23 | import java.lang.annotation.Retention;
24 | import java.lang.annotation.Target;
25 |
26 | import fr.exanpe.t5.lib.exception.AuthorizeException;
27 |
28 | /**
29 | * Interface used to restrict a page's method invocation.
30 | * Simply annotate your method or class with \@Authorize and the restriction will be applied
31 | * depending on the current user authorities.
32 | * Note that on authorization failure, an {@link AuthorizeException} will be thrown. Catch it to
33 | * display a custom error page.
34 | *
35 | * @see AuthorizeException
36 | * @author jmaupoux
37 | * @since 1.2
38 | */
39 | @Target(
40 | { ElementType.METHOD, ElementType.TYPE })
41 | @Retention(RUNTIME)
42 | @Documented
43 | public @interface Authorize
44 | {
45 | /**
46 | * Any of these authorizations grant access
47 | */
48 | String[] any() default
49 | {};
50 |
51 | /**
52 | * All of these authorizations are required to grant access
53 | */
54 | String[] all() default
55 | {};
56 |
57 | /**
58 | * None of these authorizations grant access
59 | */
60 | String[] not() default
61 | {};
62 | }
63 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/AjaxValidationTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.pages.comp;
18 |
19 | import org.apache.tapestry5.annotations.OnEvent;
20 | import org.apache.tapestry5.annotations.Property;
21 |
22 | import fr.exanpe.t5.lib.constants.AjaxValidationResult;
23 | import fr.exanpe.t5.lib.constants.ExanpeEventConstants;
24 |
25 | public class AjaxValidationTest
26 | {
27 | @Property
28 | private String value;
29 |
30 | @OnEvent(value = ExanpeEventConstants.AJAXVALIDATION_EVENT, component = "admin")
31 | public AjaxValidationResult ajaxValidate(String value)
32 | {
33 | if ("admin".equalsIgnoreCase(value))
34 | return AjaxValidationResult.TRUE;
35 | else
36 | return AjaxValidationResult.FALSE;
37 | }
38 |
39 | @OnEvent(value = ExanpeEventConstants.AJAXVALIDATION_EVENT, component = "props")
40 | public AjaxValidationResult ajaxValidateProps(String value)
41 | {
42 | if ("admin".equalsIgnoreCase(value))
43 | return AjaxValidationResult.TRUE;
44 | else
45 | return AjaxValidationResult.FALSE;
46 | }
47 |
48 | @OnEvent(value = ExanpeEventConstants.AJAXVALIDATION_EVENT, component = "multi")
49 | public AjaxValidationResult ajaxValidateMulti(String value)
50 | {
51 | if (value != null && value.length() < 7)
52 | return AjaxValidationResult.TRUE;
53 | return AjaxValidationResult.FALSE;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/model/MenuInternalModel.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package fr.exanpe.t5.lib.model;
18 |
19 | import java.util.Stack;
20 |
21 | /**
22 | * Internal mode for the menu
23 | * Used mainly to build a render stack and keep in mind the positioning state in the menu. This
24 | * positioning may have an impact on rendering.
25 | * This model is not kept after rendering. Elements are discarded after processed.
26 | *
27 | * @author jmaupoux
28 | */
29 | public class MenuInternalModel
30 | {
31 | private Stack stack = new Stack();
32 |
33 | /**
34 | * Type of element managed
35 | *
36 | * @author jmaupoux
37 | */
38 | public enum MenuRenderElement
39 | {
40 | ROOT, MENUITEM;
41 | }
42 |
43 | /**
44 | * Return the parent of the current state
45 | *
46 | * @return the parent of the current state
47 | */
48 | public MenuRenderElement getParent()
49 | {
50 | return stack.peek();
51 | }
52 |
53 | /**
54 | * Push a new element under the current
55 | *
56 | * @param element the element
57 | */
58 | public void push(MenuRenderElement element)
59 | {
60 | stack.push(element);
61 | }
62 |
63 | /**
64 | * End the current element. Discard it
65 | */
66 | public void endElement()
67 | {
68 | stack.pop();
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/AjaxLoaderTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.pages.comp;
18 |
19 | import java.text.SimpleDateFormat;
20 | import java.util.Date;
21 | import java.util.List;
22 |
23 | import org.apache.tapestry5.annotations.Import;
24 | import org.apache.tapestry5.annotations.Property;
25 | import org.apache.tapestry5.ioc.annotations.Inject;
26 |
27 | import exanpe.t5.lib.demo.bean.User;
28 | import exanpe.t5.lib.demo.services.DataService;
29 | import fr.exanpe.t5.lib.components.AjaxLoader;
30 |
31 | /**
32 | * The demo page for the {@link AjaxLoader} component.
33 | *
34 | * @author lguerin
35 | */
36 | @Import(stylesheet =
37 | { "${exanpe.asset-base}/css/exanpe-t5-lib-skin.css" })
38 | public class AjaxLoaderTest
39 | {
40 | @Inject
41 | private DataService dataService;
42 |
43 | @Property
44 | private User userRow;
45 |
46 | @Property
47 | private String date;
48 |
49 | public void onActivate()
50 | {
51 | date = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss").format(new Date());
52 | }
53 |
54 | public List getUsers1() throws InterruptedException
55 | {
56 | List result;
57 | result = dataService.getListUsersWithLatence(2000);
58 | return result;
59 | }
60 |
61 | public List getUsers2() throws InterruptedException
62 | {
63 | List result;
64 | result = dataService.getListUsersWithLatence(5000);
65 | return result;
66 | }
67 |
68 | }
69 |
--------------------------------------------------------------------------------
/src/site/xdoc/migration.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 | About us - Exanpe T5 Lib
8 | Exanpe
9 |
10 |
11 |
12 |
13 |
14 |
Accordion
15 | A migration have to be performed on this component if you customized its look and feed.
16 | Borders have been redefined to fix a bug under Firefox.
17 | The component CSS styles have been slightly modified :
18 |
.exanpe-acc .acc-content : Removed border-bottom, cause of a bug
23 |
.exanpe-acc ul li .acc-title a : Add "border-top: 1px solid #CCCCCC;"
24 |
Customize the class : .exanpe-acc ul li.opened .acc-title{ border-bottom: 1px solid #CCCCCC; }
25 |
26 |
27 |
Menu
28 | A migration have to be performed on this component if you customized its look and feed.
29 | Icon have been fixed on menubar item when submenu is present :
30 |
31 |
.exanpe-menu .yuimenubaritemlabel-hassubmenu : Renamed to .exanpe-menu .yuimenubaritem-hassubmenu
Declare a Tapestry 5 dependency (obviously we do not import one)
31 |
Paste the following configuration is your Maven descriptor :
32 |
33 |
34 |
36 | fr.exanpe
37 | exanpe-t5-lib
38 | ${project.version}
39 |
40 | ]]>
41 |
42 |
43 |
44 | Annotate your Module class with :
45 |
46 | @SubModule(ExanpeLibraryModule.class)
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | The TML integration is as simple as the previous step.
55 | Open your TML and add in the root tag :
56 |
57 |
59 | ]]>
60 |
61 |
62 |
63 |
64 |
65 | Your are now ready to take advantage of all the components provided by the library
66 | Have a look at our Demo and at the Reference page detailing each component usage.
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/src/site/xdoc/user_guide.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 | Architecture - Exanpe T5 Lib
8 | Exanpe
9 |
10 |
11 |
12 |
13 |
14 | Here are some rules that you should seriously respect to avoid any problem using the library :
15 |
16 |
To all components (except Border), define an id using the t:id attribute.
17 |
Two css files are present : a core one and skin one.
18 | Although the attributes defined in the skin file can be overridden without impacting the component layout, we do not guarantee any modification in the core one.
19 |
20 |
21 |
22 |
23 | A strict relationship between the different languages was established to design each component, to ensure coherence and increase the development process.
24 | Based on the t:id given to the component, here are the norms you can rely on :
25 |
26 |
27 | If a JavaScript class is defined for the component, an instance is available through the id provided, allowing action on the component via JavaScript.
28 |
29 |
If the JavaScript component uses a YUI one, the YUI instance is available through a yui var contained inside the JavaScript Exanpe component instance
30 |
The root HTML tag id is the id given to the component.
31 |
Some parameters of the components can be automatically injected via properties files, based on the component id suffixed (see each component documentation).
32 |
33 |
34 |
35 |
36 | CSS properties have been split between core ones (deciding the positionning) and skin ones (declaring the rendering).
37 | Two CSS files are present :
38 |
39 |
exanpe-t5-lib-core.css
40 |
exanpe-t5-lib-skin.css
41 |
42 | To customize our components rendering, we strongly advise you to check the skin file and override any of the CSS class that match your needs.
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/PasswordStrengthCheckerTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | /**
18 | *
19 | */
20 | package exanpe.t5.lib.demo.pages.comp;
21 |
22 | import org.apache.tapestry5.EventConstants;
23 | import org.apache.tapestry5.annotations.ActivationRequestParameter;
24 | import org.apache.tapestry5.annotations.Import;
25 | import org.apache.tapestry5.annotations.OnEvent;
26 | import org.apache.tapestry5.annotations.Property;
27 |
28 | import fr.exanpe.t5.lib.constants.ExanpeEventConstants;
29 | import fr.exanpe.t5.lib.constants.PasswordStrengthCheckerTypeEnum;
30 | import fr.exanpe.t5.lib.mixins.PasswordStrengthChecker;
31 |
32 | /**
33 | * The demo page for the {@link PasswordStrengthChecker} mixin.
34 | *
35 | * @author lguerin
36 | */
37 | @Import(library = "PasswordStrengthCheckerTest.js")
38 | public class PasswordStrengthCheckerTest
39 | {
40 | @ActivationRequestParameter("param1")
41 | private String param1;
42 |
43 | @Property
44 | private String pwd;
45 |
46 | @Property
47 | private String pwd2;
48 |
49 | @Property
50 | private String password;
51 |
52 | @OnEvent(value = EventConstants.ACTIVATE)
53 | void init()
54 | {
55 | System.out.println("Activation request param: " + param1);
56 | }
57 |
58 | @OnEvent(value = ExanpeEventConstants.PASSWORDSTRENGTHCHECKER_EVENT)
59 | PasswordStrengthCheckerTypeEnum checkPassword(String pwd)
60 | {
61 | System.out.println("Check password:" + pwd);
62 | Integer size = pwd.length();
63 | PasswordStrengthCheckerTypeEnum result = PasswordStrengthCheckerTypeEnum.VERYWEAK;
64 | if (size >= 5)
65 | {
66 | result = PasswordStrengthCheckerTypeEnum.WEAK;
67 | }
68 | if (size >= 6)
69 | {
70 | result = PasswordStrengthCheckerTypeEnum.STRONG;
71 | }
72 | if (size >= 7)
73 | {
74 | result = PasswordStrengthCheckerTypeEnum.STRONGEST;
75 | }
76 | return result;
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/constants/ExanpeEventConstants.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | /**
18 | *
19 | */
20 | package fr.exanpe.t5.lib.constants;
21 |
22 | import org.apache.tapestry5.SelectModel;
23 |
24 | import fr.exanpe.t5.lib.components.AjaxLoader;
25 | import fr.exanpe.t5.lib.components.Slider;
26 | import fr.exanpe.t5.lib.components.VerticalMenu;
27 | import fr.exanpe.t5.lib.mixins.AjaxValidation;
28 | import fr.exanpe.t5.lib.mixins.PasswordStrengthChecker;
29 | import fr.exanpe.t5.lib.mixins.SelectLoader;
30 |
31 | /**
32 | * This class contains the events triggered by the Exanpe T5 Lib.
33 | *
34 | * @author lguerin
35 | */
36 | public class ExanpeEventConstants
37 | {
38 | /**
39 | * Event triggered when the {@link Slider} component is used.
40 | */
41 | public static final String SLIDER_EVENT = "sliderEventAction";
42 |
43 | /**
44 | * Event triggered when {@link AjaxLoader} load a content.
45 | */
46 | public static final String AJAXLOADER_EVENT = "ajaxLoaderAction";
47 |
48 | /**
49 | * Event triggered when load a {@link SelectLoader} content.
50 | * A method handling this event have to return a class of type {@link SelectModel}
51 | */
52 | public static final String SELECTLOADER_EVENT = "selectLoaderAction";
53 |
54 | /**
55 | * Event triggered when {@link PasswordStrengthChecker} validate a password.
56 | * A method handling this event have to return a class of type
57 | * {@link PasswordStrengthCheckerTypeEnum}
58 | */
59 | public static final String PASSWORDSTRENGTHCHECKER_EVENT = "passwordStrengthCheckerAction";
60 |
61 | /**
62 | * Event triggered when validating from a {@link AjaxValidation} mixin.
63 | * A method handling this event have to return a class of type {@link AjaxValidationResult}
64 | */
65 | public static final String AJAXVALIDATION_EVENT = "ajaxValidationAction";
66 |
67 | /**
68 | * Event triggered when a {@link VerticalMenu} item is selected.
69 | */
70 | public static final String VERTICALMENU_EVENT = "selectVerticalMenuItem";
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/SelectLoaderTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.pages.comp;
18 |
19 | import java.util.List;
20 |
21 | import org.apache.tapestry5.SelectModel;
22 | import org.apache.tapestry5.ValueEncoder;
23 | import org.apache.tapestry5.annotations.OnEvent;
24 | import org.apache.tapestry5.annotations.Persist;
25 | import org.apache.tapestry5.annotations.Property;
26 | import org.apache.tapestry5.annotations.SetupRender;
27 | import org.apache.tapestry5.internal.OptionModelImpl;
28 | import org.apache.tapestry5.internal.SelectModelImpl;
29 | import org.apache.tapestry5.ioc.annotations.Inject;
30 | import org.apache.tapestry5.services.SelectModelFactory;
31 |
32 | import exanpe.t5.lib.demo.bean.Country;
33 | import exanpe.t5.lib.demo.encoders.CountryEncoder;
34 | import exanpe.t5.lib.demo.services.DataService;
35 | import fr.exanpe.t5.lib.constants.ExanpeEventConstants;
36 |
37 | public class SelectLoaderTest
38 | {
39 | @Inject
40 | private SelectModelFactory selectModelFactory;
41 |
42 | @Property
43 | private SelectModel countryModel;
44 |
45 | @Property
46 | private String countryValue;
47 |
48 | @Property
49 | @Persist
50 | private SelectModel cityModel;
51 |
52 | @Property
53 | private String cityValue;
54 |
55 | @Inject
56 | private DataService dataService;
57 |
58 | @SetupRender
59 | public void ini()
60 | {
61 | // invoke my service to find all countries, e.g. in the database
62 | List countries = dataService.getCountryList();
63 |
64 | // create a SelectModel from my list of countries
65 | countryModel = selectModelFactory.create(countries, "name");
66 |
67 | // init cityModel
68 | cityModel = new SelectModelImpl(new OptionModelImpl[0]);
69 | }
70 |
71 | @OnEvent(value = ExanpeEventConstants.SELECTLOADER_EVENT)
72 | public SelectModel populateSelect(String value)
73 | {
74 | cityModel = selectModelFactory.create(dataService.getCitiesFromCountry(value), "name");
75 | return cityModel;
76 | }
77 |
78 | public ValueEncoder getCountryEncoder()
79 | {
80 | return new CountryEncoder(dataService);
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/src/test/resources/exanpe/t5/lib/demo/pages/comp/MenuTest.tml:
--------------------------------------------------------------------------------
1 |
3 |
4 | Menubar test, with disabled elements and cat 4 not rendered :
5 |
6 |
7 | Menu Test
8 |
9 |
10 |
11 |
12 | sub11
13 |
14 |
15 | Google Link
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | sub41
27 |
28 |
29 | Google Link
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | Index
42 |
43 |
44 |
45 |
46 | Google Link
47 |
48 |
49 | Google Link
50 |
51 |
52 | Google Link
53 |
54 |
55 |
56 |
57 | NOT RENDERED !!!!!!!!!
58 |
59 |
60 |
61 |
62 | Menu test, with disabled elements and sub 3 not rendered :
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 | NOT RENDERED !!!!!!!!!
86 |
87 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/src/changes/changes.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 | Changes - Exanpe T5 Lib
6 |
7 |
8 |
9 |
10 | Fixed Contextual Menu position
11 |
12 |
13 | Added RichTextEditor mixin
14 |
15 |
16 | Added GoogleMap component and full set of markers
17 |
18 |
19 | Added LocaleSession service
20 |
21 |
22 | Added ListSorter component
23 |
24 |
25 | Added @ContextPageReset service
26 |
27 |
28 | Added full set of Authorization services (@Authorize)
29 |
30 |
31 | Fixing Accordion render bug
32 |
33 |
34 | Fixing MenuBar render bug
35 |
36 |
37 |
38 |
39 | TLD available for Eclipse development (see FAQ)
40 |
41 |
42 | Validated as Tapestry 5.3.0 compliant
43 |
44 |
45 | Added the AjaxValidation mixin
46 |
47 |
48 | Updated the Dialog mixin with rich render
49 |
50 |
51 | Added MenuBar and Menu components
52 |
53 |
54 | Added VerticalMenu component
55 |
56 |
57 | Added PasswordStrengthChecker mixin
58 |
59 |
60 | Added JavaScript events handler
61 |
62 |
63 |
64 |
65 |
66 | Initialization of the first version of the library
67 |
68 |
69 | Initialization of the first version of the library
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/src/main/java/fr/exanpe/t5/lib/services/impl/AuthorizeBusinessServiceImpl.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package fr.exanpe.t5.lib.services.impl;
18 |
19 | import org.apache.commons.lang.ArrayUtils;
20 | import org.apache.tapestry5.ioc.annotations.Inject;
21 | import org.apache.tapestry5.services.RequestGlobals;
22 |
23 | import fr.exanpe.t5.lib.services.AuthorizeBusinessService;
24 |
25 | /**
26 | * Implementation of the interface {@link AuthorizeBusinessService}
27 | *
28 | * @author jmaupoux
29 | */
30 | public class AuthorizeBusinessServiceImpl implements AuthorizeBusinessService
31 | {
32 | @Inject
33 | private RequestGlobals request;
34 |
35 | /*
36 | * (non-Javadoc)
37 | * @see fr.exanpe.t5.lib.services.AuthorizeBusinessService#applyAny(java.lang.String[])
38 | */
39 | public boolean applyAny(String[] any)
40 | {
41 | if (ArrayUtils.isEmpty(any)) { return true; }
42 |
43 | String[] roles = any;
44 | for (String r : roles)
45 | {
46 | if (r != null && request.getHTTPServletRequest().isUserInRole(r.trim())) { return true; }
47 | }
48 |
49 | return false;
50 | }
51 |
52 | /*
53 | * (non-Javadoc)
54 | * @see fr.exanpe.t5.lib.services.AuthorizeBusinessService#applyAll(java.lang.String[])
55 | */
56 | public boolean applyAll(String[] all)
57 | {
58 | if (ArrayUtils.isEmpty(all)) { return true; }
59 |
60 | String[] roles = all;
61 | for (String r : roles)
62 | {
63 | if (r != null && !request.getHTTPServletRequest().isUserInRole(r.trim())) { return false; }
64 | }
65 |
66 | return true;
67 | }
68 |
69 | /*
70 | * (non-Javadoc)
71 | * @see fr.exanpe.t5.lib.services.AuthorizeBusinessService#applyNot(java.lang.String[])
72 | */
73 | public boolean applyNot(String[] not)
74 | {
75 | if (ArrayUtils.isEmpty(not)) { return true; }
76 |
77 | String[] roles = not;
78 | for (String r : roles)
79 | {
80 | if (r != null && request.getHTTPServletRequest().isUserInRole(r.trim())) { return false; }
81 | }
82 |
83 | return true;
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/src/test/java/exanpe/t5/lib/demo/pages/comp/AuthorizeAnnotationTest.java:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright 2011 EXANPE
3 | //
4 | // Licensed under the Apache License, Version 2.0 (the "License");
5 | // you may not use this file except in compliance with the License.
6 | // You may obtain a copy of the License at
7 | //
8 | // http://www.apache.org/licenses/LICENSE-2.0
9 | //
10 | // Unless required by applicable law or agreed to in writing, software
11 | // distributed under the License is distributed on an "AS IS" BASIS,
12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | // See the License for the specific language governing permissions and
14 | // limitations under the License.
15 | //
16 |
17 | package exanpe.t5.lib.demo.pages.comp;
18 |
19 | import org.apache.tapestry5.EventConstants;
20 | import org.apache.tapestry5.PersistenceConstants;
21 | import org.apache.tapestry5.annotations.OnEvent;
22 | import org.apache.tapestry5.annotations.Persist;
23 | import org.apache.tapestry5.annotations.Property;
24 | import org.apache.tapestry5.ioc.annotations.Inject;
25 | import org.springframework.context.ApplicationContext;
26 | import org.springframework.security.authentication.AuthenticationManager;
27 | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
28 | import org.springframework.security.core.Authentication;
29 | import org.springframework.security.core.context.SecurityContextHolder;
30 |
31 | import fr.exanpe.t5.lib.annotation.Authorize;
32 |
33 | public class AuthorizeAnnotationTest
34 | {
35 |
36 | @Inject
37 | private ApplicationContext applicationContext;
38 |
39 | private AuthenticationManager authenticationManager;
40 |
41 | void onActivate()
42 | {
43 | authenticationManager = (AuthenticationManager) applicationContext.getBean(applicationContext.getBeanNamesForType(AuthenticationManager.class)[0]);
44 | }
45 |
46 | public void onActionFromUser()
47 | {
48 |
49 | authenticate("USER");
50 | }
51 |
52 | public void onActionFromAdmin()
53 | {
54 | authenticate("ADMIN");
55 | }
56 |
57 | private void authenticate(String role)
58 | {
59 | Authentication request = new UsernamePasswordAuthenticationToken(role, role);
60 | Authentication result = authenticationManager.authenticate(request);
61 | SecurityContextHolder.getContext().setAuthentication(result);
62 | }
63 |
64 | @Persist(PersistenceConstants.FLASH)
65 | @Property
66 | private String roleInvoked;
67 |
68 | @Authorize(all = "ROLE_USER")
69 | @OnEvent(value = EventConstants.ACTION, component = "act")
70 | public void invokeUser()
71 | {
72 | roleInvoked = "USER";
73 | }
74 |
75 | @Authorize(all = "ROLE_ADMIN")
76 | @OnEvent(value = EventConstants.ACTION, component = "act")
77 | public void invokeAdmin()
78 | {
79 | roleInvoked = "ADMIN";
80 | }
81 |
82 | }
83 |
--------------------------------------------------------------------------------