[jboss-cvs] jboss-seam/src/pdf/org/jboss/seam/pdf/ui ...

Norman Richards norman.richards at jboss.com
Wed Jan 24 01:09:59 EST 2007


  User: nrichards
  Date: 07/01/24 01:09:59

  Modified:    src/pdf/org/jboss/seam/pdf/ui  UIDocument.java
  Log:
  finish pdf name support, make docstore truly conversation
  
  Revision  Changes    Path
  1.11      +24 -4     jboss-seam/src/pdf/org/jboss/seam/pdf/ui/UIDocument.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: UIDocument.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/pdf/org/jboss/seam/pdf/ui/UIDocument.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -b -r1.10 -r1.11
  --- UIDocument.java	20 Jan 2007 20:10:55 -0000	1.10
  +++ UIDocument.java	24 Jan 2007 06:09:59 -0000	1.11
  @@ -1,5 +1,6 @@
   package org.jboss.seam.pdf.ui;
   
  +import org.jboss.seam.core.Manager;
   import org.jboss.seam.pdf.ITextUtils;
   import org.jboss.seam.pdf.DocumentStore;
   import org.jboss.seam.pdf.DocumentStore.DocType;
  @@ -17,11 +18,10 @@
   {
       public static final String COMPONENT_TYPE   = "org.jboss.seam.pdf.ui.UIDocument";
       
  -    
  -    
       Document document;
       ByteArrayOutputStream stream;
       String id;
  +    String baseName;
       DocType docType;
       
       String type;
  @@ -188,7 +188,6 @@
                   break;
               }
   
  -            
               initMetaData(context);
               
               document.open();
  @@ -202,7 +201,11 @@
           response.startElement("meta", this);
           response.writeAttribute("http-equiv", "Refresh", null);
           
  -        String url = store.preferredUrlForContent(docType, id);
  +        baseName = baseNameForViewId(FacesContext.getCurrentInstance().getViewRoot().getViewId()); 
  +        String url = store.preferredUrlForContent(baseName, docType, id);
  +        
  +        url = Manager.instance().encodeConversationId(url);
  +        
           response.writeAttribute("content", "0; URL=" + url, null);
    
           response.endElement("meta");
  @@ -211,6 +214,20 @@
           response.startElement("body",this);
       }
   
  +    private String baseNameForViewId(String viewId) {
  +        int pos = viewId.lastIndexOf("/");
  +        if (pos != -1) {
  +            viewId = viewId.substring(pos+1);
  +        }
  +
  +        pos = viewId.lastIndexOf(".");
  +        if (pos!=-1) {
  +            viewId = viewId.substring(0,pos);
  +        }
  +        
  +        return viewId;
  +    }
  +
       @Override
       public void encodeEnd(FacesContext context) 
           throws IOException
  @@ -218,6 +235,7 @@
           document.close();
   
           DocumentStore.instance().saveData(id,
  +                                          baseName,
                                             docType,
                                             stream.toByteArray());        
   
  @@ -226,6 +244,8 @@
           response.endElement("html");
       
           removeITextObject();
  +        
  +        Manager.instance().beforeRedirect();
       }
   
       private DocType docTypeForName(String typeName) {    
  
  
  



More information about the jboss-cvs-commits mailing list