Package org.apache.cocoon.portal.layout

Examples of org.apache.cocoon.portal.layout.Layout


        if ( o == null ) {
            throw new ProcessingException("LayoutDescription with name '" + layoutName + "' not found.");
        }
        DefaultLayoutDescription layoutDescription = (DefaultLayoutDescription)o[0];
       
        Layout layout = null;
        try {
            Class clazz = ClassUtils.loadClass( layoutDescription.getClassName() );
            layout = (Layout)clazz.newInstance();
           
        } catch (Exception e) {
            throw new ProcessingException("Unable to create new instance", e );
        }
       
        String id = null;
        if ( layoutDescription.createId() ) {
            // TODO - set unique id
            id = layoutName + '-' + System.currentTimeMillis();
        }
        layout.initialize( layoutName, id );
        layout.setDescription( layoutDescription );
        layout.setAspectDataHandler((AspectDataHandler)o[1]);

        ProfileManager profileManager = null;
        try {
            profileManager = (ProfileManager)this.manager.lookup(ProfileManager.ROLE);
            profileManager.register(layout);
View Full Code Here


     */
    public void inform(Event e) {
        // event dispatching
        if ( e instanceof LayoutRemoveEvent ) {
            LayoutRemoveEvent event = (LayoutRemoveEvent)e;
            Layout layout = (Layout)event.getTarget();
            try {
                this.remove( layout );
            } catch (ProcessingException pe) {
                throw new CascadingRuntimeException("Exception during removal.", pe);
            }
View Full Code Here

        Renderer portalLayoutRenderer = null;
        PortalService service = null;
        try {
            service = (PortalService)this.componentManager.lookup(PortalService.ROLE);
            profileManager = (ProfileManager)this.componentManager.lookup(ProfileManager.ROLE);
            Layout portalLayout = profileManager.getPortalLayout(null);

            rendererSelector = (ComponentSelector)this.componentManager.lookup(Renderer.ROLE+"Selector");
            portalLayoutRenderer = (Renderer)rendererSelector.select(portalLayout.getRendererName());      

            contentHandler.startDocument();
            portalLayoutRenderer.toSAX(portalLayout, service, contentHandler);
            contentHandler.endDocument();
        } catch (ComponentException ce) {
View Full Code Here

            factory = (LayoutFactory) this.manager.lookup(LayoutFactory.ROLE);
            copletFactory = (CopletFactory) this.manager.lookup(CopletFactory.ROLE);
            adapterSelector = (ComponentSelector)this.manager.lookup(CopletAdapter.ROLE+"Selector");
           
            if ( null == key ) {
                Layout l = (Layout) service.getTemporaryAttribute("DEFAULT_LAYOUT");
                if ( null != l) {
                    return l;
                }
            }
           
            String portalPrefix = AuthenticationProfileManager.class.getName()+"/"+service.getPortalName();
            Layout layout = null;

            if ( key != null ) {
                // now search for a layout
                Map layoutMap = (Map)service.getAttribute("layout-map");
                if ( layoutMap == null ) {
View Full Code Here

        MapSourceAdapter adapter = null;
        try {
            service = (PortalService) this.componentManager.lookup(PortalService.ROLE);
           
            if ( null == key ) {
                Layout l = (Layout) service.getTemporaryAttribute("DEFAULT_LAYOUT");
                if ( null != l) {
                    return l;
                }
            }

            Object[] objects = (Object[]) service.getAttribute(StaticProfileManager.class.getName() + "/Layout");

            Map map = new HashMap();
            map.put("profile", "layout");
            map.put("portalname", service.getPortalName());

            int valid = SourceValidity.INVALID;
            SourceValidity sourceValidity = null;
            if (objects != null) {
                sourceValidity = (SourceValidity) objects[1];
                valid = sourceValidity.isValid();
                if (valid == SourceValidity.VALID)
                    return (Layout) objects[0];
            }
            adapter = (MapSourceAdapter) this.componentManager.lookup(MapSourceAdapter.ROLE);
            Map param = new HashMap();
            param.put("portalname", service.getPortalName());
            SourceValidity newValidity = adapter.getValidity(param, map);
            if (valid == SourceValidity.UNKNWON) {
                if (sourceValidity.isValid(newValidity) == SourceValidity.VALID)
                    return (Layout) objects[0];
            }
            Layout layout = (Layout) adapter.loadProfile(param, map);
            if (newValidity != null) {
                objects = new Object[] { layout, newValidity };
                service.setAttribute(StaticProfileManager.class.getName() + "/Layout", objects);
            }
            // resolve parents
View Full Code Here

           
            if ( null == layoutKey ) {
                layoutKey = this.getDefaultLayoutKey();
            }
            // FIXME actually this is a hack for full screen
            Layout l = (Layout) service.getTemporaryAttribute("DEFAULT_LAYOUT:" + layoutKey);
            if ( null != l) {
                return l;
            }
           
            final String layoutAttributeKey = "Layout:" + layoutKey;
            final String layoutObjectsAttributeKey = "Layout-Map:" + layoutKey;
           
            Layout layout = (Layout)service.getAttribute(layoutAttributeKey);
            if (layout == null) {
                layout = this.loadProfile(layoutKey, service, copletFactory, factory, adapterSelector);
            }
           
            if ( layoutID != null ) {
View Full Code Here

        service.setAttribute("CopletInstanceData:" + layoutKey, copletInstanceDataManager);
               
        // load layout
        parameters.put("profiletype", "layout");
        parameters.put("objectmap", copletInstanceDataManager.getCopletInstanceData());
        Layout layout = (Layout)this.getOrCreateProfile(layoutKey, parameters, service, layoutFactory);
        service.setAttribute("Layout:" + layoutKey, layout);
               
        // now invoke login on each instance
        Iterator iter =  copletInstanceDataManager.getCopletInstanceData().values().iterator();
        while ( iter.hasNext() ) {
View Full Code Here

   */
  protected void processItem(Item item,
                             ContentHandler handler,
                             PortalService service)
    throws SAXException {
        Layout layout = item.getLayout();

        Map parameters = item.getParameters();
        if (parameters.size() == 0) {
            XMLUtils.startElement(handler, ITEM_STRING);
        } else {
View Full Code Here

                               Item                  item,
                           ContentHandler        handler,
                           PortalService         service)
    throws SAXException {
        final PreparedConfiguration config = (PreparedConfiguration)context.getAspectConfiguration();
        Layout layout = item.getLayout();

        if ( config.itemTag ) {
            Map parameters = item.getParameters();
            if (parameters.size() == 0) {
                XMLUtils.startElement(handler, config.itemTagName);
View Full Code Here

        if ( o == null ) {
            throw new ProcessingException("LayoutDescription with name '" + layoutName + "' not found.");
        }
        DefaultLayoutDescription layoutDescription = (DefaultLayoutDescription)o[0];
       
        Layout layout = null;
        try {
            Class clazz = ClassUtils.loadClass( layoutDescription.getClassName() );
            layout = (Layout)clazz.newInstance();
           
        } catch (Exception e) {
            throw new ProcessingException("Unable to create new instance", e );
        }
       
        String id = null;
        if ( layoutDescription.createId() ) {
            synchronized (this) {
                id = layoutName + '_' + idCounter;
                idCounter += 1;
            }
        }
        layout.initialize( layoutName, id );
        layout.setDescription( layoutDescription );
        layout.setAspectDataHandler((AspectDataHandler)o[1]);

        if ( layout instanceof CompositeLayout ) {
            CompositeLayout composite = (CompositeLayout)layout;
            composite.setItemClassName(layoutDescription.getItemClassName());
        }
View Full Code Here

TOP

Related Classes of org.apache.cocoon.portal.layout.Layout

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.