SPARK-1287, found error when parsing certain color.settings due to whitespaces somewhere

added button to reset all colorsettings to default


polish language updates




git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@12263 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Wolf Posdorfer
2011-04-20 07:52:37 +00:00
committed by wolf.posdorfer
parent cfacfaf89c
commit 328ec71c48
7 changed files with 280 additions and 228 deletions

View File

@ -447,41 +447,7 @@ public final class Spark {
UIManager.put(property, c);
}
// UIManager.put("TextField.lightforeground", Color.gray);
// UIManager.put("TextField.foreground", Color.BLACK);
// UIManager.put("TextField.caretForeground", Color.black);
// UIManager.put("List.selectionBackground", new Color(217, 232, 250));
// UIManager.put("List.selectionForeground", Color.black);
// UIManager.put("List.selectionBorder", new Color(187, 195, 215));
// UIManager.put("List.foreground", Color.black);
// UIManager.put("List.background", Color.white);
// UIManager.put("MenuItem.selectionBackground", new Color(217, 232, 250));
// UIManager.put("MenuItem.selectionForeground", Color.black);
// UIManager.put("TextPane.foreground", Color.black);
// UIManager.put("TextPane.background", new Color(255,255,255,0));
// UIManager.put("TextPane.inactiveForeground", Color.white);
// UIManager.put("TextPane.caretForeground", Color.black);
// UIManager.put("ChatInput.SelectedTextColor", Color.white);
// UIManager.put("ChatInput.SelectionColor", Color.blue);
// UIManager.put("ContactItemNickname.foreground", Color.black);
// UIManager.put("ContactItemDescription.foreground", Color.gray);
// UIManager.put("ContactItem.background", new Color(240, 243, 253,0));
// UIManager.put("ContactItemOffline.color", Color.gray);
// UIManager.put("Table.foreground", Color.black);
// UIManager.put("Table.background", Color.white);
// // Chat Area Text Settings
// UIManager.put("Link.foreground", Color.blue);
// UIManager.put("Address.foreground", new Color(212, 160, 0));
// UIManager.put("User.foreground", Color.blue);
// UIManager.put("OtherUser.foreground", Color.red);
// UIManager.put("Notification.foreground", new Color(0, 128, 0));
// UIManager.put("Error.foreground", Color.red);
// UIManager.put("Question.foreground", Color.red);
// UIManager.put("History.foreground", Color.darkGray);
// UIManager.put("SparkTabbedPane.startColor", new Color(236, 236, 236));
// UIManager.put("SparkTabbedPane.endColor", new Color(236, 236, 236));
// UIManager.put("SparkTabbedPane.borderColor", Color.lightGray);
}
/**

View File

@ -133,7 +133,7 @@ DEFAULT_LOOK_AND_FEEL = org.jvnet.substance.skin.SubstanceBusinessBlueSteelLookA
# all values must be set or it will produce errors
# they are preconfigured to look nice with the Windowstheme or the SubstanceBusinessBlueSteel Look
ChatInput.SelectedTextColor = 255,255,255,255
ChatInput.SelectionColor = 0,0,255,255
ChatInput.SelectionColor = 10,36,106,255
ContactItemNickname.foreground = 0,0,0,255
ContactItemDescription.foreground = 128,128,128,255
ContactItem.background = 240,243,253,255
@ -143,14 +143,14 @@ List.selectionBackground = 217,232,250,255
List.selectionForeground = 0,0,0,255
List.selectionBorder = 187,195,215,255
List.foreground = 0,0,0,255
List.background = 255,255,255,255
List.background = 255,255,255,255
TextField.lightforeground = 128,128,128,255
TextField.foreground = 0,0,0,255
TextField.caretForeground = 0,0,0,255
TextPane.foreground = 0,0,0,255
TextPane.background = 255,255,255,255
TextPane.inactiveForeground = 255,255,255,255
TextPane.caretForeground = 0,0,0,255
TextPane.caretForeground = 0,0,0,255
MenuItem.selectionBackground = 217,232,250,255
MenuItem.selectionForeground = 0,0,0,255
Table.foreground = 0,0,0,255

View File

@ -25,15 +25,13 @@ import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.awt.image.WritableRaster;
import java.util.Collections;
import java.util.Set;
import java.util.Vector;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JLabel;
@ -56,6 +54,13 @@ public class ColorPreferencePanel extends SparkTabbedPane {
private JList _colorliste;
private ColorSettings _colorsettings;
private JLabel _colorPreview;
private JLabel _errorlabel;
private JTextField _red;
private JTextField _green;
private JTextField _blue;
private JTextField _alfa;
public ColorPreferencePanel() {
createUI();
@ -76,62 +81,64 @@ public class ColorPreferencePanel extends SparkTabbedPane {
JPanel rightpanel = new JPanel(new GridBagLayout());
final JTextField red = new JTextField();
red.setPreferredSize(new Dimension(80,20));
_red = new JTextField();
_red.setPreferredSize(new Dimension(80,20));
JLabel redlabel = new JLabel(Res.getString("lookandfeel.color.red"));
final JTextField green = new JTextField();
green.setPreferredSize(new Dimension(80,20));
_green = new JTextField();
_green.setPreferredSize(new Dimension(80,20));
JLabel greenlabel = new JLabel(Res.getString("lookandfeel.color.green"));
final JTextField blue = new JTextField();
blue.setPreferredSize(new Dimension(80,20));
_blue = new JTextField();
_blue.setPreferredSize(new Dimension(80,20));
JLabel bluelabel = new JLabel(Res.getString("lookandfeel.color.blue"));
final JTextField alfa = new JTextField();
alfa.setPreferredSize(new Dimension(80,20));
_alfa = new JTextField();
_alfa.setPreferredSize(new Dimension(80,20));
JLabel alfalabel = new JLabel(Res.getString("lookandfeel.color.opacity")); //100 = 100%Visible
final JButton savebutton = new JButton(Res.getString("apply"));
final JLabel errorlabel = new JLabel("");
errorlabel.setForeground(Color.red);
final JButton restoreDefaults = new JButton(Res.getString("use.default"));
_errorlabel = new JLabel("");
_errorlabel.setForeground(Color.red);
final JLabel colorPreview = new JLabel();
colorPreview.setBackground(new Color(0,0,0,0));
colorPreview.setPreferredSize(new Dimension(80,20));
colorPreview.setMaximumSize(new Dimension(80,20));
colorPreview.setMinimumSize(new Dimension(80,20));
_colorPreview = new JLabel();
_colorPreview.setBackground(new Color(0,0,0,0));
_colorPreview.setPreferredSize(new Dimension(80,20));
_colorPreview.setMaximumSize(new Dimension(80,20));
_colorPreview.setMinimumSize(new Dimension(80,20));
rightpanel.add(colorPreview, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
rightpanel.add(_colorPreview, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
rightpanel.add(redlabel , new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0,GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
rightpanel.add(red, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
rightpanel.add(_red, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
rightpanel.add(new JLabel("0-255"), new GridBagConstraints(2, 1, 1, 1, 1.0, 0.0,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
rightpanel.add(greenlabel , new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
rightpanel.add(green, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
rightpanel.add(_green, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
rightpanel.add(new JLabel("0-255"), new GridBagConstraints(2, 2, 1, 1, 1.0, 0.0,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
rightpanel.add(bluelabel , new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0,GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
rightpanel.add(blue, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
rightpanel.add(_blue, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
rightpanel.add(new JLabel("0-255"), new GridBagConstraints(2, 3, 1, 1, 1.0, 0.0,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
rightpanel.add(alfalabel , new GridBagConstraints(0, 4, 1, 1, 1.0, 0.0,GridBagConstraints.EAST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
rightpanel.add(alfa, new GridBagConstraints(1, 4, 1, 1, 1.0, 0.0,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
rightpanel.add(_alfa, new GridBagConstraints(1, 4, 1, 1, 1.0, 0.0,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
rightpanel.add(new JLabel("0-100%"), new GridBagConstraints(2, 4, 1, 1, 1.0, 0.0,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
rightpanel.add(savebutton, new GridBagConstraints(0, 5, 2, 1, 1.0, 0.0,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
rightpanel.add(errorlabel, new GridBagConstraints(0, 6, 2, 1, 0.0, 0.0,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
rightpanel.add(_errorlabel, new GridBagConstraints(0, 6, 2, 1, 0.0, 0.0,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
rightpanel.add(restoreDefaults, new GridBagConstraints(0, 9, 2, 1, 1.0, 0.0,GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));
_colorliste = new JList(keys);
_jScrollPane = new JScrollPane(_colorliste);
@ -141,8 +148,7 @@ public class ColorPreferencePanel extends SparkTabbedPane {
_colorliste.addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent e) {
@ -150,16 +156,16 @@ public class ColorPreferencePanel extends SparkTabbedPane {
Color c = _colorsettings.getColorFromProperty(v);
red.setText(""+c.getRed());
green.setText(""+c.getGreen());
blue.setText(""+c.getBlue());
_red.setText(""+c.getRed());
_green.setText(""+c.getGreen());
_blue.setText(""+c.getBlue());
alfa.setText(""+(c.getAlpha()*100/255));
_alfa.setText(""+(c.getAlpha()*100/255));
colorPreview.setBackground(new Color(c.getRed(),c.getGreen(),c.getBlue()));
colorPreview.repaint();
colorPreview.revalidate();
errorlabel.setText("");
_colorPreview.setBackground(new Color(c.getRed(),c.getGreen(),c.getBlue()));
_colorPreview.repaint();
_colorPreview.revalidate();
_errorlabel.setText("");
}
});
@ -167,50 +173,71 @@ public class ColorPreferencePanel extends SparkTabbedPane {
@Override
public void actionPerformed(ActionEvent e) {
try{
// convert to value between 0 and 255
final int redvalue = Math.max(0,Math.min(255,Integer.parseInt(red.getText())));
final int greenvalue = Math.max(0,Math.min(255,Integer.parseInt(green.getText())));
final int bluevalue = Math.max(0,Math.min(255,Integer.parseInt(blue.getText())));
// convert to percent
int alfavalue = Math.max(0,Math.min(100,Integer.parseInt(alfa.getText())));
alfavalue = alfavalue*255/100;
Color c = new Color(redvalue,greenvalue,bluevalue,alfavalue);
_colorsettings.setColorForProperty((String)_colorliste.getSelectedValue(), c);
UIManager.put((String)_colorliste.getSelectedValue(), c);
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
colorPreview.setBackground(new Color(redvalue,greenvalue,bluevalue));
colorPreview.repaint();
colorPreview.revalidate();
}
});
errorlabel.setText(Res.getString("lookandfeel.color.saved"));
}
catch(Exception ex)
{
errorlabel.setText(Res.getString("title.error"));
errorlabel.revalidate();
}
savebuttonaction(e);
}
});
restoreDefaults.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ColorSettingManager.restoreDefault();
_colorsettings = ColorSettingManager.getColorSettings();
}
});
}
/**
* Called when the Save-Button is pressed
* @param e
*/
private void savebuttonaction(ActionEvent e)
{
try{
// convert to value between 0 and 255
final int redvalue = Math.max(0,Math.min(255,Integer.parseInt(_red.getText())));
final int greenvalue = Math.max(0,Math.min(255,Integer.parseInt(_green.getText())));
final int bluevalue = Math.max(0,Math.min(255,Integer.parseInt(_blue.getText())));
// convert to percent
int alfavalue = Math.max(0,Math.min(100,Integer.parseInt(_alfa.getText())));
alfavalue = alfavalue*255/100;
Color c = new Color(redvalue,greenvalue,bluevalue,alfavalue);
_colorsettings.setColorForProperty((String)_colorliste.getSelectedValue(), c);
UIManager.put((String)_colorliste.getSelectedValue(), c);
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
_colorPreview.setBackground(new Color(redvalue,greenvalue,bluevalue));
_colorPreview.repaint();
_colorPreview.revalidate();
}
});
_errorlabel.setText(Res.getString("lookandfeel.color.saved"));
}
catch(Exception ex)
{
_errorlabel.setText(Res.getString("title.error"));
_errorlabel.revalidate();
}
}
/**
* Sorts the provided List
* @param set
*/
private void sortList(Vector<String> set)
{
Collections.sort(set);
}

View File

@ -16,7 +16,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
package org.jivesoftware.spark.ui.themes;
import java.io.File;
@ -33,32 +33,33 @@ import org.jivesoftware.resource.Default;
import org.jivesoftware.spark.util.log.Log;
public class ColorSettingManager {
private static HashMap<String,String> _propertyHashMap = new HashMap<String, String>();
private static HashMap<String, String> _propertyHashMap = new HashMap<String, String>();
private static ColorSettings _colorsettings;
public ColorSettingManager() {
}
/**
* Returns the ColorSettingagent
*
*
* @return ColorSettingagent
*/
public static ColorSettings getColorSettings() {
File settings = getSettingsFile();
_colorsettings = load(settings);
_colorsettings = loadSettings(settings);
return _colorsettings;
}
public static boolean exists() {
return getSettingsFile().exists();
return getSettingsFile().exists();
}
/**
* Returns the file or creates it
*
* @return
*/
public static File getSettingsFile() {
@ -75,50 +76,51 @@ public class ColorSettingManager {
}
return f;
}
/**
* Save all settings
*/
public static void saveColorSettings() {
final Properties props = new Properties();
final Properties props = new Properties();
for(String key : _propertyHashMap.keySet())
{
String value =_propertyHashMap.get(key);
props.setProperty(key, value);
}
try {
props.store(new FileOutputStream(getSettingsFile()), "Storing Spark Color Settings");
}
catch (Exception e) {
Log.error("Error saving settings.", e);
}
for (String key : _propertyHashMap.keySet()) {
String value = _propertyHashMap.get(key);
props.setProperty(key, value);
}
try {
props.store(new FileOutputStream(getSettingsFile()),
"Storing Spark Color Settings");
} catch (Exception e) {
Log.error("Error saving settings.", e);
}
}
/**
* load the Settingfile
*
* @param file
* @return
*/
private static ColorSettings load(File file) {
private static ColorSettings loadSettings(File file) {
// load from file
loadSettingsToMap(file);
loadMap(file);
if (_propertyHashMap.size() == 0) {
Properties p = new Properties();
try {
p.load(new FileInputStream(getSettingsFile()));
initialLoad(p);
loadMap(file);
loadSettingsToMap(file);
} catch (FileNotFoundException e) {
Log.error("Error saving settings.", e);
} catch (IOException e) {
Log.error("Error saving settings.", e);
}
} else if (_propertyHashMap.size() != getDefaultColors().size()) {
compareSettings(_propertyHashMap, getDefaultColors());
}
ColorSettings settings = new ColorSettings(_propertyHashMap);
@ -126,25 +128,49 @@ public class ColorSettingManager {
return settings;
}
/**
* loads all Properties into a HashMap
* Compares two Hashmaps, if defaultmap has keys that are not within mymap
*
* @param mymap
* HashMap < String,String >
* @param defaultmap
* HashMap < String,String >
*/
private static void compareSettings(HashMap<String, String> mymap,
HashMap<String, String> defaultmap) {
boolean changesmade = false;
for (String key : defaultmap.keySet()) {
if (mymap.get(key) == null) // key doesnt exist in mymap
{
mymap.put(key, defaultmap.get(key));
changesmade = true;
}
}
if (changesmade) {
saveColorSettings();
}
}
/**
* loads all Properties into a HashMap from the File specified
*
* @param file
*/
private static void loadMap(File file) {
private static void loadSettingsToMap(File file) {
Properties props = new Properties();
try {
props.load(new FileInputStream(file));
Enumeration<Object> xx2 = props.keys();
while (xx2.hasMoreElements()) {
String object = (String) xx2.nextElement();
_propertyHashMap.put(object, props.getProperty(object));
}
Enumeration<Object> enume = props.keys();
while (enume.hasMoreElements()) {
String object = (String) enume.nextElement();
_propertyHashMap.put(object, props.getProperty(object));
}
} catch (FileNotFoundException e) {
Log.error("Error saving settings.", e);
@ -152,63 +178,42 @@ public class ColorSettingManager {
Log.error("Error saving settings.", e);
}
}
/**
* Used to set the Default values
* @param props
*/
private static void initialLoad(Properties props) {
public static HashMap<String, String> getDefaultColors() {
HashMap<String, String> hashmap = new HashMap<String, String>();
Enumeration<String> enu = Default.getAllKeys();
while (enu.hasMoreElements()) {
String s = enu.nextElement();
if (Default.getString(s).matches("[0-9]*,[0-9]*,[0-9]*,[0-9]*")) {
props.setProperty(s, Default.getString(s));
if (Default.getString(s).replace(" ", "")
.matches("[0-9]*,[0-9]*,[0-9]*,[0-9]*")) {
hashmap.put(s, Default.getString(s));
}
}
// props.setProperty("ChatInput.SelectedTextColor", Default.getString("ChatInput.SelectedTextColor"));
// props.setProperty("ChatInput.SelectionColor", Default.getString("ChatInput.SelectionColor" ));
// props.setProperty("ContactItemNickname.foreground", Default.getString("ContactItemNickname.foreground"));
// props.setProperty("ContactItemDescription.foreground", Default.getString("ContactItemDescription.foreground"));
// props.setProperty("ContactItem.background", Default.getString("ContactItem.background"));
// props.setProperty("ContactItemOffline.color", Default.getString("ContactItemOffline.color"));
// props.setProperty("Link.foreground", Default.getString("Link.foreground"));
// props.setProperty("List.selectionBackground", Default.getString("List.selectionBackground"));
// props.setProperty("List.selectionForeground", Default.getString("List.selectionForeground"));
// props.setProperty("List.selectionBorder", Default.getString("List.selectionBorder"));
// props.setProperty("List.foreground", Default.getString("List.foreground"));
// props.setProperty("List.background", Default.getString("List.background"));
// props.setProperty("TextField.lightforeground", Default.getString("TextField.lightforeground"));
// props.setProperty("TextField.foreground", Default.getString("TextField.foreground"));
// props.setProperty("TextField.caretForeground", Default.getString("TextField.caretForeground"));
// props.setProperty("TextPane.foreground", Default.getString("TextPane.foreground"));
// props.setProperty("TextPane.background", Default.getString("TextPane.background"));
// props.setProperty("TextPane.inactiveForeground", Default.getString("TextPane.inactiveForeground"));
// props.setProperty("TextPane.caretForeground", Default.getString("TextPane.caretForeground"));
// props.setProperty("MenuItem.selectionBackground", Default.getString("MenuItem.selectionBackground"));
// props.setProperty("MenuItem.selectionForeground", Default.getString("MenuItem.selectionForeground"));
// props.setProperty("Table.foreground", Default.getString("Table.foreground"));
// props.setProperty("Table.background", Default.getString("Table.background"));
// props.setProperty("Address.foreground", Default.getString("Address.foreground"));
// props.setProperty("User.foreground", Default.getString("User.foreground"));
// props.setProperty("OtherUser.foreground", Default.getString("OtherUser.foreground"));
// props.setProperty("Notification.foreground", Default.getString("Notification.foreground"));
// props.setProperty("Error.foreground", Default.getString("Error.foreground"));
// props.setProperty("History.foreground", Default.getString("History.foreground"));
// props.setProperty("SparkTabbedPane.startColor", Default.getString("SparkTabbedPane.startColor"));
// props.setProperty("SparkTabbedPane.endColor", Default.getString("SparkTabbedPane.endColor"));
// props.setProperty("SparkTabbedPane.borderColor", Default.getString("SparkTabbedPane.borderColor"));
// props.setProperty("Chat.activeTabColor", Default.getString("Chat.activeTabColor"));
// props.setProperty("Chat.inactiveTabColor", Default.getString("Chat.inactiveTabColor"));
// props.setProperty("Chat.unreadMessageColor", Default.getString("Chat.unreadMessageColor"));
return hashmap;
}
/**
* Used to set the Default values
*
* @param props
*/
private static void initialLoad(Properties props) {
HashMap<String, String> map = getDefaultColors();
for (String key : map.keySet()) {
props.setProperty(key, map.get(key));
}
try {
props.store(new FileOutputStream(getSettingsFile()), "Storing Spark Color Settings");
props.store(new FileOutputStream(getSettingsFile()),
"Storing Spark Color Settings");
} catch (FileNotFoundException e) {
Log.error("Error saving settings.", e);
} catch (IOException e) {
@ -216,4 +221,12 @@ public class ColorSettingManager {
}
}
/**
* Restores the Default Settings
*/
public static void restoreDefault() {
_propertyHashMap = getDefaultColors();
saveColorSettings();
}
}

View File

@ -20,20 +20,15 @@
package org.jivesoftware.spark.ui.themes;
import java.awt.Color;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Set;
import org.jivesoftware.resource.Default;
public class ColorSettings {
private HashMap<String, String> _hashmap;
public ColorSettings(HashMap<String, String> settingmap) {
_hashmap = settingmap;
addMissingValues();
}
public void setColorForProperty(String propertyname, Color color)
@ -72,30 +67,6 @@ public class ColorSettings {
return _hashmap.keySet();
}
/**
* Checks the default.properties for missing values and adds them
*/
public void addMissingValues()
{
boolean save = false;
Enumeration<String> enu = Default.getAllKeys();
while(enu.hasMoreElements())
{
String s = enu.nextElement();
if(Default.getString(s).matches("[0-9]*,[0-9]*,[0-9]*,[0-9]*"))
{
if (!_hashmap.containsKey(s)) {
_hashmap.put(s, Default.getString(s));
save = true;
}
}
}
if (save) {
ColorSettingManager.saveColorSettings();
}
}
}

View File

@ -19,10 +19,7 @@
*/
package org.jivesoftware.sparkimpl.plugin.systray;
import java.awt.Menu;
import java.awt.MenuItem;
import java.awt.MouseInfo;
import java.awt.PopupMenu;
import java.awt.SystemTray;
import java.awt.TrayIcon;
import java.awt.Window;
@ -450,12 +447,14 @@ public class SysTrayPlugin implements Plugin, NativeHandler,
// For Typing
@Override
public void cancelledNotification(String from, String packetID) {
System.out.println("set available");
trayIcon.setImage(availableIcon.getImage());
}
@Override
public void composingNotification(String from, String packetID) {
if (pref.isTypingNotificationShown()) {
System.out.println("set typing");
trayIcon.setImage(typingIcon.getImage());
}
}

View File

@ -238,6 +238,43 @@
## Added key: 'lookandfeel.color.saved'
## Added key: 'label.time.till.idlemessage'
## Added key: 'message.search.input.short'
## Added key: 'menuitem.revoke.member'
## Added key: 'menuitem.revoke.admin'
## Added key: 'menuitem.revoke.owner'
## Added key: 'menuitem.grant.member'
## Added key: 'menuitem.grant.admin'
## Added key: 'menutiem.grant.owner'
## Added key: 'menuitem.affiliation'
## Added key: 'privacy.title.preferences'
## Added key: 'privacy.title.panel'
## Added key: 'privacy.label.iq.desc'
## Added key: 'privacy.label.pin.desc'
## Added key: 'privacy.label.pout.desc'
## Added key: 'privacy.label.msg.desc'
## Added key: 'privacy.border.information'
## Added key: 'privacy.label.information'
## Added key: 'privacy.root.node'
## Added key: 'privacy.label.preferences'
## Added key: 'pricacy.tooltip.preferences'
## Added key: 'privacy.label.list.is.active'
## Added key: 'privacy.label.list.is.default'
## Added key: 'privacy.border.block'
## Added key: 'privacy.pick.one.or.more'
## Added key: 'privacy.title.add.picker'
## Added key: 'privacy.node.contacts'
## Added key: 'privacy.node.groups'
## Added key: 'privacy.menu.add.contacts'
## Added key: 'privacy.menu.add.groups'
## Added key: 'privacy.menu.add.rem.items'
## Added key: 'privacy.menu.remove'
## Added key: 'privacy.menu.avtivate.list'
## Added key: 'privacy.menu.default.list'
## Added key: 'privacy.menu.add.list'
## Added key: 'privacy.menu.remove.list'
## Added key: 'privacy.dialog.add.list'
## Added key: 'privacy.dialog.rem.list'
## Added key: 'privacy.status.menu.entry'
## Added key: 'privacy.name.for.default.list'
##
## Polish translation made by Martini26
@ -543,7 +580,11 @@ menuitem.edit.my.profile = Edytuj m\u00f3j profil
menuitem.edit.status.message = Edytuj opis statusu
menuitem.enter.login.information = Wprowad\u017a informacje logowania
menuitem.exit = Wyjd\u017a
menuitem.affiliation = Przynale\u017cno\u015b\u0107
menuitem.grant.moderator = Zezw\u00f3l na moderowanie
menuitem.grant.member = Przydziel uprawnienia cz\u0142onkowskie
menuitem.grant.admin = Przydziel uprawnienia administratora
menuitem.grant.owner = Przydziel uprawnienia w\u0142asno\u015bci
menuitem.grant.voice = Zezw\u00f3l na po\u0142\u0105czenie g\u0142osowe
menuitem.help = Pomoc
menuitem.hide = Ukryj
@ -573,6 +614,9 @@ menuitem.remove.service = Usu\u0144 us\u0142ug\u0119
menuitem.rename = Zmie\u0144 nazw\u0119
menuitem.revoke.moderator = Odbierz uprawnienia moderatora
menuitem.revoke.voice = Odbierz uprawnienia do po\u0142\u0105czenia g\u0142osowego
menuitem.revoke.member = Odbierz uprawnienia cz\u0142onkowskie
menuitem.revoke.admin = Odbierz uprawnienia administratora
menuitem.revoke.owner = Odbierz uprawnienia w\u0142asno\u015bci
menuitem.save = Zapisz
menuitem.save.as = Zapisz jako
menuitem.send.a.file = Wy\u015blij plik
@ -1019,4 +1063,36 @@ lookandfeel.color.red = Czerwony
lookandfeel.color.green = Zielony
lookandfeel.color.blue = Niebieski
lookandfeel.color.opacity = Nieprzezroczysto\u015b\u0107
lookandfeel.color.saved = Kolor zapisany#!#
lookandfeel.color.saved = Kolor zapisany
privacy.title.preferences = W\u0142a\u015bciwo\u015bci prywatno\u015bci Sparka
privacy.title.panel = Prosz\u0119 u\u017cyj prawego przycisku myszy
privacy.label.iq.desc = Zapytanie
privacy.label.pin.desc = Obecno\u015b\u0107
privacy.label.pout.desc = Nieobecno\u015b\u0107
privacy.label.msg.desc = Wiadomo\u015bci
privacy.border.information = Informacje o prywatno\u015bci
privacy.label.information = U\u017cyj prawego przycisku myszy i menu aby doda\u0107 lub usun\u0105\u0107 listy albo przedmioty
privacy.root.node = Listy prywatno\u015bci
privacy.label.preferences = Wytczka prywatno\u015bci
pricacy.tooltip.preferences = Ustawienia prywatno\u015bci Sparka
privacy.label.list.is.active = AKTYWNA
privacy.label.list.is.default = DOMY\u015aLNA
privacy.border.block = Zablokuj
privacy.pick.one.or.more = Wybierz jeden lub wi\u0119cej przedmiot\u00f3w aby doda\u0107 do listy
privacy.title.add.picker = Dodaj przedmioty do listy
privacy.node.contacts = Kontakty
privacy.node.groups = Grupy
privacy.menu.add.contacts = Dodaj kontakty do listy
privacy.menu.add.groups = Dodaj grupy do listy
privacy.menu.add.rem.items = Usu\u0144 {0} przedmiot\u00f3w z listy
privacy.menu.remove = Usu\u0144
privacy.menu.avtivate.list = Aktywuj
privacy.menu.default.list = Ustaw jako domy\u015blne
privacy.menu.add.list = Dodaj list\u0119
privacy.menu.remove.list = Usu\u0144 list\u0119
privacy.dialog.add.list = Wpisz nazw\u0119 listy
privacy.dialog.rem.list = Czy na pewno chcesz usun\u0105\u0107 {0}?
privacy.status.menu.entry = Listy prywatno\u015bci
privacy.name.for.default.list = Domy\u015blna
#!#