You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by ay...@apache.org on 2006/11/10 18:00:33 UTC
svn commit: r473392 [3/3] - in
/incubator/harmony/enhanced/classlib/trunk/modules:
beans/src/main/java/java/beans/beancontext/
print/src/main/java/common/javax/print/attribute/
print/src/main/java/common/org/apache/harmony/x/print/
print/src/main/java/...
Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/attributes/MediaMargins.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/attributes/MediaMargins.java?view=diff&rev=473392&r1=473391&r2=473392
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/attributes/MediaMargins.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/attributes/MediaMargins.java Fri Nov 10 09:00:32 2006
@@ -14,10 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Irina A. Arkhipets
- * @version $Revision: 1.4 $
- */
/*
* MediaMargins.java
@@ -71,229 +67,231 @@
PrintRequestAttribute
{
-public static final int INCH = Size2DSyntax.INCH; // 25 400
-public static final int MM = Size2DSyntax.MM; // 1 000
-private int x1; // left margin
-private int x2; // right margin
-private int y1; // top margin
-private int y2; // bottom margin
-private int units; // original units
-
-/*
- * Constructs a MediaMargins object from integer values.
- *
- * Parameters:
- * x1 - left margin
- * y1 - top margin
- * x2 - right margin
- * y2 - bottom margin
- * units - units in which the values are expressed
- *
- * Throws IllegalArgumentException if margins value are < 0
- * or units < 1
- */
-public MediaMargins(int xx1, int yy1, int xx2, int yy2, int myunits) {
- if ((xx1 < 0) || (yy1 < 0) || (xx2 < 0) || (yy2 < 0) || (myunits < 1)) {
- throw new IllegalArgumentException("Incorrect margins!");
- }
- x1 = xx1 * myunits;
- y1 = yy1 * myunits;
- x2 = xx2 * myunits;
- y2 = yy2 * myunits;
- units = myunits;
-}
-
-/*
- * Constructs a MediaMargins object from float values.
- *
- * Parameters:
- * x1 - left margin
- * y1 - top margin
- * x2 - right margin
- * y2 - bottom margin
- * units - units in which the values are expressed
- *
- * Throws IllegalArgumentException if margins value are < 0
- * or units < 1
- */
-public MediaMargins(float xx1, float yy1, float xx2, float yy2, int myunits) {
- if ((xx1 < 0) || (yy1 < 0) || (xx2 < 0) || (yy2 < 0) || (myunits < 1)) {
- throw new IllegalArgumentException("Incorrect margins!");
- }
- x1 = Math.round(xx1 * myunits);
- y1 = Math.round(yy1 * myunits);
- x2 = Math.round(xx2 * myunits);
- y2 = Math.round(yy2 * myunits);
- units = myunits;
-}
-
-/*
- * Constructs a MediaMargins object from MediaSize and MediaPrintableArea.
- *
- * Parameters:
- * size - MediaSize attribute
- * area - MediaPrintableArea attribute
- *
- * Throws IllegalArgumentException if size is null or area is null or
- * if given MediaPrintableArea is too big for the given MediaSize.
- */
-
-public MediaMargins(MediaSize size, MediaPrintableArea area) {
- if ((size == null) || (area == null)) {
- throw new IllegalArgumentException("Incorrect margins!");
- }
- this.x1 = Math.round(area.getX(MM) * MM);
- this.x2 = Math.round((size.getX(MM) - area.getX(MM) - area.getWidth(MM))
- * MM);
- this.y1 = Math.round(area.getY(MM) * MM);
- this.y2 = Math.round((size.getY(MM) - area.getY(MM) - area.getHeight(MM))
- * MM);
- if ((x1 < 0) || (y1 < 0) || (x2 < 0) || (y2 < 0)) {
- throw new IllegalArgumentException("Incorrect margins!");
+ static final long serialVersionUID = -7745492737636484477L;
+
+ public static final int INCH = Size2DSyntax.INCH; // 25 400
+ public static final int MM = Size2DSyntax.MM; // 1 000
+ private int x1; // left margin
+ private int x2; // right margin
+ private int y1; // top margin
+ private int y2; // bottom margin
+ private int units; // original units
+
+ /*
+ * Constructs a MediaMargins object from integer values.
+ *
+ * Parameters:
+ * x1 - left margin
+ * y1 - top margin
+ * x2 - right margin
+ * y2 - bottom margin
+ * units - units in which the values are expressed
+ *
+ * Throws IllegalArgumentException if margins value are < 0
+ * or units < 1
+ */
+ public MediaMargins(int xx1, int yy1, int xx2, int yy2, int myunits) {
+ if ((xx1 < 0) || (yy1 < 0) || (xx2 < 0) || (yy2 < 0) || (myunits < 1)) {
+ throw new IllegalArgumentException("Incorrect margins!");
+ }
+ x1 = xx1 * myunits;
+ y1 = yy1 * myunits;
+ x2 = xx2 * myunits;
+ y2 = yy2 * myunits;
+ units = myunits;
}
-}
-
-/*
- * Returns whether this margins attribute is equal to the passed object.
- * The following conditions must be true:
- * - objectis not null;
- * - object is an instance of MediaMargins class
- * - The margins values are the same
- */
-public boolean equals(Object object) {
- if (object instanceof MediaMargins) {
- MediaMargins m = (MediaMargins) object;
- return (x1 == m.x1) && (y1 == m.y1) && (x2 == m.x2) && (y2 == m.y2);
- }
- return false;
-}
-
-/*
- * Returns the printing category attribute class
- * (an instance of java.lang.Class class).
- * For the MediaMargins the category class is MediaMargins class itself.
- */
-public final Class getCategory() {
- return MediaMargins.class;
-}
-
-/*
- * Returns the attribute category name - "media-margins"
- */
-public final String getName() {
- return "media-margins";
-}
-
-/*
- * Returns the left margin value in the specified units.
- *
- * Throws IllegalArgumentException if units < 1.
- */
-public float getX1(int myunits) {
- if (myunits < 1) {
- throw new IllegalArgumentException("units is less than 1");
+
+ /*
+ * Constructs a MediaMargins object from float values.
+ *
+ * Parameters:
+ * x1 - left margin
+ * y1 - top margin
+ * x2 - right margin
+ * y2 - bottom margin
+ * units - units in which the values are expressed
+ *
+ * Throws IllegalArgumentException if margins value are < 0
+ * or units < 1
+ */
+ public MediaMargins(float xx1, float yy1, float xx2, float yy2, int myunits) {
+ if ((xx1 < 0) || (yy1 < 0) || (xx2 < 0) || (yy2 < 0) || (myunits < 1)) {
+ throw new IllegalArgumentException("Incorrect margins!");
+ }
+ x1 = Math.round(xx1 * myunits);
+ y1 = Math.round(yy1 * myunits);
+ x2 = Math.round(xx2 * myunits);
+ y2 = Math.round(yy2 * myunits);
+ units = myunits;
}
- return ((float) x1) / myunits;
-}
-
-/*
- * Returns the top margin value in the specified units.
- *
- * Throws IllegalArgumentException if units < 1.
- */
-public float getY1(int myunits) {
- if (myunits < 1) {
- throw new IllegalArgumentException("units is less than 1");
+
+ /*
+ * Constructs a MediaMargins object from MediaSize and MediaPrintableArea.
+ *
+ * Parameters:
+ * size - MediaSize attribute
+ * area - MediaPrintableArea attribute
+ *
+ * Throws IllegalArgumentException if size is null or area is null or
+ * if given MediaPrintableArea is too big for the given MediaSize.
+ */
+
+ public MediaMargins(MediaSize size, MediaPrintableArea area) {
+ if ((size == null) || (area == null)) {
+ throw new IllegalArgumentException("Incorrect margins!");
+ }
+ this.x1 = Math.round(area.getX(MM) * MM);
+ this.x2 = Math.round((size.getX(MM) - area.getX(MM) - area.getWidth(MM))
+ * MM);
+ this.y1 = Math.round(area.getY(MM) * MM);
+ this.y2 = Math.round((size.getY(MM) - area.getY(MM) - area.getHeight(MM))
+ * MM);
+ if ((x1 < 0) || (y1 < 0) || (x2 < 0) || (y2 < 0)) {
+ throw new IllegalArgumentException("Incorrect margins!");
+ }
}
- return ((float) y1) / myunits;
-}
-
-/*
- * Returns the right margin value in the specified units.
- *
- * Throws IllegalArgumentException if units < 1.
- */
-public float getX2(int myunits) {
- if (myunits < 1) {
- throw new IllegalArgumentException("units is less than 1");
+
+ /*
+ * Returns whether this margins attribute is equal to the passed object.
+ * The following conditions must be true:
+ * - objectis not null;
+ * - object is an instance of MediaMargins class
+ * - The margins values are the same
+ */
+ public boolean equals(Object object) {
+ if (object instanceof MediaMargins) {
+ MediaMargins m = (MediaMargins) object;
+ return (x1 == m.x1) && (y1 == m.y1) && (x2 == m.x2) && (y2 == m.y2);
+ }
+ return false;
}
- return ((float) x2) / myunits;
-}
-
-/*
- * Returns the bottom margin value in the specified units.
- *
- * Throws IllegalArgumentException if units < 1.
- */
-public float getY2(int myunits) {
- if (myunits < 1) {
- throw new IllegalArgumentException("units is less than 1");
+
+ /*
+ * Returns the printing category attribute class
+ * (an instance of java.lang.Class class).
+ * For the MediaMargins the category class is MediaMargins class itself.
+ */
+ public final Class getCategory() {
+ return MediaMargins.class;
}
- return ((float) y2) / myunits;
-}
-
-/*
- * Returns the margins value as an array of 4 float values in the order
- * left, top, right, bottom in given units.
- *
- * Throws IllegalArgumentException if units < 1.
- */
-public float[] getMargins(int myunits) {
- return new float [] { getX1(myunits),
- getY1(myunits),
- getX2(myunits),
- getY2(myunits) };
-}
-
-/*
- * Returns a hash code value for the attribute
- */
-public int hashCode() {
- return ((x1 + x2) | ((y1 + y2) << 16));
-}
-
-/*
- * Returns a string version of this margins attribute in mm
- */
-public String toString() {
- return toString(MM, "mm");
-}
-
-/*
- * Returns a string version of this margins attribute in the given units.
- *
- * Parameters:
- * units - units conversion factor (for example, INCH or MM)
- * unitsName - units name string. If null, no units name is appended to
- * the result string.
- *
- * Throws IllegalArgumentException if units < 1.
- */
-public String toString(int myunits, String unitsName) {
- StringBuffer s = new StringBuffer();
- s.append("x1=");
- s.append(getX1(myunits));
- s.append(" y1=");
- s.append(getY1(myunits));
- s.append(" x2=");
- s.append(getX2(myunits));
- s.append(" y2=");
- s.append(getY2(myunits));
- s.append(" ");
- s.append((unitsName == null) ? "" : unitsName);
- return s.toString();
-}
-
-/*
- * Calculate MediaPrintableArea attribute for tis margins and the given
- * MediaSize object.
- */
-public MediaPrintableArea getMediaPrintableArea(MediaSize size) {
- return new MediaPrintableArea(getX1(MM),
- getY1(MM),
- size.getX(MM) - getX1(MM) - getX2(MM),
- size.getY(MM) - getY1(MM) - getY2(MM),
- MM);
-}
-
+
+ /*
+ * Returns the attribute category name - "media-margins"
+ */
+ public final String getName() {
+ return "media-margins";
+ }
+
+ /*
+ * Returns the left margin value in the specified units.
+ *
+ * Throws IllegalArgumentException if units < 1.
+ */
+ public float getX1(int myunits) {
+ if (myunits < 1) {
+ throw new IllegalArgumentException("units is less than 1");
+ }
+ return ((float) x1) / myunits;
+ }
+
+ /*
+ * Returns the top margin value in the specified units.
+ *
+ * Throws IllegalArgumentException if units < 1.
+ */
+ public float getY1(int myunits) {
+ if (myunits < 1) {
+ throw new IllegalArgumentException("units is less than 1");
+ }
+ return ((float) y1) / myunits;
+ }
+
+ /*
+ * Returns the right margin value in the specified units.
+ *
+ * Throws IllegalArgumentException if units < 1.
+ */
+ public float getX2(int myunits) {
+ if (myunits < 1) {
+ throw new IllegalArgumentException("units is less than 1");
+ }
+ return ((float) x2) / myunits;
+ }
+
+ /*
+ * Returns the bottom margin value in the specified units.
+ *
+ * Throws IllegalArgumentException if units < 1.
+ */
+ public float getY2(int myunits) {
+ if (myunits < 1) {
+ throw new IllegalArgumentException("units is less than 1");
+ }
+ return ((float) y2) / myunits;
+ }
+
+ /*
+ * Returns the margins value as an array of 4 float values in the order
+ * left, top, right, bottom in given units.
+ *
+ * Throws IllegalArgumentException if units < 1.
+ */
+ public float[] getMargins(int myunits) {
+ return new float [] { getX1(myunits),
+ getY1(myunits),
+ getX2(myunits),
+ getY2(myunits) };
+ }
+
+ /*
+ * Returns a hash code value for the attribute
+ */
+ public int hashCode() {
+ return ((x1 + x2) | ((y1 + y2) << 16));
+ }
+
+ /*
+ * Returns a string version of this margins attribute in mm
+ */
+ public String toString() {
+ return toString(MM, "mm");
+ }
+
+ /*
+ * Returns a string version of this margins attribute in the given units.
+ *
+ * Parameters:
+ * units - units conversion factor (for example, INCH or MM)
+ * unitsName - units name string. If null, no units name is appended to
+ * the result string.
+ *
+ * Throws IllegalArgumentException if units < 1.
+ */
+ public String toString(int myunits, String unitsName) {
+ StringBuffer s = new StringBuffer();
+ s.append("x1=");
+ s.append(getX1(myunits));
+ s.append(" y1=");
+ s.append(getY1(myunits));
+ s.append(" x2=");
+ s.append(getX2(myunits));
+ s.append(" y2=");
+ s.append(getY2(myunits));
+ s.append(" ");
+ s.append((unitsName == null) ? "" : unitsName);
+ return s.toString();
+ }
+
+ /*
+ * Calculate MediaPrintableArea attribute for tis margins and the given
+ * MediaSize object.
+ */
+ public MediaPrintableArea getMediaPrintableArea(MediaSize size) {
+ return new MediaPrintableArea(getX1(MM),
+ getY1(MM),
+ size.getX(MM) - getX1(MM) - getX2(MM),
+ size.getY(MM) - getY1(MM) - getY2(MM),
+ MM);
+ }
+
} /* End of MediaMargins */
Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/attributes/PPDMediaSizeName.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/attributes/PPDMediaSizeName.java?view=diff&rev=473392&r1=473391&r2=473392
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/attributes/PPDMediaSizeName.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/attributes/PPDMediaSizeName.java Fri Nov 10 09:00:32 2006
@@ -14,10 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Igor A. Pyankov
- * @version $Revision: 1.2 $
- */
package org.apache.harmony.x.print.attributes;
@@ -43,6 +39,9 @@
*
*/
public class PPDMediaSizeName extends MediaSizeName {
+
+ static final long serialVersionUID = -2117680157822011363L;
+
public static final PPDMediaSizeName s10x11 = new PPDMediaSizeName(0, 720, 792);
public static final PPDMediaSizeName s10x13 = new PPDMediaSizeName(1, 720, 936);
public static final PPDMediaSizeName s10x14 = new PPDMediaSizeName(2, 720, 1008);
@@ -551,4 +550,4 @@
}
return null;
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppAttributeGroup.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppAttributeGroup.java?view=diff&rev=473392&r1=473391&r2=473392
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppAttributeGroup.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppAttributeGroup.java Fri Nov 10 09:00:32 2006
@@ -14,10 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Igor A. Pyankov
- * @version $Revision: 1.2 $
- */
package org.apache.harmony.x.print.ipp;
import java.io.ByteArrayOutputStream;
@@ -29,6 +25,9 @@
* class IppAttributeGroup stores IPP attributes group
*/
public class IppAttributeGroup extends Vector {
+
+ static final long serialVersionUID = -2197671478629444252L;
+
/* According to RFC2910 (http://ietf.org/rfc/rfc2910.txt?number=2910):
*
* Each "attribute-group" field MUST be encoded with the "begin-
Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppAttributeGroupSet.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppAttributeGroupSet.java?view=diff&rev=473392&r1=473391&r2=473392
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppAttributeGroupSet.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppAttributeGroupSet.java Fri Nov 10 09:00:32 2006
@@ -14,11 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Igor A. Pyankov
- * @version $Revision: 1.2 $
- */
-
package org.apache.harmony.x.print.ipp;
import java.io.ByteArrayOutputStream;
@@ -32,6 +27,8 @@
* Set of IppAttributeGroup
*/
public class IppAttributeGroupSet extends Hashtable {
+
+ static final long serialVersionUID = -1273600082773438491L;
static protected void sortAttributes(Vector va) {
Object v1, v2;
@@ -199,4 +196,4 @@
return ab.toByteArray();
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppException.java?view=diff&rev=473392&r1=473391&r2=473392
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppException.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/IppException.java Fri Nov 10 09:00:32 2006
@@ -14,15 +14,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Igor A. Pyankov
- * @version $Revision: 1.2 $
- */
-
package org.apache.harmony.x.print.ipp;
public class IppException extends Exception {
+
+ static final long serialVersionUID = -5855422273043510539L;
+
IppException(String message) {
super(message);
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/util/IppMimeType.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/util/IppMimeType.java?view=diff&rev=473392&r1=473391&r2=473392
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/util/IppMimeType.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/common/org/apache/harmony/x/print/ipp/util/IppMimeType.java Fri Nov 10 09:00:32 2006
@@ -14,17 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- * @author Igor A. Pyankov
- * @version $Revision: 1.2 $
- */
-
package org.apache.harmony.x.print.ipp.util;
import org.apache.harmony.x.print.MimeType;
public class IppMimeType extends MimeType {
+ static final long serialVersionUID = 1492779006204043813L;
+
/*
* @param mimeType
*/
@@ -55,4 +52,4 @@
return s.toString();
}
-}
\ No newline at end of file
+}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/windows/org/apache/harmony/x/print/GDIClient.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/windows/org/apache/harmony/x/print/GDIClient.java?view=diff&rev=473392&r1=473391&r2=473392
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/windows/org/apache/harmony/x/print/GDIClient.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/print/src/main/java/windows/org/apache/harmony/x/print/GDIClient.java Fri Nov 10 09:00:32 2006
@@ -663,6 +663,8 @@
//----------------------- Internal classes -------------------------------------
private static class GDIMediaName extends MediaSizeName {
+
+ static final long serialVersionUID = 8176250163720875699L;
private static GDIMediaName staticMediaName = new GDIMediaName(-1);
private String mediaName = null;