SPARK-1210

PasswordProtected and Membersonly rooms get a LockSymbol

git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@12266 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Wolf Posdorfer
2011-04-20 11:10:55 +00:00
committed by wolf.posdorfer
parent 9c9db29460
commit e773330776
3 changed files with 850 additions and 778 deletions

View File

@ -54,6 +54,9 @@ import java.util.Map;
* @version 1.0, 03/12/14
*/
public abstract class Table extends JXTable {
private static final long serialVersionUID = -6511813002260596088L;
private Table.JiveTableModel tableModel;
/**
@ -181,7 +184,7 @@ public abstract class Table extends JXTable {
*
* @param list the list to add to the model.
*/
public void add(List list) {
public void add(List<Object> list) {
for (Object aList : list) {
Object[] newRow = (Object[]) aList;
tableModel.addRow(newRow);
@ -233,7 +236,9 @@ public abstract class Table extends JXTable {
* The internal Table Model.
*/
public static class JiveTableModel extends DefaultTableModel {
private boolean isEditable;
private static final long serialVersionUID = 2256144012470569949L;
private boolean isEditable;
/**
* Use the JiveTableModel in order to better handle the table. This allows
@ -264,7 +269,9 @@ public abstract class Table extends JXTable {
* A swing renderer used to display labels within a table.
*/
public class JLabelRenderer extends JLabel implements TableCellRenderer {
Border unselectedBorder;
private static final long serialVersionUID = 4433780600297455731L;
Border unselectedBorder;
Border selectedBorder;
boolean isBordered = true;
@ -323,7 +330,9 @@ public abstract class Table extends JXTable {
*/
public class TextAreaCellRenderer extends JTextArea implements TableCellRenderer {
/**
private static final long serialVersionUID = -8533968851464831361L;
/**
* Create new renderer with font.
*
* @param font the font to use in the renderer.
@ -351,7 +360,9 @@ public abstract class Table extends JXTable {
* A swing renderer used to display Buttons within a table.
*/
public class JButtonRenderer extends JButton implements TableCellRenderer {
Border unselectedBorder;
private static final long serialVersionUID = 1268514163461994738L;
Border unselectedBorder;
Border selectedBorder;
boolean isBordered = true;
@ -402,7 +413,10 @@ public abstract class Table extends JXTable {
}
public class ComboBoxRenderer extends JComboBox implements TableCellRenderer {
public ComboBoxRenderer() {
private static final long serialVersionUID = -545496178928790522L;
public ComboBoxRenderer() {
}
@ -428,7 +442,10 @@ public abstract class Table extends JXTable {
}
public class MyComboBoxEditor extends DefaultCellEditor {
public MyComboBoxEditor(String[] items) {
private static final long serialVersionUID = 6097118754932234992L;
public MyComboBoxEditor(String[] items) {
super(new JComboBox(items));
}
}

View File

@ -1,147 +1,84 @@
package pkg;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.io.FileInputStream;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Properties;
/**
* Use this Class to compare your locale with the standard english to find missing entries
* To Run in Terminal:
* javac CompareLocales.java
* java CompareLocales
*
*
*
*
* Use this Class to compare your locale with the standard english to find
* missing entries
*
* @author wolf.posdorfer
*
*
*/
public class CompareLocales {
private static ArrayList<String> _mainlist = new ArrayList<String>();
static ArrayList<String> _standardlist = new ArrayList<String>();
static ArrayList<String> _mylocalelist = new ArrayList<String>();
static HashMap<String, String>_englishlist = new HashMap<String, String>();
static HashMap<String, String> _mylocalelist = new HashMap<String, String>();
static String _endofFile = "#!#";
static String _path = "C:\\Dokumente und Einstellungen\\wolf.posdorfer\\Desktop\\eclipse\\spark\\src\\resources\\i18n\\spark_i18n";
static String english = _path + ".properties";
static String totest = _path + "_pl.properties";
public static void main(String[] args)
{
// Change Path
String path = "C:\\spark\\spark_i18n";
File standard = new File(path + ".properties");
/**
* Change this to your locale
*/
File mylocale = new File(path + "_de.properties");
public static void main(String[] args) {
readFile(new File(english), _englishlist);
readFile(new File(totest), _mylocalelist);
readFile(standard, _standardlist);
readFile(mylocale, _mylocalelist);
// check if all standard items are in the locale file
for (String s : _standardlist) {
if (!_mylocalelist.contains(s)) {
System.out.println(_mainlist.get(_standardlist.indexOf(s)));
for(String key : _englishlist.keySet())
{
if(!_mylocalelist.containsKey(key))
{
System.out.println(key +" = "+ _englishlist.get(key));
}
}
// Check if all locale-items are in the standard file
for (String s : _mylocalelist) {
if (!_standardlist.contains(s)) {
System.out.println("Delete this->"+s+ " @"+_mylocalelist.indexOf(s));
for(String key : _mylocalelist.keySet())
{
if(!_englishlist.containsKey(key))
{
System.out.println("Not Found in English: "+key +" = "+ _mylocalelist.get(key));
}
}
System.out.println("standardlist has: "+_standardlist.size() + " , my local has " + _mylocalelist.size());
// Check if we have doubles
checkdoubles(mylocale);
System.out.println("standardlist has: " + _englishlist.size() + " , my local has " + _mylocalelist.size());
}
/**
* Check if our File has double entries
* @param file
*/
private static void checkdoubles(File file) {
try {
BufferedReader reader = new BufferedReader(new FileReader(file));
ArrayList<String> liste = new ArrayList<String>();
HashSet<String> hashliste = new HashSet<String>();
String zeile = "";
boolean t = true;
while (t) {
// Skip all files that are not items
// like comments and empty lines
if (zeile != null && zeile.contains("=")) {
String s = zeile;
s = zeile.replace(" ", "");
s = s.substring(0, zeile.indexOf("="));
liste.add(s);
if (!hashliste.add(s))
System.out.println("Double-> "+zeile);
}
zeile = reader.readLine();
t = !zeile.contains(_endofFile);
}
System.out.println("\n "+file.getName()+"\n >>>containing " + liste.size() + " entries, with " + (liste.size()-hashliste.size())+ " doubles");
reader.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Reads a file into the Destination
*
* @param file
* @param destination
*/
public static void readFile(File file, ArrayList<String> destination) {
public static void readFile(File file, HashMap<String,String> destination) {
Properties props = new Properties();
try {
BufferedReader reader = new BufferedReader(new FileReader(file));
String zeile = "";
boolean t = true;
while (t) {
if (zeile != null && zeile.contains("=")) {
if (destination.equals(_standardlist))
_mainlist.add(zeile);
String s = zeile;
s = zeile.replace(" ", "");
s = s.substring(0, zeile.indexOf("="));
destination.add(s);
}
zeile = reader.readLine();
t = !zeile.contains(_endofFile);
}
reader.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
props.load(new FileInputStream(file));
} catch (Exception e) {
System.err.println("error with file");
}
Enumeration<Object> enume = props.keys();
while(enume.hasMoreElements())
{
String s = (String) enume.nextElement();
destination.put(s, props.getProperty(s));
}
}