pbwest 2004/06/29 00:34:22
Modified: src/java/org/apache/fop/area Tag: FOP_0-20-0_Alt-Design
AreaFrame.java
Log:
Documentation changes and code re-arragement.
Removed redundant getWritingMode method.
Added double getBefore, getAfter, getStart & getEnd methods.
WIP on incorporating reference-orientation.
Revision Changes Path
No revision
No revision
1.1.2.8 +107 -24 xml-fop/src/java/org/apache/fop/area/Attic/AreaFrame.java
Index: AreaFrame.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/Attic/AreaFrame.java,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -r1.1.2.7 -r1.1.2.8
--- AreaFrame.java 17 Jun 2004 11:27:27 -0000 1.1.2.7
+++ AreaFrame.java 29 Jun 2004 07:34:22 -0000 1.1.2.8
@@ -42,7 +42,10 @@
protected Point2D contentOffset = null;
/**
- * @param writingMode
+ * Instantiates an <code>AreaFrame</code> with zero dimensions and offset,
+ * whose contents and contentOffset are null
+ * @param area the <code>Area</code> on which this <code>AreaFrame</code>
+ * is being defined
*/
public AreaFrame(Area area) {
area.super(area.frameWritingMode);
@@ -58,7 +61,8 @@
}
/**
- * Instantiates a frame with 0-width edges.
+ * Instantiates a frame with 0-width edges around the given
+ * <code>AreaGeometry</code> contents
* @param contents the contained rectangle
*/
public AreaFrame(Area area, AreaGeometry contents) {
@@ -110,10 +114,6 @@
this.contentOffset = contentOffset;
}
- public int getWritingMode() {
- return writingMode;
- }
-
/**
* Sets the contents rectangle. The dimensions of <code>this</code> are
* adjusted to the difference between the current framed contents and
@@ -145,6 +145,11 @@
contentOffset = offset;
}
+ /**
+ * Gets the offset of the <i>contents</i> rectangle's Java2D origin point
+ * from the Java2D origin point of the <code>AreaFrame</code>.
+ * @return the offset as a <code>Point2D</code>.
+ */
public Point2D getContentOffset() {
return contentOffset;
}
@@ -169,6 +174,20 @@
}
/**
+ * Gets the width of the before edge of the <code>AreaFrame</code>
+ * @return the width in user co-ordinate units (points)
+ */
+ public double getBefore() {
+ try {
+ return getAbsoluteEdgeWidth(
+ WritingMode.getCorrespondingAbsoluteEdge(
+ writingMode, WritingMode.BEFORE));
+ } catch (PropertyException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
* Sets the start edge width of the frame. The <code>contents</code> size
* is unaffected, but the size of the frame (<code>this</code>) will
* change. The width will vary by the difference between the previous and
@@ -188,6 +207,20 @@
}
/**
+ * Gets the width of the start edge of the <code>AreaFrame</code>
+ * @return the width in user co-ordinate units (points)
+ */
+ public double getStart() {
+ try {
+ return getAbsoluteEdgeWidth(
+ WritingMode.getCorrespondingAbsoluteEdge(
+ writingMode, WritingMode.START));
+ } catch (PropertyException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
* Sets the after edge width of the frame. The <code>contents</code> size
* and the <code>contentOffset</code> are unaffected, but the size of the
* frame (<code>this</code>) will change. The height will vary by the
@@ -206,6 +239,20 @@
}
/**
+ * Gets the width of the after edge of the <code>AreaFrame</code>
+ * @return the width in user co-ordinate units (points)
+ */
+ public double getAfter() {
+ try {
+ return getAbsoluteEdgeWidth(
+ WritingMode.getCorrespondingAbsoluteEdge(
+ writingMode, WritingMode.AFTER));
+ } catch (PropertyException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
* Sets the end edge width of the frame. The <code>contents</code> size
* and the <code>contentOffset</code> are unaffected, but the size of the
* frame (<code>this</code>) will change. The width will vary by the
@@ -223,6 +270,26 @@
}
}
+ /**
+ * Gets the width of the end edge of the <code>AreaFrame</code>
+ * @return the width in user co-ordinate units (points)
+ */
+ public double getEnd() {
+ try {
+ return getAbsoluteEdgeWidth(
+ WritingMode.getCorrespondingAbsoluteEdge(
+ writingMode, WritingMode.END));
+ } catch (PropertyException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Sets an absolute edge width between the <code>AreaFrame</code> and the
+ * <code>contents</code> rectangle.
+ * @param edge absolute edge as defined in <code>WritingMode</code>.
+ * @param width to set in user co-ordinate units (points).
+ */
public void setAbsoluteEdgeWidth(int edge, double width) {
switch (edge) {
case WritingMode.TOP:
@@ -260,6 +327,14 @@
}
/**
+ * Gets the width of the top edge of the <code>AreaFrame</code>
+ * @return the width in user co-ordinate units (points)
+ */
+ public double getTop() {
+ return contentOffset.getY();
+ }
+
+ /**
* Sets the left edge width of the frame. The <code>contents</code> size
* is unaffected, but the size of the frame (<code>this</code>) will
* change. The width will vary by the difference between the previous and
@@ -276,6 +351,14 @@
}
/**
+ * Gets the width of the left edge of the <code>AreaFrame</code>
+ * @return the width in user co-ordinate units (points)
+ */
+ public double getLeft() {
+ return contentOffset.getX();
+ }
+
+ /**
* Sets the bottom edge width of the frame. The <code>contents</code> size
* and the <code>contentOffset</code> are unaffected, but the size of the
* frame (<code>this</code>) will change. The height will vary by the
@@ -289,6 +372,14 @@
}
/**
+ * Gets the width of the bottom edge of the <code>AreaFrame</code>
+ * @return the width in user co-ordinate units (points)
+ */
+ public double getBottom() {
+ return getHeight() - contentOffset.getY() - contents.getHeight();
+ }
+
+ /**
* Sets the right edge width of the frame. The <code>contents</code> size
* and the <code>contentOffset</code> are unaffected, but the size of the
* frame (<code>this</code>) will change. The width will vary by the
@@ -301,6 +392,14 @@
setRect(getX(), getY(), getWidth() + diff, getHeight());
}
+ /**
+ * Gets the width of the right edge of the <code>AreaFrame</code>
+ * @return the width in user co-ordinate units (points)
+ */
+ public double getRight() {
+ return getWidth() - contentOffset.getX() - contents.getWidth();
+ }
+
public double getAbsoluteEdgeWidth(int edge) {
switch (edge) {
case WritingMode.TOP:
@@ -315,22 +414,6 @@
throw new RuntimeException(
"Invalid absolute writing mode: " + edge);
}
- }
-
- public double getTop() {
- return contentOffset.getY();
- }
-
- public double getLeft() {
- return contentOffset.getX();
- }
-
- public double getBottom() {
- return getHeight() - contentOffset.getY() - contents.getHeight();
- }
-
- public double getRight() {
- return getWidth() - contentOffset.getX() - contents.getWidth();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]