Author: amarkhel
Date: 2010-10-29 10:50:18 -0400 (Fri, 29 Oct 2010)
New Revision: 19775
Removed:
trunk/ui/calendar/api/src/main/java/org/richfaces/event/
trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarIcon.java
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarSeparator.java
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/DisabledCalendarIcon.java
trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/
trunk/ui/calendar/ui/src/main/java/org/richfaces/utils/
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/JQuerySpinBtn.js
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar-utils.js
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.ecss
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/jquery.effects.core.js
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/jquery.effects.highlight.js
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/json-dom.js
trunk/ui/calendar/ui/src/main/templates/calendar.template.xml
Log:
Deleted: trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
===================================================================
---
trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-10-29
14:48:32 UTC (rev 19774)
+++
trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-10-29
14:50:18 UTC (rev 19775)
@@ -1,351 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.component;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.Locale;
-import java.util.TimeZone;
-
-import javax.el.ELContext;
-import javax.el.ValueExpression;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIInput;
-import javax.faces.component.UIViewRoot;
-import javax.faces.context.FacesContext;
-import javax.faces.convert.DateTimeConverter;
-import javax.faces.event.AbortProcessingException;
-import javax.faces.event.FacesEvent;
-import javax.faces.event.PhaseId;
-
-import org.richfaces.cdk.annotations.Attribute;
-import org.richfaces.cdk.annotations.EventName;
-import org.richfaces.cdk.annotations.JsfComponent;
-import org.richfaces.cdk.annotations.JsfRenderer;
-import org.richfaces.cdk.annotations.Tag;
-import org.richfaces.log.Logger;
-import org.richfaces.log.RichfacesLogger;
-import org.richfaces.utils.CalendarHelper;
-
-import org.richfaces.event.CurrentDateChangeEvent;
-import org.richfaces.event.CurrentDateChangeListener;
-
-
-/**
- * @author amarkhel
- *
- */
-
-@JsfComponent(type = AbstractCalendar.COMPONENT_TYPE, family =
AbstractCalendar.COMPONENT_FAMILY, generate =
"org.richfaces.component.UICalendar", renderer = @JsfRenderer(type =
"org.richfaces.CalendarRenderer"), tag = @Tag(name = "calendar"))
-public abstract class AbstractCalendar extends UIInput {
-
- public static final String COMPONENT_TYPE = "org.richfaces.Calendar";
-
- public static final String COMPONENT_FAMILY = "org.richfaces.Calendar";
-
- public static final String SUB_TIME_PATTERN =
"\\s*[hHkKma]+[\\W&&\\S]+[hHkKma]+\\s*";
-
- public static final String TIME_PATTERN = "HH:mm";
-
- public static final String DEFAULT_DATE_PATTERN = "MMM d, yyyy";
-
- Logger log = RichfacesLogger.COMPONENTS.getLogger();
-
- protected enum PropertyKeys {
- locale
- };
-
-
- @Attribute(defaultValue = "MMM d, yyyy")
- public abstract String getDatePattern();
-
- @Attribute(defaultValue = "TimeZone.getDefault()")
- public abstract TimeZone getTimeZone();
-
- @Attribute(defaultValue = "Integer.MIN_VALUE")
- public abstract int getFirstWeekDay();
-
- @Attribute(defaultValue = "Integer.MIN_VALUE")
- public abstract int getMinDaysInFirstWeek();
-
- @Attribute(defaultValue = "select")
- public abstract String getTodayControlMode();
-
- @Attribute(defaultValue = "true")
- public abstract boolean isShowWeekDaysBar();
-
- @Attribute(defaultValue = "true")
- public abstract boolean isShowWeeksBar();
-
- @Attribute(defaultValue = "true")
- public abstract boolean isShowFooter();
-
- @Attribute(defaultValue = "true")
- public abstract boolean isShowHeader();
-
- @Attribute(defaultValue = "true")
- public abstract boolean isShowInput();
-
- @Attribute(defaultValue = "true")
- public abstract boolean isPopup();
-
- @Attribute(defaultValue = "true")
- public abstract String getHidePopupOnScroll();
-
- @Attribute(defaultValue = "false")
- public abstract boolean isDisable();
-
- @Attribute(defaultValue = "false")
- public abstract boolean isEnableManualInput();
-
- @Attribute(defaultValue = "false")
- public abstract boolean isDayEnabled();
-
- @Attribute(defaultValue = "false")
- public abstract boolean isShowApplyButton();
-
- @Attribute(defaultValue = "false")
- public abstract boolean isResetTimeOnDateSelect();
-
- @Attribute(defaultValue = "AA")
- public abstract String getJointPoint();
-
- @Attribute(defaultValue = "AA")
- public abstract String getDirection();
-
- @Attribute(defaultValue = "inactive")
- public abstract String getBoundaryDatesMode();
-
- @Attribute(defaultValue = "0")
- public abstract String getHorizontalOffset();
-
- @Attribute(defaultValue = "0")
- public abstract String getVerticalOffsetOffset();
-
- @Attribute(defaultValue = "3")
- public abstract int getZindex();
-
- @Attribute
- public abstract String getStyle();
-
- @Attribute
- public abstract Object getMonthLabels();
-
- @Attribute
- public abstract Object getMonthLabelsShort();
-
- @Attribute
- public abstract Object getWeekDayLabelsShort();
-
- @Attribute
- public abstract Object getWeekDayLabels();
-
- @Attribute
- public abstract String getDayStyleClass();
-
- @Attribute
- public abstract String getTabindex();
-
- @Attribute
- public abstract String getInputStyle();
-
- @Attribute
- public abstract String getButtonClass();
-
- @Attribute
- public abstract String getInputClass();
-
- @Attribute
- public abstract String getButtonLabel();
-
- @Attribute
- public abstract String getInputSize();
-
- @Attribute
- public abstract Object getCurrentDate();
-
- public abstract void setCurrentDate(Object date);
-
- @Attribute
- public abstract String getButtonIcon();
-
- @Attribute
- public abstract String getButtonIconDisabled();
-
- @Attribute
- public abstract Object getDefaultTime();
-
- @Attribute(events = @EventName("inputclick"))
- public abstract String getOninputclick();
-
- @Attribute(events = @EventName("inputdblclick"))
- public abstract String getOninputdblclick();
-
- @Attribute(events = @EventName("inputchange"))
- public abstract String getOninputchange();
-
- @Attribute(events = @EventName("inputselect"))
- public abstract String getOninputselect();
-
- @Attribute(events = @EventName("inputmousedown"))
- public abstract String getOninputmousedown();
-
- @Attribute(events = @EventName("inputmousemove"))
- public abstract String getOninputmousemove();
-
- @Attribute(events = @EventName("inputmouseout"))
- public abstract String getOninputmouseout();
-
- @Attribute(events = @EventName("inputmouseover"))
- public abstract String getOninputmouseover();
-
- @Attribute(events = @EventName("inputmouseup"))
- public abstract String getOninputmouseup();
-
- @Attribute(events = @EventName("inputkeydown"))
- public abstract String getOninputkeydown();
-
- @Attribute(events = @EventName("inputkeypress"))
- public abstract String getOninputkeypress();
-
- @Attribute(events = @EventName("inputkeyup"))
- public abstract String getOninputkeypup();
-
- @Attribute(events = @EventName("inputfocus"))
- public abstract String getOninputfocus();
-
- @Attribute(events = @EventName("inputblur"))
- public abstract String getOninputblur();
-
- @Attribute
- public Object getLocale() {
- Object locale = getStateHelper().eval(PropertyKeys.locale);
- if (locale == null) {
- FacesContext facesContext = getFacesContext();
- UIViewRoot viewRoot = facesContext.getViewRoot();
- if (viewRoot != null) {
- locale = viewRoot.getLocale();
- }
- }
- return locale != null ? locale : Locale.US;
- }
-
- public void setLocale(Object locale) {
- getStateHelper().put(PropertyKeys.locale, locale);
- }
-
- public void updateCurrentDate(FacesContext facesContext, Object currentDate) {
- if (facesContext == null) {
- throw new NullPointerException();
- }
- // RF-1073
- try {
- ValueExpression ve = getValueExpression("currentDate");
- if (ve != null) {
- ELContext elContext = facesContext.getELContext();
- if (ve.getType(elContext).equals(String.class)) {
- DateTimeConverter convert = new DateTimeConverter();
- convert.setLocale(CalendarHelper.getAsLocale(facesContext, this,
getLocale()));
- convert.setPattern(getDatePattern());
- ve.setValue(facesContext.getELContext(),
convert.getAsString(facesContext, this, currentDate));
- return;
- } else if (ve.getType(elContext).equals(Calendar.class)) {
- Calendar c = Calendar.getInstance();
- c.setTime((Date) currentDate);
- ve.setValue(elContext, c);
- return;
- } else {
- ve.setValue(elContext, currentDate);
- return;
- }
- } else {
- setCurrentDate(currentDate);
- }
-
- } catch (Exception e) {
- setValid(false);
- if (log.isDebugEnabled()) {
- log.debug(" updateCurrentDate method throws exception: " +
e.toString(), e);
- }
-
- String messageString = e.toString();
- FacesMessage message = new FacesMessage(messageString);
- message.setSeverity(FacesMessage.SEVERITY_ERROR);
- facesContext.addMessage(getClientId(facesContext), message);
- }
- }
-
- public void addCurrentDateChangeListener(CurrentDateChangeListener listener) {
- addFacesListener(listener);
- }
-
- public void removeToggleListener(CurrentDateChangeListener listener) {
- removeFacesListener(listener);
- }
-
- public CurrentDateChangeListener[] getCurrentDateChangeListeners() {
- return (CurrentDateChangeListener[])
getFacesListeners(CurrentDateChangeListener.class);
- }
-
- public void broadcast(FacesEvent event) throws AbortProcessingException {
- if (event instanceof CurrentDateChangeEvent) {
- FacesContext facesContext = getFacesContext();
- CurrentDateChangeEvent currentDateChangeEvent = (CurrentDateChangeEvent)
event;
- String currentDateString = currentDateChangeEvent.getCurrentDateString();
-
- try {
- // we should use datePattern attribute-based converter only for
- // selectedDate
- // current date string always has predefined format: m/y
- Date currentDate = CalendarHelper.getAsDate(facesContext, this,
getCurrentDate());
- Date submittedCurrentDate =
CalendarHelper.convertCurrentDate(currentDateString);
- currentDateChangeEvent.setCurrentDate(submittedCurrentDate);
-
- if (!submittedCurrentDate.equals(currentDate)) {
- updateCurrentDate(facesContext, submittedCurrentDate);
- }
-
- } catch (Exception e) {
- if (log.isDebugEnabled()) {
- log.debug(" currentDate convertion fails with following
exception: " + e.toString(), e);
- }
- setValid(false);
- String messageString = e.toString();
- FacesMessage message = new FacesMessage(messageString);
- message.setSeverity(FacesMessage.SEVERITY_ERROR);
- facesContext.addMessage(getClientId(facesContext), message);
- facesContext.renderResponse();
- }
- } else {
- super.broadcast(event);
- }
- }
-
- @Override
- public void queueEvent(FacesEvent event) {
- super.queueEvent(event);
- if (event instanceof CurrentDateChangeEvent) {
- event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
- }
- }
-}
Deleted:
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
---
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2010-10-29
14:48:32 UTC (rev 19774)
+++
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2010-10-29
14:50:18 UTC (rev 19775)
@@ -1,609 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.renderkit;
-
-import java.io.IOException;
-import java.text.DateFormatSymbols;
-import java.text.Format;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-import java.util.TimeZone;
-
-import javax.faces.application.ResourceDependencies;
-import javax.faces.application.ResourceDependency;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.context.ResponseWriter;
-import javax.faces.convert.Converter;
-import javax.faces.convert.ConverterException;
-import javax.faces.convert.DateTimeConverter;
-
-import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.javascript.JSReference;
-import org.richfaces.component.AbstractCalendar;
-import org.richfaces.component.util.HtmlUtil;
-import org.richfaces.component.util.MessageUtil;
-import org.richfaces.component.util.SelectUtils;
-import org.richfaces.component.util.ViewUtil;
-import org.richfaces.event.CurrentDateChangeEvent;
-import org.richfaces.utils.CalendarHelper;
-
-/**
- * @author amarkhel
- *
- */
-
-@ResourceDependencies({ @ResourceDependency(library = "javax.faces", name =
"jsf.js"),
- @ResourceDependency(name = "jquery.js"),
- @ResourceDependency(name = "jquery.position.js"),
- @ResourceDependency(name = "richfaces.js"),
- @ResourceDependency(name = "richfaces-base-component.js"),
- @ResourceDependency(name = "richfaces-event.js"),
- @ResourceDependency(library = "org.richfaces", name =
"json-dom.js"),
- @ResourceDependency(library = "org.richfaces", name =
"jquery.effects.core.js"),
- @ResourceDependency(library = "org.richfaces", name =
"jquery.effects.highlight.js"),
- @ResourceDependency(library = "org.richfaces", name =
"JQuerySpinBtn.js.js"),
- @ResourceDependency(library = "org.richfaces", name =
"calendar-utils.js"),
- @ResourceDependency(library = "org.richfaces", name =
"calendar.js"),
- @ResourceDependency(library = "org.richfaces", name =
"calendar.ecss") })
-public class CalendarRendererBase extends InputRendererBase {
-
- public static final String CALENDAR_BUNDLE =
"org.richfaces.renderkit.calendar";
-
- public static final String OPTION_ENABLE_MANUAL_INPUT =
"enableManualInput";
-
- public static final String OPTION_DISABLED = "disabled";
-
- public static final String OPTION_READONLY = "readonly";
-
- public static final String OPTION_RESET_TIME_ON_DATE_SELECT =
"resetTimeOnDateSelect";
-
- public static final String OPTION_SHOW_APPLY_BUTTON = "showApplyButton";
-
- public static final String OPTION_MIN_DAYS_IN_FIRST_WEEK =
"minDaysInFirstWeek";
-
- public static final String OPTION_POPUP = "popup";
-
- public static final String OPTION_SHOW_INPUT = "showInput";
-
- public static final String OPTION_SHOW_HEADER = "showHeader";
-
- public static final String OPTION_SHOW_FOOTER = "showFooter";
-
- public static final String OPTION_SHOW_WEEKS_BAR = "showWeeksBar";
-
- public static final String OPTION_TODAY_CONTROL_MODE = "todayControlMode";
-
- public static final String OPTION_DATE_PATTERN = "datePattern";
-
- public static final String OPTION_JOINT_POINT = "jointPoint";
-
- public static final String OPTION_DIRECTION = "direction";
-
- public static final String OPTION_BOUNDARY_DATES_MODE =
"boundaryDatesMode";
-
- public static final String OPTION_HORIZONTAL_OFFSET = "horizontalOffset";
-
- public static final String OPTION_VERTICAL_OFFSET = "verticalOffset";
-
- public static final String OPTION_CURRENT_DATE = "currentDate";
-
- public static final String OPTION_SELECTED_DATE = "selectedDate";
-
- public static final String OPTION_DAY_CELL_CLASS = "dayCellClass";
-
- public static final String OPTION_DAY_STYLE_CLASS = "dayStyleClass";
-
- public static final String OPTION_LABELS = "labels";
-
- public static final String OPTION_DEFAULT_TIME = "defaultTime";
-
- public static final String OPTION_HIDE_POPUP_ON_SCROLL =
"hidePopupOnScroll";
-
- public static final String OPTION_SHOW_WEEK_DAYS_BAR = "showWeekDaysBar";
-
- public static final String MONTH_LABELS_SHORT = "monthLabelsShort";
-
- public static final String MONTH_LABELS = "monthLabels";
-
- public static final String WEEK_DAY_LABELS_SHORT = "weekDayLabelsShort";
-
- public static final String WEEK_DAY_LABELS = "weekDayLabels";
-
- public static final String FIRST_DAY_WEEK = "firstWeekDay";
-
- public static final String MIN_DAYS_IN_FIRST_WEEK = "minDaysInFirstWeek";
-
- public static final String CALENDAR_ICON_RESOURCE_NAME =
"calendarIcon.png";
-
- public static final String CALENDAR_DISABLE_ICON_RESOURCE_NAME =
"disabledCalendarIcon.png";
-
- public static final String CURRENT_DATE_INPUT = "InputCurrentDate";
-
-
-
-
-
- protected static final Map<String, ComponentAttribute>
CALENDAR_INPUT_HANDLER_ATTRIBUTES =
Collections.unmodifiableMap(ComponentAttribute.createMap(
- new ComponentAttribute(HtmlConstants.ONCLICK_ATTRIBUTE)
- .setEventNames("inputclick")
- .setComponentAttributeName("oninputclick"),
- new ComponentAttribute(HtmlConstants.ONDBLCLICK_ATTRIBUTE)
- .setEventNames("inputdblclick")
- .setComponentAttributeName("oninputdblclick"),
- new ComponentAttribute(HtmlConstants.ONMOUSEDOWN_ATTRIBUTE)
- .setEventNames("inputmousedown")
- .setComponentAttributeName("oninputmousedown"),
- new ComponentAttribute(HtmlConstants.ONMOUSEUP_ATTRIBUTE)
- .setEventNames("inputmouseup")
- .setComponentAttributeName("oninputmouseup"),
- new ComponentAttribute(HtmlConstants.ONMOUSEOVER_ATTRIBUTE)
- .setEventNames("inputmouseover")
- .setComponentAttributeName("oninputmouseover"),
- new ComponentAttribute(HtmlConstants.ONMOUSEMOVE_ATTRIBUTE)
- .setEventNames("inputmousemove")
- .setComponentAttributeName("oninputmousemove"),
- new ComponentAttribute(HtmlConstants.ONMOUSEOUT_ATTRIBUTE)
- .setEventNames("inputmouseout")
- .setComponentAttributeName("oninputmouseout"),
- new ComponentAttribute(HtmlConstants.ONKEYPRESS_ATTRIBUTE)
- .setEventNames("inputkeypress")
- .setComponentAttributeName("oninputkeypress"),
- new ComponentAttribute(HtmlConstants.ONKEYDOWN_ATTRIBUTE)
- .setEventNames("inputkeydown")
- .setComponentAttributeName("oninputkeydown"),
- new ComponentAttribute(HtmlConstants.ONKEYUP_ATTRIBUTE)
- .setEventNames("inputkeyup")
- .setComponentAttributeName("oninputkeyup"),
- new ComponentAttribute(HtmlConstants.ONBLUR_ATTRIBUTE)
- .setEventNames("inputblur")
- .setComponentAttributeName("oninputblur"),
- new ComponentAttribute(HtmlConstants.ONFOCUS_ATTRIBUTE)
- .setEventNames("inputfocus")
- .setComponentAttributeName("oninputfocus"),
- new ComponentAttribute(HtmlConstants.ONCHANGE_ATTRIBUTE)
- .setEventNames("inputchange")
- .setComponentAttributeName("oninputchange"),
- new ComponentAttribute(HtmlConstants.ONSELECT_ATTRIBUTE)
- .setEventNames("inputselect")
- .setComponentAttributeName("oninputselect")));
-
- private static final String HOURS_VALUE = "hours";
-
- private static final String MINUTES_VALUE = "minutes";
-
- protected void doDecode(FacesContext context, UIComponent component) {
- if(!(component instanceof AbstractCalendar)) {
- return;
- }
-
- AbstractCalendar calendar = (AbstractCalendar)component;
- if (calendar.isDisable()){
- return;
- }
-
- Map<String, String> requestParameterMap =
context.getExternalContext().getRequestParameterMap();
-
- String clientId = calendar.getClientId(context);
- String currentDateString = (String) requestParameterMap.get(clientId +
CURRENT_DATE_INPUT);
- if (currentDateString != null) {
- calendar.queueEvent(new CurrentDateChangeEvent(calendar,
currentDateString));
- }
-
- String selectedDateString = (String) requestParameterMap.get(clientId +
"InputDate");
- if (selectedDateString != null) {
- calendar.setSubmittedValue(selectedDateString);
- }
- }
-
- public void renderInputHandlers(FacesContext facesContext, UIComponent component)
throws IOException {
- RenderKitUtils.renderPassThroughAttributesOptimized(facesContext, component,
CALENDAR_INPUT_HANDLER_ATTRIBUTES);
- }
-
- @Override
- public Object getConvertedValue(FacesContext facesContext, UIComponent component,
Object submittedValue) throws ConverterException {
- if ((facesContext == null) || (component == null)) {
- throw new NullPointerException();
- }
-
- // skip conversion of already converted date
- if (submittedValue instanceof Date) {
- return (Date)submittedValue;
- }
-
- // Store submitted value in the local variable as a string
- String newValue = (String) submittedValue;
- // if we have no local value, try to get the valueExpression.
- AbstractCalendar calendar = (AbstractCalendar) component;
- Converter converter = SelectUtils.getConverterForProperty(facesContext, calendar,
"value");
-
- // in case the converter hasn't been set, try to use default
- // DateTimeConverter
- if (converter == null) {
- converter = createDefaultConverter();
- }
- setupConverter(facesContext, converter, calendar);
- return converter.getAsObject(facesContext, component, newValue);
- }
-
- @Override
- public String getInputValue(FacesContext facesContext, UIComponent component) {
- if(!(component instanceof AbstractCalendar)) {
- return null;
- }
-
- AbstractCalendar calendar = (AbstractCalendar) component;
- String value = (String) calendar.getSubmittedValue();
- if (value == null) {
- Object curVal = calendar.getValue();
- Converter converter = SelectUtils.getConverterForProperty(facesContext,
calendar, "value");
-
- if(converter == null) {
- converter = createDefaultConverter();
- setupConverter(facesContext, converter, calendar);
- }
-
- if (converter != null) {
- value = converter.getAsString(facesContext, calendar, curVal);
- } else {
- value = curVal !=null ? curVal.toString() : "";
- }
- }
-
- if (value == null) {
- value = "";
- }
-
- return value;
-
- }
-
- public String getButtonIcon(FacesContext facesContext, UIComponent component) {
- boolean disable = (Boolean)component.getAttributes().get("disable");
- String buttonIcon =
(String)component.getAttributes().get("buttonIcon");
- if(disable) {
- buttonIcon =
(String)component.getAttributes().get("buttonIconDisabled");
- }
-
- if(buttonIcon != null && buttonIcon.trim().length() != 0) {
- buttonIcon = ViewUtil.getResourceURL(buttonIcon, facesContext);
- } else {
- buttonIcon = disable ? CALENDAR_ICON_RESOURCE_NAME:
CALENDAR_ICON_RESOURCE_NAME;
- buttonIcon = RenderKitUtils.getResourcePath(facesContext,
"org.richfaces.images",buttonIcon);
- }
-
- return buttonIcon;
- }
-
- public Object getSelectedDate(FacesContext facesContext, UIComponent component)
throws IOException {
- Object returnValue = null;
- AbstractCalendar calendar = (AbstractCalendar)component;
- if(calendar.isValid()) {
- Date date;
- Object value = calendar.getValue();
- date = CalendarHelper.getAsDate(facesContext, calendar, value);
- if(date != null) {
- returnValue = formatSelectedDate(calendar.getTimeZone(), date);
- }
- }
- return returnValue;
- }
-
- public static Object formatSelectedDate(TimeZone timeZone, Date date) {
- Calendar calendar = Calendar.getInstance();
- calendar.setTimeZone(timeZone);
- calendar.setTime(date);
-
- JSFunction result = new JSFunction("new Date");
- result.addParameter(Integer.valueOf(calendar.get(Calendar.YEAR)));
- result.addParameter(Integer.valueOf(calendar.get(Calendar.MONTH)));
- result.addParameter(Integer.valueOf(calendar.get(Calendar.DATE)));
- result.addParameter(Integer.valueOf(calendar.get(Calendar.HOUR_OF_DAY)));
- result.addParameter(Integer.valueOf(calendar.get(Calendar.MINUTE)));
- result.addParameter(new Integer(0));
-
- return result;
- }
-
- public Object getCurrentDate(FacesContext facesContext, AbstractCalendar calendar)
throws IOException {
- Date date = CalendarHelper.getCurrentDateOrDefault(facesContext, calendar);
- return formatDate(date);
- }
-
- public String getCurrentDateAsString(FacesContext facesContext, UIComponent
component) throws IOException {
- AbstractCalendar calendar = (AbstractCalendar)component;
- Format formatter = new SimpleDateFormat("MM/yyyy");
-
- Date currentDate = CalendarHelper.getCurrentDateOrDefault(facesContext,
calendar);
- return formatter.format(currentDate);
- }
-
- public static Object formatDate(Date date) {
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(date);
- JSFunction result = new JSFunction("new Date");
- result.addParameter(Integer.valueOf(calendar.get(Calendar.YEAR)));
- result.addParameter(Integer.valueOf(calendar.get(Calendar.MONTH)));
- result.addParameter(Integer.valueOf(calendar.get(Calendar.DATE)));
-
- return result;
- }
-
- public String getDayCellClass(FacesContext facesContext, AbstractCalendar calendar)
{
- //TODO: refactor this
- /*
- String cellwidth = (String)
component.getAttributes().get("cellWidth");
- String cellheight = (String)
component.getAttributes().get("cellHeight");
- if (cellwidth != null && cellwidth.length() != 0 || cellheight != null
- && cellheight.length() != 0) {
- String clientId = component.getClientId(context);
- String value = clientId.replace(':', '_') +
"DayCell";
- return value;
- }
- */
- return null;
- }
-
- public JSReference getIsDayEnabled(FacesContext facesContext, AbstractCalendar
calendar) {
- return calendar.isDayEnabled() ? JSReference.TRUE : JSReference.FALSE;
- }
-
- public JSReference getDayStyleClass(FacesContext context, AbstractCalendar calendar)
{
- String dayStyleClass = calendar.getDayStyleClass();
- return ((dayStyleClass != null && dayStyleClass.trim().length() != 0)) ?
new JSReference(dayStyleClass) : null;
- }
-
-
- public Map<String, Object> getLabels(FacesContext facesContext,
AbstractCalendar calendar) {
- ResourceBundle bundle1 = null;
- ResourceBundle bundle2 = null;
-
- ClassLoader loader = Thread.currentThread().getContextClassLoader();
-
- String messageBundle = facesContext.getApplication().getMessageBundle();
- Locale locale = CalendarHelper.getAsLocale(facesContext, calendar);
- if (null != messageBundle) {
- bundle1 = ResourceBundle.getBundle(messageBundle,locale , loader);
- }
-
- try {
- bundle2 = ResourceBundle.getBundle(CALENDAR_BUNDLE, locale, loader);
- } catch (MissingResourceException e) {
- //No external bundle was found, ignore this exception.
- }
-
- ResourceBundle [] bundles = {bundle1, bundle2};
- String[] names = {"apply", "today", "clean",
"cancel", "ok", "close"};
-
- return getCollectedLabels(bundles, names);
- }
-
- protected Map<String, Object> getCollectedLabels(ResourceBundle [] bundles ,
String[] names) {
- Map<String, Object> labels = new HashMap<String, Object>();
- if(bundles != null && names != null) {
- for (String name: names) {
- String label = null;
- String bundleKey = "RICH_CALENDAR_" + name.toUpperCase() +
"_LABEL";
- for(ResourceBundle bundle: bundles) {
- if (bundle != null) {
- try {
- label = bundle.getString(bundleKey);
- } catch (MissingResourceException mre) {
- // Current key was not found, ignore this exception;
- }
- }
- if(label != null) {
- break;
- }
- }
- RenderKitUtils.addToScriptHash(labels, name, label);
- }
- }
- return labels;
- }
-
- public Map<String, Object> getPreparedDefaultTime(FacesContext facesContext,
AbstractCalendar abstractCalendar) {
- Date date = CalendarHelper.getFormattedDefaultTime(abstractCalendar);
- Map<String, Object> result = new HashMap<String, Object>();
- if (date != null) {
- Calendar calendar = CalendarHelper.getCalendar(facesContext,
abstractCalendar);
- calendar.setTime(date);
- int hours = calendar.get(Calendar.HOUR_OF_DAY);
- int minutes = calendar.get(Calendar.MINUTE);
-
- if (hours != 12 || minutes != 0) {
- result.put(HOURS_VALUE, hours);
- result.put(MINUTES_VALUE, minutes);
- }
- }
- return result;
- }
-
- private static String[] shiftDates(int minimum, int maximum, String[] labels) {
- if (minimum == 0 && (maximum - minimum == labels.length - 1)) {
- return labels;
- }
-
- String[] shiftedLabels = new String[maximum - minimum + 1];
- System.arraycopy(labels, minimum, shiftedLabels, 0, maximum - minimum
- + 1);
-
- return shiftedLabels;
- }
-
- protected Map<String, Object> getLocaleOptions(FacesContext facesContext,
AbstractCalendar calendarComponent) {
- Map<String, Object> map = new HashMap<String, Object>();
-
- Locale locale = CalendarHelper.getAsLocale(facesContext, calendarComponent);
- DateFormatSymbols dateFormat = new DateFormatSymbols(locale);
-
- Calendar calendar = CalendarHelper.getCalendar(facesContext, calendarComponent);
- int maximum = calendar.getActualMaximum(Calendar.DAY_OF_WEEK);
- int minimum = calendar.getActualMinimum(Calendar.DAY_OF_WEEK);
-
- int monthMax = calendar.getActualMaximum(Calendar.MONTH);
- int monthMin = calendar.getActualMinimum(Calendar.MONTH);
-
- String [] weekDayLabels =
RenderKitUtils.asArray(calendarComponent.getWeekDayLabels());
- if(weekDayLabels == null) {
- weekDayLabels = dateFormat.getWeekdays();
- weekDayLabels = shiftDates(minimum, maximum, weekDayLabels);
- }
- RenderKitUtils.addToScriptHash(map, WEEK_DAY_LABELS, weekDayLabels);
-
- String [] weekDayLabelsShort =
RenderKitUtils.asArray(calendarComponent.getWeekDayLabelsShort());
- if(weekDayLabelsShort == null) {
- weekDayLabelsShort = dateFormat.getShortWeekdays();
- weekDayLabelsShort = shiftDates(minimum, maximum, weekDayLabelsShort);
- }
- RenderKitUtils.addToScriptHash(map, WEEK_DAY_LABELS_SHORT, weekDayLabelsShort);
-
- String [] monthLabels =
RenderKitUtils.asArray(calendarComponent.getMonthLabels());
- if(monthLabels == null) {
- monthLabels = dateFormat.getMonths();
- monthLabels = shiftDates(monthMin, monthMax, monthLabels);
- }
- RenderKitUtils.addToScriptHash(map, MONTH_LABELS, monthLabels);
-
-
- String [] monthLabelsShort =
RenderKitUtils.asArray(calendarComponent.getMonthLabelsShort());
- if(monthLabelsShort == null) {
- monthLabelsShort = dateFormat.getShortMonths();
- monthLabelsShort = shiftDates(monthMin, monthMax, monthLabelsShort);
- }
- RenderKitUtils.addToScriptHash(map, MONTH_LABELS_SHORT, monthLabelsShort);
-
- int minDaysInFirstWeek = calendarComponent.getMinDaysInFirstWeek();
- if(minDaysInFirstWeek == Integer.MIN_VALUE) {
- minDaysInFirstWeek = calendar.getMinimalDaysInFirstWeek();
- }
-
- if (0 <= minDaysInFirstWeek && minDaysInFirstWeek <= 7) {
- RenderKitUtils.addToScriptHash(map, MIN_DAYS_IN_FIRST_WEEK,
minDaysInFirstWeek);
- }
-
- int day = calendarComponent.getFirstWeekDay();
- if(day == Integer.MIN_VALUE) {
- day = calendar.getFirstDayOfWeek();
- day = calendar.getFirstDayOfWeek() -
calendar.getActualMinimum(Calendar.DAY_OF_WEEK);
- }
-
- if (0 <= day && day <= 6) {
- RenderKitUtils.addToScriptHash(map, FIRST_DAY_WEEK, day);
- } else if (day != Integer.MIN_VALUE) {
- facesContext.getExternalContext().log(day + " value of firstWeekDay
attribute is not a legal one for component: " + MessageUtil.getLabel(facesContext,
calendarComponent) + ". Default value was applied.");
- }
-
- return map;
- }
-
- public ScriptOptions createCalendarScriptOption(FacesContext facesContext,
UIComponent component) throws IOException {
- AbstractCalendar calendar = (AbstractCalendar)component;
- ScriptOptions scriptOptions = new ScriptOptions(component);
- scriptOptions.addOption(OPTION_ENABLE_MANUAL_INPUT);
- scriptOptions.addOption(OPTION_DISABLED);
- scriptOptions.addOption(OPTION_READONLY);
- scriptOptions.addOption(OPTION_RESET_TIME_ON_DATE_SELECT);
- scriptOptions.addOption(OPTION_SHOW_APPLY_BUTTON);
- scriptOptions.addOption(OPTION_POPUP);
- scriptOptions.addOption(OPTION_SHOW_INPUT);
- scriptOptions.addOption(OPTION_SHOW_HEADER);
- scriptOptions.addOption(OPTION_SHOW_FOOTER);
- scriptOptions.addOption(OPTION_SHOW_WEEKS_BAR);
- scriptOptions.addOption(OPTION_TODAY_CONTROL_MODE);
- scriptOptions.addOption(OPTION_DATE_PATTERN);
- scriptOptions.addOption(OPTION_JOINT_POINT);
- scriptOptions.addOption(OPTION_DIRECTION);
- scriptOptions.addOption(OPTION_BOUNDARY_DATES_MODE);
- scriptOptions.addOption(OPTION_HORIZONTAL_OFFSET);
- scriptOptions.addOption(OPTION_VERTICAL_OFFSET);
- scriptOptions.addOption(OPTION_CURRENT_DATE, getCurrentDate(facesContext,
calendar));
- scriptOptions.addOption(OPTION_SELECTED_DATE, getSelectedDate(facesContext,
calendar));
- scriptOptions.addOption(OPTION_DAY_CELL_CLASS, getDayCellClass(facesContext,
calendar));
- scriptOptions.addOption(OPTION_DAY_STYLE_CLASS, getDayStyleClass(facesContext,
calendar));
- /*
- *add to script option
- *<cdk:scriptOption attributes="ondateselected, ondateselect,
ontimeselect, ontimeselected, onchanged, ondatemouseover, ondatemouseout, onexpand,
oncollapse, oncurrentdateselect, oncurrentdateselected"
wrapper="eventHandler" />
- * */
- scriptOptions.addOption(OPTION_LABELS, getLabels(facesContext, calendar));
- scriptOptions.addOption(OPTION_DEFAULT_TIME, getPreparedDefaultTime(facesContext,
calendar));
- scriptOptions.addOption(OPTION_HIDE_POPUP_ON_SCROLL);
- scriptOptions.addOption("showWeekDaysBar");
-
- scriptOptions.addOption("styleClass");
- scriptOptions.addOption("style", HtmlUtil.concatStyles("z-index:
" + calendar.getZindex(), calendar.getStyle()));
-
- return scriptOptions;
- }
-
- public void buildAddLocaleScript(ResponseWriter writer, FacesContext facesContext,
UIComponent component) throws IOException {
- if(component instanceof AbstractCalendar) {
- AbstractCalendar calendar = (AbstractCalendar)component;
- JSFunction function = new
JSFunction("RichFaces.ui.Calendar.addLocale",
CalendarHelper.getAsLocale(facesContext, calendar), getLocaleOptions(facesContext,
calendar));
- writer.write(function.toScript());
- writer.write(";");
- }
- }
-
- public void buildCalendarScript(ResponseWriter writer, FacesContext facesContext,
UIComponent component) throws IOException {
- if(component instanceof AbstractCalendar) {
- AbstractCalendar calendar = (AbstractCalendar)component;
- ScriptOptions scriptOptions = createCalendarScriptOption(facesContext,
calendar);
- JSFunction function = new JSFunction("new RichFaces.ui.Calendar",
calendar.getClientId(facesContext), CalendarHelper.getAsLocale(facesContext, calendar),
scriptOptions, "");
- StringBuffer scriptBuffer = new StringBuffer();
- scriptBuffer.append(function.toScript()).append(".load();");
- writer.write(scriptBuffer.toString());
- }
- }
-
- public boolean isUseIcons(FacesContext facesContext, UIComponent component) {
- Object label = component.getAttributes().get("buttonLabel");
- return (label == null || ((String)label).trim().length() == 0);
- }
-
- protected Converter createDefaultConverter() {
- return new DateTimeConverter();
- }
-
- protected Converter setupConverter(FacesContext facesContext, Converter converter,
AbstractCalendar calendar) {
- if(converter == null || calendar == null) {
- return null;
- }
-
- if(converter instanceof DateTimeConverter) {
- DateTimeConverter defaultConverter = (DateTimeConverter) converter;
- defaultConverter.setPattern(calendar.getDatePattern());
- defaultConverter.setLocale( CalendarHelper.getAsLocale(facesContext,
calendar));
- defaultConverter.setTimeZone(calendar.getTimeZone());
- }
- return converter;
- }
-
-}
\ No newline at end of file
Deleted:
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarIcon.java
===================================================================
---
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarIcon.java 2010-10-29
14:48:32 UTC (rev 19774)
+++
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarIcon.java 2010-10-29
14:50:18 UTC (rev 19775)
@@ -1,186 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.renderkit.html.images;
-
-import java.awt.BasicStroke;
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.GradientPaint;
-import java.awt.Graphics2D;
-import java.awt.Paint;
-import java.awt.RenderingHints;
-import java.awt.geom.Rectangle2D;
-import java.awt.geom.RoundRectangle2D;
-import java.awt.image.BufferedImage;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.Date;
-import java.util.Map;
-
-import javax.faces.context.FacesContext;
-
-import org.richfaces.resource.DynamicResource;
-import org.richfaces.resource.ImageType;
-import org.richfaces.resource.Java2DUserResource;
-import org.richfaces.resource.PostConstructResource;
-import org.richfaces.resource.StateHolderResource;
-import org.richfaces.skin.Skin;
-import org.richfaces.skin.SkinFactory;
-
-/**
- * @author amarkhel
- *
- */
-@DynamicResource
-public class CalendarIcon implements Java2DUserResource, StateHolderResource{
-
- private static final Dimension DIMENSION = new Dimension(20, 20);
-
- private Integer headerTextColor;
-
- private Integer headerBackgroundColor;
-
-
- @PostConstructResource
- public final void initialize() {
- FacesContext context = FacesContext.getCurrentInstance();
- Skin skin = SkinFactory.getInstance(context).getSkin(context);
-
- this.headerTextColor = skin.getColorParameter(context,
Skin.HEADER_BACKGROUND_COLOR);
- this.headerBackgroundColor = skin.getColorParameter(context,
Skin.SELECT_CONTROL_COLOR);
- }
-
-
- public boolean isTransient() {
- return false;
- }
-
- public void writeState(FacesContext context, DataOutput dataOutput) throws
IOException {
- dataOutput.writeInt(this.headerTextColor);
- dataOutput.writeInt(this.headerBackgroundColor);
- }
-
- public void readState(FacesContext context, DataInput dataInput) throws IOException
{
- this.headerTextColor = dataInput.readInt();
- this.headerBackgroundColor = dataInput.readInt();
- }
-
- public Map<String, String> getResponseHeaders() {
- return null;
- }
-
- public Date getLastModified() {
- return null;
- }
-
- public ImageType getImageType() {
- return ImageType.PNG;
- }
-
- public Dimension getDimension() {
- return DIMENSION;
- }
-
- protected BufferedImage createImage(int width, int height) {
- return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
- }
-
- public void paint(Graphics2D graphics2d, Dimension dimension) {
- BufferedImage image = paintImage();
- graphics2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
- graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
- graphics2d.drawImage(image, 0, 0, dimension.width, dimension.height, null);
- }
-
- public BufferedImage paintImage() {
-
- BufferedImage image = createImage(16, 16);
-
- Graphics2D g2d = image.createGraphics();
-
- Color borderColor = new Color(this.headerTextColor);
- Color activeColor = new Color(this.headerBackgroundColor);
-
- g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
- g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
-
- g2d.setStroke(new BasicStroke(1));
-
- int w = 16;
- int h = 16;
-
- //Draw Border
- g2d.setColor(borderColor);
- Rectangle2D border = new Rectangle2D.Double(1, 1, w - 3, h - 3);
- RoundRectangle2D round = new RoundRectangle2D.Double(1, 1, w- 3, h - 3, 2, 2);
- g2d.draw(round);
-
- Color lightBlue = new Color(216, 226, 240);
- Paint gradient1 = new GradientPaint(w-4, h-4, lightBlue, 2, 2, Color.white);
- g2d.setPaint(gradient1);
- border = new Rectangle2D.Double(2, 2, w - 4, h - 4);
- g2d.fill(border);
-
- border = new Rectangle2D.Double(3, 3, w - 6, h - 6);
- gradient1 = new GradientPaint(3, 3, lightBlue , w - 6, h - 6, borderColor);
- g2d.setPaint(gradient1);
- g2d.fill(border);
-
- g2d.setColor(Color.white);
- g2d.drawLine(3, 6, 3, 11);
- g2d.drawLine(5, 6, 5, 11);
- g2d.drawLine(7, 6, 7, 11);
- g2d.drawLine(9, 6, 9, 11);
- g2d.drawLine(11, 6, 11, 11);
-
- //Draw orange rectangle
- border = new Rectangle2D.Double(3, 3, 10, 3);
- g2d.setColor(Color.white);
- g2d.fill(border);
-
- Color c = new Color(activeColor.getRed(), activeColor.getGreen(),
activeColor.getBlue(), 100);
- Color c2 = new Color(activeColor.getRed(), activeColor.getGreen(),
activeColor.getBlue(), 200);
-
- gradient1 = new GradientPaint(12, 4, activeColor, 4, 7, c2);
- g2d.setPaint(gradient1);
- g2d.fill(border);
- //g2d.setColor(activeColor);
-
- c = new Color(activeColor.getRed(), activeColor.getGreen(),
activeColor.getBlue(), 150);
- c2 = new Color(activeColor.getRed(), activeColor.getGreen(),
activeColor.getBlue(), 200);
- border = new Rectangle2D.Double(4, 4, 8, 1);
-
- g2d.setColor(Color.white);
- g2d.fill(border);
-
- gradient1 = new GradientPaint(4, 4, c, 10, 4, c2);
- //g2d.setPaint(gradient1);
- g2d.setColor(c);
- g2d.fill(border);
-
- g2d.dispose();
-
- return image;
- }
-}
Deleted:
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarSeparator.java
===================================================================
---
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarSeparator.java 2010-10-29
14:48:32 UTC (rev 19774)
+++
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/CalendarSeparator.java 2010-10-29
14:50:18 UTC (rev 19775)
@@ -1,106 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.renderkit.html.images;
-
-import java.awt.Color;
-import java.awt.Dimension;
-import java.awt.Graphics2D;
-import java.awt.RenderingHints;
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.Date;
-import java.util.Map;
-
-import javax.faces.context.FacesContext;
-
-import org.richfaces.resource.ImageType;
-import org.richfaces.resource.Java2DUserResource;
-import org.richfaces.resource.PostConstructResource;
-import org.richfaces.resource.StateHolderResource;
-import org.richfaces.skin.Skin;
-import org.richfaces.skin.SkinFactory;
-
-/**
- * @author amarkhel
- *
- */
-public class CalendarSeparator implements Java2DUserResource, StateHolderResource {
-
- private static final Dimension DIMENSION = new Dimension(1, 15);
-
- private Integer headerTextColor;
-
- @PostConstructResource
- public void initialize() {
- FacesContext context = FacesContext.getCurrentInstance();
- Skin skin = SkinFactory.getInstance(context).getSkin(context);
-
- this.headerTextColor = skin.getColorParameter(context, Skin.HEAD_TEXT_COLOR);
- }
-
- public boolean isTransient() {
- return false;
- }
-
- public void writeState(FacesContext context, DataOutput dataOutput) throws
IOException {
- dataOutput.writeInt(this.headerTextColor);
- }
-
- public void readState(FacesContext context, DataInput dataInput) throws IOException
{
- this.headerTextColor = dataInput.readInt();
- }
-
- public Map<String, String> getResponseHeaders() {
- return null;
- }
-
- public Date getLastModified() {
- return null;
- }
-
- public ImageType getImageType() {
- return ImageType.PNG;
- }
-
- public Dimension getDimension() {
- return DIMENSION;
- }
-
- public void paint(Graphics2D graphics2d, Dimension dimension) {
- graphics2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
- graphics2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL,
RenderingHints.VALUE_STROKE_NORMALIZE);
- graphics2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
RenderingHints.VALUE_COLOR_RENDER_QUALITY);
- graphics2d.setRenderingHint(RenderingHints.KEY_DITHERING,
RenderingHints.VALUE_DITHER_DISABLE);
- graphics2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION,
RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
- graphics2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BICUBIC);
- graphics2d.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
-
- Color color = new Color(this.headerTextColor);
- graphics2d.setColor(color);
-
- for (int i = 0;i < DIMENSION.getHeight(); i += 2 ) {
- graphics2d.drawLine(0, i, 0, i);
- }
- }
-}
Deleted:
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/DisabledCalendarIcon.java
===================================================================
---
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/DisabledCalendarIcon.java 2010-10-29
14:48:32 UTC (rev 19774)
+++
trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/html/images/DisabledCalendarIcon.java 2010-10-29
14:50:18 UTC (rev 19775)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.richfaces.renderkit.html.images;
-
-import java.awt.Transparency;
-import java.awt.color.ColorSpace;
-import java.awt.image.BufferedImage;
-import java.awt.image.ComponentColorModel;
-import java.awt.image.DataBuffer;
-import java.awt.image.WritableRaster;
-
-/**
- * @author Maksim Kaszynski
- *
- */
-public class DisabledCalendarIcon extends CalendarIcon {
-
- @Override
- protected BufferedImage createImage(int width, int height) {
- ColorSpace gsColorSpace = ColorSpace.getInstance(ColorSpace.CS_GRAY);
- ComponentColorModel ccm = new ComponentColorModel(gsColorSpace, true, false,
Transparency.TRANSLUCENT, DataBuffer.TYPE_BYTE);
- WritableRaster raster = ccm.createCompatibleWritableRaster(width, height);
-
- return new BufferedImage(ccm, raster, ccm.isAlphaPremultiplied(), null);
- }
-
-}
Deleted:
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/JQuerySpinBtn.js
===================================================================
---
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/JQuerySpinBtn.js 2010-10-29
14:48:32 UTC (rev 19774)
+++
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/JQuerySpinBtn.js 2010-10-29
14:50:18 UTC (rev 19775)
@@ -1,295 +0,0 @@
-/* SpinButton control
- *
- * Adds bells and whistles to any ordinary textbox to
- * make it look and feel like a SpinButton Control.
- *
- * Originally written by George Adamson, Software Unity (george.jquery(a)softwareunity.com)
August 2006.
- * - Added min/max options
- * - Added step size option
- * - Added bigStep (page up/down) option
- *
- * Modifications made by Mark Gibson, (mgibson(a)designlinks.net) September 2006:
- * - Converted to jQuery plugin
- * - Allow limited or unlimited min/max values
- * - Allow custom class names, and add class to input element
- * - Removed global vars
- * - Reset (to original or through config) when invalid value entered
- * - Repeat whilst holding mouse button down (with initial pause, like keyboard repeat)
- * - Support mouse wheel in Firefox
- * - Fix double click in IE
- * - Refactored some code and renamed some vars
- *
- * Tested in IE6, Opera9, Firefox 1.5
- * v1.0 11 Aug 2006 - George Adamson - First release
- * v1.1 Aug 2006 - George Adamson - Minor enhancements
- * v1.2 27 Sep 2006 - Mark Gibson - Major enhancements
- * v1.3a 28 Sep 2006 - George Adamson - Minor enhancements
- * rf1.3a 15 Nov 2007 - Pavel Yaschenko - some changes
-
- Sample usage:
-
- // Create group of settings to initialise spinbutton(s). (Optional)
- var myOptions = {
- min: 0, // Set lower limit.
- max: 100, // Set upper limit.
- step: 1, // Set increment size.
- spinClass: mySpinBtnClass, // CSS class to style the spinbutton. (Class also
specifies url of the up/down button image.)
- upClass: mySpinUpClass, // CSS class for style when mouse over up button.
- downClass: mySpinDnClass // CSS class for style when mouse over down button.
- }
-
- $(document).ready(function(){
-
- // Initialise INPUT element(s) as SpinButtons: (passing options if desired)
- $("#myInputElement").SpinButton(myOptions);
-
- });
-
- */
-var sbjQuery = jQuery;
-sbjQuery.fn.SpinButton = function(cfg){
- return this.each(function(){
-
- // Apply specified options or defaults:
- // (Ought to refactor this some day to use $.extend() instead)
- this.spinCfg = {
- //min: cfg && cfg.min ? Number(cfg.min) : null,
- //max: cfg && cfg.max ? Number(cfg.max) : null,
- min: cfg && !isNaN(parseFloat(cfg.min)) ? Number(cfg.min) : null, // Fixes bug
with min:0
- max: cfg && !isNaN(parseFloat(cfg.max)) ? Number(cfg.max) : null,
- step: cfg && cfg.step ? Number(cfg.step) : 1,
- page: cfg && cfg.page ? Number(cfg.page) : 10,
- upClass: cfg && cfg.upClass ? cfg.upClass : 'up',
- downClass: cfg && cfg.downClass ? cfg.downClass : 'down',
- reset: cfg && cfg.reset ? cfg.reset : this.value,
- delay: cfg && cfg.delay ? Number(cfg.delay) : 500,
- interval: cfg && cfg.interval ? Number(cfg.interval) : 100,
- _btn_width: 20,
- _btn_height: 12,
- _direction: null,
- _delay: null,
- _repeat: null,
-
- digits: cfg && cfg.digits ? Number(cfg.digits) : 1
- };
-
- this.adjustValue = function(i){
- var v = this.value.toLowerCase();
- if (v=="am")
- {
- this.value="PM";
- return;
- }
- else if (v=="pm") {
- this.value="AM";
- return;
- }
- v = (isNaN(this.value) ? this.spinCfg.reset : Number(this.value)) + Number(i);
- if (this.spinCfg.min !== null) v = (v<this.spinCfg.min ? (this.spinCfg.max != null
? this.spinCfg.max : this.spinCfg.min) : v);
- if (this.spinCfg.max !== null) v = (v>this.spinCfg.max ? (this.spinCfg.min != null
? this.spinCfg.min : this.spinCfg.max) : v);
-
- var value = String(v);
- while (value.length<this.spinCfg.digits) value="0"+value;
-
- this.value = value;
- };
-
- sbjQuery(this)
-// .addClass(cfg && cfg.spinClass ? cfg.spinClass : 'spin-button')
-//
-// .mousemove(function(e){
-// // Determine which button mouse is over, or not (spin direction):
-// var x = e.pageX || e.x;
-// var y = e.pageY || e.y;
-// var el = e.target || e.srcElement;
-// var direction =
-// (x > coord(el,'offsetLeft') + el.offsetWidth - this.spinCfg._btn_width)
-// ? ((y < coord(el,'offsetTop') + this.spinCfg._btn_height) ? 1 : -1) :
0;
-//
-// if (direction !== this.spinCfg._direction) {
-// // Style up/down buttons:
-// switch(direction){
-// case 1: // Up arrow:
-// sbjQuery(this).removeClass(this.spinCfg.downClass).addClass(this.spinCfg.upClass);
-// break;
-// case -1: // Down arrow:
-// sbjQuery(this).removeClass(this.spinCfg.upClass).addClass(this.spinCfg.downClass);
-// break;
-// default: // Mouse is elsewhere in the textbox
-// sbjQuery(this).removeClass(this.spinCfg.upClass).removeClass(this.spinCfg.downClass);
-// }
-//
-// // Set spin direction:
-// this.spinCfg._direction = direction;
-// }
-// })
-//
-// .mouseout(function(){
-// // Reset up/down buttons to their normal appearance when mouse moves away:
-// sbjQuery(this).removeClass(this.spinCfg.upClass).removeClass(this.spinCfg.downClass);
-// this.spinCfg._direction = null;
-// })
-
-// .mousedown(function(e){
-// if (this.spinCfg._direction != 0) {
-// // Respond to click on one of the buttons:
-// var self = this;
-// var adjust = function() {
-// self.adjustValue(self.spinCfg._direction * self.spinCfg.step);
-// };
-//
-// adjust();
-//
-// // Initial delay before repeating adjustment
-// self.spinCfg._delay = window.setTimeout(function() {
-// adjust();
-// // Repeat adjust at regular intervals
-// self.spinCfg._repeat = window.setInterval(adjust, self.spinCfg.interval);
-// }, self.spinCfg.delay);
-// }
-// })
-//
-// .mouseup(function(e){
-// // Cancel repeating adjustment
-// window.clearInterval(this.spinCfg._repeat);
-// window.clearTimeout(this.spinCfg._delay);
-// })
-//
-// .dblclick(function(e) {
-// if (sbjQuery.browser.msie)
-// this.adjustValue(this.spinCfg._direction * this.spinCfg.step);
-// })
-
- .keydown(function(e){
- // Respond to up/down arrow keys.
- switch(e.keyCode){
- case 38: this.adjustValue(this.spinCfg.step); break; // Up
- case 40: this.adjustValue(-this.spinCfg.step); break; // Down
- case 33: this.adjustValue(this.spinCfg.page); break; // PageUp
- case 34: this.adjustValue(-this.spinCfg.page); break; // PageDown
- }
- })
-
- .bind("mousewheel", function(e){
- // Respond to mouse wheel in IE. (It returns up/dn motion in multiples of 120)
- if (e.wheelDelta >= 120)
- this.adjustValue(this.spinCfg.step);
- else if (e.wheelDelta <= -120)
- this.adjustValue(-this.spinCfg.step);
-
- e.preventDefault();
- })
-
- .change(function(e){
- this.adjustValue(0);
- });
-
- var self = this;
-
- var btnUp = document.getElementById(this.id + 'BtnUp');
- sbjQuery(btnUp)
- .mousedown(function(e){
- // Respond to click on one of the buttons:
- var adjust = function() {
- self.adjustValue(self.spinCfg.step);
- };
-
- adjust();
-
- // Initial delay before repeating adjustment
- self.spinCfg._delay = window.setTimeout(function() {
- adjust();
- // Repeat adjust at regular intervals
- self.spinCfg._repeat = window.setInterval(adjust, self.spinCfg.interval);
- }, self.spinCfg.delay);
- self.spinCfg._repeater = true;
- return false;
- })
-
- .mouseup(function(e){
- // Cancel repeating adjustment
- self.spinCfg._repeater = false;
- window.clearInterval(self.spinCfg._repeat);
- window.clearTimeout(self.spinCfg._delay);
- })
-
- .dblclick(function(e) {
- if (sbjQuery.browser.msie)
- self.adjustValue(self.spinCfg.step);
- })
- .mouseout(function(e){
- // Cancel repeating adjustment
- if (self.spinCfg._repeater)
- {
- self.spinCfg._repeater = false
- window.clearInterval(self.spinCfg._repeat);
- window.clearTimeout(self.spinCfg._delay);
- }
- });
-
- var btnDown = document.getElementById(this.id + 'BtnDown');
- sbjQuery(btnDown)
- .mousedown(function(e){
- // Respond to click on one of the buttons:
- var adjust = function() {
- self.adjustValue(-self.spinCfg.step);
- };
-
- adjust();
-
- // Initial delay before repeating adjustment
- self.spinCfg._delay = window.setTimeout(function() {
- adjust();
- // Repeat adjust at regular intervals
- self.spinCfg._repeat = window.setInterval(adjust, self.spinCfg.interval);
- }, self.spinCfg.delay);
- self.spinCfg._repeater = true;
- return false;
- })
-
- .mouseup(function(e){
- // Cancel repeating adjustment
- self.spinCfg._repeater = false;
- window.clearInterval(self.spinCfg._repeat);
- window.clearTimeout(self.spinCfg._delay);
- })
-
- .dblclick(function(e) {
- if (sbjQuery.browser.msie)
- self.adjustValue(-self.spinCfg.step);
- })
- .mouseout(function(e){
- // Cancel repeating adjustment
- if (self.spinCfg._repeater)
- {
- self.spinCfg._repeater = false
- window.clearInterval(self.spinCfg._repeat);
- window.clearTimeout(self.spinCfg._delay);
- }
- });
-
-
- if (this.addEventListener) {
- // Respond to mouse wheel in Firefox
- this.addEventListener('DOMMouseScroll', function(e) {
- if (e.detail > 0)
- this.adjustValue(-this.spinCfg.step);
- else if (e.detail < 0)
- this.adjustValue(this.spinCfg.step);
-
- e.preventDefault();
- }, false);
- }
- });
-
- function coord(el,prop) {
- var c = el[prop], b = document.body;
-
- while ((el = el.offsetParent) && (el != b)) {
- if (!sbjQuery.browser.msie || (el.currentStyle.position != 'relative'))
- c += el[prop];
- }
-
- return c;
- }
-};
Deleted:
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar-utils.js
===================================================================
---
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar-utils.js 2010-10-29
14:48:32 UTC (rev 19774)
+++
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar-utils.js 2010-10-29
14:50:18 UTC (rev 19775)
@@ -1,351 +0,0 @@
-(function ($, rf) {
-
- rf.calendarUtils = rf.calendarUtils || {};
-
- var getDefaultMonthNames = function(shortNames)
- {
- return (shortNames
- ?
['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
- :
['January','February','March','April','May','June','July','August','September','October','November','December']);
- };
-
- $.extend(rf.calendarUtils, {
- // TODO: rewrite this function or use the same function if exists
- /*clonePosition: function (elements, source)
- {
- if (!elements.length) elements = [elements];
- var offset = Position.cumulativeOffset(source);
- offset = {left:offset[0], top:offset[1]};
- var offsetTemp;
- if (source.style.position!='absolute')
- {
- offsetTemp = Position.realOffset(source);
- offset.left -= offsetTemp.left;
- offset.top -= offsetTemp.top;
- offsetTemp = Richfaces.Calendar.getWindowScrollOffset();
- offset.left += offsetTemp.left;
- offset.top += offsetTemp.top;
- }
-
- for (var i=0;i<elements.length;i++)
- {
- offsetTemp = Richfaces.Calendar.getParentOffset(elements[i]);
- elements[i].style.left = (offset.left - offsetTemp.left) + 'px';
- elements[i].style.top = (offset.top - offsetTemp.top) + 'px';
- }
- return offset;
- }*/
-
- //TODO: not used
- /*Object.extend(Event, {
- findElementByAttr : function(event, tagName, attribute, value, flag) {
- var element = Event.findElement(event, tagName);
- while (!element[attribute] || (flag ? element[attribute].indexOf(value)!=0 :
element[attribute]!=value) )
- {
- element = element.parentNode;
- }
- return element;
- }
- });
-
- Object.extend(Element, {
- replaceClassName : function (element, whichClassName, toClassName) {
- if (!(element = $(element))) return;
- var e = Element.classNames(element);
- e.remove(whichClassName);
- e.add(toClassName);
- return element;
- }
- });*/
-
- // TODO: move joinArray to richfaces utils
- joinArray: function(array, begin, end, separator)
- {
- var value = '';
- if (array.length!=0) value = begin+array.pop()+end;
- while (array.length)
- value = begin+array.pop()+end+separator+value;
- return value;
- },
-
- getMonthByLabel: function (monthLabel, monthNames) {
- var toLowerMonthLabel = monthLabel.toLowerCase();
- var i = 0;
- while (i < monthNames.length) {
- if (monthNames[i].toLowerCase() == toLowerMonthLabel) {
- return i;
- }
-
- i++;
- }
- },
-
- /* Year:
- * y,yy - 00-99
- * yyy+ - 1999
- * Month:
- * M - 1-12
- * MM - 01-12
- * MMM - short (Jul)
- * MMMM+ - long (July)
- * Date:
- * d - 1-31
- * dd+ - 01-31 */
- parseDate: function(dateString, pattern, monthNames, monthNamesShort)
- {
- var re = /([.*+?^<>=!:${}()[\]\/\\])/g;
- var monthNamesStr
- var monthNamesShortStr;
- if (!monthNames) {
- monthNames = getDefaultMonthNames();
- monthNamesStr = monthNames.join('|');
- } else {
- monthNamesStr = monthNames.join('|').replace(re, '\\$1');
- }
-
- if (!monthNamesShort) {
- monthNamesShort = getDefaultMonthNames(true);
- monthNamesShortStr = monthNamesShort.join('|');
- } else {
- monthNamesShortStr = monthNamesShort.join('|').replace(re, '\\$1');
- }
-
- var counter=1;
- var y,m,d;
- var a,h,min,s;
- var shortLabel=false;
-
- pattern = pattern.replace(/([.*+?^<>=!:${}()|[\]\/\\])/g, '\\$1');
- pattern = pattern.replace(/(y+|M+|d+|a|H{1,2}|h{1,2}|m{2}|s{2})/g,
- function($1) {
- switch ($1) {
- case 'y' :
- case 'yy' : y=counter; counter++; return '(\\d{2})';
- case 'MM' : m=counter; counter++; return '(\\d{2})';
- case 'M' : m=counter; counter++; return '(\\d{1,2})';
- case 'd' : d=counter; counter++; return '(\\d{1,2})';
- case 'MMM': m=counter; counter++; shortLabel=true; return
'('+monthNamesShortStr+')';
- case 'a' : a=counter; counter++; return
'(AM|am|PM|pm)?';
- case 'HH' :
- case 'hh' : h=counter; counter++; return '(\\d{2})?';
- case 'H' :
- case 'h' : h=counter; counter++; return '(\\d{1,2})?';
- case 'mm' : min=counter; counter++; return '(\\d{2})?';
- case 'ss' : s=counter; counter++; return '(\\d{2})?';
-
- }
- // y+,M+,d+
- var ch = $1.charAt(0);
- if (ch=='y') {y=counter; counter++; return '(\\d{3,4})'};
- if (ch=='M') {m=counter; counter++; return
'('+monthNamesStr+')'};
- if (ch=='d') {d=counter; counter++; return '(\\d{2})'};
- }
- );
-
- var re = new RegExp(pattern,'i');
- var match = dateString.match(re);
- if (match!=null)
- {
- // set default century start
- var correctYear = false;
- var defaultCenturyStart = new Date();
- defaultCenturyStart.setFullYear(defaultCenturyStart.getFullYear()-80);
-
- var yy = parseInt(match[y],10);
- if (isNaN(yy)) return null;
- else if (yy<100){
- // calculate full year if year has only two digits
- var defaultCenturyStartYear = defaultCenturyStart.getFullYear();
- var ambiguousTwoDigitYear = defaultCenturyStartYear % 100;
- correctYear = yy == ambiguousTwoDigitYear;
- yy += Math.floor(defaultCenturyStartYear/100)*100 + (yy < ambiguousTwoDigitYear ?
100 : 0);
- }
-
- var mm = parseInt(match[m],10); if (isNaN(mm)) mm = this.getMonthByLabel(match[m],
shortLabel ? monthNamesShort : monthNames); else if (--mm<0 || mm>11) return null;
- var addDay = correctYear ? 1 : 0;
- var dd = parseInt(match[d],10); if (isNaN(dd) || dd<1 ||
dd>this.daysInMonth(yy, mm) + addDay) return null;
-
- var date = new Date(yy, mm, dd);
-
- // time parsing
- if (min!=undefined && h!=undefined)
- {
- var hh,mmin,aa;
- mmin = parseInt(match[min],10); if (isNaN(mmin) || mmin<0 || mmin>59) return
null;
- hh = parseInt(match[h],10); if (isNaN(hh)) return null;
- if (a!=undefined)
- {
- aa = match[a];
- if (!aa) return null;
- aa = aa.toLowerCase();
- if ((aa!='am' && aa!='pm') || hh<1 || hh>12) return
null;
- if (aa=='pm')
- {
- if (hh!=12) hh+=12;
- } else if (hh==12) hh = 0;
- }
- else if (hh<0 || hh>23) return null;
-
- date.setHours(hh); date.setMinutes(mmin);
- if (s!=undefined)
- {
- sec = parseInt(match[s], 10); if (isNaN(sec) || sec<0 || sec>59) return
null;
- date.setSeconds(sec);
- }
- }
-
- if (correctYear) {
- if (date.getTime() < defaultCenturyStart.getTime()) {
- date.setFullYear(yy + 100);
- }
- if (date.getMonth() != mm) return null;
- }
-
- return date;
- }
- return null;
- },
-
- formatDate: function(date, pattern, monthNames, monthNamesShort) {
- if (!monthNames) monthNames = getDefaultMonthNames();
- if (!monthNamesShort) monthNamesShort = getDefaultMonthNames(true);
- var mm,dd,hh,min,sec;
- var result =
pattern.replace(/(\\\\|\\[yMdaHhms])|(y+|M+|d+|a|H{1,2}|h{1,2}|m{2}|s{2})/g,
- function($1,$2,$3) {
- if ($2) return $2.charAt(1);
- switch ($3) {
- case 'y':
- case 'yy': return date.getYear().toString().slice(-2);
- case 'M': return (date.getMonth()+1);
- case 'MM': return ((mm = date.getMonth()+1)<10 ?
'0'+mm : mm);
- case 'MMM': return monthNamesShort[date.getMonth()];
- case 'd': return date.getDate();
- case 'a' : return (date.getHours()<12 ? 'AM' :
'PM');
- case 'HH' : return ((hh = date.getHours())<10 ? '0'+hh
: hh);
- case 'H' : return date.getHours();
- case 'hh' : return ((hh = date.getHours())==0 ? '12' :
(hh<10 ? '0'+hh : (hh>21 ? hh-12 : (hh>12) ? '0'+(hh-12) :
hh)));
- case 'h' : return ((hh = date.getHours())==0 ? '12' :
(hh>12 ? hh-12 : hh));
- case 'mm' : return ((min = date.getMinutes())<10 ?
'0'+min : min);
- case 'ss' : return ((sec = date.getSeconds())<10 ? '0'+sec :
sec);
- }
- // y+,M+,d+
- var ch = $3.charAt(0);
- if (ch=='y') return date.getFullYear();
- if (ch=='M') return monthNames[date.getMonth()];
- if (ch=='d') return ((dd = date.getDate())<10 ? '0'+dd : dd);
- }
- );
- return result;
- },
-
- isLeapYear: function(year) {
- return new Date(year, 1, 29).getDate()==29;
- },
-
- daysInMonth: function(year,month) {
- return 32 - new Date(year, month, 32).getDate();
- },
-
- daysInMonthByDate: function(date) {
- return 32 - new Date(date.getFullYear(), date.getMonth(), 32).getDate();
- },
-
- getDay: function(date, firstWeekDay ) {
- var value = date.getDay() - firstWeekDay;
- if (value < 0) value = 7 + value;
- return value;
- },
-
- getFirstWeek: function(year, mdifw, fdow) {
- var date = new Date(year,0,1);
- var firstday = this.getDay(date, fdow);
-
- var weeknumber = (7-firstday<mdifw) ? 0 : 1;
-
- return {date:date, firstDay:firstday, weekNumber:weeknumber, mdifw:mdifw, fdow:fdow};
- },
-
- getLastWeekOfPrevYear: function(o) {
- var year = o.date.getFullYear()-1;
- var days = (isLeapYear(year) ? 366 : 365);
- var obj = this.getFirstWeek(year, o.mdifw, o.fdow);
- days = (days - 7 + o.firstDay);
- var weeks = Math.floor(days/7)+1;
-
- return weeks+obj.weekNumber;
- },
-
- weekNumber: function(year, month, mdifw, fdow) {
-
- var o = this.getFirstWeek(year, mdifw, fdow);
-
- if (month==0)
- {
- if (o.weekNumber==1) return 1;
- return getLastWeekOfPrevYear(o);
- }
- var oneweek = 604800000;
- var d = new Date(year, month,1);
- d.setDate( 1+o.firstDay + (this.getDay(d,fdow)==0?1:0));
-
- weeknumber = o.weekNumber + Math.floor((d.getTime() - o.date.getTime()) / oneweek);
-
- return weeknumber;
- }
-
- });
-
- rf.calendarTemplates = rf.calendarTemplates || {};
-
- $.extend(rf.calendarTemplates, (function (){
-
- var VARIABLE_NAME_PATTERN = /^\s*[_,A-Z,a-z][\w,_\.]*\s*$/;
-
- var getObjectValue = function (str, object) {
- var a=str.split(".");
- var value=object[a[0]];
- var c=1;
- while (value && c<a.length) value = value[a[c++]];
- return (value ? value : "");
- };
-
- return {
- evalMacro: function(template, object)
- {
- var _value_="";
- // variable evaluation
- if (VARIABLE_NAME_PATTERN.test(template))
- {
- if (template.indexOf('.')==-1) {
- _value_ = object[template];
- if (!_value_) _value_=window[template];
- }
- // object's variable evaluation
- else {
- _value_ = getObjectValue(template, object);
- if (!_value_) _value_=getObjectValue(template, window);
- }
- if (_value_ && typeof _value_=='function') _value_ =
_value_(object);
- if (!_value_) _value_="";
- }
- //js string evaluation
- else {
- try {
- if (object.eval) {
- _value_ = object.eval(template);
- }
- else with (object) {
- _value_ = eval(template) ;
- }
-
- if (typeof _value_ == 'function') {
- _value_ = _value_(object);
- }
- } catch (e) { LOG.warn("Exception: "+e.Message + "\n[" +
template + "]"); }
- }
- return _value_;
- }
- };
- })());
-
-})(jQuery, RichFaces);
\ No newline at end of file
Deleted:
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.ecss
===================================================================
---
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.ecss 2010-10-29
14:48:32 UTC (rev 19774)
+++
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.ecss 2010-10-29
14:50:18 UTC (rev 19775)
@@ -1,402 +0,0 @@
-.rf-ca-extr{
- border : 1px solid;
- border-color: '#{richSkin.panelBorderColor}';
-}
-.rf-ca-btn{
- cursor : pointer;
-}
-.rf-ca-hdr-optnl{
- border-bottom : 1px solid;
- border-bottom-color : '#{richSkin.panelBorderColor}';
- background-color : '#{richSkin.additionalBackgroundColor}';
- font-size : '#{richSkin.generalSizeFont}';
- font-family : '#{richSkin.generalFamilyFont}';
- padding : 7px;
- height : 22px;
- font-weight: bold;
-}
-
-.rf-ca-hdr{
- border-right : 0px solid;
- border-bottom : 1px solid;
- border-bottom-color : '#{richSkin.panelBorderColor}';
- background-color : '#{richSkin.additionalBackgroundColor}';
- font-size : '#{richSkin.generalSizeFont}';
- font-family : '#{richSkin.generalFamilyFont}';
-}
-
-.rf-ca-c-size{
- width : 25px;
- height : 22px;
-}
-
-.rf-ca-c-div{
- overflow: hidden;
-}
-
-.rf-ca-c{
- border-bottom : 1px solid;
- border-right : 1px solid;
- padding : 0px;
- vertical-align : middle;
- text-align : center;
- border-bottom-color : '#{richSkin.panelBorderColor}';
- border-right-color : '#{richSkin.panelBorderColor}';
- background-color : '#{richSkin.tableBackgroundColor}';
- font-size : '#{richSkin.generalSizeFont}';
- font-family : '#{richSkin.generalFamilyFont}';
-}
-
-.rf-ca-month{
- vertical-align : middle;
- text-align : center;
- height : 22px;
- white-space: nowrap;
- background-color : '#{richSkin.headerBackgroundColor}';
- font-size : '#{richSkin.headerSizeFont}';
- font-family : '#{richSkin.headerFamilyFont}';
- font-weight : '#{richSkin.headerWeightFont}';
- color : '#{richSkin.headerTextColor}';
-}
-
-.rf-ca-days{
- border-bottom : 1px solid;
- border-right : 0px solid;
- vertical-align : middle;
- text-align : center;
- height : 22px;
- border-bottom-color : '#{richSkin.panelBorderColor}';
- border-right-color : '#{richSkin.panelBorderColor}';
- background-color : '#{richSkin.additionalBackgroundColor}';
- font-size : '#{richSkin.generalSizeFont}';
- font-family : '#{richSkin.generalFamilyFont}';
-}
-
-.rf-ca-week{
- border-bottom : 1px solid;
- border-right : 1px solid;
- vertical-align : middle;
- text-align : center;
- width : 25px;
- color: red;
- border-bottom-color : '#{richSkin.panelBorderColor}';
- background-color : '#{richSkin.calendarWeekBackgroundColor}';
- border-right-color : '#{richSkin.panelBorderColor}';
- font-size : '#{richSkin.generalSizeFont}';
- font-family : '#{richSkin.generalFamilyFont}';
-}
-
-.rf-rgh-c{
- border-right : 0px;
-}
-
-.rf-btm-c{
- border-bottom : 0px;
-}
-
-.rf-ca-tl-ftr{
- height : 22px;
- padding : 1px 2px 1px 1px;
- background: '#{richSkin.additionalBackgroundColor}';
- font-size: '#{richSkin.generalSizeFont}';
- font-family: '#{richSkin.generalFamilyFont}';
- background-image:
"url(#{resource['org.richfaces.images:calendarSeparator.png']})";
- background-repeat: no-repeat;
- background-position: right center;
-}
-
-.rf-ca-ftr-optnl{
- border-top : 1px solid;
- border-right : 0px solid;
- padding : 7px;
- height : 22px;
- font-weight: bold;
- border-top-color: '#{richSkin.panelBorderColor}';
- border-right-color: '#{richSkin.panelBorderColor}';
- background: '#{richSkin.additionalBackgroundColor}';
- font-size: '#{richSkin.generalSizeFont}';
- font-family: '#{richSkin.generalFamilyFont}';
-}
-
-.rf-ca-ftr{
- border-top: 1px solid;
- border-right: 0px solid;
- font-size: '#{richSkin.generalSizeFont}';
- font-family: '#{richSkin.generalFamilyFont}';
- background: '#{richSkin.additionalBackgroundColor}';
- border-top-color: '#{richSkin.panelBorderColor}';
- border-right-color: '#{richSkin.panelBorderColor}';
-}
-
-.rf-ca-sp-inp {
- border: 0px;
- padding: 0px 0px 0px 3px;
- background: none transparent scroll repeat 0% 0%;
- font-size: '#{richSkin.buttonSizeFont}';
- font-family: '#{richSkin.buttonFamilyFont}';
- width: 18px;
-}
-
-.rf-ca-sp-inp-cntr {
- background-position: left top;
- background-repeat: repeat-x;
- border: 1px solid;
- background-image:
url("#{resource['org.richfaces.renderkit.html.images.InputBackgroundImage']}");
- background-color: '#{richSkin.controlBackgroundColor}';
- border-color: '#{richSkin.panelBorderColor}';
- border-bottom-color: '#{richSkin.subBorderColor}';
- border-right-color: '#{richSkin.subBorderColor}';
-}
-
-.rf-ca-sp-btn {
- border-width: 1px;
- border-style: solid;
- background-position: left top;
- background-repeat: repeat-x;
- font-size: 0px;
- background-color: '#{richSkin.headerBackgroundColor}';
- border-color: '#{richSkin.headerBackgroundColor}';
- background-image:
"url(#{resource['org.richfaces.renderkit.html.images.ButtonBackgroundImage']})";
-}
-
-
-.rf-ca-spec {
- background-color: '#{richSkin.calendarSpecBackgroundColor}';
-}
-
-.calendarSpecBackgroundColo {
- color: red;
-}
-
-.rf-ca-holly {
- background-color: '#{richSkin.calendarHolidaysBackgroundColor}';
- color: '#{richSkin.calendarHolidaysTextColor}';
-}
-
-.rf-ca-boundary-dates {
- color: #A0A0A0;
-
-}
-
-.rf-ca-today {
- background-color: '#{richSkin.calendarCurrentBackgroundColor}';
- color: '#{richSkin.calendarCurrentTextColor}';
- font-weight: bold;
-}
-
-.rf-ca-today {
- background-color: '#{richSkin.calendarCurrentBackgroundColor}';
- color: '#{richSkin.calendarCurrentTextColor}';
- font-weight: bold;
-}
-
-.rf-ca-sel {
- background-color: '#{richSkin.headerBackgroundColor}';
- color: '#{richSkin.headerTextColor}';
- font-weight: '#{richSkin.headerWeightFont}';
-}
-
-.rf-ca-hov {
- background-color: '#{richSkin.calendarSpecBackgroundColor}';
- background-color: '#{richSkin.calendarSpecTextColor}';
-}
-
-.rf-ca-tl-btn {
- cursor: pointer;
- padding: 2px 3px 2px 3px;
- white-space: nowrap;
-}
-
-.rf-ca-tl-btn-dis {
- cursor: pointer;
- padding: 2px 3px 2px 3px;
-}
-
-.rf-ca-tl-btn-hov {
- background-color: '#{richSkin.calendarWeekBackgroundColor}';
- color: '#{richSkin.generalTextColor}';
- border: 1px solid;
- border-color: '#{richSkin.tableBackgroundColor}';
- border-right-color: '#{richSkin.panelBorderColor}';
- border-bottom-color: '#{richSkin.panelBorderColor}';
- padding: 1px 2px 1px 2px;
-}
-
-.rf-ca-tl-btn-press {
- border-color: '#{richSkin.panelBorderColor}';
- border-right-color: '#{richSkin.tableBackgroundColor}';
- border-bottom-color: '#{richSkin.tableBackgroundColor}';
-}
-
-.rf-ca-tl-close {
- padding: 2px 2px 2px 4px;
- background-image:
"url(#{resource['org.richfaces.images:calendarSeparator.png']})";
- background-repeat: no-repeat;
- background-position: left center;
-}
-
-.rf-ca-btn {
- cursor: pointer;
- vertical-align: middle;
-}
-
-.rf-ca-edtr-shdw {
- background: '#{richSkin.tableBackgroundColor}';
- opacity: 0.5;
- filter: alpha(opacity=50);
-}
-
-.rf-ca-time-layout {
- background: '#{richSkin.additionalBackgroundColor}';
- border: 1px solid;
- border-color: '#{richSkin.panelBorderColor}';
- position: relative;
-}
-
-.rf-ca-date-layout {
- background: '#{richSkin.tableBackgroundColor}';
- border: 1px solid;
- border-color: '#{richSkin.panelBorderColor}';
- position: relative;
-}
-
-.rf-ca-edtr-cntr {
-}
-
-.rf-ca-time-layout, .rf-ca-date-layout, .rf-ca-time-layout input {
- font-size: '#{richSkin.generalSizeFont}';
- font-family: '#{richSkin.generalFamilyFont}';
-}
-
-.rf-ca-time-layout-fld {
- padding: 7px 7px 5px 7px;
- white-space: nowrap;
-}
-
-.rf-ca-time-layout-cancel {
- padding: 0px 7px 7px 1px;
-}
-
-
-.rf-ca-time-layout-ok {
- padding: 0px 1px 7px 7px;
-}
-
-.rf-ca-date-layout-cancel {
- background: '#{richSkin.additionalBackgroundColor}';
- border-top: 1px solid;
- border-top-color: '#{richSkin.panelBorderColor}';
- padding: 5px 5px 5px 1px;
-}
-
-.rich-ca-date-layout-ok {
- background: '#{richSkin.additionalBackgroundColor}';
- border-top: 1px solid;
- border-top-color: '#{richSkin.panelBorderColor}';
- padding: 5px 1px 5px 5px;
-}
-
-.rf-ca-date-layout-split {
- border-right: 1px solid;
- border-right-color: '#{richSkin.panelBorderColor}';
-}
-
-.rf-ca-time-btn {
- width: 45px;
- border: 1px solid;
- border-color: '#{richSkin.tableBackgroundColor}';
- border-right-color: '#{richSkin.panelBorderColor}';
- border-bottom-color: '#{richSkin.panelBorderColor}';
- background: '#{richSkin.additionalBackgroundColor}';
- text-align: center;
- padding: 2px;
- white-space: nowrap;
- text-align: center;
- cursor: pointer;
-}
-
-.rf-ca-time-btn-press {
- border: 1px solid;
- border-color: '#{richSkin.panelBorderColor}';
- border-right-color: '#{richSkin.tableBackgroundColor}';
- border-bottom-color: '#{richSkin.panelBorderColor}';
- background-color: '#{richSkin.calendarWeekBackgroundColor}';
-}
-
-.rf-ca-time-inp {
- width: 22px;
- margin: 0px 2px;
-}
-
-.rf-ca-sp-up {
- background-image: "url(#{resource['StandardButtonBgImage']})";
- height: 7px;
- width: 14px;
- margin: 0px 1px 1px 0px;
-}
-
-.rf-ca-sp-down {
- background-image:
"url(#{resource['org.richfaces.renderkit.html.images.StandardButtonPressedBgImage']})";
- height: 7px;
- width: 14px;
- margin: 0px 1px 1px 0px;
-}
-
-.rf-ca-sp-press {
- margin: 1px 0px 0px 1px;
-}
-
-.rf-ca-sp-btn {
- background-color: '#{richSkin.headerBackgroundColor}';
- border-color: '#{richSkin.headerBackgroundColor}';
- background-image:
"url(#{resource['org.richfaces.renderkit.html.images.ButtonBackgroundImage']})";
-}
-
-.rf-ca-edtr-layout-shdw {
- background-color: '#{richSkin.shadowBackgroundColor}';
- position: absolute;
- opacity: 0.3;
- filter: alpha(opacity=30);
-}
-
-.rf-ca-edtr-btn {
- width: 36px;
- padding: 2px;
- margin: 2px;
- text-align: center;
- cursor: pointer;
-}
-
-.rf-ca-edtr-btn-over {
- padding: 1px;
- border: 1px solid;
- border-color: '#{richSkin.panelBorderColor}';
- background: '#{richSkin.calendarSpecBackgroundColor}';
-}
-
-.rf-ca-edtr-btn-sel {
- background-color: '#{richSkin.calendarCurrentBackgroundColor}';
- padding: 2px;
- border: 0px;
- color: '#{richSkin.calendarCurrentTextColor}';
- font-weight: bold;
- cursor: default;
-}
-
-.rf-ca-edtr-tl-over {
- padding: 1px;
- border: 1px solid;
- background: '#{richSkin.additionalBackgroundColor}';
- border-color: '#{richSkin.tableBackgroundColor}';
- border-right-color: '#{richSkin.panelBorderColor}';
- border-bottom-color: '#{richSkin.panelBorderColor}';
-}
-
-.rf-ca-edtr-tl-press {
- padding: 1px;
- border: 1px solid;
- background: '#{richSkin.additionalBackgroundColor}';
- border-color: '#{richSkin.panelBorderColor}';
- border-right-color: '#{richSkin.tableBackgroundColor}';
- border-bottom-color: '#{richSkin.tableBackgroundColor}';
-}
\ No newline at end of file
Deleted:
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js
===================================================================
---
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js 2010-10-29
14:48:32 UTC (rev 19774)
+++
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/calendar.js 2010-10-29
14:50:18 UTC (rev 19775)
@@ -1,1806 +0,0 @@
-/*if(!window.LOG){
- window.LOG = {warn:function(){}};
-}*/
-
-// TODO: try to change RichFaces.$ to $$ if possible
-
-(function ($, rf) {
-
- rf.ui = rf.ui || {};
-
- //calendar templates
- var CalendarView = {
- getControl: function(text, attributes, functionName, paramsStr) {
- var attr = $.extend({
- onclick: (functionName ?
"RichFaces.$$('Calendar',this)."+functionName+"("+(paramsStr ?
paramsStr : "")+");" : "")+"return true;"
- }, attributes);
- return new E('div',attr,[new T(text)]);
- },
-
- getSelectedDateControl: function(calendar) {
-
- if (!calendar.selectedDate || calendar.params.showApplyButton) return "";
-
- var text = rf.calendarUtils.formatDate(calendar.selectedDate,(calendar.timeType ?
calendar.datePattern : calendar.params.datePattern), calendar.params.monthLabels,
calendar.params.monthLabelsShort);
- var onclick = "RichFaces.$$('Calendar',this).showSelectedDate(); return
true;"
- var markup = ( calendar.params.disabled ?
- new E('div', {'class': 'rf-ca-tl-btn-dis'}, [new
ET(text)]) :
- new E('div', {'class': 'rf-ca-tl-btn', 'onclick':
onclick}, [new ET(text)]) );
-
- return markup;
- },
-
- getTimeControl: function(calendar) {
-
- if (!calendar.selectedDate || !calendar.timeType) return "";
-
- var text = rf.calendarUtils.formatDate(calendar.selectedDate, calendar.timePattern,
calendar.params.monthLabels, calendar.params.monthLabelsShort);
-
- var onmouseover =
"jQuery(this).removeClass('rf-ca-tl-btn-press');";
- var onmouseout = "jQuery(this).addClass('rf-ca-tl-btn-press');";
- var onclick = "RichFaces.$$('Calendar',this).showTimeEditor();return
true;";
- var markup = calendar.params.disabled || calendar.params.readonly ?
- new E('div', {'class': 'rf-ca-tl-btn-btn-dis'}, [new
ET(text)]) :
- new E('div', {'class': 'rf-ca-tl-btn rf-ca-tl-btn-hov
rf-ca-tl-btn-press', 'onclick': onclick,
- 'onmouseover': + onmouseover ,
- 'onmouseout' : + onmouseout}, [new ET(text)]);
-
- return markup;
- },
-
- toolButtonAttributes: {className: "rf-ca-tl-btn",
onmouseover:"this.className='rf-ca-tl-btn rf-ca-tl-btn-hov'",
onmouseout:"this.className='rf-ca-tl-btn'",
onmousedown:"this.className='rf-ca-tl-btn rf-ca-tl-btn-hov
rf-ca-tl-btn-btn-press'", onmouseup:"this.className='rf-ca-tl-btn
rf-ca-tl-btn-hov'"},
- nextYearControl: function (context) {
- return (!context.calendar.params.disabled ?
CalendarView.getControl(">>", CalendarView.toolButtonAttributes,
"nextYear") : "");
- },
- previousYearControl: function (context) {
- return (!context.calendar.params.disabled ?
CalendarView.getControl("<<", CalendarView.toolButtonAttributes,
"prevYear") : "");
- },
- nextMonthControl: function (context) {
- return (!context.calendar.params.disabled ? CalendarView.getControl(">",
CalendarView.toolButtonAttributes, "nextMonth") : "");
- },
- previousMonthControl: function (context) {
- return (!context.calendar.params.disabled ? CalendarView.getControl("<",
CalendarView.toolButtonAttributes, "prevMonth") : "");
- },
- currentMonthControl: function (context) {
- var text = rf.calendarUtils.formatDate(context.calendar.getCurrentDate(), "MMMM,
yyyy", context.monthLabels, context.monthLabelsShort);
- var markup = context.calendar.params.disabled ?
- new E('div',{className: "rf-ca-tl-btn-dis"},[new T(text)]) :
- CalendarView.getControl(text, CalendarView.toolButtonAttributes,
"showDateEditor");
- return markup;
- },
- todayControl: function (context) {
- return (!context.calendar.params.disabled &&
context.calendar.params.todayControlMode!='hidden' ?
CalendarView.getControl(context.controlLabels.today, CalendarView.toolButtonAttributes,
"today") : "");
- },
- closeControl: function (context) {
- return (context.calendar.params.popup ?
CalendarView.getControl(context.controlLabels.close, CalendarView.toolButtonAttributes,
"close", "false") : "");
- },
- applyControl: function (context) {
- return (!context.calendar.params.disabled && !context.calendar.params.readonly
&& context.calendar.params.showApplyButton ?
CalendarView.getControl(context.controlLabels.apply, CalendarView.toolButtonAttributes,
"close", "true") : "");
- },
- cleanControl: function (context) {
- return (!context.calendar.params.disabled && !context.calendar.params.readonly
&& context.calendar.selectedDate ?
CalendarView.getControl(context.controlLabels.clean, CalendarView.toolButtonAttributes,
"resetSelectedDate") : "");
- },
-
- selectedDateControl: function (context) { return
CalendarView.getSelectedDateControl(context.calendar);},
- timeControl: function (context) { return
CalendarView.getTimeControl(context.calendar);},
- timeEditorFields: function (context) {return context.calendar.timePatternHtml;},
-
- header: [
- new E('table',{'border': '0', 'cellpadding':
'0', 'cellspacing': '0', 'width': '100%'},
- [
- new E('tbody',{},
- [
- new E('tr',{},
- [
- new E('td',{'class': 'rf-ca-tl'},
- [
- new ET(function (context) { return
rf.calendarTemplates.evalMacro("previousYearControl", context)})
- ]),
- new E('td',{'class': 'rf-ca-tl'},
- [
- new ET(function (context) { return
rf.calendarTemplates.evalMacro("previousMonthControl", context)})
- ]),
- new E('td',{'class': 'rf-ca-month'},
- [
- new ET(function (context) { return
rf.calendarTemplates.evalMacro("currentMonthControl", context)})
- ]),
- new E('td',{'class': 'rf-ca-tl'},
- [
- new ET(function (context) { return
rf.calendarTemplates.evalMacro("nextMonthControl", context)})
- ]),
- new E('td',{'class': 'rf-ca-tl'},
- [
- new ET(function (context) { return
rf.calendarTemplates.evalMacro("nextYearControl", context)})
- ]),
- new E('td',{'class': 'rf-ca-tl rf-ca-tl-close',
'style':function(context){return (this.isEmpty ? 'display:none;' :
'');}},
- [
- new ET(function (context) { return
rf.calendarTemplates.evalMacro("closeControl", context)})
- ])
- ])
- ])
- ]
- )],
-
- footer: [
- new E('table',{'border': '0', 'cellpadding':
'0', 'cellspacing': '0', 'width': '100%'},
- [
- new E('tbody',{},
- [
- new E('tr',{},
- [
- new E('td',{'class': 'rf-tl-ftr',
'style':function(context){return (this.isEmpty ? 'display:none;' :
'');}},
- [
- new ET(function (context) { return
rf.calendarTemplates.evalMacro("selectedDateControl", context)})
- ]),
- new E('td',{'class': 'rf-tl-ftr',
'style':function(context){return (this.isEmpty ? 'display:none;' :
'');}},
- [
- new ET(function (context) { return
rf.calendarTemplates.evalMacro("cleanControl", context)})
- ]),
- new E('td',{'class': 'rf-tl-ftr',
'style':function(context){return (this.isEmpty ? 'display:none;' :
'');}},
- [
- new ET(function (context) { return
rf.calendarTemplates.evalMacro("timeControl", context)})
- ]),
- new E('td',{'class': 'rf-tl-ftr', 'style':
'background-image:none;', 'width': '100%'}, []),
- new E('td',{'class': 'rf-tl-ftr',
'style':function(context){return (this.isEmpty ? 'display:none;' :
'')+(context.calendar.params.disabled || context.calendar.params.readonly ||
!context.calendar.params.showApplyButton ? 'background-image:none;' :
'');}},
- [
- new ET(function (context) { return
rf.calendarTemplates.evalMacro("todayControl", context)})
- ]),
- new E('td',{'class': 'rf-tl-ftr',
'style':function(context){return (this.isEmpty ? 'display:none;' :
'')+'background-image:none;';}},
- [
- new ET(function (context) { return
rf.calendarTemplates.evalMacro("applyControl", context)})
- ])
- ])
- ])
- ]
- )],
-
- timeEditorLayout: [
-
- new E('table',{'id': function(context){return
context.calendar.TIME_EDITOR_LAYOUT_ID}, 'border': '0',
'cellpadding': '0', 'cellspacing': '0', 'class':
'rf-ca-time-layout'},
- [
- new E('tbody',{},
- [
- new E('tr',{},
- [
- new E('td',{'class': 'rf-ca-time-layout-fld',
'colspan': '2', 'align': 'center'},
- [
- new ET(function (context) { return
rf.calendarTemplates.evalMacro("timeEditorFields", context)})
- ])
- ]),
- new E('tr',{},
- [
- new E('td',{'class': 'rf-ca-time-layout-ok'},
- [
- new E('div',{'id': function(context){return
context.calendar.TIME_EDITOR_BUTTON_OK}, 'class': 'rf-ca-time-btn',
'style': 'float:right;', 'onmousedown':
"jQuery(this).addClass('rf-ca-time-btn-press');", 'onmouseout':
"jQuery(this).removeClass('rf-ca-time-btn-press');",
'onmouseup':
"jQuery(this).removeClass('rf-ca-time-btn-press');", 'onclick':
function(context){return
"RichFaces.$('"+context.calendar.id+"').hideTimeEditor(true)";}},
- [
- new E('span',{},
- [
- new ET(function (context) { return context.controlLabels.ok; })
- ])
- ])
- ])
- ,
- new E('td',{'class': 'rf-ca-time-layout-cancel'},
- [
- new E('div',{'id': function(context){return
context.calendar.TIME_EDITOR_BUTTON_CANCEL}, 'class': 'rf-ca-time-btn',
'style': 'float:left;', 'onmousedown':
"jQuery(this).addClass('rf-ca-time-btn-press');", 'onmouseout':
"jQuery(this).removeClass('rf-ca-time-btn-press');",
'onmouseup':
"jQuery(this).removeClass('rf-ca-time-btn-press');", 'onclick':
function(context){return
"RichFaces.$('"+context.calendar.id+"').hideTimeEditor(false)";}},
- [
- new E('span',{},
- [
- new ET(function (context) { return context.controlLabels.cancel; })
- ])
- ])
- ])
- ])
- ])
- ]
- )],
-
- dayList: [new ET(function (context) { return context.day})],
- weekNumber: [new ET(function (context) { return context.weekNumber})],
- weekDay: [new ET(function (context) { return context.weekDayLabelShort})]
- };
- // calendar templates end
-
- // calendar context
- var CalendarContext = function(calendar) {
- this.calendar=calendar;
- this.monthLabels=calendar.params.monthLabels;
- this.monthLabelsShort=calendar.params.monthLabelsShort;
- this.weekDayLabels=calendar.params.weekDayLabels;
- this.weekDayLabelsShort=calendar.params.weekDayLabelsShort;
- this.controlLabels=calendar.params.labels;
- };
-
- $.extend(CalendarContext.prototype, {
- nextYearControl: CalendarView.nextYearControl,
- previousYearControl: CalendarView.previousYearControl,
- nextMonthControl: CalendarView.nextMonthControl,
- previousMonthControl: CalendarView.previousMonthControl,
- currentMonthControl: CalendarView.currentMonthControl,
- selectedDateControl: CalendarView.selectedDateControl,
- cleanControl: CalendarView.cleanControl,
- timeControl: CalendarView.timeControl,
- todayControl: CalendarView.todayControl,
- closeControl: CalendarView.closeControl,
- applyControl: CalendarView.applyControl,
- timeEditorFields: CalendarView.timeEditorFields,
- });
-
- // must be :defaultTime, minDaysInFirstWeek, firstWeekday, weekDayLabels,
weekDayLabelsShort, monthLabels, monthLabelsShort
-
- // defaults definition
- var defaultOptions = {
- showWeekDaysBar: true,
- showWeeksBar: true,
- datePattern: "MMM d, yyyy",
- horizontalOffset: 0,
- verticalOffset: 0,
- dayListMarkup: CalendarView.dayList,
- weekNumberMarkup: CalendarView.weekNumber,
- weekDayMarkup: CalendarView.weekDay,
- headerMarkup: CalendarView.header,
- footerMarkup: CalendarView.footer,
- isDayEnabled: function (context) {return true;},
- dayStyleClass: function (context) {return "";},
- showHeader: true,
- showFooter: true,
- direction: "AA",
- jointPoint: "AA",
- popup: true,
- boundaryDatesMode: "inactive",
- todayControlMode: "select",
- style: "",
- className: "",
- disabled: false,
- readonly: false,
- enableManualInput: false,
- showInput: true,
- resetTimeOnDateSelect: false,
- style: "z-index: 3;",
- showApplyButton: false,
- selectedDate: null,
- currentDate: null,
- defaultTime: {hours:12,minutes:0, seconds:0},
- hidePopupOnScroll: true
- };
-
- var defaultLabels = {apply:'Apply', today:'Today',
clean:'Clean', ok:'OK', cancel:'Cancel', close:'x'};
-
- // Constructor definition
- rf.ui.Calendar = function(componentId, locale, options, markups) {
-
- // dayListMarkup - day cell markup
- // context: {day, date, weekNumber, weekDayNumber, isWeekend, isCurrentMonth,
elementId, component}
- // weekNumberMarkup - week number cell markup
- // context: {weekNumber, elementId, component}
- // weekDayMarkup - week day cell markup
- // context: {weekDayLabel, weekDayLabelShort, weekDayNumber, isWeekend, elementId,
component}
-
- // headerMarkup
- // footerMarkup
- // optionalHeaderMarkup - user defined header (optional)
- // optionalFooterMarkup - user defined footer (optional)
-
- // currentDate - date to show month (day not used) (MM/yyyy)
- // selectedDate - selected date (mm/dd/yyyy)
- // weekDayLabels - collection of week day labels keyed by week day numbers
- // weekDayLabelsShort - collection of week day short labels keyed by week day numbers
- // minDaysInFirstWeek - locale-specific constant defining number of days in the first
week
- // firstWeekDay - (0..6) locale-specific constant defining number of the first week
day
- // showWeekDaysBar - show WeekDays Bar [default value is true]
- // showWeeksBar - show Weeks numbers bar [default value is true]
- // showApplyButton
- // showHeader
- // showFooter
-
- // POPUP description
- // direction - [top-left, top-right, bottom-left, bottom-right, auto]
- // jointPoint - [top-left, top-right, bottom-left, bottom-right]
- // popup - true
- // id+PopupButton, id+InputDate,
-
- // boundaryDatesMode - boundary dates onclick action:
- // "inactive" or undefined - no action (default)
- // "scroll" - change current month
- // "select" - change current month and select date
- //
- // todayControlMode - today control onclick action:
- // "scroll"
- // "select"
- // "hidden"
-
- // isDayEnabled - end-developer JS function
- // dayStyleClass - end-developer JS function that provide style class for day's
cells.
-
- // dayCellClass - add div to day cell with class 'rf-ca-c-div' and add this
class to TD if defined
- // style - table style
- // styleClass - table class
-
- // disabled
- // readonly
-
- //var _d = new Date();
-
- // call constructor of parent class
- $super.constructor.call(this, componentId);
-
- this.namespace = "."+rf.Event.createNamespace(this.name, componentId);
-
- //create parameters
- //this.options = $.extend(this.options, defaultOptions, options);
- this.params = $.extend({}, defaultOptions, locales[locale], options, markups);
-
- // labels
- var value = options.labels || {};
- for (var name in defaultLabels) {
- if (!value[name]) value[name] = defaultLabels[name];
- }
- this.params.labels = value;
-
- this.popupOffset = {dx:this.params.horizontalOffset, dy:this.params.verticalOffset};
-
- //
- if (!this.params.popup) this.params.showApplyButton = false;
-
- //
- this.params.boundaryDatesMode = this.params.boundaryDatesMode.toLowerCase();
- this.params.todayControlMode = this.params.todayControlMode.toLowerCase();
-
- // time
- this.setTimeProperties();
-
- this.customDayListMarkup = (this.params.dayListMarkup!=CalendarView.dayList);
-
- this.currentDate = this.params.currentDate ? this.params.currentDate :
(this.params.selectedDate ? this.params.selectedDate : new Date());
- this.currentDate.setDate(1);
- this.selectedDate = this.params.selectedDate;
-
- this.todayDate = new Date();
-
- this.firstWeekendDayNumber = 6-this.params.firstWeekDay;
- this.secondWeekendDayNumber = (this.params.firstWeekDay>0 ?
7-this.params.firstWeekDay : 0);
-
- this.calendarContext = new CalendarContext(this);
-
- // TODO: move it from constructor
- this.DATE_ELEMENT_ID = this.id+'DayCell';
- this.WEEKNUMBER_BAR_ID = this.id+"WeekNum";
- this.WEEKNUMBER_ELEMENT_ID = this.WEEKNUMBER_BAR_ID+'Cell';
- this.WEEKDAY_BAR_ID = this.id+"WeekDay";
- this.WEEKDAY_ELEMENT_ID = this.WEEKDAY_BAR_ID+'Cell';
- this.POPUP_ID = this.id+'Popup';
- this.POPUP_BUTTON_ID = this.id+'PopupButton';
- this.INPUT_DATE_ID = this.id+'InputDate';
- this.EDITOR_ID = this.id+'Editor';
- this.EDITOR_SHADOW_ID = this.id+'EditorShadow';
-
- this.TIME_EDITOR_LAYOUT_ID = this.id+'TimeEditorLayout';
- this.DATE_EDITOR_LAYOUT_ID = this.id+'DateEditorLayout';
- this.EDITOR_LAYOUT_SHADOW_ID = this.id+'EditorLayoutShadow';
- this.TIME_EDITOR_BUTTON_OK = this.id+'TimeEditorButtonOk';
- this.TIME_EDITOR_BUTTON_CANCEL = this.id+'TimeEditorButtonCancel';
- this.DATE_EDITOR_BUTTON_OK = this.id+'DateEditorButtonOk';
- this.DATE_EDITOR_BUTTON_CANCEL = this.id+'DateEditorButtonCancel';
- this.CALENDAR_CONTENT = this.id+"Content";
-
- this.firstDateIndex = 0;
-
- this.daysData = {startDate:null, days:[]};
- this.days = [];
- this.todayCellId = null;
- this.todayCellColor = "";
-
- this.selectedDateCellId = null;
- this.selectedDateCellColor = "";
-
- var popupStyles = "";
- this.isVisible = true;
- if (this.params.popup==true)
- {
- // popup mode initialisation
- popupStyles = "display:none; position:absolute;"
- this.isVisible = false;
- }
-
- var tempStr = "RichFaces.$('"+this.id+"').";
-
- var htmlTextHeader = '<table id="'+this.CALENDAR_CONTENT+'"
border="0" cellpadding="0" cellspacing="0"
class="rf-ca-extr rf-ca-popup '+this.params.styleClass+'"
style="'+popupStyles+this.params.style+'"
onclick="'+tempStr+'skipEventOnCollapse=true;"><tbody>';
- var colspan = (this.params.showWeeksBar ? "8" : "7");
- var htmlHeaderOptional = (this.params.optionalHeaderMarkup) ? '<tr><td
class="rf-ca-hdr-optnl" colspan="'+colspan+'"
id="'+this.id+'HeaderOptional"></td></tr>' :
'';
- var htmlFooterOptional = (this.params.optionalFooterMarkup) ? '<tr><td
class="rf-ca-ftr-optl" colspan="'+colspan+'"
id="'+this.id+'FooterOptional"></td></tr>' :
'';
- var htmlControlsHeader = (this.params.showHeader ? '<tr><td
class="rf-ca-hdr" colspan="'+colspan+'"
id="'+this.id+'Header"></td></tr>' : '');
- var htmlControlsFooter = (this.params.showFooter ? '<tr><td
class="rf-ca-ftr" colspan="'+colspan+'"
id="'+this.id+'Footer"></td></tr>' : '');
- var htmlTextFooter = '</tbody></table>'
-
- // days bar creation
- var styleClass;
- var bottomStyleClass;
- var htmlTextWeekDayBar=[];
- var context;
-
- var eventsStr = this.params.disabled || this.params.readonly ? '' :
'onclick="'+tempStr+'eventCellOnClick(event, this);"
onmouseover="'+tempStr+'eventCellOnMouseOver(event, this);"
onmouseout="'+tempStr+'eventCellOnMouseOut(event, this);"';
- if (this.params.showWeekDaysBar)
- {
- htmlTextWeekDayBar.push('<tr
id="'+this.WEEKDAY_BAR_ID+'">');
- if (this.params.showWeeksBar) htmlTextWeekDayBar.push('<td
class="rf-ca-days"><br/></td>');
- var weekDayCounter = this.params.firstWeekDay;
- for (var i=0;i<7;i++)
- {
- context = {weekDayLabel: this.params.weekDayLabels[weekDayCounter],
weekDayLabelShort: this.params.weekDayLabelsShort[weekDayCounter],
weekDayNumber:weekDayCounter, isWeekend:this.isWeekend(i),
elementId:this.WEEKDAY_ELEMENT_ID+i, component:this};
- var weekDayHtml = this.evaluateMarkup(this.params.weekDayMarkup, context );
- if (weekDayCounter==6) weekDayCounter=0; else weekDayCounter++;
-
- styleClass = "rf-ca-days";
- if (context.isWeekend)
- {
- styleClass += " rf-ca-weekends";
- }
- if (i==6) styleClass += " rf-rgh-cell";
- htmlTextWeekDayBar.push('<td class="'+styleClass+'"
id="'+context.elementId+'">'+weekDayHtml+'</td>');
- }
- htmlTextWeekDayBar.push('</tr>\n');
- }
-
- // week & weekNumber creation
- var htmlTextWeek=[];
- var p=0;
- this.dayCellClassName = [];
-
- for (k=1;k<7;k++)
- {
- bottomStyleClass = (k==6 ? "rf-btm-c " : "");
- htmlTextWeek.push('<tr
id="'+this.WEEKNUMBER_BAR_ID+k+'">');
- if (this.params.showWeeksBar)
- {
- context = {weekNumber: k, elementId:this.WEEKNUMBER_ELEMENT_ID+k, component:this};
- var weekNumberHtml = this.evaluateMarkup(this.params.weekNumberMarkup, context );
- htmlTextWeek.push('<td class="rf-ca-week
'+bottomStyleClass+'"
id="'+context.elementId+'">'+weekNumberHtml+'</td>');
- }
-
- // day cells creation
- for (var i=0;i<7;i++)
- {
- styleClass = bottomStyleClass+(!this.params.dayCellClass ? "rf-ca-c-size" :
(!this.customDayListMarkup ? this.params.dayCellClass : ""))+"
rf-ca-c";
- if (i==this.firstWeekendDayNumber || i==this.secondWeekendDayNumber)
styleClass+=" rf-ca-holly";
- if (i==6) styleClass+=" rf-rgh-c";
-
- this.dayCellClassName.push(styleClass);
- htmlTextWeek.push('<td class="'+styleClass+'"
id="'+this.DATE_ELEMENT_ID+p+'" '+
- eventsStr+
- '>'+(this.customDayListMarkup ? '<div
class="rf-ca-c-div'+(this.params.dayCellClass ? '
'+this.params.dayCellClass : '')+'"></div>' :
'')+'</td>');
- p++;
- }
- htmlTextWeek.push('</tr>');
- }
-
- var div = rf.getDomElement(this.CALENDAR_CONTENT);
- div =
$(div).replaceWith(htmlTextHeader+htmlHeaderOptional+htmlControlsHeader+htmlTextWeekDayBar.join('')+htmlTextWeek.join('')+htmlControlsFooter+htmlFooterOptional+htmlTextFooter);
- this.attachToDom(this.id); // TODO: optimize double $
-
- // memory leaks fix // from old 3.3.x code, may be not needed now
- div = null;
-
- // add onclick event handlers to input field and popup button
- if (this.params.popup && !this.params.disabled)
- {
- var handler = new Function ('event',
"RichFaces.$('"+this.id+"').doSwitch();");
- rf.Event.bindById(this.POPUP_BUTTON_ID, "click"+this.namespace, handler,
this);
- if (!this.params.enableManualInput)
- {
- rf.Event.bindById(this.INPUT_DATE_ID, "click"+this.namespace, handler,
this);
- }
- }
-
- this.scrollElements = null;
-
- //alert(new Date().getTime()-_d.getTime());
-
- };
-
- // Extend component class and add protected methods from parent class to our container
- rf.BaseComponent.extend(rf.ui.Calendar);
-
- // define super class link
- var $super = rf.ui.Calendar.$super;
-
- // static methods definition
- var locales = {};
-
- rf.ui.Calendar.addLocale = function (locale, symbols) {
- if (!locales[locale]) {
- locales[locale] = symbols;
- }
- };
-
- /*
- * Prototype definition
- */
- $.extend(rf.ui.Calendar.prototype, {
- name: "Calendar",
- destructor: function()
- {
- if (this.params.popup && this.isVisible)
- {
- this.scrollElements &&
rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
- this.scrollElements = null;
- rf.Event.unbind(window.document, "click"+this.namespace);
- }
- },
-
- dateEditorSelectYear: function(value)
- {
- if (this.dateEditorYearID)
- {
- $(rf.getDomElement(this.dateEditorYearID)).removeClass('rf-ca-edtr-btn-sel');
- }
- this.dateEditorYear = this.dateEditorStartYear + value;
- this.dateEditorYearID = this.DATE_EDITOR_LAYOUT_ID+'Y'+value;
- $(rf.getDomElement(this.dateEditorYearID)).addClass('rf-ca-edtr-btn-sel');
- },
-
- dateEditorSelectMonth: function(value)
- {
- this.dateEditorMonth = value;
- $(rf.getDomElement(this.dateEditorMonthID)).removeClass('rf-ca-edtr-btn-sel');
- this.dateEditorMonthID = this.DATE_EDITOR_LAYOUT_ID+'M'+value;
- $(rf.getDomElement(this.dateEditorMonthID)).addClass('rf-ca-edtr-btn-sel');
- },
-
- scrollEditorYear: function(value)
- {
- var element = rf.getDomElement(this.DATE_EDITOR_LAYOUT_ID+'TR');
-
- if (this.dateEditorYearID)
- {
- $(rf.getDomElement(this.dateEditorYearID)).removeClass('rf-ca-edtr-btn-sel');
- this.dateEditorYearID='';
- }
-
- if (!value)
- {
- // update month selection when open editor (value == 0)
- if (this.dateEditorMonth != this.getCurrentMonth())
- {
- this.dateEditorMonth = this.getCurrentMonth();
- $(rf.getDomElement(this.dateEditorMonthID)).removeClass('rf-ca-edtr-btn-sel');
- this.dateEditorMonthID =
this.DATE_EDITOR_LAYOUT_ID+'M'+this.dateEditorMonth;
- $(rf.getDomElement(this.dateEditorMonthID)).addClass('rf-ca-edtr-btn-sel');
- }
- }
-
- if (element)
- {
- var div;
- var year = this.dateEditorStartYear = this.dateEditorStartYear+value*10;
- for (var i=0;i<5;i++)
- {
- element = element.nextSibling;
- div = element.firstChild.nextSibling.nextSibling;
- div.firstChild.innerHTML=year;
- if (year == this.dateEditorYear)
- {
- $(div.firstChild).addClass('rf-ca-edtr-btn-sel');
- this.dateEditorYearID = div.firstChild.id;
- }
- div = div.nextSibling;
- div.firstChild.innerHTML=year+5;
- if (year+5 == this.dateEditorYear)
- {
- $(div.firstChild).addClass('rf-ca-edtr-btn-sel');
- this.dateEditorYearID = div.firstChild.id;
- }
- year++;
- }
- }
- },
-
- updateDateEditor: function()
- {
- this.dateEditorYear = this.getCurrentYear();
- this.dateEditorStartYear = this.getCurrentYear() - 4;
- this.scrollEditorYear(0);
- },
-
- updateTimeEditor: function()
- {
- var th=rf.getDomElement(this.id+'TimeHours');
- var ts=rf.getDomElement(this.id+'TimeSign');
- var tm=rf.getDomElement(this.id+'TimeMinutes');
-
- var h = this.selectedDate.getHours();
- var m = this.selectedDate.getMinutes();
- if (this.timeType==2)
- {
- var a = (h<12 ? 'AM' : 'PM');
- ts.value = a;
- h = (h==0 ? '12' : (h>12 ? h-12 : h));
- }
- th.value = (this.timeHoursDigits==2 && h<10 ? '0'+h : h);
- tm.value = (m<10 ? '0'+m : m);
-
- if (this.showSeconds) {
- var tsec=rf.getDomElement(this.id+'TimeSeconds');
- var s = this.selectedDate.getSeconds();
- tsec.value = (s<10 ? '0'+s : s);
- }
- },
-
-
- createEditor: function()
- {
- var element = $(rf.getDomElement(this.CALENDAR_CONTENT));
- var zindex = parseInt(element.css('z-index'), 10);
- var htmlBegin = '<div id="'+this.EDITOR_SHADOW_ID+'"
class="rf-ca-edtr-shdw" style="position:absolute;
display:none;z-index:'+zindex+'"></div><table
border="0" cellpadding="0" cellspacing="0"
id="'+this.EDITOR_ID+'" style="position:absolute;
display:none;z-index:'+(zindex+1)+'"
onclick="RichFaces.$(\''+this.id+'\').skipEventOnCollapse=true;"><tbody><tr><td
class="rf-ca-edtr-cntr" align="center"><div
style="position:relative; width:100%">';
- var htmlContent = '<div id="'+this.EDITOR_LAYOUT_SHADOW_ID+'"
class="rf-ca-edtr-layout-shdw"></div>';
-
- var htmlEnd =
'</div></td></tr></tbody></table>';
- element.after(htmlBegin+htmlContent+htmlEnd);
-
- this.isEditorCreated = true;
-
- return rf.getDomElement(this.EDITOR_ID);
- },
-
- createTimeEditorLayout: function(editor)
- {
- $(rf.getDomElement(this.EDITOR_LAYOUT_SHADOW_ID)).after(this.evaluateMarkup(CalendarView.timeEditorLayout,
this.calendarContext));
-
- var th=rf.getDomElement(this.id+'TimeHours');
- var ts;
- var tm=rf.getDomElement(this.id+'TimeMinutes');
- if (this.timeType==1)
- {
- sbjQuery(th).SpinButton({digits:this.timeHoursDigits,min:0,max:23});
- }
- else
- {
- sbjQuery(th).SpinButton({digits:this.timeHoursDigits,min:1,max:12});
- ts=rf.getDomElement(this.id+'TimeSign');
- sbjQuery(ts).SpinButton({});
- }
- sbjQuery(tm).SpinButton({digits:2,min:0,max:59});
- if (this.showSeconds) {
- var tsec=rf.getDomElement(this.id+'TimeSeconds');
- sbjQuery(tsec).SpinButton({digits:2,min:0,max:59});
- }
-
- this.correctEditorButtons(editor, this.TIME_EDITOR_BUTTON_OK,
this.TIME_EDITOR_BUTTON_CANCEL);
-
- this.isTimeEditorLayoutCreated = true;
- },
-
- correctEditorButtons: function(editor, buttonID1, buttonID2)
- {
- var button1 = rf.getDomElement(buttonID1);
- var button2 = rf.getDomElement(buttonID2);
- editor.style.visibility = "hidden";
- editor.style.display = "";
- var width1 = $(button1.firstChild).width();
- var width2 = $(button2.firstChild).width();
- editor.style.display = "none";
- editor.style.visibility = "";
-
- if (width1!=width2)
- {
- button1.style.width = button2.style.width = (width1>width2 ? width1 :
width2)+"px";
- }
- },
-
- createDECell: function(id, value, buttonType, param, className)
- {
- if (buttonType==0)
- {
- return '<div id="'+id+'"
class="rf-ca-edtr-btn'+(className ? ' '+className : '')+
- '"
onmouseover="this.className=\'rf-ca-edtr-btn rf-ca-edtr-tl-over\';"
onmouseout="this.className=\'rf-ca-edtr-btn\';"
onmousedown="this.className=\'rf-ca-edtr-btn rf-ca-edtr-tl-press\';"
onmouseup="this.className=\'rf-ca-edtr-btn rf-ca-edtr-tl-over\';"
onclick="RichFaces.$(\''+this.id+'\').scrollEditorYear('+param+');">'+value+'</div>';
- }
- else
- {
- var onclick = (buttonType==1 ?
'RichFaces.$(\''+this.id+'\').dateEditorSelectMonth('+param+');':
-
'RichFaces.$(\''+this.id+'\').dateEditorSelectYear('+param+');'
);
- return '<div id="'+id+'"
class="rf-ca-edtr-btn'+(className ? ' '+className : '')+
- '"
onmouseover="jQuery(this).addClass(\'rf-ca-edtr-btn-over\');"
onmouseout="$(this).removeClass(\'rf-ca-edtr-btn-over\');"
onclick="'+onclick+'">'+value+'</div>';
- }
- },
-
- createDateEditorLayout: function(editor)
- {
- var htmlBegin = '<table id="'+this.DATE_EDITOR_LAYOUT_ID+'"
class="rf-ca-date-layout" border="0" cellpadding="0"
cellspacing="0"><tbody><tr
id="'+this.DATE_EDITOR_LAYOUT_ID+'TR">';
- var htmlEnd = '</tr></tbody></table>';
- var month = 0;
- this.dateEditorYear = this.getCurrentYear();
- var year = this.dateEditorStartYear = this.dateEditorYear-4;
- var htmlContent = '<td
align="center">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+month,
this.params.monthLabelsShort[month], 1, month)+'</td>'
- +'<td align="center"
class="rf-ca-date-layout-split">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+(month+6),
this.params.monthLabelsShort[month+6], 1, month+6)+'</td>'
- +'<td
align="center">'+this.createDECell('','<', 0,
-1)+'</td>'
- +'<td
align="center">'+this.createDECell('','>', 0,
1)+'</td>';
- month++;
-
- for (var i=0;i<5;i++)
- {
- htmlContent+='</tr><tr><td
align="center">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+month,
this.params.monthLabelsShort[month], 1, month)+'</td>'
- +'<td align="center"
class="rf-ca-date-layout-split">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'M'+(month+6),
this.params.monthLabelsShort[month+6], 1, month+6)+'</td>'
- +'<td
align="center">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'Y'+i,
year, 2, i, (i==4 ? 'rf-ca-edtr-btn-sel' : ''))+'</td>'
- +'<td
align="center">'+this.createDECell(this.DATE_EDITOR_LAYOUT_ID+'Y'+(i+5),
year+5, 2, i+5)+'</td>';
- month++;
- year++;
- }
- this.dateEditorYearID = this.DATE_EDITOR_LAYOUT_ID+'Y4';
- this.dateEditorMonth = this.getCurrentMonth();
- this.dateEditorMonthID = this.DATE_EDITOR_LAYOUT_ID+'M'+this.dateEditorMonth;
-
- htmlContent+='</tr><tr><td colspan="2"
class="rf-ca-date-layout-ok">'+
- '<div id="'+this.DATE_EDITOR_BUTTON_OK+'"
class="rf-ca-time-btn" style="float:right;"
onmousedown="jQuery(this).addClass(\'rf-ca-time-btn-press\');"
onmouseout="$(this).removeClass(\'rf-ca-time-btn-press\');"
onmouseup="$(this).removeClass(\'rf-ca-time-btn-press\');"
onclick="RichFaces.$(\''+this.id+'\').hideDateEditor(true);"><span>'+this.params.labels.ok+'</span></div>'+
- '</td><td colspan="2"
class="rf-ca-date-layout-cancel">'+
- '<div id="'+this.DATE_EDITOR_BUTTON_CANCEL+'"
class="rf-ca-time-btn" style="float:left;"
onmousedown="jQuery(this).addClass(\'rf-ca-time-btn-press\');"
onmouseout="$(this).removeClass(\'rf-ca-time-btn-press\');"
onmouseup="$(this).removeClass(\'rf-ca-time-btn-press\');"
onclick="RichFaces.$(\''+this.id+'\').hideDateEditor(false);"><span>'+this.params.labels.cancel+'</span></div>'+
- '</td>';
-
-
- $(rf.getDomElement(this.EDITOR_LAYOUT_SHADOW_ID)).after(htmlBegin+htmlContent+htmlEnd);
-
- $(rf.getDomElement(this.dateEditorMonthID)).addClass('rf-ca-edtr-btn-sel');
-
- this.correctEditorButtons(editor, this.DATE_EDITOR_BUTTON_OK,
this.DATE_EDITOR_BUTTON_CANCEL);
-
- this.isDateEditorLayoutCreated = true;
- },
-
- createSpinnerTable: function(id) {
- return '<table cellspacing="0" cellpadding="0"
border="0"><tbody><tr>'+
- '<td class="rf-ca-sp-inp-ctnr">'+
- '<input id="' + id + '" name="' + id +
'" class="rf-ca-sp-inp" type="text" />'+
- '</td>'+
- '<td class="rf-ca-sp-btn">'+
- '<table border="0" cellspacing="0"
cellpadding="0"><tbody>'+
- '<tr><td>'+
- '<div id="'+id+'BtnUp"
class="rf-ca-sp-up"'+
- ' onmousedown="this.className=\'rf-ca-sp-up
rf-ca-sp-press\'"'+
- ' onmouseup="this.className=\'rf-ca-sp-up\'"'+
- '
onmouseout="this.className=\'rf-ca-sp-up\'"><span></span></div>'+
- '</td></tr>'+
- '<tr><td>'+
- '<div id="'+id+'BtnDown"
class="rf-ca-sp-down"'+
- ' onmousedown="this.className=\'rf-ca-sp-down
rf-ca-sp-press\'"'+
- ' onmouseup="this.className=\'rf-ca-sp-down\'"'+
- '
onmouseout="this.className=\'rf-ca-sp-down\'"><span></span></div>'+
- '</td></tr>'+
- '</tbody></table>'+
- '</td>'+
- '</tr></tbody></table>';
- },
-
- setTimeProperties: function() {
- this.timeType = 0;
-
- var dateTimePattern = this.params.datePattern;
- var pattern = [];
- var re = /(\\\\|\\[yMdaHhms])|(y+|M+|d+|a|H{1,2}|h{1,2}|m{2}|s{2})/g;
- var r;
- while (r = re.exec(dateTimePattern))
- if (!r[1])
- pattern.push({str:r[0],marker:r[2],idx:r.index});
-
- var datePattern = "";
- var timePattern = "";
-
- var digits,h,hh,m,s,a;
- var id = this.id;
-
- var getString = function (p) {
- return (p.length==0 ? obj.marker :
dateTimePattern.substring(pattern[i-1].str.length+pattern[i-1].idx,
obj.idx+obj.str.length));
- };
-
- for (var i=0;i<pattern.length;i++)
- {
- var obj = pattern[i];
- var ch = obj.marker.charAt(0);
- if (ch=='y'||ch=='M'||ch=='d')
datePattern+=getString(datePattern);
- else if (ch=='a')
- {
- a=true;
- timePattern+=getString(timePattern);
- }
- else if (ch=='H')
- {
- h=true;
- digits=obj.marker.length;
- timePattern+=getString(timePattern);
- }
- else if (ch=='h')
- {
- hh=true;
- digits=obj.marker.length;
- timePattern+=getString(timePattern);
- }
- else if (ch=='m')
- {
- m=true;
- timePattern+=getString(timePattern);
- }
- else if (ch=='s')
- {
- this.showSeconds=true;
- timePattern+=getString(timePattern);
- }
-
-
- }
- this.datePattern = datePattern;
- this.timePattern = timePattern;
-
- var calendar = this;
-
- this.timePatternHtml =
timePattern.replace(/(\\\\|\\[yMdaHhms])|(H{1,2}|h{1,2}|m{2}|s{2}|a)/g,
- function($1,$2,$3) {
- if ($2) return $2.charAt(1);
- switch ($3) {
- case 'a' : return
'</td><td>'+calendar.createSpinnerTable(id+'TimeSign')+'</td><td>';
- case 'H' :
- case 'HH' :
- case 'h' :
- case 'hh' : return
'</td><td>'+calendar.createSpinnerTable(id+'TimeHours')+'</td><td>';
- case 'mm' : return
'</td><td>'+calendar.createSpinnerTable(id+'TimeMinutes')+'</td><td>';
- case 'ss' : return
'</td><td>'+calendar.createSpinnerTable(id+'TimeSeconds')+'</td><td>';
- }
- }
- );
-
- this.timePatternHtml = '<table border="0"
cellpadding="0"><tbody><tr><td>'+this.timePatternHtml+'</td></tr></tbody></table>';
-
- if (m && h)
- {
- this.timeType = 1;
- }
- else if (m && hh && a)
- {
- this.timeType = 2;
- }
- this.timeHoursDigits = digits;
- },
-
- eventOnScroll: function (e) {
- this.doCollapse();
- },
-
- doCollapse: function() {
-
- if (!this.params.popup || !this.isVisible) return;
-
- if (this.invokeEvent("collapse", rf.getDomElement(this.id)))
- {
- if (this.isEditorVisible) this.hideEditor();
- this.scrollElements &&
rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
- this.scrollElements = null;
- rf.Event.unbind(window.document, "click"+this.namespace);
-
- $(rf.getDomElement(this.CALENDAR_CONTENT)).hide();
- this.isVisible = false;
-
- }
- },
-
- collapse: function() {
- this.doCollapse();
- },
-
- doExpand: function(e) {
- if (!this.isRendered) {
- this.isRendered = true;
- this.render();
- }
- this.skipEventOnCollapse = false;
- if (e && e.type=='click') this.skipEventOnCollapse = true;
- if (!this.params.popup || this.isVisible) return;
-
- var element = rf.getDomElement(this.id);
-
- if (this.invokeEvent("expand", element, e))
- {
- var base = rf.getDomElement(this.POPUP_ID)
- var baseInput = base.firstChild;
- var baseButton = baseInput.nextSibling;
-
- if (baseInput && baseInput.value!=undefined)
- {
- this.selectDate(baseInput.value, false, {event:e, element:element});
- }
-
- //rect calculation
-
- if (this.params.showInput)
- {
- base = base.children;
- } else {
- base = baseButton;
- };
-
- $(rf.getDomElement(this.CALENDAR_CONTENT)).setPosition(base,
{type:"DROPDOWN", from: this.params.jointPoint, to:this.params.direction,
offset: this.popupOffset}).show();
-
- this.isVisible = true;
-
- rf.Event.bind(window.document, "click"+this.namespace,
this.eventOnCollapse, this);
-
- this.scrollElements &&
rf.Event.unbindScrollEventHandlers(this.scrollElements, this);
- this.scrollElements = null;
- if (this.params.hidePopupOnScroll) {
- this.scrollElements = rf.Event.bindScrollEventHandlers(element, this.eventOnScroll,
this);
- }
- }
- },
-
- expand: function(e) {
- this.doExpand(e);
- },
-
- doSwitch: function(e) {
- this.isVisible ? this.doCollapse() : this.doExpand(e);
- },
-
- switchState: function(e) {
- this.doSwitch(e);
- },
-
- eventOnCollapse: function (e) {
- if (this.skipEventOnCollapse)
- {
- this.skipEventOnCollapse = false;
- return true;
- }
-
- if (e.target.id == this.POPUP_BUTTON_ID || (!this.params.enableManualInput &&
e.target.id == this.INPUT_DATE_ID) ) return true;
-
- this.doCollapse();
-
- return true;
- },
-
- setInputField: function(dateStr, event)
- {
- var field = rf.getDomElement(this.INPUT_DATE_ID);
- if (field.value!=dateStr)
- {
- field.value=dateStr;
- this.invokeEvent("changed",field, event, this.selectedDate);
- }
- },
-
- getCurrentDate: function() {
- return this.currentDate;
- },
- getSelectedDate: function() {
- if (!this.selectedDate) return null; else return this.selectedDate;
- },
- getSelectedDateString: function(pattern) {
- if (!this.selectedDate) return "";
- if (!pattern) pattern = this.params.datePattern;
- return rf.calendarUtils.formatDate(this.selectedDate, pattern,
this.params.monthLabels, this.params.monthLabelsShort);
- },
-
- getPrevYear: function() {
- var value = this.currentDate.getFullYear()-1;
- if (value<0) value = 0;
- return value;
- },
- getPrevMonth: function(asMonthLabel) {
- var value = this.currentDate.getMonth()-1;
- if (value < 0 ) value = 11;
- if (asMonthLabel)
- {
- return this.params.monthLabels[value];
- } else return value;
- },
- getCurrentYear: function() {
- return this.currentDate.getFullYear();
- },
- getCurrentMonth: function(asMonthLabel) {
- var value = this.currentDate.getMonth();
- if (asMonthLabel)
- {
- return this.params.monthLabels[value];
- } else return value;
- },
- getNextYear: function() {
- return this.currentDate.getFullYear()+1;
- },
- getNextMonth: function(asMonthLabel) {
- var value = this.currentDate.getMonth()+1;
- if (value > 11 ) value = 0;
- if (asMonthLabel)
- {
- return this.params.monthLabels[value];
- } else return value;
- },
-
- isWeekend: function(weekday) {
- return (weekday == this.firstWeekendDayNumber || weekday ==
this.secondWeekendDayNumber);
- },
-
- setupTimeForDate: function (date) {
- if (this.selectedDate && (!this.params.resetTimeOnDateSelect ||
- (this.selectedDate.getFullYear() == date.getFullYear() &&
- this.selectedDate.getMonth() == date.getMonth() &&
- this.selectedDate.getDate() == date.getDate())))
- {
- date.setHours(this.selectedDate.getHours());
- date.setMinutes(this.selectedDate.getMinutes());
- date.setSeconds(this.selectedDate.getSeconds());
- } else
- {
- date.setHours(this.params.defaultTime.hours);
- date.setMinutes(this.params.defaultTime.minutes);
- date.setSeconds(this.params.defaultTime.seconds);
- }
- },
-
- eventCellOnClick: function (e, obj) {
- var daydata = this.days[parseInt(obj.id.substr(this.DATE_ELEMENT_ID.length),10)];
- if (daydata.enabled && daydata._month==0)
- {
- var date=new Date(this.currentDate);
- date.setDate(daydata.day);
- if (this.timeType)
- {
- this.setupTimeForDate(date);
- }
-
- if (this.selectDate(date,true, {event:e, element:obj}) &&
!this.params.showApplyButton)
- {
- this.doCollapse();
- }
-
- } else if (daydata._month!=0){
- if (this.params.boundaryDatesMode == "scroll")
- if (daydata._month==-1) this.prevMonth(); else this.nextMonth();
- else if (this.params.boundaryDatesMode == "select")
- {
- var date = new Date(daydata.date);
- if (this.timeType)
- {
- this.setupTimeForDate(date);
- }
-
- if (this.selectDate(date, false, {event:e, element:obj}) &&
!this.params.showApplyButton)
- {
- this.doCollapse();
- }
- }
- }
- },
-
- eventCellOnMouseOver: function (e, obj) {
- var daydata = this.days[parseInt(obj.id.substr(this.DATE_ELEMENT_ID.length),10)];
- if (this.invokeEvent("datemouseover", obj, e, daydata.date) &&
daydata.enabled)
- {
- if (daydata._month==0 && obj.id!=this.selectedDateCellId &&
obj.id!=this.todayCellId) {
- $(obj).addClass('rf-ca-hov');
- }
- }
- },
-
- eventCellOnMouseOut: function (e, obj) {
- var daydata = this.days[parseInt(obj.id.substr(this.DATE_ELEMENT_ID.length),10)];
- if (this.invokeEvent("datemouseout", obj, e, daydata.date) &&
daydata.enabled)
- {
- if (daydata._month==0 && obj.id!=this.selectedDateCellId &&
obj.id!=this.todayCellId) {
- $(obj).removeClass('rf-ca-hov');
- }
- }
- },
-
- load:function(daysData, isAjaxMode) {
- // startDate,
- // daysData:array[]
- // {
- // day
- // enabled boolean
- // text1: 'Meeting...',
- // text2: 'Meeting...'
- // tooltip
- // hasTooltip
- // styleClass
- // }
-
-
- if (daysData) {
- this.daysData = this.indexData(daysData, isAjaxMode);
- } else {
- this.daysData = null;
- }
-
- this.isRendered = false;
- if (this.isVisible) {
- this.render();
- };
-
- if (typeof this.afterLoad=='function')
- {
- this.afterLoad();
- this.afterLoad=null;
- }
- },
-
- indexData:function(daysData, isAjaxMode) {
- var dateYear = daysData.startDate.getFullYear();
- var dateMonth = daysData.startDate.getMonth();
-
- daysData.index = [];
- daysData.index[dateYear+'-'+dateMonth] = 0;
- if (isAjaxMode)
- {
- this.currentDate = daysData.startDate;
- this.currentDate.setDate(1);
- return daysData;
- }
- var idx =
rf.calendarUtils.daysInMonthByDate(daysData.startDate)-daysData.startDate.getDate()+1;
-
- while (daysData.days[idx])
- {
- if (dateMonth==11) {dateYear++; dateMonth=0;} else dateMonth++;
- daysData.index[dateYear+'-'+dateMonth] = idx;
- idx+= (32 - new Date(dateYear, dateMonth, 32).getDate());
- }
- return daysData;
- },
-
- getCellBackgroundColor: function(element)
- {
- return $(element).css('background-color');
- },
-
- clearEffect: function (element_id, className, className1)
- {
- if (element_id)
- {
- var e = $(rf.getDomElement(element_id)).stop(true, true);
- if (className) e.removeClass(className);
- if (className1) e.addClass(className1);
- }
- return null;
- },
-
- render:function() {
- //var _d=new Date();
- this.isRendered = true;
- this.todayDate = new Date();
-
- var currentYear = this.getCurrentYear();
- var currentMonth = this.getCurrentMonth();
-
- var todayflag = (currentYear == this.todayDate.getFullYear() && currentMonth
== this.todayDate.getMonth());
- var todaydate = this.todayDate.getDate();
-
- var selectedflag = this.selectedDate && (currentYear ==
this.selectedDate.getFullYear() && currentMonth == this.selectedDate.getMonth())
- var selecteddate = this.selectedDate && this.selectedDate.getDate();
-
- var wd = rf.calendarUtils.getDay(this.currentDate, this.params.firstWeekDay);
- var currentMonthDays = rf.calendarUtils.daysInMonthByDate(this.currentDate);
- var previousMonthDays = rf.calendarUtils.daysInMonth(currentYear, currentMonth-1);
-
- var p=0;
- var month=-1;
- this.days = [];
- var dayCounter = previousMonthDays - wd + 1;
-
- // previuos month days
- if (wd>0) while (dayCounter<=previousMonthDays)
- {
- this.days.push({day:dayCounter, isWeekend: this.isWeekend(p), _month:month});
dayCounter++; p++;
- }
-
- dayCounter = 1;
- month=0;
-
- this.firstDateIndex = p;
-
- // current month days
- if (this.daysData &&
this.daysData.index[currentYear+'-'+currentMonth]!=undefined)
- {
- var idx = this.daysData.index[currentYear+'-'+currentMonth];
- if (this.daysData.startDate.getFullYear()==currentYear &&
this.daysData.startDate.getMonth()==currentMonth)
- {
- var firstDay = firstDay=(this.daysData.days[idx].day ? this.daysData.days[idx].day :
this.daysData.startDate.getDate());
- while (dayCounter<firstDay)
- {
- this.days.push({day:dayCounter, isWeekend:this.isWeekend(p%7), _month:month});
-
- dayCounter++;
- p++;
- }
- }
-
- var len = this.daysData.days.length;
- var obj;
- var flag;
- while (idx<len && dayCounter<=currentMonthDays)
- {
- flag = this.isWeekend(p%7);
- obj = this.daysData.days[idx];
- obj.day = dayCounter;
- obj.isWeekend = flag;
- obj._month = month;
- this.days.push(obj);
- idx++;
- dayCounter++;
- p++;
- }
- }
- while (p<42)
- {
- if (dayCounter>currentMonthDays) {dayCounter=1; month=1;}
- this.days.push({day:dayCounter, isWeekend: this.isWeekend(p%7), _month:month});
- dayCounter++;
- p++;
- }
-
- // render
- this.renderHF();
-
- //days render
- p=0;
- var element;
- var dataobj;
- var wn;
- if (this.params.showWeeksBar) wn = rf.calendarUtils.weekNumber(currentYear,
currentMonth, this.params.minDaysInFirstWeek, this.params.firstWeekDay); /// fix it
- this.selectedDayElement=null;
- var weekflag=true;
-
- var e;
-
- var boundaryDatesModeFlag = (this.params.boundaryDatesMode == "scroll" ||
this.params.boundaryDatesMode == "select");
-
- this.todayCellId = this.clearEffect(this.todayCellId);
- this.selectedDateCellId = this.clearEffect(this.selectedDateCellId);
-
- //var _d=new Date();
- var obj = rf.getDomElement(this.WEEKNUMBER_BAR_ID+"1");
- for (var k=1;k<7;k++)
- {
- //
- dataobj = this.days[p];
-
- element = obj.firstChild;
- var weeknumber;
-
- // week number update
- if (this.params.showWeeksBar)
- {
- // TODO: fix: there is no weekNumber in dataobj if showWeeksBar == false;
- if (weekflag && currentMonth==11 &&
- (k==5||k==6) &&
- (dataobj._month==1 || (7 - (currentMonthDays - dataobj.day + 1)) >=
this.params.minDaysInFirstWeek) )
- {
- wn=1;
- weekflag=false;
- }
- weeknumber = wn;
- element.innerHTML = this.evaluateMarkup(this.params.weekNumberMarkup,
{weekNumber: wn++, elementId:element.id, component:this} );
- if (k==1&&wn>52) wn=1;
- element = element.nextSibling;
- }
-
- var weekdaycounter = this.params.firstWeekDay;
- var contentElement = null;
-
- while (element)
- {
- dataobj.elementId=element.id;
- dataobj.date=new Date(currentYear, currentMonth+dataobj._month, dataobj.day);
- dataobj.weekNumber = weeknumber;
- dataobj.component = this;
- dataobj.isCurrentMonth = (dataobj._month==0);
- dataobj.weekDayNumber = weekdaycounter;
-
- // call user function to get day state
- if (dataobj.enabled != false) dataobj.enabled = this.params.isDayEnabled(dataobj);
- // call user function to custom class style
- if (!dataobj.styleClass) dataobj.customStyleClass =
this.params.dayStyleClass(dataobj);
- else
- {
- var styleclass = this.params.dayStyleClass(dataobj);
- dataobj.customStyleClass = dataobj.styleClass;
- if (styleclass) dataobj.customStyleClass += " " + styleclass;
- }
-
- contentElement = (this.customDayListMarkup ? element.firstChild : element);
- contentElement.innerHTML = this.evaluateMarkup(this.params.dayListMarkup, dataobj
);
-
- if (weekdaycounter==6) weekdaycounter=0; else weekdaycounter++;
-
- var classNames = this.dayCellClassName[p];
-
- // class styles
- if (dataobj._month!=0)
- {
- classNames+=' rf-ca-boundary-dates';
- if (!this.params.disabled && !this.params.readonly &&
boundaryDatesModeFlag)
- {
- classNames+=' rf-ca-btn';
- }
- }
- else
- {
- if (todayflag && dataobj.day==todaydate)
- {
- this.todayCellId = element.id;
- this.todayCellColor = this.getCellBackgroundColor(element);
- classNames+=" rf-ca-today";
- }
-
- if (selectedflag && dataobj.day==selecteddate)
- {
- this.selectedDateCellId = element.id;
- this.selectedDateCellColor = this.getCellBackgroundColor(element);
- classNames+=" rf-ca-sel";
- }
- else if (!this.params.disabled && !this.params.readonly &&
dataobj.enabled) classNames+=' rf-ca-btn';
-
- // add custom style class
- if (dataobj.customStyleClass)
- {
- classNames+=' '+dataobj.customStyleClass;
- }
- }
- element.className = classNames;
-
- p++;
-
- dataobj = this.days[p];
- element=element.nextSibling;
- }
- obj = obj.nextSibling;
- }
-
- //alert(new Date().getTime()-_d.getTime());
-
- },
-
- renderHF: function()
- {
- if (this.params.showHeader) this.renderMarkup(this.params.headerMarkup,
this.id+"Header", this.calendarContext);
- if (this.params.showFooter) this.renderMarkup(this.params.footerMarkup,
this.id+"Footer", this.calendarContext);
-
- this.renderHeaderOptional();
- this.renderFooterOptional();
- },
-
- renderHeaderOptional: function()
- {
- this.renderMarkup(this.params.optionalHeaderMarkup,
this.id+"HeaderOptional", this.calendarContext);
- },
-
- renderFooterOptional: function()
- {
- this.renderMarkup(this.params.optionalFooterMarkup,
this.id+"FooterOptional", this.calendarContext);
- },
-
- renderMarkup: function (markup, elementId, context)
- {
- if (!markup) return;
-
- var e = rf.getDomElement(elementId);
- if (!e) return;
-
- e.innerHTML = this.evaluateMarkup(markup, context);
- },
-
- evaluateMarkup: function(markup, context)
- {
- if (!markup) return "";
-
- var result = [];
- var m;
- for (var i=0; i<markup.length; i++) {
- m = markup[i];
- if (m['getContent']) {
- result.push(m.getContent(context));
- }
- }
- return result.join('');
- },
-
- onUpdate: function()
- {
- var formattedDate =
rf.calendarUtils.formatDate(this.getCurrentDate(),"MM/yyyy");
- rf.getDomElement(this.id+'InputCurrentDate').value=formattedDate;
-
- if (this.submitFunction)
- this.submitFunction.call(this, formattedDate);
- else
- this.render();
- },
-
- nextMonth: function() {
- this.changeCurrentDateOffset(0,1);
- },
-
- prevMonth: function() {
- this.changeCurrentDateOffset(0,-1);
- },
-
- nextYear: function() {
- this.changeCurrentDateOffset(1,0);
- },
-
- prevYear: function() {
- this.changeCurrentDateOffset(-1,0);
- },
-
- changeCurrentDate: function(year, month, noUpdate) {
- if (this.getCurrentMonth()!=month || this.getCurrentYear()!=year)
- {
- var date = new Date(year, month,1);
- if (this.invokeEvent("currentdateselect", rf.getDomElement(this.id), null,
date))
- {
- // fix for RF-2450.
- // Additional event is fired: after the hidden input with current date
- // value is updated in function onUpdate() and then
- // the "currentdateselected" Event is fired.
- this.currentDate = date;
- if (noUpdate) this.render(); else this.onUpdate();
- this.invokeEvent("currentdateselected", rf.getDomElement(this.id), null,
date);
- return true;
- }
- }
- return false;
- },
-
- changeCurrentDateOffset: function(yearOffset, monthOffset) {
- var date = new Date(this.currentDate.getFullYear()+yearOffset,
this.currentDate.getMonth()+monthOffset,1);
-
- if (this.invokeEvent("currentdateselect", rf.getDomElement(this.id), null,
date))
- {
- // fix for RF-2450.
- // Additional event is fired: after the hidden input with current date
- // value is updated in function onUpdate() and then
- // the "currentdateselected" Event is fired.
- this.currentDate = date;
- this.onUpdate();
- this.invokeEvent("currentdateselected", rf.getDomElement(this.id), null,
date);
- }
- },
-
- today: function(noUpdate, noHighlight) {
-
- var now = new Date();
-
- var nowyear = now.getFullYear();
- var nowmonth = now.getMonth();
- var nowdate = now.getDate();
- var updateflag = false;
-
- if (nowdate!=this.todayDate.getDate()) {updateflag=true; this.todayDate = now;}
-
- if (nowyear != this.currentDate.getFullYear() || nowmonth !=
this.currentDate.getMonth() )
- {
- updateflag = true;
- this.currentDate = new Date(nowyear, nowmonth, 1);
- }
-
- if (this.params.todayControlMode=='select')
- {
- noHighlight=true;
- }
-
- if (updateflag)
- {
- if (noUpdate) this.render(); else this.onUpdate();
- }
- else
- {
- // highlight today
-
- if (this.isVisible && this.todayCellId && !noHighlight)
- {
- this.clearEffect(this.todayCellId);
- if (this.todayCellColor!="transparent")
- {
- $(rf.getDomElement(this.todayCellId)).effect("highlight",
{easing:'easeInOutSine', color: this.todayCellColor}, 300);
- }
- }
- }
-
- // todayControl select mode
- if (this.params.todayControlMode=='select' && !this.params.disabled
&& !this.params.readonly)
- if (updateflag && !noUpdate && this.submitFunction)
- {
- this.afterLoad = this.selectToday;
- }
- else this.selectToday();
-
- },
-
- selectToday: function()
- {
- if (this.todayCellId)
- {
- var daydata =
this.days[parseInt(this.todayCellId.substr(this.DATE_ELEMENT_ID.length),10)];
- var today = new Date();
- var date = new Date(today.getFullYear(), today.getMonth(), today.getDate());
- if (this.timeType)
- {
- this.setupTimeForDate(date);
- }
- if (daydata.enabled && this.selectDate(date,true) &&
!this.params.showApplyButton)
- {
- this.doCollapse();
- }
- }
- },
-
- selectDate: function(date, noUpdate, eventData) {
-
- if (!eventData)
- {
- eventData = {event: null, element: null};
- }
-
- var oldSelectedDate = this.selectedDate;
- var newSelectedDate;
- if (date)
- {
- if (typeof date=='string')
- {
- date = rf.calendarUtils.parseDate(date,this.params.datePattern,
this.params.monthLabels, this.params.monthLabelsShort);
- }
- newSelectedDate = date;
- }
- else
- {
- newSelectedDate = null;
- }
-
- // fire user event
- var flag = true;
- var isDateChange = false;
- if ( (oldSelectedDate - newSelectedDate) && (oldSelectedDate!=null ||
newSelectedDate!=null) )
- {
- isDateChange = true;
- flag = this.invokeEvent("dateselect", eventData.element, eventData.event,
date);
- }
-
- if (flag)
- {
- if (newSelectedDate!=null)
- {
- if (newSelectedDate.getMonth()==this.currentDate.getMonth() &&
newSelectedDate.getFullYear()==this.currentDate.getFullYear())
- {
- this.selectedDate = newSelectedDate;
- if (!oldSelectedDate || (oldSelectedDate - this.selectedDate))
- {
- // find cell and change style class
- var e = $(rf.getDomElement(this.DATE_ELEMENT_ID+(this.firstDateIndex +
this.selectedDate.getDate()-1)));
-
- this.clearEffect(this.selectedDateCellId, "rf-ca-sel",
(this.params.disabled || this.params.readonly ? null : "rf-ca-btn"));
- this.selectedDateCellId = e.attr('id');
- this.selectedDateCellColor = this.getCellBackgroundColor(e);
-
- e.removeClass("rf-ca-btn");
- e.removeClass("rf-ca-hov");
- e.addClass("rf-ca-sel");
-
- this.renderHF();
- }
- else if (this.timeType!=0) this.renderHF();
- }
- else
- {
- //RF-5600
- this.selectedDate = newSelectedDate;
-
- // change currentDate and call this.onUpdate();
- if (this.changeCurrentDate(newSelectedDate.getFullYear(),
newSelectedDate.getMonth(), noUpdate))
- {
- //this.selectedDate = newSelectedDate;
- } else {
- this.selectedDate = oldSelectedDate;
- isDateChange = false;
- }
- }
- }
- else
- {
- this.selectedDate = null;
-
- this.clearEffect(this.selectedDateCellId, "rf-ca-sel",
(this.params.disabled || this.params.readonly ? null : "rf-ca-btn"));
-
- if (this.selectedDateCellId)
- {
- this.selectedDateCellId = null;
- this.renderHF();
- }
-
- var date = new Date();
- if (this.currentDate.getMonth()==date.getMonth() &&
this.currentDate.getFullYear()==date.getFullYear())
- {
- this.renderHF();
- }
-
- var todayControlMode = this.params.todayControlMode;
- this.params.todayControlMode = '';
- this.today(noUpdate, true);
- this.params.todayControlMode = todayControlMode;
- }
-
- // call user event
- if (isDateChange)
- {
- this.invokeEvent("dateselected", eventData.element, eventData.event,
this.selectedDate);
- if (!this.params.showApplyButton)
- {
- this.setInputField(this.selectedDate!=null ?
this.getSelectedDateString(this.params.datePattern) : "", eventData.event);
- }
- }
- }
-
- return isDateChange;
- },
-
- resetSelectedDate: function()
- {
- if (!this.selectedDate) return;
- if (this.invokeEvent("dateselect", null, null, null))
- {
- this.selectedDate = null;
- this.invokeEvent("dateselected", null, null, null);
-
- this.selectedDateCellId = this.clearEffect(this.selectedDateCellId,
"rf-ca-sel", (this.params.disabled || this.params.readonly ? null :
"rf-ca-btn"));
-
- this.renderHF();
- if (!this.params.showApplyButton)
- {
- this.setInputField("", null);
- this.doCollapse();
- }
- }
- },
-
- showSelectedDate: function()
- {
- if (!this.selectedDate) return;
- if (this.currentDate.getMonth()!=this.selectedDate.getMonth() ||
this.currentDate.getFullYear()!=this.selectedDate.getFullYear())
- {
- this.currentDate = new Date(this.selectedDate);
- this.currentDate.setDate(1);
- this.onUpdate();
- }
- else
- {
- // highlight Selected Date
- if (this.isVisible && this.selectedDateCellId)
- {
- this.clearEffect(this.selectedDateCellId);
- if (this.selectedDateCellColor!="transparent")
- {
- $(rf.getDomElement(this.selectedDateCellId)).effect("highlight",
{easing:'easeInOutSine', color: this.selectedDateCellColor}, 300);
-
- }
- }
- }
- },
-
- close: function(updateDate)
- {
- if (updateDate)
- {
- this.setInputField(this.getSelectedDateString(this.params.datePattern), null);
- }
- this.doCollapse();
- },
-
- clonePosition: function (source, elements, offset)
- {
- var jqe = $(source);
- if (!elements.length) elements = [elements];
- offset = offset || {left:0,top:0};
- var width = jqe.outerWidth()+"px", height =
jqe.outerHeight()+"px";
- var pos = jqe.position();
- var left = Math.floor(pos.left)+offset.left+"px", top =
Math.floor(pos.top)+offset.top+"px";
- var element;
- for (var i = 0; i<elements.length;i++) {
- element = elements[i];
- element.style.width = width;
- element.style.height = height;
- element.style.left = left;
- element.style.top = top;
- }
- },
-
- showTimeEditor: function()
- {
- var editor;
- if (this.timeType==0) return;
- if (!this.isEditorCreated) editor = this.createEditor();
- else editor = rf.getDomElement(this.EDITOR_ID);
- if (!this.isTimeEditorLayoutCreated) this.createTimeEditorLayout(editor);
-
- $(rf.getDomElement(this.TIME_EDITOR_LAYOUT_ID)).show();
-
- var editor_shadow = rf.getDomElement(this.EDITOR_SHADOW_ID);
-
- this.clonePosition(rf.getDomElement(this.CALENDAR_CONTENT), [editor, editor_shadow]);
-
- this.updateTimeEditor();
-
- $(editor_shadow).show();
-
- $(editor).show();
-
- this.clonePosition(rf.getDomElement(this.TIME_EDITOR_LAYOUT_ID),
rf.getDomElement(this.EDITOR_LAYOUT_SHADOW_ID), {left: 3, top: 3});
- this.isEditorVisible = true;
- },
-
- hideEditor: function()
- {
- if (this.isTimeEditorLayoutCreated)
$(rf.getDomElement(this.TIME_EDITOR_LAYOUT_ID)).hide();
- if (this.isDateEditorLayoutCreated)
$(rf.getDomElement(this.DATE_EDITOR_LAYOUT_ID)).hide();
- $(rf.getDomElement(this.EDITOR_ID)).hide();
- $(rf.getDomElement(this.EDITOR_SHADOW_ID)).hide();
- this.isEditorVisible = false;
- },
-
- hideTimeEditor: function(updateTime)
- {
- this.hideEditor();
- if (updateTime && this.selectedDate)
- {
- var s = this.showSeconds ?
parseInt(rf.getDomElement(this.id+'TimeSeconds').value,10) :
this.params.defaultTime.seconds;
- var m = parseInt(rf.getDomElement(this.id+'TimeMinutes').value,10);
- var h = parseInt(rf.getDomElement(this.id+'TimeHours').value,10);
- if (this.timeType==2)
- {
- if
(rf.getDomElement(this.id+'TimeSign').value.toLowerCase()=="am")
- {
- if (h==12) h = 0;
- }
- else
- {
- if (h!=12) h+=12;
- }
- }
- var date = new Date(this.selectedDate.getFullYear(), this.selectedDate.getMonth(),
this.selectedDate.getDate(), h, m, s);
- if (date-this.selectedDate && this.invokeEvent("timeselect",null,
null, date))
- {
- this.selectedDate = date;
- this.renderHF();
- if (!this.params.popup || !this.params.showApplyButton)
this.setInputField(this.getSelectedDateString(this.params.datePattern), null);
- this.invokeEvent("timeselected",null, null, this.selectedDate);
- }
- }
- if (this.params.popup && !this.params.showApplyButton) this.close(false);
- },
-
- showDateEditor: function()
- {
- var editor;
- if (!this.isEditorCreated) editor = this.createEditor();
- else editor = rf.getDomElement(this.EDITOR_ID);
- if (!this.isDateEditorLayoutCreated) this.createDateEditorLayout(editor);
- else this.updateDateEditor();
-
- $(rf.getDomElement(this.DATE_EDITOR_LAYOUT_ID)).show();
-
- var editor_shadow = rf.getDomElement(this.EDITOR_SHADOW_ID);
-
- this.clonePosition(rf.getDomElement(this.CALENDAR_CONTENT), [editor, editor_shadow]);
-
- $(editor_shadow).show();
- $(editor).show();
-
- this.clonePosition(rf.getDomElement(this.DATE_EDITOR_LAYOUT_ID),
rf.getDomElement(this.EDITOR_LAYOUT_SHADOW_ID), {left: 3, top: 3});
-
- this.isEditorVisible = true;
- },
-
- hideDateEditor: function(updateCurrentDate)
- {
- this.hideEditor();
- if (updateCurrentDate)
- {
- this.changeCurrentDate(this.dateEditorYear, this.dateEditorMonth);
- }
- },
-
- getNamespace: function () {
- return this.namespace;
- }
- });
-})(jQuery, RichFaces);
\ No newline at end of file
Deleted:
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/jquery.effects.core.js
===================================================================
---
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/jquery.effects.core.js 2010-10-29
14:48:32 UTC (rev 19774)
+++
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/jquery.effects.core.js 2010-10-29
14:50:18 UTC (rev 19775)
@@ -1,714 +0,0 @@
-/*
- * jQuery UI Effects 1.8.5
- *
- * Copyright 2010, AUTHORS.txt (
http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- *
http://jquery.org/license
- *
- *
http://docs.jquery.com/UI/Effects/
- */
-;jQuery.effects || (function($, undefined) {
-
-$.effects = {};
-
-
-
-/******************************************************************************/
-/****************************** COLOR ANIMATIONS ******************************/
-/******************************************************************************/
-
-// override the animation for color styles
-$.each(['backgroundColor', 'borderBottomColor',
'borderLeftColor',
- 'borderRightColor', 'borderTopColor', 'color',
'outlineColor'],
-function(i, attr) {
- $.fx.step[attr] = function(fx) {
- if (!fx.colorInit) {
- fx.start = getColor(fx.elem, attr);
- fx.end = getRGB(fx.end);
- fx.colorInit = true;
- }
-
- fx.elem.style[attr] = 'rgb(' +
- Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10),
255), 0) + ',' +
- Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10),
255), 0) + ',' +
- Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10),
255), 0) + ')';
- };
-});
-
-// Color Conversion functions from highlightFade
-// By Blair Mitchelmore
-//
http://jquery.offput.ca/highlightFade/
-
-// Parse strings looking for color tuples [255,255,255]
-function getRGB(color) {
- var result;
-
- // Check if we're already dealing with an array of colors
- if ( color && color.constructor == Array && color.length == 3 )
- return color;
-
- // Look for rgb(num,num,num)
- if (result =
/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
- return [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];
-
- // Look for rgb(num%,num%,num%)
- if (result =
/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
- return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55,
parseFloat(result[3])*2.55];
-
- // Look for #a0b1c2
- if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
- return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
-
- // Look for #fff
- if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
- return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16),
parseInt(result[3]+result[3],16)];
-
- // Look for rgba(0, 0, 0, 0) == transparent in Safari 3
- if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
- return colors['transparent'];
-
- // Otherwise, we're most likely dealing with a named color
- return colors[$.trim(color).toLowerCase()];
-}
-
-function getColor(elem, attr) {
- var color;
-
- do {
- color = $.curCSS(elem, attr);
-
- // Keep going until we find an element that has color, or we hit the body
- if ( color != '' && color != 'transparent' ||
$.nodeName(elem, "body") )
- break;
-
- attr = "backgroundColor";
- } while ( elem = elem.parentNode );
-
- return getRGB(color);
-};
-
-// Some named colors to work with
-// From Interface by Stefan Petre
-//
http://interface.eyecon.ro/
-
-var colors = {
- aqua:[0,255,255],
- azure:[240,255,255],
- beige:[245,245,220],
- black:[0,0,0],
- blue:[0,0,255],
- brown:[165,42,42],
- cyan:[0,255,255],
- darkblue:[0,0,139],
- darkcyan:[0,139,139],
- darkgrey:[169,169,169],
- darkgreen:[0,100,0],
- darkkhaki:[189,183,107],
- darkmagenta:[139,0,139],
- darkolivegreen:[85,107,47],
- darkorange:[255,140,0],
- darkorchid:[153,50,204],
- darkred:[139,0,0],
- darksalmon:[233,150,122],
- darkviolet:[148,0,211],
- fuchsia:[255,0,255],
- gold:[255,215,0],
- green:[0,128,0],
- indigo:[75,0,130],
- khaki:[240,230,140],
- lightblue:[173,216,230],
- lightcyan:[224,255,255],
- lightgreen:[144,238,144],
- lightgrey:[211,211,211],
- lightpink:[255,182,193],
- lightyellow:[255,255,224],
- lime:[0,255,0],
- magenta:[255,0,255],
- maroon:[128,0,0],
- navy:[0,0,128],
- olive:[128,128,0],
- orange:[255,165,0],
- pink:[255,192,203],
- purple:[128,0,128],
- violet:[128,0,128],
- red:[255,0,0],
- silver:[192,192,192],
- white:[255,255,255],
- yellow:[255,255,0],
- transparent: [255,255,255]
-};
-
-
-
-/******************************************************************************/
-/****************************** CLASS ANIMATIONS ******************************/
-/******************************************************************************/
-
-var classAnimationActions = ['add', 'remove', 'toggle'],
- shorthandStyles = {
- border: 1,
- borderBottom: 1,
- borderColor: 1,
- borderLeft: 1,
- borderRight: 1,
- borderTop: 1,
- borderWidth: 1,
- margin: 1,
- padding: 1
- };
-
-function getElementStyles() {
- var style = document.defaultView
- ? document.defaultView.getComputedStyle(this, null)
- : this.currentStyle,
- newStyle = {},
- key,
- camelCase;
-
- // webkit enumerates style porperties
- if (style && style.length && style[0] && style[style[0]]) {
- var len = style.length;
- while (len--) {
- key = style[len];
- if (typeof style[key] == 'string') {
- camelCase = key.replace(/\-(\w)/g, function(all, letter){
- return letter.toUpperCase();
- });
- newStyle[camelCase] = style[key];
- }
- }
- } else {
- for (key in style) {
- if (typeof style[key] === 'string') {
- newStyle[key] = style[key];
- }
- }
- }
-
- return newStyle;
-}
-
-function filterStyles(styles) {
- var name, value;
- for (name in styles) {
- value = styles[name];
- if (
- // ignore null and undefined values
- value == null ||
- // ignore functions (when does this occur?)
- $.isFunction(value) ||
- // shorthand styles that need to be expanded
- name in shorthandStyles ||
- // ignore scrollbars (break in IE)
- (/scrollbar/).test(name) ||
-
- // only colors or values that can be converted to numbers
- (!(/color/i).test(name) && isNaN(parseFloat(value)))
- ) {
- delete styles[name];
- }
- }
-
- return styles;
-}
-
-function styleDifference(oldStyle, newStyle) {
- var diff = { _: 0 }, //
http://dev.jquery.com/ticket/5459
- name;
-
- for (name in newStyle) {
- if (oldStyle[name] != newStyle[name]) {
- diff[name] = newStyle[name];
- }
- }
-
- return diff;
-}
-
-$.effects.animateClass = function(value, duration, easing, callback) {
- if ($.isFunction(easing)) {
- callback = easing;
- easing = null;
- }
-
- return this.each(function() {
-
- var that = $(this),
- originalStyleAttr = that.attr('style') || ' ',
- originalStyle = filterStyles(getElementStyles.call(this)),
- newStyle,
- className = that.attr('className');
-
- $.each(classAnimationActions, function(i, action) {
- if (value[action]) {
- that[action + 'Class'](value[action]);
- }
- });
- newStyle = filterStyles(getElementStyles.call(this));
- that.attr('className', className);
-
- that.animate(styleDifference(originalStyle, newStyle), duration, easing, function() {
- $.each(classAnimationActions, function(i, action) {
- if (value[action]) { that[action + 'Class'](value[action]); }
- });
- // work around bug in IE by clearing the cssText before setting it
- if (typeof that.attr('style') == 'object') {
- that.attr('style').cssText = '';
- that.attr('style').cssText = originalStyleAttr;
- } else {
- that.attr('style', originalStyleAttr);
- }
- if (callback) { callback.apply(this, arguments); }
- });
- });
-};
-
-$.fn.extend({
- _addClass: $.fn.addClass,
- addClass: function(classNames, speed, easing, callback) {
- return speed ? $.effects.animateClass.apply(this, [{ add: classNames
},speed,easing,callback]) : this._addClass(classNames);
- },
-
- _removeClass: $.fn.removeClass,
- removeClass: function(classNames,speed,easing,callback) {
- return speed ? $.effects.animateClass.apply(this, [{ remove: classNames
},speed,easing,callback]) : this._removeClass(classNames);
- },
-
- _toggleClass: $.fn.toggleClass,
- toggleClass: function(classNames, force, speed, easing, callback) {
- if ( typeof force == "boolean" || force === undefined ) {
- if ( !speed ) {
- // without speed parameter;
- return this._toggleClass(classNames, force);
- } else {
- return $.effects.animateClass.apply(this,
[(force?{add:classNames}:{remove:classNames}),speed,easing,callback]);
- }
- } else {
- // without switch parameter;
- return $.effects.animateClass.apply(this, [{ toggle: classNames
},force,speed,easing]);
- }
- },
-
- switchClass: function(remove,add,speed,easing,callback) {
- return $.effects.animateClass.apply(this, [{ add: add, remove: remove
},speed,easing,callback]);
- }
-});
-
-
-
-/******************************************************************************/
-/*********************************** EFFECTS **********************************/
-/******************************************************************************/
-
-$.extend($.effects, {
- version: "1.8.5",
-
- // Saves a set of properties in a data storage
- save: function(element, set) {
- for(var i=0; i < set.length; i++) {
- if(set[i] !== null) element.data("ec.storage."+set[i],
element[0].style[set[i]]);
- }
- },
-
- // Restores a set of previously saved properties from a data storage
- restore: function(element, set) {
- for(var i=0; i < set.length; i++) {
- if(set[i] !== null) element.css(set[i],
element.data("ec.storage."+set[i]));
- }
- },
-
- setMode: function(el, mode) {
- if (mode == 'toggle') mode = el.is(':hidden') ? 'show' :
'hide'; // Set for toggle
- return mode;
- },
-
- getBaseline: function(origin, original) { // Translates a [top,left] array into a
baseline value
- // this should be a little more flexible in the future to handle a string & hash
- var y, x;
- switch (origin[0]) {
- case 'top': y = 0; break;
- case 'middle': y = 0.5; break;
- case 'bottom': y = 1; break;
- default: y = origin[0] / original.height;
- };
- switch (origin[1]) {
- case 'left': x = 0; break;
- case 'center': x = 0.5; break;
- case 'right': x = 1; break;
- default: x = origin[1] / original.width;
- };
- return {x: x, y: y};
- },
-
- // Wraps the element around a wrapper that copies position properties
- createWrapper: function(element) {
-
- // if the element is already wrapped, return it
- if (element.parent().is('.ui-effects-wrapper')) {
- return element.parent();
- }
-
- // wrap the element
- var props = {
- width: element.outerWidth(true),
- height: element.outerHeight(true),
- 'float': element.css('float')
- },
- wrapper = $('<div></div>')
- .addClass('ui-effects-wrapper')
- .css({
- fontSize: '100%',
- background: 'transparent',
- border: 'none',
- margin: 0,
- padding: 0
- });
-
- element.wrap(wrapper);
- wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems
to actually loose the reference to the wrapped element
-
- // transfer positioning properties to the wrapper
- if (element.css('position') == 'static') {
- wrapper.css({ position: 'relative' });
- element.css({ position: 'relative' });
- } else {
- $.extend(props, {
- position: element.css('position'),
- zIndex: element.css('z-index')
- });
- $.each(['top', 'left', 'bottom', 'right'], function(i,
pos) {
- props[pos] = element.css(pos);
- if (isNaN(parseInt(props[pos], 10))) {
- props[pos] = 'auto';
- }
- });
- element.css({position: 'relative', top: 0, left: 0 });
- }
-
- return wrapper.css(props).show();
- },
-
- removeWrapper: function(element) {
- if (element.parent().is('.ui-effects-wrapper'))
- return element.parent().replaceWith(element);
- return element;
- },
-
- setTransition: function(element, list, factor, value) {
- value = value || {};
- $.each(list, function(i, x){
- unit = element.cssUnit(x);
- if (unit[0] > 0) value[x] = unit[0] * factor + unit[1];
- });
- return value;
- }
-});
-
-
-function _normalizeArguments(effect, options, speed, callback) {
- // shift params for method overloading
- if (typeof effect == 'object') {
- callback = options;
- speed = null;
- options = effect;
- effect = options.effect;
- }
- if ($.isFunction(options)) {
- callback = options;
- speed = null;
- options = {};
- }
- if (typeof options == 'number' || $.fx.speeds[options]) {
- callback = speed;
- speed = options;
- options = {};
- }
- if ($.isFunction(speed)) {
- callback = speed;
- speed = null;
- }
-
- options = options || {};
-
- speed = speed || options.duration;
- speed = $.fx.off ? 0 : typeof speed == 'number'
- ? speed : $.fx.speeds[speed] || $.fx.speeds._default;
-
- callback = callback || options.complete;
-
- return [effect, options, speed, callback];
-}
-
-$.fn.extend({
- effect: function(effect, options, speed, callback) {
- var args = _normalizeArguments.apply(this, arguments),
- // TODO: make effects takes actual parameters instead of a hash
- args2 = {
- options: args[1],
- duration: args[2],
- callback: args[3]
- },
- effectMethod = $.effects[effect];
-
- return effectMethod && !$.fx.off ? effectMethod.call(this, args2) : this;
- },
-
- _show: $.fn.show,
- show: function(speed) {
- if (!speed || typeof speed == 'number' || $.fx.speeds[speed] ||
!$.effects[speed] ) {
- return this._show.apply(this, arguments);
- } else {
- var args = _normalizeArguments.apply(this, arguments);
- args[1].mode = 'show';
- return this.effect.apply(this, args);
- }
- },
-
- _hide: $.fn.hide,
- hide: function(speed) {
- if (!speed || typeof speed == 'number' || $.fx.speeds[speed] ||
!$.effects[speed] ) {
- return this._hide.apply(this, arguments);
- } else {
- var args = _normalizeArguments.apply(this, arguments);
- args[1].mode = 'hide';
- return this.effect.apply(this, args);
- }
- },
-
- // jQuery core overloads toggle and creates _toggle
- __toggle: $.fn.toggle,
- toggle: function(speed) {
- if (!speed || typeof speed == 'number' || $.fx.speeds[speed] ||
!$.effects[speed] ||
- typeof speed == 'boolean' || $.isFunction(speed)) {
- return this.__toggle.apply(this, arguments);
- } else {
- var args = _normalizeArguments.apply(this, arguments);
- args[1].mode = 'toggle';
- return this.effect.apply(this, args);
- }
- },
-
- // helper functions
- cssUnit: function(key) {
- var style = this.css(key), val = [];
- $.each( ['em','px','%','pt'], function(i, unit){
- if(style.indexOf(unit) > 0)
- val = [parseFloat(style), unit];
- });
- return val;
- }
-});
-
-
-
-/******************************************************************************/
-/*********************************** EASING ***********************************/
-/******************************************************************************/
-
-/*
- * jQuery Easing v1.3 -
http://gsgd.co.uk/sandbox/jquery/easing/
- *
- * Uses the built in easing capabilities added In jQuery 1.1
- * to offer multiple easing options
- *
- * TERMS OF USE - jQuery Easing
- *
- * Open source under the BSD License.
- *
- * Copyright 2008 George McGinley Smith
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other
materials
- * provided with the distribution.
- *
- * Neither the name of the author nor the names of contributors may be used to endorse
- * or promote products derived from this software without specific prior written
permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
-*/
-
-// t: current time, b: begInnIng value, c: change In value, d: duration
-$.easing.jswing = $.easing.swing;
-
-$.extend($.easing,
-{
- def: 'easeOutQuad',
- swing: function (x, t, b, c, d) {
- //alert($.easing.default);
- return $.easing[$.easing.def](x, t, b, c, d);
- },
- easeInQuad: function (x, t, b, c, d) {
- return c*(t/=d)*t + b;
- },
- easeOutQuad: function (x, t, b, c, d) {
- return -c *(t/=d)*(t-2) + b;
- },
- easeInOutQuad: function (x, t, b, c, d) {
- if ((t/=d/2) < 1) return c/2*t*t + b;
- return -c/2 * ((--t)*(t-2) - 1) + b;
- },
- easeInCubic: function (x, t, b, c, d) {
- return c*(t/=d)*t*t + b;
- },
- easeOutCubic: function (x, t, b, c, d) {
- return c*((t=t/d-1)*t*t + 1) + b;
- },
- easeInOutCubic: function (x, t, b, c, d) {
- if ((t/=d/2) < 1) return c/2*t*t*t + b;
- return c/2*((t-=2)*t*t + 2) + b;
- },
- easeInQuart: function (x, t, b, c, d) {
- return c*(t/=d)*t*t*t + b;
- },
- easeOutQuart: function (x, t, b, c, d) {
- return -c * ((t=t/d-1)*t*t*t - 1) + b;
- },
- easeInOutQuart: function (x, t, b, c, d) {
- if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
- return -c/2 * ((t-=2)*t*t*t - 2) + b;
- },
- easeInQuint: function (x, t, b, c, d) {
- return c*(t/=d)*t*t*t*t + b;
- },
- easeOutQuint: function (x, t, b, c, d) {
- return c*((t=t/d-1)*t*t*t*t + 1) + b;
- },
- easeInOutQuint: function (x, t, b, c, d) {
- if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
- return c/2*((t-=2)*t*t*t*t + 2) + b;
- },
- easeInSine: function (x, t, b, c, d) {
- return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
- },
- easeOutSine: function (x, t, b, c, d) {
- return c * Math.sin(t/d * (Math.PI/2)) + b;
- },
- easeInOutSine: function (x, t, b, c, d) {
- return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
- },
- easeInExpo: function (x, t, b, c, d) {
- return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
- },
- easeOutExpo: function (x, t, b, c, d) {
- return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
- },
- easeInOutExpo: function (x, t, b, c, d) {
- if (t==0) return b;
- if (t==d) return b+c;
- if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
- return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
- },
- easeInCirc: function (x, t, b, c, d) {
- return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
- },
- easeOutCirc: function (x, t, b, c, d) {
- return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
- },
- easeInOutCirc: function (x, t, b, c, d) {
- if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
- return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
- },
- easeInElastic: function (x, t, b, c, d) {
- var s=1.70158;var p=0;var a=c;
- if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
- if (a < Math.abs(c)) { a=c; var s=p/4; }
- else var s = p/(2*Math.PI) * Math.asin (c/a);
- return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
- },
- easeOutElastic: function (x, t, b, c, d) {
- var s=1.70158;var p=0;var a=c;
- if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
- if (a < Math.abs(c)) { a=c; var s=p/4; }
- else var s = p/(2*Math.PI) * Math.asin (c/a);
- return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
- },
- easeInOutElastic: function (x, t, b, c, d) {
- var s=1.70158;var p=0;var a=c;
- if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
- if (a < Math.abs(c)) { a=c; var s=p/4; }
- else var s = p/(2*Math.PI) * Math.asin (c/a);
- if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p ))
+ b;
- return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
- },
- easeInBack: function (x, t, b, c, d, s) {
- if (s == undefined) s = 1.70158;
- return c*(t/=d)*t*((s+1)*t - s) + b;
- },
- easeOutBack: function (x, t, b, c, d, s) {
- if (s == undefined) s = 1.70158;
- return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
- },
- easeInOutBack: function (x, t, b, c, d, s) {
- if (s == undefined) s = 1.70158;
- if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
- return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
- },
- easeInBounce: function (x, t, b, c, d) {
- return c - $.easing.easeOutBounce (x, d-t, 0, c, d) + b;
- },
- easeOutBounce: function (x, t, b, c, d) {
- if ((t/=d) < (1/2.75)) {
- return c*(7.5625*t*t) + b;
- } else if (t < (2/2.75)) {
- return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
- } else if (t < (2.5/2.75)) {
- return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
- } else {
- return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
- }
- },
- easeInOutBounce: function (x, t, b, c, d) {
- if (t < d/2) return $.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
- return $.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
- }
-});
-
-/*
- *
- * TERMS OF USE - EASING EQUATIONS
- *
- * Open source under the BSD License.
- *
- * Copyright 2001 Robert Penner
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other
materials
- * provided with the distribution.
- *
- * Neither the name of the author nor the names of contributors may be used to endorse
- * or promote products derived from this software without specific prior written
permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE
- * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
-
-})(jQuery);
Deleted:
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/jquery.effects.highlight.js
===================================================================
---
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/jquery.effects.highlight.js 2010-10-29
14:48:32 UTC (rev 19774)
+++
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/jquery.effects.highlight.js 2010-10-29
14:50:18 UTC (rev 19775)
@@ -1,50 +0,0 @@
-/*
- * jQuery UI Effects Highlight 1.8.5
- *
- * Copyright 2010, AUTHORS.txt (
http://jqueryui.com/about)
- * Dual licensed under the MIT or GPL Version 2 licenses.
- *
http://jquery.org/license
- *
- *
http://docs.jquery.com/UI/Effects/Highlight
- *
- * Depends:
- * jquery.effects.core.js
- */
-(function( $, undefined ) {
-
-$.effects.highlight = function(o) {
- return this.queue(function() {
- var elem = $(this),
- props = ['backgroundImage', 'backgroundColor', 'opacity'],
- mode = $.effects.setMode(elem, o.options.mode || 'show'),
- animation = {
- backgroundColor: elem.css('backgroundColor')
- };
-
- if (mode == 'hide') {
- animation.opacity = 0;
- }
-
- $.effects.save(elem, props);
- elem
- .show()
- .css({
- backgroundImage: 'none',
- backgroundColor: o.options.color || '#ffff99'
- })
- .animate(animation, {
- queue: false,
- duration: o.duration,
- easing: o.options.easing,
- complete: function() {
- (mode == 'hide' && elem.hide());
- $.effects.restore(elem, props);
- (mode == 'show' && !$.support.opacity &&
this.style.removeAttribute('filter'));
- (o.callback && o.callback.apply(this, arguments));
- elem.dequeue();
- }
- });
- });
-};
-
-})(jQuery);
Deleted:
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/json-dom.js
===================================================================
---
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/json-dom.js 2010-10-29
14:48:32 UTC (rev 19774)
+++
trunk/ui/calendar/ui/src/main/resources/META-INF/resources/org.richfaces/json-dom.js 2010-10-29
14:50:18 UTC (rev 19775)
@@ -1,133 +0,0 @@
-// AJAX-JSF AJAX-like library, for communicate with view Tree on server side.
-// In case of XMLHttpRequest don't worked, use :
-// JSHttpRequest v1.12. (C) Dmitry Koterov, 2005-01-27.
-//
http://forum.dklab.ru/users/DmitryKoterov/
-//
-// Do not remove this comment if you want to use script!
-// ?? ???????? ?????? ???????????, ???? ?? ?????? ???????????? ??????!
-//
-// Modified by Alexander J. Smirnov to use as JSF AJAX-like components.
-
-// DOM - like elements for JSRequest. JS serialiser encode
-// XML sax events to creation of corresponding objects.
-JSNode = function() {
-};
-
-// Base node
-JSNode.prototype = {
- tag : null,
- attrs : {},
- childs : [],
- value : "",
- _symbols : {
- '&':"&",
- '<':"<",
- '>':">",
- '"':""",
- '\'':"'",
- '\u00A0':" "
- },
- // Public functions
- getInnerHTML : function(context) {
- var children = [];
- for (var i = 0; i < this.childs.length; i++)
- {
- children.push(this.childs[i].getContent(context));
- }
- return children.join('');
- },
- // Escape XML symbols - < > & ' ...
- xmlEscape : function(value) {
- var text = value ? value.toString() : "";
- for(var i in this._symbols ) {
- text = text.replace(i,this._symbols[i]);
-
- }
- return text;
- }
-};
-
-// Element node
-E = function(tagname,attributes,childnodes) {
- this.tag = tagname;
- if (attributes) this.attrs = attributes;
- if(childnodes) this.childs = childnodes;
-};
-
-E.prototype = new JSNode();
-E.prototype.getContent = function(context) {
- var html = "<"+this.tag;
- var inner = this.getInnerHTML(context);
- if (inner=='') this.isEmpty = true; else this.isEmpty=false;
- for(var i in this.attrs) {
- if (!this.attrs.hasOwnProperty(i)) {
- continue ;
- }
-
- var attrValue = this.attrs[i];
-
- if (typeof attrValue == "function")
- attrValue = attrValue.call(this, context);
-
- if (attrValue)
- html += "
"+(i=='className'?'class':i)+'="'+this.xmlEscape(attrValue)+'"';
- }
- html+= ">"+inner+"</"+this.tag+">";
- return html;
-};
-
-// Escaped Text node
-ET = function(text) {
- this.value = text;
-};
-
-
-//ET.prototype = new JSNode();
-ET.prototype.getContent = function(context) {
- var value = this.value;
- if (typeof value=="function") value=value(context);
- if (value && value.getContent) {
- value = value.getContent(context);
- }
-
- if (value) return value;
-
- return "";
-};
-
-// Text node
-T = function(text) {
- this.value = text;
-};
-
-T.prototype = new JSNode();
-T.prototype.getContent = function(context) {
- var value = this.value;
- if (typeof value=="function") value=value(context);
-
- if (value) return this.xmlEscape(value);
-
- return "";
-};
-
-// Comment node
-C = function(text) {
- this.value = text;
-};
-
-//C.prototype = new JSNode();
-C.prototype.getContent = function(context) {
- return "<!--"+this.value+"-->";
-};
-
-// CDATA Section node.
-D = function(text) {
- this.value = text;
-};
-
-//D.prototype = new JSNode();
-D.prototype.getContent = function(context) {
- return "<![CDATA["+this.value+"]]>";
-};
-
-
Deleted: trunk/ui/calendar/ui/src/main/templates/calendar.template.xml
===================================================================
--- trunk/ui/calendar/ui/src/main/templates/calendar.template.xml 2010-10-29 14:48:32 UTC
(rev 19774)
+++ trunk/ui/calendar/ui/src/main/templates/calendar.template.xml 2010-10-29 14:50:18 UTC
(rev 19775)
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- /* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat,
- Inc. and individual contributors * by the @authors tag. See the copyright.txt
- in the distribution for a * full listing of individual contributors. * *
- This is free software; you can redistribute it and/or modify it * under the
- terms of the GNU Lesser General Public License as * published by the Free
- Software Foundation; either version 2.1 of * the License, or (at your option)
- any later version. * * This software is distributed in the hope that it will
- be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty
- of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser
- General Public License for more details. * * You should have received a copy
- of the GNU Lesser General Public * License along with this software; if not,
- write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- Boston, MA * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. */ -->
-<cdk:root
xmlns="http://jboss.org/schema/richfaces/cdk/xhtml-el"
-
xmlns:cdk="http://jboss.org/schema/richfaces/cdk/core"
xmlns:cc="http://jboss.org/schema/richfaces/cdk/jsf/composite"
-
xmlns:c="http://jboss.org/schema/richfaces/cdk/jstl/core"
xmlns:xi="http://www.w3.org/2001/XInclude">
- <cc:interface>
- <cdk:class>org.richfaces.renderkit.html.CalendarRenderer</cdk:class>
- <cdk:superclass>org.richfaces.renderkit.CalendarRendererBase
- </cdk:superclass>
- <cdk:renderer-type>org.richfaces.CalendarRenderer</cdk:renderer-type>
- </cc:interface>
- <cc:implementation>
- <span id="#{clientId}">
- <span id="#{clientId}Popup"
- style="#{component.attributes['popup'] ? '' : 'display:
none'}">
- <c:choose>
- <c:when test="#{!component.attributes['popup']}">
- <input id="#{clientId}InputDate" autocomplete="off"
style="display:none"
- name="#{clientId}InputDate"
value="#{this:getInputValue(facesContext,component)}"
- type="hidden" />
- </c:when>
- <c:otherwise>
- <input id="#{clientId}InputDate" name="#{clientId}InputDate"
- value="#{this:getInputValue(facesContext,component)}"
type="#{component.attributes['showInput'] ? 'text' :
'hidden'}"
- disabled="#{component.attributes['disabled']}"
accesskey="#{component.attributes['accesskey']}"
- maxlength="#{component.attributes['maxlength']}"
size="#{component.attributes['inputSize']}"
- style="vertical-align: middle;
#{component.attributes['inputStyle']}"
- class="rf-ca-inp #{component.attributes['inputClass']}"
- tabindex="#{component.attributes['tabindex']}"
- readonly="#{(!component.attributes['enableManualInput'] ||
component.attributes['readonly']) ? 'readonly' : ''}">
- <cdk:call expression="renderInputHandlers(facesContext, component);"
/>
- </input>
- <c:choose>
- <c:when test="#{isUseIcons(facesContext, component)}">
- <img id="#{clientId}PopupButton" alt=""
- class="rf-ca-btn #{component.attributes['buttonClass']}"
- accesskey="#{component.attributes['accesskey']}"
style="vertical-align: middle"
- tabindex="#{component.attributes['tabindex']}"
src="#{getButtonIcon(facesContext, component)}" />
- </c:when>
- <c:otherwise>
- <button type="button" id="#{clientId}PopupButton"
name="#{clientId}PopupButton"
- style="vertical-align: middle"
- class="rf-ca-btn #{component.attributes['buttonClass']}"
- tabindex="#{component.attributes['tabindex']}"
disabled="#{component.attributes['disabled']}">
- #{component.attributes['buttonLabel']}
- </button>
- </c:otherwise>
- </c:choose>
- </c:otherwise>
- </c:choose>
- <input type="hidden" id="#{clientId}InputCurrentDate"
style="display:none"
- autocomplete="off" name="#{clientId}InputCurrentDate"
- value="#{getCurrentDateAsString(facesContext, component)}" />
- </span>
- <span style="display: none;"
id="#{clientId}Content"></span>
- <span style="display: none;" id="#{clientId}Script">
- <script type="text/javascript">
- <cdk:call
- expression="buildAddLocaleScript(responseWriter, facesContext,
component);" />
- <cdk:call
- expression="buildCalendarScript(responseWriter, facesContext, component);"
/>
- </script>
- </span>
- </span>
- </cc:implementation>
-</cdk:root>