private void setConfirmResponseProperty(String propertyName, final int answer) { setDontShowProperty(propertyName); if (answer == JOptionPane.YES_OPTION) { _propertyMap.setPropertyBool(propertyName, true); } else if (answer == JOptionPane.NO_OPTION) { _propertyMap.setPropertyBool(propertyName, false); } }
/** * Sets a value of type <code>boolean</code>. * * @param key the key * @param value the value * * @throws IllegalArgumentException */ public void setPropertyBool(String key, boolean value) { Guardian.assertNotNullOrEmpty("key", key); setPropertyBool(key, value ? Boolean.TRUE : Boolean.FALSE); }
private void setDontShowProperty(String propertyName) { _propertyMap.setPropertyBool(createDontShowPropertyName(propertyName), _checkBox.isSelected()); }
public void unSuppressDialogs() { Enumeration propertyKeys = _propertyMap.getPropertyKeys(); while (propertyKeys.hasMoreElements()) { String key = (String) propertyKeys.nextElement(); if (isDontShowPropertyName(key)) { _propertyMap.setPropertyBool(key, false); } } }
private void initPreferences() { preferences = new PropertyMap(); preferences.setPropertyBool(PROPERTY_KEY_APP_DEBUG_ENABLED, false); preferences.setPropertyString(PROPERTY_KEY_APP_UI_FONT_NAME, "SansSerif"); preferences.setPropertyInt(PROPERTY_KEY_APP_UI_FONT_SIZE, 12); preferences.setPropertyBool(PROPERTY_KEY_APP_LOG_ENABLED, false); preferences.setPropertyString(PROPERTY_KEY_APP_LOG_PREFIX, getAppName()); preferences.setPropertyString(PROPERTY_KEY_APP_LOG_LEVEL, SystemUtils.LLS_INFO); preferences.setPropertyBool(PROPERTY_KEY_APP_LOG_ECHO, false); preferencesFile = new File(appUserDir, "preferences.properties"); loadPreferences(); suppressibleOptionPane = new SuppressibleOptionPane(getPreferences()); }
public static void transferConnectionData(ConnectionConfigData connectionConfigData, PropertyMap propertyMap) { ProxyConfig proxyConfig = connectionConfigData.getProxyConfig(); propertyMap.setPropertyBool(KEY_BEAM_REPOSITORY_PROXY_USED, connectionConfigData.isProxyUsed()); propertyMap.setPropertyString(KEY_BEAM_REPOSITORY_PROXY_HOST, proxyConfig.getHost()); propertyMap.setPropertyInt(KEY_BEAM_REPOSITORY_PROXY_PORT, proxyConfig.getPort()); propertyMap.setPropertyBool(KEY_BEAM_REPOSITORY_PROXY_AUTH_USED, proxyConfig.isAuthorizationUsed()); propertyMap.setPropertyString(KEY_BEAM_REPOSITORY_PROXY_USERNAME, proxyConfig.getUsername()); propertyMap.setPropertyString(KEY_BEAM_REPOSITORY_PROXY_PASSWORD, proxyConfig.getScrambledPassword()); }
/** * Stores this color palette definition in the given file * * @param colorPaletteDef thje color palette definition * @param file the file * * @throws IOException if an I/O error occurs */ public static void storeColorPaletteDef(ColorPaletteDef colorPaletteDef, File file) throws IOException { final ColorPaletteDef.Point[] points = colorPaletteDef.getPoints(); final PropertyMap propertyMap = new PropertyMap(); final int numPoints = points.length; propertyMap.setPropertyInt(_PROPERTY_KEY_NUM_POINTS, numPoints); propertyMap.setPropertyBool(_PROPERTY_KEY_AUTODISTRIBUTE, colorPaletteDef.isAutoDistribute()); for (int i = 0; i < numPoints; i++) { propertyMap.setPropertyColor(_PROPERTY_KEY_COLOR + i, points[i].getColor()); propertyMap.setPropertyDouble(_PROPERTY_KEY_SAMPLE + i, points[i].getSample()); } propertyMap.store(file, "BEAM Colour Palette Definition File"); /*I18N*/ }
protected final void setPreferences() { ////////////////////////////////////////////////////////////// // Store file history fileHistory.copyInto(getPreferences()); ////////////////////////////////////////////////////////////// // Store frame properties getPreferences().setPropertyInt("frame.location.x", getMainFrame().getLocation().x); getPreferences().setPropertyInt("frame.location.y", getMainFrame().getLocation().y); getPreferences().setPropertyInt("frame.size.width", getMainFrame().getSize().width); getPreferences().setPropertyInt("frame.size.height", getMainFrame().getSize().height); getPreferences().setPropertyBool("frame.ui.dblbuf", RepaintManager.currentManager(getMainFrame()).isDoubleBufferingEnabled()); ////////////////////////////////////////////////////////////// getPreferences().setPropertyBool(PROPERTY_KEY_APP_DEBUG_ENABLED, debugEnabled); }
/** * Tests the functionality of set and getPropertyBool */ public void testSetGetPropertyBool() { PropertyMap prop = new PropertyMap(); // "a" is not in the set assertEquals(false, prop.getPropertyBool("a")); assertEquals(true, prop.getPropertyBool("a", true)); assertEquals(false, prop.getPropertyBool("a", false)); assertEquals(null, prop.getPropertyBool("a", null)); assertEquals(Boolean.TRUE, prop.getPropertyBool("a", Boolean.TRUE)); assertEquals(Boolean.FALSE, prop.getPropertyBool("a", Boolean.FALSE)); // "b" is in the set and true prop.setPropertyBool("b", true); assertEquals(true, prop.getPropertyBool("b")); assertEquals(true, prop.getPropertyBool("b", true)); assertEquals(true, prop.getPropertyBool("b", false)); assertEquals(Boolean.TRUE, prop.getPropertyBool("b", null)); assertEquals(Boolean.TRUE, prop.getPropertyBool("b", Boolean.TRUE)); assertEquals(Boolean.TRUE, prop.getPropertyBool("b", Boolean.FALSE)); // "c" is in the set and false prop.setPropertyBool("c", false); assertEquals(false, prop.getPropertyBool("c")); assertEquals(false, prop.getPropertyBool("c", true)); assertEquals(false, prop.getPropertyBool("c", false)); assertEquals(Boolean.FALSE, prop.getPropertyBool("c", null)); assertEquals(Boolean.FALSE, prop.getPropertyBool("c", Boolean.TRUE)); assertEquals(Boolean.FALSE, prop.getPropertyBool("c", Boolean.FALSE)); }