Package org.apache.cocoon.portal.layout

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


    throws SAXException {
        PortalService service = null;
        try {
            service = (PortalService)this.manager.lookup(PortalService.ROLE);
            // first check for a full screen layout
            Layout portalLayout = service.getEntryLayout(null);
            if ( portalLayout == null ) {
                portalLayout = service.getComponentManager().getProfileManager().getPortalLayout(null, null);
            }

            Renderer portalLayoutRenderer = service.getComponentManager().getRenderer( portalLayout.getRendererName());      

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


     * This method gets the layout object from the first two
     * values and invokes {@link #publish(Publisher, Layout, String[])}.
     * @param values The values contained in the request
     */
    protected void publish( PortalService service, Publisher publisher, String[] values) {
        Layout layout = service.getComponentManager().getProfileManager().getPortalLayout(values[0], values[1] );
        if ( layout != null ) {
            this.publish( publisher, layout, values);
        }
    }
View Full Code Here

    // get layout element:
    Object layoutObj = getLayoutElement (layout, id, "", 1);
    if (layoutObj == null) return false;
   
    // do the job:
    Layout lay;
    if (layoutObj instanceof NamedItem)
      lay =  ((NamedItem)layoutObj).getLayout();
    else
      lay = (Layout) layoutObj;
   
    try {
      // an empty item can not be handled by the LayoutFactory, do the job manual:
      if (lay == null) {
        List items = ((NamedItem)layoutObj).getParent().getItems();
        for (ListIterator iter = items.listIterator(); iter.hasNext(); ) {
         
          Item itemElem = (Item) iter.next();
         
          if( itemElem.equals(layoutObj)) {
            items.remove (iter.nextIndex()-1);
            return true;
          }
        }
      } else if(lay.getParent() instanceof NamedItem) {
        // FIXME: Causes that only the contents inside a tab are deleted instead of the tab
          NamedItem par = (NamedItem) lay.getParent();
          par.setLayout(null);
      } else {
        lf.remove(lay);
      }
     
View Full Code Here

    // get layout element:
    Object layoutObj = getLayoutElement (layout, id, "", 1);
    if (layoutObj == null) return false;
   
    // do the job:
    Layout lay;
    Item item;
    if (layoutObj instanceof NamedItem) {
      lay =  ((NamedItem)layoutObj).getLayout();
      if (lay == null)
        item = (NamedItem) layoutObj;
      else
        item = lay.getParent();
    }
    else {
      lay = (Layout) layoutObj;
      item = lay.getParent();
    }
   
    // find element in the list and move it:
    List items = item.getParent().getItems();
    for (ListIterator iter = items.listIterator(); iter.hasNext(); ) {
View Full Code Here

    public void add(String parent, String type) {
   
    Object layoutObj = getLayoutElement (layout, parent, "", 1);
    if (layoutObj == null) return;
   
    Layout lay;
    if (layoutObj instanceof NamedItem)
      lay =  ((NamedItem)layoutObj).getLayout();
   
    else
      lay = (Layout) layoutObj;
   
    try {
      Layout nObj = lf.newInstance(type);
      pm.register(nObj);
     
      Item e = new Item();
      nObj.setParent(e);
      e.setLayout(nObj);
     
      if (lay != null)
        ((CompositeLayout) lay).addItem(e);
      else
      {
        NamedItem ni = (NamedItem)layoutObj;
        nObj.setParent(ni);
        ni.setLayout(nObj);
      }
     
    } catch (ProcessingException e) {
      e.printStackTrace();
View Full Code Here

     
      // get layout element:
    Object layoutObj = getLayoutElement (layout, parent, "", 1);
    if (layoutObj == null) return;
   
    Layout lay;
   
    if (layoutObj instanceof NamedItem)
      lay =  ((NamedItem)layoutObj).getLayout();
    else
      lay = (Layout) layoutObj;
   
    // add tab:
    if(lay != null && lay.getName().equals("tab")) {
     
      NamedItem tab = new NamedItem();
      tab.setName(name);
      ((CompositeLayout) lay).addItem(tab);
     
    } else {
     
      try {
       
        Layout tab = lf.newInstance("tab");
        pm.register(tab);
       
        NamedItem e = new NamedItem();
        e.setName(name);
       
View Full Code Here

    /* (non-Javadoc)
     * @see org.apache.cocoon.portal.event.Subscriber#inform(org.apache.cocoon.portal.event.Event)
     */
    public void inform(Event event) {
        FullScreenCopletEvent e = (FullScreenCopletEvent) event;
        final Layout startingLayout = (CopletLayout)e.getLayout();
        PortalService portalService = null;
        try {
            portalService = (PortalService) this.manager.lookup(PortalService.ROLE);
            final Layout old = portalService.getEntryLayout(null);
            if ( old != null && old instanceof CopletLayout) {
                ((CopletLayout)old).getCopletInstanceData().setAspectData("fullScreen", Boolean.FALSE);
            }
            portalService.setEntryLayout( null, startingLayout );
            if ( startingLayout != null && startingLayout instanceof CopletLayout) {
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

     */
    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

       
        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));
            } else {
                FullScreenCopletEvent event = new FullScreenCopletEvent( cid, layout );
                XMLUtils.createElement(handler, "fullscreen-uri", service.getComponentManager().getLinkService().getLinkURI(event));
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.