[Bug #1274] Remove LenientDecimalBox.

FEA: ItEr75S04BugFixing
This commit is contained in:
Manuel Rego Casasnovas 2011-11-28 10:05:27 +01:00 committed by Jacobo Aragunde Pérez
parent fc6f0f6b7f
commit 8fa78f51f8
6 changed files with 2 additions and 71 deletions

View file

@ -1,46 +0,0 @@
/*
* This file is part of LibrePlan
*
* Copyright (C) 2011 Igalia, S.L.
*
* 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.libreplan.web.common;
import java.math.BigDecimal;
import java.text.DecimalFormatSymbols;
import org.zkoss.util.Locales;
import org.zkoss.zk.ui.WrongValueException;
import org.zkoss.zul.Decimalbox;
/**
* Same behavior as a {@link Decimalbox}, but it always interprets <b>,</b> and
* <b>.</b> as decimals separators. So you can use both freely as decimal
* separators.
*
* @author Óscar González Fernández <ogonzalez@igalia.com>
*
*/
public class LenientDecimalBox extends Decimalbox {
public LenientDecimalBox() {
super();
}
public LenientDecimalBox(BigDecimal value) throws WrongValueException {
super(value);
}
}

View file

@ -60,7 +60,6 @@ import org.libreplan.business.workingday.EffortDuration;
import org.libreplan.business.workingday.EffortDuration.IEffortFrom;
import org.libreplan.business.workingday.ResourcesPerDay;
import org.libreplan.web.common.EffortDurationBox;
import org.libreplan.web.common.LenientDecimalBox;
import org.libreplan.web.common.Util;
import org.libreplan.web.planner.allocation.ResourceAllocationController.DerivedAllocationColumn;
import org.zkoss.zk.au.out.AuWrongValue;
@ -284,7 +283,7 @@ public abstract class AllocationRow {
private EffortDurationBox effortInput = new EffortDurationBox();
private final Decimalbox intendedResourcesPerDayInput = new LenientDecimalBox();
private final Decimalbox intendedResourcesPerDayInput = new Decimalbox();
private ResourcesPerDay editedValue;

View file

@ -40,7 +40,6 @@ import org.libreplan.business.resources.entities.ResourceEnum;
import org.libreplan.web.I18nHelper;
import org.libreplan.web.common.EffortDurationBox;
import org.libreplan.web.common.IMessagesForUser;
import org.libreplan.web.common.LenientDecimalBox;
import org.libreplan.web.common.Util;
import org.libreplan.web.common.components.AllocationSelector;
import org.libreplan.web.common.components.NewAllocationSelector;
@ -142,7 +141,7 @@ public class ResourceAllocationController extends GenericForwardComposer {
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
allResourcesPerDay = new LenientDecimalBox();
allResourcesPerDay = new Decimalbox();
allResourcesPerDay.setWidth("80px");
initAllocationLabels();
makeReadyInputsForCalculationTypes();

View file

@ -88,12 +88,6 @@
<macro-uri>/common/components/templateFinder.zul</macro-uri>
</component>
<component>
<component-name>LenientDecimalBox</component-name>
<component-class>org.libreplan.web.common.LenientDecimalBox</component-class>
<widget-class>webcommon.LenientDecimalBox</widget-class>
</component>
<component>
<component-name>LimitingResourcesPanel</component-name>
<component-class>org.libreplan.web.limitingresources.LimitingResourcesPanel</component-class>

View file

@ -1,14 +0,0 @@
zk.$package("webcommon");
webcommon.LenientDecimalBox = zk.$extends(zul.inp.Decimalbox,{
coerceFromString_: function (b) {
if(!b) {
return null;
}
//replace decimal comma with dot
b = b.replace(',','.');
//process normally
return this.$supers('coerceFromString_', arguments);
}
});

View file

@ -1,3 +1,2 @@
<package name="webcommon" language="xul/html" depends="zul.inp">
<widget name="LenientDecimalBox"/>
</package>