PageRenderTime 16ms CodeModel.GetById 11ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/ftr-gwt-library-date/src/main/java/eu/future/earth/gwt/client/date/horizontal/BaseHorizontalRowPanel.java

http://ftr-gwt-library.googlecode.com/
Java | 66 lines | 35 code | 16 blank | 15 comment | 0 complexity | 37c3e4d6f12d0bb73ef3c4f738cddd29 MD5 | raw file
 1/*
 2 * Copyright 2007 Future Earth, info@future-earth.eu
 3 *
 4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 5 * use this file except in compliance with the License. You may obtain a copy of
 6 * the License at
 7 *
 8 * http://www.apache.org/licenses/LICENSE-2.0
 9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
14 * the License.
15 */
16
17package eu.future.earth.gwt.client.date.horizontal;
18
19import com.google.gwt.user.client.ui.AbsolutePanel;
20import com.google.gwt.user.client.ui.FocusPanel;
21import com.google.gwt.user.client.ui.Widget;
22
23import eu.future.earth.gwt.client.FtrGwtDateCss;
24
25public abstract class BaseHorizontalRowPanel<T, M> extends FocusPanel {
26
27	protected HorizontalDateRenderer<T, M> renderer;
28
29	protected int startHour = 0;
30
31	protected int endHour = 24;
32
33	private ExtendedHorizontalAbsolutePanel<T, M> body = null;
34
35	public BaseHorizontalRowPanel(HorizontalDateRenderer<T, M> newRenderer) {
36		super();
37		this.renderer = newRenderer;
38		body = new ExtendedHorizontalAbsolutePanel<T, M>(this);
39		this.setWidget(body);
40		body.setStyleName(FtrGwtDateCss.DATE_DAY_FULL);
41		startHour = renderer.getStartHour();
42		endHour = renderer.getEndHour();
43
44	}
45
46	public HorizontalDateRenderer<T, M> getRenderer() {
47		return renderer;
48	}
49
50	protected int getDailyIntervals() {
51		return (endHour - startHour) * renderer.getIntervalsPerHour();
52	}
53
54	public boolean removeFromBody(Widget w) {
55		return body.removeNormal(w);
56	}
57
58	public void add(Widget w, int left, int top) {
59		body.addNormal(w, left, top);
60	}
61
62	public AbsolutePanel getBody() {
63		return body;
64	}
65
66}