eu.future.earth.gwt.client.date.AbstractWholeDayField 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.date;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.InlineHTML;
import com.google.gwt.user.client.ui.Widget;
import eu.future.earth.gwt.client.date.DateEvent.DateEventActions;
public abstract class AbstractWholeDayField extends EventPanel implements HasDateEventHandlers {
private FlowPanel whole = new FlowPanel();
protected InlineHTML title = new InlineHTML();
@SuppressWarnings("unused")
private TimeEventRendererVertical dateRenderer = null;
public AbstractWholeDayField(TimeEventRendererVertical newRenderer, T data) {
super(newRenderer, data);
dateRenderer = newRenderer;
whole.add(title);
super.setWidget(whole);
title.setWordWrap(false);
}
public int getContentHeight() {
return contentHeight;
}
private int contentHeight = 15;
public void setContentHeight(int contentHeight) {
if (contentHeight > 0) {
this.contentHeight = contentHeight;
}
}
public void setWidth(int width) {
if (width > 20) {
title.setWidth(width - 20 + "px");
super.setWidth(width + "px");
}
}
public void setEventStyleName(String newStyleName) {
whole.setStyleName(newStyleName);
whole.addStyleName("wrTop");
}
public Widget getDraggableItem() {
return title;
}
public FlowPanel getPanel() {
return whole;
}
public void setDraggable(boolean newState) {
}
public void sendEdit() {
DateEvent.fire(this, DateEventActions.EDIT, getValue());
}
public HandlerRegistration addDateEventHandler(DateEventListener extends T> handler) {
return addHandler(handler, DateEvent.getType());
}
public void setTextToTitle(String newTitle) {
title.setText(newTitle);
}
public void setTitleToTitle(String newTitle) {
title.setTitle(newTitle);
}
}