*/
public class EventPreviewRenderer extends RendererBase {
@Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
EventPreview eventPreview = (EventPreview) component;
String clientId = eventPreview.getClientId(context);
ResponseWriter writer = context.getResponseWriter();
writer.startElement("div", eventPreview);
writer.writeAttribute("id", clientId, null);
PopupLayer popupLayer = Components.getOrCreateFacet(
context, component, PopupLayer.COMPONENT_TYPE, "_popupLayer", PopupLayer.class);
popupLayer.setId(eventPreview.getId() + Rendering.SERVER_ID_SUFFIX_SEPARATOR + "popupLayer");
popupLayer.setStyle(eventPreview.getStyle());
popupLayer.setStyleClass(eventPreview.getStyleClass());
popupLayer.setHideOnOuterClick(true);
popupLayer.encodeAll(context);
OUIComponent timetableView = (OUIComponent) eventPreview.getParent();
String componentJs;
if (timetableView instanceof MonthTable) {
componentJs = "timetable/monthTable.js";
} else if (timetableView instanceof WeekTable) {
componentJs = "timetable/weekTable.js";
} else {
componentJs = "timetable/dayTable.js";
}
Rendering.renderInitScript(context,
new ScriptBuilder().initScript(context, eventPreview, "O$.Timetable._initEventPreview",
timetableView,
eventPreview.getShowingDelay(),
Styles.getCSSClass(context, eventPreview, eventPreview.getStyle(), StyleGroup.regularStyleGroup(), eventPreview.getStyleClass(), "o_eventPreview"),
Styles.getCSSClass(context, eventPreview, eventPreview.getEventNameStyle(), StyleGroup.regularStyleGroup(), eventPreview.getEventNameClass()),
Styles.getCSSClass(context, eventPreview, eventPreview.getEventDescriptionStyle(), eventPreview.getEventDescriptionClass()),
eventPreview.getHorizontalAlignment(),
eventPreview.getVerticalAlignment(),
eventPreview.getHorizontalDistance(),
eventPreview.getVerticalDistance()),
Resources.utilJsURL(context),
Resources.internalURL(context, "timetable/rangeMap.js"),
Resources.internalURL(context, "timetable/timetable.js"),
Resources.internalURL(context, componentJs));