Exemplo n.º 1
0
  private Widget addWidget(AddRecord recordTable) {
    Widget widget = new Widget();
    if (recordTable.getFieldType().equals(SQL_TYPE_STRING)) {
      widget = new TextBox();
      if (recordTable.getFieldType() != null) {
        ((TextBox) widget).setValue(recordTable.getFieldValue());
        ((TextBox) widget).setEnabled(recordTable.isEditable());
      }
    } else if (recordTable.getFieldType().equals(SQL_TYPE_DATE)) {
      widget = new DateBox();
      ((DateBox) widget).setEnabled(recordTable.isEditable());
    } else if (recordTable.getFieldType().equals(SQL_TYPE_LIST_STRING)) {
      final ListBox listBox = new ListBox();
      listBox.setEnabled(recordTable.isEditable());
      for (RefRecord rec : recordTable.getListRefRecord()) {
        listBox.addItem(rec.getValue(), String.valueOf(rec.getKey()));
      }

      widget = listBox;
    } else {
      widget = new TextBox();
      if (recordTable.getFieldValue() != null) {
        ((TextBox) widget).setValue(recordTable.getFieldValue());
        ((TextBox) widget).setEnabled(recordTable.isEditable());
      }
    }
    return widget;
  }
Exemplo n.º 2
0
 public void setEdited(boolean enabled) {
   dateBox.setEnabled(enabled);
   if (!enabled) {
     dateBox.addStyleDependentName("disabled");
   } else {
     dateBox.removeStyleDependentName("disabled");
   }
   edited = enabled;
 }
Exemplo n.º 3
0
  private void init() {
    staffArea = new OrganizationSpecialTextArea();
    staffAreaPanel.add(staffArea); // 提名人面板
    startTime.setFormat(new DateBox.DefaultFormat(dateFormat));
    // 隐藏周期性
    expectTime.setEnabled(true);
    tmdays.setEnabled(true);
    nextRewardsTime.setEnabled(false);
    tmday.setEnabled(false);
    setting.setEnabled(false);
    autoCbx.setEnabled(false);
    nextPublicTime.setEnabled(false);
    specialCbx.setEnabled(false);
    birthRadio.setEnabled(false);
    backStore.setVisible(false);
    //	settingText.getElement().getParentElement().getParentElement().getParentElement().addClassName(CssStyleConstants.hidden);
    nextRewardsTime.setFormat(new DateBox.DefaultFormat(dateFormat));
    nextPublicTime.setFormat(new DateBox.DefaultFormat(dateFormat));
    expectTime.setFormat(new DateBox.DefaultFormat(dateFormat));
    // sub.setText("我的奖项");
    // title.setText("创建奖项");
    // settingText.setText("每1天一次");
    birthRadio.getElement().addClassName(CssStyleConstants.hidden);
    // 周期性选择
    onetimes.addValueChangeHandler(
        new ValueChangeHandler<Boolean>() {
          @Override
          public void onValueChange(ValueChangeEvent<Boolean> event) {
            if (event.getValue()) {
              // settingText.getElement().getParentElement().getParentElement().getParentElement().addClassName(CssStyleConstants.hidden);
              // expectTime.getElement().getParentElement().getParentElement().getParentElement().removeClassName(CssStyleConstants.hidden);
              expectTime.setEnabled(true);
              tmdays.setEnabled(true);

              nextRewardsTime.setEnabled(false);
              tmday.setEnabled(false);
              setting.setEnabled(false);
              autoCbx.setEnabled(false);
              nextPublicTime.setEnabled(false);
              specialCbx.setEnabled(false);
              birthRadio.setEnabled(false);

              nextRewardsTime.setValue(null);
              tmday.setValue(null);
              autoCbx.setValue(null);
              nextPublicTime.setValue(null);
              specialCbx.setValue(null);
              birthRadio.setValue(null);
              settingText.setText("");
              frequency = null;
            } else {
              // settingText.getElement().getParentElement().getParentElement().getParentElement().removeClassName(CssStyleConstants.hidden);
              // expectTime.getElement().getParentElement().getParentElement().getParentElement().addClassName(CssStyleConstants.hidden);
              expectTime.setEnabled(false);
              tmdays.setEnabled(false);
              expectTime.setValue(null);
              tmdays.setValue(null);

              nextRewardsTime.setEnabled(true);
              tmday.setEnabled(true);
              setting.setEnabled(true);
              autoCbx.setEnabled(true);
              nextPublicTime.setEnabled(true);
              specialCbx.setEnabled(true);
              birthRadio.setEnabled(true);
            }
          }
        });
    moretimes.addValueChangeHandler(
        new ValueChangeHandler<Boolean>() {
          @Override
          public void onValueChange(ValueChangeEvent<Boolean> event) {
            if (event.getValue()) {
              expectTime.setEnabled(false);
              tmdays.setEnabled(false);
              expectTime.setValue(null);
              tmdays.setValue(null);

              nextRewardsTime.setEnabled(true);
              tmday.setEnabled(true);
              setting.setEnabled(true);
              autoCbx.setEnabled(true);
              nextPublicTime.setEnabled(true);
              specialCbx.setEnabled(true);
              birthRadio.setEnabled(true);
              // settingText.getElement().getParentElement().getParentElement().getParentElement().removeClassName(CssStyleConstants.hidden);
              // expectTime.getElement().getParentElement().getParentElement().getParentElement().addClassName(CssStyleConstants.hidden);
            } else {
              expectTime.setEnabled(true);
              tmdays.setEnabled(true);

              nextRewardsTime.setEnabled(false);
              tmday.setEnabled(false);
              setting.setEnabled(false);
              autoCbx.setEnabled(false);
              nextPublicTime.setEnabled(false);
              specialCbx.setEnabled(false);
              birthRadio.setEnabled(false);
              nextRewardsTime.setValue(null);
              tmday.setValue(null);
              autoCbx.setValue(null);
              nextPublicTime.setValue(null);
              specialCbx.setValue(null);
              birthRadio.setValue(null);
              settingText.setText("");
              // settingText.getElement().getParentElement().getParentElement().getParentElement().addClassName(CssStyleConstants.hidden);
              // expectTime.getElement().getParentElement().getParentElement().getParentElement().removeClassName(CssStyleConstants.hidden);
            }
          }
        });
    // 特殊条件
    specialCbx.addValueChangeHandler(
        new ValueChangeHandler<Boolean>() {

          @Override
          public void onValueChange(ValueChangeEvent<Boolean> event) {
            if (event.getValue()) {
              birthRadio.setValue(true, true);
              birthRadio.getElement().removeClassName(CssStyleConstants.hidden);
            } else {
              birthRadio.setValue(false, true);
              birthRadio.getElement().addClassName(CssStyleConstants.hidden);
            }
          }
        });

    // 生日奖
    birthRadio.addValueChangeHandler(
        new ValueChangeHandler<Boolean>() {
          @Override
          public void onValueChange(ValueChangeEvent<Boolean> event) {
            if (event.getValue()) {
              FrequencyClient frequecny = getFrequencyObj();
              if (frequecny == null
                  || frequecny instanceof WeekFrequencyClient
                  || frequecny instanceof YearFrequencyClient) {
                Window.alert("生日奖必须为每日或每月,已重设为每天一次");
                DayFrequencyClient daily = new DayFrequencyClient();
                daily.setInterval(1);
                showFrequencyInfo(daily);
              }
            } else {
              showFrequencyInfo(null);
            }
          }
        });

    // 自动颁奖
    autoCbx.addValueChangeHandler(
        new ValueChangeHandler<Boolean>() {

          @Override
          public void onValueChange(ValueChangeEvent<Boolean> event) {
            if (event.getValue()) {
              nextPublicTime.setEnabled(false);
              chooseBtns.setEnabled(false);
              //					chooseBtns.getElement().getParentElement()//隐藏提名
              //					.getParentElement()
              //					.addClassName(CssStyleConstants.hidden);
              //					nextPublicTime.getElement().getParentElement()
              //							.getParentElement()
              //							.addClassName(CssStyleConstants.hidden);
            } else {
              //					chooseBtns.getElement().getParentElement()//隐藏提名
              //					.getParentElement()
              //					.removeClassName(CssStyleConstants.hidden);
              //					nextPublicTime.getElement().getParentElement()
              //							.getParentElement()
              //							.removeClassName(CssStyleConstants.hidden);
              nextPublicTime.setEnabled(true);
              chooseBtns.setEnabled(true);
            }
          }
        });
    // 只能输入数字
    peopleSizeLimit.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            if (event.getValue() != null && !event.getValue().equals("")) {
              try {
                Integer.parseInt(event.getValue());
              } catch (Exception e) {
                peopleSizeLimit.setValue("");
              }
            }
          }
        });
    totalJF.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            if (event.getValue() != null && !event.getValue().equals("")) {
              try {
                Integer.parseInt(event.getValue());
              } catch (Exception e) {
                totalJF.setValue("");
              }
            }
          }
        });
    rewardsFrom.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            if (event.getValue() != null && !event.getValue().equals("")) {
              try {
                Integer.parseInt(event.getValue());
              } catch (Exception e) {
                rewardsFrom.setValue("");
              }
            }
          }
        });
    tmdays.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            if (event.getValue() != null && !event.getValue().equals("")) {
              try {
                Integer.parseInt(event.getValue());
              } catch (Exception e) {
                tmdays.setValue("");
              }
            }
          }
        });
    tmday.addValueChangeHandler(
        new ValueChangeHandler<String>() {
          @Override
          public void onValueChange(ValueChangeEvent<String> event) {
            if (event.getValue() != null && !event.getValue().equals("")) {
              try {
                Integer.parseInt(event.getValue());
              } catch (Exception e) {
                tmday.setValue("");
              }
            }
          }
        });
  }