
eu.future.earth.gwt.client.DateBox Maven / Gradle / Ivy
The newest version!
/*
* Copyright 2007 Future Earth, [email protected]
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package eu.future.earth.gwt.client;
import java.util.Date;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.event.logical.shared.HasValueChangeHandlers;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.event.logical.shared.ValueChangeHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.Composite;
import eu.future.earth.client.date.DateNoTimeZone;
public class DateBox extends Composite implements KeyUpHandler, HasValueChangeHandlers, HasClickHandlers, ClickHandler {
private DateBoxInternal edit = null;
public DateBox() {
this(null);
}
public DateBox(String format) {
super();
edit = new DateBoxInternal(format);
initWidget(edit);
edit.addKeyUpHandler(this);
edit.addClickHandler(this);
}
@Override
public void addStyleName(String style) {
edit.addStyleName(style);
}
@Override
public String getStyleName() {
return edit.getStyleName();
}
@Override
public void setStyleName(String style) {
edit.setStyleName(style);
}
@Override
public void setStylePrimaryName(String style) {
edit.setStylePrimaryName(style);
}
public void setEnabled(boolean newState) {
edit.setEnabled(newState);
}
public void setValue(Date newValue) {
edit.setDate(newValue);
}
public void setValueNoTimeZone(DateNoTimeZone newValue) {
edit.setDate(newValue);
}
public Date getValue() {
return edit.getDate();
}
public String getFormat() {
return edit.getFormat();
}
public void setFormat(String format) {
edit.setFormat(format);
}
@Override
public void onKeyUp(KeyUpEvent event) {
ValueChangeEvent.fire(this, edit.getDate());
}
@Override
public HandlerRegistration addValueChangeHandler(ValueChangeHandler handler) {
return addHandler(handler, ValueChangeEvent.getType());
}
@Override
public HandlerRegistration addClickHandler(ClickHandler handler) {
return super.addHandler(handler, ClickEvent.getType());
}
@Override
public void onClick(ClickEvent event) {
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy