Localize predefined criterion types

Adds new component <l10n> suited to localized strings that come from
properties from business objets
This commit is contained in:
Diego Pino Garcia 2010-09-07 11:40:13 +02:00
parent 50696ee4d6
commit b9c04d5d90
7 changed files with 7257 additions and 5750 deletions

View file

@ -22,6 +22,8 @@ package org.navalplanner.business.resources.entities;
import java.util.Arrays;
import java.util.List;
import static org.navalplanner.business.i18n.I18nHelper._;
/**
* This class defines some criterion types known a priori<br />
* @author Óscar González Fernández <ogonzalez@igalia.com>
@ -29,37 +31,37 @@ import java.util.List;
*/
public enum PredefinedCriterionTypes implements ICriterionType<Criterion> {
WORK_RELATIONSHIP("Relationship of the resource with the enterprise ",false, false,true, ResourceEnum.WORKER) {
WORK_RELATIONSHIP(_("WORK_RELATIONSHIP"), "Relationship of the resource with the enterprise ",false, false,true, ResourceEnum.WORKER) {
@Override
public List<String> getPredefined() {
return WorkingRelationship.getCriterionNames();
}
},
LOCATION_GROUP("Location where the resource work",false, true, true, ResourceEnum.RESOURCE) {
LOCATION_GROUP(_("LOCATION_GROUP"), "Location where the resource work",false, true, true, ResourceEnum.RESOURCE) {
@Override
public List<String> getPredefined() {
return Arrays.asList();
}
},
LEAVE("Leave",false, false, true, ResourceEnum.WORKER) {
LEAVE(_("LEAVE"), "Leave",false, false, true, ResourceEnum.WORKER) {
@Override
public List<String> getPredefined() {
return LeaveCriterions.getCriterionNames();
}
},
TRAINING("Training courses and labor training",true, true, true, ResourceEnum.WORKER) {
TRAINING(_("TRAINING"), "Training courses and labor training",true, true, true, ResourceEnum.WORKER) {
@Override
public List<String> getPredefined() {
return Arrays.asList();
}
},
JOB("Job",true, true, true, ResourceEnum.WORKER) {
JOB(_("JOB"),"Job",true, true, true, ResourceEnum.WORKER) {
@Override
public List<String> getPredefined() {
return Arrays.asList();
}
},
CATEGORY("Professional category",true, true, true, ResourceEnum.WORKER) {
CATEGORY(_("CATEGORY"),"Professional category",true, true, true, ResourceEnum.WORKER) {
@Override
public List<String> getPredefined() {
return Arrays.asList();
@ -76,7 +78,7 @@ public enum PredefinedCriterionTypes implements ICriterionType<Criterion> {
private final ResourceEnum resource;
private PredefinedCriterionTypes(String description, boolean allowHierarchy,
private PredefinedCriterionTypes(String name, String description, boolean allowHierarchy,
boolean allowSimultaneousCriterionsPerResource,
boolean enabled,
ResourceEnum resource) {

View file

@ -0,0 +1,49 @@
/*
* This file is part of NavalPlan
*
* Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
* Desenvolvemento Tecnolóxico de Galicia
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.navalplanner.web.common.components;
import org.navalplanner.web.I18nHelper;
import org.zkoss.zul.Label;
/**
* This component is aimed to localize strings that come from business objects. For instance:
*
* <rows>
* <row self="@{each='criterionType'}" value="@{criterionType}">
* <l10n value="@{criterionType.name}"/>
* </row>
* </rows>
*
* @author Diego Pino García <dpino@igalia.com>
*/
@SuppressWarnings("serial")
public class L10n extends Label {
public L10n() {
}
@Override
public void setValue(String value) {
super.setValue(I18nHelper._(value));
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -17,6 +17,12 @@
<macro-uri>/common/components/i18n.zul</macro-uri>
</component>
<component>
<component-name>l10n</component-name>
<component-class>org.navalplanner.web.common.components.L10n</component-class>
<extends>label</extends>
</component>
<component>
<component-name>calendarhighlighteddays</component-name>
<component-class>org.navalplanner.web.common.components.CalendarHighlightedDays</component-class>

View file

@ -28,7 +28,7 @@
</columns>
<rows>
<row self="@{each='criterionType'}" value="@{criterionType}">
<label value="@{criterionType.name}"/>
<l10n value="@{criterionType.name}"/>
<label value="@{criterionType.code}"/>
<checkbox disabled="true" checked="@{criterionType.enabled}"/>
<hbox>
@ -51,4 +51,4 @@
<button id="show_create_form" onClick="controller.goToCreateForm();" label="${i18n:_('Create')}"
sclass="create-button global-action">
</button>
</window>
</window>