Package org.apache.cocoon.portal.coplet

Examples of org.apache.cocoon.portal.coplet.CopletInstanceData


                (CopletLayout) lfac.newInstance("coplet");

            CopletFactory cfac =
                (CopletFactory) manager.lookup(CopletFactory.ROLE);

            CopletInstanceData newCoplet = cfac.newInstance(copletData);

            copletLayout.setCopletInstanceData(newCoplet);
            profileManager.register(copletLayout);

            NamedItem newItem = new NamedItem();
View Full Code Here


    public PortletEntity add(PortletApplicationEntity appEntity, String definitionId) {
        // FIXME
        PortletDefinitionRegistry registry = null;
        PortletDefinition pd = registry.getPortletDefinition(ObjectIDImpl.createFromString(definitionId));
        PortletApplicationEntity pae = registry.getPortletApplicationEntityList().get(ObjectIDImpl.createFromString("cocoon"));
        CopletInstanceData coplet = null;
        PortletEntity portletEntity = new PortletEntityImpl(pae, coplet, pd);
        this.portlets.put(portletEntity.getId(), portletEntity);
       
        return portletEntity;
    }
View Full Code Here

     * This adapter listens for CopletInstanceEvents. Each event sets the cache invalid.
     */
    public void handleCopletInstanceEvent(Event e) {
        final CopletInstanceEvent event = (CopletInstanceEvent) e;

        final CopletInstanceData coplet = (CopletInstanceData) event.getTarget();

        this.setCacheInvalid(coplet);
    }
View Full Code Here

                    Layout layout,
                    PortalService service,
                    ContentHandler handler)
  throws SAXException {
       
        CopletInstanceData cid = ((CopletLayout)layout).getCopletInstanceData();

        Boolean supportsFullScreen = (Boolean)cid.getCopletData().getAspectData("full-screen");
        if ( supportsFullScreen == null || supportsFullScreen.equals(Boolean.TRUE) ) {
            final Layout fullScreenLayout = service.getEntryLayout(null);
            if ( fullScreenLayout != null && fullScreenLayout.equals( layout )) {
                FullScreenCopletEvent event = new FullScreenCopletEvent( cid, null );
                XMLUtils.createElement(handler, "fullscreen-uri", service.getComponentManager().getLinkService().getLinkURI(event));
View Full Code Here

                final String href = attr.getValue("href");           
                if ( href != null ) {
                    ci = new ContentItem(href, addContent);
                } else {
                    final String copletId = attr.getValue("coplet");
                    final CopletInstanceData cid = service.getComponentManager().getProfileManager().getCopletInstanceData(copletId);                   
                    ci = new ContentItem(cid, addContent);
            }

                // do we want to add the content to the basket or to the briefcase
                final ContentStore store;
View Full Code Here

                this.addValues(layout.getId(), state, layout.getAspectDatas(), "aspectDatas/");
                this.addValues(layout.getId(), state, layout.getParameters(), "parameters/");
               
                // are we a coplet layout
                if ( layout instanceof CopletLayout ) {
                    CopletInstanceData cid = ((CopletLayout)layout).getCopletInstanceData();
                    this.addValues(cid.getId(), state, cid.getAspectDatas(), "aspectDatas/");
                    this.addValues(cid.getId(), state, cid.getAttributes(), "attributes/");
                }
                session.setAttribute("portal-history", history);
            }
        }
        context.invokeNext(layout, service, handler);
View Full Code Here

                    PortalService service,
                    ContentHandler handler)
  throws SAXException {
       
        XMLUtils.startElement(handler, "content");
        CopletInstanceData cid = ((CopletLayout)layout).getCopletInstanceData();

        final String adapterName = cid.getCopletData().getCopletBaseData().getCopletAdapterName();
        CopletAdapter copletAdapter = null;
        ServiceSelector adapterSelector = null;
        try {
            adapterSelector = (ServiceSelector) this.manager.lookup(CopletAdapter.ROLE + "Selector");
            copletAdapter = (CopletAdapter) adapterSelector.select(adapterName);
View Full Code Here

                      Layout layout,
                      PortalService service,
                      ContentHandler contenthandler)
    throws SAXException {
        final PreparedConfiguration config = (PreparedConfiguration)context.getAspectConfiguration();
        final CopletInstanceData copletInstanceData = ((CopletLayout)layout).getCopletInstanceData();

        if ( config.rootTag ) {
            XMLUtils.startElement(contenthandler, config.tagName);
        }
        final PortletWindow window = (PortletWindow)copletInstanceData.getTemporaryAttribute("window");
        if ( window == null ) {
            // no portlet window, so use a default behaviour
            XMLUtils.createElement(contenthandler, "title", copletInstanceData.getTitle());
        } else {
            if ( ((PortletWindowImpl)window).getLayout() == null ) {
                ((PortletWindowImpl)window).setLayout((CopletLayout)layout);
            }
           
            String title = (String) copletInstanceData.getTemporaryAttribute("dynamic-title");
            if ( title == null ) {
                final PortletDefinition def = window.getPortletEntity().getPortletDefinition();
                try {
                    title = def.getDisplayName(def.getLanguageSet().getDefaultLocale()).getDisplayName();
                } catch (Exception ignore)  {
                    title = copletInstanceData.getTitle();
                }
            }
            XMLUtils.createElement(contenthandler, "title", title);           
       

            if ( this.environment != null ) {
                InformationProviderService ips = (InformationProviderService) this.environment.getContainerService(InformationProviderService.class);
                DynamicInformationProvider dip = ips.getDynamicProvider((HttpServletRequest) context.getObjectModel().get("portlet-request"));
               
                // Sizing
                WindowState ws = (WindowState)copletInstanceData.getTemporaryAttribute("window-state");
                if ( ws == null ) {
                    ws = WindowState.NORMAL;
                }
               
                if ( !ws.equals(WindowState.MINIMIZED) && !ws.equals(WindowState.MAXIMIZED)) {
                    PortletURLProviderImpl url = (PortletURLProviderImpl)dip.getPortletURLProvider(window);
                    url.clearParameters();
                    url.setWindowState(WindowState.MINIMIZED);
                   
                    XMLUtils.createElement(contenthandler, "minimize-uri", url.toString());
                }

                if ( !ws.equals(WindowState.NORMAL)) {
                    PortletURLProviderImpl url = (PortletURLProviderImpl)dip.getPortletURLProvider(window);
                    url.clearParameters();
                    url.setWindowState(WindowState.NORMAL);
                    XMLUtils.createElement(contenthandler, "maximize-uri", url.toString());
                }

                if ( !ws.equals(WindowState.MAXIMIZED)) {
                    PortletURLProviderImpl url = (PortletURLProviderImpl)dip.getPortletURLProvider(window);
                    url.clearParameters();
                    url.setWindowState(WindowState.MAXIMIZED);
                    XMLUtils.createElement(contenthandler, "fullscreen-uri", url.toString());
                }

                // portlet modes
                PortletMode pm = (PortletMode)copletInstanceData.getTemporaryAttribute("portlet-mode");
                if ( pm == null ) {
                    pm = PortletMode.VIEW;
                }
                if ( !pm.equals(PortletMode.EDIT) ) {
                    PortletURLProviderImpl url = (PortletURLProviderImpl)dip.getPortletURLProvider(window);
View Full Code Here

            try {
                service = (PortalService) this.manager.lookup(PortalService.ROLE);
               
                ContentItem ci = (ContentItem)event.getItem();
                CopletLayout layout = (CopletLayout) event.getLayout();
                CopletInstanceData cid = null;
                if ( ci.isContent() ) {
                    CopletData copletData = service.getComponentManager().getProfileManager().getCopletData(event.getCopletDataId());
                    cid = service.getComponentManager().getCopletFactory().newInstance(copletData);
                    cid.setAttribute("item-content", ci.getContent());               
                } else {
                    if ( ci.getURL() != null ) {
                        SourceResolver resolver = null;
                        Source source = null;
                        String url = null;
                        try {
                            resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
                            url = ci.getURL();
                            source = resolver.resolveURI(url);
                            CopletData copletData = service.getComponentManager().getProfileManager().getCopletData(event.getCopletDataId());
                            cid = service.getComponentManager().getCopletFactory().newInstance(copletData);
                            cid.setAttribute("item-content", IOUtil.toByteArray(source.getInputStream()));
                        } catch (IOException se) {
                            this.getLogger().warn("Unable to get content for " + url, se);
                        } catch (ServiceException se) {
                            this.getLogger().warn("Unable to get source resolver.", se);
                        } finally {
                            if ( source != null ) {
                                resolver.release(source);
                            }
                            this.manager.release(resolver);
                        }
                       
                    } else {
                        CopletData copletData = service.getComponentManager().getProfileManager().getCopletInstanceData(ci.getCopletId()).getCopletData();
                        cid = service.getComponentManager().getCopletFactory().newInstance(copletData);
                        Map attributes = (Map) ci.getAttribute("coplet-attributes");
                        Iterator i = attributes.entrySet().iterator();
                        while ( i.hasNext() ) {
                            Map.Entry entry = (Map.Entry)i.next();
                            cid.setAttribute(entry.getKey().toString(), entry.getValue());
                        }
                    }
                }
                layout.setCopletInstanceData(cid);
            } catch (ProcessingException pe) {
View Full Code Here

                } else if ( ci.getURL() == null ) {
                    // copy coplet attributes
                    PortalService service = null;
                    try {
                        service = (PortalService) this.manager.lookup(PortalService.ROLE);
                        CopletInstanceData cid = service.getComponentManager().getProfileManager().getCopletInstanceData(ci.getCopletId());
                        Map attributes = new HashMap();
                        Iterator i = cid.getAttributes().entrySet().iterator();
                        while ( i.hasNext() ) {
                            Map.Entry entry = (Map.Entry)i.next();
                            attributes.put(entry.getKey(), entry.getValue());
                        }
                        ci.setAttribute("coplet-attributes", attributes);
View Full Code Here

TOP

Related Classes of org.apache.cocoon.portal.coplet.CopletInstanceData

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.