title: GWT CSS String Parser
body: <p>Does gwt have a built in parser for converting css based strings to java constructs?</p>
  
  <p>IE I'm interested in writing my own widget that takes for instance height/width:</p>
  
  <pre><code>public class MyWidget extends Composite{
  
    private double width;
    private Style.Unit widthUnit;
    private double height;
    private Style.Unit heightUnit;
  
    /**
    * @width - width of my widget in CSS dimensions (ie. "10px", "1em" ...)
    * @height - height of my widget in CSS dimensions (ie. "10px", "1em" ...)
    */
    public MyWidget(String width, String height){
    // Parse out strings and set dimensions / units
    }
  }
  </code></pre>
  
  <p>I could easily do some regex on this but I thought I'd see if there was some sort of built in mechanism for this, I'd hate to re-invent...</p>
  
  <p>Also, I of course thought about just accepting <code>double width, Style.Unit widthUnit</code> in the constructor, but UiObject's <code>setWidth</code> takes a CSS string, so I still have to do some String munging, albeit the other way around.  Ideally I'd have 2 constructors to achieve both possibilities with a simple mechanism to parse the Strings / dimensions and Units properly.</p>
  
  <p><em>EDIT:</em></p>
  
  <p>Forgot to mention the REASON that i'd like to parse out these values:</p>
  
  <p>I'm trying to write a simple scroll panel (think iphone nav) so when a user clicks a button, a new 'item' scrolls in from the right.  </p>
  
  <p>On the backend this would be:<br>
  1) Fetch new scroll item<br>
  2) Extend scroll wrapper to accompany new item (this is where i need actual widths)<br>
  2) Append to item scroll wrapper<br>
  3) Animate scroll wrapper (by sliding left the width of 1 item) to expose newly added item to visible section of panel wrapper</p>
  
  <p>The reason I need original widths is because I'd like to extend my scroller panel by the width of the item added to it.  If I'm just getting strings, I can't exactly say <code>setWidth( currentWidth + itemWidth)</code></p>
  
  <p>Basically I'm trying to mimic <a href="http://flowplayer.org/tools/scrollable.html" rel="nofollow noreferrer">JQuery Tools Scroller</a></p>