eu.future.earth.gwt.client.date.WeekLabels Maven / Gradle / Ivy
The newest version!
package eu.future.earth.gwt.client.date;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.user.client.ui.DockLayoutPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.ResizeComposite;
import eu.future.earth.gwt.client.FtrGwtDateCss;
import eu.future.earth.gwt.client.date.week.DayHeader;
import eu.future.earth.gwt.client.date.week.staend.HourPanel;
public class WeekLabels extends ResizeComposite {
private DockLayoutPanel main_labels = new DockLayoutPanel(Unit.PX);
private DockLayoutPanel main_header_labels_days = new DockLayoutPanel(Unit.PCT);
public WeekLabels() {
super();
initWidget(main_labels);
main_labels.setStyleName(FtrGwtDateCss.WEEK_HEADER);
main_labels.addStyleName(FtrGwtDateCss.HEADER);
}
public void init(HourPanel hour) {
main_labels.clear();
if (hour != null) {
main_labels.addWest(new HTML(" "), hour.getPrefferedWitdhInt());
}
main_labels.addEast(new HTML(" "), 16);
main_labels.add(main_header_labels_days);
main_header_labels_days.clear();
}
public void addColumn(DayHeader label, int i, int daysShown, double colWideProcent) {
if (i == (daysShown - 1)) {
main_header_labels_days.add(label);
} else {
main_header_labels_days.addWest(label, colWideProcent);
}
}
}