use of org.apache.tapestry5.internal.InternalComponentResources in project tapestry-5 by apache.
the class InternalComponentResourcesImplTest method get_property_name.
@Test
public void get_property_name() {
Component component = mockComponent();
Instantiator ins = mockInstantiator(component);
ComponentModel model = mockComponentModel();
ComponentPageElement element = mockComponentPageElement();
Page page = mockPage();
Binding binding = mockBinding();
train_getModel(ins, model);
replay();
InternalComponentResources resources = new InternalComponentResourcesImpl(page, element, null, null, null, null, ins, false);
resources.bindParameter("bar", binding);
assertNull(resources.getPropertyName("bar"));
verify();
}
use of org.apache.tapestry5.internal.InternalComponentResources in project tapestry-5 by apache.
the class InternalComponentResourcesImplTest method render_informal_parameters_skips_formal_parameters.
@Test
public void render_informal_parameters_skips_formal_parameters() {
ComponentPageElement element = mockComponentPageElement();
Component component = mockComponent();
Instantiator ins = mockInstantiator(component);
MarkupWriter writer = mockMarkupWriter();
ComponentModel model = mockComponentModel();
ParameterModel pmodel = mockParameterModel();
Binding binding = mockBinding();
train_getModel(ins, model);
train_getParameterModel(model, "fred", pmodel);
replay();
InternalComponentResources resources = new InternalComponentResourcesImpl(null, element, null, elementResources, null, null, ins, false);
resources.bindParameter("fred", binding);
resources.renderInformalParameters(writer);
verify();
}
use of org.apache.tapestry5.internal.InternalComponentResources in project tapestry-5 by apache.
the class UnclaimedFieldWorker method createComputedFieldConduit.
private ComputedValue<FieldConduit<Object>> createComputedFieldConduit(PlasticField field) {
final String fieldType = field.getTypeName();
return new ComputedValue<FieldConduit<Object>>() {
public FieldConduit<Object> get(InstanceContext context) {
Object fieldDefaultValue = classCache.defaultValueForType(fieldType);
InternalComponentResources resources = context.get(InternalComponentResources.class);
return new UnclaimedFieldConduit(resources, perThreadManager.createValue(), fieldDefaultValue);
}
};
}
use of org.apache.tapestry5.internal.InternalComponentResources in project tapestry-5 by apache.
the class ComponentInstantiatorSourceImpl method implementComponentInterface.
private void implementComponentInterface(PlasticClass plasticClass) {
plasticClass.introduceInterface(Component.class);
final PlasticField resourcesField = plasticClass.introduceField(InternalComponentResources.class, "internalComponentResources").injectFromInstanceContext();
plasticClass.introduceMethod(GET_COMPONENT_RESOURCES, new InstructionBuilderCallback() {
public void doBuild(InstructionBuilder builder) {
builder.loadThis().getField(resourcesField).returnResult();
}
});
}
use of org.apache.tapestry5.internal.InternalComponentResources in project tapestry-5 by apache.
the class ComponentInstantiatorSourceImplTest method createComponent.
private Component createComponent(String classname) {
InternalComponentResources resources = mockInternalComponentResources();
replay();
Instantiator inst = source.getInstantiator(classname);
Component target = inst.newInstance(resources);
verify();
return target;
}
Aggregations