Exemplo n.º 1
0
    private void reset(final UploadComponentOptions options) {
      resetComponents(options);
      clear();

      final Set<String> types = components.keySet();
      currentType = types.iterator().next();

      parentCanvas = new Canvas();
      layout = new VLayout();
      final SelectItem typeItem = new SelectItem("uploadType", "Upload Type");
      typeItem.setValueMap(types.toArray(new String[types.size()]));
      typeItem.setValue(currentType);
      typeItem.setWidth(250);
      typeItem.addChangedHandler(
          new ChangedHandler() {
            public void onChanged(final ChangedEvent event) {
              currentType = typeItem.getValue().toString();
              update();
            }
          });
      final Form form =
          new Form(
              DomConstants.buildConstant(DomConstants.UPLOAD_COMPONENT_TYPE, uploadComponentNumber),
              typeItem);
      form.setPadding(0);
      form.setMargin(0);
      form.setCellSpacing(0);
      form.setCellPadding(0);

      form.setAlign(Alignment.RIGHT);
      form.setWidth(350);
      form.setHeight(20);
      final HLayout header = new HLayout();
      header.setAlign(Alignment.RIGHT);
      header.addMember(form);
      header.setHeight(20);

      layout.setAlign(Alignment.RIGHT);
      layout.addMember(header);
      layout.addMember(parentCanvas);
      layout.setGroupTitle("File Chooser");
      layout.setIsGroup(true);
      layout.setHeight("185px");
      layout.setPadding(2);
      layout.setLayoutAlign(Alignment.CENTER);
      layout.setAlign(Alignment.CENTER);

      for (final UploadComponent uploadComponent : components.values()) {
        final Canvas childCanvas = uploadComponent.get();
        childCanvas.hide();
        parentCanvas.addChild(childCanvas);
      }
      update();
      wrapperLayout.addMember(layout);
    }
  {
    filter = new CityFilter();

    cityRPCService = GWT.create(CityRPCService.class);
    stateRPCService = GWT.create(StateRPCService.class);
    countryRPCService = GWT.create(CountryRPCService.class);

    textDescription = new TextItem(Attribute.DESCRIPTION, I18N.$.LABEL_DESCRIPTION());

    selectState = new SelectItem(Attribute.STATE, I18N.$.LABEL_STATE());
    selectState.setPickListHeight(100);

    selectCountry = new SelectItem(Attribute.COUNTRY, I18N.$.LABEL_COUNTRY());
    selectCountry.setPickListHeight(100);
    selectCountry.addChangeHandler(
        new ChangeHandler() {
          public void onChange(final ChangeEvent event) {
            stateRPCService.findByCountryId(
                Integer.parseInt((String) event.getValue()), stateFindCallback);
          }
        });

    fieldDescription = new ListGridField(Attribute.DESCRIPTION, I18N.$.LABEL_DESCRIPTION());
    fieldState = new ListGridField(Attribute.STATE, I18N.$.LABEL_STATE());
    fieldCountry = new ListGridField(Attribute.COUNTRY, I18N.$.LABEL_COUNTRY());
    fieldLastUpdate = new ListGridField(Attribute.LAST_UPDATE, I18N.$.LABEL_LAST_UPDATE());
    fieldLastUpdate.setCellFormatter(GWTUtils.getDateTimeCellFormatter());

    stateFindCallback =
        new AsyncCallback<List<StateDTO>>() {
          public void onFailure(final Throwable throwable) {
            GWTUtils.showError(throwable);
          }

          public void onSuccess(final List<StateDTO> dtos) {
            selectState.setValueMap(GWTUtils.getStateValueMap(dtos));
          }
        };

    countryFindCallback =
        new AsyncCallback<List<CountryDTO>>() {
          public void onFailure(final Throwable throwable) {
            GWTUtils.showError(throwable);
          }

          public void onSuccess(final List<CountryDTO> dtos) {
            selectCountry.setValueMap(GWTUtils.getCountryValueMap(dtos));
          }
        };
  }
Exemplo n.º 3
0
 public void setStatuses() {
   setSelectItems(siDocStatus, DocFlow.user_obj.getStatuses(DocFlow.system_id));
   try {
     siDocStatus.setValue(mpCurrentStatus.get(DocFlow.system_id).toString());
   } catch (Exception e) {
   }
 }
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
 public void clearFields() {
   LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
   map.put("-1", "---");
   try {
     siCustomerType.setValueMap(map);
     siCustomerType.setValue("-1");
     addrComp.getSiRegion().setValue("-1");
     addrComp.getSiSubregion().setValueMap(map);
     addrComp.getSiSubregion().setValue("-1");
     addrComp.getSiCity().setValueMap(map);
     addrComp.getSiCity().setValue("-1");
     addrComp.getSiStreet().setValueMap(map);
     addrComp.getSiStreet().setValue("-1");
   } catch (Exception e) {
     // TODO: handle exception
   }
 }
Exemplo n.º 6
0
 public void saveStatus() {
   int cur_status = -1;
   try {
     cur_status = Integer.parseInt(siDocStatus.getValueAsString());
   } catch (Exception e) {
   }
   mpCurrentStatus.put(DocFlow.system_id, cur_status);
 }
Exemplo n.º 7
0
  /** Prepares the language form */
  private Tab setupLanguage(final ValuesManager vm) {
    Tab languageTab = new Tab();
    languageTab.setTitle(I18N.message(LANGUAGE));

    SelectItem languageItem = ItemFactory.newLanguageSelector(LANGUAGE, false, true);
    languageItem.setTitle(I18N.message("defaultlang"));
    languageItem.setRequired(true);
    languageItem.setValue(I18N.getLocale());

    final DynamicForm languageForm = new DynamicForm();
    languageForm.setID("languageForm");
    languageForm.setValuesManager(vm);
    languageForm.setFields(languageItem);
    languageForm.setDisabled(true);
    languageTab.setPane(languageForm);
    return languageTab;
  }
Exemplo n.º 8
0
  protected void setData(List<PSMittel> result) {
    this.data = result;

    LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
    for (PSMittel ps : result) {
      valueMap.put(ps.getId().toString(), ps.getName());
    }
    selectItem.setValueMap(valueMap);
  }
Exemplo n.º 9
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.º 10
0
  public Canvas getViewPanel() {

    final TabSet tabSet = new TabSet();
    tabSet.setTabBarPosition(Side.TOP);

    // required so that the select item doesnt touch the tab pane
    tabSet.setTabBarThickness(25);
    tabSet.setTabBarAlign(Side.LEFT);
    tabSet.setWidth(400);
    tabSet.setHeight(200);

    final Tab statusTab = new Tab("Status");

    final Canvas statusPane = new Canvas();
    statusTab.setPane(statusPane);
    tabSet.addTab(statusTab);

    SelectItem selectItem = new SelectItem();
    selectItem.setValueMap("Development", "Staging", "Production");
    selectItem.setShowTitle(false);

    selectItem.setDefaultValue("Development");
    selectItem.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            statusPane.setContents(
                event.getValue()
                    + ": <span style='color:green;font-weight:bold'>Normal</span><br>");
          }
        });

    DynamicForm form = new DynamicForm();
    // form.setHeight(1);
    form.setPadding(0);
    form.setMargin(0);
    form.setCellPadding(1);
    form.setNumCols(1);
    form.setFields(selectItem);

    tabSet.setTabBarControls(TabBarControls.TAB_SCROLLER, TabBarControls.TAB_PICKER, form);
    return tabSet;
  }
Exemplo n.º 11
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.º 12
0
  /** Prepares the SMTP form */
  private Tab setupSmtp(final ValuesManager vm) {
    // Prepare the SMTP connection tab
    Tab smtpTab = new Tab();
    smtpTab.setTitle(I18N.message("smtpserver"));
    final DynamicForm smtpForm = new DynamicForm();
    smtpForm.setDisabled(true);
    smtpForm.setID("smtpForm");
    smtpForm.setTitleOrientation(TitleOrientation.TOP);
    smtpForm.setValuesManager(vm);
    smtpTab.setPane(smtpForm);

    TextItem smtpHost = ItemFactory.newTextItem(SMTP_HOST, "host", null);
    smtpHost.setValue("localhost");
    smtpHost.setWrapTitle(false);

    IntegerItem smtpPort = ItemFactory.newIntegerItem(SMTP_PORT, "port", null);
    smtpPort.setValue(25);
    smtpPort.setWrapTitle(false);

    TextItem smtpUsername = ItemFactory.newTextItem(SMTP_USERNAME, "username", null);
    smtpUsername.setWrapTitle(false);

    PasswordItem smtpPassword = new PasswordItem();
    smtpPassword.setTitle(I18N.message("password"));
    smtpPassword.setName(SMTP_PASSWORD);
    smtpPassword.setWrapTitle(false);

    BooleanItem smtpSecureAuth = new BooleanItem();
    smtpSecureAuth.setTitle(I18N.message("secureauth"));
    smtpSecureAuth.setName(SMTP_SECURE_AUTH);
    smtpSecureAuth.setWrapTitle(false);
    smtpSecureAuth.setDefaultValue(false);

    SelectItem smtpConnectionSecurity = new SelectItem();
    smtpConnectionSecurity.setTitle(I18N.message("connectionsecurity"));
    smtpConnectionSecurity.setName("smtpConnectionSecurity");
    smtpConnectionSecurity.setDefaultValue(Constants.SMTP_SECURITY_NONE);
    smtpConnectionSecurity.setWrapTitle(false);
    LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
    valueMap.put(Constants.SMTP_SECURITY_NONE, I18N.message("none"));
    valueMap.put(Constants.SMTP_SECURITY_SSL, I18N.message("ssl"));
    valueMap.put(Constants.SMTP_SECURITY_TLS, I18N.message("tls"));
    valueMap.put(Constants.SMTP_SECURITY_TLS_IF_AVAILABLE, I18N.message("tlsavailable"));
    smtpConnectionSecurity.setValueMap(valueMap);

    TextItem smtpSender = ItemFactory.newEmailItem(SMTP_SENDER, "sender", false);
    smtpSender.setWrapTitle(false);
    smtpSender.setValue("*****@*****.**");

    smtpForm.setFields(
        smtpHost,
        smtpPort,
        smtpUsername,
        smtpPassword,
        smtpSender,
        smtpConnectionSecurity,
        smtpSecureAuth);
    return smtpTab;
  }
  private void initComponents() {
    HLayout formsHLayout = new HLayout();
    formsHLayout.setWidth100();
    formsHLayout.setHeight("*");
    formsHLayout.setMembersMargin(5);

    DynamicForm jobNamesForm = new DynamicForm();
    jobNamesForm.setWidth100();
    jobNamesForm.setHeight100();
    jobNamesForm.setGroupTitle("Filter Jobs");
    jobNamesForm.setIsGroup(true);
    jobNamesForm.setTitleOrientation(TitleOrientation.TOP);
    jobNamesForm.setNumCols(2);
    jobNamesForm.setValuesManager(valuesManager);

    jobNamesForm.setDataFetchMode(FetchMode.BASIC);

    CheckboxItem selectAllJobNamesChkItem = new CheckboxItem();
    selectAllJobNamesChkItem.setValue(true);
    selectAllJobNamesChkItem.setTitle("Select All Jobs");
    selectAllJobNamesChkItem.setWidth("*");
    selectAllJobNamesChkItem.setName("selectAllJobNames");
    selectAllJobNamesChkItem.addChangedHandler(
        new ChangedHandler() {

          @Override
          public void onChanged(ChangedEvent event) {
            if ((Boolean) event.getValue()) {
              selectJobNameGrid.setDisabled(true);
              selectJobNameGrid.setCriterion(null);
            } else {
              selectJobNameGrid.setDisabled(false);
              // selectJobNameGrid.setCriterion(new Criterion().seta);
            }
          }
        });

    selectJobNameGrid.setTitle("Select Jobs");
    selectJobNameGrid.setWidth(280);
    selectJobNameGrid.setMultiple(true);
    selectJobNameGrid.setMultipleAppearance(MultipleAppearance.GRID);
    selectJobNameGrid.setValueMap("job", "job1", "job2", "Goat", "Marmoset", "Mouse");
    selectJobNameGrid.setName("selectedJobNames");
    selectJobNameGrid.setCriteriaField("selectedJobNames");
    /*selectJobNameGrid.addClickHandler(new ClickHandler() {
    	@Override
    	public void onClick(ClickEvent event) {
    		if(event.getSource().equals(selectJobNameGrid)){
    			String[] values = selectJobNameGrid.getValues();
    			valuesManager.setAttribute("selectedJobNames", values, true);
    		}
    	}
    });*/

    executionStartDate.setName("executionStartDate");
    executionStartDate.setTitle("Exceution Start Date");
    executionStartDate.setRequired(true);

    executionEndDate.setName("executionEndDate");
    executionEndDate.setTitle("Exceution End Date");
    executionEndDate.setRequired(true);

    executionStartTime.setName("executionStartTime");
    executionStartTime.setTitle("Exceution Start Time");
    executionStartTime.setRequired(true);

    executionEndTime.setName("executionEndTime");
    executionEndTime.setTitle("Exceution End Time");
    executionEndTime.setRequired(true);

    FormItem[] formItems =
        new FormItem[] {
          selectAllJobNamesChkItem,
          selectJobNameGrid,
          executionStartDate,
          executionStartTime,
          executionEndDate,
          executionEndTime
        };
    jobNamesForm.setDataSource(HistoricalJobMonitorDataSource.getInstance(), formItems);
    jobNamesForm.setFields(formItems);
    formsHLayout.addMember(jobNamesForm);

    addMember(formsHLayout);

    addMember(searchButton);
  }
 @Override
 protected void clean() {
   super.clean();
   selectState.setValueMap(GWTUtils.getEmptyValueMap());
 }
Exemplo n.º 15
0
  /** Prepares the database tab */
  private Tab setupDatabase(final ValuesManager vm) {
    // Prepare the map with all database engines
    engines.put(
        MYSQL,
        new String[] {
          "MySQL 5.x",
          "com.mysql.jdbc.Driver",
          "jdbc:mysql://<server>[,<failoverhost>][<:3306>]/<database>",
          "org.hibernate.dialect.MySQLDialect",
          "SELECT 1"
        });
    engines.put(
        "PostgreSQL",
        new String[] {
          "PostgreSQL 9.x",
          "org.postgresql.Driver",
          "jdbc:postgresql:[<//server>[<:5432>/]]<database>",
          "org.hibernate.dialect.PostgreSQLDialect",
          "SELECT 1"
        });
    engines.put(
        ORACLE,
        new String[] {
          "Oracle 10g/11g",
          "oracle.jdbc.driver.OracleDriver",
          "jdbc:oracle:thin:@<server>[<:1521>]:<sid>",
          "org.hibernate.dialect.Oracle10gDialect",
          "SELECT 1 FROM DUAL"
        });
    engines.put(
        SQLSERVER,
        new String[] {
          "SQL Server 2005/2008",
          "net.sourceforge.jtds.jdbc.Driver",
          "jdbc:jtds:sqlserver://<server>[:<1433>]/<database>;instance=<instance>",
          "org.hibernate.dialect.SQLServerDialect",
          "SELECT 1"
        });

    Tab databaseTab = new Tab();
    databaseTab.setTitle(I18N.message("database"));

    final DynamicForm databaseForm = new DynamicForm();
    databaseForm.setWidth(450);
    databaseForm.setID("database");
    databaseForm.setValuesManager(vm);
    databaseForm.setDisabled(true);

    RadioGroupItem dbType = new RadioGroupItem();
    dbType.setName(DB_TYPE);
    dbType.setWrapTitle(false);
    dbType.setRequired(true);
    dbType.setVertical(false);
    dbType.setValueMap(I18N.message(INTERNAL), I18N.message("external"));
    dbType.setValue(I18N.message(INTERNAL));
    dbType.setRedrawOnChange(true);
    dbType.setTitle(I18N.message("dbtype"));

    // The database engine, if the External db was chosen
    SelectItem dbEngine = new SelectItem();
    dbEngine.setTitle(I18N.message("dbengine"));
    dbEngine.setWrapTitle(false);
    dbEngine.setVisible(false);
    dbEngine.setName(DB_ENGINE);
    dbEngine.setDefaultValue(MYSQL);
    LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
    for (String engine : engines.keySet()) {
      valueMap.put(engine, engines.get(engine)[0]);
    }
    dbEngine.setValueMap(valueMap);
    dbEngine.setShowIfCondition(
        new FormItemIfFunction() {
          public boolean execute(FormItem item, Object value, DynamicForm form) {
            return !I18N.message(INTERNAL).equals(databaseForm.getValue(DB_TYPE));
          }
        });
    RequiredIfValidator ifValidator = new RequiredIfValidator();
    ifValidator.setExpression(
        new RequiredIfFunction() {
          public boolean execute(FormItem formItem, Object value) {
            return !I18N.message(INTERNAL).equals(databaseForm.getValue(DB_TYPE));
          }
        });
    dbEngine.setValidators(ifValidator);
    dbEngine.addChangeHandler(
        new ChangeHandler() {
          public void onChange(ChangeEvent event) {
            String selectedItem = (String) event.getValue();
            databaseForm.getField(DB_DRIVER).setValue(engines.get(selectedItem)[1]);
            databaseForm.getField(DB_URL).setValue(engines.get(selectedItem)[2]);
          }
        });

    // The driver for the external DB
    TextItem dbDriver = ItemFactory.newTextItem(DB_DRIVER, "driverclass", null);
    dbDriver.setVisible(false);
    dbDriver.setDefaultValue(engines.get(MYSQL)[1]);
    dbDriver.setWrapTitle(false);
    dbDriver.setShowIfCondition(
        new FormItemIfFunction() {
          public boolean execute(FormItem item, Object value, DynamicForm form) {
            return !I18N.message(INTERNAL).equals(databaseForm.getValue(DB_TYPE));
          }
        });
    dbDriver.setValidators(ifValidator);

    // The connection URL to external DB
    TextItem dbUrl = ItemFactory.newTextItem(DB_URL, "connectionurl", null);
    dbUrl.setWidth(200);
    dbUrl.setVisible(false);
    dbUrl.setDefaultValue(engines.get(MYSQL)[2]);
    dbUrl.setWrapTitle(false);
    dbUrl.setShowIfCondition(
        new FormItemIfFunction() {
          public boolean execute(FormItem item, Object value, DynamicForm form) {
            return !I18N.message(INTERNAL).equals(databaseForm.getValue(DB_TYPE));
          }
        });
    dbUrl.setValidators(ifValidator);

    // The username to access the external DB
    TextItem dbUsername = ItemFactory.newTextItem(DB_USERNAME, "username", null);
    dbUsername.setVisible(false);
    dbUsername.setWrapTitle(false);
    dbUsername.setShowIfCondition(
        new FormItemIfFunction() {
          public boolean execute(FormItem item, Object value, DynamicForm form) {
            return !I18N.message(INTERNAL).equals(databaseForm.getValue(DB_TYPE));
          }
        });

    // The password to access the external DB
    PasswordItem dbPassword = new PasswordItem();
    dbPassword.setVisible(false);
    dbPassword.setTitle(I18N.message("password"));
    dbPassword.setName(DB_PASSWORD);
    dbPassword.setWrapTitle(false);
    dbPassword.setShowIfCondition(
        new FormItemIfFunction() {
          public boolean execute(FormItem item, Object value, DynamicForm form) {
            return !I18N.message(INTERNAL).equals(databaseForm.getValue(DB_TYPE));
          }
        });

    databaseForm.setFields(dbType, dbEngine, dbDriver, dbUrl, dbUsername, dbPassword);
    databaseTab.setPane(databaseForm);
    return databaseTab;
  }
Exemplo n.º 16
0
  public DeliveryOrderLayout(final User currentUser) {
    // Tab reviseTab = new Tab("ข้อมูลใบแจ้งหนี้", "icons/16/search-good-icon.png");
    // VLayout reviseLayout = new VLayout();
    // reviseLayout.
    setWidth(750);
    // reviseLayout.
    setHeight100();

    HLayout searchLayout = new HLayout();
    searchLayout.setHeight(20);

    final DynamicForm searchForm = new DynamicForm();
    searchForm.setWidth(450);
    searchForm.setHeight(30);
    searchForm.setMargin(5);
    searchForm.setNumCols(4);
    searchForm.setCellPadding(2);
    searchForm.setAutoFocus(true);
    searchForm.setSelectOnFocus(true);
    searchForm.setIsGroup(true);
    searchForm.setDataSource(DeliveryDS.getInstance());
    searchForm.setUseAllDataSourceFields(false);
    searchForm.setGroupTitle("ค้นหารายการนำส่งสินค้า");

    final TextItem deliveryText = new TextItem("delivery_id", "รหัสรายการนำส่งสินค้า");
    deliveryText.setWrapTitle(false);
    deliveryText.setOperator(OperatorId.REGEXP);
    final TextItem saleText = new TextItem("sale_id", "รหัสรายการขาย");
    saleText.setWrapTitle(false);
    saleText.setOperator(OperatorId.REGEXP);
    final SelectItem statusSelected = new SelectItem("issued_status", "สถานะ");
    statusSelected.setWrapTitle(false);
    // statusSelected.setValueMap("กำลังนำส่ง", "นำส่งแล้ว");
    statusSelected.setValueMap(DeliveryStatus.getIssueValueMap());
    statusSelected.setAllowEmptyValue(true);
    statusSelected.setEmptyDisplayValue("ทั้งหมด");
    statusSelected.setOperator(OperatorId.EQUALS);
    final TextItem cidText = new TextItem("cid", "รหัสลูกค้า");
    cidText.setWrapTitle(false);
    cidText.setOperator(OperatorId.REGEXP);

    final DynamicForm dateForm = new DynamicForm();
    dateForm.setWidth(300);
    dateForm.setHeight(30);
    dateForm.setMargin(5);
    dateForm.setNumCols(2);
    dateForm.setCellPadding(2);
    dateForm.setSelectOnFocus(true);
    dateForm.setIsGroup(true);
    // dateForm.setGroupTitle("วันที่นำส่งสินค้า");
    dateForm.setGroupTitle("วันที่ออกใบนำส่งสินค้า");
    DateRange dateRange = new DateRange();
    dateRange.setRelativeStartDate(new RelativeDate("-7d"));
    dateRange.setRelativeEndDate(RelativeDate.TODAY);
    // final DateItem from = new DateItem("delivery_from" , "ตั้งแต่");
    // final DateItem to = new DateItem("delivery_to" , "ถึง");
    final DateItem from = new DateItem("created_from", "ตั้งแต่");
    final DateItem to = new DateItem("created_to", "ถึง");
    from.setDefaultChooserDate(dateRange.getStartDate());
    from.setDefaultValue(dateRange.getStartDate());
    from.setUseTextField(true);
    to.setDefaultChooserDate(dateRange.getEndDate());
    to.setDefaultValue(dateRange.getEndDate());
    to.setUseTextField(true);

    FromToValidate.addValidator(from, to);
    searchForm.setItems(deliveryText, statusSelected, saleText, cidText);
    // searchForm.setItems(Text, cidText, cnameText);
    dateForm.setItems(from, to);

    // final ListGrid deliveryListGrid = new EditorListGrid(new RequestViewWindow(), currentUser);
    final ListGrid deliveryListGrid = new ListGrid();

    deliveryListGrid.setAutoFetchData(true);
    deliveryListGrid.setCanMultiSort(true);
    // deliveryListGrid.setCriteria(new Criterion("status", OperatorId.NOT_EQUAL, "ยกเลิก"));

    deliveryListGrid.setDataSource(DeliveryDS.getInstance());
    deliveryListGrid.setInitialSort(
        new SortSpecifier[] {
          new SortSpecifier("issued_status", SortDirection.ASCENDING),
          new SortSpecifier("delivery", SortDirection.DESCENDING)
        });
    deliveryListGrid.setUseAllDataSourceFields(false);
    deliveryListGrid.setGroupByField("issued_status");
    deliveryListGrid.setGroupStartOpen(GroupStartOpen.ALL);

    ListGridField delivery_id = new ListGridField("delivery_id", 120);
    ListGridField sale_id = new ListGridField("sale_id", 100);
    // ListGridField quote_id = new ListGridField("quote_id" , 90);
    ListGridField cus_name = new ListGridField("cus_name", 180);
    ListGridField status = new ListGridField("issued_status");
    //		LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
    //		valueMap.put("3_approved", "approved");
    //		status.setValueMap(valueMap);
    ListGridField total_amount = new ListGridField("total_amount", 120);
    total_amount.setCellFormatter(FieldFormatter.getIntegerFormat());
    total_amount.setAlign(Alignment.RIGHT);
    //		ListGridField netInclusive = new ListGridField("netInclusive", 125);
    //		netInclusive.setCellFormatter(FieldFormatter.getPriceFormat());
    //		netInclusive.setAlign(Alignment.RIGHT);
    ListGridField delivery_date = new ListGridField("delivery", 120);
    //		created_date.setType(ListGridFieldType.DATE);
    //		created_date.setCellFormatter(new CellFormatter() {
    //
    //			@Override
    //			public String format(Object arg0, ListGridRecord arg1, int arg2, int arg3) {
    //			DateTimeFormat fmt = DateTimeFormat.getFormat("MM/dd/yyyy");
    //			return fmt.format(arg1.getAttributeAsDate("created_date"));
    //			}
    //		});

    //		ListGridField iconField = new ListGridField("viewDeliveryField", "เรียกดูรายการ", 80);

    deliveryListGrid.setFields(status, delivery_id, sale_id, cus_name, total_amount, delivery_date);

    searchLayout.addMembers(searchForm, dateForm);
    // reviseLayout.
    addMember(searchLayout);

    HLayout buttonLayout = new HLayout();
    buttonLayout.setMargin(10);
    buttonLayout.setMembersMargin(5);
    buttonLayout.setHeight(30);
    IButton searchButton = new IButton("ค้นหารายการนำส่งสินค้า");
    searchButton.setIcon("icons/16/icon_view.png");
    searchButton.setWidth(150);
    searchButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            Criterion search = new Criterion();
            search.addCriteria(searchForm.getValuesAsCriteria());
            AdvancedCriteria criteria =
                new AdvancedCriteria(
                    OperatorId.AND,
                    new Criterion[] {
                      // new Criterion("delivery", OperatorId.BETWEEN_INCLUSIVE,
                      // from.getValueAsDate(), to.getValueAsDate()),
                      new Criterion(
                          "created_date",
                          OperatorId.BETWEEN_INCLUSIVE,
                          from.getValueAsDate(),
                          to.getValueAsDate()),
                      search
                    });
            deliveryListGrid.fetchData(criteria);
            deliveryListGrid.deselectAllRecords();
          }
        });

    IButton listAllButton = new IButton("แสดงรายการทั้งหมด");
    listAllButton.setIcon("[SKIN]actions/refresh.png");
    listAllButton.setWidth(150);
    listAllButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            AdvancedCriteria criteria =
                new AdvancedCriteria(
                    OperatorId.AND,
                    new Criterion[] {
                      // new Criterion("delivery", OperatorId.BETWEEN_INCLUSIVE,
                      // from.getValueAsDate(), to.getValueAsDate())
                      new Criterion(
                          "created_date",
                          OperatorId.BETWEEN_INCLUSIVE,
                          from.getValueAsDate(),
                          to.getValueAsDate())
                    });
            searchForm.reset();
            deliveryListGrid.fetchData(criteria);
            deliveryListGrid.deselectAllRecords();
          }
        });

    HLayout empty = new HLayout();
    empty.setWidth("*");
    IButton viewButton = new IButton("เรียกดูรายการ");
    viewButton.setIcon("icons/16/icon_view.png");
    viewButton.setWidth(150);
    viewButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            ListGridRecord selected = deliveryListGrid.getSelectedRecord();
            if (selected == null) {
              SC.warn("กรุณาเลือกรายการเบิกสินค้า");
              return;
            }
            RequestViewWindow deliveryWindow = new RequestViewWindow();
            deliveryWindow.show(selected, false, currentUser, 1);
          }
        });

    IButton receiveOrderButton = new IButton("เบิกจ่ายสินค้า");
    receiveOrderButton.setIcon("icons/16/actions-receive-icon.png");
    receiveOrderButton.setWidth(100);
    receiveOrderButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            ListGridRecord selected = deliveryListGrid.getSelectedRecord();
            if (selected == null) {
              SC.warn("กรุณาเลือกรายการเบิกสินค้า");
              return;
            }

            if (selected
                .getAttributeAsString("issued_status")
                .equalsIgnoreCase("0_product_request")) {
              RequestViewWindow deliveryWindow = new RequestViewWindow();
              deliveryWindow.show(selected, true, currentUser, 2);
            } else {
              SC.warn("จ่ายสินค้าแล้ว");
            }
          }
        });

    buttonLayout.addMembers(searchButton, listAllButton, empty, viewButton, receiveOrderButton);
    // buttonLayout.addMembers(searchButton, listAllButton);
    // reviseLayout.
    addMember(buttonLayout);

    VLayout gridLayout = new VLayout();
    gridLayout.setWidth100();
    gridLayout.setHeight(355);

    gridLayout.addMember(deliveryListGrid);
    // reviseLayout.
    addMember(gridLayout);

    // reviseTab.setPane(reviseLayout);
    // return reviseTab;
  }
Exemplo n.º 17
0
 private FieldDefinitionItem createField(FieldDefinition field) {
   FormItem fi = null;
   switch (field.getFieldType()) {
     case FieldDefinition.FT_STRING:
       fi = new TextItem();
       break;
     case FieldDefinition.FT_INTEGER:
       fi = new IntegerItem();
       break;
     case FieldDefinition.FT_DOUBLE:
       fi = new FloatItem();
       break;
     case FieldDefinition.FT_BOOLEAN:
       fi = new CheckboxItem();
       break;
     case FieldDefinition.FT_TEXTAREA:
       fi = new TextAreaItem();
       // fi.setWidth("10000px");
       break;
     case FieldDefinition.FT_STATICTEXT:
       fi = new StaticTextItem();
       break;
     case FieldDefinition.FT_COMBO:
       fi = new ComboBoxItem();
       if (field.isNoUnknownValueComboValue())
         ((ComboBoxItem) fi).setAddUnknownValues(!field.isNoUnknownValueComboValue());
       break;
     case FieldDefinition.FT_SELECTION:
       fi = new SelectItem();
       if (field.isNoUnknownValueComboValue())
         ((SelectItem) fi).setAddUnknownValues(!field.isNoUnknownValueComboValue());
       break;
     case FieldDefinition.FT_DATE:
       fi = new CurrentTimeItem();
       break;
     case FieldDefinition.FT_CHK_GRID:
       fi = new ChkGridItem();
       break;
     case FieldDefinition.FT_MAP_ITEM:
       fi = new MapButton(this, field);
       break;
     case FieldDefinition.FT_IMAGE_ITEM:
       fi = new ImageItem(this, field);
       break;
     case FieldDefinition.FT_CUSTOM:
       fi = new CanvasItem();
       break;
     default:
       break;
   }
   if (fi == null) {
     return null;
   }
   fi.setTitle(DocFlow.getCaption(field.getFieldCaptionId(), field.getFieldCaption()));
   if (field.getFieldWidth() != null && !field.getFieldWidth().isEmpty()) {
     fi.setWidth(field.getFieldWidth());
   }
   if (field.getFieldHeight() != null && !field.getFieldHeight().isEmpty()) {
     fi.setHeight(field.getFieldHeight());
   }
   if (field.isFieldReadOnly()) {
     if (field.getFieldType() == FieldDefinition.FT_COMBO
         || field.getFieldType() == FieldDefinition.FT_SELECTION
         || field.getFieldType() == FieldDefinition.FT_DATE) fi.setCanEdit(false);
     else fi.setCanEdit(false);
   }
   setDefaultValue(field, fi);
   if (field.isHidden()) fi.setVisible(false);
   if (field.isDisabled()) {
     fi.setDisabled(true);
   }
   return new FieldDefinitionItem(field, fi);
 }
Exemplo n.º 18
0
  public PZoneChange() {
    restrictedEdits = DocFlow.user_obj.getZoneConfiguration().getRestricted_edits();
    CHARCOUNT = DocFlow.user_obj.getZoneConfiguration().getCharcount();
    tsMain = new ToolStrip();
    tsMain.setWidth100();
    HashMap<String, String> listSqls = new HashMap<String, String>();
    listSqls.put("" + ClSelection.T_REGION, "" + ClSelection.T_REGION);
    listSqls.put("" + ClSelection.T_CUST_TYPE, "" + ClSelection.T_CUST_TYPE);
    dsZoneDS = DocFlow.getDataSource("ZoneDS");
    dsCustomer = DocFlow.getDataSource("CustomerDS");
    miSearch = new ToolStripButton("Search");
    tiNewZone = new TextItem("newzone", "New Zone");
    biSaveData = new ButtonItem("saveData", "Change Zone");

    tiNewZone.addKeyPressHandler(
        new KeyPressHandler() {

          @Override
          public void onKeyPress(KeyPressEvent event) {
            newZoneKeyPressed(event);
          }
        });
    VLayout vl = new VLayout();

    dmCriteria = new DynamicForm();
    dmCriteria.setNumCols(4);
    dmCriteria.setHeight("8%");
    dmCriteria.setTitleOrientation(TitleOrientation.TOP);
    siCustomerType = new SelectItem("custypeid", "Customer Type");
    siZones = new SelectItem("zones", "Zones");
    siZones.setValueField("zone");
    siZones.setAutoFetchData(false);
    siZones.setDisplayField("zone");
    siZones.setOptionDataSource(dsZoneDS);

    tsMain.setHeight("15");
    vl.addMember(tsMain);
    tsMain.addButton(miSearch);
    vl.addMember(dmCriteria);
    lgCustomers = new ListGrid();
    lgCustomers.setDataSource(dsCustomer);
    lgCustomers.setAutoFetchData(false);
    lgCustomers.setShowResizeBar(false);
    lgCustomers.setCanDragRecordsOut(true);
    lgCustomers.setDragDataAction(DragDataAction.COPY);
    lgCustomers.setHeight100();
    lgCustomers.setHeight100();

    DataSource dsSelectedData = new DataSource();
    dsSelectedData.setClientOnly(true);

    DataSourceIntegerField dsfcusid = new DataSourceIntegerField("cusid", "Customer ID");
    dsfcusid.setPrimaryKey(true);

    DataSourceTextField dsZone = new DataSourceTextField("zone", "Zone");
    dsSelectedData.setFields(dsfcusid, dsZone);

    lgZoneCustomers = new ListGrid();
    lgZoneCustomers.setDataSource(dsSelectedData);
    lgZoneCustomers.setAutoFetchData(false);
    lgZoneCustomers.setCanAcceptDroppedRecords(true);
    lgZoneCustomers.setCanRemoveRecords(true);
    lgZoneCustomers.setAutoFetchData(false);
    lgZoneCustomers.setPreventDuplicates(true);
    lgZoneCustomers.setHeight100();
    lgZoneCustomers.setWidth100();

    HStack hStack = new HStack(10);
    hStack.setWidth100();
    hStack.setHeight100();
    hStack.setShowEdges(true);

    VStack vStack = new VStack();
    vStack.setHeight100();
    vStack.setWidth("60%");
    vStack.addMember(lgCustomers);
    hStack.addMember(vStack);
    TransferImgButton arrowImg = new TransferImgButton(TransferImgButton.RIGHT);
    arrowImg.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            lgZoneCustomers.transferSelectedData(lgCustomers);
          }
        });

    TransferImgButton arrowImgLeft = new TransferImgButton(TransferImgButton.LEFT);
    arrowImgLeft.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            lgZoneCustomers.removeSelectedData();
          }
        });
    hStack.addMember(arrowImg);
    hStack.addMember(arrowImgLeft);
    VStack vStack2 = new VStack();
    vStack2.setHeight100();
    vStack2.setWidth("40%");
    vStack2.addMember(lgZoneCustomers);
    hStack.addMember(vStack2);

    miSearch.addClickHandler(
        new ClickHandler() {

          @Override
          public void onClick(ClickEvent event) {
            search();
          }
        });

    lgCustomers.addClickHandler(
        new com.smartgwt.client.widgets.events.ClickHandler() {

          @Override
          public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {}
        });

    vl.addMember(hStack);

    this.addMember(vl);
    DocFlow.docFlowService.getListTypesForDocument(
        listSqls,
        -1,
        new AsyncCallback<HashMap<String, ArrayList<ClSelectionItem>>>() {

          @Override
          public void onFailure(Throwable caught) {
            setResults(null);
          }

          @Override
          public void onSuccess(HashMap<String, ArrayList<ClSelectionItem>> result) {

            setResults(result);
          }
        });
  }
Exemplo n.º 19
0
 private void updateLists() {
   mixTypes.setValueMap(diff(allTypes, nodeTypes));
   selectedTypes.setValueMap(diff(nodeTypes, allTypes));
 }
Exemplo n.º 20
0
  public ReportReceiveLayout_2(final User currentUser) {
    setWidth(950);
    setHeight100();

    HLayout searchLayout = new HLayout();
    searchLayout.setHeight(20);

    final DynamicForm searchForm = new DynamicForm();
    searchForm.setWidth(450);
    searchForm.setHeight(30);
    searchForm.setMargin(5);
    searchForm.setNumCols(4);
    searchForm.setCellPadding(2);
    searchForm.setAutoFocus(true);
    searchForm.setSelectOnFocus(true);
    searchForm.setIsGroup(true);
    searchForm.setDataSource(TransferDS.getInstance());
    searchForm.setUseAllDataSourceFields(false);
    searchForm.setGroupTitle("ตัวกรอง");

    final SelectItem statusSelected = new SelectItem("status", "สถานะ");
    statusSelected.setWrapTitle(false);
    // statusSelected.setValueMap("รอแก้ไข", "รออนุมัติ", "อนุมัติแล้ว");
    statusSelected.setValueMap(TransferStatus.getValueMap());
    statusSelected.setAllowEmptyValue(true);
    statusSelected.setEmptyDisplayValue("ทั้งหมด");
    statusSelected.setOperator(OperatorId.EQUALS);
    final TextItem jidText = new TextItem("plan_id", "รหัสแผนการผลิต");
    jidText.setWrapTitle(false);
    jidText.setOperator(OperatorId.REGEXP);
    //		final TextItem smidText = new TextItem("smid", "รหัสช่าง");
    //		smidText.setWrapTitle(false);
    //		smidText.setOperator(OperatorId.REGEXP);

    //		final DynamicForm dateForm = new DynamicForm();
    //		dateForm.setWidth(300);
    //		dateForm.setHeight(30);
    //		dateForm.setMargin(5);
    //		dateForm.setNumCols(2);
    //		dateForm.setCellPadding(2);
    //		dateForm.setSelectOnFocus(true);
    //		dateForm.setIsGroup(true);
    //		dateForm.setGroupTitle("วันที่ขอโอนสินค้า");
    DateRange dateRange = new DateRange();
    dateRange.setRelativeStartDate(new RelativeDate("-1w"));
    dateRange.setRelativeEndDate(RelativeDate.TODAY);
    final DateItem from = new DateItem("create_from", "ตั้งแต่");
    final DateItem to = new DateItem("create_to", "ถึง");
    from.setDefaultChooserDate(dateRange.getStartDate());
    from.setDefaultValue(dateRange.getStartDate());
    from.setUseTextField(true);
    to.setDefaultChooserDate(dateRange.getEndDate());
    to.setDefaultValue(dateRange.getEndDate());
    to.setUseTextField(true);

    searchForm.setItems(jidText, statusSelected, from, to);
    // searchForm.setItems(planText, jidText);
    //        dateForm.setItems(from, to);

    final ListGrid orderListGrid = new ListGrid();

    orderListGrid.setAutoFetchData(true);
    orderListGrid.setCanMultiSort(true);
    orderListGrid.setShowRowNumbers(true);
    orderListGrid.setShowGridSummary(true);

    AdvancedCriteria criteria =
        new AdvancedCriteria(
            OperatorId.AND,
            new Criterion[] {
              // new Criterion("status", OperatorId.NOT_EQUAL, "3_to_next_process"),
              // new Criterion("created_date", OperatorId.BETWEEN_INCLUSIVE, from.getValueAsDate(),
              // to.getValueAsDate())
              new Criterion(
                  "created_date",
                  OperatorId.BETWEEN_INCLUSIVE,
                  dateRange.getStartDate(),
                  dateRange.getEndDate())
            });
    orderListGrid.setCriteria(criteria);

    orderListGrid.setDataSource(TransferDS.getInstance());
    orderListGrid.setInitialSort(
        new SortSpecifier[] {
          new SortSpecifier("status", SortDirection.DESCENDING),
          new SortSpecifier("created_date", SortDirection.DESCENDING)
        });
    orderListGrid.setUseAllDataSourceFields(false);
    orderListGrid.setSelectionType(SelectionStyle.NONE);

    ListGridField transfer_id = new ListGridField("transfer_id", 100);
    transfer_id.setSummaryFunction(
        new SummaryFunction() {
          public Object getSummaryValue(Record[] records, ListGridField field) {
            return records.length + " รายการ";
          }
        });
    transfer_id.setShowGridSummary(true);

    ListGridField status = new ListGridField("status", 120);
    ListGridField plan_id = new ListGridField("plan_id", 100);
    ListGridField transfer_by = new ListGridField("transfer_by");
    ListGridField transfer_date = new ListGridField("transfer_date", 150);

    ListGridField total_weight = new ListGridField("total_sent_weight", 120);
    total_weight.setCellFormatter(FieldFormatter.getNumberFormat());
    total_weight.setAlign(Alignment.RIGHT);
    total_weight.setSummaryFunction(SummaryFunctionType.SUM);
    total_weight.setShowGridSummary(true);

    ListGridField total_amount = new ListGridField("total_sent_amount", 120);
    total_amount.setCellFormatter(FieldFormatter.getNumberFormat());
    total_amount.setAlign(Alignment.RIGHT);
    total_amount.setSummaryFunction(SummaryFunctionType.SUM);
    total_amount.setShowGridSummary(true);

    orderListGrid.setFields(
        transfer_date, transfer_id, status, plan_id, transfer_by, total_weight, total_amount);

    // orderListGrid.hideField("status");

    HLayout buttonLayout = new HLayout();
    buttonLayout.setMargin(10);
    buttonLayout.setMembersMargin(5);
    buttonLayout.setHeight(30);
    IButton searchButton = new IButton("ค้นหาคำขอโอนสินค้า");
    searchButton.setIcon("icons/16/reports-icon.png");
    searchButton.setWidth(170);
    searchButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            Criterion search = new Criterion();
            search.addCriteria(searchForm.getValuesAsCriteria());
            AdvancedCriteria criteria =
                new AdvancedCriteria(
                    OperatorId.AND,
                    new Criterion[] {
                      new Criterion(
                          "created_date",
                          OperatorId.BETWEEN_INCLUSIVE,
                          from.getValueAsDate(),
                          to.getValueAsDate()),
                      search
                    });
            reportDate.setContents(
                "ตั้งแต่วันที่ "
                    + DateTimeFormat.getFormat("d-M-yyyy").format(from.getValueAsDate())
                    + " ถึงวันที่ "
                    + DateTimeFormat.getFormat("d-M-yyyy").format(to.getValueAsDate()));
            orderListGrid.fetchData(criteria);
            orderListGrid.deselectAllRecords();
          }
        });

    IButton listAllButton = new IButton("ล้างรายการค้นหา");
    listAllButton.setIcon("[SKIN]actions/refresh.png");
    listAllButton.setWidth(150);
    listAllButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            AdvancedCriteria criteria =
                new AdvancedCriteria(
                    OperatorId.AND,
                    new Criterion[] {
                      new Criterion(
                          "created_date",
                          OperatorId.BETWEEN_INCLUSIVE,
                          from.getValueAsDate(),
                          to.getValueAsDate())
                    });
            searchForm.reset();
            reportDate.setContents(
                "ตั้งแต่วันที่ "
                    + DateTimeFormat.getFormat("d-M-yyyy").format(from.getValueAsDate())
                    + " ถึงวันที่ "
                    + DateTimeFormat.getFormat("d-M-yyyy").format(to.getValueAsDate()));
            orderListGrid.fetchData(criteria);
            orderListGrid.deselectAllRecords();
          }
        });

    IButton printButton = new IButton("พิมพ์รายงาน");
    printButton.setIcon("icons/16/print.png");
    printButton.setWidth(120);

    buttonLayout.addMembers(searchButton, listAllButton, printButton);

    searchLayout.addMembers(searchForm);
    // reviseLayout.
    addMember(searchLayout);

    // reviseLayout.
    addMember(buttonLayout);

    final VLayout gridLayout = new VLayout();
    gridLayout.setWidth100();
    gridLayout.setHeight(500);
    Label text = new Label();
    text.setContents("รายงานการโอนสินค้าเข้าคลังสินค้า");
    text.setAlign(Alignment.CENTER);
    text.setHeight(10);
    text.setStyleName("printTitle");
    reportDate = new Label();
    reportDate.setContents(
        "ตั้งแต่วันที่ "
            + DateTimeFormat.getFormat("d-M-yyyy").format(from.getValueAsDate())
            + " ถึงวันที่ "
            + DateTimeFormat.getFormat("d-M-yyyy").format(to.getValueAsDate()));
    reportDate.setAlign(Alignment.CENTER);
    reportDate.setHeight(10);
    reportDate.setStyleName("printDetails");

    gridLayout.addMember(text);
    gridLayout.addMember(reportDate);
    gridLayout.addMember(orderListGrid);
    addMember(gridLayout);

    printButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            Canvas.showPrintPreview(gridLayout);
          }
        });
  }
Exemplo n.º 21
0
  private void initEditWindow() {

    String strBookName = theBook.getBookName();

    this.setAutoSize(true);
    this.setTitle("《" + strBookName + "》" + "修改信息");
    this.setCanDragReposition(true);
    this.setCanDragResize(false);
    this.setAutoCenter(true);
    this.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);

    VLayout vLayout;
    HLayout hLayout;
    HLayout buttonLayout;

    vLayout = new VLayout();
    vLayout.setWidth(WINDOW_WIDTH);
    vLayout.setHeight(WINDOW_HEIGHT);
    vLayout.setBorder("2px solid #7598C7");
    vLayout.setMargin(12);
    vLayout.setPadding(14);

    hLayout = new HLayout();
    hLayout.setWidth(WINDOW_WIDTH);

    // HLayout
    // ---------------------------------------------------------------------------------------
    strBookPicUrl = theBook.getBookPicUrl();
    imgVLayout = new VLayout();
    imgVLayout.setWidth(IMG_WIDTH);
    bookPicUrlItem = new Img(strBookPicUrl, IMG_WIDTH, IMG_HEIGHT);
    //		bookPicUrlItem = new Img(strBookPicUrl, IMG_WIDTH, IMG_HEIGHT);
    //		bookPicUrlItem.setPrefix("/images/upload/");

    uploadPicButton = new IButton("上传封面");
    uploadPicButton.setIcon("actions/plus.png");
    uploadPicButton.setWidth(IMG_WIDTH);

    imgVLayout.setMembers(bookPicUrlItem, uploadPicButton);
    imgVLayout.setMembersMargin(10);

    // Form
    // 1-----------------------------------------------------------------------------------------
    SLBookDS theDataSource = new SLBookDS();
    Record theRecord = theBook.toRecord();
    theDataSource.addData(theRecord);

    bookForm1 = new DynamicForm();
    bookForm1.setDataSource(theDataSource);
    bookForm1.setNumCols(4);
    bookForm1.setWidth("*");
    bookForm1.setColWidths(100, "*", 100, "*");
    bookForm1.setCellPadding(5);

    TextItem bookNameItem = new TextItem("bookName", "书名");
    bookNameItem.setColSpan(4);
    bookNameItem.setWidth("100%");
    bookNameItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookNameItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    TextItem bookAuthorItem = new TextItem("bookAuthor", "作者");
    bookAuthorItem.setColSpan(4);
    bookAuthorItem.setWidth("100%");
    bookAuthorItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookAuthorItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    TextItem bookISBNItem = new TextItem("bookISBN", "ISBN");
    bookISBNItem.setColSpan(4);
    bookISBNItem.setWidth("100%");
    bookISBNItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookISBNItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookISBNItem.setDisabled(true);

    TextItem bookPublisherItem = new TextItem("bookPublisher", "出版社");
    bookPublisherItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookPublisherItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    DateItem bookPublishDateItem = new DateItem("bookPublishDate", "出版日期");
    bookPublishDateItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookPublishDateItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookPublishDateItem.setUseTextField(true);

    SelectItem bookClassItem = new SelectItem("bookClass", "类别");
    bookClassItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookClassItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookClassItem.setValueMap(
        "计算机/网络", "小说/文学", "哲学/文化", "经济/管理", "政治/军事", "励志/成长", "儿童/育儿", "心理", "法律", "历史", "其他");
    bookClassItem.setDefaultToFirstOption(true);

    SelectItem bookLanguageItem = new SelectItem("bookLanguage", "语言");
    bookLanguageItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookLanguageItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookLanguageItem.setValueMap("中文", "英语", "法语", "德语", "日语", "俄语", "韩语");
    bookLanguageItem.setDefaultToFirstOption(true);

    TextItem bookContributorItem = new TextItem("bookContributor", "贡献者");
    bookContributorItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookContributorItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    TextItem bookPriceItem = new TextItem("bookPrice", "价格");
    bookPriceItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookPriceItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    bookForm1.setFields(
        bookNameItem,
        bookAuthorItem,
        bookISBNItem,
        bookPublisherItem,
        bookPublishDateItem,
        bookClassItem,
        bookLanguageItem,
        bookContributorItem,
        bookPriceItem);

    bookForm1.selectRecord(theRecord);
    bookForm1.fetchData();

    // Form
    // 2-----------------------------------------------------------------------------------------
    bookForm2 = new DynamicForm();
    bookForm2.setDataSource(theDataSource);
    bookForm2.setNumCols(3);
    bookForm2.setWidth(WINDOW_WIDTH);
    bookForm2.setColWidths("*", "*", "*");
    bookForm2.setCellPadding(3);
    bookForm2.setCellBorder(1);
    bookForm2.setTitleOrientation(TitleOrientation.TOP);

    StaticTextItem bookTotalQuantityItemTitle = new StaticTextItem("bookTotalQuantityTitle", "");
    bookTotalQuantityItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header");
    bookTotalQuantityItemTitle.setShowTitle(false);

    StaticTextItem bookInStoreQuantityitemTitle =
        new StaticTextItem("bookInStoreQuantityTitle", "");
    bookInStoreQuantityitemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header");
    bookInStoreQuantityitemTitle.setShowTitle(false);

    StaticTextItem bookAvailableQuantityItemTitle =
        new StaticTextItem("bookAvailableQuantityTitle", "");
    bookAvailableQuantityItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header");
    bookAvailableQuantityItemTitle.setShowTitle(false);

    TextItem bookTotalQuantityItem = new TextItem("bookTotalQuantity", "");
    bookTotalQuantityItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookTotalQuantityItem.setShowTitle(false);

    TextItem bookInStoreQuantityitem = new TextItem("bookInStoreQuantity", "");
    bookInStoreQuantityitem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookInStoreQuantityitem.setShowTitle(false);

    TextItem bookAvailableQuantityItem = new TextItem("bookAvailableQuantity", "");
    bookAvailableQuantityItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookAvailableQuantityItem.setShowTitle(false);

    bookForm2.setFields(
        bookTotalQuantityItemTitle,
        bookInStoreQuantityitemTitle,
        bookAvailableQuantityItemTitle,
        bookTotalQuantityItem,
        bookInStoreQuantityitem,
        bookAvailableQuantityItem);

    bookForm2.selectRecord(theRecord);
    bookForm2.fetchData();

    // Form
    // 3-----------------------------------------------------------------------------------------
    bookForm3 = new DynamicForm();
    bookForm3.setDataSource(theDataSource);
    bookForm3.setWidth(WINDOW_WIDTH);
    bookForm3.setCellPadding(3);
    // bookForm2.setNumCols(2);
    bookForm3.setTitleOrientation(TitleOrientation.TOP);

    StaticTextItem bookIntroItemTitle = new StaticTextItem("bookIntroTitle", "");
    bookIntroItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_text_title");
    bookIntroItemTitle.setShowTitle(false);

    TextAreaItem bookIntroItem = new TextAreaItem("bookIntro", "");
    bookIntroItem.setTextBoxStyle("alex_bookdisplaywindow_form_intro_content");
    bookIntroItem.setShowTitle(false);
    bookIntroItem.setColSpan(2);
    bookIntroItem.setWidth("100%");

    bookForm3.setFields(bookIntroItemTitle, bookIntroItem);

    bookForm3.selectRecord(theRecord);
    bookForm3.fetchData();

    // buttonLayout
    // --------------------------------------------------------------------------------------
    buttonLayout = new HLayout();
    submitButton = new IButton("提交修改");
    submitButton.setIcon("actions/approve.png");
    buttonLayout.setMembers(submitButton);
    buttonLayout.setAlign(Alignment.RIGHT);

    hLayout.setMembers(imgVLayout, bookForm1);
    vLayout.setMembers(hLayout, bookForm2, bookForm3, buttonLayout);
    vLayout.setMembersMargin(20);

    this.addItem(vLayout);

    bind();
  }
  /** Instantiates a new digital object menu view. */
  @Inject
  public DigitalObjectMenuView(final LangConstants lang, final EventBus eventBus) {
    this.lang = lang;
    this.eventBus = eventBus;

    layout = new VLayout();

    layout.setHeight100();
    layout.setWidth100();
    layout.setOverflow(Overflow.AUTO);

    relatedGrid = new ListGrid();
    relatedGrid.setWidth100();
    relatedGrid.setHeight100();
    relatedGrid.setShowSortArrow(SortArrow.CORNER);
    relatedGrid.setShowAllRecords(true);
    relatedGrid.setAutoFetchData(false);
    relatedGrid.setCanHover(true);
    relatedGrid.setCanSort(false);
    ListGridField field1 = new ListGridField("relation", lang.relation());
    field1.setWidth("40%");
    ListGridField field2 = new ListGridField("uuid", "PID");
    field2.setWidth("*");
    relatedGrid.setFields(field1, field2);
    sectionRelated = new SectionStackSection();
    sectionRelated.setID(SECTION_RELATED_ID);
    sectionRelated.setTitle(lang.referencedBy());
    sectionRelated.setResizeable(true);
    sectionRelated.setItems(relatedGrid);
    sectionRelated.setExpanded(false);

    sideNavGrid =
        new ListGrid() {

          @Override
          protected Canvas getRollOverCanvas(Integer rowNum, Integer colNum) {
            final ListGridRecord rollOverRecord = this.getRecord(rowNum);
            if (rollOverCanvas == null) {
              rollOverCanvas = new HLayout();
              rollOverCanvas.setSnapTo("TR");
              rollOverCanvas.setWidth(50);
              rollOverCanvas.setHeight(22);
            }

            if (rollOverCanvas.getChildren().length > 0) {
              rollOverCanvas.removeChild(rollOverCanvas.getChildren()[0]);
            }
            final String lockOwner = rollOverRecord.getAttributeAsString(Constants.ATTR_LOCK_OWNER);
            if (lockOwner != null) {
              ImgButton lockImg = new ImgButton();
              lockImg.setShowDown(false);
              lockImg.setShowRollOver(false);
              lockImg.setLayoutAlign(Alignment.CENTER);

              if ("".equals(lockOwner)) {
                lockImg.setSrc("icons/16/lock_lock_all.png");
              } else if (lockOwner.length() > 0) {
                lockImg.setSrc("icons/16/lock_lock_all_red.png");
              }

              lockImg.setPrompt(lang.lockInfoButton());
              lockImg.setHeight(16);
              lockImg.setWidth(16);
              lockImg.addClickHandler(
                  new com.smartgwt.client.widgets.events.ClickHandler() {

                    @Override
                    public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
                      EditorSC.objectIsLock(
                          lang,
                          new LockInfo(
                              lockOwner,
                              rollOverRecord.getAttributeAsString(Constants.ATTR_LOCK_DESCRIPTION),
                              rollOverRecord.getAttributeAsStringArray(
                                  Constants.ATTR_TIME_TO_EXP_LOCK)));
                    }
                  });
              rollOverCanvas.addChild(lockImg);
            }
            return rollOverCanvas;
          }
        };
    sideNavGrid.setShowSelectionCanvas(false);

    sideNavGrid.setWidth100();
    sideNavGrid.setHeight100();
    sideNavGrid.setShowSortArrow(SortArrow.CORNER);
    sideNavGrid.setShowAllRecords(true);
    sideNavGrid.setAutoFetchData(true);
    sideNavGrid.setCanHover(true);
    sideNavGrid.setHoverOpacity(75);
    sideNavGrid.setHoverStyle("interactImageHover");
    sideNavGrid.setShowRollOverCanvas(true);

    final DynamicForm form = new DynamicForm();
    form.setHeight(1);
    form.setWidth(60);
    form.setNumCols(1);

    selectItem.setWidth(60);
    selectItem.setShowTitle(false);
    selectItem.setValueMap(lang.me(), lang.all());
    selectItem.setDefaultValue(lang.me());
    selectItem.setHoverOpacity(75);
    selectItem.setHoverStyle("interactImageHover");
    selectItem.addItemHoverHandler(
        new ItemHoverHandler() {

          @Override
          public void onItemHover(ItemHoverEvent event) {
            selectItem.setPrompt(
                DigitalObjectMenuView.this.lang.showModifiedHint() + selectItem.getValue());
          }
        });
    selectItem.addChangedHandler(
        new ChangedHandler() {

          @Override
          public void onChanged(ChangedEvent event) {
            getUiHandlers().refreshRecentlyModified();
          }
        });

    form.setFields(selectItem);
    form.setTitle("by:");

    sectionRecentlyModified = new SectionStackSection();
    sectionRecentlyModified.setTitle(lang.recentlyModified());
    sectionRecentlyModified.setResizeable(true);
    sectionRecentlyModified.setItems(sideNavGrid);
    sectionRecentlyModified.setControls(form);
    sectionRecentlyModified.setExpanded(true);

    sectionStack = new SectionStack();
    sectionStack.addSection(sectionRelated);
    sectionStack.addSection(sectionRecentlyModified);
    sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
    sectionStack.setAnimateSections(true);
    sectionStack.setWidth100();
    sectionStack.setHeight100();
    sectionStack.setOverflow(Overflow.HIDDEN);
    layout.addMember(sectionStack);
  }
Exemplo n.º 23
0
  private void refresh() {
    form.clearValues();
    form.clearErrors(false);

    if (form != null) form.destroy();

    if (formsContainer.contains(form)) formsContainer.removeChild(form);

    form = new DynamicForm();
    form.setNumCols(2);
    form.setTitleOrientation(TitleOrientation.TOP);

    TextItem include = ItemFactory.newTextItem("include", "include", account.getIncludes());
    include.addChangedHandler(changedHandler);

    TextItem exclude = ItemFactory.newTextItem("exclude", "exclude", account.getExcludes());
    exclude.addChangedHandler(changedHandler);

    TextItem folder = ItemFactory.newTextItem("mailfolder", "mailfolder", account.getMailFolder());
    folder.addChangedHandler(changedHandler);

    SelectItem format = ItemFactory.newSelectItem("format", "format");
    LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
    map.put("0", I18N.message("multiplefiles"));
    map.put("1", I18N.message("singleeml"));
    format.setValueMap(map);
    format.addChangedHandler(changedHandler);
    format.setValue(Integer.toString(account.getFormat()));

    CheckboxItem deleteFomMailbox = new CheckboxItem();
    deleteFomMailbox.setName("delete");
    deleteFomMailbox.setTitle(I18N.message("deletefrommailbox"));
    deleteFomMailbox.setRedrawOnChange(true);
    deleteFomMailbox.setWidth(50);
    deleteFomMailbox.addChangedHandler(changedHandler);
    deleteFomMailbox.setValue(account.isDeleteFromMailbox());

    final DateItem startDate = ItemFactory.newDateItem("startdate", "earliestdate");
    startDate.addChangedHandler(changedHandler);
    startDate.setValue(account.getStartDate());
    startDate.setUseMask(false);
    startDate.setShowPickerIcon(true);
    startDate.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATE);
    startDate.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            if ("backspace".equals(event.getKeyName().toLowerCase())
                || "delete".equals(event.getKeyName().toLowerCase())) {
              startDate.clearValue();
              startDate.setValue((Date) null);
              changedHandler.onChanged(null);
            } else {
              changedHandler.onChanged(null);
            }
          }
        });

    form.setItems(folder, format, include, exclude, startDate, deleteFomMailbox);

    formsContainer.addMember(form);
  }
Exemplo n.º 24
0
  public DuengungDetailsWindow(
      final DuengungRecord record, final boolean addNewRecord, AbstractListGrid grid) {
    super();
    SelectItem duengerartItem = new SelectItem(DuengungRecord.DUENGERART, "D&uuml;ungerart");
    duengerartItem.setRequired(true);
    this.duengerartDataSource = new DuengerartDataSource(duengerartItem);

    this.stammdatenManager = new StammdatenManager();
    this.dataManager = new DataManager();

    this.grid = grid;
    setTitle("D&uuml;ngung");
    setAutoSize(true);
    setCanDragResize(true);
    setIsModal(true);
    setShowModalMask(true);
    setAutoCenter(true);

    /* create the form */
    FloatItem flaecheItem =
        FormItemFactory.createFloatItem(DuengungRecord.FLAECHE, "Fl&auml;che", true);
    DateItem datumItem = FormItemFactory.createDateItem(DuengungRecord.DATUM, "Datum", true);
    FloatItem kgProHaItem =
        FormItemFactory.createFloatItem(DuengungRecord.KG_PRO_HA, "kg/ha", false);
    FloatItem ecItem = FormItemFactory.createFloatItem(DuengungRecord.EC, "EC", false);
    TextAreaItem bemItem =
        FormItemFactory.createTextAreaItem(DuengungRecord.BEMERKUNG, "Bemerkung", false);

    final DynamicForm form = new DynamicForm();
    form.setItems(datumItem, duengerartItem, flaecheItem, kgProHaItem, ecItem, bemItem);

    // display values form an existing entry
    if (!addNewRecord && record != null) {
      Duengung d = record.getDTO();

      bemItem.setValue(d.getBemerkung() != null ? d.getBemerkung() : "");
      flaecheItem.setValue(d.getFlaeche());
      datumItem.setValue(d.getDatum() != null ? d.getDatum() : new Date());
      ecItem.setValue(d.getEc() != null ? d.getEc() : Double.valueOf(0));
      kgProHaItem.setValue(d.getKgProHa() != null ? d.getKgProHa() : Double.valueOf(0));
      if (d.getDuengerartKey() != null) {
        duengerartDataSource.setSelectedValue(d.getDuengerartKey().getId());
      }
    }

    /* create the save & cancel buttons */
    com.smartgwt.client.widgets.Button saveBtn =
        new com.smartgwt.client.widgets.Button("Speichern");
    saveBtn.addClickHandler(
        new com.smartgwt.client.widgets.events.ClickHandler() {
          @Override
          public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
            if (form.validate()) {
              // save changes
              onSavePressed(record, form, addNewRecord);
              // close dialog window
              DuengungDetailsWindow.this.destroy();
            }
          }
        });

    com.smartgwt.client.widgets.Button cancelBtn =
        new com.smartgwt.client.widgets.Button("Abbrechen");
    cancelBtn.addClickHandler(
        new com.smartgwt.client.widgets.events.ClickHandler() {
          @Override
          public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
            // close dialog window
            DuengungDetailsWindow.this.destroy();
          }
        });

    /* create the layout */

    // panel for the buttons
    HLayout btnLayout = new HLayout();
    btnLayout.setMargin(10);
    // add the buttons
    btnLayout.addMember(saveBtn);
    btnLayout.addMember(cancelBtn);

    VLayout verticalPanel = new VLayout();
    verticalPanel.setMargin(10);
    verticalPanel.setPadding(5);

    // add the form
    verticalPanel.addMember(form);
    // and the buttons
    verticalPanel.addMember(btnLayout);

    // add panel to component
    addItem(verticalPanel);
  }
Exemplo n.º 25
0
  private void initExportButton() {
    setHeight(30);
    exportButton.setShowRollOver(false);
    exportButton.setIcon(GWT.getHostPageBaseURL() + "images/icons/32/woofunction/export_32.png");
    exportButton.setIconOrientation("right");

    final DynamicForm exportForm = new DynamicForm();
    exportForm.setNumCols(4);
    // exportForm.setWidth(300);

    SelectItem exportTypeItem = new SelectItem("exportType", "Exporteer als");
    //    exportTypeItem.setWidth(150);
    exportTypeItem.setDefaultToFirstOption(true);
    LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
    valueMap.put("ooxml", "XLSX (Excel2007+/OOXML)");
    valueMap.put("xls", "XLS (Excel97)");
    valueMap.put("csv", "CSV (Excel)");
    // valueMap.put("xml", "XML");
    // valueMap.put("json", "JSON");
    exportTypeItem.setValueMap(valueMap);

    BooleanItem showInWindowItem = new BooleanItem();
    showInWindowItem.setName("showInWindow");
    showInWindowItem.setTitle("Toon Export in nieuw venster");
    showInWindowItem.setAlign(Alignment.LEFT);

    exportForm.setFields(exportTypeItem, showInWindowItem);

    exportButton.addClickHandler(
        new ClickHandler() {
          public void onClick(ClickEvent event) {
            String exportAs = (String) exportForm.getField("exportType").getValue();
            FormItem item = exportForm.getField("showInWindow");
            boolean showInWindow = item.getValue() == null ? false : (Boolean) item.getValue();
            DSRequest dsRequestProperties = new DSRequest();

            // set all fields, also from joined models. If they don't appear in the DS.xml file,
            // they will be ignored. Adding foreign fields to ds.xml automatically makes them being
            // exported as well.
            // (just make sure the query does some joins correctly, as is normal!)
            String[] f = fields == null ? ds.getFieldNames() : fields;

            if (hideInvisibleFieldsFromExport) {
              f = ListGridUtil.getVisibleFields(grid);
            }

            dsRequestProperties.setExportFields(f);

            if (fetchOperation != null) {
              dsRequestProperties.setOperationId(fetchOperation);
            }

            if (criteria != null) {
              dsRequestProperties.setCriteria(criteria);
              dsRequestProperties.setTextMatchStyle(TextMatchStyle.EXACT);
            }

            if (exportAs.equals("json")) {
              // JSON exports are server-side only, so use the OperationBinding on the DataSource
              dsRequestProperties.setOperationId("customJSONExport");
              dsRequestProperties.setExportDisplay(
                  showInWindow ? ExportDisplay.WINDOW : ExportDisplay.DOWNLOAD);

              grid.exportData(dsRequestProperties);
            } else {
              // exportAs is either XML or CSV, which we can do with requestProperties
              dsRequestProperties.setExportAs(
                  (ExportFormat) EnumUtil.getEnum(ExportFormat.values(), exportAs));
              dsRequestProperties.setExportDisplay(
                  showInWindow ? ExportDisplay.WINDOW : ExportDisplay.DOWNLOAD);

              grid.exportData(dsRequestProperties);
            }
          }
        });
    addMember(exportButton);
    addMember(exportForm);
  }
Exemplo n.º 26
0
  /**
   * Creates this property editor.
   *
   * @param contents Contents view form.
   */
  public MixinValueEditor(Contents contents) {
    super(TITLE);
    this.contents = contents;

    setWidth(WIDTH);
    setHeight(HEIGHT);

    Columns h1 = new Columns(Align.CENTER, Align.CENTER);
    h1.setHeight(15);

    Label l1 = new Label();
    l1.setWidth(150);
    l1.setContents("Mixin Types");

    Label l2 = new Label();
    l2.setWidth(100);
    l2.setContents("");

    Label l3 = new Label();
    l3.setWidth(150);
    l3.setContents("Node's types");

    h1.addMember(l1);
    h1.addMember(l2);
    h1.addMember(l3);

    addMember(h1);

    Columns layout = new Columns(Align.CENTER, Align.CENTER);
    layout.setWidth100();

    mixTypes.setMultiple(true);
    mixTypes.setMultipleAppearance(MultipleAppearance.GRID);
    mixTypes.setWidth(150);
    mixTypes.setHeight(200);

    selectedTypes.setMultiple(true);
    selectedTypes.setMultipleAppearance(MultipleAppearance.GRID);
    selectedTypes.setWidth(150);
    selectedTypes.setHeight(200);

    DynamicForm f1 = new DynamicForm();
    f1.setItems(mixTypes);
    f1.setWidth(150);
    f1.setHeight(200);

    DynamicForm f2 = new DynamicForm();
    f2.setItems(selectedTypes);
    f2.setWidth(150);
    f2.setHeight(200);

    VLayout buttons = new VLayout();
    buttons.setLayoutAlign(Alignment.CENTER);
    buttons.setDefaultLayoutAlign(Alignment.CENTER);
    buttons.setAlign(Alignment.CENTER);
    buttons.setLayoutAlign(VerticalAlignment.CENTER);
    buttons.setWidth(50);

    layout.addMember(f1);
    layout.addMember(buttons);
    layout.addMember(f2);

    Button b1 = new Button(">>");
    b1.setWidth(30);
    b1.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
            allTypes = remove(allTypes, mixTypes.getValueAsString());
            nodeTypes = add(nodeTypes, mixTypes.getValueAsString());
            updateLists();
          }
        });

    Button b2 = new Button("<<");
    b2.setWidth(30);
    b2.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
            nodeTypes = remove(nodeTypes, selectedTypes.getValueAsString());
            allTypes = add(allTypes, selectedTypes.getValueAsString());
            updateLists();
          }
        });

    buttons.addMember(b1);
    buttons.addMember(b2);

    addMember(layout);

    Columns h3 = new Columns(Align.RIGHT, Align.CENTER);
    h3.setHeight(50);

    Button okButton = new Button("OK");
    okButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
            onConfirm(null);
            hide();
          }
        });

    Button cancelButton = new Button("Cancel");
    cancelButton.addClickHandler(
        new ClickHandler() {
          @Override
          public void onClick(com.smartgwt.client.widgets.events.ClickEvent event) {
            hide();
          }
        });

    h3.addMember(okButton);
    h3.addMember(cancelButton);

    addMember(h3);
  }
    public teamsInClass_Team_Widget(
        final Criteria criteria, final UserDetailsReceivedEvent userDetails) {
      this.userDetails = userDetails;

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

      BoatTypeModelMessages boatTypeMessages =
          (BoatTypeModelMessages) GWT.create(BoatTypeModelMessages.class);

      setPadding(10);
      setIsGroup(true);
      setGroupTitle(
          classMessages.richFormView_teamsInClass_coupling_with_Team(
              targetMessages.tab_name_TeamModel()));

      // all elements from the target reference, to be picked from to make a connection

      setWidth100();
      setHeight100();

      this.grid.setWidth100();
      // grid.setHeight(150); //automatically ought to use all the space
      // grid.setHeight("*");

      this.grid.setAlternateRecordStyles(false);
      this.grid.setCellHeight(32);
      this.grid.setDataSource(dataSource);
      this.grid.setAutoFetchData(false);
      this.grid.setCanEdit(true);
      this.grid.setModalEditing(true);
      this.grid.setShowFilterEditor(true);
      this.grid.setDoubleClickDelay(100);
      this.grid.setEditEvent(ListGridEditEvent.DOUBLECLICK);
      this.grid.setListEndEditAction(RowEndEditAction.DONE);
      this.grid.setCanRemoveRecords(true);
      this.grid.setAutoSaveEdits(true);
      this.grid.setCanSelectText(true);
      this.grid.setAllowFilterExpressions(true);

      this.grid.setCanDragSelectText(true);
      this.grid.setCanRemoveRecords(
          false); // we have our own delete button, with extra functionality

      /*

      */

      ListGridField idField = new ListGridField("Team_id", "Team id");

      ListGridField sailNumberField = new ListGridField("sailNumber", targetMessages.sailNumber());

      sailNumberField.setAlign(Alignment.LEFT);

      sailNumberField = TeamRichTableView.setFormatterForsailNumber(sailNumberField);

      ListGridField teamNameField = new ListGridField("teamName", targetMessages.teamName());

      teamNameField.setAlign(Alignment.LEFT);

      teamNameField = TeamRichTableView.setFormatterForteamName(teamNameField);

      ListGridField nameCaptainField =
          new ListGridField("nameCaptain", targetMessages.nameCaptain());

      nameCaptainField.setAlign(Alignment.LEFT);

      nameCaptainField = TeamRichTableView.setFormatterFornameCaptain(nameCaptainField);

      ListGridField streetField = new ListGridField("street", targetMessages.street());

      streetField.setAlign(Alignment.LEFT);

      streetField = TeamRichTableView.setFormatterForstreet(streetField);

      ListGridField zipcodeField = new ListGridField("zipcode", targetMessages.zipcode());

      zipcodeField.setAlign(Alignment.LEFT);

      zipcodeField = TeamRichTableView.setFormatterForzipcode(zipcodeField);

      ListGridField cityField = new ListGridField("city", targetMessages.city());

      cityField.setAlign(Alignment.LEFT);

      cityField = TeamRichTableView.setFormatterForcity(cityField);

      ListGridField emailField = new ListGridField("email", targetMessages.email());

      emailField.setAlign(Alignment.LEFT);

      emailField = TeamRichTableView.setFormatterForemail(emailField);

      ListGridField phoneField = new ListGridField("phone", targetMessages.phone());

      phoneField.setAlign(Alignment.LEFT);

      phoneField = TeamRichTableView.setFormatterForphone(phoneField);

      ListGridField numPersonsField = new ListGridField("numPersons", targetMessages.numPersons());

      numPersonsField.setAlign(Alignment.LEFT);

      numPersonsField = TeamRichTableView.setFormatterFornumPersons(numPersonsField);

      ListGridField toerField = new ListGridField("toer", targetMessages.toer());

      toerField = TeamRichTableView.setFormatterFortoer(toerField);

      ListGridField spinField = new ListGridField("spin", targetMessages.spin());

      spinField = TeamRichTableView.setFormatterForspin(spinField);

      ListGridField waitinglistField =
          new ListGridField("waitinglist", targetMessages.waitinglist());

      waitinglistField = TeamRichTableView.setFormatterForwaitinglist(waitinglistField);

      ListGridField femaleTeamField = new ListGridField("femaleTeam", targetMessages.femaleTeam());

      femaleTeamField = TeamRichTableView.setFormatterForfemaleTeam(femaleTeamField);

      ListGridField remark_Field = new ListGridField("remark_", targetMessages.remark_());

      remark_Field.setAlign(Alignment.LEFT);

      remark_Field = TeamRichTableView.setFormatterForremark_(remark_Field);

      ListGridField teamStartTimeField =
          new ListGridField("teamStartTime", targetMessages.teamStartTime());

      teamStartTimeField.setAlign(Alignment.LEFT);

      teamStartTimeField = TeamRichTableView.setFormatterForteamStartTime(teamStartTimeField);

      teamStartTimeField.setTimeFormatter(TimeDisplayFormat.TOSHORTPADDED24HOURTIME);

      // call to a custom field, this class should be created customly
      teamStartTimeField =
          nl.sytematic.projects.BrioRaceSystem.client.custom.TeamTeamStartTimeCustomFieldFactory
              .getCustomField(grid, teamStartTimeField, userDetails);

      ListGridField endTimeField = new ListGridField("endTime", targetMessages.endTime());

      endTimeField.setAlign(Alignment.LEFT);

      endTimeField = TeamRichTableView.setFormatterForendTime(endTimeField);

      endTimeField.setTimeFormatter(TimeDisplayFormat.TOSHORTPADDED24HOURTIME);

      ListGridField sailingTimeField =
          new ListGridField("sailingTime", targetMessages.sailingTime());

      sailingTimeField.setAlign(Alignment.LEFT);

      sailingTimeField = TeamRichTableView.setFormatterForsailingTime(sailingTimeField);

      sailingTimeField.setTimeFormatter(TimeDisplayFormat.TOSHORTPADDED24HOURTIME);

      // call to a custom field, this class should be created customly
      sailingTimeField =
          nl.sytematic.projects.BrioRaceSystem.client.custom.TeamSailingTimeCustomFieldFactory
              .getCustomField(grid, sailingTimeField, userDetails);

      ListGridField swTimeField = new ListGridField("swTime", targetMessages.swTime());

      swTimeField.setAlign(Alignment.LEFT);

      swTimeField = TeamRichTableView.setFormatterForswTime(swTimeField);

      swTimeField.setTimeFormatter(TimeDisplayFormat.TOSHORTPADDED24HOURTIME);

      // call to a custom field, this class should be created customly
      swTimeField =
          nl.sytematic.projects.BrioRaceSystem.client.custom.TeamSwTimeCustomFieldFactory
              .getCustomField(grid, swTimeField, userDetails);

      ListGridField registrationDateTimeField =
          new ListGridField("registrationDateTime", targetMessages.registrationDateTime());

      registrationDateTimeField.setAlign(Alignment.LEFT);

      registrationDateTimeField =
          TeamRichTableView.setFormatterForregistrationDateTime(registrationDateTimeField);

      //	registrationDateTimeField.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);
      DateTimeItem registrationDateTimeEditor = new DateTimeItem();
      registrationDateTimeEditor.setUseTextField(true);
      registrationDateTimeEditor.setUseMask(true);
      //	registrationDateTimeEditor.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);
      registrationDateTimeField.setEditorType(registrationDateTimeEditor);
      //   registrationDateTimeField.setFilterEditorType(registrationDateTimeEditor);

      // call to a custom field, this class should be created customly
      registrationDateTimeField =
          nl.sytematic.projects.BrioRaceSystem.client.custom
              .TeamRegistrationDateTimeCustomFieldFactory.getCustomField(
              grid, registrationDateTimeField, userDetails);

      ListGridField payDateField = new ListGridField("payDate", targetMessages.payDate());

      payDateField.setAlign(Alignment.LEFT);

      payDateField = TeamRichTableView.setFormatterForpayDate(payDateField);

      //	payDateField.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATE);
      DateItem payDateEditor = new DateItem();
      payDateEditor.setUseTextField(true);
      payDateEditor.setUseMask(true);
      //	payDateEditor.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATE);
      payDateField.setEditorType(payDateEditor);
      // payDateField.setFilterEditorType(payDateEditor);

      ListGridField payOrderField = new ListGridField("payOrder", targetMessages.payOrder());

      payOrderField.setAlign(Alignment.LEFT);

      payOrderField = TeamRichTableView.setFormatterForpayOrder(payOrderField);

      ListGridField payIdField = new ListGridField("payId", targetMessages.payId());

      payIdField.setAlign(Alignment.LEFT);

      payIdField = TeamRichTableView.setFormatterForpayId(payIdField);

      ListGridField acceptedField = new ListGridField("accepted", targetMessages.accepted());

      acceptedField = TeamRichTableView.setFormatterForaccepted(acceptedField);

      ListGridField payStatusField = new ListGridField("payStatus", targetMessages.payStatus());

      payStatusField.setAlign(Alignment.LEFT);

      payStatusField = TeamRichTableView.setFormatterForpayStatus(payStatusField);

      ListGridField BoatTypeField =
          new ListGridField("BoatType_id", boatTypeMessages.name_single());

      ListGridField ClassField = new ListGridField("Class_id", classMessages.name_single());

      final SelectItem BoatTypeSelectItem =
          new SelectItem("BoatType_id", boatTypeMessages.name_single());

      BoatTypeSelectItem.setOptionDataSource(DataSource.get("BoatType"));
      BoatTypeSelectItem.setValueField("BoatType_id");
      BoatTypeSelectItem.setAlign(Alignment.LEFT);

      BoatTypeSelectItem.setTextAlign(Alignment.LEFT);
      BoatTypeSelectItem.setTitleAlign(Alignment.LEFT);
      ListGrid BoatTypeListGrid = new ListGrid();
      BoatTypeListGrid.setShowFilterEditor(true);
      BoatTypeListGrid.setFilterOnKeypress(true);

      SortSpecifier BoatTypeSort = new SortSpecifier("typeName", SortDirection.ASCENDING);
      SortSpecifier[] BoatTypeSorts = new SortSpecifier[] {BoatTypeSort};
      BoatTypeListGrid.setInitialSort(BoatTypeSorts);

      BoatTypeSelectItem.setDisplayField("typeName");

      BoatTypeSelectItem.setAllowEmptyValue(true);

      BoatTypeSelectItem.setPickListWidth(800);
      BoatTypeSelectItem.setPickListFields(
          new ListGridField("typeName", boatTypeMessages.typeName()),
          new ListGridField("SW_value", boatTypeMessages.SW_value()));

      BoatTypeSelectItem.setPickListProperties(BoatTypeListGrid);

      BoatTypeField.setAlign(Alignment.LEFT);

      BoatTypeField.setEditorType(BoatTypeSelectItem);
      BoatTypeField.setOptionDataSource(DataSource.get("BoatType"));
      BoatTypeField.setDisplayField("typeName");

      BoatTypeField.setFilterEditorType(BoatTypeSelectItem); // reusing this is okay appareantly

      ButtonItem newBoatType = new ButtonItem("newBoatType", boatTypeMessages.new_window());
      newBoatType.addClickHandler(
          new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
            @Override
            public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {
              BoatTypeNewEntryWindow w =
                  new BoatTypeNewEntryWindow(
                      null,
                      new DSCallback() {
                        @Override
                        public void execute(
                            DSResponse response, Object rawData, DSRequest request) {
                          RecordList rl = response.getDataAsRecordList();
                          if (rl.getLength() > 0) {
                            Record r = rl.get(0);
                            Log.debug("Record found in callback");
                            Integer id = r.getAttributeAsInt("BoatType_id");
                            Log.debug("ID is " + id);
                            BoatTypeSelectItem.setValue(id); // select the just added value
                          }
                        }
                      });

              w.show();
              w.bringToFront();
            }
          });

      final SelectItem ClassSelectItem = new SelectItem("Class_id", classMessages.name_single());

      ClassSelectItem.setOptionDataSource(DataSource.get("Class"));
      ClassSelectItem.setValueField("Class_id");
      ClassSelectItem.setAlign(Alignment.LEFT);

      ClassSelectItem.setTextAlign(Alignment.LEFT);
      ClassSelectItem.setTitleAlign(Alignment.LEFT);
      ListGrid ClassListGrid = new ListGrid();
      ClassListGrid.setShowFilterEditor(true);
      ClassListGrid.setFilterOnKeypress(true);

      SortSpecifier ClassSort = new SortSpecifier("className", SortDirection.ASCENDING);
      SortSpecifier[] ClassSorts = new SortSpecifier[] {ClassSort};
      ClassListGrid.setInitialSort(ClassSorts);

      ClassSelectItem.setDisplayField("className");

      ClassSelectItem.setAllowEmptyValue(true);

      ClassSelectItem.setPickListWidth(800);
      ClassSelectItem.setPickListFields(
          new ListGridField("className", classMessages.className()),
          new ListGridField("startTime", classMessages.startTime()));

      ClassSelectItem.setPickListProperties(ClassListGrid);

      ClassField.setAlign(Alignment.LEFT);

      ClassField.setEditorType(ClassSelectItem);
      ClassField.setOptionDataSource(DataSource.get("Class"));
      ClassField.setDisplayField("className");

      ClassField.setFilterEditorType(ClassSelectItem); // reusing this is okay appareantly

      ButtonItem newClass = new ButtonItem("newClass", classMessages.new_window());
      newClass.addClickHandler(
          new com.smartgwt.client.widgets.form.fields.events.ClickHandler() {
            @Override
            public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent event) {
              ClassNewEntryWindow w =
                  new ClassNewEntryWindow(
                      null,
                      new DSCallback() {
                        @Override
                        public void execute(
                            DSResponse response, Object rawData, DSRequest request) {
                          RecordList rl = response.getDataAsRecordList();
                          if (rl.getLength() > 0) {
                            Record r = rl.get(0);
                            Log.debug("Record found in callback");
                            Integer id = r.getAttributeAsInt("Class_id");
                            Log.debug("ID is " + id);
                            ClassSelectItem.setValue(id); // select the just added value
                          }
                        }
                      });

              w.show();
              w.bringToFront();
            }
          });

      ListGridField deleteField = new ListGridField("deleteField", "-");
      deleteField.setShouldPrint(false);
      deleteField.setCellIcon(
          GWT.getHostPageBaseURL() + "images/icons/32/woofunction/remove_32.png");
      deleteField.setType(ListGridFieldType.ICON);
      deleteField.setTitle("");
      deleteField.setWidth(32);
      deleteField.setIconSize(24);
      deleteField.setCanDragResize(false);
      deleteField.setCanSort(false);
      deleteField.setCanEdit(false);
      deleteField.setCanGroupBy(false);
      deleteField.setCanFreeze(false);
      deleteField.setCanFilter(false);
      deleteField.setCanHide(false);
      deleteField.setCanReorder(false);
      this.grid.addRecordClickHandler(
          new RecordClickHandler() {
            public void onRecordClick(RecordClickEvent event) {
              ListGridField clicked = event.getField();
              final Record r = event.getRecord();
              if ("deleteField".equals(clicked.getName())) {

                SC.confirm(
                    radosMessages.delete_confirm_coupling(),
                    new BooleanCallback() {
                      public void execute(Boolean confirmed) {
                        if (confirmed != null && confirmed) {
                          grid.removeData(r);
                        } else {
                          // Cancel
                        }
                      }
                    });
              }
            }
          });

      ArrayList<ListGridField> fields = new ArrayList<ListGridField>();

      fields.add(idField);

      fields.add(sailNumberField);

      fields.add(teamNameField);

      fields.add(nameCaptainField);

      fields.add(streetField);

      fields.add(zipcodeField);

      fields.add(cityField);

      fields.add(emailField);

      fields.add(phoneField);

      fields.add(numPersonsField);

      fields.add(toerField);

      fields.add(spinField);

      fields.add(waitinglistField);

      fields.add(femaleTeamField);

      fields.add(remark_Field);

      fields.add(teamStartTimeField);

      fields.add(endTimeField);

      fields.add(sailingTimeField);

      fields.add(swTimeField);

      fields.add(registrationDateTimeField);

      fields.add(payDateField);

      fields.add(payOrderField);

      fields.add(payIdField);

      fields.add(acceptedField);

      fields.add(payStatusField);

      fields.add(BoatTypeField);

      if (userDetails.hasAuthority("CAN_DELETE_TEAM")) {
        fields.add(deleteField);
      }

      ListGridField[] fieldsArr = fields.toArray(new ListGridField[fields.size()]);

      this.grid.setFields(fieldsArr);

      this.grid.fetchData(criteria);
      buttonPanel.setMargin(2);

      grid.hideField("Team_id");

      // newButton.setSize(32);
      newButton.setIcon(GWT.getHostPageBaseURL() + "images/icons/32/woofunction/add_32.png");
      newButton.setIconOrientation("right");
      newButton.addClickHandler(
          new ClickHandler() {
            public void onClick(ClickEvent event) {

              Map<String, Object> defaultValues = new HashMap<String, Object>();
              defaultValues.put("Class_id", criteria.getAttribute("Class_id"));
              grid.startEditingNew(defaultValues);
            }
          });

      buttonPanel.addMember(newButton);

      /*IButton printButton = new IButton(radosMessages.richTableView_print_button());*/
      IButton printButton = new IButton(radosMessages.richTableView_print_button());
      printButton.setShowRollOver(false);
      printButton.setIcon(GWT.getHostPageBaseURL() + "images/icons/32/woofunction/printer_32.png");
      printButton.setIconOrientation("right");

      // Img printButton = new
      // Img(GWT.getHostPageBaseURL()+"images/icons/32/woofunction/printer_32.png");
      // printButton.setSize(32);
      // printButton.setAltText(radosMessages.richTableView_print_button());
      printButton.addClickHandler(
          new ClickHandler() {
            public void onClick(ClickEvent event) {
              Canvas.showPrintPreview(grid);
            }
          });
      buttonPanel.addMember(printButton);

      EmailGridButtonWidget email = new EmailGridButtonWidget(new Canvas[] {grid});
      email.setDefaultMessage(targetMessages.name_single() + "overzicht");
      email.setDefaultSubject(targetMessages.name_single() + "overzicht");
      email.setDefaultFrom(BrioRaceSystemApplicationPanel.getUserdetails().getEmail());
      buttonPanel.addMember(email);

      ExportButtonWidget exportButton = new ExportButtonWidget(grid, dataSource);
      buttonPanel.addMember(exportButton);

      buttonPanel.setHeight(30);

      this.addMember(buttonPanel);
      this.addMember(grid);

      handleRights();
    }
Exemplo n.º 28
0
  public TabBillingComps() {
    try {

      setTitle(CallCenterBK.constants.billingComps());
      setCanClose(true);

      billingCompsDS = DataSource.get("BillingCompsDS");

      mainLayout = new VLayout(5);
      mainLayout.setWidth100();
      mainLayout.setHeight100();
      mainLayout.setMargin(5);

      searchForm = new DynamicForm();
      searchForm.setAutoFocus(true);
      searchForm.setWidth(830);
      searchForm.setTitleWidth(250);
      searchForm.setNumCols(4);
      mainLayout.addMember(searchForm);

      billingCompNameItem = new TextItem();
      billingCompNameItem.setTitle(CallCenterBK.constants.companyName());
      billingCompNameItem.setWidth(250);
      billingCompNameItem.setName("billingCompNameItem");

      phoneIndexItem = new TextItem();
      phoneIndexItem.setTitle(CallCenterBK.constants.index());
      phoneIndexItem.setWidth(250);
      phoneIndexItem.setName("phoneIndexItem");

      hasCalcItem = new SelectItem();
      hasCalcItem.setTitle(CallCenterBK.constants.hasCalculation());
      hasCalcItem.setWidth(250);
      hasCalcItem.setName("hasCalcItem");
      hasCalcItem.setDefaultToFirstOption(true);
      hasCalcItem.setValueMap(ClientMapUtil.getInstance().getHasCalculations());

      operatorItem = new SelectItem();
      operatorItem.setTitle(CallCenterBK.constants.operator());
      operatorItem.setWidth(200);
      operatorItem.setName("operator_src");
      operatorItem.setDefaultToFirstOption(true);
      ClientUtils.fillCombo(
          operatorItem, "OperatorsDS", "searchOperators", "operator_src", "operator_src_descr");

      searchForm.setFields(billingCompNameItem, phoneIndexItem, hasCalcItem, operatorItem);

      HLayout buttonLayout = new HLayout(5);
      buttonLayout.setWidth(830);
      buttonLayout.setHeight(30);
      buttonLayout.setAlign(Alignment.RIGHT);

      clearButton = new IButton();
      clearButton.setTitle(CallCenterBK.constants.clear());

      findButton = new IButton();
      findButton.setTitle(CallCenterBK.constants.find());

      buttonLayout.setMembers(findButton, clearButton);
      mainLayout.addMember(buttonLayout);

      ToolStrip toolStrip = new ToolStrip();
      toolStrip.setWidth100();
      toolStrip.setPadding(5);
      mainLayout.addMember(toolStrip);

      addBtn = new ToolStripButton(CallCenterBK.constants.add(), "addIcon.png");
      addBtn.setLayoutAlign(Alignment.LEFT);
      addBtn.setWidth(50);
      toolStrip.addButton(addBtn);

      editBtn = new ToolStripButton(CallCenterBK.constants.modify(), "editIcon.png");
      editBtn.setLayoutAlign(Alignment.LEFT);
      editBtn.setWidth(50);
      toolStrip.addButton(editBtn);

      deleteBtn = new ToolStripButton(CallCenterBK.constants.disable(), "deleteIcon.png");
      deleteBtn.setLayoutAlign(Alignment.LEFT);
      deleteBtn.setWidth(50);
      toolStrip.addButton(deleteBtn);

      toolStrip.addSeparator();

      billingCompBillByDayBtn =
          new ToolStripButton(CallCenterBK.constants.telCombBillByDay(), "billing.png");
      billingCompBillByDayBtn.setLayoutAlign(Alignment.LEFT);
      billingCompBillByDayBtn.setWidth(50);
      toolStrip.addButton(billingCompBillByDayBtn);

      billingCompBillByMonthBtn =
          new ToolStripButton(CallCenterBK.constants.telCombBillByMonth(), "billing.png");
      billingCompBillByMonthBtn.setLayoutAlign(Alignment.LEFT);
      billingCompBillByMonthBtn.setWidth(50);
      toolStrip.addButton(billingCompBillByMonthBtn);

      billingCompsGrid = new ListGrid();

      billingCompsGrid.setWidth100();
      billingCompsGrid.setHeight100();
      billingCompsGrid.setAlternateRecordStyles(true);
      billingCompsGrid.setDataSource(billingCompsDS);
      billingCompsGrid.setAutoFetchData(false);
      billingCompsGrid.setShowFilterEditor(false);
      billingCompsGrid.setCanEdit(false);
      billingCompsGrid.setCanRemoveRecords(false);
      billingCompsGrid.setFetchOperation("searchAllBillingComps");
      billingCompsGrid.setShowRowNumbers(true);
      billingCompsGrid.setCanHover(true);
      billingCompsGrid.setShowHover(true);
      billingCompsGrid.setShowHoverComponents(true);
      billingCompsGrid.setWrapCells(true);
      billingCompsGrid.setFixedRecordHeights(false);
      billingCompsGrid.setCanDragSelectText(true);

      ListGridField billing_company_name =
          new ListGridField("billing_company_name", CallCenterBK.constants.companyName());

      ListGridField our_percent =
          new ListGridField("our_percent", CallCenterBK.constants.ourPercent(), 150);

      ListGridField has_calculation_descr =
          new ListGridField("has_calculation_descr", CallCenterBK.constants.hasCalculation(), 150);

      ListGridField call_price =
          new ListGridField("call_price", CallCenterBK.constants.callPrice(), 150);

      our_percent.setAlign(Alignment.CENTER);
      has_calculation_descr.setAlign(Alignment.CENTER);
      call_price.setAlign(Alignment.CENTER);

      billingCompsGrid.setFields(
          billing_company_name, our_percent, has_calculation_descr, call_price);

      mainLayout.addMember(billingCompsGrid);
      findButton.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              search();
            }
          });

      billingCompNameItem.addKeyPressHandler(
          new KeyPressHandler() {
            @Override
            public void onKeyPress(KeyPressEvent event) {
              if (event.getKeyName().equals("Enter")) {
                search();
              }
            }
          });

      phoneIndexItem.addKeyPressHandler(
          new KeyPressHandler() {
            @Override
            public void onKeyPress(KeyPressEvent event) {
              if (event.getKeyName().equals("Enter")) {
                search();
              }
            }
          });

      clearButton.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              billingCompNameItem.clearValue();
            }
          });

      addBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              DlgAddEditBillingComps dlgAddEditBillingComp =
                  new DlgAddEditBillingComps(billingCompsGrid, null);
              dlgAddEditBillingComp.show();
            }
          });

      editBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord();

              if (listGridRecord == null) {
                SC.say(CallCenterBK.constants.pleaseSelrecord());
                return;
              }

              DlgAddEditBillingComps dlgAddEditBillingComp =
                  new DlgAddEditBillingComps(billingCompsGrid, listGridRecord);
              dlgAddEditBillingComp.show();
            }
          });
      deleteBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
              final ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenterBK.constants.pleaseSelrecord());
                return;
              }
              SC.ask(
                  CallCenterBK.constants.askForDisable(),
                  new BooleanCallback() {
                    @Override
                    public void execute(Boolean value) {
                      if (value) {
                        delete(listGridRecord);
                      }
                    }
                  });
            }
          });

      billingCompsGrid.addRecordDoubleClickHandler(
          new RecordDoubleClickHandler() {
            @Override
            public void onRecordDoubleClick(RecordDoubleClickEvent event) {
              ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord();
              DlgAddEditBillingComps dlgAddEditBillingComp =
                  new DlgAddEditBillingComps(billingCompsGrid, listGridRecord);
              dlgAddEditBillingComp.show();
            }
          });

      billingCompBillByDayBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {

              final ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenterBK.constants.pleaseSelrecord());
                return;
              }
              Integer billing_company_id = listGridRecord.getAttributeAsInt("billing_company_id");
              getBillingCompBillByDay(billing_company_id);
            }
          });
      billingCompBillByMonthBtn.addClickHandler(
          new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {

              final ListGridRecord listGridRecord = billingCompsGrid.getSelectedRecord();
              if (listGridRecord == null) {
                SC.say(CallCenterBK.constants.pleaseSelrecord());
                return;
              }
              Integer billing_company_id = listGridRecord.getAttributeAsInt("billing_company_id");
              getBillingCompBillByMonth(billing_company_id);
            }
          });

      setPane(mainLayout);
    } catch (Exception e) {
      SC.say(e.toString());
    }
  }
Exemplo n.º 29
0
 public void setDocState(int state) {
   siDocStatus.setValue("" + state);
 }
Exemplo n.º 30
0
  private void initNewWindow() {

    this.setAutoSize(true);
    this.setTitle("新书入库");
    this.setCanDragReposition(true);
    this.setCanDragResize(false);
    this.setAutoCenter(true);
    this.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);

    VLayout vLayout;
    HLayout hLayout;
    HLayout buttonLayout;

    vLayout = new VLayout();
    vLayout.setWidth(WINDOW_WIDTH);
    vLayout.setHeight(WINDOW_HEIGHT);
    vLayout.setBorder("2px solid #7598C7");
    vLayout.setMargin(12);
    vLayout.setPadding(14);

    hLayout = new HLayout();
    hLayout.setWidth(WINDOW_WIDTH);

    // HLayout
    // ---------------------------------------------------------------------------------------
    imgVLayout = new VLayout();
    imgVLayout.setWidth(IMG_WIDTH);
    bookPicUrlItem = new Img("/images/upload/" + strBookPicUrl, IMG_WIDTH, IMG_HEIGHT);
    //		bookPicUrlItem = new Img(strBookPicUrl, IMG_WIDTH, IMG_HEIGHT);
    //		bookPicUrlItem.setPrefix("/images/upload/");

    uploadPicButton = new IButton("上传封面");
    uploadPicButton.setIcon("actions/plus.png");
    uploadPicButton.setWidth(IMG_WIDTH);

    imgVLayout.setMembers(bookPicUrlItem, uploadPicButton);
    imgVLayout.setMembersMargin(10);

    // Form
    // 1-----------------------------------------------------------------------------------------

    bookForm1 = new DynamicForm();
    bookForm1.setNumCols(4);
    bookForm1.setWidth("*");
    bookForm1.setColWidths(100, "*", 100, "*");
    bookForm1.setCellPadding(5);

    TextItem bookNameItem = new TextItem("bookName", "书名");
    bookNameItem.setColSpan(4);
    bookNameItem.setWidth("100%");
    bookNameItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookNameItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    TextItem bookAuthorItem = new TextItem("bookAuthor", "作者");
    bookAuthorItem.setColSpan(4);
    bookAuthorItem.setWidth("100%");
    bookAuthorItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookAuthorItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    TextItem bookISBNItem = new TextItem("bookISBN", "ISBN");
    bookISBNItem.setColSpan(4);
    bookISBNItem.setWidth("100%");
    bookISBNItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookISBNItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    bookISBNItem.setShowIcons(true);
    FormItemIcon fetchBookInfoBut = new FormItemIcon();
    fetchBookInfoBut.setSrc("/images/actions/approve.png");
    bookISBNItem.setIcons(fetchBookInfoBut);
    bookISBNItem.addKeyPressHandler(
        new KeyPressHandler() {
          @Override
          public void onKeyPress(KeyPressEvent event) {
            if (event.getKeyName().equals("Enter")) {
              fetchDataFromDouban();
            }
          }
        });
    fetchBookInfoBut.addFormItemClickHandler(
        new FormItemClickHandler() {

          @Override
          public void onFormItemClick(FormItemIconClickEvent event) {
            fetchDataFromDouban();
          }
        });
    bookISBNItem.setIconPrompt("从豆瓣获取书籍信息");

    TextItem bookPublisherItem = new TextItem("bookPublisher", "出版社");
    bookPublisherItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookPublisherItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    DateItem bookPublishDateItem = new DateItem("bookPublishDate", "出版日期");
    bookPublishDateItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookPublishDateItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookPublishDateItem.setUseTextField(true);
    bookPublishDateItem.setDefaultChooserDate(new Date());

    SelectItem bookClassItem = new SelectItem("bookClass", "类别");
    bookClassItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookClassItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookClassItem.setValueMap(
        "计算机/网络", "小说/文学", "哲学/文化", "经济/管理", "政治/军事", "励志/成长", "儿童/育儿", "心理", "法律", "历史", "其他");
    bookClassItem.setDefaultToFirstOption(true);

    SelectItem bookLanguageItem = new SelectItem("bookLanguage", "语言");
    bookLanguageItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookLanguageItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookLanguageItem.setValueMap("中文", "英语", "法语", "德语", "日语", "俄语", "韩语");
    bookLanguageItem.setDefaultToFirstOption(true);

    TextItem bookContributorItem = new TextItem("bookContributor", "贡献者");
    bookContributorItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookContributorItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    TextItem bookPriceItem = new TextItem("bookPrice", "价格");
    bookPriceItem.setTitleStyle("alex_bookdisplaywindow_form_text_title");
    bookPriceItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");

    bookForm1.setFields(
        bookNameItem,
        bookAuthorItem,
        bookISBNItem,
        bookPublisherItem,
        bookPublishDateItem,
        bookClassItem,
        bookLanguageItem,
        bookContributorItem,
        bookPriceItem);

    // Form
    // 2-----------------------------------------------------------------------------------------
    bookForm2 = new DynamicForm();
    bookForm2.setNumCols(3);
    bookForm2.setWidth(WINDOW_WIDTH);
    bookForm2.setColWidths("*", "*", "*");
    bookForm2.setCellPadding(3);
    bookForm2.setCellBorder(1);
    bookForm2.setTitleOrientation(TitleOrientation.TOP);

    StaticTextItem bookTotalQuantityItemTitle = new StaticTextItem("bookTotalQuantityTitle", "");
    bookTotalQuantityItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header");
    bookTotalQuantityItemTitle.setShowTitle(false);

    StaticTextItem bookInStoreQuantityitemTitle =
        new StaticTextItem("bookInStoreQuantityTitle", "");
    bookInStoreQuantityitemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header");
    bookInStoreQuantityitemTitle.setShowTitle(false);

    StaticTextItem bookAvailableQuantityItemTitle =
        new StaticTextItem("bookAvailableQuantityTitle", "");
    bookAvailableQuantityItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_header");
    bookAvailableQuantityItemTitle.setShowTitle(false);

    TextItem bookTotalQuantityItem = new TextItem("bookTotalQuantity", "");
    bookTotalQuantityItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookTotalQuantityItem.setShowTitle(false);

    TextItem bookInStoreQuantityitem = new TextItem("bookInStoreQuantity", "");
    bookInStoreQuantityitem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookInStoreQuantityitem.setShowTitle(false);

    TextItem bookAvailableQuantityItem = new TextItem("bookAvailableQuantity", "");
    bookAvailableQuantityItem.setTextBoxStyle("alex_bookdisplaywindow_form_text_content");
    bookAvailableQuantityItem.setShowTitle(false);

    bookForm2.setFields(
        bookTotalQuantityItemTitle,
        bookInStoreQuantityitemTitle,
        bookAvailableQuantityItemTitle,
        bookTotalQuantityItem,
        bookInStoreQuantityitem,
        bookAvailableQuantityItem);

    // Form
    // 3-----------------------------------------------------------------------------------------
    bookForm3 = new DynamicForm();
    bookForm3.setWidth(WINDOW_WIDTH);
    bookForm3.setCellPadding(3);
    // bookForm2.setNumCols(2);
    bookForm3.setTitleOrientation(TitleOrientation.TOP);

    StaticTextItem bookIntroItemTitle = new StaticTextItem("bookIntroTitle", "");
    bookIntroItemTitle.setTextBoxStyle("alex_bookdisplaywindow_form_text_title");
    bookIntroItemTitle.setShowTitle(false);

    TextAreaItem bookIntroItem = new TextAreaItem("bookIntro", "");
    bookIntroItem.setTextBoxStyle("alex_bookdisplaywindow_form_intro_content");
    bookIntroItem.setShowTitle(false);
    bookIntroItem.setColSpan(2);
    bookIntroItem.setWidth("100%");

    bookForm3.setFields(bookIntroItemTitle, bookIntroItem);

    // buttonLayout
    // --------------------------------------------------------------------------------------
    buttonLayout = new HLayout();
    newButton = new IButton("添加图书");
    newButton.setIcon("actions/approve.png");
    buttonLayout.setMembers(newButton);
    buttonLayout.setAlign(Alignment.RIGHT);

    hLayout.setMembers(imgVLayout, bookForm1);
    vLayout.setMembers(hLayout, bookForm2, bookForm3, buttonLayout);
    vLayout.setMembersMargin(20);

    bookForm1.setValue("bookPublishDate", new Date());
    bookForm1.setValue("bookClass", "计算机/网络");
    bookForm1.setValue("bookLanguage", "中文");
    bookForm1.setValue("bookPrice", "0.00");
    bookForm1.setValue("bookContributor", "公司采购");

    bookForm2.setValue("bookTotalQuantity", "1");
    bookForm2.setValue("bookInStoreQuantity", "1");
    bookForm2.setValue("bookAvailableQuantity", "1");

    bookForm2.setValue("bookTotalQuantityTitle", "总数");
    bookForm2.setValue("bookInStoreQuantityTitle", "库中数量");
    bookForm2.setValue("bookAvailableQuantityTitle", "可借数量");
    bookForm3.setValue("bookIntroTitle", "简介:");

    this.addItem(vLayout);

    bind();
  }