001: // Copyright 2006, 2007 The Apache Software Foundation
002: //
003: // Licensed under the Apache License, Version 2.0 (the "License");
004: // you may not use this file except in compliance with the License.
005: // You may obtain a copy of the License at
006: //
007: // http://www.apache.org/licenses/LICENSE-2.0
008: //
009: // Unless required by applicable law or agreed to in writing, software
010: // distributed under the License is distributed on an "AS IS" BASIS,
011: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012: // See the License for the specific language governing permissions and
013: // limitations under the License.
014:
015: package org.apache.tapestry.internal.structure;
016:
017: import java.util.List;
018:
019: import org.apache.tapestry.ioc.Messages;
020: import org.apache.tapestry.ioc.internal.util.InternalUtils;
021: import org.apache.tapestry.ioc.internal.util.MessagesImpl;
022:
023: class StructureMessages {
024: private static final Messages MESSAGES = MessagesImpl
025: .forClass(StructureMessages.class);
026:
027: private StructureMessages() {
028: }
029:
030: static String missingParameters(List<String> parameters,
031: ComponentPageElement element) {
032: return MESSAGES.format("missing-parameters", InternalUtils
033: .joinSorted(parameters), element
034: .getComponentResources().getComponentModel()
035: .getComponentClassName());
036: }
037:
038: static String noSuchComponent(ComponentPageElement parent,
039: String embeddedId) {
040: return MESSAGES.format("no-such-component", parent
041: .getCompleteId(), embeddedId);
042: }
043:
044: static String getParameterFailure(String parameterName,
045: String componentId, Throwable cause) {
046: return MESSAGES.format("get-parameter-failure", parameterName,
047: componentId, cause);
048: }
049:
050: static String writeParameterFailure(String parameterName,
051: String componentId, Throwable cause) {
052: return MESSAGES.format("write-parameter-failure",
053: parameterName, componentId, cause);
054: }
055:
056: static String missingMixinForParameter(String componentId,
057: String mixinName, String parameterName) {
058: return MESSAGES.format("missing-mixin-for-parameter",
059: componentId, mixinName, parameterName);
060: }
061:
062: static String unknownMixin(String componentId, String mixinClassName) {
063: return MESSAGES.format("unknown-mixin", componentId,
064: mixinClassName);
065: }
066:
067: static String detachFailure(Object listener, Throwable cause) {
068: return MESSAGES.format("detach-failure", listener, cause);
069: }
070:
071: static String wrongEventResultType(String method, Class expectedType) {
072: return MESSAGES.format("wrong-event-result-type", method,
073: expectedType.getName());
074: }
075:
076: static String blockNotFound(String componentId, String blockId) {
077: return MESSAGES.format("block-not-found", componentId, blockId);
078: }
079:
080: static String unbalancedElements(String componentId) {
081: return MESSAGES.format("unbalanced-elements", componentId);
082: }
083:
084: static String pageIsDirty(Page page) {
085: return MESSAGES.format("page-is-dirty", page);
086: }
087:
088: static String duplicateChildComponent(
089: ComponentPageElement container, String childId) {
090: return MESSAGES.format("duplicate-child-component", container
091: .getCompleteId(), childId);
092: }
093:
094: static String duplicateBlock(ComponentPageElement component,
095: String blockId) {
096: return MESSAGES.format("duplicate-block", component
097: .getCompleteId(), blockId);
098: }
099:
100: static String fieldPersistFailure(String componentId,
101: String fieldName, Throwable cause) {
102: return MESSAGES.format("field-persist-failure", componentId,
103: fieldName, cause);
104: }
105: }
|