KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > engine > EngineMessages


1 // Copyright 2004, 2005 The Apache Software Foundation
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.
14

15 package org.apache.tapestry.engine;
16
17 import java.util.List JavaDoc;
18
19 import org.apache.hivemind.impl.MessageFormatter;
20 import org.apache.tapestry.IComponent;
21 import org.apache.tapestry.IPage;
22
23 /**
24  * @author Howard M. Lewis Ship
25  * @since 4.0
26  */

27 public class EngineMessages
28 {
29     protected static MessageFormatter _formatter = new MessageFormatter(EngineMessages.class,
30             "EngineStrings");
31
32     public static String JavaDoc serviceNoParameter(IEngineService service)
33     {
34         return _formatter.format("service-no-parameter", service.getName());
35     }
36
37     static String JavaDoc wrongComponentType(IComponent component, Class JavaDoc expectedType)
38     {
39         return _formatter.format("wrong-component-type", component.getExtendedId(), expectedType
40                 .getName());
41     }
42
43     static String JavaDoc requestStateSession(IComponent component)
44     {
45         return _formatter.format("request-stale-session", component.getExtendedId());
46     }
47
48     static String JavaDoc pageNotCompatible(IPage page, Class JavaDoc expectedType)
49     {
50         return _formatter.format("page-not-compatible", page.getPageName(), expectedType.getName());
51     }
52
53     static String JavaDoc exceptionDuringCleanup(Throwable JavaDoc cause)
54     {
55         return _formatter.format("exception-during-cleanup", cause);
56     }
57
58     static String JavaDoc validateCycle(List JavaDoc pageNames)
59     {
60         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
61         int count = pageNames.size();
62
63         for (int i = 0; i < count; i++)
64         {
65             if (i > 0)
66                 buffer.append("; ");
67
68             buffer.append(pageNames.get(i));
69         }
70
71         return _formatter.format("validate-cycle", buffer);
72     }
73 }
Popular Tags