Package diva.canvas.toolbox
Class GraphicsParser
- java.lang.Object
-
- diva.canvas.toolbox.GraphicsParser
-
public class GraphicsParser extends java.lang.Object
A collection of utilities to help parsing graphics from strings and other kinds of external storage.- Version:
- $Id$
- Author:
- John Reekie
-
-
Constructor Summary
Constructors Constructor Description GraphicsParser()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PaintedObject
createPaintedObject(java.lang.String type, java.lang.String attributes, java.lang.String content)
Create a new painted object.static PaintedObject
createPaintedObject(java.lang.String type, java.util.Map attributes)
Create a new painted object.static PaintedObject
createPaintedObject(java.lang.String type, java.util.Map attributes, java.lang.String content)
Create a new painted object.static void
hashAttributes(java.lang.String s, java.util.Map map)
Given a XML-style attribute string and a hash-table, add each attribute and its value to the table.
-
-
-
Method Detail
-
createPaintedObject
public static PaintedObject createPaintedObject(java.lang.String type, java.lang.String attributes, java.lang.String content)
Create a new painted object. The element is parsed from two strings, the first being a representation of the element type, and the second being an XML-style attribute string. Any attributes that are not recognized will be ignored. Legal types and their attributes are:- line coords=vertex-list fill=color width=integer
- rectangle coords=x y width height fill=color outline=color width=integer
- ellipse coords=x y width height fill=color outline=color width=integer
- polygon coords=vertex-list fill=color outline=color width=integer
- text coords=x y fill=color font=font-name size=int style=bold|italic|plain
-
createPaintedObject
public static PaintedObject createPaintedObject(java.lang.String type, java.util.Map attributes, java.lang.String content)
Create a new painted object. The first argument is a string representation of the element type, and the second is a hash-table containing attributes of the object. Any attributes that are not recognized will be ignored. See the add(String, String) for a description of legal types and their attributes.
-
createPaintedObject
public static PaintedObject createPaintedObject(java.lang.String type, java.util.Map attributes)
Create a new painted object. The first argument is a string representation of the element type, and the second is a hash-table containing attributes of the object. Any attributes that are not recognized will be ignored. See the add(String, String) for a description of legal types and their attributes.
-
hashAttributes
public static void hashAttributes(java.lang.String s, java.util.Map map)
Given a XML-style attribute string and a hash-table, add each attribute and its value to the table.FIXME: this sucks.
-
-