SPARK-1257, SPARK-1258

added multilanguage support for Colors-Tab
added License headers
added english and german for colors-tab

git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@12189 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Wolf Posdorfer
2011-03-28 07:16:26 +00:00
committed by wolf.posdorfer
parent 44880929e0
commit 0cea49b718
6 changed files with 107 additions and 32 deletions

View File

@ -1,39 +1,51 @@
/**
* $RCSfile: ,v $
* $Revision: $
* $Date: $
*
* Copyright (C) 2004-2010 Jive Software. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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.awt.Color;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Image;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
import java.awt.image.IndexColorModel;
import java.awt.image.Raster;
import java.awt.image.WritableRaster;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.Vector;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import org.jivesoftware.resource.Res;
import org.jivesoftware.spark.component.tabbedPane.SparkTabbedPane;
public class ColorPreferencePanel extends SparkTabbedPane {
@ -66,21 +78,21 @@ public class ColorPreferencePanel extends SparkTabbedPane {
final JTextField red = new JTextField();
red.setPreferredSize(new Dimension(80,20));
JLabel redlabel = new JLabel("(0-255) Red:");
JLabel redlabel = new JLabel(Res.getString("lookandfeel.color.red"));
final JTextField green = new JTextField();
green.setPreferredSize(new Dimension(80,20));
JLabel greenlabel = new JLabel("(0-255) Green:");
JLabel greenlabel = new JLabel(Res.getString("lookandfeel.color.green"));
final JTextField blue = new JTextField();
blue.setPreferredSize(new Dimension(80,20));
JLabel bluelabel = new JLabel("(0-255) Blue:");
JLabel bluelabel = new JLabel(Res.getString("lookandfeel.color.blue"));
final JTextField alfa = new JTextField();
alfa.setPreferredSize(new Dimension(80,20));
JLabel alfalabel = new JLabel("(0-100%) Opacity:"); //100 = 100%Visible
JLabel alfalabel = new JLabel(Res.getString("lookandfeel.color.opacity")); //100 = 100%Visible
final JButton savebutton = new JButton("Save Color");
final JButton savebutton = new JButton(Res.getString("apply"));
final JLabel errorlabel = new JLabel("");
errorlabel.setForeground(Color.red);
@ -98,15 +110,23 @@ public class ColorPreferencePanel extends SparkTabbedPane {
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(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(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(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(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));
@ -175,12 +195,12 @@ public class ColorPreferencePanel extends SparkTabbedPane {
}
});
errorlabel.setText("Saved Color");
errorlabel.setText(Res.getString("lookandfeel.color.saved"));
}
catch(Exception ex)
{
errorlabel.setText("Insert valid number between 0-255");
errorlabel.setText(Res.getString("title.error"));
errorlabel.revalidate();
}
}
@ -194,14 +214,4 @@ public class ColorPreferencePanel extends SparkTabbedPane {
Collections.sort(set);
}
private BufferedImage createImageLabel(int[] pixels)
{
BufferedImage image = new BufferedImage(80, 20, BufferedImage.TYPE_INT_RGB);
WritableRaster raster = image.getRaster();
raster.setPixels(0, 0, 80, 20, pixels);
return image;
}
}

View File

@ -1,3 +1,22 @@
/**
* $RCSfile: ,v $
* $Revision: $
* $Date: $
*
* Copyright (C) 2004-2010 Jive Software. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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;
@ -13,8 +32,6 @@ import org.jivesoftware.Spark;
import org.jivesoftware.resource.Default;
import org.jivesoftware.spark.util.log.Log;
import sun.security.action.PutAllAction;
public class ColorSettingManager {
private static HashMap<String,String> _propertyHashMap = new HashMap<String, String>();
@ -92,7 +109,6 @@ public class ColorSettingManager {
Properties p = new Properties();
try {
System.out.println("loading again");
p.load(new FileInputStream(getSettingsFile()));
initialLoad(p);
loadMap(file);

View File

@ -1,3 +1,22 @@
/**
* $RCSfile: ,v $
* $Revision: $
* $Date: $
*
* Copyright (C) 2004-2010 Jive Software. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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.awt.Color;

View File

@ -1,6 +1,24 @@
/**
* $RCSfile: ,v $
* $Revision: $
* $Date: $
*
* Copyright (C) 2004-2010 Jive Software. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* 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 javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
@ -30,9 +48,8 @@ public class MainThemePanel extends JPanel {
tabs.addTab(Res.getString("title.appearance.preferences"),SparkRes.getImageIcon(SparkRes.PALETTE_24x24_IMAGE), _themepanel);
if(!Default.getBoolean("CHANGE_COLORS_DISABLED")){
tabs.addTab("Color",SparkRes.getImageIcon(SparkRes.COLOR_ICON),_colorpanel);
tabs.addTab(Res.getString("lookandfeel.color.label"),SparkRes.getImageIcon(SparkRes.COLOR_ICON),_colorpanel);
}
add(tabs);
}

View File

@ -989,5 +989,12 @@ lookandfeel.select = Select Look & Feel
lookandfeel.change.now = Change now
lookandfeel.tooltip.restart.no = No restart is needed
lookandfeel.tooltip.restart.yes = To toggle a System Look&Feel press Save and restart Spark.
lookandfeel.color.label = Colors
lookandfeel.color.red = Red
lookandfeel.color.green = Green
lookandfeel.color.blue = Blue
lookandfeel.color.opacity = Opacity
lookandfeel.color.saved = Color saved
#!#

View File

@ -880,4 +880,10 @@ lookandfeel.select = W
lookandfeel.change.now = Jetzt <20>ndern
lookandfeel.tooltip.restart.no = Es wird kein Neustart ben<65>tigt
lookandfeel.tooltip.restart.yes = Um ein System Look&Feel auszuw<75>hlen, bitte Speichern und Spark neustarten.
lookandfeel.color.label = Farben
lookandfeel.color.red = Rot
lookandfeel.color.green = Gr<EFBFBD>n
lookandfeel.color.blue = Blau
lookandfeel.color.opacity = Deckkraft
lookandfeel.color.saved = Farben gespeichert
#!#