Adding ability to filter results by kind.
authorJan Lahoda <jlahoda@netbeans.org>
Sat, 27 Apr 2013 23:08:16 +0200
changeset 950af4b95a3ce24
parent 949 5c9e6a3248ba
child 951 b00f220fd939
Adding ability to filter results by kind.
remoting/server/web/web.ui.frontend/public_html/index/ui/script.js
remoting/server/web/web.ui.frontend/public_html/index/ui/search.html
     1.1 --- a/remoting/server/web/web.ui.frontend/public_html/index/ui/script.js	Sat Apr 27 09:44:00 2013 +0200
     1.2 +++ b/remoting/server/web/web.ui.frontend/public_html/index/ui/script.js	Sat Apr 27 23:08:16 2013 +0200
     1.3 @@ -28,11 +28,16 @@
     1.4      };
     1.5      $scope.performQueryDelayed = _.debounce($scope.performQuery, 2000);
     1.6      $scope.getElementIcon = getElementIcon;
     1.7 +    $scope.acceptByKind = acceptByKind;
     1.8      $scope.prefix = $routeParams.prefix || "";
     1.9      $scope.symbolSignature = symbolSignature;
    1.10  
    1.11      $scope.showSearch = false;
    1.12      $scope.showNextPrev = false;
    1.13 +    $scope.showTypes = true;
    1.14 +    $scope.showFields = true;
    1.15 +    $scope.showMethods = true;
    1.16 +    $scope.showOthers = true;
    1.17      
    1.18      if (typeof $routeParams.prefix !== 'undefined') {
    1.19          $scope.performQuery();
    1.20 @@ -69,6 +74,19 @@
    1.21      }
    1.22  }
    1.23  
    1.24 +function acceptByKind(elementKind, showFields, showTypes, showMethods, showOthers) {
    1.25 +    if (   "ENUM" === elementKind || "ANNOTATION_TYPE" === elementKind
    1.26 +        || "CLASS" === elementKind || "INTERFACE" === elementKind) {
    1.27 +        return showTypes;
    1.28 +    } else if ("FIELD" === elementKind || "ENUM_CONSTANT" === elementKind) {
    1.29 +        return showFields;
    1.30 +    } else if ("CONSTRUCTOR" === elementKind || "METHOD" === elementKind) {
    1.31 +        return showMethods;
    1.32 +    } else {
    1.33 +        return showOthers;
    1.34 +    }
    1.35 +}
    1.36 +
    1.37  // Private Methods ---------------------------------------------------------
    1.38  
    1.39  function getIconName(typeName, extension, modifiers) {
     2.1 --- a/remoting/server/web/web.ui.frontend/public_html/index/ui/search.html	Sat Apr 27 09:44:00 2013 +0200
     2.2 +++ b/remoting/server/web/web.ui.frontend/public_html/index/ui/search.html	Sat Apr 27 23:08:16 2013 +0200
     2.3 @@ -7,8 +7,16 @@
     2.4  <span class="project-checkboxes" ng-repeat="project in $parent.projects">
     2.5      <input class="projectCheckBox" type='checkbox' ng-model="project.selected" name="path" ng-change="$parent.projectCheckBoxChanged()" id="projectCheckBox-{{project.id}}">{{project.displayName}}</input>
     2.6  </span>
     2.7 +<br>
     2.8 +<span>
     2.9 +    Show:
    2.10 +    <input type='checkbox' ng-model="showTypes" id="showTypes">Types</input>
    2.11 +    <input type='checkbox' ng-model="showFields" id="showFields">Fields</input>
    2.12 +    <input type='checkbox' ng-model="showMethods" id="showMethods">Methods</input>
    2.13 +    <input type='checkbox' ng-model="showOthers" id="showOthers">Others</input>
    2.14 +</span>
    2.15  <table width="100%">
    2.16 -    <tr ng-repeat="symbolsDescription in searchResult" ng-show="projects.get(symbolsDescription.project.id).selected==true" id="{{symbolsDescription.project.id}}"> <!--projects[symbolsDescription.projectId].neco==true">-->
    2.17 +    <tr ng-repeat="symbolsDescription in searchResult" ng-show="projects.get(symbolsDescription.project.id).selected==true && acceptByKind(symbolsDescription.kind, showFields, showTypes, showMethods, showOthers)" id="{{symbolsDescription.project.id}}"> <!--projects[symbolsDescription.projectId].neco==true">-->
    2.18          <td style="vertical-align: top">
    2.19              <img src="/index/icons/{{getElementIcon(symbolsDescription.kind, symbolsDescription.modifiers)}}" alt="{{symbolsDescription.kind}}"/>
    2.20          </td><td>