From a4bb0eb95961b33746514c4616a72b46550bfade Mon Sep 17 00:00:00 2001 From: konermann Date: Wed, 28 Oct 2015 10:36:08 +0000 Subject: [PATCH] added util/Dimension.java and used it in several classes instead of java.awt.Dimension.java so it works with the Headless package git-svn-id: https://svn.libreccm.org/ccm/trunk@3713 8810af33-2d31-482b-a856-94f89814c4df --- .../com/arsdigita/cms/ui/ImageBrowser.java | 2 +- .../mimetypes/image/BMPImageSizer.java | 2 +- .../mimetypes/image/GIFImageSizer.java | 2 +- .../mimetypes/image/ImageIOSizer.java | 2 +- .../arsdigita/mimetypes/image/ImageSizer.java | 2 +- .../mimetypes/image/JPEGImageSizer.java | 2 +- .../src/com/arsdigita/util/Dimension.java | 66 +++++++++++++++++++ 7 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 ccm-core/src/com/arsdigita/util/Dimension.java diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java b/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java index f6044a9c0..40d039d7d 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java @@ -43,7 +43,7 @@ import com.arsdigita.mimetypes.MimeType; import com.arsdigita.persistence.OID; import com.arsdigita.util.LockableImpl; import com.arsdigita.web.URL; -import java.awt.Dimension; +import com.arsdigita.util.Dimension; import java.math.BigDecimal; import org.apache.log4j.Logger; diff --git a/ccm-core/src/com/arsdigita/mimetypes/image/BMPImageSizer.java b/ccm-core/src/com/arsdigita/mimetypes/image/BMPImageSizer.java index a9ca2e305..b1e712196 100755 --- a/ccm-core/src/com/arsdigita/mimetypes/image/BMPImageSizer.java +++ b/ccm-core/src/com/arsdigita/mimetypes/image/BMPImageSizer.java @@ -18,7 +18,7 @@ */ package com.arsdigita.mimetypes.image; -import java.awt.Dimension; +import com.arsdigita.util.Dimension; import java.io.DataInputStream; import java.io.IOException; diff --git a/ccm-core/src/com/arsdigita/mimetypes/image/GIFImageSizer.java b/ccm-core/src/com/arsdigita/mimetypes/image/GIFImageSizer.java index 50ba58713..93659af0f 100755 --- a/ccm-core/src/com/arsdigita/mimetypes/image/GIFImageSizer.java +++ b/ccm-core/src/com/arsdigita/mimetypes/image/GIFImageSizer.java @@ -18,7 +18,7 @@ */ package com.arsdigita.mimetypes.image; -import java.awt.Dimension; +import com.arsdigita.util.Dimension; import java.io.DataInputStream; import java.io.IOException; diff --git a/ccm-core/src/com/arsdigita/mimetypes/image/ImageIOSizer.java b/ccm-core/src/com/arsdigita/mimetypes/image/ImageIOSizer.java index f9505edb4..f229017c7 100755 --- a/ccm-core/src/com/arsdigita/mimetypes/image/ImageIOSizer.java +++ b/ccm-core/src/com/arsdigita/mimetypes/image/ImageIOSizer.java @@ -1,6 +1,6 @@ package com.arsdigita.mimetypes.image; -import java.awt.Dimension; +import com.arsdigita.util.Dimension; import java.awt.image.BufferedImage; import java.io.DataInputStream; import java.io.IOException; diff --git a/ccm-core/src/com/arsdigita/mimetypes/image/ImageSizer.java b/ccm-core/src/com/arsdigita/mimetypes/image/ImageSizer.java index dd6f964c0..adbd2e64a 100755 --- a/ccm-core/src/com/arsdigita/mimetypes/image/ImageSizer.java +++ b/ccm-core/src/com/arsdigita/mimetypes/image/ImageSizer.java @@ -18,7 +18,7 @@ */ package com.arsdigita.mimetypes.image; -import java.awt.Dimension; +import com.arsdigita.util.Dimension; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; diff --git a/ccm-core/src/com/arsdigita/mimetypes/image/JPEGImageSizer.java b/ccm-core/src/com/arsdigita/mimetypes/image/JPEGImageSizer.java index 0b3e6f3e4..dd2aadbe3 100755 --- a/ccm-core/src/com/arsdigita/mimetypes/image/JPEGImageSizer.java +++ b/ccm-core/src/com/arsdigita/mimetypes/image/JPEGImageSizer.java @@ -20,7 +20,7 @@ package com.arsdigita.mimetypes.image; import com.arsdigita.mimetypes.util.GlobalizationUtil; -import java.awt.Dimension; +import com.arsdigita.util.Dimension; import java.io.DataInputStream; import java.io.IOException; import org.apache.log4j.Logger; diff --git a/ccm-core/src/com/arsdigita/util/Dimension.java b/ccm-core/src/com/arsdigita/util/Dimension.java new file mode 100644 index 000000000..17980f91f --- /dev/null +++ b/ccm-core/src/com/arsdigita/util/Dimension.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2003-2004 Red Hat Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.util; + +/** + * Almost the same as java.awt.Dimension + * + * @author Koalamann (konerman@tzi.de) + * @version $Date: 2015/10/28 $ + */ +public class Dimension { + + /** + * The width dimension; negative values can be used. + */ + public int width; + + /** + * The height dimension; negative values can be used. + */ + public int height; + + /** + * Creates an instance of Dimension with a width of zero and a + * height of zero. + */ + public Dimension() { + this(0, 0); + } + + /** + * Constructs a Dimension and initializes it to the specified + * width and specified height. + * + * @param width the specified width + * @param height the specified height + */ + public Dimension(int width, int height) { + this.width = width; + this.height = height; + } + + public double getWidth() { + return width; + } + + public double getHeight() { + return height; + } +}