| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| MutableComponentModel |
|
| 1.0;1 |
| 1 | // Copyright 2006, 2007, 2008, 2009 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.tapestry5.model; | |
| 16 | ||
| 17 | import org.apache.tapestry5.annotations.Parameter; | |
| 18 | import org.apache.tapestry5.annotations.Persist; | |
| 19 | import org.apache.tapestry5.internal.InternalComponentResources; | |
| 20 | import org.apache.tapestry5.ioc.Location; | |
| 21 | ||
| 22 | /** | |
| 23 | * Mutable version of {@link org.apache.tapestry5.model.ComponentModel} used during the transformation phase. | |
| 24 | */ | |
| 25 | public interface MutableComponentModel extends ComponentModel | |
| 26 | { | |
| 27 | /** | |
| 28 | * Adds a new formal parameter to the model. Each parameter has a unique name (though access to parameters is case | |
| 29 | * insensitive). | |
| 30 | * | |
| 31 | * @param name new, unique name for the parameter | |
| 32 | * @param required if true, the parameter must be bound | |
| 33 | * @param allowNull if true, then parameter may be bound to null, if false a null check will be added | |
| 34 | * @param defaultBindingPrefix the default binding prefix for this parameter @throws IllegalArgumentException if a | |
| 35 | * parameter with the given name has already been defined for this model | |
| 36 | * @see Parameter | |
| 37 | */ | |
| 38 | void addParameter(String name, boolean required, boolean allowNull, String defaultBindingPrefix); | |
| 39 | ||
| 40 | /** | |
| 41 | * Defines a new embedded component. | |
| 42 | * | |
| 43 | * @param id the unique id for the embedded component, which must not already exist. | |
| 44 | * @param type the type of the component (posslibly blank) | |
| 45 | * @param componentClassName the fully qualified class name (derived from the field), used if the type is | |
| 46 | * blank | |
| 47 | * @param inheritInformalParameters if true, then the component will inherit informal parameters provided to its | |
| 48 | * container | |
| 49 | * @param location where the component is defined @return a mutable model allowing parameters to be | |
| 50 | * set | |
| 51 | */ | |
| 52 | MutableEmbeddedComponentModel addEmbeddedComponent(String id, String type, String componentClassName, | |
| 53 | boolean inheritInformalParameters, Location location); | |
| 54 | ||
| 55 | /** | |
| 56 | * Used to define the field persistence strategy for a particular field name. Returns a logical name for the field, | |
| 57 | * which is guaranteed to be unique (this is necessary for handling the case where a subclass has a persistent field | |
| 58 | * with the same name as a persistent field from a super-class). | |
| 59 | * | |
| 60 | * @param fieldName the name of the field which is to be made persistent | |
| 61 | * @param strategy the strategy for persisting the field, from {@link Persist#value()}. This value may be blank, in | |
| 62 | * which case the stategy is inherited from the component, or the component's container. | |
| 63 | * @return a logical name for the field, to be used with {@link ComponentModel#getFieldPersistenceStrategy(String)}, | |
| 64 | * and with {@link InternalComponentResources#persistFieldChange(String, Object)}, etc. | |
| 65 | */ | |
| 66 | String setFieldPersistenceStrategy(String fieldName, String strategy); | |
| 67 | ||
| 68 | /** | |
| 69 | * Adds a mixin to the component's implementation. | |
| 70 | */ | |
| 71 | void addMixinClassName(String mixinClassName); | |
| 72 | ||
| 73 | /** | |
| 74 | * Sets the internal flag to indicate that this model (and all models that extend from it) support informal | |
| 75 | * parameters. | |
| 76 | */ | |
| 77 | void enableSupportsInformalParameters(); | |
| 78 | ||
| 79 | /** | |
| 80 | * Changes the value of the mixinAfter flag. The default value is false. | |
| 81 | */ | |
| 82 | void setMixinAfter(boolean mixinAfter); | |
| 83 | ||
| 84 | /** | |
| 85 | * Stores a meta data value under the indicated key. | |
| 86 | */ | |
| 87 | void setMeta(String key, String value); | |
| 88 | ||
| 89 | /** | |
| 90 | * Identifies that the component does handle the render phase. | |
| 91 | * | |
| 92 | * @param renderPhase annotation class corresponding to the render phase | |
| 93 | * @see ComponentModel#getHandledRenderPhases() | |
| 94 | * @since 5.0.19, 5.1.0.0 | |
| 95 | */ | |
| 96 | void addRenderPhase(Class renderPhase); | |
| 97 | ||
| 98 | /** | |
| 99 | * Identifies that the component includes an event handler for the indicated event type. | |
| 100 | * | |
| 101 | * @param eventType of handled event | |
| 102 | * @since 5.1.0.0 | |
| 103 | */ | |
| 104 | void addEventHandler(String eventType); | |
| 105 | } |