eu.future.earth.gwt.client.date.week.staend.AbstractDayField Maven / Gradle / Ivy
/*
* 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.week.staend;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.Widget;
import eu.future.earth.gwt.client.FtrGwtDateCss;
import eu.future.earth.gwt.client.date.DateEvent;
import eu.future.earth.gwt.client.date.DateEvent.DateEventActions;
import eu.future.earth.gwt.client.date.TimeEventRendererVertical;
import eu.future.earth.gwt.client.ui.button.FtrLabel;
public abstract class AbstractDayField extends DayField {
protected FtrLabel title;
private final SimplePanel top;
private SimplePanel bottom;
private FtrLabel titleDescription = null;
private FlowPanel tit = new FlowPanel();
public AbstractDayField(TimeEventRendererVertical extends T> renderer, T data) {
super(renderer, data);
title = new FtrLabel();
titleDescription = new FtrLabel();
tit.add(title);
tit.add(titleDescription);
title.setWordWrap(false);
top = new SimplePanel();
top.setWidget(tit);
int topHeight = renderer.getEventTopHeight();
if (topHeight > 0) {
top.setHeight(topHeight + "px");
}
bottom = new SimplePanel();
bottom.setHeight(renderer.getEventBottomHeight() + "px");
// tit.setWidth("100%");
setEventStyleName(FtrGwtDateCss.EVENT_DAY_PANEL, FtrGwtDateCss.EVENT_DAY_HEADER);
}
public void setEventStyleName(String newStyleName, String tileStyle) {
super.setEventStyleName(newStyleName);
top.setStyleName(tileStyle);
top.addStyleName(FtrGwtDateCss.EVENT_DAY_HEADER);
bottom.setStyleName(newStyleName);
tit.setStyleName(tileStyle);
title.setStyleName(tileStyle);
tit.addStyleName(FtrGwtDateCss.EVENT_DAY_HEADER);
title.addStyleName(FtrGwtDateCss.EVENT_DAY_HEADER);
titleDescription.setStyleName(tileStyle);
titleDescription.addStyleName(FtrGwtDateCss.EVENT_DAY_HEADER);
titleDescription.addStyleName("ftrgwtdate-title-description");
}
protected void setBody(Widget body) {
// clickable = getClickableItem();
body.setStyleName(getEventStyleName());
body.addStyleName(FtrGwtDateCss.EVENT_DAY_PANEL);
setWidgetInsizeResize(top, body, bottom);
}
public void setMainColor(String newColor) {
super.setMainColor(newColor);
if (dataWidget != null) {
dataWidget.getElement().getStyle().setBackgroundColor(newColor);
}
bottom.getElement().getStyle().setBackgroundColor(newColor);
}
public void setForeGroundColor(String newColor) {
super.setForeGroundColor(newColor);
if (dataWidget != null) {
dataWidget.getElement().getStyle().setColor(newColor);
}
if (titleDescription != null) {
titleDescription.getElement().getStyle().setColor(newColor);
}
bottom.getElement().getStyle().setColor(newColor);
}
public void setWidth(int width) {
if (width > 0) {
super.setWidth(width + "px");
}
}
public Widget getDraggableItem() {
return title;
}
// private Widget clickable = null;
public void setTitle(String newTitle) {
title.setText(newTitle);
}
public void setTitleDescription(String newTitle) {
title.setTitle(newTitle);
titleDescription.setText(newTitle);
titleDescription.setTitle(newTitle);
}
public void sendEdit() {
DateEvent.fire(this, DateEventActions.EDIT, getValue());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy