|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcox.jmatt.java.MathTools.markup.Tag
cox.jmatt.java.MathTools.markup.svg.StyleTag
cox.jmatt.java.MathTools.markup.svg.DrawableContainerTag
public abstract class DrawableContainerTag
This class provides the abstract superclass for the SVG tags that can contain other tags (container tags) and the methods to add those tags quickly, easily, and conveniently (drawable). These include but are not limited to the grouping tags: <g>, <symbol>, <defs>, and <svg>. DCTag contains the necessary methods to add tags where they need to be and to handle the content from all subclasses.
The <defs> block (tag) is handled implicitly. Since it contains CSS stylesheets, groups, and symbols it is handled internally and never exposed. All elements that should go there do.
Note on default methods: This class extends StyleTag
, therefore it inherits all the methods to set default style and transform values. These
methods should not be used!! Each ContainerTag
should be customized individually, not by default! None of the methods is specifically blocked,
so they can be used if truly necessary, but such necessity should represent only the most extreme cases!
Nested Class Summary |
---|
Nested classes/interfaces inherited from class cox.jmatt.java.MathTools.markup.svg.StyleTag |
---|
StyleTag.TagKeys |
Field Summary |
---|
Fields inherited from class cox.jmatt.java.MathTools.markup.Tag |
---|
myTagName |
Constructor Summary | |
---|---|
protected |
DrawableContainerTag(StyleTag.TagKeys pKey)
Subclass constructor necessary for StyleTag functionality. |
Method Summary | |
---|---|
protected void |
_addContent(java.lang.String pContent)
Add something to the internal content. |
protected void |
_addCSS(java.lang.String pRule)
Add a rule to the CSS stylesheet. |
protected void |
_addDef(java.lang.String pDef)
Add something to the <defs> block, followed by a newline. |
protected java.lang.String |
_content()
Collect and present all the necessary content elements and other goodies in proper order and in proper form. |
protected void |
_setContent(java.lang.String pContent)
This method is only implemented to clear content. |
protected void |
_setDesc(java.lang.String pDesc)
Protected method to set the <desc> tag, which is also maintained here. |
protected void |
_setOBUS(java.lang.String pAttr,
boolean isUserSpace)
Method to set an attribute value to 'objectBoundingBox' (false) or 'userSpaceOnUse' (true). |
protected void |
_setPAR(java.lang.String par)
Set the 'preserveAspectRatio=' attribute on tags that can take it. |
protected void |
_setTitle(java.lang.String pTitle)
Method to set the <title< tag, which is maintained here but protected for only those tags where it is allowed. |
protected void |
_setViewBox(java.lang.String pBox)
Method to set the 'viewBox=' attribute, for those tags that need it. |
DrawableContainerTag |
add(StyleTag pTag)
Add a StyleTag to the internal content. |
DrawableContainerTag |
addRaw(java.lang.String pTagString)
Add a pre-String'ed tag to the internal content. |
DrawableContainerTag |
drawCircle(java.lang.Double X1,
java.lang.Double Y1,
java.lang.Double pRadius)
Add a <circle> tag to the current contents. |
DrawableContainerTag |
drawEllipse(java.lang.Double X1,
java.lang.Double Y1,
java.lang.Double radX,
java.lang.Double radY)
Add an <ellipse> tag to the current contents. |
DrawableContainerTag |
drawLine(java.lang.Double X1,
java.lang.Double Y1,
java.lang.Double X2,
java.lang.Double Y2)
Add a <line> tag to the current contents. |
DrawableContainerTag |
drawPath(java.lang.String pPath)
Add a pre-defined <path> to the current content. |
DrawableContainerTag |
drawPoint(double X1,
double Y1)
Add a point to the current graphic. |
DrawableContainerTag |
drawPolygon(java.lang.String pPoints)
Add a polygon to the current tag. |
DrawableContainerTag |
drawPolyline(java.lang.String pPoints)
Add a polyline to the current tag. |
DrawableContainerTag |
drawRectangle(java.lang.Double X1,
java.lang.Double Y1,
java.lang.Double pWidth,
java.lang.Double pHeight)
Add a <rectangle> tag to the current contents. |
DrawableContainerTag |
drawRectangle(java.lang.Double X1,
java.lang.Double Y1,
java.lang.Double pWidth,
java.lang.Double pHeight,
java.lang.Double radX,
java.lang.Double radY)
Add a rounded <rectangle> tag. |
DrawableContainerTag |
drawText(java.lang.Double X1,
java.lang.Double Y1,
java.lang.String pText)
Add text to the current contents. |
Methods inherited from class cox.jmatt.java.MathTools.markup.svg.StyleTag |
---|
_configureTag, _enableCopy, canHaveDefs, isInDefs, setDefaultPen, setDefaultStyle, setDefaultTransform, setPen, setStyle, setTransform |
Methods inherited from class cox.jmatt.java.MathTools.markup.Tag |
---|
_addAttribute, _addAttributes, _addNAttribute, _asBoolean, _asDouble, _asInt, _attributes, _clampNAttribute, _clampNAttribute, _fixKey, _setEnableXMLTag, badPizza, closeTag, configureTag, configureTagFromGlobalPizza, makeTag, openTag, reset, setID, toString, validString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected DrawableContainerTag(StyleTag.TagKeys pKey)
StyleTag
functionality.
Method Detail |
---|
protected void _setContent(java.lang.String pContent)
_setContent
in class Tag
protected java.lang.String _content()
_content
in class Tag
protected void _setTitle(java.lang.String pTitle)
protected void _setDesc(java.lang.String pDesc)
protected void _setViewBox(java.lang.String pBox)
Method to set the 'viewBox=' attribute, for those tags that need it. The argument is String, so care should be used in setting it.
The viewBox is set via a String of four space-separated numbers. The first two represent the minimum x- and y-values for the viewport, the last two are its maxima. This establishes the 'user coordinates' used for all other tags, so set carefully! It is generally best to set the viewBox once only and on the root <svg> tag. These values should also be set to a convenient number, like 100 user units per whatever unit is used on the root tag. So, for U.S. letter-sized paper (8.5 in. by 11 in.) the viewBox is '0 0 850 1100'.
protected void _setOBUS(java.lang.String pAttr, boolean isUserSpace)
pAttr
- The attribute whose value is 'objectBoundingBox' or 'userSpaceOnUse'.isUserSpace
- true for 'userSpaceOnUse' false for 'objectBoundingBox'.protected void _setPAR(java.lang.String par)
Set the 'preserveAspectRatio=' attribute on tags that can take it. This method expects a one-, two-, or three-character String. Each character causes the following actions:
Other characters have no effect, nor does the order in which the characters occur. The first three specifiers determine what to do when an image overlaps its bounding box. The remaining characters determine what to do if 'meet' or 'slice' is specified. Setting an 'x' specifier automatically sets the same 'y' specifier unless 'y' is already set. Setting a 'y' does not affect the 'x'.
protected void _addCSS(java.lang.String pRule)
protected void _addDef(java.lang.String pDef)
protected void _addContent(java.lang.String pContent)
public DrawableContainerTag add(StyleTag pTag)
Add a StyleTag
to the internal content. If the tag is null nothing happens. This method automatically detects tags that must appear in the
<defs> block and puts them there, others go to content. If 'pTag' is supposed to appear only in the <defs> block and the subclass adding it does
not have one the tag is ignored. The tags are converted to String when added so changing them afterward will not affect the data added.
Technically, a group tag ('<g>') should appear in the definitions but it can appear in the body of the document. In order to do this
groupTagInstance.toString()
must be added via the addRaw()
method. This also applies to other such tags: defs-block-inclusion
takes priority.
public DrawableContainerTag addRaw(java.lang.String pTagString)
public DrawableContainerTag drawLine(java.lang.Double X1, java.lang.Double Y1, java.lang.Double X2, java.lang.Double Y2)
public DrawableContainerTag drawCircle(java.lang.Double X1, java.lang.Double Y1, java.lang.Double pRadius)
public DrawableContainerTag drawPoint(double X1, double Y1)
MathDrawSVG
.
public DrawableContainerTag drawEllipse(java.lang.Double X1, java.lang.Double Y1, java.lang.Double radX, java.lang.Double radY)
public DrawableContainerTag drawRectangle(java.lang.Double X1, java.lang.Double Y1, java.lang.Double pWidth, java.lang.Double pHeight)
public DrawableContainerTag drawRectangle(java.lang.Double X1, java.lang.Double Y1, java.lang.Double pWidth, java.lang.Double pHeight, java.lang.Double radX, java.lang.Double radY)
public DrawableContainerTag drawText(java.lang.Double X1, java.lang.Double Y1, java.lang.String pText)
public DrawableContainerTag drawPath(java.lang.String pPath)
public DrawableContainerTag drawPolygon(java.lang.String pPoints)
public DrawableContainerTag drawPolyline(java.lang.String pPoints)
addPolygon()
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |