use of com.google.gwt.regexp.shared.MatchResult in project kie-wb-common by kiegroup.
the class QNameConverter method getRegexGroups.
// Delegate RegEx handling to method to allow overriding RegEx implementation in Unit Tests.
// Gwt provides its own RegEx engine for which the API is similar but incompatible with Java's RegEx.
protected List<String> getRegexGroups(final String componentValue) {
final List<String> regExGroups = new ArrayList<>();
final RegExp p = RegExp.compile(QNAME_DECODING_PATTERN);
final MatchResult m = p.exec(componentValue);
for (int i = 0; i < m.getGroupCount(); i++) {
regExGroups.add(m.getGroup(i));
}
return regExGroups;
}
use of com.google.gwt.regexp.shared.MatchResult in project kie-wb-common by kiegroup.
the class SvgDataUriGenerator method removeAll.
private static String removeAll(final RegExp exp, final int group, final String content) {
String result = content;
while (exp.test(result)) {
final MatchResult matchResult = exp.exec(result);
if (matchResult != null) {
String toReplace = matchResult.getGroup(group);
result = result.replace(toReplace, "");
}
}
return result;
}
use of com.google.gwt.regexp.shared.MatchResult in project kie-wb-common by kiegroup.
the class NotificationEditorWidget method setExpirationDateTime.
@Override
public void setExpirationDateTime(String expiresAt) {
MatchResult result = RegExp.compile(REPEATABLE + "/" + ISO_DATE_TIME + "/" + PERIOD).exec(expiresAt);
if (result != null) {
String timeZone = result.getGroup(3);
view.enableRepeatNotification(parseDate(result.getGroup(2)), clearTimeZone(timeZone), expiresAt.split("/")[2], expiresAt.split("/")[0]);
} else {
result = RegExp.compile(ISO_DATE_TIME).exec(expiresAt);
if (result != null) {
view.disableRepeatNotification(parseDate(result.getGroup(1)), result.getGroup(2));
}
}
}
use of com.google.gwt.regexp.shared.MatchResult in project kie-wb-common by kiegroup.
the class NotificationEditorWidgetViewImpl method setPeriod.
protected void setPeriod(String period, PeriodBox box) {
MatchResult match = RegExp.compile(PERIOD).exec(period);
String duration = match.getGroup(2);
String result = duration + presenter.minuteOrMonth(match);
box.setValue(result);
}
use of com.google.gwt.regexp.shared.MatchResult in project kie-wb-common by kiegroup.
the class NotificationEditorWidgetViewImpl method setExpirationTimePeriod.
@Override
public void setExpirationTimePeriod(String iso) {
MatchResult result = RegExp.compile(REPEATABLE + "/" + PERIOD).exec(iso);
if (result != null) {
if (presenter.isRepeatable(iso.split("/")[0])) {
repeatNotification.setValue(true, true);
setPeriod(iso.split("/")[1], periodBox);
setTaskStateOrRepeatCountValue(presenter.getRepeatCount(iso.split("/")[0]));
}
} else {
result = RegExp.compile(PERIOD).exec(iso);
if (result != null) {
setPeriod(result.getGroup(0), periodBox);
repeatNotification.setValue(false, true);
}
}
}
Aggregations