001: /*
002: * Version: MPL 1.1/GPL 2.0/LGPL 2.1
003: *
004: * "The contents of this file are subject to the Mozilla Public License
005: * Version 1.1 (the "License"); you may not use this file except in
006: * compliance with the License. You may obtain a copy of the License at
007: * http://www.mozilla.org/MPL/
008: *
009: * Software distributed under the License is distributed on an "AS IS"
010: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
011: * License for the specific language governing rights and limitations under
012: * the License.
013: *
014: * The Original Code is ICEfaces 1.5 open source software code, released
015: * November 5, 2006. The Initial Developer of the Original Code is ICEsoft
016: * Technologies Canada, Corp. Portions created by ICEsoft are Copyright (C)
017: * 2004-2006 ICEsoft Technologies Canada, Corp. All Rights Reserved.
018: *
019: * Contributor(s): _____________________.
020: *
021: * Alternatively, the contents of this file may be used under the terms of
022: * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"
023: * License), in which case the provisions of the LGPL License are
024: * applicable instead of those above. If you wish to allow use of your
025: * version of this file only under the terms of the LGPL License and not to
026: * allow others to use your version of this file under the MPL, indicate
027: * your decision by deleting the provisions above and replace them with
028: * the notice and other provisions required by the LGPL License. If you do
029: * not delete the provisions above, a recipient may use your version of
030: * this file under either the MPL or the LGPL License."
031: *
032: */
033:
034: package com.icesoft.faces.context.effects;
035:
036: /**
037: * Move an HTML element to a new position. Moves can be absolute or relative.
038: * Relative moves an element from it current position, absolute moves it from
039: * its begging position. (Here the HTML initially rendered it)
040: */
041: public class Move extends Effect {
042: private int x;
043: private int y;
044: private String mode;
045:
046: public Move() {
047: }
048:
049: /**
050: * Move an element to a new position
051: *
052: * @param x or left location
053: * @param y or top location
054: * @param mode can be relative or absolute
055: */
056: public Move(int x, int y, String mode) {
057: setX(x);
058: setY(y);
059: setMode(mode);
060: }
061:
062: /**
063: * Move an element to a new position. Mode is relative
064: *
065: * @param x or left location
066: * @param y or top location
067: */
068: public Move(int x, int y) {
069: setX(x);
070: setY(y);
071: setMode("relative");
072: }
073:
074: /**
075: * Get the X or left end position
076: *
077: * @return
078: */
079: public int getX() {
080: return x;
081: }
082:
083: /**
084: * Set the X or left end position
085: *
086: * @param x
087: */
088: public void setX(int x) {
089: this .x = x;
090: ea.add("x", x);
091: }
092:
093: /**
094: * Get the Y or top position
095: *
096: * @return
097: */
098: public int getY() {
099: return y;
100: }
101:
102: /**
103: * Set the Y or top position
104: *
105: * @param y
106: */
107: public void setY(int y) {
108: this .y = y;
109: ea.add("y", y);
110: }
111:
112: /**
113: * Get the mode of the move (absolute or relative)
114: *
115: * @return
116: */
117: public String getMode() {
118: return mode;
119: }
120:
121: /**
122: * Set the mode (absolute or realitve)
123: *
124: * @param mode
125: */
126: public void setMode(String mode) {
127: this .mode = mode;
128: ea.add("mode", mode);
129: }
130:
131: /**
132: * The javascript function name
133: *
134: * @return
135: */
136: public String getFunctionName() {
137: return "new Effect.Move";
138: }
139:
140: public int hasCode() {
141: return EffectHashCode.MOVE * (x * 1) * (y * 2)
142: + ("relative".equals(mode) ? 1 : 2);
143: }
144: }
|