Examples of CopletLayout


Examples of org.apache.cocoon.portal.layout.impl.CopletLayout

     * @see java.lang.Object#toString()
     */
    private String getURL() {
        if ( this.generatedURL == null ) {
            final PortletWindowImpl impl = (PortletWindowImpl)this.portletWindow;
            final CopletLayout cl = impl.getLayout();
            Event sizingEvent = null;
            if ( cl != null ) {
                final CopletInstanceData cid = cl.getCopletInstanceData();
                WindowState oldState = (WindowState)cid.getTemporaryAttribute("window-state");
                if ( oldState == null ) {
                    oldState = WindowState.NORMAL;
                }
                if ( this.state != null && !this.state.equals(oldState) ) {
View Full Code Here

Examples of org.apache.cocoon.portal.layout.impl.CopletLayout

     * @return The URL as a String
     */
    public String asString() {

        final PortletWindowImpl impl = (PortletWindowImpl) this.portletWindow;
        final CopletLayout cl = impl.getLayout();
        if (cl == null) {
            return "";
        }
        final CopletInstanceData cid = cl.getCopletInstanceData();
        PortletURLConverter urlConverter = new PortletURLConverter(cid);

        if (this.mode != null) {
            urlConverter.setMode(this.mode);
        }
View Full Code Here

Examples of org.apache.cocoon.portal.layout.impl.CopletLayout

    for(Iterator it = copletDatas.iterator(); it.hasNext();) {
      CopletData cd = (CopletData) it.next();
     
      try {
        CopletInstanceData cinst = cf.newInstance(cd);
        CopletLayout lay = (CopletLayout) lf.newInstance("coplet");
        lay.setCopletInstanceData(cinst);
       
         if(obj instanceof Item) {
           Item item = (Item) obj;
           item.setLayout(lay);
           lay.setParent(item);
         } else if(obj instanceof CompositeLayout) {
           CompositeLayout cl = (CompositeLayout) obj;
           Item item = new Item();
           item.setLayout(lay);
           lay.setParent(item);
           cl.addItem(item);
         }
        
      } catch (ProcessingException e) {}
    }
View Full Code Here

Examples of org.apache.cocoon.portal.layout.impl.CopletLayout

            PortalService service = null;
            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 {
                        final CopletInstanceData original = service.getComponentManager().getProfileManager().getCopletInstanceData(ci.getCopletId());
                        final CopletData copletData = original.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());
                        }
                        // now copy the original attributes
                        attributes = original.getAttributes();
                        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) {
                this.getLogger().warn("Unable to create new instance.", pe);
            } catch (ServiceException se) {
                this.getLogger().warn("Unable to lookup portal service.", se);
            } finally {
View Full Code Here

Examples of org.apache.cocoon.portal.layout.impl.CopletLayout

            CopletData copletData = coplet.getCopletData();

            LayoutFactory lfac =
                (LayoutFactory) this.manager.lookup(LayoutFactory.ROLE);

            CopletLayout copletLayout =
                (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();
            newItem.setLayout(copletLayout);
View Full Code Here

Examples of org.apache.cocoon.portal.layout.impl.CopletLayout

            PortalService service = null;
            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) {
                this.getLogger().warn("Unable to create new instance.", pe);
            } catch (ServiceException se) {
                this.getLogger().warn("Unable to lookup portal service.", se);
            } finally {
View Full Code Here

Examples of org.apache.cocoon.portal.layout.impl.CopletLayout

     * @see java.lang.Object#toString()
     */
    public String toString() {
        if ( this.generatedURL == null ) {
            final PortletWindowImpl impl = (PortletWindowImpl)this.portletWindow;
            final CopletLayout cl = impl.getLayout();
            Event sizingEvent = null;
            if ( cl != null ) {
                final CopletInstanceData cid = cl.getCopletInstanceData();
                WindowState oldState = (WindowState)cid.getAttribute("window-state");
                if ( oldState == null ) {
                    oldState = WindowState.NORMAL;
                }
                if ( this.state != null && !this.state.equals(oldState) ) {
View Full Code Here

Examples of org.apache.cocoon.portal.layout.impl.CopletLayout

            CopletData copletData = coplet.getCopletData();

            LayoutFactory lfac =
                (LayoutFactory) this.manager.lookup(LayoutFactory.ROLE);

            CopletLayout copletLayout =
                (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();
            newItem.setLayout(copletLayout);
View Full Code Here

Examples of org.apache.cocoon.portal.layout.impl.CopletLayout

                layoutItem.setParent(compositeLayout);
                this.resolveParents(layoutItem.getLayout(), layoutItem, manager);
            }
        }
        if (layout instanceof CopletLayout) {
      CopletLayout copletLayout = (CopletLayout)layout;

      if (manager != null) {
        String copletId = copletLayout.getCopletInstanceData().getCopletId();
        copletLayout.setCopletInstanceData(manager.getCopletInstanceData(copletId));
      }

            // FIXME - move this simple test at a better place
            if ( copletLayout.getCopletInstanceData() == null ) {
                throw new ProcessingException("Layout " + copletLayout.getId() + " has no coplet instance data.");
            } else {
                if ( copletLayout.getCopletInstanceData().getCopletData() == null ) {
                    throw new ProcessingException("CopletInstanceData " + copletLayout.getCopletInstanceData().getCopletId() + " has no coplet data.");
                }
            }
            this.setAspectStatus(ProfileManager.SESSION_STATUS, copletLayout.getCopletInstanceData().getCopletData().getName(), new SizeableStatus());
        }
        layout.setParent(item);
    }
View Full Code Here

Examples of org.apache.cocoon.portal.layout.impl.CopletLayout

            CopletData copletData = coplet.getCopletData();

            LayoutFactory lfac =
                (LayoutFactory) this.manager.lookup(LayoutFactory.ROLE);

            CopletLayout copletLayout =
                (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();
            newItem.setLayout(copletLayout);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.