List of usage examples for java.util.prefs Preferences put
public abstract void put(String key, String value);
From source file:org.kuali.test.ui.components.dialogs.EmailDlg.java
/** * * @return// w w w .ja va2 s .com */ @Override protected boolean save() { boolean retval = false; boolean oktosave = true; if (StringUtils.isNotBlank(mailHost.getText()) && StringUtils.isNotBlank(subject.getText()) && StringUtils.isNotBlank(fromAddress.getText()) && StringUtils.isNotBlank(toAddresses.getText())) { } else { displayRequiredFieldsMissingAlert("Email Setup", "mail host, subject, from address, to addreses"); oktosave = false; } if (oktosave) { emailSetup.setMailHost(mailHost.getText()); emailSetup.setSubject(subject.getText()); emailSetup.setFromAddress(fromAddress.getText()); emailSetup.setToAddresses(toAddresses.getText()); Preferences proot = Preferences.userRoot(); Preferences node = proot.node(Constants.PREFS_ROOT_NODE); node.put(Constants.LOCAL_RUN_EMAIL, localRunAddress.getText()); try { node.flush(); } catch (BackingStoreException ex) { LOG.warn(ex.toString(), ex); } setSaved(true); getConfiguration().setModified(true); dispose(); retval = true; } return retval; }
From source file:org.pentaho.di.core.util.StringListPluginProperty.java
/** * {@inheritDoc}/* w ww . j av a 2 s .c om*/ * * @see at.aschauer.commons.pentaho.plugin.PluginProperty#saveToPreferences(java.util.prefs.Preferences) */ public void saveToPreferences(final Preferences node) { node.put(this.getKey(), asString(this.getValue())); }
From source file:com.esri.geoevent.test.performance.ui.ProducerController.java
@Override protected void saveState() { Protocol selectedProtocol = protocol.getValue(); int portNumber = NumberUtils.toInt(port.getText(), DEFAULT_COMMAND_PORT); int serverPortNumber = NumberUtils.toInt(serverPort.getText(), DEFAULT_SERVER_PORT); Preferences preferences = Preferences.userNodeForPackage(ProducerController.class); preferences.put("protocol", selectedProtocol.toString()); preferences.put("port", String.valueOf(portNumber)); preferences.put("serverPort", String.valueOf(serverPortNumber)); }
From source file:de.fhg.igd.mapviewer.server.tiles.CustomTileMapServerConfiguration.java
/** * Save the configuration's properties to the given preference node * /*from www .java 2s . co m*/ * @param node the preference node */ protected void saveProperties(Preferences node) { node.put(URL_PATTERN, getUrlPattern()); node.putInt(ZOOM_LEVELS, getZoomLevel()); node.put(ATTRIBUTION, getAttributionText()); }
From source file:com.esri.geoevent.test.performance.ui.ConsumerController.java
@Override protected void saveState() { Protocol selectedProtocol = protocol.getValue(); int portNumber = NumberUtils.toInt(port.getText(), DEFAULT_COMMAND_PORT); int serverPortNumber = NumberUtils.toInt(serverPort.getText(), DEFAULT_SERVER_PORT); Preferences preferences = Preferences.userNodeForPackage(ConsumerController.class); preferences.put("protocol", selectedProtocol.toString()); preferences.put("port", String.valueOf(portNumber)); preferences.put("serverPort", String.valueOf(serverPortNumber)); }
From source file:de.fhg.igd.mapviewer.server.wms.WMSConfiguration.java
/** * Save the configuration's properties to the given preference node * //from w w w. j ava2 s . c om * @param node the preference node */ protected void saveProperties(Preferences node) { node.put(BASE_URL, getBaseUrl()); node.putInt(PREFERRED_EPSG, getPreferredEpsg()); node.put(LAYERS, getLayers()); }
From source file:net.straylightlabs.tivolibre.DecoderApp.java
private void saveMak(String mak) { Preferences prefs = getPrefs(); prefs.put(PREF_MAK, mak); }
From source file:ch.astina.hesperid.installer.web.services.InstallationManager.java
public void saveHomeDirectory(String homedirectory) { Preferences prefs = Preferences.userNodeForPackage(InstallationManager.class); prefs.put(HOME_DIRECTORY, homedirectory); try {//from w w w .j av a2 s. c o m prefs.flush(); } catch (BackingStoreException ex) { logger.error("Could not store home directory", ex); } }
From source file:de.dal33t.powerfolder.util.ConfigurationLoader.java
/** * PUBLIC because of tests. DO NOT USE. Use * {@link #merge(Properties, Properties, Preferences, boolean)} instead. * <p>/*from www. ja va2 s. c o m*/ * Merges the give pre configuration properties into the target preferences. * It can be choosen if existing keys in the target preferences should be * replaced or not. Will only set those values from preConfig where the key * begins with "pref." and cut it off. "pref.xxx=true" will be set to * "xxx=true" in preferences. * * @param preConfig * the pre config * @param targetPreferences * the preferences to set the pre-configuration values into. * @param replaceExisting * if existing key/value pairs will be overwritten by pairs of * pre config. * @return the number of merged entries. */ public static int mergePreferences(Properties preConfig, Preferences targetPreferences, boolean replaceExisting) { Reject.ifNull(preConfig, "PreConfig is null"); Reject.ifNull(targetPreferences, "TargetPreferences is null"); int n = 0; for (Object obj : preConfig.keySet()) { String key = (String) obj; String value = preConfig.getProperty(key); if (!key.startsWith(PREFERENCES_PREFIX)) { continue; } else { key = key.substring(PREFERENCES_PREFIX.length(), key.length()); } boolean entryMissing = "-XXWEIRED-DEFAULT-VALUE" .equals(targetPreferences.get(key, "-XXWEIRED-DEFAULT-VALUE")); if (entryMissing || replaceExisting) { targetPreferences.put(key, value); n++; LOG.finer("Preconfigured " + key + "=" + value); } } if (n > 0) { LOG.fine(n + " default preferences set"); } else { LOG.finer("No additional default preferences set"); } return n; }
From source file:org.apache.syncope.ide.netbeans.view.ServerDetailsView.java
protected void okButtonActionPerformed(final java.awt.event.ActionEvent evt) { // validation List<String> validation = validate(schemeTxt, hostTxt, portTxt, userNameTxt); if (validation.isEmpty()) { Preferences prefs = NbPreferences.forModule(ResourceExplorerTopComponent.class); prefs.put("scheme", schemeTxt.getText()); prefs.put("host", hostTxt.getText()); prefs.put("port", portTxt.getText()); prefs.put("username", userNameTxt.getText()); prefs.put("password", new String(passwordTxt.getPassword())); // dismiss panel this.dispose(); } else {// ww w. java 2s . com JOptionPane.showMessageDialog(null, "Please insert valid " + validation, "Validation Error", JOptionPane.ERROR_MESSAGE); } }