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

Norman Richards norman.richards at jboss.com
Tue Jul 10 19:55:22 EDT 2007


  User: nrichards
  Date: 07/07/10 19:55:22

  Modified:    src/pdf/org/jboss/seam/pdf/ui  UIFont.java
  Log:
  JBSEAM-1039: rework UIFont to allow for alternative encodings
  
  Revision  Changes    Path
  1.9       +47 -21    jboss-seam/src/pdf/org/jboss/seam/pdf/ui/UIFont.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: UIFont.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/pdf/org/jboss/seam/pdf/ui/UIFont.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -b -r1.8 -r1.9
  --- UIFont.java	3 Apr 2007 17:15:45 -0000	1.8
  +++ UIFont.java	10 Jul 2007 23:55:22 -0000	1.9
  @@ -1,11 +1,7 @@
   package org.jboss.seam.pdf.ui;
   
  -import java.awt.Color;
  -
   import javax.faces.context.*;
  -
   import org.jboss.seam.pdf.ITextUtils;
  -
   import com.lowagie.text.*;
   
   public class UIFont
  @@ -15,13 +11,34 @@
   
       Font   font; 
       
  -    String familyName;
  +    String name;
  +    String encoding;
       int    size   = Font.UNDEFINED;
       String style; 
  -    Color  color;
  +    String color;
  +
  +    public String getName() {
  +        return (String) valueBinding("name", name);
  +    }
  +
  +    public void setFamily(String name) {
  +        this.name = name;
  +    }
  +    
  +    public void setName(String name) {
  +        this.name = name;
  +    }
  +       
  +    public String getEncoding() {
  +        return (String) valueBinding("encoding", encoding);
  +    }
   
  -    public void setFamily(String familyName) {
  -        this.familyName = familyName;
  +    public void setEncoding(String encoding) {
  +        this.encoding = encoding;
  +    }
  +
  +    public int getSize() {
  +        return (Integer) valueBinding("size", size);
       }
   
       public void setSize(int size) {
  @@ -31,11 +48,19 @@
       public void setStyle(String style) {
           this.style = style;
       }
  +    public String getStyle() {
  +        return (String) valueBinding("style", style);
  +    }
  +    
  +    public String getColor() {
  +        return (String) valueBinding("color", color);
  +    }
       
       public void setColor(String color) {
  -        this.color = ITextUtils.colorValue(color);
  +        this.color = color;
       }
   
  +    
       @Override
       public Font getFont() {
           return font;
  @@ -53,19 +78,18 @@
       
       @Override
       public void createITextObject(FacesContext context) {
  -        familyName = (String) valueBinding(context, "familyName", familyName);
  -        int family = (familyName==null) ? Font.UNDEFINED :  Font.getFamilyIndex(familyName);        
  -        size = (Integer) valueBinding(context, "size", size);        
  -        
  -        font = new Font(family, size);
  +        if (encoding == null) {
  +            font = FontFactory.getFont(getName(), getSize());
  +        } else {
  +            font = FontFactory.getFont(getName(), getEncoding(), getSize());
  +        }
   
  -        style = (String) valueBinding(context, "style", style);
  -        if (style != null) {
  -            font.setStyle(style);
  +        if (getStyle() != null) {
  +            font.setStyle(getStyle());
           }
           
  -        if (color != null) {
  -            font.setColor(color);
  +        if (getColor() != null) {
  +            font.setColor(ITextUtils.colorValue(getColor()));
           }
       }
   
  @@ -73,4 +97,6 @@
       public void handleAdd(Object o) {
           addToITextParent(o);
       }
  +
  +
   }
  
  
  



More information about the jboss-cvs-commits mailing list