Пример #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;
 }
  // 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));
      }
    }
  }
Пример #3
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());
    }
  }
Пример #4
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());
    }
  }
Пример #5
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());
    }
  }
Пример #6
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());
    }
  }
  @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();
  }
  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();
          }
        });
  }
Пример #9
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);
  }
Пример #10
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();
  }