JBoss Rich Faces SVN: r19747 - trunk/examples/input-demo/src/main/webapp/examples.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-10-28 15:11:02 -0400 (Thu, 28 Oct 2010)
New Revision: 19747
Modified:
trunk/examples/input-demo/src/main/webapp/examples/inplaceSelect.xhtml
trunk/examples/input-demo/src/main/webapp/examples/select.xhtml
Log:
add more items ))
Modified: trunk/examples/input-demo/src/main/webapp/examples/inplaceSelect.xhtml
===================================================================
--- trunk/examples/input-demo/src/main/webapp/examples/inplaceSelect.xhtml 2010-10-28 19:09:25 UTC (rev 19746)
+++ trunk/examples/input-demo/src/main/webapp/examples/inplaceSelect.xhtml 2010-10-28 19:11:02 UTC (rev 19747)
@@ -17,12 +17,23 @@
<fieldset>
<legend>InplaceSelect Test App</legend>
Fresh off his victory in the Florida primary, Sen. John McCain is poised to take another big prize. Former
- <in:inplaceSelect defaultLabel="Edit Text" value="#{inputBean.value}">
+ <in:inplaceSelect defaultLabel="Edit Text" value="#{inputBean.value}" openOnEdit="true" saveOnSelect="false">
<f:selectItem itemLabel="Label#1" itemValue="Value#1"/>
<f:selectItem itemLabel="Label#2" itemValue="Value#2"/>
<f:selectItem itemLabel="Label#3" itemValue="Value#3"/>
<f:selectItem itemLabel="Label#4" itemValue="Value#4"/>
+ <f:selectItem itemLabel="Label#5" itemValue="Value#5"/>
+ <f:selectItem itemLabel="Label#6" itemValue="Value#6"/>
+ <f:selectItem itemLabel="Label#7" itemValue="Value#7"/>
+ <f:selectItem itemLabel="Label#8" itemValue="Value#8"/>
+ <f:selectItem itemLabel="Label#9" itemValue="Value#9"/>
+ <f:selectItem itemLabel="Label#10" itemValue="Value#10"/>
+ <f:selectItem itemLabel="Label#11" itemValue="Value#11"/>
+ <f:selectItem itemLabel="Label#12" itemValue="Value#12"/>
+ <f:selectItem itemLabel="Label#13" itemValue="Value#13"/>
+ <f:selectItem itemLabel="Label#14" itemValue="Value#14"/>
</in:inplaceSelect>
+
Mayor Rudy Giuliani plans to drop out and endorse McCain, two GOP sources said. That would give McCain added momentum heading into a debate Wednesday and next week's Super Tuesday contests
</fieldset>
<h:commandButton value="submit"></h:commandButton>
Modified: trunk/examples/input-demo/src/main/webapp/examples/select.xhtml
===================================================================
--- trunk/examples/input-demo/src/main/webapp/examples/select.xhtml 2010-10-28 19:09:25 UTC (rev 19746)
+++ trunk/examples/input-demo/src/main/webapp/examples/select.xhtml 2010-10-28 19:11:02 UTC (rev 19747)
@@ -16,11 +16,21 @@
<div id="scroll" style="width: 400px; height:100px; overflow:auto;" >
<fieldset>
<legend>Select Test App</legend>
- <in:select defaultLabel="Select Value ..." value="#{inputBean.value}">
+ <in:select enableManualInput="true" defaultLabel="Select Value ..." value="#{inputBean.value}">
<f:selectItem itemLabel="Label#1" itemValue="Value#1"/>
<f:selectItem itemLabel="Label#2" itemValue="Value#2"/>
<f:selectItem itemLabel="Label#3" itemValue="Value#3"/>
<f:selectItem itemLabel="Label#4" itemValue="Value#4"/>
+ <f:selectItem itemLabel="Label#5" itemValue="Value#5"/>
+ <f:selectItem itemLabel="Label#6" itemValue="Value#6"/>
+ <f:selectItem itemLabel="Label#7" itemValue="Value#7"/>
+ <f:selectItem itemLabel="Label#8" itemValue="Value#8"/>
+ <f:selectItem itemLabel="Label#9" itemValue="Value#9"/>
+ <f:selectItem itemLabel="Label#10" itemValue="Value#10"/>
+ <f:selectItem itemLabel="Label#11" itemValue="Value#11"/>
+ <f:selectItem itemLabel="Label#12" itemValue="Value#12"/>
+ <f:selectItem itemLabel="Label#13" itemValue="Value#13"/>
+ <f:selectItem itemLabel="Label#14" itemValue="Value#14"/>
</in:select>
</fieldset>
<h:commandButton value="submit"></h:commandButton>
14 years, 2 months
JBoss Rich Faces SVN: r19746 - sandbox/trunk/examples/calendar-demo/src/main/webapp.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-10-28 15:09:25 -0400 (Thu, 28 Oct 2010)
New Revision: 19746
Modified:
sandbox/trunk/examples/calendar-demo/src/main/webapp/calendar.xhtml
Log:
fix sample
Modified: sandbox/trunk/examples/calendar-demo/src/main/webapp/calendar.xhtml
===================================================================
--- sandbox/trunk/examples/calendar-demo/src/main/webapp/calendar.xhtml 2010-10-28 19:05:38 UTC (rev 19745)
+++ sandbox/trunk/examples/calendar-demo/src/main/webapp/calendar.xhtml 2010-10-28 19:09:25 UTC (rev 19746)
@@ -34,12 +34,8 @@
</h:head>
<h:body>
<h:form id="form">
- <h:outputText value="Skin: "/>
- <h:selectOneMenu value="#{skinBean.skin}" onchange="submit();">
- <f:selectItems value="#{skinBean.skins}"/>
- </h:selectOneMenu>
- <br />
- <calendar:calendar />
+ <calendar:calendar popup="true"/>
+ <h:commandButton value="submit"></h:commandButton>
</h:form>
</h:body>
</html>
14 years, 2 months
JBoss Rich Faces SVN: r19745 - in sandbox/trunk/ui/calendar/ui/src/main: java/org/richfaces/component and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: amarkhel
Date: 2010-10-28 15:05:38 -0400 (Thu, 28 Oct 2010)
New Revision: 19745
Added:
sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/events/
sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/events/CurrentDateChangeEvent.java
sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/events/CurrentDateChangeListener.java
sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/
sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/CalendarHandler.java
sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/MethodExpressionCurrentDateChangeListener.java
sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/utils/
sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/utils/CalendarHelper.java
Modified:
sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
sandbox/trunk/ui/calendar/ui/src/main/templates/calendar.template.xml
Log:
continue migration; implement base functionality (without CalendarDataModel), move utility methods to the CalendarHelper class, add currentDateChangeEvent support
Modified: sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-10-28 19:01:39 UTC (rev 19744)
+++ sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/component/AbstractCalendar.java 2010-10-28 19:05:38 UTC (rev 19745)
@@ -20,151 +20,150 @@
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-
package org.richfaces.component;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import javax.faces.FacesException;
-import javax.faces.application.Application;
+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.Converter;
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.events.CurrentDateChangeEvent;
+import org.richfaces.events.CurrentDateChangeListener;
+import org.richfaces.log.Logger;
+import org.richfaces.log.RichfacesLogger;
+import org.richfaces.utils.CalendarHelper;
/**
* @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{
-
+@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";
-
- @Attribute(defaultValue="MMM d, yyyy")
- public abstract String getDatePattern();
+ Logger log = RichfacesLogger.COMPONENTS.getLogger();
- @Attribute(defaultValue="getDefaultLocale()")
- public abstract Object getLocale();
+ protected enum PropertyKeys {
+ locale
+ };
+
- @Attribute(defaultValue="TimeZone.getDefault()")
+ @Attribute(defaultValue = "MMM d, yyyy")
+ public abstract String getDatePattern();
+
+ @Attribute(defaultValue = "TimeZone.getDefault()")
public abstract TimeZone getTimeZone();
-
- @Attribute(defaultValue="Integer.MIN_VALUE")
+
+ @Attribute(defaultValue = "Integer.MIN_VALUE")
public abstract int getFirstWeekDay();
-
- @Attribute(defaultValue="Integer.MIN_VALUE")
+
+ @Attribute(defaultValue = "Integer.MIN_VALUE")
public abstract int getMinDaysInFirstWeek();
-
- @Attribute(defaultValue="select")
+
+ @Attribute(defaultValue = "select")
public abstract String getTodayControlMode();
-
- @Attribute(defaultValue="true")
+
+ @Attribute(defaultValue = "true")
public abstract boolean isShowWeekDaysBar();
-
- @Attribute(defaultValue="true")
+
+ @Attribute(defaultValue = "true")
public abstract boolean isShowWeeksBar();
-
- @Attribute(defaultValue="true")
+
+ @Attribute(defaultValue = "true")
public abstract boolean isShowFooter();
-
- @Attribute(defaultValue="true")
+
+ @Attribute(defaultValue = "true")
public abstract boolean isShowHeader();
-
- @Attribute(defaultValue="true")
+
+ @Attribute(defaultValue = "true")
public abstract boolean isShowInput();
-
- @Attribute(defaultValue="true")
+
+ @Attribute(defaultValue = "true")
public abstract boolean isPopup();
-
- @Attribute(defaultValue="true")
+
+ @Attribute(defaultValue = "true")
public abstract String getHidePopupOnScroll();
-
- @Attribute(defaultValue="false")
+
+ @Attribute(defaultValue = "false")
public abstract boolean isDisable();
-
- @Attribute(defaultValue="false")
+
+ @Attribute(defaultValue = "false")
public abstract boolean isEnableManualInput();
-
- @Attribute(defaultValue="false")
+
+ @Attribute(defaultValue = "false")
public abstract boolean isDayEnabled();
-
- @Attribute(defaultValue="false")
+
+ @Attribute(defaultValue = "false")
public abstract boolean isShowApplyButton();
-
- @Attribute(defaultValue="false")
+
+ @Attribute(defaultValue = "false")
public abstract boolean isResetTimeOnDateSelect();
-
- @Attribute(defaultValue="AA")
+
+ @Attribute(defaultValue = "AA")
public abstract String getJointPoint();
-
- @Attribute(defaultValue="AA")
+
+ @Attribute(defaultValue = "AA")
public abstract String getDirection();
-
- @Attribute(defaultValue="inactive")
+
+ @Attribute(defaultValue = "inactive")
public abstract String getBoundaryDatesMode();
-
- @Attribute(defaultValue="0")
+
+ @Attribute(defaultValue = "0")
public abstract String getHorizontalOffset();
-
- @Attribute(defaultValue="0")
+
+ @Attribute(defaultValue = "0")
public abstract String getVerticalOffsetOffset();
-
- @Attribute(defaultValue="3")
+
+ @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();
@@ -173,235 +172,178 @@
@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"))
+
+ @Attribute(events = @EventName("inputclick"))
public abstract String getOninputclick();
- @Attribute(events=@EventName("inputdblclick"))
+ @Attribute(events = @EventName("inputdblclick"))
public abstract String getOninputdblclick();
- @Attribute(events=@EventName("inputchange"))
+ @Attribute(events = @EventName("inputchange"))
public abstract String getOninputchange();
-
- @Attribute(events=@EventName("inputselect"))
+
+ @Attribute(events = @EventName("inputselect"))
public abstract String getOninputselect();
-
- @Attribute(events=@EventName("inputmousedown"))
+
+ @Attribute(events = @EventName("inputmousedown"))
public abstract String getOninputmousedown();
-
- @Attribute(events=@EventName("inputmousemove"))
+
+ @Attribute(events = @EventName("inputmousemove"))
public abstract String getOninputmousemove();
-
- @Attribute(events=@EventName("inputmouseout"))
+
+ @Attribute(events = @EventName("inputmouseout"))
public abstract String getOninputmouseout();
-
- @Attribute(events=@EventName("inputmouseover"))
+
+ @Attribute(events = @EventName("inputmouseover"))
public abstract String getOninputmouseover();
-
- @Attribute(events=@EventName("inputmouseup"))
+
+ @Attribute(events = @EventName("inputmouseup"))
public abstract String getOninputmouseup();
-
- @Attribute(events=@EventName("inputkeydown"))
+
+ @Attribute(events = @EventName("inputkeydown"))
public abstract String getOninputkeydown();
-
- @Attribute(events=@EventName("inputkeypress"))
+
+ @Attribute(events = @EventName("inputkeypress"))
public abstract String getOninputkeypress();
-
- @Attribute(events=@EventName("inputkeyup"))
+
+ @Attribute(events = @EventName("inputkeyup"))
public abstract String getOninputkeypup();
-
- @Attribute(events=@EventName("inputfocus"))
+
+ @Attribute(events = @EventName("inputfocus"))
public abstract String getOninputfocus();
-
- @Attribute(events=@EventName("inputblur"))
+
+ @Attribute(events = @EventName("inputblur"))
public abstract String getOninputblur();
-
- public Calendar getCalendar() {
- return Calendar.getInstance(getTimeZone(), getAsLocale());
- }
-
- public Date getCurrentDateOrDefault() {
- Date date = getAsDate(getCurrentDate());
- if (date == null) {
- date = getAsDate(this.getValue());
-
- if (date == null) {
- TimeZone timeZone = getTimeZone();
- Calendar calendar = timeZone != null ? Calendar.getInstance(timeZone) : Calendar.getInstance();
- date = calendar.getTime();
+
+ @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 date;
+ return locale != null ? locale : Locale.US;
}
- public Date getAsDate(Object date) {
- if(date == null) {
- return null;
- }
+ public void setLocale(Object locale) {
+ getStateHelper().put(PropertyKeys.locale, locale);
+ }
- Date value = null;
- FacesContext facesContext = getFacesContext();
- if(date instanceof Date) {
- value = (Date)date;
-
- } else if(date instanceof String) {
- DateTimeConverter converter = new DateTimeConverter();
- converter.setPattern(this.getDatePattern());
- converter.setLocale(getAsLocale());
- converter.setTimeZone(this.getTimeZone());
- value = (Date)converter.getAsObject(facesContext, this,(String) date);
-
- } else if(date instanceof Calendar) {
- value = ((Calendar) date).getTime();
-
- } else {
- Converter converter = getConverter();
- if(converter != null) {
- return getAsDate(converter.getAsString(facesContext, this, date));
- }
-
- Application application = facesContext.getApplication();
- converter = application.createConverter(date.getClass());
- if (null != converter) {
- value = getAsDate(converter.getAsString(facesContext, this, date));
+ 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 {
- throw new FacesException("Wrong attibute type or there is no converter for custom attibute type");
+ 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);
}
-
- return value;
}
-
- public Locale getAsLocale() {
- Object locale = getLocale();
- return getAsLocale(locale);
+
+ public void addCurrentDateChangeListener(CurrentDateChangeListener listener) {
+ addFacesListener(listener);
}
-
- protected Locale getDefaultLocale() {
- FacesContext facesContext = FacesContext.getCurrentInstance();
- if (facesContext != null) {
- UIViewRoot viewRoot = facesContext.getViewRoot();
- if (viewRoot != null) {
- Locale locale = viewRoot.getLocale();
- if (locale != null) {
- return locale;
- }
- }
- }
- return Locale.US;
+
+ public void removeToggleListener(CurrentDateChangeListener listener) {
+ removeFacesListener(listener);
}
- public Locale getAsLocale(Object locale) {
-
- if(locale == null) {
- return null;
- }
-
- Locale localeValue = null;
- if (locale instanceof Locale) {
- localeValue = (Locale)locale;
+ public CurrentDateChangeListener[] getCurrentDateChangeListeners() {
+ return (CurrentDateChangeListener[]) getFacesListeners(CurrentDateChangeListener.class);
+ }
- } else if (locale instanceof String) {
- localeValue = parseLocale((String) locale);
+ public void broadcast(FacesEvent event) throws AbortProcessingException {
+ if (event instanceof CurrentDateChangeEvent) {
+ FacesContext facesContext = getFacesContext();
+ CurrentDateChangeEvent currentDateChangeEvent = (CurrentDateChangeEvent) event;
+ String currentDateString = currentDateChangeEvent.getCurrentDateString();
- } else {
- FacesContext context = FacesContext.getCurrentInstance();
- Application application = context.getApplication();
- Converter converter = application .createConverter(locale.getClass());
-
- if (null != converter) {
- localeValue = parseLocale(converter.getAsString(context, this, locale));
- } else {
- throw new FacesException("Wrong locale attibute type or there is no converter for custom attibute type");
+ 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);
}
- return localeValue;
}
-
- public Locale parseLocale(String localeStr){
- if(null==localeStr || localeStr.trim().length() < 2) {
- return Locale.getDefault();
- }
-
- //Lookup index of first '_' in string locale representation.
- int index1 = localeStr.indexOf("_");
- //Get first charters (if exist) from string
- String language = null;
- if(index1!=-1){
- language = localeStr.substring(0, index1);
- }else{
- return new Locale(localeStr);
- }
-
- //Lookup index of second '_' in string locale representation.
- int index2 = localeStr.indexOf("_", index1+1);
- String country = null;
- if(index2!=-1){
- country = localeStr.substring(index1+1, index2);
- String variant = localeStr.substring(index2+1);
- return new Locale(language, country, variant);
- }else{
- country = localeStr.substring(index1+1);
- return new Locale(language, country);
- }
- }
-
- public Date getFormattedDefaultTime() {
- Object defaultTime = getDefaultTime();
- if(defaultTime == null) {
- return null;
+ @Override
+ public void queueEvent(FacesEvent event) {
+ super.queueEvent(event);
+ if (event instanceof CurrentDateChangeEvent) {
+ event.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
}
-
- Date result = null;
- if (defaultTime instanceof Calendar) {
- result = ((Calendar) defaultTime).getTime();
-
- } else if (defaultTime instanceof Date) {
- result = (Date) defaultTime;
-
- } else {
- String defaultTimeString = defaultTime.toString();
- String datePattern = getDatePattern();
-
- String timePattern = TIME_PATTERN;
- Pattern pattern = Pattern.compile(timePattern);
- Matcher matcher = pattern.matcher(datePattern);
-
- String subTimePattern = SUB_TIME_PATTERN;
- if(matcher.find()) {
- subTimePattern = matcher.group().trim();
- }
-
- DateFormat format = new SimpleDateFormat(subTimePattern);
- try {
- result = format.parse(defaultTimeString);
- } catch (ParseException parseException) {
- // log??
- result = null;
- }
- }
-
- return result;
}
}
Added: sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/events/CurrentDateChangeEvent.java
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/events/CurrentDateChangeEvent.java (rev 0)
+++ sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/events/CurrentDateChangeEvent.java 2010-10-28 19:05:38 UTC (rev 19745)
@@ -0,0 +1,61 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+package org.richfaces.events;
+
+import java.util.Date;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.FacesListener;
+
+public class CurrentDateChangeEvent extends FacesEvent {
+
+ private static final long serialVersionUID = -8169207286087810907L;
+ private Date currentDate = null;
+ private String currentDateString = null;
+
+ public CurrentDateChangeEvent(UIComponent component, String curentDateString) {
+ super(component);
+ this.currentDateString = curentDateString;
+ }
+
+ public boolean isAppropriateListener(FacesListener listener) {
+ return false;
+ }
+
+ public void processListener(FacesListener listener) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException();
+ }
+
+ public Date getCurrentDate() {
+ return currentDate;
+ }
+
+ public void setCurrentDate(Date currentDate) {
+ this.currentDate = currentDate;
+ }
+
+ public String getCurrentDateString() {
+ return currentDateString;
+ }
+
+}
Added: sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/events/CurrentDateChangeListener.java
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/events/CurrentDateChangeListener.java (rev 0)
+++ sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/events/CurrentDateChangeListener.java 2010-10-28 19:05:38 UTC (rev 19745)
@@ -0,0 +1,36 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library 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 library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces.events;
+
+import javax.faces.event.FacesListener;
+
+/**
+ * @author Alexej Kushunin - akushunin(a)exadel.com
+ * created 28.08.2007
+ *
+ * Base calendar events interface
+ */
+public interface CurrentDateChangeListener extends FacesListener {
+
+ public void processCurrentDateChange(CurrentDateChangeEvent event);
+
+}
\ No newline at end of file
Modified: sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2010-10-28 19:01:39 UTC (rev 19744)
+++ sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2010-10-28 19:05:38 UTC (rev 19745)
@@ -52,6 +52,8 @@
import org.richfaces.component.util.MessageUtil;
import org.richfaces.component.util.SelectUtils;
import org.richfaces.component.util.ViewUtil;
+import org.richfaces.events.CurrentDateChangeEvent;
+import org.richfaces.utils.CalendarHelper;
/**
* @author amarkhel
@@ -115,8 +117,6 @@
public static final String OPTION_SELECTED_DATE = "selectedDate";
- public static final String OPTION_SUBMIT_FUNCTION = "submitFunction";
-
public static final String OPTION_DAY_CELL_CLASS = "dayCellClass";
public static final String OPTION_DAY_STYLE_CLASS = "dayStyleClass";
@@ -145,7 +145,10 @@
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(
@@ -196,36 +199,90 @@
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 context, UIComponent component, Object submittedValue) throws ConverterException {
- if ((context == null) || (component == null)) {
+ 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;
+ 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(context, calendar, "value");
+ 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();
}
- setupDefaultConverter(converter, calendar);
+ 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() : "";
+ }
+ }
- return converter.getAsObject(context, component, newValue);
+ if (value == null) {
+ value = "";
+ }
+
+ return value;
+
}
public String getButtonIcon(FacesContext facesContext, UIComponent component) {
@@ -251,7 +308,7 @@
if(calendar.isValid()) {
Date date;
Object value = calendar.getValue();
- date = calendar.getAsDate(value);
+ date = CalendarHelper.getAsDate(facesContext, calendar, value);
if(date != null) {
returnValue = formatSelectedDate(calendar.getTimeZone(), date);
}
@@ -276,15 +333,15 @@
}
public Object getCurrentDate(FacesContext facesContext, AbstractCalendar calendar) throws IOException {
- Date date = calendar.getCurrentDateOrDefault();
+ Date date = CalendarHelper.getCurrentDateOrDefault(facesContext, calendar);
return formatDate(date);
}
- public String getCurrentDateAsString(FacesContext context, UIComponent component) throws IOException {
+ public String getCurrentDateAsString(FacesContext facesContext, UIComponent component) throws IOException {
AbstractCalendar calendar = (AbstractCalendar)component;
Format formatter = new SimpleDateFormat("MM/yyyy");
- Date currentDate = calendar.getCurrentDateOrDefault();
+ Date currentDate = CalendarHelper.getCurrentDateOrDefault(facesContext, calendar);
return formatter.format(currentDate);
}
@@ -322,28 +379,29 @@
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;
- Object locale = calendar.getAsLocale();
ClassLoader loader = Thread.currentThread().getContextClassLoader();
String messageBundle = facesContext.getApplication().getMessageBundle();
+ Locale locale = CalendarHelper.getAsLocale(facesContext, calendar);
if (null != messageBundle) {
- bundle1 = ResourceBundle.getBundle(messageBundle, calendar.getAsLocale(locale), loader);
+ bundle1 = ResourceBundle.getBundle(messageBundle,locale , loader);
}
try {
- bundle2 = ResourceBundle.getBundle(CALENDAR_BUNDLE, calendar.getAsLocale(locale), loader);
+ bundle2 = ResourceBundle.getBundle(CALENDAR_BUNDLE, locale, loader);
} catch (MissingResourceException e) {
//No external bundle was found, ignore this exception.
}
-
+
ResourceBundle [] bundles = {bundle1, bundle2};
- String [] test = new String []{};
String[] names = {"apply", "today", "clean", "cancel", "ok", "close"};
+
return getCollectedLabels(bundles, names);
}
@@ -370,49 +428,12 @@
}
return labels;
}
-
- public Object getSubmitFunction(FacesContext context, AbstractCalendar calendar) throws IOException {
- /*
- if (!UICalendar.AJAX_MODE.equals(calendar.getAttributes().get("mode")))
- return null;
-
- JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(calendar, context,
- AjaxRendererUtils.AJAX_FUNCTION_NAME);
- ajaxFunction.addParameter(JSReference.NULL);
-
- HashMap<String, Object> params = new HashMap<String, Object>();
- params.put(calendar.getClientId(context) + CURRENT_DATE_PRELOAD, Boolean.TRUE);
-
- Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, calendar, params, true);
- options.put("calendar", JSReference.THIS);
-
- String oncomplete = AjaxRendererUtils.getAjaxOncomplete(calendar);
- JSFunctionDefinition oncompleteDefinition = new JSFunctionDefinition();
- oncompleteDefinition.addParameter("request");
- oncompleteDefinition.addParameter("event");
- oncompleteDefinition.addParameter("data");
- oncompleteDefinition.addToBody("this.calendar.load(data, true);");
- if (oncomplete != null) {
- oncompleteDefinition.addToBody(oncomplete);
- }
-
- options.put("oncomplete", oncompleteDefinition);
- JSReference requestValue = new JSReference("requestValue");
- ajaxFunction.addParameter(options);
- JSFunctionDefinition definition = new JSFunctionDefinition();
- definition.addParameter(requestValue);
- definition.addToBody(ajaxFunction);
- return definition;
- */
-
- return null;
- }
- public Map<String, Object> getPreparedDefaultTime(AbstractCalendar abstractCalendar) {
- Date date = abstractCalendar.getFormattedDefaultTime();
+ 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 = abstractCalendar.getCalendar();
+ Calendar calendar = CalendarHelper.getCalendar(facesContext, abstractCalendar);
calendar.setTime(date);
int hours = calendar.get(Calendar.HOUR_OF_DAY);
int minutes = calendar.get(Calendar.MINUTE);
@@ -440,10 +461,10 @@
protected Map<String, Object> getLocaleOptions(FacesContext facesContext, AbstractCalendar calendarComponent) {
Map<String, Object> map = new HashMap<String, Object>();
- Locale locale = calendarComponent.getAsLocale();
+ Locale locale = CalendarHelper.getAsLocale(facesContext, calendarComponent);
DateFormatSymbols dateFormat = new DateFormatSymbols(locale);
- Calendar calendar = calendarComponent.getCalendar();
+ Calendar calendar = CalendarHelper.getCalendar(facesContext, calendarComponent);
int maximum = calendar.getActualMaximum(Calendar.DAY_OF_WEEK);
int minimum = calendar.getActualMinimum(Calendar.DAY_OF_WEEK);
@@ -505,9 +526,7 @@
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);
@@ -527,7 +546,6 @@
scriptOptions.addOption(OPTION_VERTICAL_OFFSET);
scriptOptions.addOption(OPTION_CURRENT_DATE, getCurrentDate(facesContext, calendar));
scriptOptions.addOption(OPTION_SELECTED_DATE, getSelectedDate(facesContext, calendar));
- scriptOptions.addOption(OPTION_SUBMIT_FUNCTION, getSubmitFunction(facesContext, calendar));
scriptOptions.addOption(OPTION_DAY_CELL_CLASS, getDayCellClass(facesContext, calendar));
scriptOptions.addOption(OPTION_DAY_STYLE_CLASS, getDayStyleClass(facesContext, calendar));
/*
@@ -535,7 +553,7 @@
*<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(calendar));
+ scriptOptions.addOption(OPTION_DEFAULT_TIME, getPreparedDefaultTime(facesContext, calendar));
scriptOptions.addOption(OPTION_HIDE_POPUP_ON_SCROLL);
scriptOptions.addOption("showWeekDaysBar");
@@ -545,21 +563,24 @@
return scriptOptions;
}
- public void buildLocaleScript(ResponseWriter writer, FacesContext facesContext, UIComponent component) throws IOException {
- AbstractCalendar calendar = (AbstractCalendar)component;
- JSFunction function = new JSFunction("RichFaces.ui.Calendar.addLocale", calendar.getAsLocale(), getLocaleOptions(facesContext, calendar));
- writer.write(function.toScript());
- writer.write(";");
+ 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 buildScript(ResponseWriter writer, FacesContext facesContext, UIComponent component) throws IOException {
- AbstractCalendar calendar = (AbstractCalendar)component;
-
- ScriptOptions scriptOptions = createCalendarScriptOption(facesContext, calendar);
- JSFunction function = new JSFunction("new RichFaces.ui.Calendar", calendar.getClientId(facesContext), calendar.getAsLocale(), scriptOptions, "");
- StringBuffer scriptBuffer = new StringBuffer();
- scriptBuffer.append(function.toScript()).append(".load();");
- writer.write(scriptBuffer.toString());
+ 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) {
@@ -567,24 +588,22 @@
return (label == null || ((String)label).trim().length() == 0);
}
- protected static Converter createDefaultConverter() {
+ protected Converter createDefaultConverter() {
return new DateTimeConverter();
}
- protected static Converter setupDefaultConverter(Converter converter, AbstractCalendar calendar) {
- // skip id converter is null
- if(converter == null) {
+ 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(calendar.getAsLocale());
+ defaultConverter.setLocale( CalendarHelper.getAsLocale(facesContext, calendar));
defaultConverter.setTimeZone(calendar.getTimeZone());
}
-
return converter;
}
-
+
}
\ No newline at end of file
Added: sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/CalendarHandler.java
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/CalendarHandler.java (rev 0)
+++ sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/CalendarHandler.java 2010-10-28 19:05:38 UTC (rev 19745)
@@ -0,0 +1,54 @@
+package org.richfaces.taglib;
+
+import javax.faces.view.facelets.ComponentConfig;
+import javax.faces.view.facelets.ComponentHandler;
+import javax.faces.view.facelets.FaceletContext;
+import javax.faces.view.facelets.MetaRule;
+import javax.faces.view.facelets.MetaRuleset;
+import javax.faces.view.facelets.Metadata;
+import javax.faces.view.facelets.MetadataTarget;
+import javax.faces.view.facelets.TagAttribute;
+
+import org.richfaces.component.AbstractCalendar;
+
+public class CalendarHandler extends ComponentHandler{
+
+ private static final CalendarHandlerMetaRule METARULE = new CalendarHandlerMetaRule();
+
+
+ public CalendarHandler(ComponentConfig config) {
+ super(config);
+ }
+
+ protected MetaRuleset createMetaRuleset(Class type) {
+ MetaRuleset m = super.createMetaRuleset(type);
+ m.addRule(METARULE);
+ return m;
+ }
+
+ static class CalendarHandlerMetaRule extends MetaRule {
+
+ public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) {
+ if (meta.isTargetInstanceOf(AbstractCalendar.class) && "currentDataChangeListener".equals(name)) {
+ return new CalendarMapper(attribute);
+ }
+ return null;
+ }
+
+ }
+
+ static class CalendarMapper extends Metadata {
+
+ private static final Class[] SIGNATURE = new Class[] { org.richfaces.events.CurrentDateChangeListener.class };
+
+ private final TagAttribute attribute;
+
+ public CalendarMapper(TagAttribute attribute) {
+ this.attribute = attribute;
+ }
+
+ public void applyMetadata(FaceletContext ctx, Object instance) {
+ ((AbstractCalendar) instance).addCurrentDateChangeListener((new MethodExpressionCurrentDateChangeListener(this.attribute.getMethodExpression(ctx, null, SIGNATURE))));
+ }
+ }
+}
Added: sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/MethodExpressionCurrentDateChangeListener.java
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/MethodExpressionCurrentDateChangeListener.java (rev 0)
+++ sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/taglib/MethodExpressionCurrentDateChangeListener.java 2010-10-28 19:05:38 UTC (rev 19745)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.taglib;
+
+import javax.el.MethodExpression;
+import javax.faces.context.FacesContext;
+
+import org.richfaces.events.CurrentDateChangeEvent;
+import org.richfaces.events.CurrentDateChangeListener;
+
+public class MethodExpressionCurrentDateChangeListener implements CurrentDateChangeListener {
+
+ private MethodExpression methodExpression;
+
+ public MethodExpressionCurrentDateChangeListener() {
+ super();
+ }
+
+ MethodExpressionCurrentDateChangeListener(MethodExpression methodExpression) {
+ super();
+ this.methodExpression = methodExpression;
+ }
+
+ public void processCurrentDateChange(CurrentDateChangeEvent event) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ methodExpression.invoke(facesContext.getELContext(), new Object[] { event });
+ }
+}
Added: sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/utils/CalendarHelper.java
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/utils/CalendarHelper.java (rev 0)
+++ sandbox/trunk/ui/calendar/ui/src/main/java/org/richfaces/utils/CalendarHelper.java 2010-10-28 19:05:38 UTC (rev 19745)
@@ -0,0 +1,235 @@
+/*
+ * 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.utils;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.faces.FacesException;
+import javax.faces.application.Application;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.Converter;
+import javax.faces.convert.DateTimeConverter;
+
+import org.richfaces.component.AbstractCalendar;
+
+/**
+ * @author amarkhel
+ *
+ */
+public final class CalendarHelper {
+
+ protected CalendarHelper(){
+ }
+
+ public static Date getAsDate(FacesContext facesContext, AbstractCalendar calendar, Object date) {
+ if (date == null) {
+ return null;
+ }
+
+ Date value = null;
+
+ if (date instanceof Date) {
+ value = (Date) date;
+ } else if (date instanceof String) {
+ value = convertStringToDate(facesContext, calendar, (String) date);
+ } else if (date instanceof Calendar) {
+ value = ((Calendar) date).getTime();
+ } else {
+ Converter converter = calendar.getConverter();
+ if (converter == null) {
+ Application application = facesContext.getApplication();
+ converter = application.createConverter(date.getClass());
+ if (converter == null) {
+ throw new FacesException("Wrong attibute type or there is no converter for custom attibute type");
+ }
+ }
+ value = convertStringToDate(facesContext, calendar, converter.getAsString(facesContext, calendar, date));
+ }
+
+ return value;
+ }
+
+ public static Object getDefaultValueOfDefaultTime(FacesContext facesContext, AbstractCalendar calendarComponent) {
+ if (calendarComponent == null) {
+ return null;
+ }
+
+ Calendar calendar = getCalendar(facesContext, calendarComponent);
+ calendar.set(Calendar.HOUR_OF_DAY, 12);
+ calendar.set(Calendar.MINUTE, 0);
+ return calendar.getTime();
+ }
+
+ public static Date getFormattedDefaultTime(AbstractCalendar calendar) {
+ if (calendar == null || calendar.getDefaultTime() == null) {
+ return null;
+
+ }
+ Object defaultTime = calendar.getDefaultTime();
+ Date result = null;
+
+ if (defaultTime instanceof Calendar) {
+ result = ((Calendar) defaultTime).getTime();
+
+ } else if (defaultTime instanceof Date) {
+ result = (Date) defaultTime;
+
+ } else {
+ String defaultTimeString = defaultTime.toString();
+ String datePattern = calendar.getDatePattern();
+
+ String timePattern = AbstractCalendar.TIME_PATTERN;
+ Pattern pattern = Pattern.compile(timePattern);
+ Matcher matcher = pattern.matcher(datePattern);
+
+ String subTimePattern = AbstractCalendar.SUB_TIME_PATTERN;
+ if (matcher.find()) {
+ subTimePattern = matcher.group().trim();
+ }
+
+ DateFormat format = new SimpleDateFormat(subTimePattern);
+ try {
+ result = format.parse(defaultTimeString);
+ } catch (ParseException parseException) {
+ // log??
+ result = null;
+ }
+ }
+
+ return result;
+ }
+
+ public static Locale getAsLocale(FacesContext facesContext, AbstractCalendar calendar) {
+ if (calendar == null || facesContext == null) {
+ return null;
+ }
+
+ Object locale = calendar.getLocale();
+ return getAsLocale(facesContext, calendar, locale);
+ }
+
+ public static Locale getAsLocale(FacesContext facesContext, AbstractCalendar calendar, Object locale) {
+ if (calendar == null || facesContext == null) {
+ return null;
+ }
+
+ Locale localeValue = null;
+ if (locale instanceof Locale) {
+ localeValue = (Locale) locale;
+
+ } else if (locale instanceof String) {
+ localeValue = parseLocale((String) locale);
+
+ } else if (locale != null) {
+ Application application = facesContext.getApplication();
+ Converter converter = application.createConverter(locale.getClass());
+ if (null != converter) {
+ localeValue = parseLocale(converter.getAsString(facesContext, calendar, locale));
+ } else {
+ throw new FacesException("Wrong locale attibute type or there is no converter for custom attibute type");
+ }
+ }
+ return localeValue;
+ }
+
+ public static Locale parseLocale(String localeStr) {
+ if (null == localeStr || localeStr.trim().length() < 2) {
+ return Locale.getDefault();
+ }
+
+ // Lookup index of first '_' in string locale representation.
+ int index1 = localeStr.indexOf("_");
+ // Get first charters (if exist) from string
+ String language = null;
+ if (index1 != -1) {
+ language = localeStr.substring(0, index1);
+ } else {
+ return new Locale(localeStr);
+ }
+
+ // Lookup index of second '_' in string locale representation.
+ int index2 = localeStr.indexOf("_", index1 + 1);
+ String country = null;
+ if (index2 != -1) {
+ country = localeStr.substring(index1 + 1, index2);
+ String variant = localeStr.substring(index2 + 1);
+ return new Locale(language, country, variant);
+ } else {
+ country = localeStr.substring(index1 + 1);
+ return new Locale(language, country);
+ }
+ }
+
+ public static Date convertCurrentDate(String currentDateString) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.clear();
+ calendar.set(Calendar.DATE, 1);
+ int idx = currentDateString.indexOf('/');
+
+ Date date = null;
+ if (idx != -1) {
+ calendar.set(Calendar.MONTH, Integer.parseInt(currentDateString.substring(0, idx)) - 1);
+ calendar.set(Calendar.YEAR, Integer.parseInt(currentDateString.substring(idx + 1)));
+ date = calendar.getTime();
+ }
+ return date;
+ }
+
+ public static Calendar getCalendar(FacesContext facesContext, AbstractCalendar calendar) {
+ if (calendar == null || facesContext == null) {
+ return Calendar.getInstance();
+ }
+ return Calendar.getInstance(calendar.getTimeZone(), getAsLocale(facesContext, calendar));
+ }
+
+ public static Date convertStringToDate(FacesContext facesContext, AbstractCalendar calendar, String date) {
+ DateTimeConverter converter = new DateTimeConverter();
+ converter.setPattern(calendar.getDatePattern());
+ converter.setLocale(getAsLocale(facesContext, calendar));
+ converter.setTimeZone(calendar.getTimeZone());
+ return (Date) converter.getAsObject(facesContext, calendar, date);
+ }
+
+ public static Date getCurrentDateOrDefault(FacesContext facesContext, AbstractCalendar calendar) {
+ if (calendar == null || facesContext == null) {
+ return null;
+ }
+
+ Date date = getAsDate(facesContext, calendar, calendar.getCurrentDate());
+ if (date == null) {
+ date = getAsDate(facesContext, calendar, calendar.getValue());
+ }
+
+ if (date == null) {
+ date = getCalendar(facesContext, calendar).getTime();
+ }
+ return date;
+ }
+}
Modified: sandbox/trunk/ui/calendar/ui/src/main/templates/calendar.template.xml
===================================================================
--- sandbox/trunk/ui/calendar/ui/src/main/templates/calendar.template.xml 2010-10-28 19:01:39 UTC (rev 19744)
+++ sandbox/trunk/ui/calendar/ui/src/main/templates/calendar.template.xml 2010-10-28 19:05:38 UTC (rev 19745)
@@ -59,15 +59,17 @@
</c:choose>
</c:otherwise>
</c:choose>
- <input type="hidden" id="#{clientId}InputCurrentDate" style="display:none" autocomplete="off" name="#{clientId}InputCurrentDate" value="#{getCurrentDateAsString(facesContext, component)}" />
+ <input type="hidden" id="#{clientId}InputCurrentDate" style="display:none"
+ autocomplete="off" name="#{clientId}InputCurrentDate"
+ value="#{getCurrentDateAsString(facesContext, component)}" />
</span>
-
<div style="display: none;" id="#{clientId}"></div>
<div style="display: none;" id="#{clientId}Script">
<script type="text/javascript">
<cdk:call
- expression="buildLocaleScript(responseWriter, facesContext, component);" />
- <cdk:call expression="buildScript(responseWriter, facesContext, component);" />
+ expression="buildAddLocaleScript(responseWriter, facesContext, component);" />
+ <cdk:call
+ expression="buildCalendarScript(responseWriter, facesContext, component);" />
</script>
</div>
</cc:implementation>
14 years, 2 months
JBoss Rich Faces SVN: r19744 - in trunk/examples/iteration-demo/src/main: resources and 5 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-10-28 15:01:39 -0400 (Thu, 28 Oct 2010)
New Revision: 19744
Added:
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java
trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeNodeParser.java
trunk/examples/iteration-demo/src/main/resources/org/
trunk/examples/iteration-demo/src/main/resources/org/richfaces/
trunk/examples/iteration-demo/src/main/resources/org/richfaces/demo/
trunk/examples/iteration-demo/src/main/resources/org/richfaces/demo/plants.xml
trunk/examples/iteration-demo/src/main/webapp/resources/org.richfaces/
trunk/examples/iteration-demo/src/main/webapp/tree.xhtml
Modified:
trunk/examples/iteration-demo/src/main/webapp/index.xhtml
Log:
https://jira.jboss.org/browse/RF-9315
Added: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java (rev 0)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeBean.java 2010-10-28 19:01:39 UTC (rev 19744)
@@ -0,0 +1,64 @@
+/*
+ * 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.demo;
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+import javax.swing.tree.TreeNode;
+
+import org.richfaces.log.LogFactory;
+import org.richfaces.log.Logger;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+@ManagedBean
+@SessionScoped
+public class TreeBean implements Serializable {
+
+ private static final long serialVersionUID = 3368885134614548497L;
+
+ private static final Logger LOGGER = LogFactory.getLogger(TreeBean.class);
+
+ private List<TreeNode> rootNodes;
+
+ @PostConstruct
+ public void init() {
+ try {
+ TreeNodeParser parser = new TreeNodeParser();
+ parser.parse(TreeBean.class.getResource("plants.xml"));
+ rootNodes = parser.getRootNodes();
+ } catch (Exception e) {
+ LOGGER.error(e.getMessage(), e);
+ }
+ }
+
+ public List<TreeNode> getRootNodes() {
+ return rootNodes;
+ }
+
+}
Added: trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeNodeParser.java
===================================================================
--- trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeNodeParser.java (rev 0)
+++ trunk/examples/iteration-demo/src/main/java/org/richfaces/demo/TreeNodeParser.java 2010-10-28 19:01:39 UTC (rev 19744)
@@ -0,0 +1,125 @@
+/*
+ * 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.demo;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+import java.util.Locale;
+
+import javax.swing.tree.TreeNode;
+
+import org.richfaces.model.SwingTreeNodeImpl;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+import com.google.common.base.Joiner;
+import com.google.common.collect.Lists;
+import com.google.common.io.Closeables;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class TreeNodeParser implements ContentHandler {
+
+ private static final Joiner JOINER = Joiner.on("").skipNulls();
+
+ private XMLReader reader;
+
+ private List<TreeNode> rootNodes = Lists.newArrayList();
+
+ private SwingTreeNodeImpl<String> currentNode;
+
+ public TreeNodeParser() throws SAXException {
+ reader = XMLReaderFactory.createXMLReader();
+ }
+
+ public void parse(URL url) throws IOException, SAXException {
+ InputStream is = null;
+ try {
+ is = url.openStream();
+ reader.setContentHandler(this);
+ reader.parse(new InputSource(is));
+ } finally {
+ Closeables.closeQuietly(is);
+ }
+ }
+
+ public List<TreeNode> getRootNodes() {
+ return rootNodes;
+ }
+
+ public void setDocumentLocator(Locator locator) {
+ }
+
+ public void startDocument() throws SAXException {
+ }
+
+ public void endDocument() throws SAXException {
+ }
+
+ public void startPrefixMapping(String prefix, String uri) throws SAXException {
+ }
+
+ public void endPrefixMapping(String prefix) throws SAXException {
+ }
+
+ public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
+ SwingTreeNodeImpl<String> newNode = new SwingTreeNodeImpl<String>();
+
+ if (currentNode == null) {
+ rootNodes.add(newNode);
+ } else {
+ currentNode.addChild(newNode);
+ }
+
+ currentNode.setData(JOINER.join(currentNode.getData(), localName.toLowerCase(Locale.US), " ["));
+
+ currentNode = newNode;
+ }
+
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ currentNode.setData(JOINER.join("]", currentNode.getData()));
+ currentNode = (SwingTreeNodeImpl) currentNode.getParent();
+ }
+
+ public void characters(char[] ch, int start, int length) throws SAXException {
+ currentNode.setData(JOINER.join(currentNode.getData(), new String(ch, start, length)));
+ }
+
+ public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
+ }
+
+ public void processingInstruction(String target, String data) throws SAXException {
+ }
+
+ public void skippedEntity(String name) throws SAXException {
+ }
+
+}
Added: trunk/examples/iteration-demo/src/main/resources/org/richfaces/demo/plants.xml
===================================================================
--- trunk/examples/iteration-demo/src/main/resources/org/richfaces/demo/plants.xml (rev 0)
+++ trunk/examples/iteration-demo/src/main/resources/org/richfaces/demo/plants.xml 2010-10-28 19:01:39 UTC (rev 19744)
@@ -0,0 +1,294 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<!-- Taken from http://www.xmlfiles.com/examples/ -->
+
+<CATALOG>
+ <PLANT>
+ <COMMON>Bloodroot</COMMON>
+ <BOTANICAL>Sanguinaria canadensis</BOTANICAL>
+ <ZONE>4</ZONE>
+ <LIGHT>Mostly Shady</LIGHT>
+ <PRICE>$2.44</PRICE>
+ <AVAILABILITY>031599</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Columbine</COMMON>
+ <BOTANICAL>Aquilegia canadensis</BOTANICAL>
+ <ZONE>3</ZONE>
+ <LIGHT>Mostly Shady</LIGHT>
+ <PRICE>$9.37</PRICE>
+ <AVAILABILITY>030699</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Marsh Marigold</COMMON>
+ <BOTANICAL>Caltha palustris</BOTANICAL>
+ <ZONE>4</ZONE>
+ <LIGHT>Mostly Sunny</LIGHT>
+ <PRICE>$6.81</PRICE>
+ <AVAILABILITY>051799</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Cowslip</COMMON>
+ <BOTANICAL>Caltha palustris</BOTANICAL>
+ <ZONE>4</ZONE>
+ <LIGHT>Mostly Shady</LIGHT>
+ <PRICE>$9.90</PRICE>
+ <AVAILABILITY>030699</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Dutchman's-Breeches</COMMON>
+ <BOTANICAL>Diecentra cucullaria</BOTANICAL>
+ <ZONE>3</ZONE>
+ <LIGHT>Mostly Shady</LIGHT>
+ <PRICE>$6.44</PRICE>
+ <AVAILABILITY>012099</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Ginger, Wild</COMMON>
+ <BOTANICAL>Asarum canadense</BOTANICAL>
+ <ZONE>3</ZONE>
+ <LIGHT>Mostly Shady</LIGHT>
+ <PRICE>$9.03</PRICE>
+ <AVAILABILITY>041899</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Hepatica</COMMON>
+ <BOTANICAL>Hepatica americana</BOTANICAL>
+ <ZONE>4</ZONE>
+ <LIGHT>Mostly Shady</LIGHT>
+ <PRICE>$4.45</PRICE>
+ <AVAILABILITY>012699</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Liverleaf</COMMON>
+ <BOTANICAL>Hepatica americana</BOTANICAL>
+ <ZONE>4</ZONE>
+ <LIGHT>Mostly Shady</LIGHT>
+ <PRICE>$3.99</PRICE>
+ <AVAILABILITY>010299</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Jack-In-The-Pulpit</COMMON>
+ <BOTANICAL>Arisaema triphyllum</BOTANICAL>
+ <ZONE>4</ZONE>
+ <LIGHT>Mostly Shady</LIGHT>
+ <PRICE>$3.23</PRICE>
+ <AVAILABILITY>020199</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Mayapple</COMMON>
+ <BOTANICAL>Podophyllum peltatum</BOTANICAL>
+ <ZONE>3</ZONE>
+ <LIGHT>Mostly Shady</LIGHT>
+ <PRICE>$2.98</PRICE>
+ <AVAILABILITY>060599</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Phlox, Woodland</COMMON>
+ <BOTANICAL>Phlox divaricata</BOTANICAL>
+ <ZONE>3</ZONE>
+ <LIGHT>Sun or Shade</LIGHT>
+ <PRICE>$2.80</PRICE>
+ <AVAILABILITY>012299</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Phlox, Blue</COMMON>
+ <BOTANICAL>Phlox divaricata</BOTANICAL>
+ <ZONE>3</ZONE>
+ <LIGHT>Sun or Shade</LIGHT>
+ <PRICE>$5.59</PRICE>
+ <AVAILABILITY>021699</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Spring-Beauty</COMMON>
+ <BOTANICAL>Claytonia Virginica</BOTANICAL>
+ <ZONE>7</ZONE>
+ <LIGHT>Mostly Shady</LIGHT>
+ <PRICE>$6.59</PRICE>
+ <AVAILABILITY>020199</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Trillium</COMMON>
+ <BOTANICAL>Trillium grandiflorum</BOTANICAL>
+ <ZONE>5</ZONE>
+ <LIGHT>Sun or Shade</LIGHT>
+ <PRICE>$3.90</PRICE>
+ <AVAILABILITY>042999</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Wake Robin</COMMON>
+ <BOTANICAL>Trillium grandiflorum</BOTANICAL>
+ <ZONE>5</ZONE>
+ <LIGHT>Sun or Shade</LIGHT>
+ <PRICE>$3.20</PRICE>
+ <AVAILABILITY>022199</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Violet, Dog-Tooth</COMMON>
+ <BOTANICAL>Erythronium americanum</BOTANICAL>
+ <ZONE>4</ZONE>
+ <LIGHT>Shade</LIGHT>
+ <PRICE>$9.04</PRICE>
+ <AVAILABILITY>020199</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Trout Lily</COMMON>
+ <BOTANICAL>Erythronium americanum</BOTANICAL>
+ <ZONE>4</ZONE>
+ <LIGHT>Shade</LIGHT>
+ <PRICE>$6.94</PRICE>
+ <AVAILABILITY>032499</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Adder's-Tongue</COMMON>
+ <BOTANICAL>Erythronium americanum</BOTANICAL>
+ <ZONE>4</ZONE>
+ <LIGHT>Shade</LIGHT>
+ <PRICE>$9.58</PRICE>
+ <AVAILABILITY>041399</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Anemone</COMMON>
+ <BOTANICAL>Anemone blanda</BOTANICAL>
+ <ZONE>6</ZONE>
+ <LIGHT>Mostly Shady</LIGHT>
+ <PRICE>$8.86</PRICE>
+ <AVAILABILITY>122698</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Grecian Windflower</COMMON>
+ <BOTANICAL>Anemone blanda</BOTANICAL>
+ <ZONE>6</ZONE>
+ <LIGHT>Mostly Shady</LIGHT>
+ <PRICE>$9.16</PRICE>
+ <AVAILABILITY>071099</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Bee Balm</COMMON>
+ <BOTANICAL>Monarda didyma</BOTANICAL>
+ <ZONE>4</ZONE>
+ <LIGHT>Shade</LIGHT>
+ <PRICE>$4.59</PRICE>
+ <AVAILABILITY>050399</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Bergamont</COMMON>
+ <BOTANICAL>Monarda didyma</BOTANICAL>
+ <ZONE>4</ZONE>
+ <LIGHT>Shade</LIGHT>
+ <PRICE>$7.16</PRICE>
+ <AVAILABILITY>042799</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Black-Eyed Susan</COMMON>
+ <BOTANICAL>Rudbeckia hirta</BOTANICAL>
+ <ZONE>Annual</ZONE>
+ <LIGHT>Sunny</LIGHT>
+ <PRICE>$9.80</PRICE>
+ <AVAILABILITY>061899</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Buttercup</COMMON>
+ <BOTANICAL>Ranunculus</BOTANICAL>
+ <ZONE>4</ZONE>
+ <LIGHT>Shade</LIGHT>
+ <PRICE>$2.57</PRICE>
+ <AVAILABILITY>061099</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Crowfoot</COMMON>
+ <BOTANICAL>Ranunculus</BOTANICAL>
+ <ZONE>4</ZONE>
+ <LIGHT>Shade</LIGHT>
+ <PRICE>$9.34</PRICE>
+ <AVAILABILITY>040399</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Butterfly Weed</COMMON>
+ <BOTANICAL>Asclepias tuberosa</BOTANICAL>
+ <ZONE>Annual</ZONE>
+ <LIGHT>Sunny</LIGHT>
+ <PRICE>$2.78</PRICE>
+ <AVAILABILITY>063099</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Cinquefoil</COMMON>
+ <BOTANICAL>Potentilla</BOTANICAL>
+ <ZONE>Annual</ZONE>
+ <LIGHT>Shade</LIGHT>
+ <PRICE>$7.06</PRICE>
+ <AVAILABILITY>052599</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Primrose</COMMON>
+ <BOTANICAL>Oenothera</BOTANICAL>
+ <ZONE>3 - 5</ZONE>
+ <LIGHT>Sunny</LIGHT>
+ <PRICE>$6.56</PRICE>
+ <AVAILABILITY>013099</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Gentian</COMMON>
+ <BOTANICAL>Gentiana</BOTANICAL>
+ <ZONE>4</ZONE>
+ <LIGHT>Sun or Shade</LIGHT>
+ <PRICE>$7.81</PRICE>
+ <AVAILABILITY>051899</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Blue Gentian</COMMON>
+ <BOTANICAL>Gentiana</BOTANICAL>
+ <ZONE>4</ZONE>
+ <LIGHT>Sun or Shade</LIGHT>
+ <PRICE>$8.56</PRICE>
+ <AVAILABILITY>050299</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Jacob's Ladder</COMMON>
+ <BOTANICAL>Polemonium caeruleum</BOTANICAL>
+ <ZONE>Annual</ZONE>
+ <LIGHT>Shade</LIGHT>
+ <PRICE>$9.26</PRICE>
+ <AVAILABILITY>022199</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Greek Valerian</COMMON>
+ <BOTANICAL>Polemonium caeruleum</BOTANICAL>
+ <ZONE>Annual</ZONE>
+ <LIGHT>Shade</LIGHT>
+ <PRICE>$4.36</PRICE>
+ <AVAILABILITY>071499</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>California Poppy</COMMON>
+ <BOTANICAL>Eschscholzia californica</BOTANICAL>
+ <ZONE>Annual</ZONE>
+ <LIGHT>Sun</LIGHT>
+ <PRICE>$7.89</PRICE>
+ <AVAILABILITY>032799</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Shooting Star</COMMON>
+ <BOTANICAL>Dodecatheon</BOTANICAL>
+ <ZONE>Annual</ZONE>
+ <LIGHT>Mostly Shady</LIGHT>
+ <PRICE>$8.60</PRICE>
+ <AVAILABILITY>051399</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Snakeroot</COMMON>
+ <BOTANICAL>Cimicifuga</BOTANICAL>
+ <ZONE>Annual</ZONE>
+ <LIGHT>Shade</LIGHT>
+ <PRICE>$5.63</PRICE>
+ <AVAILABILITY>071199</AVAILABILITY>
+ </PLANT>
+ <PLANT>
+ <COMMON>Cardinal Flower</COMMON>
+ <BOTANICAL>Lobelia cardinalis</BOTANICAL>
+ <ZONE>2</ZONE>
+ <LIGHT>Shade</LIGHT>
+ <PRICE>$3.02</PRICE>
+ <AVAILABILITY>022299</AVAILABILITY>
+ </PLANT>
+</CATALOG>
Modified: trunk/examples/iteration-demo/src/main/webapp/index.xhtml
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/index.xhtml 2010-10-28 19:01:33 UTC (rev 19743)
+++ trunk/examples/iteration-demo/src/main/webapp/index.xhtml 2010-10-28 19:01:39 UTC (rev 19744)
@@ -13,6 +13,7 @@
<li><h:link outcome="dataGrid">rich:DataGrid</h:link></li>
<li><h:link outcome="filteringAndSorting">filtering and sorting feature</h:link></li>
<li><h:link outcome="list">rich:list</h:link></li>
+ <li><h:link outcome="tree">rich:tree</h:link></li>
</ul>
Added: trunk/examples/iteration-demo/src/main/webapp/tree.xhtml
===================================================================
--- trunk/examples/iteration-demo/src/main/webapp/tree.xhtml (rev 0)
+++ trunk/examples/iteration-demo/src/main/webapp/tree.xhtml 2010-10-28 19:01:39 UTC (rev 19744)
@@ -0,0 +1,22 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:it="http://richfaces.org/iteration">
+<f:view contentType="text/html" />
+
+<h:head>
+ <title>Richfaces Tree</title>
+</h:head>
+
+<h:body>
+ <it:tree id="tree" var="node" value="#{treeBean.rootNodes}">
+ <it:treeNode>
+ <h:panelGroup id="group">
+ #{node.data}
+ </h:panelGroup>
+ </it:treeNode>
+ </it:tree>
+</h:body>
+</html>
14 years, 2 months
JBoss Rich Faces SVN: r19743 - in trunk/ui/input/ui/src: main/templates and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-10-28 15:01:33 -0400 (Thu, 28 Oct 2010)
New Revision: 19743
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java
trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml
trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
trunk/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceSelectRendererTest.java
trunk/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceInputTestEdit.xmlunit.xml
trunk/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceInputTestWithControls.xmlunit.xml
trunk/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceSelectTestEdit.xmlunit.xml
trunk/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceSelectTestWithControls.xmlunit.xml
Log:
use new method getResourcePath from utils
Modified: trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java
===================================================================
--- trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java 2010-10-28 18:59:28 UTC (rev 19742)
+++ trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java 2010-10-28 19:01:33 UTC (rev 19743)
@@ -150,8 +150,8 @@
return value;
}
- public String getResourcePath(FacesContext context, String resourceName) {
- return RenderKitUtils.getResourcePath(context, resourceName);
+ public String getResourcePath(FacesContext context, String library, String resourceName) {
+ return RenderKitUtils.getResourcePath(context, library, resourceName);
}
public String getStateStyleClass(UIComponent component, InplaceState inplaceState) {
Modified: trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-10-28 18:59:28 UTC (rev 19742)
+++ trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-10-28 19:01:33 UTC (rev 19743)
@@ -66,12 +66,12 @@
<span id="#{clientId}Btn" style="position : relative">
<input type="image"
id="#{clientId}Okbtn"
- src="#{getResourcePath(facesContext, 'org.richfaces/ico_ok.gif')}"
+ src="#{getResourcePath(facesContext, 'org.richfaces', 'ico_ok.gif')}"
class="rf-ii-btn" onmousedown="this.className='rf-ii-btn-p'"
onmouseout="this.className='rf-ii-btn'" onmouseup="this.className='rf-ii-btn'" />
<input type="image"
id="#{clientId}Cancelbtn"
- src="#{getResourcePath(facesContext,'org.richfaces/ico_cancel.gif')}"
+ src="#{getResourcePath(facesContext,'org.richfaces', 'ico_cancel.gif')}"
class="rf-ii-btn" onmousedown="this.className='rf-ii-btn-press'"
onmouseout="this.className='rf-ii-btn'" onmouseup="this.className='rf-ii-btn'" />
<br />
Modified: trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-10-28 18:59:28 UTC (rev 19742)
+++ trunk/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-10-28 19:01:33 UTC (rev 19743)
@@ -65,11 +65,11 @@
<span id="#{clientId}Btn" style="position : relative;">
<input type="image" name="#{clientId}Okbtn" id="#{clientId}Okbtn"
- src="#{getResourcePath(facesContext, 'org.richfaces/ico_ok.gif')}"
+ src="#{getResourcePath(facesContext, 'org.richfaces', 'ico_ok.gif')}"
class="rf-is-btn" onmousedown="this.className='rf-is-btn-press'"
onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" />
<input name="#{clientId}Okbtn" type="image" id="#{clientId}Cancelbtn"
- src="#{getResourcePath(facesContext,'org.richfaces/ico_cancel.gif')}"
+ src="#{getResourcePath(facesContext,'org.richfaces', 'ico_cancel.gif')}"
class="rf-is-btn" onmousedown="this.className='rf-is-btn-press'"
onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" />
<br />
Modified: trunk/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceSelectRendererTest.java
===================================================================
--- trunk/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceSelectRendererTest.java 2010-10-28 18:59:28 UTC (rev 19742)
+++ trunk/ui/input/ui/src/test/java/org/richfaces/renderkit/InplaceSelectRendererTest.java 2010-10-28 19:01:33 UTC (rev 19743)
@@ -21,6 +21,7 @@
* @author abelevich
*
*/
+
public class InplaceSelectRendererTest extends InplaceRendererTestBase {
Modified: trunk/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceInputTestEdit.xmlunit.xml
===================================================================
--- trunk/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceInputTestEdit.xmlunit.xml 2010-10-28 18:59:28 UTC (rev 19742)
+++ trunk/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceInputTestEdit.xmlunit.xml 2010-10-28 19:01:33 UTC (rev 19743)
@@ -17,12 +17,12 @@
<input class="rf-ii-btn" id="form:inplaceInputEditOkbtn"
onmousedown="this.className='rf-ii-btn-p'" onmouseout="this.className='rf-ii-btn'"
onmouseup="this.className='rf-ii-btn'"
- src="/javax.faces.resource/org.richfaces/ico_ok.gif.jsf"
+ src="/javax.faces.resource/ico_ok.gif.jsf?ln=org.richfaces"
type="image" />
<input class="rf-ii-btn" id="form:inplaceInputEditCancelbtn"
onmousedown="this.className='rf-ii-btn-press'" onmouseout="this.className='rf-ii-btn'"
onmouseup="this.className='rf-ii-btn'"
- src="/javax.faces.resource/org.richfaces/ico_cancel.gif.jsf"
+ src="/javax.faces.resource/ico_cancel.gif.jsf?ln=org.richfaces"
type="image" />
<br />
</span>
Modified: trunk/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceInputTestWithControls.xmlunit.xml
===================================================================
--- trunk/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceInputTestWithControls.xmlunit.xml 2010-10-28 18:59:28 UTC (rev 19742)
+++ trunk/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceInputTestWithControls.xmlunit.xml 2010-10-28 19:01:33 UTC (rev 19743)
@@ -18,12 +18,12 @@
<input class="rf-ii-btn" id="form:inplaceInputWithControlsOkbtn"
onmousedown="this.className='rf-ii-btn-p'" onmouseout="this.className='rf-ii-btn'"
onmouseup="this.className='rf-ii-btn'"
- src="/javax.faces.resource/org.richfaces/ico_ok.gif.jsf"
+ src="/javax.faces.resource/ico_ok.gif.jsf?ln=org.richfaces"
type="image" />
<input class="rf-ii-btn" id="form:inplaceInputWithControlsCancelbtn"
onmousedown="this.className='rf-ii-btn-press'" onmouseout="this.className='rf-ii-btn'"
onmouseup="this.className='rf-ii-btn'"
- src="/javax.faces.resource/org.richfaces/ico_cancel.gif.jsf"
+ src="/javax.faces.resource/ico_cancel.gif.jsf?ln=org.richfaces"
type="image" />
<br />
</span>
Modified: trunk/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceSelectTestEdit.xmlunit.xml
===================================================================
--- trunk/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceSelectTestEdit.xmlunit.xml 2010-10-28 18:59:28 UTC (rev 19742)
+++ trunk/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceSelectTestEdit.xmlunit.xml 2010-10-28 19:01:33 UTC (rev 19743)
@@ -18,8 +18,8 @@
<span class="rf-is-shdw-b">
</span>
<span id="form:inplaceSelectEditBtn" style="position : relative;">
- <input class="rf-is-btn" id="form:inplaceSelectEditOkbtn" name="form:inplaceSelectEditOkbtn" onmousedown="this.className='rf-is-btn-press'" onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" src="/javax.faces.resource/org.richfaces/ico_ok.gif.jsf" type="image"/>
- <input class="rf-is-btn" id="form:inplaceSelectEditCancelbtn" name="form:inplaceSelectEditOkbtn" onmousedown="this.className='rf-is-btn-press'" onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" src="/javax.faces.resource/org.richfaces/ico_cancel.gif.jsf" type="image"/>
+ <input class="rf-is-btn" id="form:inplaceSelectEditOkbtn" name="form:inplaceSelectEditOkbtn" onmousedown="this.className='rf-is-btn-press'" onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" src="/javax.faces.resource/ico_ok.gif.jsf?ln=org.richfaces" type="image"/>
+ <input class="rf-is-btn" id="form:inplaceSelectEditCancelbtn" name="form:inplaceSelectEditOkbtn" onmousedown="this.className='rf-is-btn-press'" onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" src="/javax.faces.resource/ico_cancel.gif.jsf?ln=org.richfaces" type="image"/>
<br/>
</span>
</span>
Modified: trunk/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceSelectTestWithControls.xmlunit.xml
===================================================================
--- trunk/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceSelectTestWithControls.xmlunit.xml 2010-10-28 18:59:28 UTC (rev 19742)
+++ trunk/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceSelectTestWithControls.xmlunit.xml 2010-10-28 19:01:33 UTC (rev 19743)
@@ -18,8 +18,8 @@
<span class="rf-is-shdw-b">
</span>
<span id="form:inplaceSelectWithControlsBtn" style="position : relative;">
- <input class="rf-is-btn" id="form:inplaceSelectWithControlsOkbtn" name="form:inplaceSelectWithControlsOkbtn" onmousedown="this.className='rf-is-btn-press'" onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" src="/javax.faces.resource/org.richfaces/ico_ok.gif.jsf" type="image"/>
- <input class="rf-is-btn" id="form:inplaceSelectWithControlsCancelbtn" name="form:inplaceSelectWithControlsOkbtn" onmousedown="this.className='rf-is-btn-press'" onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" src="/javax.faces.resource/org.richfaces/ico_cancel.gif.jsf" type="image"/>
+ <input class="rf-is-btn" id="form:inplaceSelectWithControlsOkbtn" name="form:inplaceSelectWithControlsOkbtn" onmousedown="this.className='rf-is-btn-press'" onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" src="/javax.faces.resource/ico_ok.gif.jsf?ln=org.richfaces" type="image"/>
+ <input class="rf-is-btn" id="form:inplaceSelectWithControlsCancelbtn" name="form:inplaceSelectWithControlsOkbtn" onmousedown="this.className='rf-is-btn-press'" onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" src="/javax.faces.resource/ico_cancel.gif.jsf?ln=org.richfaces" type="image"/>
<br/>
</span>
</span>
14 years, 2 months
JBoss Rich Faces SVN: r19742 - trunk/ui/common/ui/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2010-10-28 14:59:28 -0400 (Thu, 28 Oct 2010)
New Revision: 19742
Modified:
trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/RenderKitUtils.java
Log:
fis getResourcePath method
Modified: trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/RenderKitUtils.java
===================================================================
--- trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/RenderKitUtils.java 2010-10-28 18:57:57 UTC (rev 19741)
+++ trunk/ui/common/ui/src/main/java/org/richfaces/renderkit/RenderKitUtils.java 2010-10-28 18:59:28 UTC (rev 19742)
@@ -687,14 +687,16 @@
return sb.toString();
}
-
- public static String getResourcePath(FacesContext context, String resourceName) {
- if (resourceName != null) {
+ public static String getResourcePath(FacesContext context, String library, String resourceName) {
+ String path = null;
+ if(resourceName != null) {
ResourceHandler resourceHandler = context.getApplication().getResourceHandler();
- Resource resource = resourceHandler.createResource(resourceName);
- return resource.getRequestPath();
+ Resource resource = (library != null) ? resourceHandler.createResource(resourceName,library) : resourceHandler.createResource(resourceName);
+ if(resource != null) {
+ path = resource.getRequestPath();
+ }
}
- return null;
+ return path;
}
@SuppressWarnings("serial")
@@ -737,9 +739,6 @@
last.setDefaultValue(value);
return this;
}
-
-
-
}
}
14 years, 2 months
JBoss Rich Faces SVN: r19741 - trunk/ui/iteration/api/src/main/java/org/richfaces/model.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2010-10-28 14:57:57 -0400 (Thu, 28 Oct 2010)
New Revision: 19741
Added:
trunk/ui/iteration/api/src/main/java/org/richfaces/model/SwingTreeNodeImpl.java
Log:
https://jira.jboss.org/browse/RF-9315
Added: trunk/ui/iteration/api/src/main/java/org/richfaces/model/SwingTreeNodeImpl.java
===================================================================
--- trunk/ui/iteration/api/src/main/java/org/richfaces/model/SwingTreeNodeImpl.java (rev 0)
+++ trunk/ui/iteration/api/src/main/java/org/richfaces/model/SwingTreeNodeImpl.java 2010-10-28 18:57:57 UTC (rev 19741)
@@ -0,0 +1,102 @@
+/*
+ * 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.model;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+
+import javax.swing.tree.TreeNode;
+
+import com.google.common.collect.Iterators;
+
+/**
+ * @author Nick Belaevski
+ *
+ */
+public class SwingTreeNodeImpl<T> implements TreeNode, Serializable {
+
+ private static final long serialVersionUID = 8841984268370598781L;
+
+ private TreeNode parent;
+
+ private T data;
+
+ private List<TreeNode> children = new ArrayList<TreeNode>();
+
+ public SwingTreeNodeImpl() {
+ }
+
+ public SwingTreeNodeImpl(List<TreeNode> children) {
+ this.children = children;
+ }
+
+ public TreeNode getChildAt(int childIndex) {
+ return children.get(childIndex);
+ }
+
+ public int getChildCount() {
+ return children.size();
+ }
+
+ public TreeNode getParent() {
+ return parent;
+ }
+
+ public void setParent(TreeNode parent) {
+ this.parent = parent;
+ }
+
+ public int getIndex(TreeNode node) {
+ return children.indexOf(node);
+ }
+
+ public void addChild(TreeNode node) {
+ ((SwingTreeNodeImpl<?>) node).setParent(this);
+ children.add(node);
+ }
+
+ public boolean getAllowsChildren() {
+ return true;
+ }
+
+ public boolean isLeaf() {
+ return children.isEmpty();
+ }
+
+ public Enumeration<?> children() {
+ return Iterators.asEnumeration(children.iterator());
+ }
+
+ public T getData() {
+ return data;
+ }
+
+ public void setData(T data) {
+ this.data = data;
+ }
+
+ public List<TreeNode> getChildrenList() {
+ return children;
+ }
+}
14 years, 2 months
JBoss Rich Faces SVN: r19740 - in branches/RF-8742: examples/output-demo/src/main/webapp/WEB-INF and 24 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: alexsmirnov
Date: 2010-10-28 13:05:33 -0400 (Thu, 28 Oct 2010)
New Revision: 19740
Added:
branches/RF-8742/examples/output-demo/src/main/webapp/examples/tooltip.xhtml
branches/RF-8742/examples/output-demo/src/main/webapp/qunit/tooltip.xhtml
branches/RF-8742/examples/output-demo/src/main/webapp/resources/tests/richfaces-tooltip-qunit.js
branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceInput/inplaceInput.xhtml
branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceInput/samples/inplaceInput-sample.xhtml
branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/
branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/inplaceSelect.xhtml
branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/samples/
branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/samples/inplaceSelect-sample.xhtml
branches/RF-8742/ui/output/api/src/main/java/org/richfaces/TooltipDirection.java
branches/RF-8742/ui/output/api/src/main/java/org/richfaces/TooltipLayout.java
branches/RF-8742/ui/output/api/src/main/java/org/richfaces/TooltipMode.java
branches/RF-8742/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java
branches/RF-8742/ui/output/ui/src/main/java/org/richfaces/component/UITooltip.java
branches/RF-8742/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTooltip.java
branches/RF-8742/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java
branches/RF-8742/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js
branches/RF-8742/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.ecss
branches/RF-8742/ui/output/ui/src/test/java/org/richfaces/component/UITooltipTest.java
branches/RF-8742/ui/output/ui/src/test/java/org/richfaces/renderkit/html/TooltipRendererTest.java
branches/RF-8742/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xhtml
branches/RF-8742/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xmlunit.xml
Removed:
branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceInput/inplaceSelect.xhtml
branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceInput/samples/inplaceSelect-sample.xhtml
branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/inplaceSelect.xhtml
branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/samples/
branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/samples/inplaceSelect-sample.xhtml
Modified:
branches/RF-8742/
branches/RF-8742/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml
branches/RF-8742/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-item-qunit.js
branches/RF-8742/examples/output-demo/src/main/webapp/templates/template.xhtml
branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/select/samples/select-sample.xhtml
branches/RF-8742/ui/common/ui/src/main/java/org/richfaces/renderkit/RenderKitUtils.java
branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java
branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss
branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popupList.js
branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.ecss
branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js
branches/RF-8742/ui/input/ui/src/main/templates/inplaceSelect.template.xml
branches/RF-8742/ui/input/ui/src/main/templates/select.template.xml
branches/RF-8742/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceSelectTestDefault.xmlunit.xml
branches/RF-8742/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceSelectTestEdit.xmlunit.xml
branches/RF-8742/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceSelectTestWithControls.xmlunit.xml
branches/RF-8742/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
branches/RF-8742/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
branches/RF-8742/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
branches/RF-8742/ui/output/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java
Log:
Merged revisions 19721-19730,19739 via svnmerge from
https://svn.jboss.org/repos/richfaces/trunk
.......
r19721 | abelevich | 2010-10-28 01:16:52 -0700 (Thu, 28 Oct 2010) | 1 line
add 'mouseover', 'click' handlers which was removed from popup base class
.......
r19722 | abelevich | 2010-10-28 03:51:49 -0700 (Thu, 28 Oct 2010) | 1 line
add scroll support for the selects
.......
r19723 | abelevich | 2010-10-28 03:59:38 -0700 (Thu, 28 Oct 2010) | 1 line
remove debug info
.......
r19724 | abelevich | 2010-10-28 05:08:05 -0700 (Thu, 28 Oct 2010) | 1 line
fix test, add styles for fonts
.......
r19725 | ilya_shaikovsky | 2010-10-28 05:34:46 -0700 (Thu, 28 Oct 2010) | 1 line
reverted back erroneous commit and made corrections(both inplaces). Previously commited select folder rewritten input one because of SVN plugin error.
.......
r19726 | abelevich | 2010-10-28 06:55:25 -0700 (Thu, 28 Oct 2010) | 1 line
add help method to get resource requestPath
.......
r19727 | amarkhel | 2010-10-28 06:58:50 -0700 (Thu, 28 Oct 2010) | 1 line
RF-9474 Tooltip component
.......
r19728 | abelevich | 2010-10-28 07:15:26 -0700 (Thu, 28 Oct 2010) | 1 line
add name attributes to the inputs
.......
r19729 | amarkhel | 2010-10-28 07:30:03 -0700 (Thu, 28 Oct 2010) | 2 lines
RF-9474 Tooltip component
small fixes
.......
r19730 | ilya_shaikovsky | 2010-10-28 07:52:37 -0700 (Thu, 28 Oct 2010) | 1 line
https://jira.jboss.org/browse/RF-9208
.......
r19739 | ilya_shaikovsky | 2010-10-28 09:13:23 -0700 (Thu, 28 Oct 2010) | 1 line
https://jira.jboss.org/browse/RF-9243
.......
Property changes on: branches/RF-8742
___________________________________________________________________
Name: svnmerge-integrated
- /trunk:1-19713
+ /trunk:1-19739
Modified: branches/RF-8742/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- branches/RF-8742/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/examples/output-demo/src/main/webapp/WEB-INF/faces-config.xml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -9,7 +9,20 @@
</managed-bean>
<navigation-rule>
- <!-- Examples -->
+ <navigation-case>
+ <from-outcome>panel</from-outcome>
+ <to-view-id>/examples/panel.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>popup</from-outcome>
+ <to-view-id>/examples/popupPanel.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>progressbar</from-outcome>
+ <to-view-id>/examples/progressbar.xhtml</to-view-id>
+ </navigation-case>
+
+ <!-- TogglePanel navigation -->
<navigation-case>
<from-outcome>togglePanel</from-outcome>
<to-view-id>/examples/togglePanel.xhtml</to-view-id>
@@ -31,32 +44,6 @@
<to-view-id>/examples/togglePanel-mixed.xhtml</to-view-id>
</navigation-case>
<navigation-case>
- <from-outcome>accordion</from-outcome>
- <to-view-id>/examples/accordion.xhtml</to-view-id>
- </navigation-case>
- <navigation-case>
- <from-outcome>collapsiblePanel</from-outcome>
- <to-view-id>/examples/collapsiblePanel.xhtml</to-view-id>
- </navigation-case>
- <navigation-case>
- <from-outcome>tabPanel</from-outcome>
- <to-view-id>/examples/tabPanel.xhtml</to-view-id>
- </navigation-case>
- <navigation-case>
- <from-outcome>panel</from-outcome>
- <to-view-id>/examples/panel.xhtml</to-view-id>
- </navigation-case>
- <navigation-case>
- <from-outcome>popup</from-outcome>
- <to-view-id>/examples/popupPanel.xhtml</to-view-id>
- </navigation-case>
- <navigation-case>
- <from-outcome>progressbar</from-outcome>
- <to-view-id>/examples/progressbar.xhtml</to-view-id>
- </navigation-case>
-
- <!-- QUnit -->
- <navigation-case>
<from-outcome>qunit/togglePanel</from-outcome>
<to-view-id>/qunit/togglePanel.xhtml</to-view-id>
</navigation-case>
@@ -64,7 +51,13 @@
<from-outcome>qunit/togglePanelItem</from-outcome>
<to-view-id>/qunit/togglePanelItem.xhtml</to-view-id>
</navigation-case>
+
+ <!-- Accordion navigation -->
<navigation-case>
+ <from-outcome>accordion</from-outcome>
+ <to-view-id>/examples/accordion.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
<from-outcome>qunit/accordion</from-outcome>
<to-view-id>/qunit/accordion.xhtml</to-view-id>
</navigation-case>
@@ -72,13 +65,35 @@
<from-outcome>qunit/accordionHeaders</from-outcome>
<to-view-id>/qunit/accordionHeaders.xhtml</to-view-id>
</navigation-case>
+
+ <!-- CollapsiblePanel navigation -->
<navigation-case>
+ <from-outcome>collapsiblePanel</from-outcome>
+ <to-view-id>/examples/collapsiblePanel.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
<from-outcome>qunit/collapsiblePanel</from-outcome>
<to-view-id>/qunit/collapsiblePanel.xhtml</to-view-id>
</navigation-case>
+
+ <!-- TabPanel navigation -->
<navigation-case>
+ <from-outcome>tabPanel</from-outcome>
+ <to-view-id>/examples/tabPanel.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
<from-outcome>qunit/tabPanel</from-outcome>
<to-view-id>/qunit/tabPanel.xhtml</to-view-id>
</navigation-case>
+
+ <!-- Tooltip navigation -->
+ <navigation-case>
+ <from-outcome>tooltip</from-outcome>
+ <to-view-id>/examples/tooltip.xhtml</to-view-id>
+ </navigation-case>
+ <navigation-case>
+ <from-outcome>qunit/tooltip</from-outcome>
+ <to-view-id>/qunit/tooltip.xhtml</to-view-id>
+ </navigation-case>
</navigation-rule>
</faces-config>
Copied: branches/RF-8742/examples/output-demo/src/main/webapp/examples/tooltip.xhtml (from rev 19739, trunk/examples/output-demo/src/main/webapp/examples/tooltip.xhtml)
===================================================================
--- branches/RF-8742/examples/output-demo/src/main/webapp/examples/tooltip.xhtml (rev 0)
+++ branches/RF-8742/examples/output-demo/src/main/webapp/examples/tooltip.xhtml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -0,0 +1,51 @@
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright ${year}, 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.
+-->
+
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:pn="http://richfaces.org/output">
+
+<body>
+<ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="scripts">
+ <h:outputScript name="Tooltip.js" />
+ </ui:define>
+
+ <ui:define name="title">TOOLTIP JS Development</ui:define>
+ <ui:define name="body_head">TOOLTIP JS Development</ui:define>
+
+ <ui:define name="body">
+ <h:form id="f" style="border:blue solid thin;">
+ <pn:tooltip id="tooltip">
+ <!-- TODO -->
+ </pn:tooltip>
+ </h:form>
+ </ui:define>
+</ui:composition>
+</body>
+</html>
+
Copied: branches/RF-8742/examples/output-demo/src/main/webapp/qunit/tooltip.xhtml (from rev 19739, trunk/examples/output-demo/src/main/webapp/qunit/tooltip.xhtml)
===================================================================
--- branches/RF-8742/examples/output-demo/src/main/webapp/qunit/tooltip.xhtml (rev 0)
+++ branches/RF-8742/examples/output-demo/src/main/webapp/qunit/tooltip.xhtml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -0,0 +1,71 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--
+JBoss, Home of Professional Open Source
+Copyright ${year}, 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.
+-->
+
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:pn="http://richfaces.org/output">
+
+<body>
+<ui:composition template="/templates/template.xhtml">
+
+ <ui:define name="scripts">
+ <h:outputScript name="qunit/qunit.js"/>
+ <h:outputScript name="qunit/richfaces-qunit.js"/>
+
+ <h:outputStylesheet name="qunit/qunit.css"/>
+ </ui:define>
+
+ <ui:define name="title">Tooltip Example</ui:define>
+ <ui:define name="body_head">Tooltip Example</ui:define>
+
+ <ui:define name="body">
+ <p>Page</p>
+
+ <h:form id="f" style="border:blue solid thin;">
+ <div id="div" style="border: 2px solid red; background-color: #adff2f; width:300px; height:300px">
+ Hello
+
+ <pn:tooltip id="tooltip" target="div">
+ ToolTip Yo!!!
+ </pn:tooltip>
+ </div>
+
+
+ </h:form>
+ <p>Result</p>
+
+ <div>
+ <ol id="qunit-tests"></ol>
+
+ <div id="testDiv" style="margin-top:10px; border:1px solid #a0a0a0">Main Test Div</div>
+ </div>
+ <!--<h:outputScript name="tests/richfaces-tooltip-qunit.js" />-->
+ </ui:define>
+</ui:composition>
+</body>
+</html>
+
Modified: branches/RF-8742/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-item-qunit.js
===================================================================
--- branches/RF-8742/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-item-qunit.js 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/examples/output-demo/src/main/webapp/resources/tests/richfaces-accordion-item-qunit.js 2010-10-28 17:05:33 UTC (rev 19740)
@@ -41,7 +41,7 @@
for (i in PUBLIC_API) {
var funcName = PUBLIC_API[i];
- ok(c.[funcName], funcName + "present in component")
+ ok(c[funcName], funcName + "present in component")
// TODO check other functions + check is it function
}
});
Copied: branches/RF-8742/examples/output-demo/src/main/webapp/resources/tests/richfaces-tooltip-qunit.js (from rev 19739, trunk/examples/output-demo/src/main/webapp/resources/tests/richfaces-tooltip-qunit.js)
===================================================================
--- branches/RF-8742/examples/output-demo/src/main/webapp/resources/tests/richfaces-tooltip-qunit.js (rev 0)
+++ branches/RF-8742/examples/output-demo/src/main/webapp/resources/tests/richfaces-tooltip-qunit.js 2010-10-28 17:05:33 UTC (rev 19740)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.
+ */
+
+
+RichFaces.QUnit.run(function() {
+ module("richfaces-tooltip");
+
+ var TOOLTIP_ID = "f:tooltip";
+
+ function handler (msg, returnValue) {
+ return function () {
+ ok(true, msg);
+
+ if (returnValue != undefined) {
+ return returnValue;
+ }
+ };
+ }
+
+ test("RichFaces.ui.Tooltip test constructor", function () {
+ var c = RichFaces.$(TOOLTIP_ID);
+
+ ok(c instanceof RichFaces.ui.Tooltip, "instance of RichFaces.ui.Tooltip");
+ equals(c.id, TOOLTIP_ID, "id");
+
+ // test default options
+ same(c.options.direction, RichFaces.ui.TooltipDirection.DEFAULT, "Direction");
+ same(c.options.attached, true, "Attached");
+ same(c.options.offset, {}, "Offset");
+ same(c.options.mode, RichFaces.ui.TooltipMode.DEFAULT, "Mode");
+ same(c.options.disabled, false, "Disabled");
+ same(c.options.hideDelay, 0, "Hide Delay");
+ same(c.options.hideEvent, "leave", "Hide Event");
+ same(c.options.showDelay, 0, "Show Delay");
+ same(c.options.showEvent, "enter", "Show Event");
+ same(c.options.followMouse, true, "Follow Mouse");
+
+ });
+
+ test("RichFaces.ui.Tooltip test public api", function () {
+ var c = RichFaces.$(TOOLTIP_ID);
+
+ var PUBLIC_API = ["hide", "show"];
+
+ for (var i in PUBLIC_API) {
+ var funcName = PUBLIC_API[i];
+ ok(c[funcName], funcName + "present in component");
+ equals(typeof c[funcName], "function", funcName + " is function");
+ }
+ });
+
+ function testHideEvents(cancelEvent) {
+ var c = RichFaces.$(TOOLTIP_ID);
+
+ expect(cancelEvent ? 2 : 3);
+ var beforeHideHandler = function (event, comp, data) {
+ ok(true, "beforehide handler invoked");
+ same(data.id, TOOLTIP_ID, "Component Id");
+
+ return !cancelEvent;
+ };
+ var beforeHideHandlerWrapper = RichFaces.Event.bindById(TOOLTIP_ID, "beforehide", beforeHideHandler);
+
+ var hideHandler = handler("hide handler invoked", undefined);
+ var hideHandlerWrapper = RichFaces.Event.bindById(TOOLTIP_ID, "hide", hideHandler);
+
+ c.hide();
+
+ RichFaces.Event.unbindById(TOOLTIP_ID, "beforehide", beforeHideHandlerWrapper);
+ RichFaces.Event.unbindById(TOOLTIP_ID, "hide", hideHandlerWrapper);
+
+ // TODO undo changes
+ }
+
+ test("RichFaces.ui.Tooltip.hide test", function () {
+ testHideEvents(false);
+ });
+
+ test("RichFaces.ui.Tooltip.hide test cancelable event", function () {
+ testHideEvents(true);
+ });
+
+ function testShowEvents(cancelEvent) {
+ var c = RichFaces.$(TOOLTIP_ID);
+
+ expect(cancelEvent ? 2 : 3);
+ var beforeShowHandler = function (event, comp, data) {
+ ok(true, "beforeshow handler invoked");
+ same(data.id, TOOLTIP_ID, "Component Id");
+
+ return !cancelEvent;
+ };
+ var beforeShowHandlerWrapper = RichFaces.Event.bindById(TOOLTIP_ID, "beforeshow", beforeShowHandler);
+
+ var showHandler = handler("show handler invoked", undefined);
+ var showHandlerWrapper = RichFaces.Event.bindById(TOOLTIP_ID, "show", showHandler);
+
+ c.show();
+
+ RichFaces.Event.unbindById(TOOLTIP_ID, "beforeshow", beforeShowHandlerWrapper);
+ RichFaces.Event.unbindById(TOOLTIP_ID, "show", showHandlerWrapper);
+
+ // TODO undo changes
+ }
+
+ test("RichFaces.ui.Tooltip.show test", function () {
+ testShowEvents(false);
+ });
+
+ test("RichFaces.ui.Tooltip.show test cancelable event", function () {
+ testShowEvents(true);
+ });
+
+
+});
Modified: branches/RF-8742/examples/output-demo/src/main/webapp/templates/template.xhtml
===================================================================
--- branches/RF-8742/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/examples/output-demo/src/main/webapp/templates/template.xhtml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -77,6 +77,25 @@
<li><h:commandLink value="Tab Panel" action="tabPanel" /></li>
</ul>
</li>
+ <li>
+ <p>Tooltip</p>
+ <ul>
+ <li>
+ <p>Examples</p>
+ <ul>
+ <li>
+ <h:commandLink value="Tooltip" action="tooltip"/>
+ </li>
+ </ul>
+ <p>QUnit</p>
+ <ul>
+ <li>
+ <h:commandLink value="Tooltip" action="qunit/tooltip"/>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </li>
</ul>
<p>QUnit</p>
<ul>
Copied: branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceInput/inplaceInput.xhtml (from rev 19739, trunk/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceInput/inplaceInput.xhtml)
===================================================================
--- branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceInput/inplaceInput.xhtml (rev 0)
+++ branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceInput/inplaceInput.xhtml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -0,0 +1,20 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition>
+ <p>InplaceInput is a simple input component which displays the current value as outputText and switches to inputText based representation after a defined event to allow editing this value.
+You could use simplest examples below. For the first demo, just click on a label to edit the value and click somewhere outside the component to store this value(Or just press ENTER button).</p>
+
+ <ui:include src="#{demoNavigator.sampleIncludeURI}" />
+ <ui:include src="/templates/includes/source-view.xhtml">
+ <ui:param name="src" value="#{demoNavigator.sampleIncludeURI}" />
+ <ui:param name="sourceType" value="xhtml" />
+ <ui:param name="openLabel" value="View Source" />
+ <ui:param name="hideLabel" value="Hide Source" />
+ </ui:include>
+</ui:composition>
+
+</html>
\ No newline at end of file
Deleted: branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceInput/inplaceSelect.xhtml
===================================================================
--- branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceInput/inplaceSelect.xhtml 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceInput/inplaceSelect.xhtml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -1,21 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets">
-
-<ui:composition>
- <p><b>Inplace</b> Select is a simple input component which displays current
- value as outputText and switches to Select based representation after a
- defined event to allow editing this value.</p>
-
- <ui:include src="#{demoNavigator.sampleIncludeURI}" />
- <ui:include src="/templates/includes/source-view.xhtml">
- <ui:param name="src" value="#{demoNavigator.sampleIncludeURI}" />
- <ui:param name="sourceType" value="xhtml" />
- <ui:param name="openLabel" value="View Source" />
- <ui:param name="hideLabel" value="Hide Source" />
- </ui:include>
-</ui:composition>
-
-</html>
\ No newline at end of file
Copied: branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceInput/samples/inplaceInput-sample.xhtml (from rev 19739, trunk/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceInput/samples/inplaceInput-sample.xhtml)
===================================================================
--- branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceInput/samples/inplaceInput-sample.xhtml (rev 0)
+++ branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceInput/samples/inplaceInput-sample.xhtml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -0,0 +1,19 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+ <rich:panel style="width:220px;">
+ <f:facet name="header">
+ <h:outputText value="Person Info"></h:outputText>
+ </f:facet>
+ <h:panelGrid columns="2">
+ <h:outputText value="Name: " />
+ <rich:inplaceInput value="click to enter your name" />
+ <h:outputText value="Email:" />
+ <rich:inplaceInput value="click to enter your email" />
+ </h:panelGrid>
+ </rich:panel>
+</ui:composition>
\ No newline at end of file
Deleted: branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceInput/samples/inplaceSelect-sample.xhtml
===================================================================
--- branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceInput/samples/inplaceSelect-sample.xhtml 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceInput/samples/inplaceSelect-sample.xhtml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -1,44 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<ui:composition xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.org/rich">
- <h:form>
- <p>Try the simplest example below. Just click on a label to edit
- the value and click somewhere outside the component to store this
- value(Or just press ENTER button).</p>
- <rich:panel style="width:220px;">
- <f:facet name="header">
- <h:outputText value="Simples select"></h:outputText>
- </f:facet>
- <rich:inplaceSelect defaultLabel="Click here to edit"
- openOnEdit="true" saveOnBlur="false">
- <f:selectItem itemValue="0" itemLabel="Option 1" />
- <f:selectItem itemValue="1" itemLabel="Option 2" />
- <f:selectItem itemValue="2" itemLabel="Option 3" />
- <f:selectItem itemValue="3" itemLabel="Option 4" />
- <f:selectItem itemValue="4" itemLabel="Option 5" />
- </rich:inplaceSelect>
- </rich:panel>
- <p>In that sample component customized in next way:
- </p>
- <ul>
- <li><b>f:selectItems</b> tag is used to define a list of items to use.</li>
- <li>Controls "save" and "cancel" are turned on with <b>showControls</b> attribute</li>
- <li><b>editEvent</b> set to dblclick and used to switch to edit state.</li>
- </ul>
- <rich:panel style="width:220px;">
- <f:facet name="header">
- <h:outputText value="Select customization"></h:outputText>
- </f:facet>
- <rich:inplaceSelect editEvent="dblclick" id="inplaceSelect"
- showControls="true" saveOnBlur="true"
- value="#{inplaceSelectBean.value}" defaultLabel="Double click to edit value"
- openOnEdit="true">
- <f:selectItems value="#{inplaceSelectBean.capitalsOptions}" />
- </rich:inplaceSelect>
- </rich:panel>
- </h:form>
-</ui:composition>
\ No newline at end of file
Copied: branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect (from rev 19739, trunk/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect)
Deleted: branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/inplaceSelect.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/inplaceSelect.xhtml 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/inplaceSelect.xhtml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -1,21 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets">
-
-<ui:composition>
- <p><b>Inplace</b> Select is a simple input component which displays current
- value as outputText and switches to Select based representation after a
- defined event to allow editing this value.</p>
-
- <ui:include src="#{demoNavigator.sampleIncludeURI}" />
- <ui:include src="/templates/includes/source-view.xhtml">
- <ui:param name="src" value="#{demoNavigator.sampleIncludeURI}" />
- <ui:param name="sourceType" value="xhtml" />
- <ui:param name="openLabel" value="View Source" />
- <ui:param name="hideLabel" value="Hide Source" />
- </ui:include>
-</ui:composition>
-
-</html>
\ No newline at end of file
Copied: branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/inplaceSelect.xhtml (from rev 19739, trunk/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/inplaceSelect.xhtml)
===================================================================
--- branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/inplaceSelect.xhtml (rev 0)
+++ branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/inplaceSelect.xhtml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -0,0 +1,21 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition>
+ <p><b>Inplace</b> Select is a simple input component which displays current
+ value as outputText and switches to Select based representation after a
+ defined event to allow editing this value.</p>
+
+ <ui:include src="#{demoNavigator.sampleIncludeURI}" />
+ <ui:include src="/templates/includes/source-view.xhtml">
+ <ui:param name="src" value="#{demoNavigator.sampleIncludeURI}" />
+ <ui:param name="sourceType" value="xhtml" />
+ <ui:param name="openLabel" value="View Source" />
+ <ui:param name="hideLabel" value="Hide Source" />
+ </ui:include>
+</ui:composition>
+
+</html>
\ No newline at end of file
Copied: branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/samples (from rev 19739, trunk/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/samples)
Deleted: branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/samples/inplaceSelect-sample.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/samples/inplaceSelect-sample.xhtml 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/samples/inplaceSelect-sample.xhtml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -1,56 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<ui:composition xmlns="http://www.w3.org/1999/xhtml"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:a4j="http://richfaces.org/a4j"
- xmlns:rich="http://richfaces.org/rich">
- <h:form>
- <p>Try the simplest example below. Just click on a label to edit
- the value and click somewhere outside the component to store this
- value(Or just press ENTER button).</p>
- <rich:panel style="width:220px;">
- <f:facet name="header">
- <h:outputText value="Simples select"></h:outputText>
- </f:facet>
- <rich:inplaceSelect defaultLabel="Click here to edit"
- openOnEdit="true" saveOnBlur="false" oninputchange="alert('10')"
- onchange="alert('1')" oninputkeydown="alert('kdown')">
- <f:selectItem itemValue="0" itemLabel="Option 1" />
- <f:selectItem itemValue="1" itemLabel="Option 2" />
- <f:selectItem itemValue="2" itemLabel="Option 3" />
- <f:selectItem itemValue="3" itemLabel="Option 4" />
- <f:selectItem itemValue="4" itemLabel="Option 5" />
- </rich:inplaceSelect>
- </rich:panel>
- <p>In that sample component customized in next way:</p>
- <ul>
- <li><b>f:selectItems</b> tag is used to define a list of items
- to use.</li>
- <li>Controls "save" and "cancel" are turned on with <b>showControls</b>
- attribute</li>
- <li><b>editEvent</b> set to dblclick and used to switch to edit
- state.</li>
- <li><b>saveOnSelect</b> defined as false causes component not to store
- value right after choosing but wait till buttons will be used or
- focus lost.</li>
- <li><b>saveOnBlur</b> defined as false causes component to cancel new
- value if it was chosen and focus was lost without save button
- activation. That could be useful on interfaces where every change
- causes long processing. And if use true value - it will works like in
- spreadsheets where leaving the changed field causes new value to be
- applied.</li>
- </ul>
- <rich:panel style="width:220px;">
- <f:facet name="header">
- <h:outputText value="Select customization"></h:outputText>
- </f:facet>
- <rich:inplaceSelect editEvent="dblclick" id="inplaceSelect"
- showControls="true" saveOnSelect="false" saveOnBlur="false"
- value="#{inplaceSelectBean.value}"
- defaultLabel="Double click to edit value">
- <f:selectItems value="#{inplaceSelectBean.capitalsOptions}" />
- </rich:inplaceSelect>
- </rich:panel>
- </h:form>
-</ui:composition>
\ No newline at end of file
Copied: branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/samples/inplaceSelect-sample.xhtml (from rev 19739, trunk/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/samples/inplaceSelect-sample.xhtml)
===================================================================
--- branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/samples/inplaceSelect-sample.xhtml (rev 0)
+++ branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/inplaceSelect/samples/inplaceSelect-sample.xhtml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -0,0 +1,56 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:a4j="http://richfaces.org/a4j"
+ xmlns:rich="http://richfaces.org/rich">
+ <h:form>
+ <p>Try the simplest example below. Just click on a label to edit
+ the value and click somewhere outside the component to store this
+ value(Or just press ENTER button).</p>
+ <rich:panel style="width:220px;">
+ <f:facet name="header">
+ <h:outputText value="Simples select"></h:outputText>
+ </f:facet>
+ <rich:inplaceSelect defaultLabel="Click here to edit"
+ openOnEdit="true" saveOnBlur="false" oninputchange="alert('10')"
+ onchange="alert('1')" oninputkeydown="alert('kdown')">
+ <f:selectItem itemValue="0" itemLabel="Option 1" />
+ <f:selectItem itemValue="1" itemLabel="Option 2" />
+ <f:selectItem itemValue="2" itemLabel="Option 3" />
+ <f:selectItem itemValue="3" itemLabel="Option 4" />
+ <f:selectItem itemValue="4" itemLabel="Option 5" />
+ </rich:inplaceSelect>
+ </rich:panel>
+ <p>In that sample component customized in next way:</p>
+ <ul>
+ <li><b>f:selectItems</b> tag is used to define a list of items
+ to use.</li>
+ <li>Controls "save" and "cancel" are turned on with <b>showControls</b>
+ attribute</li>
+ <li><b>editEvent</b> set to dblclick and used to switch to edit
+ state.</li>
+ <li><b>saveOnSelect</b> defined as false causes component not to store
+ value right after choosing but wait till buttons will be used or
+ focus lost.</li>
+ <li><b>saveOnBlur</b> defined as false causes component to cancel new
+ value if it was chosen and focus was lost without save button
+ activation. That could be useful on interfaces where every change
+ causes long processing. And if use true value - it will works like in
+ spreadsheets where leaving the changed field causes new value to be
+ applied.</li>
+ </ul>
+ <rich:panel style="width:220px;">
+ <f:facet name="header">
+ <h:outputText value="Select customization"></h:outputText>
+ </f:facet>
+ <rich:inplaceSelect editEvent="dblclick" id="inplaceSelect"
+ showControls="true" saveOnSelect="false" saveOnBlur="false"
+ value="#{inplaceSelectBean.value}"
+ defaultLabel="Double click to edit value">
+ <f:selectItems value="#{inplaceSelectBean.capitalsOptions}" />
+ </rich:inplaceSelect>
+ </rich:panel>
+ </h:form>
+</ui:composition>
\ No newline at end of file
Modified: branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/select/samples/select-sample.xhtml
===================================================================
--- branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/select/samples/select-sample.xhtml 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/examples/richfaces-showcase/src/main/webapp/richfaces/select/samples/select-sample.xhtml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -19,5 +19,14 @@
<f:selectItem itemValue="4" itemLabel="Option 5" />
</rich:select>
</rich:panel>
+ <p>DESC</p>
+ <rich:panel style="width:220px;">
+ <f:facet name="header">
+ <h:outputText value="Select with manual input"></h:outputText>
+ </f:facet>
+ <rich:select enableManualInput="true" defaultLabel="start typing for select" >
+ <f:selectItems value="#{inplaceSelectBean.capitalsOptions}"/>
+ </rich:select>
+ </rich:panel>
</h:form>
</ui:composition>
\ No newline at end of file
Modified: branches/RF-8742/ui/common/ui/src/main/java/org/richfaces/renderkit/RenderKitUtils.java
===================================================================
--- branches/RF-8742/ui/common/ui/src/main/java/org/richfaces/renderkit/RenderKitUtils.java 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/ui/common/ui/src/main/java/org/richfaces/renderkit/RenderKitUtils.java 2010-10-28 17:05:33 UTC (rev 19740)
@@ -33,6 +33,8 @@
import java.util.Set;
import java.util.TreeSet;
+import javax.faces.application.Resource;
+import javax.faces.application.ResourceHandler;
import javax.faces.component.UIComponent;
import javax.faces.component.UIComponentBase;
import javax.faces.component.behavior.ClientBehavior;
@@ -685,6 +687,16 @@
return sb.toString();
}
+
+ public static String getResourcePath(FacesContext context, String resourceName) {
+ if (resourceName != null) {
+ ResourceHandler resourceHandler = context.getApplication().getResourceHandler();
+ Resource resource = resourceHandler.createResource(resourceName);
+ return resource.getRequestPath();
+ }
+ return null;
+ }
+
@SuppressWarnings("serial")
public static final class Attributes extends TreeSet<ComponentAttribute> {
@@ -725,6 +737,8 @@
last.setDefaultValue(value);
return this;
}
+
+
}
Modified: branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java
===================================================================
--- branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputRendererBase.java 2010-10-28 17:05:33 UTC (rev 19740)
@@ -26,10 +26,8 @@
import java.util.HashMap;
import java.util.Map;
-import javax.faces.application.Resource;
import javax.faces.application.ResourceDependencies;
import javax.faces.application.ResourceDependency;
-import javax.faces.application.ResourceHandler;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
@@ -153,13 +151,7 @@
}
public String getResourcePath(FacesContext context, String resourceName) {
- if (resourceName != null) {
- ResourceHandler resourceHandler = context.getApplication()
- .getResourceHandler();
- Resource resource = resourceHandler.createResource(resourceName);
- return resource.getRequestPath();
- }
- return null;
+ return RenderKitUtils.getResourcePath(context, resourceName);
}
public String getStateStyleClass(UIComponent component, InplaceState inplaceState) {
Modified: branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss
===================================================================
--- branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss 2010-10-28 17:05:33 UTC (rev 19740)
@@ -10,8 +10,9 @@
margin : 0px;
width : 100%;
height : 100%;
- font-family:inherit;
- font-size : inherit;
+ color: '#{richSkin.generalTextColor}';
+ font-family: '#{richSkin.generalFamilyFont}';
+ font-size : '#{richSkin.generalSizeFont}';
}
.rf-ii-edit {
@@ -27,6 +28,9 @@
.rf-ii-lbl {
white-space : nowrap;
+ color: '#{richSkin.generalTextColor}';
+ font-family: '#{richSkin.generalFamilyFont}';
+ font-size : '#{richSkin.generalSizeFont}';
}
.rf-ii-d-s {
@@ -62,6 +66,9 @@
margin : 0px;
width : 100%;
height : 100%
+ color: '#{richSkin.generalTextColor}';
+ font-family: '#{richSkin.generalFamilyFont}';
+ font-size : '#{richSkin.generalSizeFont}';
}
.rf-ii-strut {
Modified: branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss
===================================================================
--- branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.ecss 2010-10-28 17:05:33 UTC (rev 19740)
@@ -1,3 +1,9 @@
+.rf-is-fld, .rf-is-opt, .rf-is-lbl {
+ color: '#{richSkin.generalTextColor}';
+ font-family: '#{richSkin.generalFamilyFont}';
+ font-size : '#{richSkin.generalSizeFont}';
+}
+
input.rf-is-fld {
background : '#{richSkin.editBackgroundColor}';
padding : 0px 0px 0px 0px;
@@ -7,8 +13,9 @@
background-image:"url(#{resource['org.richfaces:mark_list.gif']})";
background-position : center right;
background-repeat : no-repeat;
- font-family:inherit;
- font-size : inherit;
+ color: '#{richSkin.generalTextColor}';
+ font-family: '#{richSkin.generalFamilyFont}';
+ font-size : '#{richSkin.generalSizeFont}';
}
.rf-is-none {
@@ -99,10 +106,10 @@
.rf-is-lst-cord {
display : block;
- /*font-size : 0px;*/
position : relative;
- font-family:inherit;
- font-size : inherit;
+ color: '#{richSkin.generalTextColor}';
+ font-family: '#{richSkin.generalFamilyFont}';
+ font-size : '#{richSkin.generalSizeFont}';
}
.rf-is-lst-pos {
Modified: branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js
===================================================================
--- branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceSelect.js 2010-10-28 17:05:33 UTC (rev 19740)
@@ -4,8 +4,10 @@
rf.ui.InplaceSelect = function(id, options) {
var mergedOptions = $.extend({}, defaultOptions, options);
- $super.constructor.call(this, id, mergedOptions)
- mergedOptions['attachTo'] = id;
+ $super.constructor.call(this, id, mergedOptions)
+
+ mergedOptions['attachTo'] = id;
+ mergedOptions['scrollContainer'] = $(document.getElementById(id + "Items")).parent()[0];
this.popupList = new rf.ui.PopupList(id+"List", this, mergedOptions);
this.items = mergedOptions.items;
this.selValueInput = $(document.getElementById(id+"selValue"));
Modified: branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popupList.js
===================================================================
--- branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popupList.js 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/popupList.js 2010-10-28 17:05:33 UTC (rev 19740)
@@ -5,11 +5,15 @@
rf.ui.PopupList = function(id, listener, options) {
var mergedOptions = $.extend({}, defaultOptions, options);
$super.constructor.call(this, id, mergedOptions);
- this.selectListener = listener;
+ this.selectListener = listener;
this.selectItemCss = mergedOptions.selectItemCss;
+ this.scrollContainer = $(mergedOptions.scrollContainer);
this.itemCss = mergedOptions.itemCss;
this.listCss = mergedOptions.listCss;
this.index = -1;
+ this.popup.bind("mouseover", $.proxy(this.__onMouseOver, this));
+ this.popup.bind("click", $.proxy(this.__onClick, this));
+
this.__updateItemsList();
};
@@ -41,6 +45,7 @@
} else {
item.addClass(this.selectItemCss);
}
+ this.__scrollToSelectedItem(this);
},
unselectItem: function(item) {
@@ -148,8 +153,27 @@
__setItems: function(items) {
this.items = items;
+ },
+
+ __scrollToSelectedItem : function() {
+ if(this.scrollContainer) {
+ var offset = 0;
+
+ this.items.slice(0, this.index).each(function() {
+ offset += this.offsetHeight;
+ });
+
+ var parentContainer = this.scrollContainer;
+ if(offset < parentContainer.scrollTop()) {
+ parentContainer.scrollTop(offset);
+ } else {
+ offset+=this.items.get(this.index).offsetHeight;
+ if(offset - parentContainer.scrollTop() > parentContainer.get(0).clientHeight) {
+ parentContainer.scrollTop(offset - parentContainer.innerHeight());
+ }
+ }
+ }
}
-
}
})());
Modified: branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.ecss
===================================================================
--- branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.ecss 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.ecss 2010-10-28 17:05:33 UTC (rev 19740)
@@ -1,5 +1,5 @@
-.rf-sel-inp.rf-s-fnt, .rf-sel-opt.rf-sel-fnt{
+.rf-sel-inp, .rf-sel-opt {
color: '#{richSkin.generalTextColor}';
font-size: '#{richSkin.generalSizeFont}';
font-family: '#{richSkin.generalFamilyFont}';
Modified: branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js
===================================================================
--- branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/select.js 2010-10-28 17:05:33 UTC (rev 19740)
@@ -115,7 +115,8 @@
this.id = id;
var mergedOptions = $.extend({}, defaultOptions, options);
mergedOptions['attachTo'] = id;
-
+ mergedOptions['scrollContainer'] = $(document.getElementById(id + "Items")).parent()[0];
+
this.defaultLabel = mergedOptions.defaultLabel;
var inputLabel = this.getValue() ;
this.initialValue = (inputLabel != this.defaultLabel) ? inputLabel : "";
Modified: branches/RF-8742/ui/input/ui/src/main/templates/inplaceSelect.template.xml
===================================================================
--- branches/RF-8742/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/ui/input/ui/src/main/templates/inplaceSelect.template.xml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -44,11 +44,11 @@
</span>
<c:if test="#{!isDisable(inplaceState)}">
- <input id="#{clientId}Focus" type="image" style="position: absolute; top: 0px; left: 0px; outline-style: none;" class="rf-is-none" />
+ <input id="#{clientId}Focus" type="image" name="#{clientId}Focus" style="position: absolute; top: 0px; left: 0px; outline-style: none;" class="rf-is-none" />
<span id="#{clientId}Edit" class="#{getEditStyleClass(component, inplaceState)}">
- <input id="#{clientId}selValue" name="#{clientId}" type="hidden" value="#{getValue(facesContext, component)}"/>
- <input id="#{clientId}Input" autocomplete="off"
+ <input id="#{clientId}selValue" name="#{clientId}" type="hidden" value="#{getInputValue(facesContext, component)}"/>
+ <input id="#{clientId}Input" name="#{clientId}Input" autocomplete="off"
type="text" value="#{getSelectInputLabel(facesContext, component)}"
class="rf-is-fld" style="width: #{component.attributes['inputWidth']};" readonly="readonly"
cdk:passThrough="tabIndex">
@@ -64,11 +64,11 @@
<span class="rf-is-shdw-b"></span>
<span id="#{clientId}Btn" style="position : relative;">
- <input type="image" id="#{clientId}Okbtn"
+ <input type="image" name="#{clientId}Okbtn" id="#{clientId}Okbtn"
src="#{getResourcePath(facesContext, 'org.richfaces/ico_ok.gif')}"
class="rf-is-btn" onmousedown="this.className='rf-is-btn-press'"
onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" />
- <input type="image" id="#{clientId}Cancelbtn"
+ <input name="#{clientId}Okbtn" type="image" id="#{clientId}Cancelbtn"
src="#{getResourcePath(facesContext,'org.richfaces/ico_cancel.gif')}"
class="rf-is-btn" onmousedown="this.className='rf-is-btn-press'"
onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" />
@@ -87,8 +87,10 @@
<span class="rf-is-shdw-r"></span>
<span class="rf-is-shdw-b"></span>
<span class="rf-is-lst-dec">
- <span class="rf-is-lst-scrl" id="#{clientId}Items" style="height: #{component.attributes['listHeight']}">
- <cdk:call expression="encodeItems(facesContext, component, clientSelectItems);"/>
+ <span class="rf-is-lst-scrl" style="height: #{component.attributes['listHeight']}">
+ <span id="#{clientId}Items">
+ <cdk:call expression="encodeItems(facesContext, component, clientSelectItems);"/>
+ </span>
</span>
</span>
</span>
Modified: branches/RF-8742/ui/input/ui/src/main/templates/select.template.xml
===================================================================
--- branches/RF-8742/ui/input/ui/src/main/templates/select.template.xml 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/ui/input/ui/src/main/templates/select.template.xml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -54,8 +54,10 @@
<div class="rf-sel-shdw-b"></div>
<div class="rf-sel-lst-dcrtn">
- <div class="rf-sel-lst-scrl" id="#{clientId}Items" >
- <cdk:call expression="encodeItems(facesContext, component, clientSelectItems);"/>
+ <div class="rf-sel-lst-scrl">
+ <div id="#{clientId}Items" >
+ <cdk:call expression="encodeItems(facesContext, component, clientSelectItems);"/>
+ </div>
</div>
</div>
</div>
Modified: branches/RF-8742/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceSelectTestDefault.xmlunit.xml
===================================================================
--- branches/RF-8742/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceSelectTestDefault.xmlunit.xml 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceSelectTestDefault.xmlunit.xml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -1,39 +1,45 @@
<span class="rf-is-d-s" id="form:inplaceSelectDefault">
- <span class="rf-is-lbl" id="form:inplaceSelectDefaultLabel">Edit Text</span>
- <input class="rf-is-none" id="form:inplaceSelectDefaultFocus"
- style="position: absolute; top: 0px; left: 0px; outline-style: none;"
- type="image" />
- <span class="rf-is-edit rf-is-none" id="form:inplaceSelectDefaultEdit">
- <input id="form:inplaceSelectDefaultselValue" name="form:inplaceSelectDefault"
- type="hidden" value="Edit Text" />
- <input autocomplete="off" class="rf-is-fld" id="form:inplaceSelectDefaultInput"
- readonly="readonly" style="width: ;" type="text" />
- <span class="rf-is-lst-cord" id="form:inplaceSelectDefaultList"
- style="display: none">
- <span class="rf-is-lst-pos" style="width: 250px">
- <span class="rf-is-shdw">
- <span class="rf-is-shdw-t"></span>
- <span class="rf-is-shdw-l"></span>
- <span class="rf-is-shdw-r"></span>
- <span class="rf-is-shdw-b"></span>
- <span class="rf-is-lst-dec">
- <span class="rf-is-lst-scrl" id="form:inplaceSelectDefaultItems"
- style="height: 100px">
- <span id="form:inplaceSelectDefaultItem0" class="rf-is-opt">Label#1
- </span>
- <span id="form:inplaceSelectDefaultItem1" class="rf-is-opt">Label#2
- </span>
- <span id="form:inplaceSelectDefaultItem2" class="rf-is-opt">Label#3
- </span>
- <span id="form:inplaceSelectDefaultItem3" class="rf-is-opt">Label#4
- </span>
- </span>
- </span>
- </span>
- </span>
- </span>
- </span>
- <script type="text/javascript">
- //ignored
- </script>
+ <span class="rf-is-lbl" id="form:inplaceSelectDefaultLabel">
+ Edit Text
+ </span>
+ <input class="rf-is-none" id="form:inplaceSelectDefaultFocus" name="form:inplaceSelectDefaultFocus" style="position: absolute; top: 0px; left: 0px; outline-style: none;" type="image"/>
+ <span class="rf-is-edit rf-is-none" id="form:inplaceSelectDefaultEdit">
+ <input id="form:inplaceSelectDefaultselValue" name="form:inplaceSelectDefault" type="hidden"/>
+ <input autocomplete="off" class="rf-is-fld" id="form:inplaceSelectDefaultInput" name="form:inplaceSelectDefaultInput" readonly="readonly" style="width: ;" type="text"/>
+ <span class="rf-is-lst-cord" id="form:inplaceSelectDefaultList" style="display: none">
+ <span class="rf-is-lst-pos" style="width: 250px">
+ <span class="rf-is-shdw">
+ <span class="rf-is-shdw-t">
+ </span>
+ <span class="rf-is-shdw-l">
+ </span>
+ <span class="rf-is-shdw-r">
+ </span>
+ <span class="rf-is-shdw-b">
+ </span>
+ <span class="rf-is-lst-dec">
+ <span class="rf-is-lst-scrl" style="height: 100px">
+ <span id="form:inplaceSelectDefaultItems">
+ <span id="form:inplaceSelectDefaultItem0" class="rf-is-opt">
+ Label#1
+ </span>
+ <span id="form:inplaceSelectDefaultItem1" class="rf-is-opt">
+ Label#2
+ </span>
+ <span id="form:inplaceSelectDefaultItem2" class="rf-is-opt">
+ Label#3
+ </span>
+ <span id="form:inplaceSelectDefaultItem3" class="rf-is-opt">
+ Label#4
+ </span>
+ </span>
+ </span>
+ </span>
+ </span>
+ </span>
+ </span>
+ </span>
+ <script type="text/javascript">
+ //ignored
+ </script>
</span>
Modified: branches/RF-8742/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceSelectTestEdit.xmlunit.xml
===================================================================
--- branches/RF-8742/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceSelectTestEdit.xmlunit.xml 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceSelectTestEdit.xmlunit.xml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -1,58 +1,64 @@
<span class="rf-is-d-s rf-is-e-s" id="form:inplaceSelectEdit">
- <span class="rf-is-lbl" id="form:inplaceSelectEditLabel">Edit Text</span>
- <input class="rf-is-none" id="form:inplaceSelectEditFocus"
- style="position: absolute; top: 0px; left: 0px; outline-style: none;"
- type="image" />
- <span class="rf-is-edit" id="form:inplaceSelectEditEdit">
- <input id="form:inplaceSelectEditselValue" name="form:inplaceSelectEdit"
- type="hidden" value="Edit Text" />
- <input autocomplete="off" class="rf-is-fld" id="form:inplaceSelectEditInput"
- readonly="readonly" style="width: ;" type="text" />
- <span class="rf-is-btn-prepos">
- <span class="rf-is-btn-pos">
- <span class="rf-is-shdw" id="form:inplaceSelectEditBtnshadow">
- <span class="rf-is-shdw-t"></span>
- <span class="rf-is-shdw-l"></span>
- <span class="rf-is-shdw-r"></span>
- <span class="rf-is-shdw-b"></span>
- <span id="form:inplaceSelectEditBtn" style="position : relative;">
- <input class="rf-is-btn" id="form:inplaceSelectEditOkbtn"
- onmousedown="this.className='rf-is-btn-press'" onmouseout="this.className='rf-is-btn'"
- onmouseup="this.className='rf-is-btn'"
- src="/javax.faces.resource/org.richfaces/ico_ok.gif.jsf"
- type="image" />
- <input class="rf-is-btn" id="form:inplaceSelectEditCancelbtn"
- onmousedown="this.className='rf-is-btn-press'" onmouseout="this.className='rf-is-btn'"
- onmouseup="this.className='rf-is-btn'"
- src="/javax.faces.resource/org.richfaces/ico_cancel.gif.jsf"
- type="image" />
- <br />
- </span>
- </span>
- </span>
- </span>
- <span class="rf-is-lst-cord" id="form:inplaceSelectEditList"
- style="display: none">
- <span class="rf-is-lst-pos" style="width: 250px">
- <span class="rf-is-shdw">
- <span class="rf-is-shdw-t"></span>
- <span class="rf-is-shdw-l"></span>
- <span class="rf-is-shdw-r"></span>
- <span class="rf-is-shdw-b"></span>
- <span class="rf-is-lst-dec">
- <span class="rf-is-lst-scrl" id="form:inplaceSelectEditItems"
- style="height: 100px">
- <span id="form:inplaceSelectEditItem0" class="rf-is-opt">Label#1</span>
- <span id="form:inplaceSelectEditItem1" class="rf-is-opt">Label#2</span>
- <span id="form:inplaceSelectEditItem2" class="rf-is-opt">Label#3</span>
- <span id="form:inplaceSelectEditItem3" class="rf-is-opt">Label#4</span>
- </span>
- </span>
- </span>
- </span>
- </span>
- </span>
- <script type="text/javascript">
- //ignored
- </script>
+ <span class="rf-is-lbl" id="form:inplaceSelectEditLabel">
+ Edit Text
+ </span>
+ <input class="rf-is-none" id="form:inplaceSelectEditFocus" name="form:inplaceSelectEditFocus" style="position: absolute; top: 0px; left: 0px; outline-style: none;" type="image"/>
+ <span class="rf-is-edit" id="form:inplaceSelectEditEdit">
+ <input id="form:inplaceSelectEditselValue" name="form:inplaceSelectEdit" type="hidden"/>
+ <input autocomplete="off" class="rf-is-fld" id="form:inplaceSelectEditInput" name="form:inplaceSelectEditInput" readonly="readonly" style="width: ;" type="text"/>
+ <span class="rf-is-btn-prepos">
+ <span class="rf-is-btn-pos">
+ <span class="rf-is-shdw" id="form:inplaceSelectEditBtnshadow">
+ <span class="rf-is-shdw-t">
+ </span>
+ <span class="rf-is-shdw-l">
+ </span>
+ <span class="rf-is-shdw-r">
+ </span>
+ <span class="rf-is-shdw-b">
+ </span>
+ <span id="form:inplaceSelectEditBtn" style="position : relative;">
+ <input class="rf-is-btn" id="form:inplaceSelectEditOkbtn" name="form:inplaceSelectEditOkbtn" onmousedown="this.className='rf-is-btn-press'" onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" src="/javax.faces.resource/org.richfaces/ico_ok.gif.jsf" type="image"/>
+ <input class="rf-is-btn" id="form:inplaceSelectEditCancelbtn" name="form:inplaceSelectEditOkbtn" onmousedown="this.className='rf-is-btn-press'" onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" src="/javax.faces.resource/org.richfaces/ico_cancel.gif.jsf" type="image"/>
+ <br/>
+ </span>
+ </span>
+ </span>
+ </span>
+ <span class="rf-is-lst-cord" id="form:inplaceSelectEditList" style="display: none">
+ <span class="rf-is-lst-pos" style="width: 250px">
+ <span class="rf-is-shdw">
+ <span class="rf-is-shdw-t">
+ </span>
+ <span class="rf-is-shdw-l">
+ </span>
+ <span class="rf-is-shdw-r">
+ </span>
+ <span class="rf-is-shdw-b">
+ </span>
+ <span class="rf-is-lst-dec">
+ <span class="rf-is-lst-scrl" style="height: 100px">
+ <span id="form:inplaceSelectEditItems">
+ <span id="form:inplaceSelectEditItem0" class="rf-is-opt">
+ Label#1
+ </span>
+ <span id="form:inplaceSelectEditItem1" class="rf-is-opt">
+ Label#2
+ </span>
+ <span id="form:inplaceSelectEditItem2" class="rf-is-opt">
+ Label#3
+ </span>
+ <span id="form:inplaceSelectEditItem3" class="rf-is-opt">
+ Label#4
+ </span>
+ </span>
+ </span>
+ </span>
+ </span>
+ </span>
+ </span>
+ </span>
+ <script type="text/javascript">
+ //ignored
+ </script>
</span>
Modified: branches/RF-8742/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceSelectTestWithControls.xmlunit.xml
===================================================================
--- branches/RF-8742/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceSelectTestWithControls.xmlunit.xml 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/ui/input/ui/src/test/resources/org/richfaces/renderkit/inplaceSelectTestWithControls.xmlunit.xml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -1,63 +1,64 @@
<span class="rf-is-d-s" id="form:inplaceSelectWithControls">
- <span class="rf-is-lbl" id="form:inplaceSelectWithControlsLabel">Edit Text</span>
- <input class="rf-is-none" id="form:inplaceSelectWithControlsFocus"
- style="position: absolute; top: 0px; left: 0px; outline-style: none;"
- type="image" />
- <span class="rf-is-edit rf-is-none" id="form:inplaceSelectWithControlsEdit">
- <input id="form:inplaceSelectWithControlsselValue" name="form:inplaceSelectWithControls"
- type="hidden" value="Edit Text" />
- <input autocomplete="off" class="rf-is-fld"
- id="form:inplaceSelectWithControlsInput" readonly="readonly" style="width: ;"
- type="text" />
- <span class="rf-is-btn-prepos">
- <span class="rf-is-btn-pos">
- <span class="rf-is-shdw" id="form:inplaceSelectWithControlsBtnshadow">
- <span class="rf-is-shdw-t"></span>
- <span class="rf-is-shdw-l"></span>
- <span class="rf-is-shdw-r"></span>
- <span class="rf-is-shdw-b"></span>
- <span id="form:inplaceSelectWithControlsBtn" style="position : relative;">
- <input class="rf-is-btn" id="form:inplaceSelectWithControlsOkbtn"
- onmousedown="this.className='rf-is-btn-press'" onmouseout="this.className='rf-is-btn'"
- onmouseup="this.className='rf-is-btn'"
- src="/javax.faces.resource/org.richfaces/ico_ok.gif.jsf"
- type="image" />
- <input class="rf-is-btn" id="form:inplaceSelectWithControlsCancelbtn"
- onmousedown="this.className='rf-is-btn-press'" onmouseout="this.className='rf-is-btn'"
- onmouseup="this.className='rf-is-btn'"
- src="/javax.faces.resource/org.richfaces/ico_cancel.gif.jsf"
- type="image" />
- <br />
- </span>
- </span>
- </span>
- </span>
- <span class="rf-is-lst-cord" id="form:inplaceSelectWithControlsList"
- style="display: none">
- <span class="rf-is-lst-pos" style="width: 250px">
- <span class="rf-is-shdw">
- <span class="rf-is-shdw-t"></span>
- <span class="rf-is-shdw-l"></span>
- <span class="rf-is-shdw-r"></span>
- <span class="rf-is-shdw-b"></span>
- <span class="rf-is-lst-dec">
- <span class="rf-is-lst-scrl" id="form:inplaceSelectWithControlsItems"
- style="height: 100px">
- <span id="form:inplaceSelectWithControlsItem0" class="rf-is-opt">Label#1
- </span>
- <span id="form:inplaceSelectWithControlsItem1" class="rf-is-opt">Label#2
- </span>
- <span id="form:inplaceSelectWithControlsItem2" class="rf-is-opt">Label#3
- </span>
- <span id="form:inplaceSelectWithControlsItem3" class="rf-is-opt">Label#4
- </span>
- </span>
- </span>
- </span>
- </span>
- </span>
- </span>
- <script type="text/javascript">
- // ignored
- </script>
+ <span class="rf-is-lbl" id="form:inplaceSelectWithControlsLabel">
+ Edit Text
+ </span>
+ <input class="rf-is-none" id="form:inplaceSelectWithControlsFocus" name="form:inplaceSelectWithControlsFocus" style="position: absolute; top: 0px; left: 0px; outline-style: none;" type="image"/>
+ <span class="rf-is-edit rf-is-none" id="form:inplaceSelectWithControlsEdit">
+ <input id="form:inplaceSelectWithControlsselValue" name="form:inplaceSelectWithControls" type="hidden"/>
+ <input autocomplete="off" class="rf-is-fld" id="form:inplaceSelectWithControlsInput" name="form:inplaceSelectWithControlsInput" readonly="readonly" style="width: ;" type="text"/>
+ <span class="rf-is-btn-prepos">
+ <span class="rf-is-btn-pos">
+ <span class="rf-is-shdw" id="form:inplaceSelectWithControlsBtnshadow">
+ <span class="rf-is-shdw-t">
+ </span>
+ <span class="rf-is-shdw-l">
+ </span>
+ <span class="rf-is-shdw-r">
+ </span>
+ <span class="rf-is-shdw-b">
+ </span>
+ <span id="form:inplaceSelectWithControlsBtn" style="position : relative;">
+ <input class="rf-is-btn" id="form:inplaceSelectWithControlsOkbtn" name="form:inplaceSelectWithControlsOkbtn" onmousedown="this.className='rf-is-btn-press'" onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" src="/javax.faces.resource/org.richfaces/ico_ok.gif.jsf" type="image"/>
+ <input class="rf-is-btn" id="form:inplaceSelectWithControlsCancelbtn" name="form:inplaceSelectWithControlsOkbtn" onmousedown="this.className='rf-is-btn-press'" onmouseout="this.className='rf-is-btn'" onmouseup="this.className='rf-is-btn'" src="/javax.faces.resource/org.richfaces/ico_cancel.gif.jsf" type="image"/>
+ <br/>
+ </span>
+ </span>
+ </span>
+ </span>
+ <span class="rf-is-lst-cord" id="form:inplaceSelectWithControlsList" style="display: none">
+ <span class="rf-is-lst-pos" style="width: 250px">
+ <span class="rf-is-shdw">
+ <span class="rf-is-shdw-t">
+ </span>
+ <span class="rf-is-shdw-l">
+ </span>
+ <span class="rf-is-shdw-r">
+ </span>
+ <span class="rf-is-shdw-b">
+ </span>
+ <span class="rf-is-lst-dec">
+ <span class="rf-is-lst-scrl" style="height: 100px">
+ <span id="form:inplaceSelectWithControlsItems">
+ <span id="form:inplaceSelectWithControlsItem0" class="rf-is-opt">
+ Label#1
+ </span>
+ <span id="form:inplaceSelectWithControlsItem1" class="rf-is-opt">
+ Label#2
+ </span>
+ <span id="form:inplaceSelectWithControlsItem2" class="rf-is-opt">
+ Label#3
+ </span>
+ <span id="form:inplaceSelectWithControlsItem3" class="rf-is-opt">
+ Label#4
+ </span>
+ </span>
+ </span>
+ </span>
+ </span>
+ </span>
+ </span>
+ </span>
+ <script type="text/javascript">
+ //ignored
+ </script>
</span>
\ No newline at end of file
Copied: branches/RF-8742/ui/output/api/src/main/java/org/richfaces/TooltipDirection.java (from rev 19739, trunk/ui/output/api/src/main/java/org/richfaces/TooltipDirection.java)
===================================================================
--- branches/RF-8742/ui/output/api/src/main/java/org/richfaces/TooltipDirection.java (rev 0)
+++ branches/RF-8742/ui/output/api/src/main/java/org/richfaces/TooltipDirection.java 2010-10-28 17:05:33 UTC (rev 19740)
@@ -0,0 +1,10 @@
+package org.richfaces;
+
+/**
+ * @author amarkhel
+ */
+public enum TooltipDirection {
+ topRight, topLeft, bottomRight, bottomLeft, auto;
+
+ public static final TooltipDirection DEFAULT = bottomRight;
+}
Copied: branches/RF-8742/ui/output/api/src/main/java/org/richfaces/TooltipLayout.java (from rev 19739, trunk/ui/output/api/src/main/java/org/richfaces/TooltipLayout.java)
===================================================================
--- branches/RF-8742/ui/output/api/src/main/java/org/richfaces/TooltipLayout.java (rev 0)
+++ branches/RF-8742/ui/output/api/src/main/java/org/richfaces/TooltipLayout.java 2010-10-28 17:05:33 UTC (rev 19740)
@@ -0,0 +1,10 @@
+package org.richfaces;
+
+/**
+ * @author amarkhel
+ */
+public enum TooltipLayout {
+ inline, block;
+
+ public static final TooltipLayout DEFAULT = TooltipLayout.inline;
+}
Copied: branches/RF-8742/ui/output/api/src/main/java/org/richfaces/TooltipMode.java (from rev 19739, trunk/ui/output/api/src/main/java/org/richfaces/TooltipMode.java)
===================================================================
--- branches/RF-8742/ui/output/api/src/main/java/org/richfaces/TooltipMode.java (rev 0)
+++ branches/RF-8742/ui/output/api/src/main/java/org/richfaces/TooltipMode.java 2010-10-28 17:05:33 UTC (rev 19740)
@@ -0,0 +1,10 @@
+package org.richfaces;
+
+/**
+ * @author amarkhel
+ */
+public enum TooltipMode {
+ client, ajax;
+
+ public static final TooltipMode DEFAULT = TooltipMode.client;
+}
Copied: branches/RF-8742/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java (from rev 19739, trunk/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java)
===================================================================
--- branches/RF-8742/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java (rev 0)
+++ branches/RF-8742/ui/output/ui/src/main/java/org/richfaces/component/AbstractTooltip.java 2010-10-28 17:05:33 UTC (rev 19740)
@@ -0,0 +1,158 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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 org.richfaces.TooltipLayout;
+import org.richfaces.TooltipDirection;
+import org.richfaces.TooltipMode;
+import org.richfaces.context.ExtendedVisitContext;
+import org.richfaces.context.ExtendedVisitContextMode;
+import org.richfaces.renderkit.MetaComponentRenderer;
+
+import javax.faces.component.UIComponent;
+import javax.faces.component.visit.VisitCallback;
+import javax.faces.component.visit.VisitContext;
+import javax.faces.component.visit.VisitResult;
+import javax.faces.context.FacesContext;
+import java.io.IOException;
+
+/**
+ * @author amarkhel
+ * @since 2010-10-24
+ */
+public abstract class AbstractTooltip extends AbstractDivPanel implements MetaComponentResolver, MetaComponentEncoder {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.Tooltip";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.Tooltip";
+
+ public static final String CONTENT_META_COMPONENT_ID = "content";
+
+ protected AbstractTooltip() {
+ setRendererType("org.richfaces.Tooltip");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public abstract String getTarget();
+
+ public abstract String getValue();
+
+ public abstract TooltipLayout getLayout();
+
+ public abstract boolean isAttached();
+
+ public abstract TooltipDirection getDirection();
+
+ public abstract boolean isDisabled();
+
+ public abstract boolean isFollowMouse();
+
+ public abstract int getHideDelay();
+
+ public abstract String getHideEvent();
+
+ public abstract int getHorizontalOffset();
+
+ public abstract TooltipMode getMode();
+
+ public abstract int getShowDelay();
+
+ public abstract String getShowEvent();
+
+ public abstract int getVerticalOffset();
+
+ public abstract boolean isBypassUpdates();
+
+ public abstract boolean isLimitToList();
+
+ public abstract Object getData();
+
+ public abstract String getStatus();
+
+ public abstract Object getExecute();
+
+ public abstract Object getRender();
+
+ @Override
+ public void encodeAll(FacesContext context) throws IOException {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+
+ if (!isRendered()) {
+ return;
+ }
+
+ encodeBegin(context);
+ if (getMode() == TooltipMode.client) {
+ if (getRendersChildren()) {
+ encodeChildren(context);
+ } else if (this.getChildCount() > 0) {
+ for (UIComponent kid : getChildren()) {
+ kid.encodeAll(context);
+ }
+ }
+ }
+
+ encodeEnd(context);
+ }
+
+ @Override
+ public boolean visitTree(VisitContext context, VisitCallback callback) {
+ if (context instanceof ExtendedVisitContext) {
+ ExtendedVisitContext extendedVisitContext = (ExtendedVisitContext) context;
+ if (extendedVisitContext.getVisitMode() == ExtendedVisitContextMode.RENDER) {
+
+ VisitResult result = extendedVisitContext.invokeMetaComponentVisitCallback(this, callback,
+ CONTENT_META_COMPONENT_ID);
+ if (result == VisitResult.COMPLETE) {
+ return true;
+ } else if (result == VisitResult.REJECT) {
+ return false;
+ }
+ }
+ }
+
+ return super.visitTree(context, callback);
+ }
+
+ public void encodeMetaComponent(FacesContext context, String metaComponentId) throws IOException {
+ ((MetaComponentRenderer) getRenderer(context)).encodeMetaComponent(context, this, metaComponentId);
+ }
+
+ public String getContentClientId(FacesContext context) {
+ return getClientId(context) + MetaComponentResolver.META_COMPONENT_SEPARATOR_CHAR + CONTENT_META_COMPONENT_ID;
+ }
+
+ public String resolveClientId(FacesContext facesContext, UIComponent contextComponent, String metaComponentId) {
+ if (CONTENT_META_COMPONENT_ID.equals(metaComponentId)) {
+ return ((AbstractTooltip) contextComponent).getContentClientId(facesContext);
+ }
+
+ return null;
+ }
+}
Copied: branches/RF-8742/ui/output/ui/src/main/java/org/richfaces/component/UITooltip.java (from rev 19739, trunk/ui/output/ui/src/main/java/org/richfaces/component/UITooltip.java)
===================================================================
--- branches/RF-8742/ui/output/ui/src/main/java/org/richfaces/component/UITooltip.java (rev 0)
+++ branches/RF-8742/ui/output/ui/src/main/java/org/richfaces/component/UITooltip.java 2010-10-28 17:05:33 UTC (rev 19740)
@@ -0,0 +1,220 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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 org.richfaces.TooltipLayout;
+import org.richfaces.TooltipDirection;
+import org.richfaces.TooltipMode;
+
+/**
+ * @author amarkhel
+ * @since 2010-10-24
+ */
+public class UITooltip extends AbstractTooltip {
+
+ public enum PropertyKeys {
+ target,
+ value,
+ layout,
+ attached,
+ direction,
+ disabled,
+ followMouse,
+ hideDelay,
+ hideEvent,
+ horizontalOffset,
+ mode,
+ showDelay,
+ showEvent,
+ verticalOffset,
+ bypassUpdates,
+ limitToList,
+ data,
+ status,
+ execute,
+ render
+ }
+
+ public String getTarget() {
+ return (String) getStateHelper().eval(PropertyKeys.target, getParent().getClientId());
+ }
+
+ public void setTarget(String target) {
+ getStateHelper().put(PropertyKeys.target, target);
+ }
+
+ public String getValue() {
+ return (String) getStateHelper().eval(PropertyKeys.value);
+ }
+
+ public void setValue(String value) {
+ getStateHelper().put(PropertyKeys.value, value);
+ }
+
+ public TooltipLayout getLayout() {
+ return (TooltipLayout) getStateHelper().eval(PropertyKeys.layout, TooltipLayout.DEFAULT);
+ }
+
+ public void setLayout(TooltipLayout layout) {
+ getStateHelper().put(PropertyKeys.layout, layout);
+ }
+
+ public boolean isAttached() {
+ return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.attached, true)));
+ }
+
+ public void setAttached(boolean attached) {
+ getStateHelper().put(PropertyKeys.attached, attached);
+ }
+
+ public TooltipDirection getDirection() {
+ return (TooltipDirection) getStateHelper().eval(PropertyKeys.direction, TooltipDirection.DEFAULT);
+ }
+
+ public void setDirection(TooltipDirection direction) {
+ getStateHelper().put(PropertyKeys.direction, direction);
+ }
+
+ public boolean isDisabled() {
+ return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.disabled)));
+ }
+
+ public void setDisabled(boolean disabled) {
+ getStateHelper().put(PropertyKeys.disabled, disabled);
+ }
+
+ public boolean isFollowMouse() {
+ return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.followMouse, true)));
+ }
+
+ public void setFollowMouse(boolean followMouse) {
+ getStateHelper().put(PropertyKeys.followMouse, followMouse);
+ }
+
+ public int getHideDelay() {
+ return (Integer) getStateHelper().eval(PropertyKeys.hideDelay, 0);
+ }
+
+ public void setHideDelay(int hideDelay) {
+ getStateHelper().put(PropertyKeys.hideDelay, hideDelay);
+ }
+
+ public String getHideEvent() {
+ return (String) getStateHelper().eval(PropertyKeys.hideEvent, "mouseleave");
+ }
+
+ public void setHideEvent(String hideEvent) {
+ getStateHelper().put(PropertyKeys.hideEvent, hideEvent);
+ }
+
+ public int getHorizontalOffset() {
+ return (Integer) getStateHelper().eval(PropertyKeys.horizontalOffset, 10);
+ }
+
+ public void setHorizontalOffset(int horizontalOffset) {
+ getStateHelper().put(PropertyKeys.horizontalOffset, horizontalOffset);
+ }
+
+ public TooltipMode getMode() {
+ return (TooltipMode) getStateHelper().eval(PropertyKeys.mode, TooltipMode.DEFAULT);
+ }
+
+ public void setMode(TooltipMode mode) {
+ getStateHelper().put(PropertyKeys.mode, mode);
+ }
+
+ public int getShowDelay() {
+ return (Integer) getStateHelper().eval(PropertyKeys.showDelay, 0);
+ }
+
+ public void setShowDelay(int showDelay) {
+ getStateHelper().put(PropertyKeys.showDelay, showDelay);
+ }
+
+ public String getShowEvent() {
+ return (String) getStateHelper().eval(PropertyKeys.showEvent, "mouseenter");
+ }
+
+ public void setShowEvent(String showEvent) {
+ getStateHelper().put(PropertyKeys.showEvent, showEvent);
+ }
+
+ public int getVerticalOffset() {
+ return (Integer) getStateHelper().eval(PropertyKeys.verticalOffset, 10);
+ }
+
+ public void setVerticalOffset(int verticalOffset) {
+ getStateHelper().put(PropertyKeys.verticalOffset, verticalOffset);
+ }
+
+ public boolean isBypassUpdates() {
+ return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.bypassUpdates)));
+ }
+
+ public void setBypassUpdates(boolean bypassUpdates) {
+ getStateHelper().put(PropertyKeys.bypassUpdates, bypassUpdates);
+ }
+
+ public boolean isLimitToList() {
+ return Boolean.valueOf(String.valueOf(getStateHelper().eval(PropertyKeys.limitToList)));
+ }
+
+ public void setLimitToList(boolean limitToList) {
+ getStateHelper().put(PropertyKeys.limitToList, limitToList);
+ }
+
+ public Object getData() {
+ return getStateHelper().eval(PropertyKeys.data);
+ }
+
+ public void setData(Object data) {
+ getStateHelper().put(PropertyKeys.data, data);
+ }
+
+ public String getStatus() {
+ return (String) getStateHelper().eval(PropertyKeys.status);
+ }
+
+ public void setStatus(String status) {
+ getStateHelper().put(PropertyKeys.status, status);
+ }
+
+ public Object getExecute() {
+ return getStateHelper().eval(PropertyKeys.execute);
+ }
+
+ public void setExecute(Object execute) {
+ getStateHelper().put(PropertyKeys.execute, execute);
+ }
+
+ public Object getRender() {
+ return getStateHelper().eval(PropertyKeys.render);
+ }
+
+ public void setRender(Object render) {
+ getStateHelper().put(PropertyKeys.render, render);
+ }
+
+
+}
Copied: branches/RF-8742/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTooltip.java (from rev 19739, trunk/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTooltip.java)
===================================================================
--- branches/RF-8742/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTooltip.java (rev 0)
+++ branches/RF-8742/ui/output/ui/src/main/java/org/richfaces/component/html/HtmlTooltip.java 2010-10-28 17:05:33 UTC (rev 19740)
@@ -0,0 +1,203 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.html;
+
+import org.richfaces.component.UITooltip;
+import javax.faces.component.behavior.ClientBehaviorHolder;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+/**
+ * @author amarkhel
+ * @since 2010-10-24
+ */
+public class HtmlTooltip extends UITooltip implements ClientBehaviorHolder {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.Tooltip";
+
+ public static final String COMPONENT_FAMILY = "org.richfaces.Tooltip";
+
+ private static final Collection<String> EVENT_NAMES = Collections.unmodifiableCollection(Arrays.asList(
+ "click",
+ "dblclick",
+ "mousedown",
+ "mousemove",
+ "mouseout",
+ "mouseover",
+ "mouseup",
+ "hide",
+ "show",
+ "beforehide",
+ "beforeshow"
+ ));
+
+
+ public enum PropertyKeys {
+ style,
+ styleClass,
+ zindex,
+ onclick,
+ ondblclick,
+ onmousedown,
+ onmousemove,
+ onmouseout,
+ onmouseover,
+ onmouseup,
+ onhide,
+ onshow,
+ onbeforehide,
+ onbeforeshow
+ }
+
+ public HtmlTooltip() {
+ setRendererType("org.richfaces.Tooltip");
+ }
+
+ @Override
+ public String getFamily() {
+ return COMPONENT_FAMILY;
+ }
+
+ public String getStyle() {
+ return (String) getStateHelper().eval(PropertyKeys.style);
+ }
+
+ public void setStyle(String style) {
+ getStateHelper().put(PropertyKeys.style, style);
+ }
+
+ public String getStyleClass() {
+ return (String) getStateHelper().eval(PropertyKeys.styleClass);
+ }
+
+ public void setStyleClass(String styleClass) {
+ getStateHelper().put(PropertyKeys.styleClass, styleClass);
+ }
+
+ public int getZindex() {
+ return (Integer) getStateHelper().eval(PropertyKeys.zindex);
+ }
+
+ public void setZindex(int zindex) {
+ getStateHelper().put(PropertyKeys.zindex, zindex);
+ }
+
+ public String getOnclick() {
+ return (String) getStateHelper().eval(PropertyKeys.onclick);
+ }
+
+ public void setOnclick(String onclick) {
+ getStateHelper().put(PropertyKeys.onclick, onclick);
+ }
+
+ public String getOndblclick() {
+ return (String) getStateHelper().eval(PropertyKeys.ondblclick);
+ }
+
+ public void setOndblclick(String ondblclick) {
+ getStateHelper().put(PropertyKeys.ondblclick, ondblclick);
+ }
+
+ public String getOnmousedown() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousedown);
+ }
+
+ public void setOnmousedown(String onmousedown) {
+ getStateHelper().put(PropertyKeys.onmousedown, onmousedown);
+ }
+
+ public String getOnmousemove() {
+ return (String) getStateHelper().eval(PropertyKeys.onmousemove);
+ }
+
+ public void setOnmousemove(String onmousemove) {
+ getStateHelper().put(PropertyKeys.onmousemove, onmousemove);
+ }
+
+ public String getOnmouseout() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseout);
+ }
+
+ public void setOnmouseout(String onmouseout) {
+ getStateHelper().put(PropertyKeys.onmouseout, onmouseout);
+ }
+
+ public String getOnmouseover() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseover);
+ }
+
+ public void setOnmouseover(String onmouseover) {
+ getStateHelper().put(PropertyKeys.onmouseover, onmouseover);
+ }
+
+ public String getOnmouseup() {
+ return (String) getStateHelper().eval(PropertyKeys.onmouseup);
+ }
+
+ public void setOnmouseup(String onmouseup) {
+ getStateHelper().put(PropertyKeys.onmouseup, onmouseup);
+ }
+
+ public String getOnhide() {
+ return (String) getStateHelper().eval(PropertyKeys.onhide);
+ }
+
+ public void setOnhide(String onhide) {
+ getStateHelper().put(PropertyKeys.onhide, onhide);
+ }
+
+ public String getOnshow() {
+ return (String) getStateHelper().eval(PropertyKeys.onshow);
+ }
+
+ public void setOnshow(String onshow) {
+ getStateHelper().put(PropertyKeys.onshow, onshow);
+ }
+
+ public String getOnbeforehide() {
+ return (String) getStateHelper().eval(PropertyKeys.onbeforehide);
+ }
+
+ public void setOnbeforehide(String onbeforehide) {
+ getStateHelper().put(PropertyKeys.onbeforehide, onbeforehide);
+ }
+
+ public String getOnbeforeshow() {
+ return (String) getStateHelper().eval(PropertyKeys.onbeforeshow);
+ }
+
+ public void setOnbeforeshow(String onbeforeshow) {
+ getStateHelper().put(PropertyKeys.onbeforeshow, onbeforeshow);
+ }
+
+
+
+ @Override
+ public Collection<String> getEventNames() {
+ return EVENT_NAMES;
+ }
+}
+
Modified: branches/RF-8742/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java
===================================================================
--- branches/RF-8742/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/ui/output/ui/src/main/java/org/richfaces/renderkit/html/DivPanelRenderer.java 2010-10-28 17:05:33 UTC (rev 19740)
@@ -97,7 +97,11 @@
writer.startElement(HtmlConstants.DIV_ELEM, component);
writer.writeAttribute("id", component.getClientId(context), "clientId");
writer.writeAttribute("class", getStyleClass(component), null);
- writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, getStyle(component), null);
+ String style = getStyle(component);
+ if (style != null) {
+ writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, style, null);
+ }
+
renderPassThroughAttributes(context, component, getPassThroughAttributes());
}
Copied: branches/RF-8742/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java (from rev 19739, trunk/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java)
===================================================================
--- branches/RF-8742/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java (rev 0)
+++ branches/RF-8742/ui/output/ui/src/main/java/org/richfaces/renderkit/html/TooltipRenderer.java 2010-10-28 17:05:33 UTC (rev 19740)
@@ -0,0 +1,217 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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;
+
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.javascript.JSObject;
+import org.richfaces.component.AbstractTooltip;
+import org.richfaces.component.html.HtmlTooltip;
+import org.richfaces.renderkit.HtmlConstants;
+import org.richfaces.renderkit.MetaComponentRenderer;
+
+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 java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.richfaces.component.util.HtmlUtil.concatClasses;
+import static org.richfaces.renderkit.RenderKitUtils.renderPassThroughAttributes;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.addEventOption;
+import static org.richfaces.renderkit.html.TogglePanelRenderer.getAjaxOptions;
+
+/**
+ * @author amarkhel
+ * @since 2010-10-24
+ */
+@ResourceDependencies( { // TODO review
+ @ResourceDependency(library = "javax.faces", name = "jsf.js"),
+ @ResourceDependency(name = "jquery.js"),
+ @ResourceDependency(name = "jquery.position.js"),
+ @ResourceDependency(name = "richfaces.js"),
+ @ResourceDependency(name = "richfaces-event.js"),
+ @ResourceDependency(name = "richfaces-base-component.js"),
+ @ResourceDependency(library = "org.richfaces", name = "popup.js"),
+ @ResourceDependency(library = "org.richfaces", name = "Tooltip.js"),
+ @ResourceDependency(library = "org.richfaces", name = "tooltip.ecss") })
+public class TooltipRenderer extends DivPanelRenderer implements MetaComponentRenderer {
+
+ public static final String HIDE = "hide";
+ public static final String SHOW = "show";
+ public static final String BEFORE_HIDE = "beforehide";
+ public static final String BEFORE_SHOW = "beforeshow";
+
+ @Override
+ protected void doDecode(FacesContext context, UIComponent component) {
+ AbstractTooltip tooltip = (AbstractTooltip) component;
+
+ Map<String, String> requestMap =
+ context.getExternalContext().getRequestParameterMap();
+
+ String compClientId = component.getClientId(context);
+ String clientId = requestMap.get(compClientId);
+ if (clientId != null && clientId.equals(compClientId)) {
+ context.getPartialViewContext().getRenderIds().add(tooltip.getContentClientId(context));
+
+ //TODO nick - this should be done on encode, not on decode
+ addOnCompleteParam(tooltip.getClientId());
+ }
+ }
+
+ protected static void addOnCompleteParam(String tooltipId) {
+ AjaxContext.getCurrentInstance().appendOncomplete(new StringBuilder()
+ .append("RichFaces.$('").append(tooltipId).append("').onCompleteHandler();").toString());
+ }
+
+ @Override
+ protected void doEncodeBegin(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ AbstractTooltip tooltip = (AbstractTooltip) component;
+
+ writer.startElement(getMarkupElement(tooltip), component);
+ writer.writeAttribute("id", component.getClientId(context), "clientId");
+ writer.writeAttribute("class", getStyleClass(component), null);
+ String style = getStyle(component);
+ if (style != null && style.trim().length() > 0) {
+ writer.writeAttribute(HtmlConstants.STYLE_ATTRIBUTE, style, null);
+ }
+
+ renderPassThroughAttributes(context, component, getPassThroughAttributes());
+
+ writer.startElement(getMarkupElement(tooltip), component);
+ writer.writeAttribute("id", component.getClientId(context) + ":cntr", null);
+ writer.writeAttribute("class", "rf-tt-cntr", null);
+
+ encodeLoading(writer, context, tooltip);
+ encodeContentBegin(writer, context, tooltip);
+ }
+
+ private void encodeContentBegin(ResponseWriter writer, FacesContext context, AbstractTooltip tooltip) throws IOException {
+ writer.startElement(getMarkupElement(tooltip), tooltip);
+ writer.writeAttribute("id", tooltip.getClientId(context) + "@content", null);
+ writer.writeAttribute("class", "rf-tt-cnt", null);
+ }
+
+ private void encodeLoading(ResponseWriter writer, FacesContext context, AbstractTooltip tooltip) throws IOException {
+ writer.startElement(getMarkupElement(tooltip), tooltip);
+ writer.writeAttribute("id", tooltip.getClientId(context) + ":loading", null);
+ writer.writeAttribute("class", "rf-tt-loading", null);
+ writer.writeText("Loading...", null);
+ writer.endElement(getMarkupElement(tooltip));
+ }
+
+ private String getMarkupElement(AbstractTooltip component) {
+ switch (component.getLayout()) {
+ case block:
+ return HtmlConstants.DIV_ELEM;
+
+ case inline:
+ return HtmlConstants.SPAN_ELEM;
+
+ default:
+ throw new IllegalStateException("Unknown tooltip layout (=" + component.getLayout() + ")");
+ }
+ }
+
+ @Override
+ protected String getStyleClass(UIComponent component) {
+ return concatClasses("rf-tt", attributeAsString(component, "styleClass"));
+ }
+
+ @Override
+ protected JSObject getScriptObject(FacesContext context, UIComponent component) {
+ return new JSObject("RichFaces.ui.Tooltip",
+ component.getClientId(), getScriptObjectOptions(context, component));
+ }
+
+ @Override
+ protected Map<String, Object> getScriptObjectOptions(FacesContext context, UIComponent component) {
+ HtmlTooltip tooltip = (HtmlTooltip) component;
+
+ Map<String, Object> options = new HashMap<String, Object>();
+ options.put("ajax", getAjaxOptions(context, tooltip));
+ options.put("direction", tooltip.getDirection());
+ options.put("attached", tooltip.isAttached());
+ options.put("offset", getOffset(tooltip));
+ options.put("mode", tooltip.getMode());
+ options.put("disabled", tooltip.isDisabled());
+ options.put("hideDelay", tooltip.getHideDelay());
+ options.put("hideEvent", tooltip.getHideEvent());
+ options.put("showDelay", tooltip.getShowDelay());
+ options.put("showEvent", tooltip.getShowEvent());
+ options.put("followMouse", tooltip.isFollowMouse());
+ options.put("target", tooltip.getTarget());
+
+ addEventOption(context, tooltip, options, HIDE);
+ addEventOption(context, tooltip, options, SHOW);
+ addEventOption(context, tooltip, options, BEFORE_HIDE);
+ addEventOption(context, tooltip, options, BEFORE_SHOW);
+
+ return options;
+ }
+
+ public Map<String, Object> getOffset(HtmlTooltip tooltip) {
+ Map<String, Object> options = new HashMap<String, Object>();
+ // TODO
+ return options;
+ }
+
+ private void encodeContentEnd(ResponseWriter writer, FacesContext context, AbstractTooltip tooltip) throws IOException {
+ writer.endElement(getMarkupElement(tooltip));
+ }
+
+ @Override
+ protected void doEncodeEnd(ResponseWriter writer, FacesContext context, UIComponent component) throws IOException {
+ encodeContentEnd(writer, context, (AbstractTooltip) component);
+
+ writer.endElement(getMarkupElement((AbstractTooltip) component));
+
+ writeJavaScript(writer, context, component);
+
+ writer.endElement(getMarkupElement((AbstractTooltip) component));
+ }
+
+ public void encodeMetaComponent(FacesContext context, UIComponent component, String metaComponentId) throws IOException {
+ if (AbstractTooltip.CONTENT_META_COMPONENT_ID.equals(metaComponentId)) {
+ AbstractTooltip tooltip = (AbstractTooltip) component;
+ ResponseWriter writer = context.getResponseWriter();
+
+ encodeContentBegin(writer, context, tooltip);
+ for (UIComponent child : tooltip.getChildren()) {
+ child.encodeAll(context);
+ }
+ encodeContentEnd(writer, context, tooltip);
+ }
+ }
+
+ @Override
+ protected Class<? extends UIComponent> getComponentClass() {
+ return AbstractTooltip.class;
+ }
+
+
+}
+
Modified: branches/RF-8742/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml
===================================================================
--- branches/RF-8742/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/ui/output/ui/src/main/resources/META-INF/pn.faces-config.xml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -11,6 +11,112 @@
</behavior>
<component>
+ <component-type>org.richfaces.Tooltip</component-type>
+ <component-class>org.richfaces.component.html.HtmlTooltip</component-class>
+ <property>
+ <description></description>
+ <property-name>for_</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>value</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>layout</property-name>
+ <property-class>org.richfaces.TooltipLayout</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>attached</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>direction</property-name>
+ <property-class>org.richfaces.TooltipDirection</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>disabled</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>followMouse</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>hideDelay</property-name>
+ <property-class>int</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>hideEvent</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>horizontalOffset</property-name>
+ <property-class>int</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>mode</property-name>
+ <property-class>org.richfaces.TooltipMode</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>showDelay</property-name>
+ <property-class>int</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>showEvent</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>verticalOffset</property-name>
+ <property-class>int</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>bypassUpdates</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>limitToList</property-name>
+ <property-class>boolean</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>data</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>status</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>execute</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+ <property>
+ <description></description>
+ <property-name>render</property-name>
+ <property-class>java.lang.Object</property-class>
+ </property>
+
+ </component>
+
+ <component>
<component-type>org.richfaces.CollapsiblePanel</component-type>
<component-class>org.richfaces.component.html.HtmlCollapsiblePanel</component-class>
<property>
@@ -666,6 +772,12 @@
<render-kit>
<render-kit-id>HTML_BASIC</render-kit-id>
<renderer>
+ <component-family>org.richfaces.Tooltip</component-family>
+ <renderer-type>org.richfaces.Tooltip</renderer-type>
+ <renderer-class>org.richfaces.renderkit.html.TooltipRenderer</renderer-class>
+ </renderer>
+
+ <renderer>
<component-family>org.richfaces.CollapsiblePanel</component-family>
<renderer-type>org.richfaces.CollapsiblePanel</renderer-type>
<renderer-class>org.richfaces.renderkit.html.CollapsiblePanelRenderer</renderer-class>
Modified: branches/RF-8742/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml
===================================================================
--- branches/RF-8742/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/ui/output/ui/src/main/resources/META-INF/pn.taglib.xml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -52,6 +52,201 @@
<tag>
+ <tag-name>tooltip</tag-name>
+ <component>
+ <component-type>org.richfaces.Tooltip</component-type>
+ <renderer-type>org.richfaces.Tooltip</renderer-type>
+
+ </component>
+ <attribute>
+ <description></description>
+ <name>for_</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>value</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>layout</name>
+ <type>org.richfaces.TooltipLayout</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>attached</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>direction</name>
+ <type>org.richfaces.TooltipDirection</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>disabled</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>followMouse</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>hideDelay</name>
+ <type>int</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>hideEvent</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>horizontalOffset</name>
+ <type>int</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>mode</name>
+ <type>org.richfaces.TooltipMode</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>showDelay</name>
+ <type>int</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>showEvent</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>verticalOffset</name>
+ <type>int</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>id</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>binding</name>
+ <type>javax.faces.component.UIComponent</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>rendered</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>bypassUpdates</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>limitToList</name>
+ <type>boolean</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>data</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>status</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>execute</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>render</name>
+ <type>java.lang.Object</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>style</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>styleClass</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>zindex</name>
+ <type>int</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>ondblclick</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousedown</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmousemove</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseout</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseover</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onmouseup</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onhide</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onshow</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onbeforehide</name>
+ <type>java.lang.String</type>
+ </attribute>
+ <attribute>
+ <description></description>
+ <name>onbeforeshow</name>
+ <type>java.lang.String</type>
+ </attribute>
+
+ </tag>
+
+ <tag>
<tag-name>collapsiblePanel</tag-name>
<component>
<component-type>org.richfaces.CollapsiblePanel</component-type>
Copied: branches/RF-8742/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js (from rev 19739, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js)
===================================================================
--- branches/RF-8742/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js (rev 0)
+++ branches/RF-8742/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/Tooltip.js 2010-10-28 17:05:33 UTC (rev 19740)
@@ -0,0 +1,292 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.
+ */
+
+
+(function ($, rf) {
+
+ rf.ui = rf.ui || {};
+
+ rf.ui.TooltipDirection = {
+ topRight : "topRight",
+ topLeft : "topLeft",
+ bottomRight : "bottomRight",
+ bottomLeft : "bottomLeft",
+ auto : "auto",
+
+ DEFAULT: "bottomRight"
+ };
+ var TooltipDirection = rf.ui.TooltipDirection;
+
+ rf.ui.TooltipMode = {
+ client : "client",
+ ajax : "ajax",
+
+ DEFAULT: "client"
+ };
+ var TooltipMode = rf.ui.TooltipMode;
+
+ var DEFAULT_OPTIONS = {
+ direction : TooltipDirection.DEFAULT,
+ attached : true,
+ offset : [],
+ mode : TooltipMode.DEFAULT,
+ disabled : false,
+ hideDelay : 0,
+ hideEvent : "mouseleave",
+ showDelay : 0,
+ showEvent : "mouseenter",
+ followMouse : true
+ };
+
+ var SHOW_ACTION = {
+
+ /**
+ *
+ * @return {void}
+ * */
+ exec : function (tooltip, event) {
+ var mode = tooltip.mode;
+ if (mode == TooltipMode.ajax) {
+ return this.execAjax(tooltip, event);
+ } else if (mode == TooltipMode.client) {
+ return this.execClient(tooltip, event);
+ } else {
+ rf.log.error("SHOW_ACTION.exec : unknown mode (" + mode + ")");
+ }
+ },
+
+ /**
+ * @protected
+ *
+ * @return {Boolean} false
+ * */
+ execAjax : function (tooltip, event) {
+ tooltip.__loading().show();
+ tooltip.__content().hide();
+ tooltip.__show(event);
+
+ rf.ajax(tooltip.id, null, $.extend({}, tooltip.options["ajax"], {}));
+
+ return true;
+ },
+
+ /**
+ * @protected
+ *
+ * @return {undefined}
+ * - false - if process has been terminated
+ * - true - in other cases
+ * */
+ execClient : function (tooltip, event) {
+ tooltip.__show(event);
+
+ return tooltip.__fireShow();
+ }
+ };
+
+ rf.ui.Tooltip = rf.BaseComponent.extendClass({
+ // class name
+ name:"Tooltip",
+
+ /**
+ * @class Tooltip
+ * @name Tooltip
+ *
+ * @constructor
+ * @param {String} componentId - component id
+ * @param {Hash} options - params
+ * */
+ init : function (componentId, options) {
+ this.id = componentId
+ this.options = $.extend({}, DEFAULT_OPTIONS, this.options || {}, options || {});
+ this.attachToDom.call(this, componentId);
+
+ this.mode = TooltipMode.ajax;
+ this.target = this.options.target;
+
+ this.__addUserEventHandler("hide");
+ this.__addUserEventHandler("show");
+ this.__addUserEventHandler("beforehide");
+ this.__addUserEventHandler("beforeshow");
+
+ this.popup = new RichFaces.ui.Popup(this.id + ":cntr", {
+ attachTo: this.target,
+ attachToBody: false,
+ positionType: "TOOLTIP",
+ positionOffset: [200,200]
+ });
+
+ var tooltip = this;
+ function mouseMoveHandler(event) {
+ tooltip.popup.show(event);
+ }
+
+ $(this.options.target).bind(this.options.showEvent, function (event) {
+ tooltip.show(event);
+
+ if (tooltip.options.followMouse) {
+ $(tooltip.target).bind("mousemove", mouseMoveHandler);
+ }
+ });
+
+ $(tooltip.target).bind(this.options.hideEvent, function (event) {
+ tooltip.hide();
+
+ if (tooltip.options.followMouse) {
+ $(tooltip.target).unbind("mousemove", mouseMoveHandler);
+ }
+ });
+
+ },
+
+ /***************************** Public Methods ****************************************************************/
+ /**
+ * @methodOf
+ * @name PanelMenuItem#hide
+ *
+ * TODO ...
+ *
+ * @return {void} TODO ...
+ */
+ hide: function () {
+ var continueProcess = this.__fireBeforeHide();
+ if (!continueProcess) {
+ return false;
+ }
+
+ this.__hide();
+
+ return this.__fireHide()
+ },
+
+ /**
+ * @private
+ * @return {void} TODO ...
+ */
+ __hide: function () {
+ var tooltip = this;
+ this.__delay(this.options.hideDelay, function () {
+ tooltip.popup.hide();
+ });
+ },
+
+ /**
+ * @methodOf
+ * @name PanelMenuItem#show
+ *
+ * TODO ...
+ *
+ * @return {void} TODO ...
+ */
+ show: function (event) {
+ var continueProcess = this.__fireBeforeShow();
+ if (!continueProcess) {
+ return false;
+ }
+
+ SHOW_ACTION.exec(this, event);
+ },
+
+ onCompleteHandler : function () {
+ this.__loading().hide();
+ this.__content().show();
+
+ return this.__fireShow();
+ },
+
+ /**
+ * @private
+ * @return {void} TODO ...
+ */
+ __show: function (event) {
+ var tooltip = this;
+ this.__delay(this.options.hideDelay, function () {
+ tooltip.popup.show(event);
+ });
+ },
+
+ /***************************** Private Methods ****************************************************************/
+ __delay : function (delay, action) {
+ if (delay > 0) {
+ var hidingTimerHandle = window.setTimeout(function() {
+ action();
+
+ if (hidingTimerHandle) {
+ window.clearTimeout(this.hidingTimerHandle);
+ hidingTimerHandle = undefined;
+ }
+ }, delay);
+ } else {
+ action();
+ }
+ },
+
+ __detectAncestorNode: function(leaf, element) {
+ // Return true if "element" is "leaf" or one of its parents
+ var node = leaf;
+ while (node != null && node != element) {
+ node = node.parentNode;
+ }
+ return (node != null);
+ },
+
+ __loading : function () {
+ return $(document.getElementById(this.id + ":loading"));
+ },
+
+ __content : function () {
+ return $(document.getElementById(this.id + "@content"));
+ },
+
+ __fireHide : function () {
+ return rf.Event.fireById(this.id, "hide", { id: this.id });
+ },
+
+ __fireShow : function () {
+ return rf.Event.fireById(this.id, "show", { id: this.id });
+ },
+
+ __fireBeforeHide : function () {
+ return rf.Event.fireById(this.id, "beforehide", { id: this.id });
+ },
+
+ __fireBeforeShow : function () {
+ return rf.Event.fireById(this.id, "beforeshow", { id: this.id });
+ },
+
+
+
+ /**
+ * @private
+ * */
+ __addUserEventHandler : function (name) {
+ var handler = this.options["on" + name];
+ if (handler) {
+ rf.Event.bindById(this.id, name, handler);
+ }
+ },
+
+ destroy: function () {
+ rf.ui.Tooltip.$super.destroy.call(this);
+ }
+ });
+})(jQuery, RichFaces);
Copied: branches/RF-8742/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.ecss (from rev 19739, trunk/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.ecss)
===================================================================
--- branches/RF-8742/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.ecss (rev 0)
+++ branches/RF-8742/ui/output/ui/src/main/resources/META-INF/resources/org.richfaces/tooltip.ecss 2010-10-28 17:05:33 UTC (rev 19740)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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.
+ */
+
+.rf-tt {
+ position: absolute;
+}
+
+.rf-tt-loading {
+
+}
+
+.rf-tt-cnt {
+
+}
+
+.rf-tt-cntr {
+ position: absolute;
+ display: none;
+}
\ No newline at end of file
Copied: branches/RF-8742/ui/output/ui/src/test/java/org/richfaces/component/UITooltipTest.java (from rev 19739, trunk/ui/output/ui/src/test/java/org/richfaces/component/UITooltipTest.java)
===================================================================
--- branches/RF-8742/ui/output/ui/src/test/java/org/richfaces/component/UITooltipTest.java (rev 0)
+++ branches/RF-8742/ui/output/ui/src/test/java/org/richfaces/component/UITooltipTest.java 2010-10-28 17:05:33 UTC (rev 19740)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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 org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.faces.component.UIComponent;
+import java.util.List;
+
+/**
+ * @author amarkhel
+ * @since 2010-10-24
+ */
+public class UITooltipTest {
+
+ private UITooltip tooltip;
+
+ @Before
+ public void setUp () {
+ tooltip = new UITooltip();
+ }
+
+ @Test
+ public void testSomething() {
+ Assert.assertNotNull(tooltip);
+ }
+}
+
Modified: branches/RF-8742/ui/output/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java
===================================================================
--- branches/RF-8742/ui/output/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java 2010-10-28 16:13:23 UTC (rev 19739)
+++ branches/RF-8742/ui/output/ui/src/test/java/org/richfaces/renderkit/html/RendererTestBase.java 2010-10-28 17:05:33 UTC (rev 19740)
@@ -51,7 +51,6 @@
XMLUnit.setIgnoreDiffBetweenTextAndCDATA(true);
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreComments(true);
-
}
protected HtmlUnitEnvironment environment;
@@ -85,7 +84,7 @@
Diff xmlDiff = new Diff(new StringReader(pageCode), new InputStreamReader(expectedPageCode));
xmlDiff.overrideDifferenceListener(new IgnoreScriptsContent());
- Assert.assertTrue("XML was not similar:" + xmlDiff.toString(), xmlDiff.similar());
+ Assert.assertTrue("XML was not similar:" + xmlDiff.toString() + "\n\n" + pageCode, xmlDiff.similar());
}
}
Copied: branches/RF-8742/ui/output/ui/src/test/java/org/richfaces/renderkit/html/TooltipRendererTest.java (from rev 19739, trunk/ui/output/ui/src/test/java/org/richfaces/renderkit/html/TooltipRendererTest.java)
===================================================================
--- branches/RF-8742/ui/output/ui/src/test/java/org/richfaces/renderkit/html/TooltipRendererTest.java (rev 0)
+++ branches/RF-8742/ui/output/ui/src/test/java/org/richfaces/renderkit/html/TooltipRendererTest.java 2010-10-28 17:05:33 UTC (rev 19740)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright ${year}, 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;
+
+import org.junit.Test;
+import org.xml.sax.SAXException;
+
+import java.io.IOException;
+
+ /**
+ * @author amarkhel
+ * @since 2010-10-24
+ */
+public class TooltipRendererTest extends RendererTestBase {
+
+ @Test
+ public void testDoEncode() throws IOException, SAXException {
+ doTest("tooltip", "f:tooltip");
+ }
+
+}
+
+
+
Copied: branches/RF-8742/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xhtml (from rev 19739, trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xhtml)
===================================================================
--- branches/RF-8742/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xhtml (rev 0)
+++ branches/RF-8742/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xhtml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -0,0 +1,47 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--
+ JBoss, Home of Professional Open Source
+ Copyright ${year}, 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.
+-->
+
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:fn="http://java.sun.com/jsp/jstl/functions"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:pn="http://richfaces.org/output"
+ xmlns:rich="http://richfaces.org/rich">
+
+ <h:head>
+ <title>Richfaces Tooltip Test</title>
+ </h:head>
+
+<h:body>
+ <h:form id="f" style="border:blue solid thin;">
+ <pn:tooltip id="tooltip">
+ <!-- TODO -->
+ </pn:tooltip>
+ </h:form>
+</h:body>
+</html>
+
+
Copied: branches/RF-8742/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xmlunit.xml (from rev 19739, trunk/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xmlunit.xml)
===================================================================
--- branches/RF-8742/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xmlunit.xml (rev 0)
+++ branches/RF-8742/ui/output/ui/src/test/resources/org/richfaces/renderkit/html/tooltip.xmlunit.xml 2010-10-28 17:05:33 UTC (rev 19740)
@@ -0,0 +1,9 @@
+<span id="f:tooltip" class="rf-tt">
+ <span id="f:tooltip:cntr" class="rf-tt-cntr">
+ <span id="f:tooltip:loading" class="rf-tt-loading">Loading...</span>
+ <span id="f:tooltip@content" class="rf-tt-cnt"></span>
+ </span>
+ <script type="text/javascript">
+ // Text
+ </script>
+</span>
14 years, 2 months
JBoss Rich Faces SVN: r19739 - trunk/examples/richfaces-showcase/src/main/webapp/richfaces/select/samples.
by richfaces-svn-commits@lists.jboss.org
Author: ilya_shaikovsky
Date: 2010-10-28 12:13:23 -0400 (Thu, 28 Oct 2010)
New Revision: 19739
Modified:
trunk/examples/richfaces-showcase/src/main/webapp/richfaces/select/samples/select-sample.xhtml
Log:
https://jira.jboss.org/browse/RF-9243
Modified: trunk/examples/richfaces-showcase/src/main/webapp/richfaces/select/samples/select-sample.xhtml
===================================================================
--- trunk/examples/richfaces-showcase/src/main/webapp/richfaces/select/samples/select-sample.xhtml 2010-10-28 16:04:09 UTC (rev 19738)
+++ trunk/examples/richfaces-showcase/src/main/webapp/richfaces/select/samples/select-sample.xhtml 2010-10-28 16:13:23 UTC (rev 19739)
@@ -19,5 +19,14 @@
<f:selectItem itemValue="4" itemLabel="Option 5" />
</rich:select>
</rich:panel>
+ <p>DESC</p>
+ <rich:panel style="width:220px;">
+ <f:facet name="header">
+ <h:outputText value="Select with manual input"></h:outputText>
+ </f:facet>
+ <rich:select enableManualInput="true" defaultLabel="start typing for select" >
+ <f:selectItems value="#{inplaceSelectBean.capitalsOptions}"/>
+ </rich:select>
+ </rich:panel>
</h:form>
</ui:composition>
\ No newline at end of file
14 years, 2 months
JBoss Rich Faces SVN: r19738 - modules/tests/metamer/trunk/application/src/main/webapp/components/richAccordion.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-10-28 12:04:09 -0400 (Thu, 28 Oct 2010)
New Revision: 19738
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richAccordion/simple.xhtml
Log:
emphases the disabled item in rich:accordion sample
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richAccordion/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richAccordion/simple.xhtml 2010-10-28 16:03:36 UTC (rev 19737)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richAccordion/simple.xhtml 2010-10-28 16:04:09 UTC (rev 19738)
@@ -100,7 +100,7 @@
<rich:accordionItem id="item3" name="item3" header="Item 3">
content of item 3
</rich:accordionItem>
- <rich:accordionItem id="item4" name="item4" header="Item 4" disabled="true">
+ <rich:accordionItem id="item4" name="item4" header="Item 4 (disabled)" disabled="true">
content of item 4
</rich:accordionItem>
<rich:accordionItem id="item5" name="item5" header="Item 5">
14 years, 2 months