@Override public Object createObject() { return componentSource.getPage(injectedPageName); } });
@Override public void run() { componentSource.getPage(pageName); } }
public Block getTabContent(String tabName) { Component page = componentSource.getPage(tab2PageName.get(tabName)); return page.getComponentResources().getBlock("content"); } }
public void processResultValue(Class value) throws IOException { String pageName = componentSource.getPage(value).getComponentResources().getPageName(); masterProcessor.processResultValue(pageName); } }
protected boolean redirectUnauthorizedUser(String pageName) throws IOException { Component page = componentSource.getPage(pageName);
private void trigger(String pageName, String eventType, Link link, Object parameters) { String pageClassName = resolver.resolvePageNameToClassName(pageName); ComponentModel model = modelSource.getModel(pageClassName); if (model.handlesEvent(eventType)) { Component page = componentSource.getPage(pageName); page.getComponentResources().triggerEvent(eventType, new Object[] { link, parameters }, null); } } }
@Override public void handle(ComponentEventRequestParameters parameters, ComponentEventRequestHandler handler) throws IOException { FileUploadException uploadException = decoder.getUploadException(); if (uploadException != null) { Component page = componentSource.getPage(parameters.getActivePageName()); ComponentResultProcessorWrapper callback = new ComponentResultProcessorWrapper(resultProcessor); page.getComponentResources().triggerEvent(UploadEvents.UPLOAD_EXCEPTION, new Object[] { uploadException }, callback); // If an event handler exists and returns a value, then the callback will be aborted and a response // (typically a redirect) will already have been sent to the client. if (callback.isAborted()) return; // If the page does not properly handle the exception, then we throw it now. throw new RuntimeException(UploadMessages.unableToDecode(), uploadException); } handler.handle(parameters); } }
@Override public void handle(ComponentEventRequestParameters parameters, ComponentEventRequestHandler handler) throws IOException { FileUploadException uploadException = decoder.getUploadException(); if (uploadException != null) { Component page = componentSource.getPage(parameters.getActivePageName()); ComponentResultProcessorWrapper callback = new ComponentResultProcessorWrapper(resultProcessor); page.getComponentResources().triggerEvent(UploadEvents.UPLOAD_EXCEPTION, new Object[] { uploadException }, callback); // If an event handler exists and returns a value, then the callback will be aborted and a response // (typically a redirect) will already have been sent to the client. if (callback.isAborted()) return; // If the page does not properly handle the exception, then we throw it now. throw new RuntimeException(UploadMessages.unableToDecode(), uploadException); } handler.handle(parameters); } }
@Test public void get_page_by_class() { RequestPageCache cache = mockRequestPageCache(); Page page = mockPage(); Component component = mockComponent(); ComponentClassResolver resolver = mockComponentClassResolver(); train_resolvePageClassNameToPageName(resolver, ComponentSourceImplTest.class.getName(), PAGE_NAME); train_get(cache, PAGE_NAME, page); train_getRootComponent(page, component); replay(); ComponentSource source = new ComponentSourceImpl(cache, resolver, null); assertSame(source.getPage(ComponentSourceImplTest.class), component); verify(); }
@Test public void get_page_by_logical_name() { RequestPageCache cache = mockRequestPageCache(); Page page = mockPage(); Component component = mockComponent(); ComponentClassResolver resolver = mockComponentClassResolver(); train_get(cache, PAGE_NAME, page); train_getRootComponent(page, component); replay(); ComponentSource source = new ComponentSourceImpl(cache, resolver, null); assertSame(source.getPage(PAGE_NAME), component); verify(); }