Search in sources :

Example 46 with MatchResult

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;
}
Also used : RegExp(com.google.gwt.regexp.shared.RegExp) ArrayList(java.util.ArrayList) MatchResult(com.google.gwt.regexp.shared.MatchResult)

Example 47 with MatchResult

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;
}
Also used : MatchResult(com.google.gwt.regexp.shared.MatchResult)

Example 48 with MatchResult

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));
        }
    }
}
Also used : MatchResult(com.google.gwt.regexp.shared.MatchResult)

Example 49 with MatchResult

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);
}
Also used : MatchResult(com.google.gwt.regexp.shared.MatchResult)

Example 50 with MatchResult

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);
        }
    }
}
Also used : MatchResult(com.google.gwt.regexp.shared.MatchResult)

Aggregations

MatchResult (com.google.gwt.regexp.shared.MatchResult)53 RegExp (com.google.gwt.regexp.shared.RegExp)24 ArrayList (java.util.ArrayList)9 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)3 ProjectId (edu.stanford.bmir.protege.web.shared.project.ProjectId)3 JsArrayString (com.google.gwt.core.client.JsArrayString)1 Node (com.google.gwt.dom.client.Node)1 PreElement (com.google.gwt.dom.client.PreElement)1 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)1 BasicOverlayType (cz.metacentrum.perun.webgui.model.BasicOverlayType)1 ItemTexts (cz.metacentrum.perun.webgui.model.ItemTexts)1 AutoCompletionChoice (edu.stanford.bmir.gwtcodemirror.client.AutoCompletionChoice)1 AutoCompletionResult (edu.stanford.bmir.gwtcodemirror.client.AutoCompletionResult)1 EditorPosition (edu.stanford.bmir.gwtcodemirror.client.EditorPosition)1 CollectionId (edu.stanford.bmir.protege.web.shared.collection.CollectionId)1 CollectionItem (edu.stanford.bmir.protege.web.shared.collection.CollectionItem)1 FormId (edu.stanford.bmir.protege.web.shared.form.FormId)1 GetUserIdCompletionsAction (edu.stanford.bmir.protege.web.shared.itemlist.GetUserIdCompletionsAction)1