Exemplo n.º 1
0
 private Tab createLiveDeploymentsTab() {
   Tab tab = new Tab(MSG.view_bundle_deployments());
   Criteria criteria = new Criteria();
   criteria.setAttribute("bundleVersionId", version.getId());
   tab.setPane(new BundleDeploymentListView(criteria, this.canDeploy));
   return tab;
 }
  /**
   * Refreshes the members, filtered by any fixed criteria, as well as any user-specified filters.
   */
  public void refresh() {
    Criteria criteria = getCurrentCriteria();

    Map<String, Object> criteriaMap =
        (criteria != null) ? criteria.getValues() : Collections.<String, Object>emptyMap();

    try {
      carouselSizeFilter = Integer.valueOf((String) criteriaMap.get(FILTER_CAROUSEL_SIZE));
    } catch (Exception e) {
      carouselSizeFilter = null;
    }

    try {
      carouselStartFilter = (Integer) criteriaMap.get(FILTER_CAROUSEL_START);
    } catch (Exception e) {
      carouselStartFilter = null;
    }

    // on refresh remove any end filter as the criteria may have changed completely
    carouselEndFilter = null;

    // Any change to filters means we have to rebuild the carousel because the set of members may
    // change, because
    // "empty" members (i.e. members whose relevant data has been completely filtered) may be
    // omitted completely
    // from the carousel.
    buildCarousel(true);

    // TODO: it would be best if this was actually called after the async return of the member
    // refreshes
    refreshCarouselInfo();
  }
  public void getData(String codeSystem, String codeSystemVersion, String searchText) {
    i_searchString = searchText;

    Criteria criteria = new Criteria();
    criteria.addCriteria("searchText", searchText);
    criteria.addCriteria("codeSystem", codeSystem);
    criteria.addCriteria("codeSystemVersion", codeSystemVersion);

    i_valueSetItemSearchXmlDS.fetchData(
        criteria,
        new DSCallback() {

          @Override
          public void execute(DSResponse response, Object rawData, DSRequest request) {

            if ((response != null) && (response.getAttribute("reason") != null)) {
              setEmptyMessage("<b><font color=\"red\">" + ERROR_MESSAGE + "</font></b>");
            } else {
              setEmptyMessage(EMPTY_MESSAGE);
            }

            setData(new ListGridRecord[0]);
            fetchData();

            redraw();

            // let others know that the data has been retrieved.
            Cts2Editor.EVENT_BUS.fireEvent(new ValueSetItemsReceivedEvent());
          }
        });
  }
Exemplo n.º 4
0
  private void setResults(HashMap<String, ArrayList<ClSelectionItem>> result) {
    result = result == null ? new HashMap<String, ArrayList<ClSelectionItem>>() : result;
    addrComp = new AddressComponent(true, true, result.get("" + ClSelection.T_REGION));
    setSelectItems(siCustomerType, result.get("" + ClSelection.T_CUST_TYPE));

    addrComp.getSiRegion().setTitle("Region");
    addrComp.getSiSubregion().setTitle("Sub Region");
    addrComp.getSiCity().setTitle("City");
    addrComp.getSiStreet().setTitle("Street");
    biSaveData.setStartRow(false);
    biSaveData.setEndRow(false);
    FormItem[] items =
        new FormItem[] {
          addrComp.getSiRegion(),
          addrComp.getSiSubregion(),
          addrComp.getSiCity(),
          addrComp.getSiStreet(),
          siZones,
          siCustomerType,
          tiNewZone,
          biSaveData
        };
    dmCriteria.setFields(items);

    ChangedHandler addressChange =
        new ChangedHandler() {

          @Override
          public void onChanged(ChangedEvent event) {

            if (event.getItem().equals(addrComp.getSiRegion())
                || event.getItem().equals(addrComp.getSiSubregion())) {
              setZoneValue();
            }

            creteriaChanged();
          }
        };

    addrComp.getSiRegion().addChangedHandler(addressChange);
    addrComp.getSiSubregion().addChangedHandler(addressChange);
    addrComp.getSiCity().addChangedHandler(addressChange);
    addrComp.getSiStreet().addChangedHandler(addressChange);

    Criteria cr = new Criteria();
    addZoneCriteria(cr, addrComp.getSiRegion(), "regionid");
    cr.addCriteria("uniq", SC.generateID());
    siZones.setOptionCriteria(cr);
    setZoneValue();

    biSaveData.addClickHandler(
        new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {

          @Override
          public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {
            saveData();
          }
        });
  }
Exemplo n.º 5
0
  private static Criteria createCriteria(int groupId, int definitionId) {
    Criteria criteria = new Criteria();

    criteria.addCriteria(MeasurementDataTraitCriteria.FILTER_FIELD_GROUP_ID, groupId);
    criteria.addCriteria(MeasurementDataTraitCriteria.FILTER_FIELD_DEFINITION_ID, definitionId);

    return criteria;
  }
Exemplo n.º 6
0
 private void search() {
   Criteria cr = new Criteria();
   addZoneCriteria(cr, siZones, "zone");
   addZoneCriteria(cr, siCustomerType, "custypeid");
   addZoneCriteria(cr, addrComp.getSiStreet(), "streetid");
   cr.addCriteria("uniq", SC.generateID());
   lgCustomers.fetchData(cr);
 }
Exemplo n.º 7
0
  private void addZoneCriteria(Criteria cr, FormItem fi, String fieldName) {
    Long criteria = null;
    try {
      criteria = Long.parseLong(fi.getValue().toString());
    } catch (Exception e) {

    }
    if (criteria != null) cr.addCriteria(fieldName, criteria.toString());
  }
Exemplo n.º 8
0
  private void creteriaChanged() {
    siZones.setValue((Integer) null);
    Criteria cr = new Criteria();
    addZoneCriteria(cr, addrComp.getSiRegion(), "regionid");
    addZoneCriteria(cr, addrComp.getSiSubregion(), "subregionid");
    addZoneCriteria(cr, addrComp.getSiCity(), "cityid");
    addZoneCriteria(cr, addrComp.getSiStreet(), "streetid");
    cr.addCriteria("uniq", SC.generateID());
    siZones.setOptionCriteria(cr);
    siZones.fetchData(
        new DSCallback() {

          @Override
          public void execute(DSResponse response, Object rawData, DSRequest request) {
            if (response.getData() != null && response.getData().length > 0)
              siZones.setValue(response.getData()[0].getAttributeAsDouble(siZones.getValueField()));
          }
        });
  }
Exemplo n.º 9
0
  private void search() {
    try {
      String firstname = firstNameItem.getValueAsString();
      String lastname = lastNameItem.getValueAsString();
      String phone = phoneItem.getValueAsString();
      String street_id_str = streetItem.getValueAsString();
      String city_id_str = citiesItem.getValueAsString();
      String city_region_id_str = regionItem.getValueAsString();

      if ((firstname == null || firstname.trim().equals(""))
          && (lastname == null || lastname.trim().equals(""))
          && (phone == null || phone.trim().equals(""))
          && (street_id_str == null || street_id_str.trim().equals(""))) {
        SC.say(CallCenter.constants.warning(), CallCenter.constants.enterAbonentSearchParam());
        return;
      }
      Criteria criteria = new Criteria();
      if (firstname != null && !firstname.trim().equals("")) {
        criteria.setAttribute("firstname_param", firstname);
      }
      if (lastname != null && !lastname.trim().equals("")) {
        criteria.setAttribute("lastname_param", lastname);
      }
      if (phone != null && !phone.trim().equals("")) {
        criteria.setAttribute("phone_param", phone);
      }
      if (street_id_str != null && !street_id_str.trim().equals("")) {
        String tmp = street_id_str.trim();
        String arrStr[] = tmp.split(" ");
        int i = 1;
        for (String string : arrStr) {
          String item = string.trim();
          criteria.setAttribute("street_name_geo_param" + i, item);
          i++;
        }
      }
      if (city_id_str != null && !city_id_str.trim().equals("")) {
        criteria.setAttribute("city_id", new Integer(city_id_str));
      }
      if (city_region_id_str != null && !city_region_id_str.trim().equals("")) {
        criteria.setAttribute("city_region_id", new Integer(city_region_id_str));
      }
      DSRequest dsRequest = new DSRequest();
      dsRequest.setAttribute("operationId", "customSearchForCC");
      listGrid.invalidateCache();
      listGrid.fetchData(
          criteria,
          new DSCallback() {
            @Override
            public void execute(DSResponse response, Object rawData, DSRequest request) {}
          },
          dsRequest);

    } catch (Exception e) {
      e.printStackTrace();
      SC.say(e.toString());
    }
  }
Exemplo n.º 10
0
  private void search() {
    try {
      Criteria criteria = new Criteria();
      String billing_company_name = billingCompNameItem.getValueAsString();
      criteria.setAttribute("billing_company_name", billing_company_name);

      String phoneIndex = phoneIndexItem.getValueAsString();

      if (phoneIndex != null && !phoneIndex.equals("")) {

        try {
          new Long(phoneIndex);
        } catch (Exception e) {
          SC.say(CallCenterBK.constants.invalidPhone());
          return;
        }

        criteria.setAttribute("phoneIndex", new Integer(phoneIndex));
      }

      String has_calculation_str = hasCalcItem.getValueAsString();
      if (has_calculation_str != null && !has_calculation_str.equals("-1")) {
        criteria.setAttribute("has_calculation", Integer.parseInt(has_calculation_str));
      }
      Integer operator_src = Integer.parseInt(operatorItem.getValueAsString());
      criteria.setAttribute("operator_src", operator_src);

      DSRequest dsRequest = new DSRequest();
      dsRequest.setAttribute("operationId", "searchAllBillingComps");
      billingCompsGrid.invalidateCache();
      billingCompsGrid.filterData(
          criteria,
          new DSCallback() {
            @Override
            public void execute(DSResponse response, Object rawData, DSRequest request) {}
          },
          dsRequest);
    } catch (Exception e) {
      SC.say(e.toString());
    }
  }
Exemplo n.º 11
0
  private void fillCityRegionCombo(Integer city_id) {
    try {
      if (city_id == null) {
        city_id = Constants.defCityTbilisiId;
      }

      DataSource streetsDS = DataSource.get("CityRegionDS");
      regionItem.setOptionOperationId("searchCityRegsFromDBForCombos");
      regionItem.setOptionDataSource(streetsDS);
      regionItem.setValueField("city_region_id");
      regionItem.setDisplayField("city_region_name_geo");

      Criteria criteria = new Criterion();
      criteria.setAttribute("city_id", city_id);
      regionItem.setOptionCriteria(criteria);
      regionItem.setAutoFetchData(false);

    } catch (Exception e) {
      e.printStackTrace();
      SC.say(e.toString());
    }
  }
  public void findUsers() {
    Criteria findValues;

    String condition = searchForm.getValueAsString("searchCondition");
    String keyword = searchForm.getValueAsString("searchWord");

    /*
    System.out.println("condition ======> " + condition);
    System.out.println("keyword ======> " + keyword);
    */

    if ("User ID".equals(condition)) {
      findValues = searchForm.getValuesAsCriteria();
      findValues.addCriteria("userId", keyword);
    } else if ("User Name".equals(condition)) {
      findValues = searchForm.getValuesAsCriteria();
      findValues.addCriteria("userName", keyword);
    } else {
      findValues = searchForm.getValuesAsCriteria();
    }

    userList.filterData(findValues);
    userDetailTabPane.clearDetails();
  }
 protected void buildMVEL(
     Criteria criteria,
     StringBuffer sb,
     String entityKey,
     DataSource dataSource,
     OperatorId groupOperator)
     throws IncompatibleMVELTranslationException {
   OperatorId operator = EnumUtil.getEnum(OperatorId.values(), criteria.getAttribute("operator"));
   JavaScriptObject listJS = criteria.getAttributeAsJavaScriptObject("criteria");
   if (sb.length() != 0 && sb.charAt(sb.length() - 1) != '(' && groupOperator != null) {
     switch (groupOperator) {
       default:
         sb.append("&&");
         break;
       case OR:
         sb.append("||");
     }
   }
   if (!JSOHelper.isArray(listJS)) {
     buildExpression(criteria, sb, entityKey, operator, dataSource);
   } else {
     boolean includeTopLevelParenthesis = false;
     if (sb.length() != 0 || operator.getValue().equals(OperatorId.NOT.getValue())) {
       includeTopLevelParenthesis = true;
     }
     if (operator.getValue().equals(OperatorId.NOT.getValue())) {
       sb.append("!");
     }
     if (includeTopLevelParenthesis) sb.append("(");
     Criteria[] myCriterias = AdvancedCriteria.convertToCriteriaArray(listJS);
     for (Criteria myCriteria : myCriterias) {
       buildMVEL(myCriteria, sb, entityKey, dataSource, operator);
     }
     if (includeTopLevelParenthesis) sb.append(")");
   }
 }
 @SuppressWarnings({"rawtypes", "deprecation", "unchecked"})
 protected Object[] extractDate(Criteria criteria, OperatorId operator, Map values, String key) {
   Object value;
   String jsObj = JSON.encode(criteria.getJsObj());
   JSONObject criteriaObj = JSONParser.parse(jsObj).isObject();
   JSONObject valueObj = criteriaObj.get(key).isObject();
   if (valueObj != null) {
     value = parseRelativeDate((Map<String, String>) values.get(key));
   } else {
     value = values.get(key);
   }
   if (OperatorId.GREATER_THAN.getValue().equals(operator.getValue())
       || OperatorId.LESS_OR_EQUAL.getValue().equals(operator.getValue())) {
     ((Date) value).setHours(23);
     ((Date) value).setMinutes(59);
   } else {
     ((Date) value).setHours(0);
     ((Date) value).setMinutes(0);
   }
   return new Object[] {value};
 }
Exemplo n.º 15
0
  private void search() {
    try {

      String calendar_state_id = calendarStateItem.getValueAsString();
      Criteria criteria = new Criteria();
      if (calendar_state_id != null && !calendar_state_id.trim().equals("")) {
        criteria.setAttribute("calendar_state_id", new Integer(calendar_state_id));
      }
      String calendar_event_id = secCalendarTypeItem.getValueAsString();
      if (calendar_event_id != null && !calendar_event_id.trim().equals("")) {
        criteria.setAttribute("calendar_event_id", new Integer(calendar_event_id));
      }
      boolean checkedDate = byCalendarDayItem.getValueAsBoolean();
      if (checkedDate) {
        Date calendar_day = calendarDayItem.getValueAsDate();
        if (calendar_day != null) {
          criteria.setAttribute("calendar_day", calendar_day);
        }
      }
      String calendar_description = descriptionItem.getValueAsString();
      if (calendar_description != null && !calendar_description.trim().equals("")) {
        criteria.setAttribute("calendar_description", calendar_description);
      }
      String calendar_comment = commentItem.getValueAsString();
      if (calendar_comment != null && !calendar_comment.trim().equals("")) {
        criteria.setAttribute("calendar_comment", calendar_comment);
      }

      DSRequest dsRequest = new DSRequest();
      dsRequest.setAttribute("operationId", "searchAllSecularCalendars");
      listGrid.invalidateCache();
      listGrid.filterData(
          criteria,
          new DSCallback() {
            @Override
            public void execute(DSResponse response, Object rawData, DSRequest request) {}
          },
          dsRequest);
    } catch (Exception e) {
      SC.say(e.toString());
    }
  }
Exemplo n.º 16
0
  public DlgAddEditTown(ListGrid cityGrid, ListGridRecord cityRecord) {
    super();
    this.lCityRecord = cityRecord;
    this.cityGrid = cityGrid;

    setTitle(cityRecord == null ? "ახალი ქალაქის დამატება" : "ქალაქის მოდიფიცირება");

    setHeight(310);
    setWidth(520);
    setShowMinimizeButton(false);
    setIsModal(true);
    setShowModalMask(true);
    setCanDrag(false);
    setCanDragReposition(false);
    setCanDragResize(false);
    setCanDragScroll(false);
    centerInPage();

    hLayout = new VLayout(5);
    hLayout.setWidth100();
    hLayout.setHeight100();
    hLayout.setPadding(10);

    dynamicForm = new DynamicForm();
    dynamicForm.setAutoFocus(true);
    dynamicForm.setWidth100();
    dynamicForm.setTitleWidth(200);
    dynamicForm.setNumCols(2);
    hLayout.addMember(dynamicForm);

    cityNameGeoItem = new TextItem();
    cityNameGeoItem.setTitle("დასახელება");
    cityNameGeoItem.setWidth(300);
    cityNameGeoItem.setName("town_name");

    cityCodeItem = new TextItem();
    cityCodeItem.setTitle("ქალაქის კოდი");
    cityCodeItem.setWidth(300);
    cityCodeItem.setName("town_code");

    cityNewCodeItem = new TextItem();
    cityNewCodeItem.setTitle("ქალაქის კოდი (ახალი)");
    cityNewCodeItem.setWidth(300);
    cityNewCodeItem.setName("town_new_code");

    ofGmtItem = new TextItem();
    ofGmtItem.setTitle("დრო");
    ofGmtItem.setWidth(300);
    ofGmtItem.setName("normal_gmt");

    ofGmtWinterItem = new TextItem();
    ofGmtWinterItem.setTitle("ზამთრის დრო");
    ofGmtWinterItem.setWidth(300);
    ofGmtWinterItem.setName("winter_gmt");

    countryItem = new ComboBoxItem();
    countryItem.setWidth(300);
    countryItem.setTitle("ქვეყანა");
    countryItem.setName("country_id");
    countryItem.setFetchMissingValues(true);
    countryItem.setFilterLocally(false);
    countryItem.setAddUnknownValues(false);

    townTypeItem = new ComboBoxItem();
    townTypeItem.setTitle("ქალაქის ტიპი");
    townTypeItem.setWidth(300);
    townTypeItem.setName("townTypeItem");
    townTypeItem.setFetchMissingValues(true);
    townTypeItem.setFilterLocally(false);
    townTypeItem.setAddUnknownValues(false);

    DataSource DescriptionsDS = DataSource.get("DescriptionsDS");
    townTypeItem.setOptionOperationId("searchDescriptionsOrderById");
    townTypeItem.setOptionDataSource(DescriptionsDS);
    townTypeItem.setValueField("description_id");
    townTypeItem.setDisplayField("description");

    Criteria criteria = new Criteria();
    criteria.setAttribute("description_type_id", "59000");
    townTypeItem.setOptionCriteria(criteria);
    townTypeItem.setAutoFetchData(false);

    townTypeItem.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            Criteria criteria = townTypeItem.getOptionCriteria();
            if (criteria != null) {
              String oldAttr = criteria.getAttribute("town_type_id");
              if (oldAttr != null) {
                Object nullO = null;
                criteria.setAttribute("town_type_id", nullO);
              }
            }
          }
        });

    countryItem.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            Criteria criteria = countryItem.getOptionCriteria();
            if (criteria != null) {
              String oldAttr = criteria.getAttribute("country_id");
              if (oldAttr != null) {
                Object nullO = null;
                criteria.setAttribute("country_id", nullO);
              }
            }
          }
        });

    isCapitalItem = new ComboBoxItem();
    isCapitalItem.setTitle("დედაქალაქი");
    isCapitalItem.setWidth(300);
    isCapitalItem.setName("capital_town");
    isCapitalItem.setValueMap(ClientMapUtil.getInstance().getIsCapital());

    dynamicForm.setFields(
        cityNameGeoItem,
        cityCodeItem,
        cityNewCodeItem,
        ofGmtItem,
        ofGmtWinterItem,
        countryItem,
        townTypeItem,
        isCapitalItem);

    HLayout hLayoutItem = new HLayout(5);
    hLayoutItem.setWidth100();
    hLayoutItem.setAlign(Alignment.RIGHT);

    IButton saveItem = new IButton();
    saveItem.setTitle("შენახვა");
    saveItem.setWidth(100);

    IButton cancItem = new IButton();
    cancItem.setTitle("დახურვა");
    cancItem.setWidth(100);

    hLayoutItem.setMembers(saveItem, cancItem);

    hLayout.addMember(hLayoutItem);

    cancItem.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            destroy();
          }
        });
    saveItem.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            saveCountry();
          }
        });

    addItem(hLayout);
    fillFields();
  }
Exemplo n.º 17
0
  public SmsQueueWindow(final Integer smsInfoId, String sms, String name) {
    setTitle(TicketMaster.constants.sms_numbers());
    setWidth(600);
    setHeight(500);
    setIsModal(true);
    setShowModalMask(true);
    setShowMaximizeButton(true);
    setShowMinimizeButton(false);
    setShowCloseButton(true);
    setAutoDraw(true);
    centerInPage();

    VLayout vLayout = new VLayout();
    vLayout.setWidth100();
    vLayout.setHeight100();
    form = new DynamicForm();
    form.setPadding(15);
    form.setWidth100();
    form.setNumCols(2);
    smsField = new StaticTextItem("sms", TicketMaster.constants.sms_sms());
    smsField.setValue(sms);
    smsField.setTitleVAlign(VerticalAlignment.TOP);

    StaticTextItem nameField = new StaticTextItem("name", TicketMaster.constants.name());
    nameField.setValue(name);
    form.setFields(nameField, smsField);

    Criteria c = new Criteria();
    c.setAttribute("timestamp", new Date().getTime());
    c.setAttribute("sms_info_id", smsInfoId);

    grid = new ListGrid();
    grid.setWidth100();
    grid.setHeight100();
    grid.setDataSource(DataSource.get("SMSBroadcastDS"));
    grid.setFetchOperation("getNumbers");
    grid.setCriteria(c);
    grid.setAutoFetchData(true);
    ListGridField sendDateField =
        new ListGridField("send_date", TicketMaster.constants.sms_sendDate(), 120);
    sendDateField.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);
    ListGridField deliveryDateField =
        new ListGridField("delivery_date", TicketMaster.constants.sms_deliveryDate(), 120);
    deliveryDateField.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);
    grid.setFields(
        new ListGridField("id", "ID", 60),
        new ListGridField("phone_number", TicketMaster.constants.sms_number()),
        new ListGridField("state", TicketMaster.constants.sms_state()),
        sendDateField,
        deliveryDateField);

    IButton exportBtn = new IButton(TicketMaster.constants.sms_export());
    exportBtn.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent clickEvent) {
            com.google.gwt.user.client.Window.open(
                "./SMSBroadcast/ExportNumbers?sms_info_id=" + smsInfoId, "_self", "");
          }
        });
    exportBtn.setIcon("excel.gif");

    HLayout bbar = new HLayout();
    bbar.setAlign(Alignment.RIGHT);
    bbar.setMembersMargin(5);
    bbar.setPadding(5);
    bbar.addMembers(exportBtn);
    vLayout.addMembers(form, grid, bbar);

    addItem(vLayout);
  }
  @Override
  public void init() {
    Criteria criteria = null;
    if (parentRecord != null) {
      criteria = new Criteria();
      criteria.setAttribute("Class_id", (Long) parentRecord.getAttributeAsLong("Class_id"));
    } else {

      Record rec = this.selectedRecord;
      criteria = new Criteria();
      criteria.setAttribute("Class_id", (Long) rec.getAttributeAsLong("Class_id"));
    }

    tabs.setHeight100();
    tabs.setWidth100();
    final ClassModelMessages ClassMessagesd =
        (ClassModelMessages) GWT.create(ClassModelMessages.class);

    // let First tab be the Detail page of the current row, ie. the form thing.
    Tab tab_details = new Tab(ClassMessagesd.name_single());
    tab_details.addTabDeselectedHandler(
        detailView); // has to respond with a form save, when we select a different tab
    tab_details.setPane(detailView);
    tabs.addTab(tab_details);
    tab_details.addTabSelectedHandler(
        new TabSelectedHandler() {
          @Override
          public void onTabSelected(TabSelectedEvent event) {
            getBreadcrumbs().removeAfter("Class_single");
          }
        });

    if (userDetails.hasAuthority("CAN_READ_TEAM_TAB")
        || userDetails.hasAuthority("CAN_READ_TAB_TEAM")
        || userDetails.hasAuthority("CAN_READ_CLASS_TAB_REF")) {
      Log.debug("Detected rights: CAN_READ_TEAM_TAB, showing tab");

      teamsInClass_Team_Widget teamsInClass_Team =
          new teamsInClass_Team_Widget(criteria, userDetails);
      this.refs.add(teamsInClass_Team);

      final TeamModelMessages TeamMessages =
          (TeamModelMessages) GWT.create(TeamModelMessages.class);

      Tab tab_teamsInClass_Team_Widget = new Tab(TeamMessages.tab_name_TeamModel());
      tab_teamsInClass_Team_Widget.setPane(teamsInClass_Team);
      modelToTitleMap.put("Team", TeamMessages.tab_name_TeamModel());

      tab_teamsInClass_Team_Widget.addTabSelectedHandler(
          new TabSelectedHandler() {
            @Override
            public void onTabSelected(TabSelectedEvent event) {
              // if the last element's key doesn't end with _single, pop it first
              if (!getBreadcrumbs().lastCrumbIsSingle()) {
                getBreadcrumbs().popLast();
              }

              // then add the target's normal crumb
              getBreadcrumbs().addCrumb("Team", TeamMessages.tab_name_TeamModel());
            }
          });

      tabs.addTab(tab_teamsInClass_Team_Widget);
    } else {
      Log.debug("No rights: CAN_READ_TEAM_TAB detected, not showing tab");
    }

    attachToCanvas();
  }
 @SuppressWarnings("rawtypes")
 protected void buildExpression(
     Criteria criteria,
     StringBuffer sb,
     String entityKey,
     OperatorId operator,
     DataSource dataSource)
     throws IncompatibleMVELTranslationException {
   Map values = criteria.getValues();
   String field = (String) values.get("fieldName");
   SupportedFieldType type =
       SupportedFieldType.valueOf(dataSource.getField(field).getAttribute("fieldType"));
   SupportedFieldType secondaryType = null;
   String secondaryTypeVal = dataSource.getField(field).getAttribute("secondaryFieldType");
   Object[] value;
   if (secondaryTypeVal != null) {
     secondaryType = SupportedFieldType.valueOf(secondaryTypeVal);
   }
   if (SupportedFieldType.DATE.toString().equals(type.toString())
       && !OperatorId.CONTAINS_FIELD.getValue().equals(operator.getValue())
       && !OperatorId.ENDS_WITH_FIELD.getValue().equals(operator.getValue())
       && !OperatorId.EQUALS_FIELD.getValue().equals(operator.getValue())
       && !OperatorId.GREATER_OR_EQUAL_FIELD.getValue().equals(operator.getValue())
       && !OperatorId.GREATER_THAN_FIELD.getValue().equals(operator.getValue())
       && !OperatorId.LESS_OR_EQUAL_FIELD.getValue().equals(operator.getValue())
       && !OperatorId.LESS_THAN_FIELD.getValue().equals(operator.getValue())
       && !OperatorId.NOT_EQUAL_FIELD.getValue().equals(operator.getValue())
       && !OperatorId.STARTS_WITH_FIELD.getValue().equals(operator.getValue())
       && !OperatorId.BETWEEN.getValue().equals(operator.getValue())
       && !OperatorId.BETWEEN_INCLUSIVE.getValue().equals(operator.getValue())) {
     value = extractDate(criteria, operator, values, "value");
   } else {
     value = extractBasicValues(values.get("value"));
   }
   switch (operator) {
     case CONTAINS:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             ".contains",
             true,
             false,
             false,
             false,
             false);
         break;
       }
     case CONTAINS_FIELD:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             ".contains",
             true,
             true,
             false,
             false,
             false);
         break;
       }
     case ENDS_WITH:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             ".endsWith",
             true,
             false,
             false,
             false,
             false);
         break;
       }
     case ENDS_WITH_FIELD:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             ".endsWith",
             true,
             true,
             false,
             false,
             false);
         break;
       }
     case EQUALS:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             "==",
             false,
             false,
             false,
             false,
             false);
         break;
       }
     case EQUALS_FIELD:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             "==",
             false,
             true,
             false,
             false,
             false);
         break;
       }
     case GREATER_OR_EQUAL:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             ">=",
             false,
             false,
             false,
             false,
             false);
         break;
       }
     case GREATER_OR_EQUAL_FIELD:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             ">=",
             false,
             true,
             false,
             false,
             false);
         break;
       }
     case GREATER_THAN:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             ">",
             false,
             false,
             false,
             false,
             false);
         break;
       }
     case GREATER_THAN_FIELD:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             ">",
             false,
             true,
             false,
             false,
             false);
         break;
       }
     case ICONTAINS:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             ".contains",
             true,
             false,
             true,
             false,
             false);
         break;
       }
     case IENDS_WITH:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             ".endsWith",
             true,
             false,
             true,
             false,
             false);
         break;
       }
     case IEQUALS:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             "==",
             false,
             false,
             true,
             false,
             false);
         break;
       }
     case INOT_CONTAINS:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             ".contains",
             true,
             false,
             true,
             true,
             false);
         break;
       }
     case INOT_ENDS_WITH:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             ".endsWith",
             true,
             false,
             true,
             true,
             false);
         break;
       }
     case INOT_EQUAL:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             "!=",
             false,
             false,
             true,
             false,
             false);
         break;
       }
     case INOT_STARTS_WITH:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             ".startsWith",
             true,
             false,
             true,
             true,
             false);
         break;
       }
     case IS_NULL:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             new Object[] {"null"},
             type,
             secondaryType,
             "==",
             false,
             false,
             false,
             false,
             true);
         break;
       }
     case ISTARTS_WITH:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             ".startsWith",
             true,
             false,
             true,
             false,
             false);
         break;
       }
     case LESS_OR_EQUAL:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             "<=",
             false,
             false,
             false,
             false,
             false);
         break;
       }
     case LESS_OR_EQUAL_FIELD:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             "<=",
             false,
             true,
             false,
             false,
             false);
         break;
       }
     case LESS_THAN:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             "<",
             false,
             false,
             false,
             false,
             false);
         break;
       }
     case LESS_THAN_FIELD:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             "<",
             false,
             true,
             false,
             false,
             false);
         break;
       }
     case NOT_CONTAINS:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             ".contains",
             true,
             false,
             false,
             true,
             false);
         break;
       }
     case NOT_ENDS_WITH:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             ".endsWith",
             true,
             false,
             false,
             true,
             false);
         break;
       }
     case NOT_EQUAL:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             "!=",
             false,
             false,
             false,
             false,
             false);
         break;
       }
     case NOT_EQUAL_FIELD:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             "!=",
             false,
             true,
             false,
             false,
             false);
         break;
       }
     case NOT_NULL:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             new Object[] {"null"},
             type,
             secondaryType,
             "!=",
             false,
             false,
             false,
             false,
             true);
         break;
       }
     case NOT_STARTS_WITH:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             ".startsWith",
             true,
             false,
             false,
             true,
             false);
         break;
       }
     case STARTS_WITH:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             ".startsWith",
             true,
             false,
             false,
             false,
             false);
         break;
       }
     case STARTS_WITH_FIELD:
       {
         buildExpression(
             sb,
             entityKey,
             field,
             value,
             type,
             secondaryType,
             ".startsWith",
             true,
             true,
             false,
             false,
             false);
         break;
       }
     case BETWEEN:
       {
         if (SupportedFieldType.DATE.toString().equals(type.toString())) {
           sb.append("(");
           buildExpression(
               sb,
               entityKey,
               field,
               extractDate(criteria, OperatorId.GREATER_THAN, values, "start"),
               type,
               secondaryType,
               ">",
               false,
               false,
               false,
               false,
               false);
           sb.append("&&");
           buildExpression(
               sb,
               entityKey,
               field,
               extractDate(criteria, OperatorId.LESS_THAN, values, "end"),
               type,
               secondaryType,
               "<",
               false,
               false,
               false,
               false,
               false);
           sb.append(")");
         } else {
           sb.append("(");
           buildExpression(
               sb,
               entityKey,
               field,
               new Object[] {values.get("start")},
               type,
               secondaryType,
               ">",
               false,
               false,
               false,
               false,
               false);
           sb.append("&&");
           buildExpression(
               sb,
               entityKey,
               field,
               new Object[] {values.get("end")},
               type,
               secondaryType,
               "<",
               false,
               false,
               false,
               false,
               false);
           sb.append(")");
         }
         break;
       }
     case BETWEEN_INCLUSIVE:
       {
         if (SupportedFieldType.DATE.toString().equals(type.toString())) {
           sb.append("(");
           buildExpression(
               sb,
               entityKey,
               field,
               extractDate(
                   criteria, OperatorId.GREATER_OR_EQUAL, (Map) values.get("start"), "start"),
               type,
               secondaryType,
               ">=",
               false,
               false,
               false,
               false,
               false);
           sb.append("&&");
           buildExpression(
               sb,
               entityKey,
               field,
               extractDate(criteria, OperatorId.LESS_OR_EQUAL, (Map) values.get("end"), "end"),
               type,
               secondaryType,
               "<=",
               false,
               false,
               false,
               false,
               false);
           sb.append(")");
         } else {
           sb.append("(");
           buildExpression(
               sb,
               entityKey,
               field,
               new Object[] {values.get("start")},
               type,
               secondaryType,
               ">=",
               false,
               false,
               false,
               false,
               false);
           sb.append("&&");
           buildExpression(
               sb,
               entityKey,
               field,
               new Object[] {values.get("end")},
               type,
               secondaryType,
               "<=",
               false,
               false,
               false,
               false,
               false);
           sb.append(")");
         }
         break;
       }
   }
 }
  public DlgOrgInfoViewByPhone(String phone) {
    super();
    setWidth(600);
    setHeight(700);
    setTitle("ორგანიზაციები ნომრის მიხედვით");
    setShowMinimizeButton(false);
    setIsModal(true);
    setShowModalMask(true);
    setCanDrag(false);
    setCanDragReposition(false);
    setCanDragResize(false);
    setCanDragScroll(false);
    centerInPage();

    VLayout hLayout = new VLayout(5);
    hLayout.setWidth100();
    hLayout.setHeight100();

    DataSource dataSource = DataSource.get("OrgInfoByPhoneDS");
    dataSource.getField("org_name").setTitle("ორგანიზაციის დასახელება");
    dataSource.getField("note").setTitle("შენიშვნა");
    dataSource.getField("workinghours").setTitle("სამუშაო საათები");
    dataSource.getField("director").setTitle("დირექტორი");
    dataSource.getField("identcode").setTitle("საიდ. კოდი");
    dataSource.getField("founded").setTitle("დაარსდა");
    dataSource.getField("legaladdress").setTitle("მისამართი");
    dataSource.getField("mail").setTitle("ელ. ფოსტა");
    dataSource.getField("webaddress").setTitle("ვებ გვერდი");
    dataSource.getField("org_info").setTitle("ორგ. ინფორმაცია");
    dataSource.getField("contactperson").setTitle("საკონტაქტო პიროვნება");
    dataSource.getField("dayoffs").setTitle("დასვენების დღეები");
    dataSource.getField("legal_statuse").setTitle("სტატუსი");
    dataSource.getField("partnerbank").setTitle("პარტნიორი ბანკი");
    dataSource.getField("workpersoncountity").setTitle("თანამშრომლების რაოდენობა");
    dataSource.getField("upd_user").setTitle("ვინ განაახლა");
    dataSource.getField("upd_date").setTitle("როდის განახლდა");
    dataSource.getField("ind").setTitle("ინდექსი");
    dataSource.getField("org_name_eng").setTitle("ორგ. დასახელება(ინგლისურად)");
    dataSource.getField("new_identcode").setTitle("ახალი კოდი");

    ListGridField org_name = new ListGridField("org_name", "ორგანიზაციის დასახელება", 250);
    ListGridField director = new ListGridField("director", "დირექტორი", 150);
    ListGridField identcode = new ListGridField("identcode", "საიდ. კოდი", 120);

    final ListGrid orgGrid = new ListGrid();
    orgGrid.setWidth100();
    orgGrid.setHeight(100);
    orgGrid.setAlternateRecordStyles(true);
    orgGrid.setShowFilterEditor(false);
    orgGrid.setCanEdit(false);
    orgGrid.setCanRemoveRecords(false);
    orgGrid.setShowRowNumbers(true);
    orgGrid.setCanHover(true);
    orgGrid.setShowHover(true);
    orgGrid.setShowHoverComponents(true);

    orgGrid.setAutoFetchData(true);
    Criteria criteria = new Criteria();
    criteria.setAttribute("phone", phone);
    orgGrid.setCriteria(criteria);
    orgGrid.setDataSource(dataSource);
    orgGrid.setFetchOperation("getOrgInfoByPhoneForAbonent");
    orgGrid.setFields(org_name, director, identcode);

    final DetailViewer detailViewer = new DetailViewer();
    detailViewer.setCanSelectText(true);
    detailViewer.setHeight(520);
    detailViewer.setWidth100();
    detailViewer.setDataSource(dataSource);

    orgGrid.addRecordClickHandler(
        new RecordClickHandler() {
          public void onRecordClick(RecordClickEvent event) {
            detailViewer.viewSelectedData(orgGrid);
          }
        });

    HLayout hLayoutItem = new HLayout(5);
    hLayoutItem.setWidth100();
    hLayoutItem.setAlign(Alignment.RIGHT);
    hLayoutItem.setMargin(10);

    IButton cancItem = new IButton();
    cancItem.setTitle("დახურვა");
    cancItem.setWidth(100);

    hLayoutItem.setMembers(cancItem);
    hLayout.setMembers(orgGrid, detailViewer, hLayoutItem);
    addItem(hLayout);

    cancItem.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(ClickEvent event) {
            destroy();
          }
        });
  }
  // TODO move to a utility
  // SmartGWT 2.4's version of Criteria.addCriteria for some reason doesn't have else clauses for
  // the array types
  // and it doesn't handle Object types properly (seeing odd behavior because of this), so this
  // method explicitly
  // supports adding array types and Objects.
  // This method takes the src criteria and adds it to the dest criteria.
  public static void addCriteria(Criteria dest, Criteria src) {
    Map otherMap = src.getValues();
    Set otherKeys = otherMap.keySet();
    for (Iterator i = otherKeys.iterator(); i.hasNext(); ) {
      String field = (String) i.next();
      Object value = otherMap.get(field);

      if (value instanceof Integer) {
        dest.addCriteria(field, (Integer) value);
      } else if (value instanceof Float) {
        dest.addCriteria(field, (Float) value);
      } else if (value instanceof String) {
        dest.addCriteria(field, (String) value);
      } else if (value instanceof Date) {
        dest.addCriteria(field, (Date) value);
      } else if (value instanceof Boolean) {
        dest.addCriteria(field, (Boolean) value);
      } else if (value instanceof Integer[]) {
        dest.addCriteria(field, (Integer[]) value);
      } else if (value instanceof Double[]) {
        dest.addCriteria(field, (Double[]) value);
      } else if (value instanceof String[]) {
        dest.addCriteria(field, (String[]) value);
      } else {
        // this is the magic piece - we need to get attrib as an object and set that value
        dest.setAttribute(field, src.getAttributeAsObject(field));
      }
    }
  }