Package com.google.gwt.regexp.shared

Examples of com.google.gwt.regexp.shared.RegExp


            // TODO should be part of this object
            String regexAnchor = options.isSearchContains() ? "" : "^";
            // escape reg exp special chars
            String escapedSearchText = regExpChars.replace(searchText, "\\$&");

            RegExp regex = RegExp.compile(regexAnchor + escapedSearchText, "i");
            RegExp zregex = RegExp.compile("(" + escapedSearchText + ")", "i");

            int results = 0;

            List<SelectItem> selectItems = chosen.getSelectItems();

            for (SelectItem item : selectItems) {
                if (item.isDisabled() || item.isEmpty()) {
                    continue;
                }

                if (item.isGroup()) {
                    $('#' + item.getDomId()).css("display", "none");
                } else {
                    OptionItem option = (OptionItem) item;

                    if (!(chosen.isMultiple() && option.isSelected())) {
                        boolean found = false;
                        String resultId = option.getDomId();
                        GQuery result = $("#" + resultId);
                        String optionContent = option.getHtml();

                        if (regex.test(optionContent)) {
                            found = true;
                            results++;
                        } else if (optionContent.indexOf(" ") >= 0 || optionContent.indexOf("[") == 0) {
                            String[] parts = optionContent.replaceAll("\\[|\\]", "").split(" ");
                            for (String part : parts) {
                                if (regex.test(part)) {
                                    found = true;
                                    results++;
                                }
                            }
                        }

                        if (found) {
                            String text;
                            if (searchText.length() > 0) {
                                text = zregex.replace(optionContent, "<em>$1</em>");
                            } else {
                                text = optionContent;
                            }

                            result.html(text);
View Full Code Here


    searchText = SafeHtmlUtils.htmlEscape(searchText);

    String regexAnchor = options.isSearchContains() ? "" : "^";
    // escape reg exp special chars
    String escapedSearchText = regExpChars.replace(searchText, "\\\\$&");
    RegExp regex = RegExp.compile(regexAnchor + escapedSearchText, "i");
    RegExp zregex = RegExp.compile("("+escapedSearchText+")", "i");

    for (int i = 0; i < selectItems.length(); i++) {
      SelectItem item = selectItems.get(i);

      if (item.isDisabled() || item.isEmpty()) {
        continue;
      }

      if (item.isGroup()) {
        $('#' + item.getDomId()).css("display", "none");
      } else {
        OptionItem option = (OptionItem) item;

        if (!(isMultiple && option.isSelected())) {
          boolean found = false;
          String resultId = option.getDomId();
          GQuery result = $("#" + resultId);
          String optionContent = option.getHtml();

          if (regex.test(optionContent)) {
            found = true;
            results++;
          } else if (optionContent.indexOf(" ") >= 0 || optionContent.indexOf("[") == 0) {
            String[] parts = optionContent.replaceAll("\\[\\]", "").split(" ");
            for (String part : parts) {
              if (regex.test(part)) {
                found = true;
                results++;
              }
            }
          }

          if (found) {
            String text;
            if (searchText.length() > 0) {
              text = zregex.replace(optionContent, "<em>$1</em>");
            } else {
              text = optionContent;
            }

            result.html(text);
View Full Code Here

    searchText = SafeHtmlUtils.htmlEscape(searchText);

    String regexAnchor = options.isSearchContains() ? "" : "^";
    // escape reg exp special chars
    String escapedSearchText = regExpChars.replace(searchText, "\\\\$&");
    RegExp regex = RegExp.compile(regexAnchor + escapedSearchText, "i");
    RegExp zregex = RegExp.compile("("+escapedSearchText+")", "i");

    for (int i = 0; i < selectItems.length(); i++) {
      SelectItem item = selectItems.get(i);

      if (item.isDisabled() || item.isEmpty()) {
        continue;
      }

      if (item.isGroup()) {
        $('#' + item.getDomId()).css("display", "none");
      } else {
        OptionItem option = (OptionItem) item;

        if (!(isMultiple && option.isSelected())) {
          boolean found = false;
          String resultId = option.getDomId();
          GQuery result = $("#" + resultId);
          String optionContent = option.getHtml();

          if (regex.test(optionContent)) {
            found = true;
            results++;
          } else if (optionContent.indexOf(" ") >= 0 || optionContent.indexOf("[") == 0) {
            String[] parts = optionContent.replaceAll("\\[|\\]", "").split(" ");
            for (String part : parts) {
              if (regex.test(part)) {
                found = true;
                results++;
              }
            }
          }

          if (found) {
            String text;
            if (searchText.length() > 0) {
              text = zregex.replace(optionContent, "<em>$1</em>");
            } else {
              text = optionContent;
            }

            result.html(text);
View Full Code Here

    String regexAnchor = options.isSearchContains() ? "" : "^";
    // escape reg exp special chars
    String escapedSearchText = regExpChars.replace(searchText, "\\$&");
    String test2 = "test";
    test2.substring(1);
    RegExp regex = RegExp.compile(regexAnchor + escapedSearchText, "i");
    RegExp zregex = RegExp.compile("(" + escapedSearchText + ")", "i");

    for (int i = 0; i < selectItems.length(); i++) {
      SelectItem item = selectItems.get(i);

      if (item.isDisabled() || item.isEmpty()) {
        continue;
      }

      if (item.isGroup()) {
        $('#' + item.getDomId()).css("display", "none");
      } else {
        OptionItem option = (OptionItem) item;

        if (!(isMultiple && option.isSelected())) {
          boolean found = false;
          String resultId = option.getDomId();
          GQuery result = $("#" + resultId);
          String optionContent = option.getHtml();

          if (regex.test(optionContent)) {
            found = true;
            results++;
          } else if (optionContent.indexOf(" ") >= 0 || optionContent.indexOf("[") == 0) {
            String[] parts = optionContent.replaceAll("\\[|\\]", "").split(" ");
            for (String part : parts) {
              if (regex.test(part)) {
                found = true;
                results++;
              }
            }
          }

          if (found) {
            String text;
            if (searchText.length() > 0) {
              text = zregex.replace(optionContent, "<em>$1</em>");
            } else {
              text = optionContent;
            }

            result.html(text);
View Full Code Here

            // TODO should be part of this object
            String regexAnchor = options.isSearchContains() ? "" : "^";
            // escape reg exp special chars
            String escapedSearchText = regExpChars.replace(searchText, "\\$&");

            RegExp regex = RegExp.compile(regexAnchor + escapedSearchText, "i");
            RegExp zregex = RegExp.compile("(" + escapedSearchText + ")", "i");

            int results = 0;

            List<SelectItem> selectItems = chosen.getSelectItems();

            for (SelectItem item : selectItems) {
                if (item.isDisabled() || item.isEmpty()) {
                    continue;
                }

                if (item.isGroup()) {
                    $('#' + item.getDomId()).css("display", "none");
                } else {
                    OptionItem option = (OptionItem) item;

                    if (!(chosen.isMultiple() && option.isSelected())) {
                        boolean found = false;
                        String resultId = option.getDomId();
                        GQuery result = $("#" + resultId);
                        String optionContent = option.getHtml();

                        if (regex.test(optionContent)) {
                            found = true;
                            results++;
                        } else if (optionContent.indexOf(" ") >= 0 || optionContent.indexOf("[") == 0) {
                            String[] parts = optionContent.replaceAll("\\[|\\]", "").split(" ");
                            for (String part : parts) {
                                if (regex.test(part)) {
                                    found = true;
                                    results++;
                                }
                            }
                        }

                        if (found) {
                            String text;
                            if (searchText.length() > 0) {
                                text = zregex.replace(optionContent, "<em>$1</em>");
                            } else {
                                text = optionContent;
                            }

                            result.html(text);
View Full Code Here

   
    txtLocalOrigem.removeStyleName("campoInvalido");
    txtLocalDestino.removeStyleName("campoInvalido");
    txtPeso.removeStyleName("campoInvalido");
   
    RegExp padrao = RegExp.compile("^[a-zÇ-Üá-ñ\\s]+$", "i");
   
    String origem = txtLocalOrigem.getText().trim();
    if(!padrao.test(origem) || origem.isEmpty()){
      txtLocalOrigem.addStyleName("campoInvalido");
      if(origem.isEmpty()){
        Alerta.exibeErro("O campo local de origem deve estar preenchido");
      }else{
        Alerta.exibeErro("O campo local de origem deve conter apenas letras");
      }
     
      return false;
    }
   
    String destino = txtLocalDestino.getText().trim();
    if(!padrao.test(destino) || destino.isEmpty()){
      txtLocalDestino.addStyleName("campoInvalido");
      if(destino.isEmpty()){
        Alerta.exibeErro("O campo local de destino deve estar preenchido");
      }else{
        Alerta.exibeErro("O campo local de destino deve conter apenas letras");
View Full Code Here

TOP

Related Classes of com.google.gwt.regexp.shared.RegExp

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.