use of org.apache.wicket.Page in project wicket by apache.
the class AjaxRequestHandler method add.
@Override
public void add(Component... components) {
for (final Component component : components) {
Args.notNull(component, "component");
if (component.getOutputMarkupId() == false && !(component instanceof Page)) {
throw new IllegalArgumentException("Cannot update component that does not have setOutputMarkupId property set to true. Component: " + component.toString());
}
Page pageOfComponent = component.findParent(Page.class);
if (component == getPage() || pageOfComponent == getPage()) {
add(component, component.getMarkupId());
} else {
String msg = "Cannot update component because its page is not the same as " + "the one this handler has been created for. Component: " + component.toString();
IllegalArgumentException error = new IllegalArgumentException(msg);
if (Application.get().usesDevelopmentConfig()) {
throw error;
} else {
// log the error to the application log, but don't block the user of the
// application (which was the behavior in Wicket <= 7.
log.error(msg, error);
}
}
}
}
use of org.apache.wicket.Page in project wicket by apache.
the class LocaleAwarePageParametersTest method localeAware.
@Test
public void localeAware() {
tester.executeUrl("aware?number=1.234,0");
final Page page = tester.getLastRenderedPage();
assertThat(page.getPageParameters().get("number").toDouble(), is(1234d));
}
use of org.apache.wicket.Page in project wicket by apache.
the class ConversationPropagator method onRequestHandlerScheduled.
@Override
public void onRequestHandlerScheduled(RequestCycle cycle, IRequestHandler handler) {
// propagate current non-transient conversation to the newly scheduled page
Conversation conversation = getConversation(cycle);
if (conversation == null || conversation.isTransient()) {
return;
}
Page page = getPage(handler);
if (page != null) {
if (propagation.propagatesViaPage(page, handler)) {
// propagate a conversation across non-bookmarkable page instances
setConversationOnPage(conversation, page);
}
}
if (propagation.propagatesViaParameters(handler)) {
// propagate cid to a scheduled bookmarkable page
logger.debug("Propagating non-transient conversation {} via page parameters of handler {}", conversation.getId(), handler);
PageParameters parameters = getPageParameters(handler);
if (parameters != null) {
parameters.set(CID, conversation.getId());
}
}
}
use of org.apache.wicket.Page in project wicket by apache.
the class EnclosureTest method testRender10.
/**
* It must not be a difference if the enclosure controller child is a FormComponent.
*
* @throws Exception
*/
@Test
public void testRender10() throws Exception {
Class<? extends Page> clazz = EnclosurePage_10.class;
executeTest(clazz, "EnclosurePageExpectedResult_10.html");
Page page = tester.getLastRenderedPage();
page.get("input").setVisible(false);
tester.startPage(page);
tester.assertRenderedPage(clazz);
tester.assertResultPage(getClass(), "EnclosurePageExpectedResult_10-2.html");
page.get("input").setVisible(true);
tester.startPage(page);
tester.assertRenderedPage(clazz);
tester.assertResultPage(getClass(), "EnclosurePageExpectedResult_10.html");
page.get("label").setVisible(false);
tester.startPage(page);
tester.assertRenderedPage(clazz);
tester.assertResultPage(getClass(), "EnclosurePageExpectedResult_10-3.html");
page.get("input").setVisible(false);
tester.startPage(page);
tester.assertRenderedPage(clazz);
tester.assertResultPage(getClass(), "EnclosurePageExpectedResult_10-2.html");
page.get("input").setVisible(true);
tester.startPage(page);
tester.assertRenderedPage(clazz);
tester.assertResultPage(getClass(), "EnclosurePageExpectedResult_10-3.html");
page.get("label").setVisible(true);
tester.startPage(page);
tester.assertRenderedPage(clazz);
tester.assertResultPage(getClass(), "EnclosurePageExpectedResult_10.html");
}
use of org.apache.wicket.Page in project wicket by apache.
the class MergedMarkupTest method test2.
/**
* test2()
*/
@Test
public void test2() {
Page page = new SubPageWithMarkup();
MarkupStream markup = page.getAssociatedMarkupStream(true);
assertEquals("utf-8", markup.getEncoding());
assertEquals(MarkupParser.WICKET, markup.getWicketNamespace());
}
Aggregations