Пример #1
0
  public void loadValues() {
    ConfigService.Util.getInstance()
        .getConfigValues(
            new AsyncCallbackClientLog<Map<Config, String>>() {

              @Override
              public void onSuccess(Map<Config, String> map) {
                super.onSuccess(map);
                ModelData modelData = modelData();

                for (Config config : map.keySet()) {
                  Object value = "";
                  if (config == editingConfig) {
                    value = mapKeyField.get(config).getValue();
                  } else {
                    value = map.get(config);
                  }
                  modelData.set(config.name(), value);
                }
                activateHandler = false;
                bind(modelData);
                activateHandler = true;
              }
            });
  }
Пример #2
0
  /**
   * DOC bessaies Comment method "onSaveChange".
   *
   * @param field
   */
  private void saveValue(final Field<Object> field) {
    final Config config = Config.valueOf(field.getName());
    field.setOriginalValue(field.getValue());
    updatePropertyMessage(config, ConfigStatus.CHECKING);
    String value;
    if (field.getValue() instanceof SimpleComboValue<?>) {
      SimpleComboValue<String> comboValue = (SimpleComboValue<String>) field.getValue();
      value = comboValue.getValue();
    } else if (field.getValue() instanceof Number) {
      value = String.valueOf(field.getValue());
    } else {
      value = (String) field.getValue();
    }

    ConfigService.Util.getInstance()
        .saveConfigValue(
            config,
            value,
            new AsyncCallbackClientLog<Void>() {

              @Override
              public void onSuccess(Void result) {
                ConfigService.Util.getInstance()
                    .check(
                        config,
                        new AsyncCallbackClientLog<List<ConfigMessageBean>>() {

                          @Override
                          public void onSuccess(List<ConfigMessageBean> beans) {
                            for (ConfigMessageBean configMessageBean : beans) {
                              Config c = configMessageBean.getConfig();
                              String message = configMessageBean.getMessage();
                              ConfigStatus status = configMessageBean.getStatus();
                              updatePropertyMessage(c, status, message);
                            }
                            updateGroupStatus(config.getConfigGroup(), false);
                            updateVisibility(config);
                            configsJustUpdated.add(config);
                          }

                          @Override
                          public void onFailure(Throwable caught) {
                            updatePropertyMessage(config, ConfigStatus.ERROR);
                          }
                        });
              }

              @Override
              public void onFailure(Throwable caught) {
                updatePropertyMessage(config, ConfigStatus.ERROR);
              }
            });
  }
Пример #3
0
  /** DOC bessaies Comment method "updateLicenseConfigGroup". */
  public void updateLicenseConfigGroup() {
    ConfigService.Util.getInstance()
        .getLicenseConfigGroup(
            new AsyncCallbackClientLog<List<ConfigGroup>>() {

              @Override
              public void onSuccess(List<ConfigGroup> configGroups) {
                for (ConfigGroup configGroup : ConfigGroup.values()) {
                  ContentPanel contentPanel = mapConfigGroupPanel.get(configGroup);
                  if (null != contentPanel) {
                    contentPanel.setVisible(configGroups.contains(configGroup));
                  }
                }
              }
            });
  }
Пример #4
0
  @Override
  public void load() {
    log.info("load");
    eventBus.fireEvent(new SubModuleEvent(EventType.OnServiceRefreshStart));
    loadValues();
    checkAllStatus();
    configsJustUpdated.clear();
    ConfigService.Util.getInstance()
        .checkAll(
            new AsyncCallbackClientLog<List<ConfigMessageBean>>() {

              @Override
              public void onSuccess(List<ConfigMessageBean> result) {
                for (ConfigMessageBean configMessageBean : result) {
                  Config c = configMessageBean.getConfig();
                  if (null == configsJustUpdated || !configsJustUpdated.contains(c)) {
                    String message = configMessageBean.getMessage();
                    ConfigStatus status = configMessageBean.getStatus();
                    updatePropertyMessage(c, status, message);
                  }
                }
                updateVisibility();
                updateGroupStatus(false);
                super.onSuccess(result);
                eventBus.fireEventFromSource(
                    new SubModuleEvent(EventType.OnServiceRefreshEnd), ConfigView.this);
                configsJustUpdated.clear();
              }

              @Override
              public void onFailure(Throwable caught) {
                checkAllFailed();
                super.onFailure(caught);
                eventBus.fireEventFromSource(
                    new SubModuleEvent(EventType.OnServiceRefreshEnd), ConfigView.this);
                configsJustUpdated.clear();
              }
            });
  }