Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| http://www.jpicedt.org
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## jpicedt.graphic.io.formatter
Class XmlAttributeSet

    java.lang.Object
      java.util.AbstractMap
          java.util.HashMap
              jpicedt.graphic.io.formatter.XmlAttributeSet

All Implemented Interfaces:
  Cloneable, JPICConstants, Map, PicObjectConstants, Serializable

public class XmlAttributeSet
extends HashMap
implements PicObjectConstants, JPICConstants

A map that contains XML-like name=value pairs, to be ultimately formatted as XML. With respect to jpicedt.graphic.element.AttributeSet, this is more XML-oriented, and not all attributes contained in AttributeSet are included in this map so as to reduce the size of the ultimate StringBuffer. In comparison with the older scheme, where we would directly append succesive XML-formatted name=value pairs to the main StringBuffer, this offers the benefit of avoiding redundant definition of XML parameters, which XML strictl forbids.

Since:
  jpicedt 1.4.pre5
Author:
  Sylvain Reynal
See Also:
  Serialized Form

Field Summary

Fields inherited from interface jpicedt.graphic.model.PicObjectConstants
`ARROW_GLOBAL_SCALE_LENGTH, ARROW_GLOBAL_SCALE_WIDTH, ARROW_INSET_SCALE, ARROW_LENGTH_SCALE, ARROW_WIDTH_LINEWIDTH_SCALE, ARROW_WIDTH_MINIMUM_MM, BRACKET_LENGTH_SCALE, CROSSHATCH, CROSSHATCH_FILLED, DASH_OPAQUE, DASH_TRANSPARENT, DASH1, DASH2, DASH3, DASHED, DIMEN, DOT_SEP, DOT_SEP1, DOT_SEP2, DOT_SEP3, DOTTED, DOUBLE_COLOR, DOUBLE_LINE, DOUBLE_SEP, FILL_COLOR, FILL_STYLE, HATCH_ANGLE, HATCH_COLOR, HATCH_SEP, HATCH_WIDTH, HLINES, HLINES_FILLED, INNER, LEFT_ARROW, LINE_COLOR, LINE_STYLE, LINE_WIDTH, MIDDLE, NONE, OUTER, OVER_STRIKE, OVER_STRIKE_COLOR, OVER_STRIKE_WIDTH, POLYDOTS_ANGLE, POLYDOTS_CIRCLE, POLYDOTS_DISK, POLYDOTS_PENTAGON, POLYDOTS_PENTAGON_FILLED, POLYDOTS_PLUS, POLYDOTS_SCALE_H, POLYDOTS_SCALE_V, POLYDOTS_SIZE_LINEWIDTH_SCALE, POLYDOTS_SIZE_MINIMUM_MM, POLYDOTS_SQUARE, POLYDOTS_SQUARE_FILLED, POLYDOTS_STYLE, POLYDOTS_SUPERIMPOSE, POLYDOTS_TRIANGLE, POLYDOTS_TRIANGLE_FILLED, PS_POINT, PST_CUSTOM, RBRACKET_LENGTH_SCALE, RIGHT_ARROW, SHADOW, SHADOW_ANGLE, SHADOW_COLOR, SHADOW_SIZE, SOLID, TBAR_WIDTH_LINEWIDTH_SCALE, TBAR_WIDTH_MINIMUM_MM, TEXT_BOX_CIRCLE, TEXT_BOX_NO_FRAME, TEXT_BOX_OVAL, TEXT_BOX_RECTANGLE, TEXT_FRAME, TEXT_HALIGN_CENTER, TEXT_HALIGN_LEFT, TEXT_HALIGN_RIGHT, TEXT_HOR_ALIGN, TEXT_ROTATION, TEXT_VALIGN_BASELINE, TEXT_VALIGN_BOTTOM, TEXT_VALIGN_CENTER, TEXT_VALIGN_TOP, TEXT_VERT_ALIGN, VLINES, VLINES_FILLED`

Fields inherited from interface jpicedt.graphic.io.formatter.JPICConstants
`CR_LF, CR_LF_TAB`

Constructor Summary
`XmlAttributeSet()` Constructs an empty map

Method Summary
`protected String` | `colorToHex(Color c)` Convert the given Color to a XML-like RGB string, each colour being expressed in the hexadecimal radix
`protected void` | `putCommonAttributes(Element obj)` Fills the given map with XML-like entries (name->value will translate into name="value" once text formatted) for common attributes of the given Element, that is, attributes specific to a given subclass of Element are not included here, but should be handled directly by the appropriate formatter.
`protected void` | `putNameValuePair(Object name, boolean bol)` Given attribute name and value, append a name/value entry to the given map.
`protected void` | `putNameValuePair(Object name, Color col, Color def)` Given attribute name and value, append a name/value entry to the given map if value differs from the given default value.
`protected void` | `putNameValuePair(Object name, double value)` Given attribute name and value, append a name/value entry to the given map.
`protected void` | `putNameValuePair(Object name, double[] values)` Given attribute name and an array of doubles, append a name/value entry to the given map.
`protected void` | `putNameValuePair(Object name, double value, double def)` Given attribute name and value, append a name/value entry to the given map if value differs from the given default value.
`protected void` | `putNameValuePair(Object name, PicPoint pt)` Given attribute name and value, append a name/value entry to the given map
`protected void` | `putNameValuePair(Object name, PicPoint[] values)` Given attribute name and an array of PicPoint's, append a name/value entry to the given map.
`protected void` | `putNameValuePair(Object name, String value)` Given attribute name and value, append a name/value entry to the given map.
`protected StringBuffer` | `toXML()` Returns a buffer constructed by iterating over the entries in this and appending a name="value" string to the buffer for each attribute.

Methods inherited from class java.util.HashMap
`clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values`

Methods inherited from class java.util.AbstractMap
`equals, hashCode, toString`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.Map
`equals, hashCode`

Constructor Detail

### XmlAttributeSet

    public XmlAttributeSet()

  Constructs an empty map

Method Detail

### toXML

    protected StringBuffer toXML()

  Returns a buffer constructed by iterating over the entries in this and appending a name="value" string to the buffer for each attribute.

### putCommonAttributes

    protected void putCommonAttributes(Element obj)

  Fills the given map with XML-like entries (name->value will translate into name="value" once text formatted) for common attributes of the given Element, that is, attributes specific to a given subclass of Element are not included here, but should be handled directly by the appropriate formatter.

  Attributes handled in this method include stroke-, fill-, shadow- and double-line attributes, as well as arrows, and are appended only if they differ from the default value in PicAttributeSet. See documentation on top of this class for details on the JPIC-XML syntax.

  Not supported yet : "border" and "bordercolor"

### putNameValuePair

    protected void putNameValuePair(Object name,
                                    String value)

  Given attribute name and value, append a name/value entry to the given map.

### putNameValuePair

    protected void putNameValuePair(Object name,
                                    Color col,
                                    Color def)

  Given attribute name and value, append a name/value entry to the given map if value differs from the given default value.

### putNameValuePair

    protected void putNameValuePair(Object name,
                                    boolean bol)

  Given attribute name and value, append a name/value entry to the given map.

### putNameValuePair

    protected void putNameValuePair(Object name,
                                    PicPoint pt)

  Given attribute name and value, append a name/value entry to the given map

### putNameValuePair

    protected void putNameValuePair(Object name,
                                    double value)

  Given attribute name and value, append a name/value entry to the given map. double are formatted with two-digit precision.

### putNameValuePair

    protected void putNameValuePair(Object name,
                                    double value,
                                    double def)

  Given attribute name and value, append a name/value entry to the given map if value differs from the given default value. double are formatted with two-digit precision.

### putNameValuePair

    protected void putNameValuePair(Object name,
                                    double[] values)

  Given attribute name and an array of doubles, append a name/value entry to the given map. doubles are formatted with two-digit precision, and are separated by semicolons.

### putNameValuePair

    protected void putNameValuePair(Object name,
                                    PicPoint[] values)

  Given attribute name and an array of PicPoint's, append a name/value entry to the given map. Points are formatted by means of their toString() method, and are separated by semicolons.

### colorToHex

    protected String colorToHex(Color c)

  Convert the given Color to a XML-like RGB string, each colour being expressed in the hexadecimal radix

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| http://www.jpicedt.org
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug : syd@jpicedt.org