Načítání názvů pro sestavy z properties souboru.

Properties soubory byly přesunuty do WEB-INF/locales, přesunuty lang
addony do WEB-INF/lang-addons. 
closes #79
This commit is contained in:
2014-05-30 12:23:20 +02:00
parent c42913ed9b
commit 4e5ae2bbfa
10 changed files with 81 additions and 6 deletions
@@ -28,7 +28,7 @@ public class StringUtils {
}
public static String localize(String key) {
return Labels.getLabel(key);
return Labels.getLabel(key) == null ? key : Labels.getLabel(key);
}
private static String getLocalized(String str) {
@@ -1,5 +1,7 @@
package info.bukova.isspst.reporting;
import info.bukova.isspst.StringUtils;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.List;
@@ -49,7 +51,7 @@ public class DynamicGenerator implements Generator {
Class<?> clazz = colClass(col);
if (clazz != null) {
try {
rb.addColumn(col, col, clazz, 30, false);
rb.addColumn(StringUtils.localize(col), col, clazz, 30, false);
} catch (ColumnBuilderException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -0,0 +1,21 @@
package info.bukova.isspst.ui;
import info.bukova.isspst.StringUtils;
import org.zkoss.bind.BindContext;
import org.zkoss.bind.Converter;
import org.zkoss.zk.ui.Component;
public class LocaleConverter implements Converter<String, String, Component> {
@Override
public String coerceToBean(String str, Component component, BindContext ctx) {
return str;
}
@Override
public String coerceToUi(String str, Component component, BindContext ctx) {
return StringUtils.localize(str);
}
}
@@ -27,18 +27,24 @@ public class ReportDialogVM {
private List<Object> data;
@WireVariable
private ReportDefinition reportDefinition;
private LocaleConverter locConverter;
@Init
public void init(@ExecutionArgParam("reports") List<Report> reports,
@ExecutionArgParam("data") List<Object> data) {
this.reports = reports;
this.data = data;
locConverter = new LocaleConverter();
if (data != null && data.size() > 0 && data.get(0).getClass() != reportDefinition.gatDataClass()) {
reportDefinition.clear();
}
}
public LocaleConverter getLocConverter() {
return locConverter;
}
public List<Report> getReports() {
return this.reports;
}
@@ -64,7 +70,9 @@ public class ReportDialogVM {
PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors();
List<String> properties = new ArrayList<String>();
for (PropertyDescriptor pd : pds) {
properties.add(pd.getName());
if (!(pd.getName().equals("password") || pd.getName().equals("class") || pd.getName().equals("id") || pd.getName().equals("valid"))) {
properties.add(pd.getName());
}
}
ListChecks<String> columns = new ListChecks<String>(reportDefinition.getFieldsToPrint(), properties);