use of org.apache.tapestry5.internal.services.Instantiator in project tapestry-5 by apache.
the class EmbeddedComponentAssemblerImpl method addMixinsToElement.
public int addMixinsToElement(ComponentPageElement newElement) {
for (Map.Entry<String, Instantiator> entry : mixinIdToInstantiator.entrySet()) {
String mixinId = entry.getKey();
Instantiator instantiator = entry.getValue();
newElement.addMixin(mixinId, instantiator, mixinsIdToOrderConstraints.get(mixinId));
}
return mixinIdToInstantiator.size();
}
use of org.apache.tapestry5.internal.services.Instantiator in project tapestry-5 by apache.
the class InternalComponentResourcesImplTest method add_page_lifecycle_listener.
@Test
public void add_page_lifecycle_listener() {
Component component = mockComponent();
Instantiator ins = mockInstantiator(component);
ComponentModel model = mockComponentModel();
ComponentPageElement element = mockComponentPageElement();
Page page = mockPage();
PageLifecycleListener listener = newMock(PageLifecycleListener.class);
train_getModel(ins, model);
page.addLifecycleListener(listener);
replay();
InternalComponentResources resources = new InternalComponentResourcesImpl(page, element, null, null, null, null, ins, false);
resources.addPageLifecycleListener(listener);
verify();
}
use of org.apache.tapestry5.internal.services.Instantiator in project tapestry-5 by apache.
the class InternalComponentResourcesImplTest method post_render_cleanup_removes_all_variables.
@Test
public void post_render_cleanup_removes_all_variables() {
Component component = mockComponent();
Instantiator ins = mockInstantiator(component);
ComponentModel model = mockComponentModel();
train_getModel(ins, model);
replay();
InternalComponentResources resources = new InternalComponentResourcesImpl(null, null, null, elementResources, "Foo.bar", null, ins, false);
resources.storeRenderVariable("fred", "FRED");
resources.storeRenderVariable("barney", "BARNEY");
resources.postRenderCleanup();
try {
resources.getRenderVariable("fred");
unreachable();
} catch (IllegalArgumentException ex) {
assertEquals(ex.getMessage(), "Component Foo.bar does not contain a stored render variable with name 'fred'. Stored render variables: (none).");
}
verify();
}
use of org.apache.tapestry5.internal.services.Instantiator 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.services.Instantiator 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();
}
Aggregations