Пример #1
0
  @Override
  protected void onDraw() {
    super.onDraw();

    setEditMode(editMode);
  }
Пример #2
0
  @Override
  protected void onDraw() {
    super.onDraw();

    GWTServiceLookup.getSystemService()
        .getSystemSettings(
            new AsyncCallback<SystemSettings>() {
              @Override
              public void onSuccess(SystemSettings result) {

                canvas.addMember(getServerDetails());

                Configuration config = new Configuration();
                for (Map.Entry<String, String> entry : result.getSystemConfiguration().entrySet()) {
                  String name = entry.getKey();
                  String value = (entry.getValue() == null) ? "" : entry.getValue();

                  // some of our properties are actually different values on the server than how
                  // they are to be
                  // visualized in the UI.
                  // -- JAASProvider is a boolean in the UI but is "LDAP" if it was true and "JDBC"
                  // if it was false
                  // -- LDAPProtocol is a boolean in the UI but is "ssl" if true and "" if it was
                  // false
                  // -- some other numerical values need to be converted from milliseconds
                  if (Constant.JAASProvider.equals(name)) {
                    value = Boolean.toString(value.equals(Constant.LDAPJAASProvider));
                  } else if (Constant.LDAPProtocol.equals(name)) {
                    value = Boolean.toString(value.equalsIgnoreCase("ssl"));
                  } else if (Constant.AgentMaxQuietTimeAllowed.equals(name)) {
                    value = convertMillisToMinutes(value);
                  } else if (Constant.DataMaintenance.equals(name)) {
                    value = convertMillisToHours(value);
                  } else if (Constant.AvailabilityPurge.equals(name)
                      || Constant.AlertPurge.equals(name)
                      || Constant.TraitPurge.equals(name)
                      || Constant.RtDataPurge.equals(name)
                      || Constant.EventPurge.equals(name)
                      || Constant.DriftFilePurge.equals(name)
                      || Constant.BaselineFrequency.equals(name)
                      || Constant.BaselineDataSet.equals(name)) {
                    value = convertMillisToDays(value);
                  } else if (Constant.EnableAgentAutoUpdate.equals(name)) {
                    if (value.trim().length() == 0) {
                      value =
                          "false"; // if, for some reason, this value was empty, use false - let the
                                   // user explicitly enable it
                    }
                  } else if (Constant.EnableDebugMode.equals(name)) {
                    if (value.trim().length() == 0) {
                      value = "false";
                    }
                  } else if (Constant.EnableExperimentalFeatures.equals(name)) {
                    if (value.trim().length() == 0) {
                      value = "false";
                    }
                  } else if (Constant.DataReindex.equals(name)) {
                    if (value.trim().length() == 0) {
                      value = "true";
                    }
                  }

                  PropertySimple prop = new PropertySimple(name, value);
                  config.put(prop);
                }

                // build our config definition and populate our config editor
                editor =
                    new ConfigurationEditor(
                        extendLocatorId("configEditor"),
                        getSystemSettingsDefinition(config, result.getDriftPlugins()),
                        config);
                editor.addPropertyValueChangeListener(SystemSettingsView.this);
                canvas.addMember(editor);

                ToolStrip toolStrip = new ToolStrip();
                toolStrip.setWidth100();
                toolStrip.setMembersMargin(5);
                toolStrip.setLayoutMargin(5);

                saveButton =
                    new LocatableIButton(extendLocatorId("Save"), MSG.common_button_save());
                saveButton.addClickHandler(
                    new ClickHandler() {
                      public void onClick(ClickEvent clickEvent) {
                        save();
                      }
                    });
                toolStrip.addMember(saveButton);

                canvas.addMember(toolStrip);
              }

              @Override
              public void onFailure(Throwable t) {
                CoreGUI.getErrorHandler()
                    .handleError(MSG.view_admin_systemSettings_cannotLoadSettings(), t);
              }
            });
  }