horaText.getElement().addClassName("selectorHora");
labelBox.getElement().addClassName("labelDatePicker");
labelBox2.getElement().addClassName("labelDatePicker");
PredefinedFormat format = DateTimeFormat.PredefinedFormat.DATE_LONG;
DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat(format);
final DateBox dateBox = new DateBox();
dateBox.setFormat(new DateBox.DefaultFormat(dateTimeFormat));
HorizontalPanel horas = new HorizontalPanel();
Label horasLabel = new Label("24 horas");
horasLabel.getElement().addClassName("labelHoras");
horas.add(horaText);
horas.add(horasLabel);
mainPanel.add(labelBox);
mainPanel.add(dateBox);
mainPanel.add(labelBox2);
mainPanel.add(horas);
horaText.clear();
for (int i = 0; i < 24; i++) {
if (i < 10) {
horaText.addItem("0" + i, String.valueOf(i));
} else {
horaText.addItem(String.valueOf(i));
}
}
TextBox aux = dateBox.getTextBox();
aux.addValueChangeHandler(new ValueChangeHandler<String>() {
@Override
public void onValueChange(ValueChangeEvent<String> event) {
if (!(dateBox.getTextBox().getText().isEmpty())) {
String[] fecha = dateBox.getTextBox().getText().split(" ");
Integer dia = new Integer(fecha[2]);
System.out.println(dia);
Document.get().getElementById("dia")
.setPropertyInt("value", dia);
}
}
});
ValueChangeHandler vHandler = new ValueChangeHandler<String>() {
@Override
public void onValueChange(ValueChangeEvent<String> event) {
if (!(dateBox.getTextBox().getText().isEmpty())) {
String[] fecha = dateBox.getTextBox().getText().split(" ");
Integer dia = new Integer(fecha[2]);
System.out.println(dia);
Document.get().getElementById("dia")
.setPropertyInt("value", dia);
Document.get().getElementById("mes")
.setPropertyInt("value", traduceMes(fecha[1]));
}
}
};
dateBox.addValueChangeHandler(vHandler);
horaText.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent event) {