Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.

1 /* 2 * This file is part of the Echo Web Application Framework (hereinafter "Echo").3 * Copyright (C) 2002-2005 NextApp, Inc.4 *5 * Version: MPL 1.1/GPL 2.0/LGPL 2.16 *7 * The contents of this file are subject to the Mozilla Public License Version8 * 1.1 (the "License"); you may not use this file except in compliance with9 * the License. You may obtain a copy of the License at10 * http://www.mozilla.org/MPL/11 *12 * Software distributed under the License is distributed on an "AS IS" basis,13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License14 * for the specific language governing rights and limitations under the15 * License.16 *17 * Alternatively, the contents of this file may be used under the terms of18 * either the GNU General Public License Version 2 or later (the "GPL"), or19 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),20 * in which case the provisions of the GPL or the LGPL are applicable instead21 * of those above. If you wish to allow use of your version of this file only22 * under the terms of either the GPL or the LGPL, and not to allow others to23 * use your version of this file under the terms of the MPL, indicate your24 * decision by deleting the provisions above and replace them with the notice25 * and other provisions required by the GPL or the LGPL. If you do not delete26 * the provisions above, a recipient may use your version of this file under27 * the terms of any one of the MPL, the GPL or the LGPL.28 */29 30 package nextapp.echo2.app;31 32 importjava.io.Serializable;33 34 /**35 * Describes how an image should 'fill' a particular component or region of36 * the user interface. Includes information about the image itself, its37 * positioning, repetition, and scrolling.38 */39 publicclass FillImage 40 implementsSerializable {41 42 publicstaticfinalint NO_REPEAT = 0;43 publicstaticfinalint REPEAT_HORIZONTAL = 1;44 publicstaticfinalint REPEAT_VERTICAL = 2;45 publicstaticfinalint REPEAT = 3;46 47 privateImageReference image;48 privateExtent horizontalOffset;49 privateExtent verticalOffset;50 privateint repeat;51 52 /**53 * Creates a new <code>FillImage</code> with no horizontal/vertical 54 * offset that scrolls with content and repeats both horizontally and 55 * vertically.56 * 57 * @param image the <code>ImageReference</code> to be displayed in the 58 * fill59 */60 public FillImage(ImageReference image) {61 this(image, null, null, REPEAT);62 }63 64 /**65 * Creates a new <code>FillImage</code>.66 * 67 * @param image the <code>ImageReference</code> to be displayed in the 68 * fill69 * @param horizontalOffset the horizontal offset of the fill image:70 * Positive values indicate an offset from the left side of the 71 * region.72 * Negative values indicate an offset from the right side of the 73 * region.74 * Both fixed and percentage units are supported.75 * @param verticalOffset the vertical offset of the fill image:76 * Positive values indicate an offset from the top of the region.77 * Negative values indicate an offset from the bottom of the region.78 * Both fixed and percentage units are supported.79 * @param repeat the repeat mode of the image, one of the following values:80 * <ul>81 * <li><code>NO_REPEAT</code></li>82 * <li><code>REPEAT_HORIZONTAL</code></li>83 * <li><code>REPEAT_VERTICAL</code></li>84 * <li><code>REPEAT</code> (the default)</li>85 * </ul>86 */87 public FillImage(ImageReference image, Extent horizontalOffset, Extent verticalOffset, int repeat) {88 super();89 this.image = image;90 this.horizontalOffset = horizontalOffset;91 this.verticalOffset = verticalOffset;92 this.repeat = repeat;93 }94 95 /**96 * @see java.lang.Object#equals(java.lang.Object)97 */98 publicboolean equals(Object o) {99 if (!(o instanceofFillImage)) {100 returnfalse;101 }102 FillImage that = (FillImage) o;103 if (this.repeat != that.repeat) {104 returnfalse;105 }106 if (!(this.image == that.image || (this.image != null && this.image.equals(that.image)))) {107 returnfalse;108 }109 if (!(this.horizontalOffset == that.horizontalOffset || 110 (this.horizontalOffset != null && this.horizontalOffset.equals(that.horizontalOffset)))) {111 returnfalse;112 }113 if (!(this.verticalOffset == that.verticalOffset || 114 (this.verticalOffset != null && this.verticalOffset.equals(that.verticalOffset)))) {115 returnfalse;116 }117 returntrue;118 }119 120 /**121 * Returns the horizontal offset of the fill image.122 * Positive values indicate an offset from the left side of the region.123 * Negative values indicate an offset from the right side of the region.124 * 125 * @return the horizontal offset126 */127 publicExtent getHorizontalOffset() {128 return horizontalOffset;129 }130 /**131 * Returns the fill image.132 * 133 * @return the fill image134 */135 publicImageReference getImage() {136 return image;137 }138 139 /**140 * Returns the repetition mode of the image.141 * 142 * @return the repetition mode, one of the following values:143 * <ul>144 * <li><code>NO_REPEAT</code></li>145 * <li><code>REPEAT_HORIZONTAL</code></li>146 * <li><code>REPEAT_VERTICAL</code></li>147 * <li><code>REPEAT</code> (the default)</li>148 * </ul>149 */150 publicint getRepeat() {151 return repeat;152 }153 154 /**155 * Returns the vertical offset of the fill image.156 * Positive values indicate an offset from the top of the region.157 * Negative values indicate an offset from the bottom of the region.158 * 159 * @return the vertical offset160 */161 publicExtent getVerticalOffset() {162 return verticalOffset;163 }164 }165