List of usage examples for com.google.gwt.json.client JSONNumber JSONNumber
public JSONNumber(double value)
From source file:gov.nist.spectrumbrowser.admin.FrequencyBand.java
License:Open Source License
public void setChannelCount(long channelCount) { if (channelCount <= 0) { throw new IllegalArgumentException("Attempting to set Illegal value " + channelCount); }/*from w w w.j a v a2 s . c o m*/ threshold.put("channelCount", new JSONNumber(channelCount)); }
From source file:gov.nist.spectrumbrowser.admin.ScreenConfig.java
License:Open Source License
@Override public void draw() { verticalPanel.clear();/* w ww . jav a2 s.co m*/ HTML title; title = new HTML("<h3>Specify screen configuration parameters.</h3>"); titlePanel = new HorizontalPanel(); titlePanel.add(title); verticalPanel.add(titlePanel); grid = new Grid(7, 2); grid.setCellSpacing(4); grid.setBorderWidth(2); verticalPanel.add(grid); for (int i = 0; i < grid.getRowCount(); i++) { for (int j = 0; j < grid.getColumnCount(); j++) { grid.getCellFormatter().setHorizontalAlignment(i, j, HasHorizontalAlignment.ALIGN_CENTER); grid.getCellFormatter().setVerticalAlignment(i, j, HasVerticalAlignment.ALIGN_MIDDLE); } } grid.setCellPadding(2); grid.setCellSpacing(2); grid.setBorderWidth(2); int index = 0; TextBox mapWidth = new TextBox(); mapWidth.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String str = event.getValue(); try { int newVal = Integer.parseInt(str); if (newVal < 400) newVal = 400; else if (newVal > 1600) newVal = 1600; jsonObject.put(Defines.MAP_WIDTH, new JSONNumber(newVal)); } catch (NumberFormatException nfe) { Window.alert("Please enter a valid integer between 400 and 1600"); } } }); setInteger(index++, Defines.MAP_WIDTH, "Map Width (pixels)", mapWidth); TextBox mapHeight = new TextBox(); mapHeight.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String str = event.getValue(); try { int newVal = Integer.parseInt(str); if (newVal < 400) newVal = 400; else if (newVal > 1600) newVal = 1600; jsonObject.put(Defines.MAP_HEIGHT, new JSONNumber(newVal)); } catch (NumberFormatException nfe) { Window.alert("Please enter a valid integer between 400 and 1600"); } } }); setInteger(index++, Defines.MAP_HEIGHT, "Map Height (pixels)", mapHeight); TextBox specWidth = new TextBox(); specWidth.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String str = event.getValue(); try { int newVal = Integer.parseInt(str); if (newVal < 400) newVal = 400; else if (newVal > 1600) newVal = 1600; jsonObject.put(Defines.SPEC_WIDTH, new JSONNumber(newVal)); } catch (NumberFormatException nfe) { Window.alert("Please enter a valid integer between 400 and 1600"); } } }); setInteger(index++, Defines.SPEC_WIDTH, "Chart Width (pixels) for client side charts", specWidth); TextBox specHeight = new TextBox(); specHeight.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String str = event.getValue(); try { int newVal = Integer.parseInt(str); if (newVal < 400) newVal = 400; else if (newVal > 1600) newVal = 1600; jsonObject.put(Defines.SPEC_HEIGHT, new JSONNumber(newVal)); } catch (NumberFormatException nfe) { Window.alert("Please enter a valid integer between 400 and 1600"); } } }); setInteger(index++, Defines.SPEC_HEIGHT, "Chart Height (pixels) for client side charts", specHeight); TextBox chartWidth = new TextBox(); chartWidth.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String str = event.getValue(); try { int newVal = Integer.parseInt(str); if (newVal < 1) newVal = 1; else if (newVal > 10) newVal = 10; jsonObject.put(Defines.CHART_WIDTH, new JSONNumber(newVal)); } catch (NumberFormatException nfe) { Window.alert("Please enter a valid integer between 1 and 10"); } } }); setInteger(index++, Defines.CHART_WIDTH, "Aspect ratio (width) for server generated charts", chartWidth); TextBox chartHeight = new TextBox(); chartHeight.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String str = event.getValue(); try { int newVal = Integer.parseInt(str); if (newVal < 1) newVal = 1; else if (newVal > 10) newVal = 10; jsonObject.put(Defines.CHART_HEIGHT, new JSONNumber(newVal)); } catch (NumberFormatException nfe) { Window.alert("Please enter a valid integer between 1 and 10"); } } }); setInteger(index++, Defines.CHART_HEIGHT, "Aspect ratio (height) for server generated charts", chartHeight); TextBox warningText = new TextBox(); warningText.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { jsonObject.put(Defines.WARNING_TEXT, new JSONString(event.getValue())); } }); warningText.setTitle( "Absolute server path to file containing HTML to be displayed on user access to the system. Blank if no warning"); setText(index++, Defines.WARNING_TEXT, "Path to Warning Text displayed on first access to system", warningText); for (int i = 0; i < grid.getRowCount(); i++) { grid.getCellFormatter().setStyleName(i, 0, "textLabelStyle"); } applyButton = new Button("Apply Changes"); cancelButton = new Button("Cancel Changes"); logoutButton = new Button("Log Out"); applyButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Admin.getAdminService().setScreenConfig(jsonObject.toString(), new SpectrumBrowserCallback<String>() { @Override public void onSuccess(String result) { JSONObject jsonObj = JSONParser.parseLenient(result).isObject(); if (jsonObj.get("status").isString().stringValue().equals("OK")) { Window.alert("Configuration successfully updated"); } else { String errorMessage = jsonObj.get("ErrorMessage").isString().stringValue(); Window.alert("Error in updating config - please re-enter. Error Message : " + errorMessage); } } @Override public void onFailure(Throwable throwable) { Window.alert("Error communicating with server"); admin.logoff(); } }); } }); cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { redraw = true; Admin.getAdminService().getScreenConfig(ScreenConfig.this); } }); logoutButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { admin.logoff(); } }); HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.add(applyButton); buttonPanel.add(cancelButton); buttonPanel.add(logoutButton); verticalPanel.add(buttonPanel); }
From source file:gov.nist.spectrumbrowser.admin.Sensor.java
License:Open Source License
public Sensor() { this.sensorObj = new JSONObject(); sensorObj.put(Defines.SENSOR_ID, new JSONString("UNKNOWN")); sensorObj.put(Defines.SENSOR_KEY, new JSONString("UNKNOWN")); sensorObj.put("thresholds", new JSONObject()); sensorObj.put(Defines.STREAMING, new JSONObject()); sensorObj.put("dataRetentionDurationMonths", new JSONNumber(1)); sensorObj.put("sensorStatus", new JSONString("NEW")); sensorObj.put("sensorAdminEmail", new JSONString("UNKNOWN")); sensorObj.put("measurementType", new JSONString("Swept-Frequency")); sensorObj.put(Defines.IS_STREAMING_ENABLED, JSONBoolean.getInstance(false)); sensorObj.put(Defines.STARTUP_PARAMS, new JSONString("NONE")); }
From source file:gov.nist.spectrumbrowser.admin.Sensor.java
License:Open Source License
public boolean setDataRetentionDurationMonths(int value) { if (value < 0) { return false; } else {// ww w. j ava 2s . co m sensorObj.put("dataRetentionDurationMonths", new JSONNumber(value)); return true; } }
From source file:gov.nist.spectrumbrowser.admin.StreamingParams.java
License:Open Source License
public boolean setStreamingCaptureSamplingIntervalSeconds(int interval) { if (interval <= 0) return false; jsonObject.put(Defines.STREAMING_SAMPLING_INTERVAL_SECONDS, new JSONNumber(interval)); return true;/* ww w. ja va 2 s. c om*/ }
From source file:gov.nist.spectrumbrowser.admin.StreamingParams.java
License:Open Source License
public boolean setStreamingSecondsPerFrame(float secondsPerFrame) { if (secondsPerFrame <= 0) return false; jsonObject.put(Defines.STREAMING_SECONDS_PER_FRAME, new JSONNumber(secondsPerFrame)); return true;//from w w w. j a v a 2 s .c o m }
From source file:gov.nist.spectrumbrowser.admin.StreamingParams.java
License:Open Source License
public boolean setStreamingCaptureSampleSizeSeconds(int sampleSizeSeconds) { if (sampleSizeSeconds < 0) return false; jsonObject.put(Defines.STREAMING_CAPTURE_SAMPLE_SIZE_SECONDS, new JSONNumber(sampleSizeSeconds)); return true;// w w w . j a v a2 s . c om }
From source file:gov.nist.spectrumbrowser.admin.StreamingParams.java
License:Open Source License
public void setColorScaleMinPower(float colorScaleMinPower) { jsonObject.put(Defines.SENSOR_MIN_POWER, new JSONNumber(colorScaleMinPower)); }
From source file:gov.nist.spectrumbrowser.admin.StreamingParams.java
License:Open Source License
public void setColorScaleMaxPower(float colorScaleMaxPower) { jsonObject.put(Defines.SENSOR_MAX_POWER, new JSONNumber(colorScaleMaxPower)); }
From source file:gov.nist.spectrumbrowser.admin.SystemConfig.java
License:Open Source License
@Override public void draw() { verticalPanel.clear();/*from ww w . j a va2 s. co m*/ HTML title = new HTML("<h3>System Configuration</h3>"); HTML helpText = new HTML("<p>Specifies system wide configuration information. </p>"); verticalPanel.add(title); verticalPanel.add(helpText); grid = new Grid(22, 2); grid.setCellSpacing(4); grid.setBorderWidth(2); verticalPanel.add(grid); int counter = 0; myHostNameTextBox = new TextBox(); myHostNameTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String hostName = event.getValue(); jsonObject.put("HOST_NAME", new JSONString(hostName)); } }); setText(counter++, "HOST_NAME", "Public Host Name ", myHostNameTextBox); myPortTextBox = new TextBox(); myPortTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String publicPort = event.getValue(); try { int publicPortInt = Integer.parseInt(publicPort); if (publicPortInt < 0) { Window.alert("Publicly accessible port for server HTTP(s) access"); return; } jsonObject.put("PUBLIC_PORT", new JSONNumber(publicPortInt)); } catch (NumberFormatException ex) { Window.alert("Specify publicly accessible port (int)"); } } }); setInteger(counter++, "PUBLIC_PORT", "Public Web Server Port ", myPortTextBox); myProtocolTextBox = new TextBox(); myProtocolTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String protocol = event.getValue(); if (!protocol.equals("http") && !protocol.equals("https")) { Window.alert("please specify http or https"); return; } jsonObject.put("PROTOCOL", new JSONString(protocol)); } }); setText(counter++, "PROTOCOL", "Server access protocol", myProtocolTextBox); myServerIdTextBox = new TextBox(); myServerIdTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String serverId = event.getValue(); jsonObject.put("MY_SERVER_ID", new JSONString(serverId)); } }); myServerIdTextBox.setTitle( "Server ID must be unique across federation. Used to identify server to federation peers"); setText(counter++, "MY_SERVER_ID", "Unique ID for this server", myServerIdTextBox); myServerKeyTextBox = new TextBox(); myServerKeyTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String serverKey = event.getValue(); jsonObject.put("MY_SERVER_KEY", new JSONString(serverKey)); } }); myServerKeyTextBox.setTitle("Server key used to authenticate server to federation peers."); setText(counter++, "MY_SERVER_KEY", "Server Key", myServerKeyTextBox); smtpServerTextBox = new TextBox(); smtpServerTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String smtpServer = event.getValue(); jsonObject.put("SMTP_SERVER", new JSONString(smtpServer)); } }); setText(counter++, "SMTP_SERVER", "Host Name for SMTP server", smtpServerTextBox); smtpPortTextBox = new TextBox(); smtpPortTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { try { String portString = event.getValue(); int port = Integer.parseInt(portString); jsonObject.put("SMTP_PORT", new JSONNumber(port)); } catch (Exception exception) { Window.alert("Invalid port"); draw(); } } }); setInteger(counter++, "SMTP_PORT", "Mail Server Port", smtpPortTextBox); smtpEmailAddressTextBox = new TextBox(); smtpEmailAddressTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String email = event.getValue(); if (email.matches( "^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9-]+)*(\\.[A-Za-z]{2,})$")) { jsonObject.put("SMTP_EMAIL_ADDRESS", new JSONString(email)); } else { Window.alert("Please enter a valid SMTP email address"); draw(); } } }); setText(counter++, "SMTP_EMAIL_ADDRESS", "Primary admin email to use for mail FROM this server", smtpEmailAddressTextBox); adminContactNameTextBox = new TextBox(); adminContactNameTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String email = event.getValue(); jsonObject.put("ADMIN_CONTACT_NAME", new JSONString(email)); } }); setText(counter++, "ADMIN_CONTACT_NAME", "Primary administrator name", adminContactNameTextBox); adminContactNumberTextBox = new TextBox(); adminContactNumberTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String email = event.getValue(); jsonObject.put("ADMIN_CONTACT_NUMBER", new JSONString(email)); } }); setText(counter++, "ADMIN_CONTACT_NUMBER", "Primary administrator number", adminContactNumberTextBox); isAuthenticationRequiredTextBox = new TextBox(); isAuthenticationRequiredTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String flagString = event.getValue(); if (!flagString.equals("true") && !flagString.equals("false")) { Window.alert("Invalid entry : enter true or false"); draw(); } else { try { boolean flag = Boolean.parseBoolean(flagString); jsonObject.put(Defines.IS_AUTHENTICATION_REQUIRED, JSONBoolean.getInstance(flag)); } catch (Exception ex) { Window.alert("Enter true or false"); draw(); } } } }); isAuthenticationRequiredTextBox.setTitle("Start page will display a login screen if true"); setBoolean(counter++, Defines.IS_AUTHENTICATION_REQUIRED, "User Authentication Required (true/false)?", isAuthenticationRequiredTextBox); apiKeyTextBox = new TextBox(); apiKeyTextBox.setTitle("Google Timezone API key"); apiKeyTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String apiKey = event.getValue(); jsonObject.put("API_KEY", new JSONString(apiKey)); } }); apiKeyTextBox.setText("Request google for an API key."); setText(counter++, "API_KEY", "Google TimeZone API key", apiKeyTextBox); this.minStreamingInterArrivalTimeSeconds = new TextBox(); this.minStreamingInterArrivalTimeSeconds.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { // TODO Auto-generated method stub String minStreamingTimeStr = event.getValue(); try { double minStreamingInterArrivalTimeSeconds = Double.parseDouble(minStreamingTimeStr); if (minStreamingInterArrivalTimeSeconds < 0) { Window.alert("Please enter value > 0"); draw(); return; } jsonObject.put(Defines.MIN_STREAMING_INTER_ARRIVAL_TIME_SECONDS, new JSONNumber(minStreamingInterArrivalTimeSeconds)); } catch (Exception ex) { Window.alert("Please enter an integer > 0"); draw(); } } }); setFloat(counter++, Defines.MIN_STREAMING_INTER_ARRIVAL_TIME_SECONDS, "Min time (s) between successive spectra from streaming sensor", minStreamingInterArrivalTimeSeconds); myRefreshIntervalTextBox = new TextBox(); myRefreshIntervalTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String refreshInterval = event.getValue(); try { int refreshIntervalInt = Integer.parseInt(refreshInterval); if (refreshIntervalInt < 10) { Window.alert("Specify value above 10"); return; } jsonObject.put("SOFT_STATE_REFRESH_INTERVAL", new JSONNumber(refreshIntervalInt)); } catch (NumberFormatException ex) { Window.alert("Specify soft state refresh interval (seconds) for federation."); } } }); setInteger(counter++, "SOFT_STATE_REFRESH_INTERVAL", "Peering soft state refresh interval (s) ", myRefreshIntervalTextBox); useLDAPTextBox = new TextBox(); useLDAPTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String flagString = event.getValue(); try { if (!flagString.equals("true") && !flagString.equals("false")) { Window.alert("Enter true or false"); draw(); } else { boolean flag = Boolean.parseBoolean(flagString); jsonObject.put("USE_LDAP", JSONBoolean.getInstance(flag)); draw(); } } catch (Exception ex) { Window.alert("Enter true or false"); draw(); } } }); setBoolean(counter++, "USE_LDAP", "Use LDAP to store user accounts (true/false)?", useLDAPTextBox); accountNumFailedLoginAttemptsTextBox = new TextBox(); accountNumFailedLoginAttemptsTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String accountNumFailedLoginAttempts = event.getValue(); try { int accountNumFailedLoginAttemptsInt = Integer.parseInt(accountNumFailedLoginAttempts); if (accountNumFailedLoginAttemptsInt < 1) { Window.alert("Specify value above 0"); return; } jsonObject.put("ACCOUNT_NUM_FAILED_LOGIN_ATTEMPTS", new JSONNumber(accountNumFailedLoginAttemptsInt)); } catch (NumberFormatException ex) { Window.alert("Specify number of login attempts (e.g. 3) before the user is locked out."); } } }); setInteger(counter++, "ACCOUNT_NUM_FAILED_LOGIN_ATTEMPTS", "Number of failed login attempts before user is locked out ", accountNumFailedLoginAttemptsTextBox); changePasswordIntervalDaysTextBox = new TextBox(); changePasswordIntervalDaysTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String changePasswordIntervalDays = event.getValue(); try { int changePasswordIntervalDaysInt = Integer.parseInt(changePasswordIntervalDays); if (changePasswordIntervalDaysInt < 1) { Window.alert("Specify value above 0"); return; } jsonObject.put("CHANGE_PASSWORD_INTERVAL_DAYS", new JSONNumber(changePasswordIntervalDaysInt)); } catch (NumberFormatException ex) { Window.alert("Specify the interval (in days) for how often a user must change their password."); } } }); setInteger(counter++, "CHANGE_PASSWORD_INTERVAL_DAYS", "Interval (in days) between required password changes ", changePasswordIntervalDaysTextBox); userAccountAcknowHoursTextBox = new TextBox(); userAccountAcknowHoursTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String userAccountAcknowHours = event.getValue(); try { int userAccountAcknowHoursInt = Integer.parseInt(userAccountAcknowHours); if (userAccountAcknowHoursInt < 1) { Window.alert("Specify value above 0"); return; } jsonObject.put("ACCOUNT_USER_ACKNOW_HOURS", new JSONNumber(userAccountAcknowHoursInt)); } catch (NumberFormatException ex) { Window.alert( "Specify the interval (in hours) for how the user gets to click in an email link for account authorization or password resets. "); } } }); setInteger(counter++, "ACCOUNT_USER_ACKNOW_HOURS", "Interval (in hours) for user to activate account or reset password ", userAccountAcknowHoursTextBox); accountRequestTimeoutHoursTextBox = new TextBox(); accountRequestTimeoutHoursTextBox.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String accountRequestTimeoutHours = event.getValue(); try { int accountRequestTimeoutHoursInt = Integer.parseInt(accountRequestTimeoutHours); if (accountRequestTimeoutHoursInt < 1) { Window.alert("Specify value above 1"); return; } jsonObject.put("ACCOUNT_REQUEST_TIMEOUT_HOURS", new JSONNumber(accountRequestTimeoutHoursInt)); } catch (NumberFormatException ex) { Window.alert( "Specify the interval (in hours) for how the admin gets to click in an email link for account requests."); } } }); setInteger(counter++, "ACCOUNT_REQUEST_TIMEOUT_HOURS", "Interval (in hours) for admin to approve an account ", accountRequestTimeoutHoursTextBox); userSessionTimeoutMinutes = new TextBox(); userSessionTimeoutMinutes.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String accountSessionTimeoutMinutesString = event.getValue(); try { int userSessionTimeoutMinutes = Integer.parseInt(accountSessionTimeoutMinutesString); if (userSessionTimeoutMinutes < 1) { Window.alert("Specify a value above 1"); return; } jsonObject.put("USER_SESSION_TIMEOUT_MINUTES", new JSONNumber(userSessionTimeoutMinutes)); } catch (NumberFormatException nfe) { Window.alert("Specify user session timeout in minutes."); } } }); setInteger(counter++, "USER_SESSION_TIMEOUT_MINUTES", "User session timeout (min)", userSessionTimeoutMinutes); adminSessionTimeoutMinutes = new TextBox(); adminSessionTimeoutMinutes.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String accountSessionTimeoutMinutesString = event.getValue(); try { int adminSessionTimeoutMinutes = Integer.parseInt(accountSessionTimeoutMinutesString); if (adminSessionTimeoutMinutes < 1) { Window.alert("Specify a value above 1"); return; } jsonObject.put("ADMIN_SESSION_TIMEOUT_MINUTES", new JSONNumber(adminSessionTimeoutMinutes)); } catch (NumberFormatException nfe) { Window.alert("Specify user session timeout in minutes."); } } }); setInteger(counter++, "ADMIN_SESSION_TIMEOUT_MINUTES", "Admin session timeout (min)", adminSessionTimeoutMinutes); sslCert = new TextBox(); sslCert.addValueChangeHandler(new ValueChangeHandler<String>() { @Override public void onValueChange(ValueChangeEvent<String> event) { String sslCert = event.getValue(); if (sslCert == null || sslCert.equals("")) { Window.alert("Specify path to where certificate file is installed"); } jsonObject.put("CERT", new JSONString(sslCert)); } }); setText(counter++, "CERT", "path to certificate file", sslCert); for (int i = 0; i < grid.getRowCount(); i++) { grid.getCellFormatter().setStyleName(i, 0, "textLabelStyle"); } applyButton = new Button("Apply Changes"); cancelButton = new Button("Cancel Changes"); logoutButton = new Button("Log Out"); applyButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { Admin.getAdminService().setSystemConfig(jsonObject.toString(), new SpectrumBrowserCallback<String>() { @Override public void onSuccess(String result) { JSONObject jsonObj = JSONParser.parseLenient(result).isObject(); if (jsonObj.get("status").isString().stringValue().equals("OK")) { Window.alert("Configuration successfully updated"); } else { String errorMessage = jsonObj.get("ErrorMessage").isString().stringValue(); Window.alert("Error in updating config - please re-enter. Error Message : " + errorMessage); } } @Override public void onFailure(Throwable throwable) { Window.alert("Error communicating with server"); admin.logoff(); } }); } }); cancelButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { redraw = true; Admin.getAdminService().getSystemConfig(SystemConfig.this); } }); logoutButton.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { admin.logoff(); } }); HorizontalPanel buttonPanel = new HorizontalPanel(); buttonPanel.add(applyButton); buttonPanel.add(cancelButton); buttonPanel.add(logoutButton); verticalPanel.add(buttonPanel); }