import com.google.gwt.query.client.css.BorderColorProperty;
import com.google.gwt.query.client.css.RGBColor;
import com.google.gwt.query.client.js.JsNamedArray;
-import com.google.gwt.query.client.js.JsObjectArray;
-import com.google.gwt.query.client.js.JsRegexp;
+import com.google.gwt.regexp.shared.MatchResult;
+import com.google.gwt.regexp.shared.RegExp;
/**
* A pojo to store effect values.
}
// hexadecimal regex
- public static JsRegexp REGEX_HEX_COLOR_PATTERN = new JsRegexp(
- "#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})");
+ public static RegExp REGEX_HEX_COLOR_PATTERN = RegExp.compile("#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})");
private static JsNamedArray<int[]> htmlColorToRgb;
// rgb and rgba regex
- public static JsRegexp REGEX_RGB_COLOR_PATTERN = new JsRegexp(
- "rgba?\\(\\s*([0-9]{1,3}%?)\\s*,\\s*([0-9]{1,3}%?)\\s*,\\s*([0-9]{1,3}%?).*\\)$");
+ public static RegExp REGEX_RGB_COLOR_PATTERN =
+ RegExp.compile("rgba?\\(\\s*([0-9]{1,3}%?)\\s*,\\s*([0-9]{1,3}%?)\\s*,\\s*([0-9]{1,3}%?).*\\)$");
static {
htmlColorToRgb = JsNamedArray.create();
}
protected int[] parseColor(String color) {
- JsObjectArray<String> matches = REGEX_RGB_COLOR_PATTERN.exec(color);
+ MatchResult matches = REGEX_RGB_COLOR_PATTERN.exec(color);
if (matches != null) {
return parseRGBColor(matches);
}
return parseLiteralColor(color);
}
- private int[] parseHexColor(JsObjectArray<String> matches) {
- assert matches.length() == 2;
+ private int[] parseHexColor(MatchResult matches) {
+ assert matches.getGroupCount() == 2;
int[] result = new int[3];
- String hexCode = matches.get(1);
+ String hexCode = matches.getGroup(1);
int step = (hexCode.length() == 3) ? 1 : 2;
return htmlColorToRgb.get(color);
}
- private int[] parseRGBColor(JsObjectArray<String> matches) {
- assert matches.length() == 4;
+ private int[] parseRGBColor(MatchResult matches) {
+ assert matches.getGroupCount() == 4;
int[] result = new int[3];
for (int i = 1; i < 4; i++) {
- String valueString = matches.get(i);
+ String valueString = matches.getGroup(i);
int value = -1;
if (valueString.endsWith("%")) {
int percentage = Integer.parseInt(valueString.substring(0,
import com.google.gwt.query.client.GQuery;
import com.google.gwt.query.client.Properties;
import com.google.gwt.query.client.js.JsObjectArray;
-import com.google.gwt.query.client.js.JsRegexp;
import com.google.gwt.query.client.plugins.Effects;
import com.google.gwt.query.client.plugins.Effects.GQAnimation;
import com.google.gwt.query.client.plugins.effects.Fx.ColorFx;
import com.google.gwt.query.client.plugins.effects.Fx.ColorFx.BorderColorFx;
+import com.google.gwt.regexp.shared.MatchResult;
+import com.google.gwt.regexp.shared.RegExp;
/**
* Animation effects on any numeric CSS property.
}
}
- private static final String[] ATTRS_TO_SAVE = new String[]{
- "overflow"};
-
- private static final JsRegexp REGEX_NUMBER_UNIT = new JsRegexp(
- "^([0-9+-.]+)(.*)?$");
-
- private static final JsRegexp REGEX_SYMBOL_NUMBER_UNIT = new JsRegexp(
- "^([+-]=)?([0-9+-.]+)(.*)?$");
-
- private static final JsRegexp REGEX_NON_PIXEL_ATTRS = new JsRegexp(
- "z-?index|font-?weight|opacity|zoom|line-?height|^\\$", "i");
+ private static final String[] ATTRS_TO_SAVE = new String[]{"overflow"};
+
+ private static final RegExp REGEX_NUMBER_UNIT = RegExp.compile("^([0-9+-.]+)(.*)?$");
- private static final JsRegexp REGEX_COLOR_ATTR = new JsRegexp(".*color$", "i");
+ private static final RegExp REGEX_SYMBOL_NUMBER_UNIT = RegExp.compile("^([+-]=)?([0-9+-.]+)(.*)?$");
- private static final JsRegexp REGEX_BORDERCOLOR = new JsRegexp("^bordercolor$", "i");
+ private static final RegExp REGEX_NON_PIXEL_ATTRS =
+ RegExp.compile("z-?index|font-?weight|opacity|zoom|line-?height|^\\$", "i");
- private static final JsRegexp REGEX_BACKGROUNDCOLOR = new JsRegexp("^backgroundcolor$", "i");
+ private static final RegExp REGEX_COLOR_ATTR = RegExp.compile(".*color$", "i");
+ private static final RegExp REGEX_BORDERCOLOR = RegExp.compile("^bordercolor$", "i");
+ private static final RegExp REGEX_BACKGROUNDCOLOR =RegExp.compile("^backgroundcolor$", "i");
public static Fx computeFxProp(Element e, String key, String val,
boolean hidden) {
if (key.startsWith("$")) {
rkey = key.substring(1).toLowerCase();
String attr = g.attr(rkey);
- JsObjectArray<String> parts = REGEX_NUMBER_UNIT.match(attr);
+ MatchResult parts = REGEX_NUMBER_UNIT.exec(attr);
if (parts != null) {
- String $1 = parts.get(1);
- String $2 = parts.get(2);
+ String $1 = parts.getGroup(1);
+ String $2 = parts.getGroup(2);
cur = Double.parseDouble($1);
unit = $2 == null ? "" : $2;
} else {
end = 0;
unit = REGEX_NON_PIXEL_ATTRS.test(key) ? "" : "px";
} else {
- JsObjectArray<String> parts = REGEX_SYMBOL_NUMBER_UNIT.match(val);
+ MatchResult parts = REGEX_SYMBOL_NUMBER_UNIT.exec(val);
if (parts != null) {
- String $1 = parts.get(1);
- String $2 = parts.get(2);
- String $3 = parts.get(3);
+ String $1 = parts.getGroup(1);
+ String $2 = parts.getGroup(2);
+ String $3 = parts.getGroup(3);
end = Double.parseDouble($2);
if (rkey == null) {