diff --git a/navalplanner-webapp/src/main/java/org/navalplanner/web/orders/DynamicDatebox.java b/navalplanner-webapp/src/main/java/org/navalplanner/web/orders/DynamicDatebox.java
new file mode 100644
index 000000000..9c15a11e0
--- /dev/null
+++ b/navalplanner-webapp/src/main/java/org/navalplanner/web/orders/DynamicDatebox.java
@@ -0,0 +1,228 @@
+/*
+ * This file is part of NavalPlan
+ *
+ * Copyright (C) 2009 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 .
+ */
+
+package org.navalplanner.web.orders;
+
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.List;
+
+import org.navalplanner.business.orders.entities.OrderElement;
+import org.zkoss.ganttz.util.ComponentsFinder;
+import org.zkoss.util.Locales;
+import org.zkoss.zk.ui.Component;
+import org.zkoss.zk.ui.event.Event;
+import org.zkoss.zk.ui.event.EventListener;
+import org.zkoss.zk.ui.util.GenericForwardComposer;
+import org.zkoss.zul.Datebox;
+import org.zkoss.zul.Hbox;
+import org.zkoss.zul.Textbox;
+
+public class DynamicDatebox extends GenericForwardComposer {
+
+ private final OrderElement orderElement;
+
+ final Getter getter;
+
+ final Setter setter;
+
+ private Textbox dateTextBox;
+
+ private Datebox dateBox;
+
+ private DateFormat dateFormat;
+
+ public DynamicDatebox(final OrderElement orderElement, Getter getter,
+ Setter setter) {
+ this.orderElement = orderElement;
+ this.setter = setter;
+ this.getter = getter;
+ this.dateFormat = DateFormat.getDateInstance(DateFormat.SHORT, Locales
+ .getCurrent());
+ }
+
+ public OrderElement getOrderElement() {
+ return orderElement;
+ }
+
+ public Datebox getDateBox() {
+ return dateBox;
+ }
+
+ public void setDateBox(Datebox dateBox) {
+ this.dateBox = dateBox;
+ this.dateBox.setCompact(true);
+ this.dateBox.setFormat("dd/MM/yyyy");
+ }
+
+ /**
+ * When a text box associated to a datebox is requested to show the datebox,
+ * the corresponding datebox is shown
+ * @param component
+ * the component that has received focus
+ */
+ public void userWantsDateBox(Component component) {
+ if (component == dateTextBox) {
+ showDateBox(dateBox, dateTextBox);
+ }
+ }
+
+ private void showDateBox(Datebox currentDateBox, Textbox associatedTextBox) {
+ associatedTextBox.setVisible(false);
+ currentDateBox.setVisible(true);
+ currentDateBox.setFocus(true);
+ currentDateBox.setOpen(true);
+ }
+
+ /**
+ * When the dateBox loses focus the corresponding textbox is shown instead.
+ * @param dateBox
+ * the component that has lost focus
+ */
+ public void dateBoxHasLostFocus(Datebox currentDateBox) {
+ if (currentDateBox == dateBox) {
+ hideDateBox(dateBox, dateTextBox);
+ }
+ }
+
+ private void hideDateBox(Datebox dateBoxToDissapear,
+ Textbox associatedTextBox) {
+ dateBoxToDissapear.setVisible(false);
+ associatedTextBox.setVisible(true);
+ }
+
+ @Override
+ public void doAfterCompose(Component component) throws Exception {
+ super.doAfterCompose(component);
+ findComponents((Hbox) component);
+ registerListeners();
+ updateComponents();
+ }
+
+ private void registerListeners() {
+ registerOnEnterListener(dateTextBox);
+ registerOnEnterOpenDateBox(dateBox);
+ registerBlurListener(dateBox);
+ registerOnChange(dateBox);
+ }
+
+ private void findComponents(Hbox hbox) {
+ List