JBoss Rich Faces SVN: r1715 - in trunk/ui: datascroller/src/main/java/org/richfaces/event and 9 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-07-19 18:20:58 -0400 (Thu, 19 Jul 2007)
New Revision: 1715
Added:
trunk/ui/datascroller/src/main/java/org/richfaces/event/DataScrollerEvent.java
Modified:
trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DragIndicatorRendererBase.java
trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java
trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java
trunk/ui/drag-drop/src/test/java/org/richfaces/component/DragDropTest.java
trunk/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java
trunk/ui/panel/src/main/config/component/panel.xml
trunk/ui/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java
trunk/ui/tree/src/main/java/org/richfaces/component/state/TreeState.java
trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
trunk/ui/tree/src/main/templates/htmlTree.jspx
trunk/ui/tree/src/test/java/org/richfaces/component/TreeComponentTest.java
Log:
merged changes commit
Modified: trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java
===================================================================
--- trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java 2007-07-19 22:11:59 UTC (rev 1714)
+++ trunk/ui/datascroller/src/main/java/org/richfaces/component/UIDatascroller.java 2007-07-19 22:20:58 UTC (rev 1715)
@@ -21,9 +21,14 @@
package org.richfaces.component;
+import org.ajax4jsf.component.AjaxActionComponent;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.richfaces.event.DataScrollerEvent;
+import org.richfaces.event.DataScrollerListener;
+import org.richfaces.event.DataScrollerSource;
+
import javax.faces.FacesException;
import javax.faces.component.ActionSource;
-import javax.faces.component.UICommand;
import javax.faces.component.UIComponent;
import javax.faces.component.UIData;
import javax.faces.context.FacesContext;
@@ -31,19 +36,13 @@
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
-import org.ajax4jsf.renderkit.AjaxRendererUtils;
-import org.richfaces.event.DataScrollerEvent;
-import org.richfaces.event.DataScrollerListener;
-import org.richfaces.event.DataScrollerSource;
-
-/**
- * JSF component class
- */
+/** JSF component class */
//xxxx nick -> alex - extend UIComponentBase and
//create event listener & event classes to define PageSwitchEvent
//public abstract class UIDatascroller extends UIComponentBase implements DataScrollerSource{
-public abstract class UIDatascroller extends UICommand implements DataScrollerSource,ActionSource{
+public abstract class UIDatascroller extends AjaxActionComponent
+ implements DataScrollerSource, ActionSource {
public static final String COMPONENT_TYPE = "org.richfaces.Datascroller";
public static final String COMPONENT_FAMILY = "org.richfaces.Datascroller";
@@ -67,18 +66,22 @@
public static final String NEXT_DISABLED_FACET_NAME = "next_disabled";
- public static final String PREVIOUS_DISABLED_FACET_NAME = "previous_disabled";
+ public static final String PREVIOUS_DISABLED_FACET_NAME
+ = "previous_disabled";
- public static final String FAST_FORWARD_DISABLED_FACET_NAME = "fastforward_disabled";
+ public static final String FAST_FORWARD_DISABLED_FACET_NAME
+ = "fastforward_disabled";
- public static final String FAST_REWIND_DISABLED_FACET_NAME = "fastrewind_disabled";
-
+ public static final String FAST_REWIND_DISABLED_FACET_NAME
+ = "fastrewind_disabled";
+
public void addScrollerListener(DataScrollerListener listener) {
addFacesListener(listener);
}
public DataScrollerListener[] getScrollerListeners() {
- return (DataScrollerListener[]) getFacesListeners(DataScrollerListener.class);
+ return (DataScrollerListener[]) getFacesListeners(
+ DataScrollerListener.class);
}
public void removeScrollerListener(DataScrollerListener listener) {
@@ -88,16 +91,18 @@
public void broadcast(FacesEvent event) throws AbortProcessingException {
super.broadcast(event);
if (event instanceof DataScrollerEvent) {
- DataScrollerEvent dataScrollerEvent = (DataScrollerEvent) event;
- setPage(dataScrollerEvent.getNewScrolVal());
+ DataScrollerEvent dataScrollerEvent = (DataScrollerEvent) event;
+ setPage(dataScrollerEvent.getNewScrolVal());
- FacesContext context = FacesContext.getCurrentInstance();
+ FacesContext context = FacesContext.getCurrentInstance();
AjaxRendererUtils.addRegionByName(context, this, this.getId());
AjaxRendererUtils.addRegionByName(context, this, this.getFor());
-
+
+ setupReRender(context);
+
MethodBinding scrollerListener = getScrollerListener();
if (scrollerListener != null) {
- scrollerListener.invoke(context, new Object[] {event});
+ scrollerListener.invoke(context, new Object[]{event});
}
}
}
@@ -153,20 +158,23 @@
public abstract void setStyleClass(String styleClass);
public abstract void setStyle(String styleClass);
-
+
public abstract String getAlign();
public abstract void setAlign(String align);
-
+
public abstract String getBoundaryControls();
+
public abstract void setBoundaryControls(String boundaryControls);
public abstract String getFastControls();
+
public abstract void setFastControls(String fastControls);
public abstract String getStepControls();
+
public abstract void setStepControls(String stepControls);
-
+
/**
* Finds the dataTable which id is mapped to the "for" property
*
@@ -183,16 +191,19 @@
return (UIData) forComp;
}
}
- throw new FacesException("could not dataTable for datascroller " + this.getId());
+ throw new FacesException(
+ "could not dataTable for datascroller " + this.getId());
} else {
forComp = findComponent(forAttribute);
}
if (forComp == null) {
throw new IllegalArgumentException("could not dataTable with id '"
- + forAttribute + "'");
+ + forAttribute + "'");
} else if (!(forComp instanceof UIData)) {
- throw new IllegalArgumentException("component with id '" + forAttribute
- + "' must be of type " + UIData.class.getName() + ", not type "
+ throw new IllegalArgumentException(
+ "component with id '" + forAttribute
+ + "' must be of type " + UIData.class.getName()
+ + ", not type "
+ forComp.getClass().getName());
}
return (UIData) forComp;
@@ -203,7 +214,7 @@
int rows = getRows(uiData);
if (0 == rows) {
throw new FacesException("Missing 'rows' attribute on component '"
- + uiData.getId() + "'");
+ + uiData.getId() + "'");
}
int pageIndex;
@@ -219,7 +230,7 @@
}
return pageIndex;
}
-
+
/**
* Gets the index of the current page
*
@@ -234,7 +245,8 @@
* Sets the page number according to the parameter recived from the
* commandLink
*
- * @param facetName - can be "first:, "last", "next", "previous", "fastforward", "fastrewind"
+ * @param facetName - can be "first:, "last", "next", "previous",
+ * "fastforward", "fastrewind"
*/
public void setPage(String facetName) {
@@ -246,11 +258,15 @@
dataTable.setFirst(0);
} else if (PREVIOUS_FACET_NAME.equals(facetName)) {
int previous = dataTable.getFirst() - getRows(dataTable);
- if (previous >= 0) setFirstRow(previous);
+ if (previous >= 0) {
+ setFirstRow(previous);
+ }
} else if (NEXT_FACET_NAME.equals(facetName)) {
int rows = getRows(dataTable);
int next = dataTable.getFirst() + rows;
- if (next < getRowCount(dataTable)) setFirstRow(next);
+ if (next < getRowCount(dataTable)) {
+ setFirstRow(next);
+ }
//if (rows>0){
// if (((next+rows)/rows)>getMaxPages()){
// next=getMaxPages()*rows-rows;;
@@ -259,11 +275,14 @@
} else if (FAST_FORWARD_FACET_NAME.equals(facetName)) {
int fastStep = getFastStep();
int rows = getRows(dataTable);
- if (fastStep <= 0) fastStep = 1;
+ if (fastStep <= 0) {
+ fastStep = 1;
+ }
int next = dataTable.getFirst() + rows * fastStep;
int rowcount = getRowCount(dataTable);
- if (next >= rowcount)
+ if (next >= rowcount) {
next = (rowcount - 1) - ((rowcount - 1) % rows);
+ }
//if (rows>0){
// if (((next+rows)/rows)>getMaxPages()){
// next=getMaxPages()*rows-rows;;
@@ -272,16 +291,20 @@
setFirstRow(next);
} else if (FAST_REWIND_FACET_NAME.equals(facetName)) {
int fastStep = getFastStep();
- if (fastStep <= 0) fastStep = 1;
+ if (fastStep <= 0) {
+ fastStep = 1;
+ }
int previous = dataTable.getFirst() - getRows(dataTable) * fastStep;
- if (previous < 0) previous = 0;
+ if (previous < 0) {
+ previous = 0;
+ }
setFirstRow(previous);
} else if (LAST_FACET_NAME.equals(facetName)) {
int rowcount = getRowCount(dataTable);
int rows = getRows(dataTable);
int delta = rowcount % rows;
int first = delta > 0 && delta < rows ? rowcount - delta : rowcount
- - rows;
+ - rows;
if (first >= 0) {
//if (rows>0){
//if (((first+rows)/rows)>getMaxPages()){
@@ -311,7 +334,7 @@
int rows = getRows(data);
int pageCount;
if (rows > 0) {
- int rowCount = getRowCount(data);
+ int rowCount = getRowCount(data);
pageCount = rows <= 0 ? 1 : rowCount / rows;
if (rowCount % rows > 0) {
pageCount++;
@@ -325,26 +348,22 @@
}
return pageCount;
}
-
- /**
- * @return the page count of the uidata
- */
+
+ /** @return the page count of the uidata */
public int getPageCount() {
return getPageCount(getDataTable());
}
public int getRowCount(UIData data) {
int rowCount = data.getRowCount();
- if (rowCount >= 0) {
- return rowCount;
+ if (rowCount >= 0) {
+ return rowCount;
}
-
- return BinarySearch.search(data);
+
+ return BinarySearch.search(data);
}
-
- /**
- * @return int
- */
+
+ /** @return int */
public int getRowCount() {
//xxx nick -> alex - scrollable models can return -1 here
//let's implement "dychotomic" discovery
@@ -352,7 +371,7 @@
// setPage() { setRowIndex(pageIdx * rows); }
// isPageAvailable() { return isRowAvailable() }
//return getUIData().getRowCount();
- return getRowCount(getDataTable());
+ return getRowCount(getDataTable());
}
public int getRows(UIData data) {
@@ -364,7 +383,7 @@
return row;
}
-
+
// facet getter methods
public UIComponent getFirst() {
return getFacet(FIRST_FACET_NAME);
@@ -391,11 +410,11 @@
}
public int getFirstRow(UIData data) {
- return data.getFirst();
+ return data.getFirst();
}
-
- public void setFirstRow(int rows) {
- getDataTable().setFirst(rows);
+
+ public void setFirstRow(int rows) {
+ getDataTable().setFirst(rows);
//setControls();
}
@@ -404,10 +423,11 @@
}
static class BinarySearch {
+
public static int search(UIData data) {
- int rowIndex = data.getRowIndex();
+ int rowIndex = data.getRowIndex();
try {
- int n = 1;
+ int n = 1;
int k = 2;
for (; ;) {
data.setRowIndex(k - 1);
Added: trunk/ui/datascroller/src/main/java/org/richfaces/event/DataScrollerEvent.java
===================================================================
--- trunk/ui/datascroller/src/main/java/org/richfaces/event/DataScrollerEvent.java (rev 0)
+++ trunk/ui/datascroller/src/main/java/org/richfaces/event/DataScrollerEvent.java 2007-07-19 22:20:58 UTC (rev 1715)
@@ -0,0 +1,76 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - 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.event;
+
+import org.ajax4jsf.event.AjaxActionEvent;
+
+import javax.faces.component.UIComponent;
+import javax.faces.event.FacesListener;
+
+/** @author Wesley Hales */
+public class DataScrollerEvent extends AjaxActionEvent {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2657353903701932561L;
+ private String oldScrolVal;
+ private String newScrolVal;
+
+ /**
+ * Creates a new ScrollerEvent.
+ *
+ * @param component the source of the event
+ * @param thisOldScrolVal the previously showing item identifier
+ * @param thisNewScrolVal the currently showing item identifier
+ */
+ public DataScrollerEvent(UIComponent component, String thisOldScrolVal,
+ String thisNewScrolVal) {
+ super(component);
+ oldScrolVal = thisOldScrolVal;
+ newScrolVal = thisNewScrolVal;
+ }
+
+ public String getOldScrolVal() {
+ return oldScrolVal;
+ }
+
+ public String getNewScrolVal() {
+ return newScrolVal;
+ }
+
+ public boolean isAppropriateListener(FacesListener listener) {
+ return super.isAppropriateListener(listener)
+ || (listener instanceof DataScrollerListener);
+ }
+
+ /**
+ * Delivers this event to the SliderListener.
+ *
+ * @param listener the slider listener
+ */
+ public void processListener(FacesListener listener) {
+ if (super.isAppropriateListener(listener)) {
+ super.processListener(listener);
+ }
+ }
+}
Modified: trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DragIndicatorRendererBase.java
===================================================================
--- trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DragIndicatorRendererBase.java 2007-07-19 22:11:59 UTC (rev 1714)
+++ trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DragIndicatorRendererBase.java 2007-07-19 22:20:58 UTC (rev 1715)
@@ -30,9 +30,9 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.javascript.ScriptUtils;
import org.richfaces.component.UIDragIndicator;
import org.richfaces.component.nsutils.NSUtils;
+//import org.richfaces.org.apache.commons.lang.StringEscapeUtils;
/**
* Base renderer class for drag indicator ( marker ).
@@ -68,7 +68,7 @@
}
/* (non-Javadoc)
- * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
+ * @see org.ajax4jsf.framework.renderer.RendererBase#getComponentClass()
*/
protected Class getComponentClass() {
return UIDragIndicator.class;
@@ -102,8 +102,8 @@
protected String getPredefinedMarker(FacesContext context, Object facetName) {
if (MARKERS_PREDEFINED.contains(facetName)) {
- return ScriptUtils.toScript("<img alt=\"\" border=\"0\" width=\"16\" height=\"16\" src=\"" +
- getResource("/org/richfaces/renderkit/html/images/" + facetName + ".gif").getUri(context, null) +"\" />");
+ //return StringEscapeUtils.escapeJavaScript("<img alt=\"\" border=\"0\" width=\"16\" height=\"16\" src=\"" +
+ // getResource("/org/richfaces/renderkit/html/images/" + facetName + ".gif").getUri(context, null) +"\" />");
}
throw new IllegalArgumentException("No predefined marker with [" + facetName + "] name exists!");
Modified: trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java
===================================================================
--- trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java 2007-07-19 22:11:59 UTC (rev 1714)
+++ trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java 2007-07-19 22:20:58 UTC (rev 1715)
@@ -30,11 +30,11 @@
import javax.faces.event.FacesEvent;
import org.ajax4jsf.javascript.DnDScript;
-import org.ajax4jsf.javascript.PrototypeScript;
-import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.richfaces.component.Draggable;
import org.richfaces.component.Dropzone;
import org.richfaces.event.DragEvent;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.ajax4jsf.javascript.PrototypeScript;
import org.richfaces.renderkit.DnDEventsExchangeMailer.EventCallback;
/**
Modified: trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java
===================================================================
--- trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java 2007-07-19 22:11:59 UTC (rev 1714)
+++ trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java 2007-07-19 22:20:58 UTC (rev 1715)
@@ -29,15 +29,15 @@
import javax.faces.event.FacesEvent;
import org.ajax4jsf.javascript.DnDScript;
+import org.richfaces.component.Draggable;
+import org.richfaces.component.Dropzone;
+import org.richfaces.event.DropEvent;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.ajax4jsf.javascript.PrototypeScript;
import org.ajax4jsf.javascript.JSFunction;
import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.javascript.JSReference;
-import org.ajax4jsf.javascript.PrototypeScript;
import org.ajax4jsf.javascript.ScriptUtils;
-import org.ajax4jsf.renderkit.AjaxRendererUtils;
-import org.richfaces.component.Draggable;
-import org.richfaces.component.Dropzone;
-import org.richfaces.event.DropEvent;
import org.richfaces.json.JSONCollection;
import org.richfaces.json.JSONException;
import org.richfaces.json.JSONMap;
Modified: trunk/ui/drag-drop/src/test/java/org/richfaces/component/DragDropTest.java
===================================================================
--- trunk/ui/drag-drop/src/test/java/org/richfaces/component/DragDropTest.java 2007-07-19 22:11:59 UTC (rev 1714)
+++ trunk/ui/drag-drop/src/test/java/org/richfaces/component/DragDropTest.java 2007-07-19 22:20:58 UTC (rev 1715)
@@ -40,8 +40,8 @@
private static Set javaScripts = new HashSet();
static {
- javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
- javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
+ javaScripts.add("org.ajax4jsf.framework.resource.PrototypeScript");
+ javaScripts.add("org.ajax4jsf.framework.ajax.AjaxScript");
javaScripts.add("scripts/browser_info.js");
javaScripts.add("org.ajax4jsf.dnd.DnDScript");
javaScripts.add("scripts/events.js");
Modified: trunk/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java
===================================================================
--- trunk/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java 2007-07-19 22:11:59 UTC (rev 1714)
+++ trunk/ui/modal-panel/src/main/java/org/richfaces/renderkit/ModalPanelRendererBase.java 2007-07-19 22:20:58 UTC (rev 1715)
@@ -31,10 +31,10 @@
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
-import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.renderkit.AjaxComponentRendererBase;
import org.ajax4jsf.renderkit.ComponentVariables;
import org.ajax4jsf.renderkit.ComponentsVariableResolver;
+import org.ajax4jsf.javascript.ScriptUtils;
import org.richfaces.component.UIModalPanel;
/**
Modified: trunk/ui/panel/src/main/config/component/panel.xml
===================================================================
--- trunk/ui/panel/src/main/config/component/panel.xml 2007-07-19 22:11:59 UTC (rev 1714)
+++ trunk/ui/panel/src/main/config/component/panel.xml 2007-07-19 22:20:58 UTC (rev 1715)
@@ -47,6 +47,10 @@
<description>
A class that defines a style for a panel content
</description>
+ </property>
+ <property>
+ <name>header</name>
+ <classname>java.lang.String</classname>
</property>
<property>
<name>header</name>
Modified: trunk/ui/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java
===================================================================
--- trunk/ui/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java 2007-07-19 22:11:59 UTC (rev 1714)
+++ trunk/ui/suggestionbox/src/main/java/org/richfaces/renderkit/html/SuggestionBoxRenderer.java 2007-07-19 22:20:58 UTC (rev 1715)
@@ -22,8 +22,6 @@
package org.richfaces.renderkit.html;
import org.ajax4jsf.context.AjaxContext;
-import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.ajax4jsf.renderkit.AjaxComponentRendererBase;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.ajax4jsf.renderkit.RendererBase;
@@ -33,10 +31,12 @@
import org.ajax4jsf.renderkit.compiler.TemplateContext;
import org.ajax4jsf.resource.InternetResource;
import org.ajax4jsf.resource.TemplateCSSResource;
+import org.richfaces.skin.Skin;
+import org.richfaces.skin.SkinFactory;
+import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.JSFunctionDefinition;
import org.richfaces.component.AjaxSuggestionEvent;
import org.richfaces.component.UISuggestionBox;
-import org.richfaces.skin.Skin;
-import org.richfaces.skin.SkinFactory;
import javax.faces.FacesException;
import javax.faces.component.NamingContainer;
@@ -122,7 +122,7 @@
* @param context {@link javax.faces.context.FacesContext}
* @param component {@link javax.faces.component.UIComponent}
*
- * @see org.ajax4jsf.renderkit.RendererBase#doDecode(
+ * @see org.ajax4jsf.framework.renderer.RendererBase#doDecode(
* javax.faces.context.FacesContext,
* javax.faces.component.UIComponent)
*/
@@ -152,7 +152,7 @@
* @param component {@link javax.faces.component.UIComponent}
* @throws IOException
*
- * @see {@link org.ajax4jsf.renderkit.RendererBase#doEncodeBegin}
+ * @see {@link org.ajax4jsf.framework.renderer.RendererBase#doEncodeBegin}
*/
protected final void doEncodeBegin(final ResponseWriter writer,
final FacesContext context,
@@ -171,7 +171,7 @@
* @param component {@link javax.faces.component.UIComponent}
* @throws IOException
*
- * @see {@link org.ajax4jsf.renderkit.RendererBase#doEncodeEnd}
+ * @see {@link org.ajax4jsf.framework.renderer.RendererBase#doEncodeEnd}
*/
protected void doEncodeEnd(final ResponseWriter writer,
final FacesContext context,
@@ -340,7 +340,7 @@
*
* @param context {@link javax.faces.context.FacesContext}
* @param data
- * @return {@link org.ajax4jsf.renderkit.compiler.TemplateContext}
+ * @return {@link org.ajax4jsf.framework.renderer.compiler.TemplateContext}
*/
private TemplateContext getTemplateContext(final FacesContext context,
final UIData data) {
@@ -376,7 +376,7 @@
/**
* Constructor.
*
- * @param renderer {@link org.ajax4jsf.renderkit.RendererBase}
+ * @param renderer {@link org.ajax4jsf.framework.renderer.RendererBase}
* @param facesContext {@link javax.faces.context.FacesContext}
* @param component {@link javax.faces.component.UIComponent}
*/
@@ -693,7 +693,7 @@
* Gets additional scripts.
*
* @return array of resources
- * {@link org.ajax4jsf.resource.InternetResource}
+ * {@link org.ajax4jsf.framework.resource.InternetResource}
*/
protected final InternetResource[] getAdditionalScripts() {
return additionalScripts;
@@ -703,7 +703,7 @@
* Gets styles.
*
* @return array of styles
- * {@link org.ajax4jsf.resource.InternetResource}
+ * {@link org.ajax4jsf.framework.resource.InternetResource}
*/
protected final InternetResource[] getStyles() {
return styles;
Modified: trunk/ui/tree/src/main/java/org/richfaces/component/state/TreeState.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/component/state/TreeState.java 2007-07-19 22:11:59 UTC (rev 1714)
+++ trunk/ui/tree/src/main/java/org/richfaces/component/state/TreeState.java 2007-07-19 22:20:58 UTC (rev 1715)
@@ -32,10 +32,10 @@
import org.ajax4jsf.model.DataComponentState;
import org.ajax4jsf.model.DataVisitor;
import org.ajax4jsf.model.Range;
+import org.richfaces.model.TreeRange;
+import org.richfaces.model.TreeRowKey;
import org.richfaces.component.UITree;
import org.richfaces.component.state.events.TreeStateCommandsListener;
-import org.richfaces.model.TreeRange;
-import org.richfaces.model.TreeRowKey;
/**
* @author Nick Belaevski - nbelaevski(a)exadel.com created 23.11.2006
Modified: trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java
===================================================================
--- trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2007-07-19 22:11:59 UTC (rev 1714)
+++ trunk/ui/tree/src/main/java/org/richfaces/renderkit/TreeRendererBase.java 2007-07-19 22:20:58 UTC (rev 1715)
@@ -35,22 +35,21 @@
import javax.faces.context.ResponseWriter;
import javax.faces.el.MethodBinding;
-import org.ajax4jsf.javascript.JSFunction;
-import org.ajax4jsf.javascript.JSReference;
-import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.model.DataVisitor;
import org.ajax4jsf.renderkit.AjaxRendererUtils;
-import org.ajax4jsf.renderkit.ComponentVariables;
import org.ajax4jsf.renderkit.ComponentsVariableResolver;
import org.ajax4jsf.renderkit.RendererUtils;
+import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.JSReference;
+import org.ajax4jsf.javascript.ScriptUtils;
+import org.richfaces.model.LastElementAware;
+import org.richfaces.model.TreeRowKey;
import org.richfaces.component.UITree;
import org.richfaces.component.UITreeNode;
import org.richfaces.component.nsutils.NSUtils;
+import org.richfaces.model.TreeRange;
import org.richfaces.component.state.TreeState;
import org.richfaces.component.state.TreeStateAdvisor;
-import org.richfaces.model.LastElementAware;
-import org.richfaces.model.TreeRange;
-import org.richfaces.model.TreeRowKey;
public abstract class TreeRendererBase extends CompositeRenderer {
@@ -147,8 +146,6 @@
private final ResponseWriter writer;
- private final StringHolder holder;
-
private final Flag flag;
private final UITree tree;
@@ -158,10 +155,9 @@
private TreeStateAdvisor methodBindingAdvisor = null;
private DataVisitorWithLastElement(ResponseWriter writer,
- StringHolder holder, Flag flag, UITree tree,
+ Flag flag, UITree tree,
TreeDataModelEventNavigator navigator) {
this.writer = writer;
- this.holder = holder;
this.flag = flag;
this.tree = tree;
this.navigator = navigator;
@@ -174,10 +170,6 @@
processAdvisors(context, (TreeRowKey)rowKey);
- if (tree.isSelected()) {
- holder.setValue(tree.getNodeFacet().getClientId(context));
- }
-
if (!flag.isFlagSet()) {
closeLevelDownTable(context, tree, writer);
openLevelDownTable(context, tree, writer);
@@ -350,24 +342,34 @@
}
public String encodeSelectionStateInput(FacesContext context, UITree tree) throws IOException {
- ComponentVariables variables = ComponentsVariableResolver.getVariables(this, tree);
- Object object = variables.getVariable("selectionId");
- if (object != null) {
- ResponseWriter writer = context.getResponseWriter();
- writer.startElement("input", tree);
- writer.writeAttribute("type", "hidden", null);
- String selectionHolderInputId = tree.getSelectionStateInputName(context);
- writer.writeAttribute("id", selectionHolderInputId, null);
- writer.writeAttribute("name", selectionHolderInputId, null);
-
- writer.writeAttribute("value", object,
- null);
- writer.endElement("input");
-
- return selectionHolderInputId;
+ String result = "";
+ TreeState treeState = (TreeState) tree.getComponentState();
+ TreeRowKey selectedNodeKey = treeState.getSelectedNode();
+ if (selectedNodeKey != null) {
+ Object rowKey = tree.getRowKey();
+ try {
+ tree.setRowKey(selectedNodeKey);
+ result = tree.getNodeFacet().getClientId(context);
+ } finally {
+ try {
+ tree.setRowKey(rowKey);
+ } catch (Exception e) {
+ context.getExternalContext().log(e.getMessage(), e);
+ }
+ }
}
+
+ ResponseWriter writer = context.getResponseWriter();
+ writer.startElement("input", tree);
+ writer.writeAttribute("type", "hidden", null);
+ String selectionHolderInputId = tree.getSelectionStateInputName(context);
+ writer.writeAttribute("id", selectionHolderInputId, null);
+ writer.writeAttribute("name", selectionHolderInputId, null);
- return null;
+ writer.writeAttribute("value", result, null);
+ writer.endElement("input");
+
+ return selectionHolderInputId;
}
protected String getAjaxScript(FacesContext context, UITree tree) {
@@ -457,8 +459,6 @@
TreeRowKey rowKey = (TreeRowKey) key;
- final StringHolder selectionValueHolder = new StringHolder();
-
//Object savedRowKey = input.getRowKey();
try {
input.captureOrigValue();
@@ -500,7 +500,7 @@
};
input.walk(context, new DataVisitorWithLastElement(writer,
- selectionValueHolder, droppedDownToLevelFlag, input,
+ droppedDownToLevelFlag, input,
levelNavigator), treeRange, key, null);
if (key != null) {
@@ -508,14 +508,6 @@
}
levelNavigator.followRowKey(context, null);
-
- ComponentVariables variables = ComponentsVariableResolver.getVariables(this, input);
- String value = selectionValueHolder.getValue();
- if (value != null) {
- variables.setVariable("selectionId", value);
- } else if (rowKey == null) {
- variables.setVariable("selectionId", "");
- }
} finally {
input.setRowKey(context, null);
input.restoreOrigValue();
@@ -559,16 +551,4 @@
public boolean isFlagSet() {
return flag;
}
-}
-
-class StringHolder {
- private String value;
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
}
\ No newline at end of file
Modified: trunk/ui/tree/src/main/templates/htmlTree.jspx
===================================================================
--- trunk/ui/tree/src/main/templates/htmlTree.jspx 2007-07-19 22:11:59 UTC (rev 1714)
+++ trunk/ui/tree/src/main/templates/htmlTree.jspx 2007-07-19 22:20:58 UTC (rev 1715)
@@ -17,7 +17,7 @@
new org.ajax4jsf.javascript.PrototypeScript(),
new org.ajax4jsf.javascript.AjaxScript(),
/org/richfaces/renderkit/html/scripts/utils.js,
- /org/ajax4jsf/javascript/scripts/form.js,
+ /org/ajax4jsf/renderkit/html/scripts/form.js,
/org/richfaces/renderkit/html/scripts/form.js,
/org/richfaces/renderkit/html/scripts/events.js,
/org/richfaces/renderkit/html/scripts/tree.js,
@@ -44,11 +44,7 @@
<f:parameter value="id,style,class"/>
</f:call>
- <table width="100%" cellpadding="0">
- <tbody>
- <vcp:body />
- </tbody>
- </table>
+ <vcp:body />
<f:call name="encodeSelectionStateInput" />
<f:clientId var="clientId" />
Modified: trunk/ui/tree/src/test/java/org/richfaces/component/TreeComponentTest.java
===================================================================
--- trunk/ui/tree/src/test/java/org/richfaces/component/TreeComponentTest.java 2007-07-19 22:11:59 UTC (rev 1714)
+++ trunk/ui/tree/src/test/java/org/richfaces/component/TreeComponentTest.java 2007-07-19 22:20:58 UTC (rev 1715)
@@ -38,22 +38,22 @@
import javax.faces.event.PhaseId;
import javax.servlet.http.HttpServletResponse;
+import org.richfaces.event.DragEvent;
+import org.richfaces.event.DragListener;
+import org.richfaces.event.DropEvent;
+import org.richfaces.event.DropListener;
import org.ajax4jsf.resource.InternetResource;
import org.ajax4jsf.resource.InternetResourceBuilder;
import org.ajax4jsf.resource.ResourceBuilderImpl;
import org.ajax4jsf.resource.image.ImageInfo;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
import org.apache.commons.lang.StringUtils;
-import org.richfaces.component.state.events.ExpandAllCommandEvent;
-import org.richfaces.component.xml.XmlTreeDataBuilder;
-import org.richfaces.event.DragEvent;
-import org.richfaces.event.DragListener;
-import org.richfaces.event.DropEvent;
-import org.richfaces.event.DropListener;
import org.richfaces.event.NodeExpandedEvent;
import org.richfaces.event.NodeExpandedListener;
import org.richfaces.event.NodeSelectedEvent;
import org.richfaces.event.NodeSelectedListener;
+import org.richfaces.component.state.events.ExpandAllCommandEvent;
+import org.richfaces.component.xml.XmlTreeDataBuilder;
import org.xml.sax.InputSource;
import com.gargoylesoftware.htmlunit.Page;
@@ -73,7 +73,7 @@
static {
javaScripts.add("/org/richfaces/renderkit/html/scripts/json/json-mini.js");
- javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
+ javaScripts.add("org.ajax4jsf.framework.resource.PrototypeScript");
javaScripts.add("scripts/AJAX.js");
javaScripts.add("org.ajax4jsf.dnd.DnDScript");
@@ -83,7 +83,7 @@
javaScripts.add("/org/richfaces/renderkit/html/scripts/dnd/dnd-dropzone.js");
- javaScripts.add("/org/ajax4jsf/javascript/scripts/form.js");
+ javaScripts.add("/org/ajax4jsf/renderkit/html/scripts/form.js");
javaScripts.add("/org/richfaces/renderkit/html/scripts/form.js");
javaScripts.add("/org/richfaces/renderkit/html/scripts/events.js");
javaScripts.add("/org/richfaces/renderkit/html/scripts/tree.js");
@@ -330,7 +330,7 @@
/**
- * Test method for {@link org.richfaces.component.UITreeNode#addChangeExpandListener(org.richfaces.event.NodeExpandedListener)}.
+ * Test method for {@link org.richfaces.component.UITreeNode#addChangeExpandListener(org.richfaces.component.events.NodeExpandedListener)}.
*/
public final void testAddChangeExpandListener() {
NodeExpandedListener listener = new NodeExpandedListener() {
@@ -360,7 +360,7 @@
}
/**
- * Test method for {@link org.richfaces.component.UITreeNode#addNodeSelectListener(org.richfaces.event.NodeSelectedListener)}.
+ * Test method for {@link org.richfaces.component.UITreeNode#addNodeSelectListener(org.richfaces.component.events.NodeSelectedListener)}.
*/
public final void testAddNodeSelectListener() {
NodeSelectedListener listener = new NodeSelectedListener() {
@@ -410,7 +410,7 @@
}
/**
- * Test method for {@link org.richfaces.component.UITreeNode#addDropListener(org.richfaces.event.DropListener)}.
+ * Test method for {@link org.richfaces.component.UITreeNode#addDropListener(org.ajax4jsf.dnd.event.DropListener)}.
*/
public final void testAddDropListener() {
DropListener listener = new DropListener() {
@@ -439,7 +439,7 @@
}
/**
- * Test method for {@link org.richfaces.component.UITreeNode#addDragListener(org.richfaces.event.DragListener)}.
+ * Test method for {@link org.richfaces.component.UITreeNode#addDragListener(org.ajax4jsf.dnd.event.DragListener)}.
*/
public final void testAddDragListener() {
DragListener listener = new DragListener() {
17 years, 5 months
JBoss Rich Faces SVN: r1713 - in trunk/framework: impl/src/main and 7 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-07-19 18:10:40 -0400 (Thu, 19 Jul 2007)
New Revision: 1713
Added:
trunk/framework/impl/src/main/java/org/richfaces/renderkit/MacroDefinitionJSContentHandler.java
trunk/framework/test/src/test/java/org/richfaces/renderkit/TemplateUtilTest.java
Removed:
trunk/framework/impl/src/main/antlr/
trunk/framework/impl/src/main/java/org/richfaces/renderkit/MacroDefinitionJSContentHandler.jav
trunk/framework/test/src/test/java/org/richfaces/renderkit/TemplateUtilTest.jav
Modified:
trunk/framework/impl/pom.xml
trunk/framework/impl/src/main/java/org/richfaces/component/UIRangedNumberInput.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/TemplateEncoderRendererBase.java
trunk/framework/impl/src/main/resources/META-INF/skins/blueSky.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/classic.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/deepMarine.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/emeraldTown.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/japanCherry.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/plain.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/ruby.skin.properties
trunk/framework/impl/src/main/resources/META-INF/skins/wine.skin.properties
trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/json/json-dom.js
trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js
trunk/framework/test/src/test/java/org/richfaces/component/UIRangedNumberInputTest.java
Log:
merged changes commit
Modified: trunk/framework/impl/pom.xml
===================================================================
--- trunk/framework/impl/pom.xml 2007-07-19 20:20:46 UTC (rev 1712)
+++ trunk/framework/impl/pom.xml 2007-07-19 22:10:40 UTC (rev 1713)
@@ -1,306 +1,302 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <artifactId>framework</artifactId>
- <groupId>org.richfaces</groupId>
- <version>3.1.0-SNAPSHOT</version>
- </parent>
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.richfaces.framework</groupId>
- <artifactId>impl</artifactId>
- <name>Java Server Faces AJAX framework implementation</name>
- <build>
- <resources>
- <resource>
- <directory>src/main/resources</directory>
- </resource>
- <resource>
- <directory>target/javascript</directory>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <artifactId>maven-source-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-source</id>
- <goals>
- <goal>jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <!--
- <execution>
- <id>antlr</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <java classname="org.antlr.Tool"
- classpathref="maven.plugin.classpath"
- fork="true"
- dir="src/main/antlr">
- <arg value="RichMacroDefinition.g"/>
- <arg line="-o ${project.build.directory}/generated-sources/antlr/org/richfaces"/>
- </java>
- </tasks>
- <sourceRoot>${project.build.directory}/generated-sources/antlr</sourceRoot>
- </configuration>
- </execution>
- -->
- <execution>
- <id>javascript</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <ant
- antfile="${basedir}/generatescript.xml" inheritRefs="true">
- <target name="assembly" />
- <property name="target-dir"
- value="${project.build.directory}/javascript">
- </property>
- </ant>
- </tasks>
- <resourceRoot>
- ${project.build.directory}/javascript
- </resourceRoot>
- </configuration>
- </execution>
- </executions>
- <!--
- <dependencies>
- <dependency>
- <groupId>org.antlr</groupId>
- <artifactId>antlr</artifactId>
- <version>3.0</version>
- </dependency>
- </dependencies>
- -->
- </plugin>
- </plugins>
- </build>
- <profiles>
- <profile>
- <id>jsf1_1</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- <property>
- <name>jsfVersion</name>
- <value>1.1</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.4</source>
- <target>1.4</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.4</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>jsp-api</artifactId>
- <version>2.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <version>1.1_02</version>
- <exclusions>
- <exclusion>
- <artifactId>jsp-api</artifactId>
- <groupId>javax.servlet.jsp</groupId>
- </exclusion>
- <exclusion>
- <artifactId>jstl</artifactId>
- <groupId>javax.servlet.jsp.jstl</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <version>1.1_02</version>
- <scope>runtime</scope>
- <exclusions>
- <exclusion>
- <artifactId>jsp-api</artifactId>
- <groupId>javax.servlet.jsp</groupId>
- </exclusion>
- <exclusion>
- <artifactId>jstl</artifactId>
- <groupId>javax.servlet.jsp.jstl</groupId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>jstl</artifactId>
- <version>1.0</version>
- </dependency>
- </dependencies>
- </profile>
- <profile>
- <id>jsf1_2</id>
- <activation>
- <property>
- <name>jsfVersion</name>
- <value>1.2</value>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.0</version>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>
- build-helper-maven-plugin
- </artifactId>
- <executions>
- <execution>
- <id>add-source</id>
- <phase>process-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>src/main/jsf12</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet.jsp</groupId>
- <artifactId>jsp-api</artifactId>
- <version>2.1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-api</artifactId>
- <version>1.2_03</version>
- </dependency>
- <dependency>
- <groupId>javax.faces</groupId>
- <artifactId>jsf-impl</artifactId>
- <version>1.2_03</version>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
- </profile>
- </profiles>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>opensymphony</groupId>
- <artifactId>oscache</artifactId>
- <version>2.3</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>com.sun.facelets</groupId>
- <artifactId>jsf-facelets</artifactId>
- <version>1.1.11</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>javax.el</groupId>
- <artifactId>el-api</artifactId>
- <version>1.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>nekohtml</groupId>
- <artifactId>nekohtml</artifactId>
- <version>0.9.5</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.0.4</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- <optional>true</optional>
- </dependency>
- <dependency>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- <version>1.7.0</version>
- </dependency>
- <dependency>
- <groupId>commons-digester</groupId>
- <artifactId>commons-digester</artifactId>
- <version>1.8</version>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>3.2</version>
- </dependency>
- <dependency>
- <groupId>org.richfaces.framework</groupId>
- <artifactId>api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <!--
- <dependency>
- <groupId>org.antlr</groupId>
- <artifactId>antlr</artifactId>
- <version>3.0</version>
- </dependency>
- -->
- </dependencies>
- <properties>
- <jsfVersion>1.1</jsfVersion>
- </properties>
-</project>
-
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>framework</artifactId>
+ <groupId>org.richfaces</groupId>
+ <version>3.1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>impl</artifactId>
+ <name>Java Server Faces AJAX framework implementation</name>
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ <resource>
+ <directory>target/javascript</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-source</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>javacc-maven-plugin</artifactId>
+ <version>2.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>javacc</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <packageName>org.richfaces.javacc</packageName>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>javascript</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <ant
+ antfile="${basedir}/generatescript.xml" inheritRefs="true">
+ <target name="assembly" />
+ <property name="target-dir"
+ value="${project.build.directory}/javascript">
+ </property>
+ </ant>
+ </tasks>
+ <resourceRoot>
+ ${project.build.directory}/javascript
+ </resourceRoot>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>clover</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clover-plugin</artifactId>
+ <configuration>
+ <excludes combine.children="append">
+ <exclude>
+ **/javacc/**
+ </exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>jsf1_1</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ <property>
+ <name>jsfVersion</name>
+ <value>1.1</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.4</source>
+ <target>1.4</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.4</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>1.1_02</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>jsp-api</artifactId>
+ <groupId>javax.servlet.jsp</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jstl</artifactId>
+ <groupId>javax.servlet.jsp.jstl</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>1.1_02</version>
+ <scope>runtime</scope>
+ <exclusions>
+ <exclusion>
+ <artifactId>jsp-api</artifactId>
+ <groupId>javax.servlet.jsp</groupId>
+ </exclusion>
+ <exclusion>
+ <artifactId>jstl</artifactId>
+ <groupId>javax.servlet.jsp.jstl</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+ </profile>
+ <profile>
+ <id>jsf1_2</id>
+ <activation>
+ <property>
+ <name>jsfVersion</name>
+ <value>1.2</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>
+ build-helper-maven-plugin
+ </artifactId>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>process-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>src/main/jsf12</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>1.2_03</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <version>1.2_03</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>opensymphony</groupId>
+ <artifactId>oscache</artifactId>
+ <version>2.3</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.facelets</groupId>
+ <artifactId>jsf-facelets</artifactId>
+ <version>1.1.11</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>nekohtml</groupId>
+ <artifactId>nekohtml</artifactId>
+ <version>0.9.5</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>1.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ <version>1.7.0</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ <version>1.8</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ <properties>
+ <jsfVersion>1.1</jsfVersion>
+ </properties>
+</project>
+
Modified: trunk/framework/impl/src/main/java/org/richfaces/component/UIRangedNumberInput.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/component/UIRangedNumberInput.java 2007-07-19 20:20:46 UTC (rev 1712)
+++ trunk/framework/impl/src/main/java/org/richfaces/component/UIRangedNumberInput.java 2007-07-19 22:10:40 UTC (rev 1713)
@@ -40,6 +40,15 @@
public abstract String getMinValue();
public abstract void setMinValue(String value);
+ public abstract boolean isDisabled();
+ public abstract void setDisabled(boolean disabled);
+
+ public void decode(FacesContext arg0) {
+ if (this.isDisabled())
+ return;
+ super.decode(arg0);
+ }
+
protected void validateValue(FacesContext context, Object newValue) {
if (isValid() && !isEmpty(newValue)) {
String label = MessageUtil.getLabel(context, this).toString();
Deleted: trunk/framework/impl/src/main/java/org/richfaces/renderkit/MacroDefinitionJSContentHandler.jav
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/MacroDefinitionJSContentHandler.jav 2007-07-19 20:20:46 UTC (rev 1712)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/MacroDefinitionJSContentHandler.jav 2007-07-19 22:10:40 UTC (rev 1713)
@@ -1,168 +0,0 @@
-/**
- *
- */
-package org.richfaces.renderkit;
-
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Iterator;
-import java.util.List;
-
-import org.richfaces.json.JSContentHandler;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-
-/**
- * @author Nick Belaevski - mailto:nbelaevski@exadel.com created 21.06.2007
- *
- */
-public class MacroDefinitionJSContentHandler extends JSContentHandler {
- private String prolog;
- private String epilog;
-
- public MacroDefinitionJSContentHandler(Writer writer, String prolog,
- String epilog) {
- super(writer);
- this.prolog = prolog;
- this.epilog = epilog;
- }
-
- private List parseExpressiion(String expressionString) throws SAXException {
- ANTLRStringStream stream = new ANTLRStringStream(expressionString);
- RichMacroDefinitionLexer lexer = new RichMacroDefinitionLexer(stream);
- RichMacroDefinitionParser macroParser = new RichMacroDefinitionParser(
- new CommonTokenStream(lexer));
- try {
- expression_return expression = macroParser.expression();
- List result = expression.result;
-
- return result;
- } catch (RecognitionException e) {
- throw new SAXException(e.getMessage(), e);
- }
- }
-
- private void encodeExpressionString(String string) throws IOException,
- SAXException {
- List parsedExpressiion = parseExpressiion(string);
-
- boolean isExpression = false;
- for (Iterator iterator = parsedExpressiion.iterator(); iterator
- .hasNext();) {
- Object next = (Object) iterator.next();
- if (next instanceof Expression) {
- isExpression = true;
- break;
- }
- }
-
- if (isExpression) {
- this.outputWriter.write("function (context) { return ");
- }
-
- boolean first = true;
- for (Iterator iterator = parsedExpressiion.iterator(); iterator
- .hasNext();) {
- Object next = (Object) iterator.next();
-
- if (next == null) {
- continue;
- }
-
- if (!first) {
- this.outputWriter.write('+');
- }
-
- if (next instanceof Expression) {
- Expression macroExpression = (Expression) next;
-
- this.outputWriter.write(prolog);
- this.encode(macroExpression.getExpression().toString());
- this.outputWriter.write(epilog);
- } else {
- this.outputWriter.write('\'');
- this.encode(next.toString());
- this.outputWriter.write('\'');
- }
-
- first = false;
- }
-
- if (isExpression) {
- this.outputWriter.write(";}");
- }
- }
-
- protected void encodeAttributeValue(Attributes attributes, int idx)
- throws SAXException, IOException {
-
- String value = attributes.getValue(idx);
- encodeExpressionString(value);
- }
-
- public void characters(char[] ch, int start, int length)
- throws SAXException {
- if (isProcessingCdata()) {
- super.characters(ch, start, length);
- } else {
- List parsedExpression = parseExpressiion(new String(ch, start, length));
- for (Iterator iterator = parsedExpression.iterator(); iterator
- .hasNext();) {
-
- Object next = iterator.next();
-
- if (next instanceof Expression) {
- Expression expression = (Expression) next;
-
- if (this.isBeforeDocumentStart() || level < 0)
- return;
- try {
- if (level != 0 && !this.closeElement(false) && this.isProcessingCdata() == false) {
- this.outputWriter.write(',');
- }
-
- if (this.isProcessingCdata() == false) {
- this.outputWriter.write("new ET(");
- }
-
- this.outputWriter.write("function (context) { return ");
- this.outputWriter.write(prolog);
- this.encode(expression.getExpression().toString());
- this.outputWriter.write(epilog);
- this.outputWriter.write("}");
-
- if (this.isProcessingCdata() == false) {
- this.outputWriter.write(")");
- }
- } catch (IOException e) {
- throw new SAXException("Write error",e);
- }
-
- } else {
- char[] cs = next.toString().toCharArray();
- super.characters(cs, 0, cs.length);
- }
-
- if (iterator.hasNext()) {
- try {
- this.outputWriter.write(',');
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
- }
- }
-
- protected void encodeText(char[] chars, int start, int length)
- throws SAXException, IOException {
- if (!isProcessingCdata()) {
- String str = new String(chars, start, length);
- encodeExpressionString(str);
- } else {
- super.encodeText(chars, start, length);
- }
- }
-
-}
Added: trunk/framework/impl/src/main/java/org/richfaces/renderkit/MacroDefinitionJSContentHandler.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/MacroDefinitionJSContentHandler.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/MacroDefinitionJSContentHandler.java 2007-07-19 22:10:40 UTC (rev 1713)
@@ -0,0 +1,165 @@
+/**
+ *
+ */
+package org.richfaces.renderkit;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.Writer;
+import java.util.Iterator;
+import java.util.List;
+
+import org.richfaces.javacc.RichMacroDefinition;
+import org.richfaces.json.JSContentHandler;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * @author Nick Belaevski - mailto:nbelaevski@exadel.com created 21.06.2007
+ *
+ */
+public class MacroDefinitionJSContentHandler extends JSContentHandler {
+ private String prolog;
+ private String epilog;
+
+ public MacroDefinitionJSContentHandler(Writer writer, String prolog,
+ String epilog) {
+ super(writer);
+ this.prolog = prolog;
+ this.epilog = epilog;
+ }
+
+ private List parseExpressiion(String expressionString) throws SAXException {
+ try {
+ List result = new RichMacroDefinition(new StringReader(expressionString)).expression();
+
+ return result;
+ } catch (Exception e) {
+ throw new SAXException(e.getMessage(), e);
+ }
+ }
+
+ private void encodeExpressionString(String string) throws IOException,
+ SAXException {
+ List parsedExpressiion = parseExpressiion(string);
+
+ boolean isExpression = false;
+ for (Iterator iterator = parsedExpressiion.iterator(); iterator
+ .hasNext();) {
+ Object next = (Object) iterator.next();
+ if (next instanceof Expression) {
+ isExpression = true;
+ break;
+ }
+ }
+
+ if (isExpression) {
+ this.outputWriter.write("function (context) { return ");
+ }
+
+ boolean first = true;
+ for (Iterator iterator = parsedExpressiion.iterator(); iterator
+ .hasNext();) {
+ Object next = (Object) iterator.next();
+
+ if (next == null) {
+ continue;
+ }
+
+ if (!first) {
+ this.outputWriter.write('+');
+ }
+
+ if (next instanceof Expression) {
+ Expression macroExpression = (Expression) next;
+
+ this.outputWriter.write(prolog);
+ this.encode(macroExpression.getExpression().toString());
+ this.outputWriter.write(epilog);
+ } else {
+ this.outputWriter.write('\'');
+ this.encode(next.toString());
+ this.outputWriter.write('\'');
+ }
+
+ first = false;
+ }
+
+ if (isExpression) {
+ this.outputWriter.write(";}");
+ }
+ }
+
+ protected void encodeAttributeValue(Attributes attributes, int idx)
+ throws SAXException, IOException {
+
+ String value = attributes.getValue(idx);
+ encodeExpressionString(value);
+ }
+
+ public void characters(char[] ch, int start, int length)
+ throws SAXException {
+ if (isProcessingCdata()) {
+ super.characters(ch, start, length);
+ } else {
+ List parsedExpression = parseExpressiion(new String(ch, start, length));
+ for (Iterator iterator = parsedExpression.iterator(); iterator
+ .hasNext();) {
+
+ Object next = iterator.next();
+
+ if (next instanceof Expression) {
+ Expression expression = (Expression) next;
+
+ if (this.isBeforeDocumentStart() || level < 0)
+ return;
+ try {
+ if (level != 0 && !this.closeElement(false) && this.isProcessingCdata() == false) {
+ this.outputWriter.write(',');
+ }
+
+ if (this.isProcessingCdata() == false) {
+ this.outputWriter.write("new ET(");
+ }
+
+ this.outputWriter.write("function (context) { return ");
+ this.outputWriter.write(prolog);
+ this.encode(expression.getExpression().toString());
+ this.outputWriter.write(epilog);
+ this.outputWriter.write("}");
+
+ if (this.isProcessingCdata() == false) {
+ this.outputWriter.write(")");
+ }
+ } catch (IOException e) {
+ throw new SAXException("Write error",e);
+ }
+
+ } else {
+ char[] cs = next.toString().toCharArray();
+ super.characters(cs, 0, cs.length);
+ }
+
+ if (iterator.hasNext()) {
+ try {
+ this.outputWriter.write(',');
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+
+ protected void encodeText(char[] chars, int start, int length)
+ throws SAXException, IOException {
+ if (!isProcessingCdata()) {
+ String str = new String(chars, start, length);
+ encodeExpressionString(str);
+ } else {
+ super.encodeText(chars, start, length);
+ }
+ }
+
+}
Modified: trunk/framework/impl/src/main/java/org/richfaces/renderkit/TemplateEncoderRendererBase.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/TemplateEncoderRendererBase.java 2007-07-19 20:20:46 UTC (rev 1712)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/TemplateEncoderRendererBase.java 2007-07-19 22:10:40 UTC (rev 1713)
@@ -20,9 +20,9 @@
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXResult;
-import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
import org.ajax4jsf.webapp.tidy.TidyParser;
import org.ajax4jsf.webapp.tidy.TidyXMLFilter;
+import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
import org.richfaces.json.JSContentHandler;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
@@ -67,30 +67,30 @@
writer.write("[");
-// try {
-// Transformer transformer;
-//
-// synchronized (transformerFactory) {
-// transformer = transformerFactory.newTransformer();
-// }
-//
-// transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
-// transformer.setOutputProperty(OutputKeys.METHOD, "xml");
-//
-// JSContentHandler contentHandler = new MacroDefinitionJSContentHandler(writer, "Richfaces.eval(\"", "\", context)");
-// Result result = new SAXResult(contentHandler);
-//
-// for (int i = 0; i < bodyChildrenLength; i++) {
-// if (i != 0) {
-// writer.write(", ");
-// }
-// transformer.transform(new DOMSource(bodyChildren.item(i)), result);
-// }
-// } catch (TransformerException e) {
-// throw new IOException(e.getMessage());
-// }
+ try {
+ Transformer transformer;
- writer.write("];\n");
+ synchronized (transformerFactory) {
+ transformer = transformerFactory.newTransformer();
+ }
+
+ transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
+ transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+
+ JSContentHandler contentHandler = new MacroDefinitionJSContentHandler(writer, "Richfaces.evalMacro(\"", "\", context)");
+ Result result = new SAXResult(contentHandler);
+
+ for (int i = 0; i < bodyChildrenLength; i++) {
+ if (i != 0) {
+ writer.write(", ");
+ }
+ transformer.transform(new DOMSource(bodyChildren.item(i)), result);
+ }
+ } catch (TransformerException e) {
+ throw new IOException(e.getMessage());
+ }
+
+ writer.write("]");
}
protected void writeScriptBody(FacesContext context, UIComponent component, boolean children)
@@ -119,7 +119,7 @@
writer.startElement("script", component);
writer.write("var evaluator = ");
writeScriptBody(context, component, true);
- writer.write("new Insertion.Top($('" + component.getClientId(context) + "'), evaluator.invoke('getContent', window).join(''));");
+ writer.write(";\n new Insertion.Top($('" + component.getClientId(context) + "'), evaluator.invoke('getContent', window).join(''));");
writer.endElement("script");
}
}
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/blueSky.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/blueSky.skin.properties 2007-07-19 20:20:46 UTC (rev 1712)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/blueSky.skin.properties 2007-07-19 22:10:40 UTC (rev 1713)
@@ -24,8 +24,8 @@
trimColor=#D6E6FB
-tipBackgroundColor=\#FAE6B0
-tipBorderColor=\#E5973E
+tipBackgroundColor=#FAE6B0
+tipBorderColor=#E5973E
selectControlColor=#E79A00
@@ -48,3 +48,4 @@
tableFooterBackgroundColor=#cccccc
tableSubfooterBackgroundColor=#f1f1f1
tableBorderColor=#C0C0C0
+tableBorderWidth=1px
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/classic.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/classic.skin.properties 2007-07-19 20:20:46 UTC (rev 1712)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/classic.skin.properties 2007-07-19 22:10:40 UTC (rev 1713)
@@ -24,8 +24,8 @@
trimColor=#C6D6EA
-tipBackgroundColor=\#FAE6B0
-tipBorderColor=\#E5973E
+tipBackgroundColor=#FAE6B0
+tipBorderColor=#E5973E
selectControlColor=#E79A00
@@ -48,5 +48,4 @@
tableFooterBackgroundColor=#cccccc
tableSubfooterBackgroundColor=#f1f1f1
tableBorderColor=#C0C0C0
-
-
+tableBorderWidth=1px
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/deepMarine.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/deepMarine.skin.properties 2007-07-19 20:20:46 UTC (rev 1712)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/deepMarine.skin.properties 2007-07-19 22:10:40 UTC (rev 1713)
@@ -24,8 +24,8 @@
trimColor=#C9EDF0
-tipBackgroundColor=\#FAE6B0
-tipBorderColor=\#E5973E
+tipBackgroundColor=#FAE6B0
+tipBorderColor=#E5973E
selectControlColor=#E79A00
@@ -48,7 +48,4 @@
tableFooterBackgroundColor=#cccccc
tableSubfooterBackgroundColor=#f1f1f1
tableBorderColor=#C0C0C0
-
-
-
-
+tableBorderWidth=1px
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/emeraldTown.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/emeraldTown.skin.properties 2007-07-19 20:20:46 UTC (rev 1712)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/emeraldTown.skin.properties 2007-07-19 22:10:40 UTC (rev 1713)
@@ -24,8 +24,8 @@
trimColor=#BBECBB
-tipBackgroundColor=\#FAE6B0
-tipBorderColor=\#E5973E
+tipBackgroundColor=#FAE6B0
+tipBorderColor=#E5973E
selectControlColor=#FF9409
@@ -48,7 +48,4 @@
tableFooterBackgroundColor=#cccccc
tableSubfooterBackgroundColor=#f1f1f1
tableBorderColor=#C0C0C0
-
-
-
-
+tableBorderWidth=1px
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/japanCherry.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/japanCherry.skin.properties 2007-07-19 20:20:46 UTC (rev 1712)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/japanCherry.skin.properties 2007-07-19 22:10:40 UTC (rev 1713)
@@ -24,8 +24,8 @@
trimColor=#F7D5D5
-tipBackgroundColor=\#FAE6B0
-tipBorderColor=\#E5973E
+tipBackgroundColor=#FAE6B0
+tipBorderColor=#E5973E
selectControlColor=#E79A00
@@ -48,6 +48,4 @@
tableFooterBackgroundColor=#cccccc
tableSubfooterBackgroundColor=#f1f1f1
tableBorderColor=#DFA5A5
-
-
-
+tableBorderWidth=1px
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/plain.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/plain.skin.properties 2007-07-19 20:20:46 UTC (rev 1712)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/plain.skin.properties 2007-07-19 22:10:40 UTC (rev 1713)
@@ -47,4 +47,5 @@
tableBackgroundColor=#{null}
tableFooterBackgroundColor=#{null}
tableSubfooterBackgroundColor=#{null}
-tableBorderColor=#{null}
\ No newline at end of file
+tableBorderColor=#{null}
+tableBorderWidth=0px
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/ruby.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/ruby.skin.properties 2007-07-19 20:20:46 UTC (rev 1712)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/ruby.skin.properties 2007-07-19 22:10:40 UTC (rev 1713)
@@ -24,8 +24,8 @@
trimColor=#F7C4C4
-tipBackgroundColor=\#FAE6B0
-tipBorderColor=\#E5973E
+tipBackgroundColor=#FAE6B0
+tipBorderColor=#E5973E
selectControlColor=#FF9409
@@ -48,7 +48,4 @@
tableFooterBackgroundColor=#cccccc
tableSubfooterBackgroundColor=#f1f1f1
tableBorderColor=#C0C0C0
-
-
-
-
+tableBorderWidth=1px
Modified: trunk/framework/impl/src/main/resources/META-INF/skins/wine.skin.properties
===================================================================
--- trunk/framework/impl/src/main/resources/META-INF/skins/wine.skin.properties 2007-07-19 20:20:46 UTC (rev 1712)
+++ trunk/framework/impl/src/main/resources/META-INF/skins/wine.skin.properties 2007-07-19 22:10:40 UTC (rev 1713)
@@ -24,8 +24,8 @@
trimColor=#E1D2AF
-tipBackgroundColor=\#FAE6B0
-tipBorderColor=\#E5973E
+tipBackgroundColor=#FAE6B0
+tipBorderColor=#E5973E
selectControlColor=#E79A00
@@ -49,6 +49,4 @@
tableFooterBackgroundColor=#cccccc
tableSubfooterBackgroundColor=#f1f1f1
tableBorderColor=#B6AD84
-
-
-
+tableBorderWidth=1px
Modified: trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/json/json-dom.js
===================================================================
--- trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/json/json-dom.js 2007-07-19 20:20:46 UTC (rev 1712)
+++ trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/json/json-dom.js 2007-07-19 22:10:40 UTC (rev 1713)
@@ -37,9 +37,11 @@
// Escape XML symbols - < > & ' ...
xmlEscape : function(value) {
var text = value ? value.toString() : "";
- for(var i in this._symbols )
+ /*for(var i in this._symbols ) {
text = text.replace(i,this._symbols[i]);
- return text;
+
+ */
+ return text.escapeHTML();
}
};
@@ -77,17 +79,20 @@
this.value = text;
};
+
//ET.prototype = new JSNode();
ET.prototype.getContent = function(context) {
var value = this.value;
- if (typeof value == "function")
- value = value(context);
-
+ if (typeof value=="function") value=value(context);
+ if (value && value.getContent) {
+ value = value.getContent(context);
+ }
+
if (value) return value;
return "";
};
-
+
// Text node
T = function(text) {
this.value = text;
@@ -96,8 +101,7 @@
T.prototype = new JSNode();
T.prototype.getContent = function(context) {
var value = this.value;
- if (typeof value == "function")
- value = value(context);
+ if (typeof value=="function") value=value(context);
if (value) return this.xmlEscape(value);
@@ -124,3 +128,4 @@
return "<![CDATA["+this.value+"]]>";
};
+
Modified: trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js
===================================================================
--- trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js 2007-07-19 20:20:46 UTC (rev 1712)
+++ trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js 2007-07-19 22:10:40 UTC (rev 1713)
@@ -100,16 +100,59 @@
return null;
};
-Richfaces.eval = function(template, object) {
- var value = '';
-
- try {
- with (object) {
- value = eval(template) ;
- }
- } catch (e) {
- LOG.warn('Exception: ' + e.message + '\n[' + template + ']');
+Richfaces.VARIABLE_NAME_PATTERN = /^\s*[_,A-Z,a-z][\w,_\.]*\s*$/;
+
+Richfaces.getObjectValue = function (str, object) {
+ var a=str.split(".");
+ var value=object[a[0]];
+ var c=1;
+ while (value && c<a.length) value = value[a[c++]];
+ return (value ? value : "");
+}
+
+Richfaces.evalMacro = function(template, object)
+{
+ var value="";
+ // variable evaluation
+ if (Richfaces.VARIABLE_NAME_PATTERN.test(template))
+ {
+ if (template.indexOf('.')==-1) {
+ value = object[template];
+ if (!value) value=window[template];
+ }
+ // object's variable evaluation
+ else {
+ value = Richfaces.getObjectValue(template, object);
+ if (!value) value=Richfaces.getObjectValue(template, window);
+ }
+ if (value && typeof value=='function') value = value(object);
+ if (!value) value="";
}
+ //js string evaluation
+ else {
+ try {
+ value=object.eval(template);
+ if (typeof value == 'function') {
+ value = value(object);
+ }
+ } catch (e) { LOG.warn("Exception: "+e.Message + "\n[" + template + "]"); }
+ }
+ return value;
+}
+Richfaces.evalSimpleMacro = function(template, object)
+{
+ var value = object[template];
+ if (!value) {value=window[template]; if (!value) value="";}
+ return value;
+}
- return value;
-};
+Richfaces.invokeOnComponent = function(componentType, element, functionName)
+{
+ var attribute="richfacesComponent";
+ while (element.parentNode) {
+ if (element[attribute] && element[attribute]==componentType)
+ return element.component[functionName]();
+ else
+ element = element.parentNode;
+ }
+}
Modified: trunk/framework/test/src/test/java/org/richfaces/component/UIRangedNumberInputTest.java
===================================================================
--- trunk/framework/test/src/test/java/org/richfaces/component/UIRangedNumberInputTest.java 2007-07-19 20:20:46 UTC (rev 1712)
+++ trunk/framework/test/src/test/java/org/richfaces/component/UIRangedNumberInputTest.java 2007-07-19 22:10:40 UTC (rev 1713)
@@ -37,6 +37,7 @@
input = new UIRangedNumberInput() {
private String minValue;
private String maxValue;
+ private boolean disabled;
public String getMinValue() {
return minValue;
@@ -50,6 +51,12 @@
public void setMaxValue(String maxValue) {
this.maxValue = maxValue;
}
+ public boolean isDisabled() {
+ return disabled;
+ }
+ public void setDisabled(boolean disabled) {
+ this.disabled = disabled;
+ }
};
input.setMaxValue("100");
Deleted: trunk/framework/test/src/test/java/org/richfaces/renderkit/TemplateUtilTest.jav
===================================================================
--- trunk/framework/test/src/test/java/org/richfaces/renderkit/TemplateUtilTest.jav 2007-07-19 20:20:46 UTC (rev 1712)
+++ trunk/framework/test/src/test/java/org/richfaces/renderkit/TemplateUtilTest.jav 2007-07-19 22:10:40 UTC (rev 1713)
@@ -1,70 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces 3.0 - 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.renderkit;
-
-import java.io.IOException;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.antlr.runtime.ANTLRStringStream;
-import org.antlr.runtime.CommonTokenStream;
-import org.antlr.runtime.tree.Tree;
-import org.richfaces.RichMacroDefinitionLexer;
-import org.richfaces.RichMacroDefinitionParser;
-import org.richfaces.RichMacroDefinitionParser.expression_return;
-
-/**
- * @author Nick Belaevski - mailto:nbelaevski@exadel.com
- * created 17.06.2007
- *
- */
-public class TemplateUtilTest extends TestCase {
-
- private String doWrite(String in) throws IOException {
- return in;
- }
-
- private void printTree(Tree tree, int indent) {
- int childCount = tree.getChildCount();
- for (int i = 0; i < indent; i++) {
- System.out.print('\t');
- System.out.print(tree.getText() + " : " + tree.getType());
- System.out.println();
- }
- for (int j = 1; j < childCount; j++) {
- printTree(tree.getChild(j), ++indent);
- }
- }
-
-
- public void testAntlr() throws Exception {
- ANTLRStringStream stream = new ANTLRStringStream("{aa{b\\}}a}\\\\ a\\}b\\{c");
- RichMacroDefinitionLexer lexer = new RichMacroDefinitionLexer(stream);
- RichMacroDefinitionParser macroParser = new RichMacroDefinitionParser(new CommonTokenStream(lexer));
- expression_return expression = macroParser.expression();
- List result = expression.result;
- Expression holder = (Expression) result.get(0);
- assertEquals("aa{b}}a", holder.getExpression());
- assertEquals("\\ a}b{c", result.get(1));
- }
-}
Added: trunk/framework/test/src/test/java/org/richfaces/renderkit/TemplateUtilTest.java
===================================================================
--- trunk/framework/test/src/test/java/org/richfaces/renderkit/TemplateUtilTest.java (rev 0)
+++ trunk/framework/test/src/test/java/org/richfaces/renderkit/TemplateUtilTest.java 2007-07-19 22:10:40 UTC (rev 1713)
@@ -0,0 +1,45 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - 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.renderkit;
+
+import java.io.StringReader;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.richfaces.javacc.RichMacroDefinition;
+
+/**
+ * @author Nick Belaevski - mailto:nbelaevski@exadel.com
+ * created 17.06.2007
+ *
+ */
+public class TemplateUtilTest extends TestCase {
+
+
+ public void testAntlr() throws Exception {
+ List result = new RichMacroDefinition(new StringReader("{aa{b\\}}a}\\\\ a\\}b\\{c")).expression();
+ Expression holder = (Expression) result.get(0);
+ assertEquals("aa{b}}a", holder.getExpression());
+ assertEquals("\\ a}b{c", result.get(1));
+ }
+}
17 years, 5 months
JBoss Rich Faces SVN: r1712 - in trunk/sandbox/ui: calendar/design/funcspec and 7 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-07-19 16:20:46 -0400 (Thu, 19 Jul 2007)
New Revision: 1712
Removed:
trunk/sandbox/ui/target/
Modified:
trunk/sandbox/ui/calendar/design/funcspec/FuncSpec - RF Calendar Component.doc
trunk/sandbox/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarDataModelItemAdaptor.java
trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
trunk/sandbox/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
trunk/sandbox/ui/tooltip/src/main/config/component/toolTip.xml
trunk/sandbox/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java
trunk/sandbox/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java
trunk/sandbox/ui/tooltip/src/main/templates/org/richfaces/htmltooltip.jspx
Log:
sandbox made compileable
Modified: trunk/sandbox/ui/calendar/design/funcspec/FuncSpec - RF Calendar Component.doc
===================================================================
(Binary files differ)
Modified: trunk/sandbox/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
===================================================================
--- trunk/sandbox/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2007-07-19 19:38:37 UTC (rev 1711)
+++ trunk/sandbox/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2007-07-19 20:20:46 UTC (rev 1712)
@@ -30,7 +30,6 @@
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
-import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
@@ -38,21 +37,20 @@
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.component.UIViewRoot;
-import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.convert.ConverterException;
import javax.faces.convert.DateTimeConverter;
-import javax.faces.el.MethodBinding;
import javax.faces.el.ValueBinding;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.FacesEvent;
import javax.faces.event.ValueChangeEvent;
import javax.faces.render.Renderer;
-import org.ajax4jsf.framework.ajax.AjaxChildrenEncoder;
-import org.ajax4jsf.framework.ajax.AjaxContext;
-import org.ajax4jsf.framework.ajax.AjaxEvent;
-import org.ajax4jsf.framework.util.message.Messages;
+import org.ajax4jsf.component.AjaxChildrenEncoder;
+import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.event.AjaxEvent;
+import org.richfaces.model.CalendarDataModel;
+import org.richfaces.model.CalendarDataModelItem;
import org.richfaces.renderkit.CalendarDataModelItemAdaptor;
import org.richfaces.renderkit.CalendarRendererBase;
import org.richfaces.renderkit.CurrentDateChangeEvent;
Modified: trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarDataModelItemAdaptor.java
===================================================================
--- trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarDataModelItemAdaptor.java 2007-07-19 19:38:37 UTC (rev 1711)
+++ trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarDataModelItemAdaptor.java 2007-07-19 20:20:46 UTC (rev 1712)
@@ -21,7 +21,7 @@
package org.richfaces.renderkit;
-import org.richfaces.component.CalendarDataModelItem;
+import org.richfaces.model.CalendarDataModelItem;
/**
* @author Nick Belaevski - mailto:nbelaevski@exadel.com
Modified: trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
--- trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2007-07-19 19:38:37 UTC (rev 1711)
+++ trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2007-07-19 20:20:46 UTC (rev 1712)
@@ -27,18 +27,19 @@
import java.util.Map;
import javax.faces.component.UIComponent;
-import javax.faces.context.ExternalContext;
+import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import javax.faces.event.FacesEvent;
+import javax.faces.convert.Converter;
import javax.faces.event.PhaseId;
-import org.ajax4jsf.framework.ajax.AjaxEvent;
-import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
-import org.ajax4jsf.framework.util.javascript.JSFunction;
-import org.ajax4jsf.framework.util.javascript.JSFunctionDefinition;
-import org.ajax4jsf.framework.util.javascript.JSReference;
-import org.ajax4jsf.framework.util.javascript.ScriptUtils;
+import org.ajax4jsf.event.AjaxEvent;
+import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.JSFunctionDefinition;
+import org.ajax4jsf.javascript.JSReference;
+import org.ajax4jsf.javascript.ScriptUtils;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
+import org.ajax4jsf.util.SelectUtils;
import org.richfaces.component.UICalendar;
import org.richfaces.component.util.HtmlUtil;
@@ -168,6 +169,28 @@
writer.write(definition.toScript());
}
+ public String getInputValue(FacesContext context, UIInput component){
+ UIInput input = (UIInput) component;
+ String value = (String) input.getSubmittedValue();
+ if(value == null){
+ Object curVal = input.getValue();
+ Converter converter = SelectUtils.getConverterForProperty(context, input, "value");
+ if(converter != null){
+ value = converter.getAsString(context, input, curVal);
+ } else {
+ if(curVal == null){
+ value = "";
+ } else {
+ value = curVal.toString();
+ }
+ }
+ }
+ if(value == null){
+ value = "";
+ }
+ return value;
+ }
+
public static Object formatDate(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
Modified: trunk/sandbox/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
===================================================================
--- trunk/sandbox/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2007-07-19 19:38:37 UTC (rev 1711)
+++ trunk/sandbox/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2007-07-19 20:20:46 UTC (rev 1712)
@@ -9,7 +9,7 @@
baseclass="org.richfaces.renderkit.CalendarRendererBase"
component="org.richfaces.component.UICalendar">
<f:clientid var="clientId" />
- <h:scripts>new org.ajax4jsf.framework.resource.PrototypeScript(),new org.ajax4jsf.framework.ajax.AjaxScript(),/org/richfaces/renderkit/html/scripts/utils.js,/org/richfaces/renderkit/html/scripts/json/json-dom.js,/org/richfaces/renderkit/html/scripts/calendar.js</h:scripts>
+ <h:scripts>new org.ajax4jsf.javascript.PrototypeScript(),new org.ajax4jsf.javascript.AjaxScript(),/org/richfaces/renderkit/html/scripts/utils.js,/org/richfaces/renderkit/html/scripts/json/json-dom.js,/org/richfaces/renderkit/html/scripts/calendar.js</h:scripts>
<h:styles>/org/richfaces/renderkit/html/css/calendar.xcss</h:styles>
<div id="#{clientId}"
@@ -75,7 +75,7 @@
);
</script> <jsp:scriptlet>
<![CDATA[
- boolean popup = attributeToBoolean(component, "popup");
+ boolean popup = getUtils().isBooleanAttribute(component, "popup");
if (popup) {]]>
</jsp:scriptlet>
<span> <input
Modified: trunk/sandbox/ui/tooltip/src/main/config/component/toolTip.xml
===================================================================
--- trunk/sandbox/ui/tooltip/src/main/config/component/toolTip.xml 2007-07-19 19:38:37 UTC (rev 1711)
+++ trunk/sandbox/ui/tooltip/src/main/config/component/toolTip.xml 2007-07-19 20:20:46 UTC (rev 1712)
@@ -25,7 +25,7 @@
<tag>
<name>toolTip</name>
<classname>org.richfaces.taglib.HtmlToolTipTag</classname>
- <superclass>org.ajax4jsf.framework.taglib.HtmlComponentTagBase</superclass>
+ <superclass>org.ajax4jsf.webapp.taglib.HtmlComponentTagBase</superclass>
<test>
<classname>org.richfaces.taglib.HtmlToolTipTagTest</classname>
<superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
Modified: trunk/sandbox/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java
===================================================================
--- trunk/sandbox/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java 2007-07-19 19:38:37 UTC (rev 1711)
+++ trunk/sandbox/ui/tooltip/src/main/java/org/richfaces/component/UIToolTip.java 2007-07-19 20:20:46 UTC (rev 1712)
@@ -79,4 +79,9 @@
public abstract void setOnmouseover(String onmouseover);
+ public abstract String getOncomplete();
+ public abstract void setOncomplete(String oncomplete);
+
+ public abstract String getOnhide();
+ public abstract void setOnhide(String onhide);
}
Modified: trunk/sandbox/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java
===================================================================
--- trunk/sandbox/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java 2007-07-19 19:38:37 UTC (rev 1711)
+++ trunk/sandbox/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java 2007-07-19 20:20:46 UTC (rev 1712)
@@ -7,14 +7,14 @@
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.framework.ajax.AjaxEvent;
-import org.ajax4jsf.framework.renderer.AjaxComponentRendererBase;
-import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
-import org.ajax4jsf.framework.skin.Skin;
-import org.ajax4jsf.framework.util.javascript.JSFunction;
-import org.ajax4jsf.framework.util.javascript.JSFunctionDefinition;
-import org.ajax4jsf.framework.util.javascript.JSReference;
+import org.ajax4jsf.event.AjaxEvent;
+import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.JSFunctionDefinition;
+import org.ajax4jsf.javascript.JSReference;
+import org.ajax4jsf.renderkit.AjaxComponentRendererBase;
+import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.richfaces.component.UIToolTip;
+import org.richfaces.skin.Skin;
public class ToolTipRenderer extends AjaxComponentRendererBase{
Modified: trunk/sandbox/ui/tooltip/src/main/templates/org/richfaces/htmltooltip.jspx
===================================================================
--- trunk/sandbox/ui/tooltip/src/main/templates/org/richfaces/htmltooltip.jspx 2007-07-19 19:38:37 UTC (rev 1711)
+++ trunk/sandbox/ui/tooltip/src/main/templates/org/richfaces/htmltooltip.jspx 2007-07-19 20:20:46 UTC (rev 1712)
@@ -21,102 +21,21 @@
/org/richfaces/renderkit/html/scripts/tooltip.js
</h:scripts>
-<!--
- <style type="text/css">
- .roundtop {
- background: url(#{this:getTRImageSrc(context, component)}) no-repeat top right;
- }
-
- .roundbottom {
- background: url(#{this:getBRImageSrc(context, component)}) no-repeat top right;
- }
- </style>
-
-
-
-
- <div style="#{this:getMainDivStyle(context, component)}">
- <div class="roundtop">
- <f:call name="insertImage">
- <f:parameter value="tl"/>
- </f:call>
- </div>
- <p style="margin: 0 10px;">
- <f:call name="insertValue"/>
- <vcp:body>
- <f:call name="renderChildren"/>
- </vcp:body>
- <f:clientid var="clientId"/>
-
- </p>
- <div class="roundbottom">
- <f:call name="insertImage">
- <f:parameter value="bl"/>
- </f:call>
- </div>
-</div>
-
-
- <hr/>
--->
-
<f:clientid var="clientId"/>
- <div id="tooltip#{clientId}" style="position: absolute; display : none;">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="15px">
- <f:call name="insertImage">
- <f:parameter value="tl"/>
- </f:call>
- </td>
- <td bgcolor="#{this:getBgColor(context, component)}"><f:call name="insertImage">
- <f:parameter value="br"/>
- </f:call></td>
- <td width="15px">
- <f:call name="insertImage">
- <f:parameter value="tr"/>
- </f:call>
- </td>
- </tr>
- <tr>
- <td bgcolor="#{this:getBgColor(context, component)}"></td>
- <td bgcolor="#{this:getBgColor(context, component)}">
- <jsp:scriptlet>
- <![CDATA[if(component.getFacet("defaultContent")!=null && component.getFacet("defaultContent").isRendered()) {]]>
- </jsp:scriptlet>
- <span class="dr-rich-tool-tip rich-tool-tip">
- <u:insertFacet name="defaultContent" />
- </span>
- <jsp:scriptlet>
- <![CDATA[} else {]]>
- </jsp:scriptlet>
- <span class="dr-rich-tool-tip rich-tool-tip">#{component.attributes['value']}</span>
- <jsp:scriptlet>
- <![CDATA[}]]>
- </jsp:scriptlet>
-
- </td>
- <td bgcolor="#{this:getBgColor(context, component)}"></td>
- </tr>
- <tr>
- <td>
- <f:call name="insertImage">
- <f:parameter value="bl"/>
- </f:call>
- </td>
- <td bgcolor="#{this:getBgColor(context, component)}"><f:call name="insertImage">
- <f:parameter value="br"/>
- </f:call></td>
- <td>
- <f:call name="insertImage">
- <f:parameter value="br"/>
- </f:call>
- </td>
- </tr>
-
- </table>
- <f:call name="insertScript"/>
+ <div id="#{clientId}" style="position: absolute; display : none;z-index:99; #{component.attributes['style']}" class="dr-rich-tool-tip rich-tool-tip #{component.attributes['styleClass']}">
+ <f:call name="utils.encodePassThru" />
+ <span id="#{clientId}defaultContent" style="display:none">
+ <u:insertFacet name="defaultContent" />
+ </span>
+ <vcp:body>
+ <f:call name="encodeTooltipText"/>
+ </vcp:body>
+ <f:clientid var="clientId"/>
+ <span id="#{clientId}script" style="display:none">
+ <f:call name="insertScript"/>
+ </span>
+
</div>
<!-- f:call name="utils.encodeEndFormIfNessesary"/-->
</f:root>
17 years, 5 months
JBoss Rich Faces SVN: r1711 - in trunk/sandbox/ui/message/src/main: java/org/richfaces/renderkit/html and 7 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-07-19 15:38:37 -0400 (Thu, 19 Jul 2007)
New Revision: 1711
Added:
trunk/sandbox/ui/message/src/main/resources/org/
trunk/sandbox/ui/message/src/main/resources/org/richfaces/
trunk/sandbox/ui/message/src/main/resources/org/richfaces/renderkit/
trunk/sandbox/ui/message/src/main/resources/org/richfaces/renderkit/html/
trunk/sandbox/ui/message/src/main/resources/org/richfaces/renderkit/html/css/
trunk/sandbox/ui/message/src/main/resources/org/richfaces/renderkit/html/css/msg.css
Modified:
trunk/sandbox/ui/message/src/main/config/component/message.xml
trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/RichMessageBaseRenderer.java
trunk/sandbox/ui/message/src/main/templates/org/richfaces/message.jspx
Log:
first impl of message component
Modified: trunk/sandbox/ui/message/src/main/config/component/message.xml
===================================================================
--- trunk/sandbox/ui/message/src/main/config/component/message.xml 2007-07-19 19:37:26 UTC (rev 1710)
+++ trunk/sandbox/ui/message/src/main/config/component/message.xml 2007-07-19 19:38:37 UTC (rev 1711)
@@ -39,6 +39,7 @@
<property attachedstate="true">
<name>passedLabel</name>
<classname>java.lang.String</classname>
+ <defaultvalue>"passed"</defaultvalue>
<description>
Attribute should define the label to be displayed when no message appears
</description>
@@ -81,7 +82,7 @@
<property>
<name>tooltip</name>
- <classname>java.lang.String</classname>
+ <classname>boolean</classname>
</property>
<property>
@@ -103,8 +104,12 @@
<name>styleClass</name>
<classname>java.lang.String</classname>
</property>
-
+
<property>
+ <name>style</name>
+ <classname>java.lang.String</classname>
+ </property>
+ <property>
<name>warnClass</name>
<classname>java.lang.String</classname>
</property>
Modified: trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/RichMessageBaseRenderer.java
===================================================================
--- trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/RichMessageBaseRenderer.java 2007-07-19 19:37:26 UTC (rev 1710)
+++ trunk/sandbox/ui/message/src/main/java/org/richfaces/renderkit/html/RichMessageBaseRenderer.java 2007-07-19 19:38:37 UTC (rev 1711)
@@ -10,9 +10,14 @@
import javax.faces.component.NamingContainer;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
import org.ajax4jsf.context.AjaxContext;
+import org.ajax4jsf.renderkit.ComponentVariables;
+import org.ajax4jsf.renderkit.ComponentsVariableResolver;
+import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
import org.ajax4jsf.renderkit.RendererBase;
+import org.ajax4jsf.renderkit.RendererUtils.HTML;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.richfaces.component.UIRichMessage;
@@ -22,17 +27,18 @@
* @author Anton Belevich
*
*/
-public class RichMessageBaseRenderer extends RendererBase{
+public class RichMessageBaseRenderer extends HeaderResourcesRendererBase{
private static final Log log = LogFactory.getLog(RichMessageBaseRenderer.class);
public static final String NULL_PARAMETER_ERROR_MESSAGE = "null parameter ERROR";
- public static final String COMPONENT_NOT_FOUND_IN_VIEW = "component not found in view";
+ public static final String COMPONENT_NOT_FOUND_IN_VIEW_WARN_MESSAGE = "component not found in the view WARNING";
+ private RendererBase messageTemplate = null;
- public void encodeEnd(FacesContext context, UIComponent component)
- throws IOException {
+
+ public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
Iterator msgIter = null;
@@ -40,14 +46,14 @@
throw new NullPointerException(NULL_PARAMETER_ERROR_MESSAGE);
}
- if (log.isTraceEnabled()) {
- log.trace("begin encoding component " + component.getId());
+ if(log.isTraceEnabled()){
+ log.trace("begin encoding component: " + component.getId());
}
- if (!component.isRendered()) {
- if (log.isTraceEnabled()) {
+ if (!component.isRendered()){
+ if(log.isTraceEnabled()){
log.trace("stop encoding component: "
- + component.getId() + " rendered attribute is set to false");
+ + component.getId() + " 'rendered' attribute is set to false");
}
return;
}
@@ -63,15 +69,14 @@
}
msgIter = getMessageIterator(context, forClientId, msgComponent);
-
if(!msgIter.hasNext()){
return;
}
FacesMessage message = (FacesMessage)msgIter.next();
- //TODO rendering here
-
+ encodingUIContent(msgComponent, context, message);
+
AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
Set ajaxRenderedAreas = ajaxContext.getAjaxRenderedAreas();
@@ -80,6 +85,157 @@
}
}
+ protected void encodingUIContent(UIRichMessage uiMsg, FacesContext context, FacesMessage facesMsg) throws IOException{
+
+ boolean showSummary = uiMsg.isShowSummary();
+
+ boolean showDetail = uiMsg.isShowDetail();
+
+ Object tooltip = uiMsg.getAttributes().get("tooltip");
+ boolean isTooltip = false;
+
+ if(tooltip instanceof Boolean){
+ isTooltip = ((Boolean)tooltip).booleanValue();
+ }
+
+ String divClass = null;
+ String divStyle = null;
+
+ String markerClass = null;
+ String markerStyle = null;
+
+ String labelClass = null;
+ String labelStyle = null;
+
+ UIComponent markerFacet = null;
+
+
+ if(facesMsg.getSeverity() == FacesMessage.SEVERITY_ERROR){
+
+ divClass = (String)uiMsg.getAttributes().get("errorClass");
+ divStyle = (String)uiMsg.getAttributes().get("errorStyle");
+
+ markerClass = (String)uiMsg.getAttributes().get("errorMarkerClass");
+ markerStyle = (String)uiMsg.getAttributes().get("errorMarkerStyle");
+
+ labelClass = (String)uiMsg.getAttributes().get("errorLabelClass");
+ labelStyle = (String)uiMsg.getAttributes().get("errorLabelStyle");
+
+ markerFacet = uiMsg.getFacet("errorMarker");
+
+ }else if(facesMsg.getSeverity() == FacesMessage.SEVERITY_FATAL){
+
+ divClass = (String)uiMsg.getAttributes().get("fatalClass");
+ divStyle = (String)uiMsg.getAttributes().get("fatalStyle");
+
+ markerClass = (String)uiMsg.getAttributes().get("fatalMarkerClass");
+ markerStyle = (String)uiMsg.getAttributes().get("fatalMarkerStyle");
+
+ labelClass = (String)uiMsg.getAttributes().get("fatalLabelClass");
+ labelStyle = (String)uiMsg.getAttributes().get("fatalLabelStyle");
+
+ markerFacet = uiMsg.getFacet("fatalMarker");
+
+ }else if(facesMsg.getSeverity() == FacesMessage.SEVERITY_WARN){
+
+ divClass = (String)uiMsg.getAttributes().get("warnClass");
+ divStyle = (String)uiMsg.getAttributes().get("warnStyle");
+
+ markerClass = (String)uiMsg.getAttributes().get("warnMarkerClass");
+ markerStyle = (String)uiMsg.getAttributes().get("warnMarkerStyle");
+
+ labelClass = (String)uiMsg.getAttributes().get("warnLabelClass");
+ labelStyle = (String)uiMsg.getAttributes().get("warnLabelStyle");
+
+ markerFacet = uiMsg.getFacet("warnMarker");
+
+ }else if(facesMsg.getSeverity() == FacesMessage.SEVERITY_INFO){
+
+ divClass = (String)uiMsg.getAttributes().get("infoClass");
+ divStyle = (String)uiMsg.getAttributes().get("infoStyle");
+
+ markerClass = (String)uiMsg.getAttributes().get("infoMarkerClass");
+ markerStyle = (String)uiMsg.getAttributes().get("infoMarkerStyle");
+
+ labelClass = (String)uiMsg.getAttributes().get("infoLabelClass");
+ labelStyle = (String)uiMsg.getAttributes().get("infoLabelStyle");
+
+ markerFacet = uiMsg.getFacet("infoMarker");
+ }
+
+ String markerLocation = uiMsg.getMarkerLocation();
+ markerLocation = markerLocation.toLowerCase();
+
+ ResponseWriter writer = context.getResponseWriter();
+
+ messageTemplate = getMessageTemplate();
+
+ ComponentVariables variables = ComponentsVariableResolver.getVariables(messageTemplate, uiMsg);
+ variables.setVariable("divClass", divClass);
+ variables.setVariable("divStyle", divStyle);
+
+
+
+ if(markerLocation.equals(uiMsg.MARKER_LOCATION_LEFT)){
+ renderMarkerFacet(uiMsg,markerFacet,context, writer, markerClass, markerStyle);
+ renderLabel(uiMsg, facesMsg, context, writer, labelClass,
+ labelStyle, isTooltip, showDetail,showSummary);
+ }else if(markerLocation.equals(uiMsg.MARKER_LOCATION_RIGHT)){
+ renderLabel(uiMsg, facesMsg, context, writer, labelClass,
+ labelStyle, isTooltip, showDetail, showSummary);
+ renderMarkerFacet(uiMsg,markerFacet,context, writer, markerClass, markerStyle);
+ }
+
+ doEncodeEnd(writer, context, uiMsg);
+ }
+
+ protected void renderMarkerFacet(UIRichMessage uiMsg, UIComponent marker, FacesContext context, ResponseWriter writer, String markerClass, String markerStyle) throws IOException{
+
+ if(marker == null){
+ return;
+ }
+
+ writer.startElement(HTML.SPAN_ELEM, uiMsg);
+
+ String classes = markerClass == null ? "rich-message-marker" : "rich-message-marker " + markerClass;
+
+ getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE, classes);
+ getUtils().writeAttribute(writer, HTML.style_ATTRIBUTE, markerStyle);
+ renderChild(context, marker);
+ writer.endElement(HTML.SPAN_ELEM);
+
+ }
+
+ protected void renderLabel(UIRichMessage uiMsg, FacesMessage msg, FacesContext context,
+ ResponseWriter writer, String labelClass, String labelStyle,
+ boolean isTooltip, boolean showDetail, boolean showSummary) throws IOException{
+
+ String summary = (null != (summary = msg.getSummary())) ? summary : "";
+ String detail = (null != (detail = msg.getDetail())) ? detail : "";
+
+ String classes = labelClass == null ? "rich-message-label" : "rich-message-label " + labelClass;
+
+ writer.startElement(HTML.SPAN_ELEM, uiMsg);
+ getUtils().writeAttribute(writer, HTML.class_ATTRIBUTE,classes);
+ getUtils().writeAttribute(writer, HTML.style_ATTRIBUTE, labelStyle);
+
+ if(isTooltip){
+ getUtils().writeAttribute(writer, HTML.title_ATTRIBUTE, summary);
+ }
+
+ if(showDetail){
+ writer.writeText(detail, null);
+ writer.writeText("\t", null);
+ }
+
+ if(showSummary){
+ writer.writeText(summary, null);
+ writer.writeText("\t", null);
+ }
+
+ writer.endElement(HTML.SPAN_ELEM);
+ }
+
protected Iterator getMessageIterator(FacesContext context, String forClientId, UIComponent component){
Iterator msgIter = null;
@@ -90,7 +246,6 @@
msgIter = context.getMessages(null);
}else{
UIComponent result = findForComponent(context, forClientId,component);
-
if (result == null) {
msgIter = Collections.EMPTY_LIST.iterator();
} else {
@@ -104,17 +259,17 @@
return msgIter;
}
- protected UIComponent findForComponent(FacesContext context, String forClientId, UIComponent component) {
+ protected UIComponent findForComponent(FacesContext context, String forClientId, UIComponent component){
- if(null == forClientId || forClientId.length() == 0) {
+ if(null == forClientId || forClientId.length() == 0){
return null;
}
UIComponent result = null;
UIComponent parent = component;
- try {
- while(parent != null) {
+ try{
+ while(parent != null){
result = parent.findComponent(forClientId);
if(result != null){
@@ -123,17 +278,17 @@
parent = parent.getParent();
}
- if(result == null) {
+ if(result == null){
result = findComponentBelow(context.getViewRoot(), forClientId);
}
- } catch(Throwable t) {
- throw new RuntimeException(COMPONENT_NOT_FOUND_IN_VIEW + ":"+ forClientId);
+ } catch(Throwable t){
+ throw new RuntimeException(COMPONENT_NOT_FOUND_IN_VIEW_WARN_MESSAGE + ":"+ forClientId);
}
- if(result == null) {
- if(log.isWarnEnabled()) {
- log.warn(COMPONENT_NOT_FOUND_IN_VIEW + ":"+ forClientId);
+ if(result == null){
+ if(log.isWarnEnabled()){
+ log.warn(COMPONENT_NOT_FOUND_IN_VIEW_WARN_MESSAGE + ":"+ forClientId);
}
}
@@ -165,7 +320,26 @@
return retComp;
};
- protected Class getComponentClass() {
+ private RendererBase getMessageTemplate(){
+
+ if (messageTemplate == null) {
+ try {
+
+ messageTemplate = (RendererBase)Class.forName("org.richfaces.renderkit.html.RichMessageRenderer").newInstance();
+
+ } catch (InstantiationException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ }
+ }
+
+ return messageTemplate;
+ }
+
+ protected Class getComponentClass(){
return getClass();
}
}
Added: trunk/sandbox/ui/message/src/main/resources/org/richfaces/renderkit/html/css/msg.css
===================================================================
--- trunk/sandbox/ui/message/src/main/resources/org/richfaces/renderkit/html/css/msg.css (rev 0)
+++ trunk/sandbox/ui/message/src/main/resources/org/richfaces/renderkit/html/css/msg.css 2007-07-19 19:38:37 UTC (rev 1711)
@@ -0,0 +1,18 @@
+.rich-message-marker{
+ background-image : url(1.GIF);
+ background-repeat: no-repeat;
+ background-position: left center;
+}
+
+.rich-message{
+
+}
+
+.rich-message-label{
+
+
+}
+
+.dr-msg-img{
+ vertical-align: text-bottom;
+}
\ No newline at end of file
Modified: trunk/sandbox/ui/message/src/main/templates/org/richfaces/message.jspx
===================================================================
--- trunk/sandbox/ui/message/src/main/templates/org/richfaces/message.jspx 2007-07-19 19:37:26 UTC (rev 1710)
+++ trunk/sandbox/ui/message/src/main/templates/org/richfaces/message.jspx 2007-07-19 19:38:37 UTC (rev 1711)
@@ -10,13 +10,17 @@
class="org.richfaces.renderkit.html.RichMessageRenderer"
baseclass="org.richfaces.renderkit.html.RichMessageBaseRenderer"
component="org.richfaces.component.UIRichMessage"
- >
- <f:clientId var="clientId" />
+ >
+ <h:styles>
+ /org/richfaces/renderkit/html/css/msg.css
+ </h:styles>
+
+ <f:clientId var="clientId" />
- <div id="#{clientId}:m">
- <span>
- <vcp:body/>
- </span>
- </div>
+ <div id="#{clientId}" class="rich-message #{divClass}" style="#{component.attributes['style']} #{divStyle}">
+ <span class="dr-msg-img">
+ <vcp:body/>
+ </span>
+ </div>
</f:root>
\ No newline at end of file
17 years, 5 months
JBoss Rich Faces SVN: r1710 - in trunk/sandbox/samples/rich-message-demo: target and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-07-19 15:37:26 -0400 (Thu, 19 Jul 2007)
New Revision: 1710
Added:
trunk/sandbox/samples/rich-message-demo/target/
trunk/sandbox/samples/rich-message-demo/target/classes/
trunk/sandbox/samples/rich-message-demo/target/classes/com/
trunk/sandbox/samples/rich-message-demo/target/classes/com/sun/
trunk/sandbox/samples/rich-message-demo/target/classes/com/sun/el/
trunk/sandbox/samples/rich-message-demo/target/classes/com/sun/el/Messages.properties
Log:
Added: trunk/sandbox/samples/rich-message-demo/target/classes/com/sun/el/Messages.properties
===================================================================
--- trunk/sandbox/samples/rich-message-demo/target/classes/com/sun/el/Messages.properties (rev 0)
+++ trunk/sandbox/samples/rich-message-demo/target/classes/com/sun/el/Messages.properties 2007-07-19 19:37:26 UTC (rev 1710)
@@ -0,0 +1,84 @@
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+#
+# The contents of this file are subject to the terms of either the GNU
+# General Public License Version 2 only ("GPL") or the Common Development
+# and Distribution License("CDDL") (collectively, the "License"). You
+# may not use this file except in compliance with the License. You can obtain
+# a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
+# or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+# language governing permissions and limitations under the License.
+#
+# When distributing the software, include this License Header Notice in each
+# file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+# Sun designates this particular file as subject to the "Classpath" exception
+# as provided by Sun in the GPL Version 2 section of the License file that
+# accompanied this code. If applicable, add the following below the License
+# Header, with the fields enclosed by brackets [] replaced by your own
+# identifying information: "Portions Copyrighted [year]
+# [name of copyright owner]"
+#
+# Contributor(s):
+#
+# If you wish your version of this file to be governed by only the CDDL or
+# only the GPL Version 2, indicate your decision by adding "[Contributor]
+# elects to include this software in this distribution under the [CDDL or GPL
+# Version 2] license." If you don't indicate a single choice of license, a
+# recipient has the option to distribute your version of this file under
+# either the CDDL, the GPL Version 2 or to extend the choice of license to
+# its licensees as provided above. However, if you add GPL Version 2 code
+# and therefore, elected the GPL Version 2 license, then the option applies
+# only if the new code is made subject to such option by the copyright
+# holder.
+#
+
+# General Errors
+error.convert=Cannot convert {0} of type {1} to {2}
+error.compare=Cannot compare {0} to {1}
+error.function=Problems calling function ''{0}''
+error.unreachable.base=Target Unreachable, identifier ''{0}'' resolved to null
+error.unreachable.property=Target Unreachable, ''{0}'' returned null
+error.resolver.unhandled=ELResolver did not handle type: {0} with property of ''{1}''
+error.resolver.unhandled.null=ELResolver cannot handle a null base Object with identifier ''{0}''
+
+# ValueExpressionLiteral
+error.value.literal.write=ValueExpression is a literal and not writable: {0}
+
+# ExpressionFactoryImpl
+error.null=Expression cannot be null
+error.mixed=Expression cannot contain both '#{..}' and '${..}' : {0}
+error.method=Not a valid MethodExpression : {0}
+error.method.nullParms=Parameter types cannot be null
+error.value.expectedType=Expected type cannot be null
+
+# ExpressionMediator
+error.eval=Error Evaluating {0} : {1}
+
+# ValueSetVisitor
+error.syntax.set=Illegal Syntax for Set Operation
+
+# ReflectionUtil
+error.method.notfound=Method not found: {0}.{1}({2})
+error.property.notfound=Property ''{1}'' not found on {0}
+
+# ValidatingVisitor
+error.fnMapper.null=Expression uses functions, but no FunctionMapper was provided
+error.fnMapper.method=Function ''{0}'' not found
+error.fnMapper.paramcount=Function ''{0}'' specifies {1} params, but {2} were declared
+
+# **ExpressionImpl
+error.context.null=ELContext was null
+
+# ArrayELResolver
+error.array.outofbounds=Index {0} is out of bounds for array of size {1}
+
+# ListELResolver
+error.list.outofbounds=Index {0} is out of bounds for list of size {1}
+
+# BeanELResolver
+error.property.notfound=Property ''{1}'' not found on type: {0}
+error.property.invocation=Property ''{1}'' threw an exception from type: {0}
+error.property.notreadable=Property ''{1}'' doesn't have a 'get' specified on type: {0}
+error.property.notwritable=Property ''{1}'' doesn't have a 'set' specified on type: {0}
\ No newline at end of file
17 years, 5 months
JBoss Rich Faces SVN: r1709 - in trunk/sandbox/samples/rich-message-demo/src/main: resources and 8 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-07-19 15:36:44 -0400 (Thu, 19 Jul 2007)
New Revision: 1709
Added:
trunk/sandbox/samples/rich-message-demo/src/main/resources/
trunk/sandbox/samples/rich-message-demo/src/main/resources/com/
trunk/sandbox/samples/rich-message-demo/src/main/resources/com/sun/
trunk/sandbox/samples/rich-message-demo/src/main/resources/com/sun/el/
trunk/sandbox/samples/rich-message-demo/src/main/resources/com/sun/el/Messages.properties
trunk/sandbox/samples/rich-message-demo/src/main/webapp/css/
trunk/sandbox/samples/rich-message-demo/src/main/webapp/css/app.css
trunk/sandbox/samples/rich-message-demo/src/main/webapp/image/
trunk/sandbox/samples/rich-message-demo/src/main/webapp/image/error.gif
trunk/sandbox/samples/rich-message-demo/src/main/webapp/image/fatal.gif
trunk/sandbox/samples/rich-message-demo/src/main/webapp/image/info.gif
trunk/sandbox/samples/rich-message-demo/src/main/webapp/image/warn.gif
Modified:
trunk/sandbox/samples/rich-message-demo/src/main/webapp/WEB-INF/faces-config.xml
trunk/sandbox/samples/rich-message-demo/src/main/webapp/pages/message-demo.xhtml
Log:
Added: trunk/sandbox/samples/rich-message-demo/src/main/resources/com/sun/el/Messages.properties
===================================================================
--- trunk/sandbox/samples/rich-message-demo/src/main/resources/com/sun/el/Messages.properties (rev 0)
+++ trunk/sandbox/samples/rich-message-demo/src/main/resources/com/sun/el/Messages.properties 2007-07-19 19:36:44 UTC (rev 1709)
@@ -0,0 +1,84 @@
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+#
+# Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+#
+# The contents of this file are subject to the terms of either the GNU
+# General Public License Version 2 only ("GPL") or the Common Development
+# and Distribution License("CDDL") (collectively, the "License"). You
+# may not use this file except in compliance with the License. You can obtain
+# a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
+# or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+# language governing permissions and limitations under the License.
+#
+# When distributing the software, include this License Header Notice in each
+# file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+# Sun designates this particular file as subject to the "Classpath" exception
+# as provided by Sun in the GPL Version 2 section of the License file that
+# accompanied this code. If applicable, add the following below the License
+# Header, with the fields enclosed by brackets [] replaced by your own
+# identifying information: "Portions Copyrighted [year]
+# [name of copyright owner]"
+#
+# Contributor(s):
+#
+# If you wish your version of this file to be governed by only the CDDL or
+# only the GPL Version 2, indicate your decision by adding "[Contributor]
+# elects to include this software in this distribution under the [CDDL or GPL
+# Version 2] license." If you don't indicate a single choice of license, a
+# recipient has the option to distribute your version of this file under
+# either the CDDL, the GPL Version 2 or to extend the choice of license to
+# its licensees as provided above. However, if you add GPL Version 2 code
+# and therefore, elected the GPL Version 2 license, then the option applies
+# only if the new code is made subject to such option by the copyright
+# holder.
+#
+
+# General Errors
+error.convert=Cannot convert {0} of type {1} to {2}
+error.compare=Cannot compare {0} to {1}
+error.function=Problems calling function ''{0}''
+error.unreachable.base=Target Unreachable, identifier ''{0}'' resolved to null
+error.unreachable.property=Target Unreachable, ''{0}'' returned null
+error.resolver.unhandled=ELResolver did not handle type: {0} with property of ''{1}''
+error.resolver.unhandled.null=ELResolver cannot handle a null base Object with identifier ''{0}''
+
+# ValueExpressionLiteral
+error.value.literal.write=ValueExpression is a literal and not writable: {0}
+
+# ExpressionFactoryImpl
+error.null=Expression cannot be null
+error.mixed=Expression cannot contain both '#{..}' and '${..}' : {0}
+error.method=Not a valid MethodExpression : {0}
+error.method.nullParms=Parameter types cannot be null
+error.value.expectedType=Expected type cannot be null
+
+# ExpressionMediator
+error.eval=Error Evaluating {0} : {1}
+
+# ValueSetVisitor
+error.syntax.set=Illegal Syntax for Set Operation
+
+# ReflectionUtil
+error.method.notfound=Method not found: {0}.{1}({2})
+error.property.notfound=Property ''{1}'' not found on {0}
+
+# ValidatingVisitor
+error.fnMapper.null=Expression uses functions, but no FunctionMapper was provided
+error.fnMapper.method=Function ''{0}'' not found
+error.fnMapper.paramcount=Function ''{0}'' specifies {1} params, but {2} were declared
+
+# **ExpressionImpl
+error.context.null=ELContext was null
+
+# ArrayELResolver
+error.array.outofbounds=Index {0} is out of bounds for array of size {1}
+
+# ListELResolver
+error.list.outofbounds=Index {0} is out of bounds for list of size {1}
+
+# BeanELResolver
+error.property.notfound=Property ''{1}'' not found on type: {0}
+error.property.invocation=Property ''{1}'' threw an exception from type: {0}
+error.property.notreadable=Property ''{1}'' doesn't have a 'get' specified on type: {0}
+error.property.notwritable=Property ''{1}'' doesn't have a 'set' specified on type: {0}
\ No newline at end of file
Modified: trunk/sandbox/samples/rich-message-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/sandbox/samples/rich-message-demo/src/main/webapp/WEB-INF/faces-config.xml 2007-07-19 19:35:43 UTC (rev 1708)
+++ trunk/sandbox/samples/rich-message-demo/src/main/webapp/WEB-INF/faces-config.xml 2007-07-19 19:36:44 UTC (rev 1709)
@@ -2,14 +2,10 @@
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
"http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
<faces-config>
- <managed-bean>
- <managed-bean-name>jiraUserConverter</managed-bean-name>
- <managed-bean-class>org.richfaces.demo.converters.JiraUserConverter</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
- <managed-property>
- <property-name>channel</property-name>
- <value>#{jiraService.channel}</value>
- </managed-property>
- </managed-bean>
+ <validator>
+ <validator-id>SelectValidator</validator-id>
+ <validator-class>org.richfaces.demo.SelectValidator </validator-class>
+ </validator>
+
</faces-config>
Added: trunk/sandbox/samples/rich-message-demo/src/main/webapp/css/app.css
===================================================================
--- trunk/sandbox/samples/rich-message-demo/src/main/webapp/css/app.css (rev 0)
+++ trunk/sandbox/samples/rich-message-demo/src/main/webapp/css/app.css 2007-07-19 19:36:44 UTC (rev 1709)
@@ -0,0 +1,7 @@
+.rich-message-label{
+ padding: 0px 10px;
+}
+
+.rich-message-marker{
+ vertical-align: text-bottom;
+}
\ No newline at end of file
Added: trunk/sandbox/samples/rich-message-demo/src/main/webapp/image/error.gif
===================================================================
(Binary files differ)
Property changes on: trunk/sandbox/samples/rich-message-demo/src/main/webapp/image/error.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/sandbox/samples/rich-message-demo/src/main/webapp/image/fatal.gif
===================================================================
(Binary files differ)
Property changes on: trunk/sandbox/samples/rich-message-demo/src/main/webapp/image/fatal.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/sandbox/samples/rich-message-demo/src/main/webapp/image/info.gif
===================================================================
(Binary files differ)
Property changes on: trunk/sandbox/samples/rich-message-demo/src/main/webapp/image/info.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/sandbox/samples/rich-message-demo/src/main/webapp/image/warn.gif
===================================================================
(Binary files differ)
Property changes on: trunk/sandbox/samples/rich-message-demo/src/main/webapp/image/warn.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/sandbox/samples/rich-message-demo/src/main/webapp/pages/message-demo.xhtml
===================================================================
--- trunk/sandbox/samples/rich-message-demo/src/main/webapp/pages/message-demo.xhtml 2007-07-19 19:35:43 UTC (rev 1708)
+++ trunk/sandbox/samples/rich-message-demo/src/main/webapp/pages/message-demo.xhtml 2007-07-19 19:36:44 UTC (rev 1709)
@@ -5,14 +5,38 @@
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:r="http://labs.jboss.com/jbossrichfaces/ui/ui/message"
xmlns:a4j="https://ajax4jsf.dev.java.net/ajax">
-
+ <head>
+ <link rel="stylesheet" type="text/css" href="/rich-message-demo/css/app.css" />
+ </head>
+
+
<h:form>
- <h:inputText id="input" value="hello!!">
- <f:validateLongRange minimum="1" maximum="500"/>
- </h:inputText>
+
+ <h:selectOneMenu id="select" value="">
+ <f:selectItem itemValue="error" itemLabel="error"/>
+ <f:selectItem itemValue="fatal" itemLabel="fatal"/>
+ <f:selectItem itemValue="warn" itemLabel="warning"/>
+ <f:selectItem itemValue="info" itemLabel="info"/>
+ <f:selectItem itemValue="passed" itemLabel="passed"/>
+ <f:validator validatorId="SelectValidator"/>
+ </h:selectOneMenu>
<h:commandButton value="submit"></h:commandButton>
- <r:message for="input"></r:message>
+ <r:message for="select" tooltip="true" showDetail="false" showSummary="true" markerLocation="left">
+ <f:facet name="errorMarker">
+ <h:graphicImage url="/image/error.gif"/>
+ </f:facet>
+ <f:facet name="fatalMarker">
+ <h:graphicImage url="/image/fatal.gif"/>
+ </f:facet>
+ <f:facet name="infoMarker">
+ <h:graphicImage url="/image/info.gif"/>
+ </f:facet>
+ <f:facet name="warnMarker">
+ <h:graphicImage url="/image/warn.gif"/>
+ </f:facet>
+ </r:message>
+
</h:form>
</html>
\ No newline at end of file
17 years, 5 months
JBoss Rich Faces SVN: r1708 - in trunk/sandbox/samples/rich-message-demo/src/main: java and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2007-07-19 15:35:43 -0400 (Thu, 19 Jul 2007)
New Revision: 1708
Added:
trunk/sandbox/samples/rich-message-demo/src/main/java/
trunk/sandbox/samples/rich-message-demo/src/main/java/org/
trunk/sandbox/samples/rich-message-demo/src/main/java/org/richfaces/
trunk/sandbox/samples/rich-message-demo/src/main/java/org/richfaces/demo/
trunk/sandbox/samples/rich-message-demo/src/main/java/org/richfaces/demo/SelectValidator.java
Log:
Added: trunk/sandbox/samples/rich-message-demo/src/main/java/org/richfaces/demo/SelectValidator.java
===================================================================
--- trunk/sandbox/samples/rich-message-demo/src/main/java/org/richfaces/demo/SelectValidator.java (rev 0)
+++ trunk/sandbox/samples/rich-message-demo/src/main/java/org/richfaces/demo/SelectValidator.java 2007-07-19 19:35:43 UTC (rev 1708)
@@ -0,0 +1,58 @@
+package org.richfaces.demo;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+
+public class SelectValidator implements Validator {
+
+ public SelectValidator() {
+ }
+
+ public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
+ System.out.println("SelectValidator.validate()");
+
+ String selectedValue = (String) value;
+ String clientId = component.getClientId(context);
+
+ if(selectedValue.equals("warn")){
+
+ FacesMessage message = new FacesMessage();
+ message.setSummary("warning SUMMARY");
+ message.setDetail("warning DETAIL");
+ message.setSeverity(FacesMessage.SEVERITY_WARN);
+ context.addMessage(clientId, message);
+
+
+ }else if(selectedValue.equals("error")){
+
+ FacesMessage message = new FacesMessage();
+ message.setSummary("error SUMMARY");
+ message.setDetail("error DETAIL");
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+
+ context.addMessage(clientId, message);
+
+ }else if(selectedValue.equals("info")){
+
+ FacesMessage message = new FacesMessage();
+ message.setSummary("info SUMMARY");
+ message.setDetail("info DETAIL");
+ message.setSeverity(FacesMessage.SEVERITY_INFO);
+
+ context.addMessage(clientId, message);
+
+ }else if(selectedValue.equals("fatal")){
+
+ FacesMessage message = new FacesMessage();
+ message.setSummary("fatal SUMMARY");
+ message.setDetail("fatal DETAIL");
+ message.setSeverity(FacesMessage.SEVERITY_FATAL);
+
+ context.addMessage(clientId, message);
+ }
+ }
+
+}
17 years, 5 months
JBoss Rich Faces SVN: r1707 - in trunk: sandbox/samples/calendar-sample/src/main/webapp/pages and 22 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2007-07-19 15:23:27 -0400 (Thu, 19 Jul 2007)
New Revision: 1707
Added:
trunk/sandbox/samples/calendar-sample/src/main/webapp/pages/Calendar.jsp
trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarDataModelItemAdaptor.java
trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CurrentDateChangeEvent.java
trunk/sandbox/ui/calendar/src/main/resources/org/
trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/
trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/
trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html/
trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/
trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss
trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/
trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
Modified:
trunk/docs/xslt/en/
trunk/sandbox/samples/rich-message-demo/
trunk/sandbox/samples/tooltip-sample/src/main/java/org/richfaces/Bean.java
trunk/sandbox/samples/tooltip-sample/src/main/webapp/WEB-INF/faces-config.xml
trunk/sandbox/samples/tooltip-sample/src/main/webapp/pages/index.jsp
trunk/sandbox/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
trunk/sandbox/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
trunk/sandbox/ui/calendar/src/test/java/org/richfaces/component/CalendarComponentTest.java
trunk/sandbox/ui/message/
trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js
trunk/sandbox/ui/scrollable-grid/src/main/resources/org/richfaces/renderkit/html/css/grid.xcss
trunk/sandbox/ui/tooltip/src/main/config/component/toolTip.xml
trunk/sandbox/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java
trunk/sandbox/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/css/tooltip.xcss
trunk/sandbox/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js
Log:
Branch diff aplied for r1625:1705
Property changes on: trunk/docs/xslt/en
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
.settings
target
Added: trunk/sandbox/samples/calendar-sample/src/main/webapp/pages/Calendar.jsp
===================================================================
--- trunk/sandbox/samples/calendar-sample/src/main/webapp/pages/Calendar.jsp (rev 0)
+++ trunk/sandbox/samples/calendar-sample/src/main/webapp/pages/Calendar.jsp 2007-07-19 19:23:27 UTC (rev 1707)
@@ -0,0 +1,17 @@
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://richfaces.ajax4jsf.org/calendar" prefix="calendar" %>
+<html>
+ <head>
+ <title></title>
+ </head>
+ <body>
+ <f:view>
+ <h:form>
+ <calendar:calendar id="calendar" >
+ </calendar:calendar>
+
+ </h:form>
+ </f:view>
+ </body>
+</html>
Property changes on: trunk/sandbox/samples/rich-message-demo
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
.settings
target
Modified: trunk/sandbox/samples/tooltip-sample/src/main/java/org/richfaces/Bean.java
===================================================================
--- trunk/sandbox/samples/tooltip-sample/src/main/java/org/richfaces/Bean.java 2007-07-19 18:53:25 UTC (rev 1706)
+++ trunk/sandbox/samples/tooltip-sample/src/main/java/org/richfaces/Bean.java 2007-07-19 19:23:27 UTC (rev 1707)
@@ -20,10 +20,68 @@
*/
package org.richfaces;
+
+import java.util.Date;
+
/**
* @author $Autor$
*
*/
public class Bean {
+ String text;
+
+ String toolTipContent = "ToolTip content";
+
+ String text1 = "ToolTip content1";
+ String text2 = "ToolTip content2";
+ String text3 = "ToolTip content3";
+
+
+ public String getText() {
+ return text;
+ }
+
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ public String getToolTipContent() {
+// toolTipContent += "12";
+// System.out.println("start - " + new Date(System.currentTimeMillis()));
+// for(int i=0;i<100000;i++){
+// double a = Math.cos(i+(Math.asin(1.334)));
+// }
+// System.out.println("end - " + new Date(System.currentTimeMillis()));
+ return toolTipContent;
+ }
+
+ public void setToolTipContent(String toolTipContent) {
+ this.toolTipContent = toolTipContent;
+ }
+
+ public String getText1() {
+ return text1;
+ }
+
+ public void setText1(String text1) {
+ this.text1 = text1;
+ }
+
+ public String getText2() {
+ return text2;
+ }
+
+ public void setText2(String text2) {
+ this.text2 = text2;
+ }
+
+ public String getText3() {
+ return text3;
+ }
+
+ public void setText3(String text3) {
+ this.text3 = text3;
+ }
+
}
\ No newline at end of file
Modified: trunk/sandbox/samples/tooltip-sample/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/sandbox/samples/tooltip-sample/src/main/webapp/WEB-INF/faces-config.xml 2007-07-19 18:53:25 UTC (rev 1706)
+++ trunk/sandbox/samples/tooltip-sample/src/main/webapp/WEB-INF/faces-config.xml 2007-07-19 19:23:27 UTC (rev 1707)
@@ -5,6 +5,12 @@
<managed-bean>
<managed-bean-name>bean</managed-bean-name>
<managed-bean-class>org.richfaces.Bean</managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
+ <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>skinBean</managed-bean-name>
+ <managed-bean-class>org.richfaces.SkinBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
+
</faces-config>
Modified: trunk/sandbox/samples/tooltip-sample/src/main/webapp/pages/index.jsp
===================================================================
--- trunk/sandbox/samples/tooltip-sample/src/main/webapp/pages/index.jsp 2007-07-19 18:53:25 UTC (rev 1706)
+++ trunk/sandbox/samples/tooltip-sample/src/main/webapp/pages/index.jsp 2007-07-19 19:23:27 UTC (rev 1707)
@@ -1,33 +1,35 @@
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://richfaces.ajax4jsf.org/tooltip" prefix="tt"%>
-
+<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
<html>
<head>
<title></title>
-
</head>
<body>
<f:view>
<h:form>
- <%--h:inputText value="Input text" id="inp1" size="50">
- <tt:toolTip value="1231231">
- <f:facet name="defaultContent"><f:verbatim>DEFAULT VALUE</f:verbatim></f:facet>
- </tt:toolTip>
- </h:inputText--%>
+ <h:selectOneRadio binding="#{skinBean.component}" />
+ <h:commandLink action="#{skinBean.change}" value="set skin" />
+ <f:verbatim>
+ <br/><br/>
+ </f:verbatim>
+ <h:inputText value="Ajax mode Tooltip with default content" id="inp1" size="50">
+ <tt:toolTip id="tt" followMouse="false" direction="top-right" mode="ajax" value="#{bean.toolTipContent}" horizontalOffset="20" verticalOffset="20">
+ <f:facet name="defaultContent"><f:verbatim>DEFAULT CONTENT</f:verbatim>
+ </f:facet>
+ <h:outputText id="ot" value="#{bean.toolTipContent}"></h:outputText>
+ <h:commandLink value="Click here to close window..."></h:commandLink>
+ </tt:toolTip>
+ </h:inputText>
+
+ <h:commandButton value="Tooltip with followMouse mode" id="btn">
+ <tt:toolTip value="Tooltip text" followMouse="true"></tt:toolTip>
+ </h:commandButton>
+
+ <%--a4j:log popup="false" level="ALL"></a4j:log--%>
+ </h:form>
- <h:selectOneListbox value="sdfsfd" id="ddl">
- <tt:toolTip value="1231231">
- <f:facet name="defaultContent"><f:verbatim>DEFAULT VALUE DropDown</f:verbatim></f:facet>
- </tt:toolTip>
-
- </h:selectOneListbox>
-
-
-
-
- <!-- h:inputText value="ddd" onclick="toolTipAttach();alert(document.getElementById('lkjl'))"/-->
- </h:form>
</f:view>
</body>
</html>
Modified: trunk/sandbox/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java
===================================================================
--- trunk/sandbox/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2007-07-19 18:53:25 UTC (rev 1706)
+++ trunk/sandbox/ui/calendar/src/main/java/org/richfaces/component/UICalendar.java 2007-07-19 19:23:27 UTC (rev 1707)
@@ -21,16 +21,306 @@
package org.richfaces.component;
-import javax.faces.component.UIComponentBase;
+import java.io.IOException;
+import java.util.AbstractCollection;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.TimeZone;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.component.UIInput;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.convert.ConverterException;
+import javax.faces.convert.DateTimeConverter;
+import javax.faces.el.MethodBinding;
+import javax.faces.el.ValueBinding;
+import javax.faces.event.AbortProcessingException;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.ValueChangeEvent;
+import javax.faces.render.Renderer;
+
+import org.ajax4jsf.framework.ajax.AjaxChildrenEncoder;
+import org.ajax4jsf.framework.ajax.AjaxContext;
+import org.ajax4jsf.framework.ajax.AjaxEvent;
+import org.ajax4jsf.framework.util.message.Messages;
+import org.richfaces.renderkit.CalendarDataModelItemAdaptor;
+import org.richfaces.renderkit.CalendarRendererBase;
+import org.richfaces.renderkit.CurrentDateChangeEvent;
+
+// import org.richfaces.renderkit.html.BaseGradient.Data;
+
/**
* JSF component class
- *
+ *
*/
-public abstract class UICalendar extends UIComponentBase {
-
- public static final String COMPONENT_TYPE = "org.richfaces.Calendar";
-
+public abstract class UICalendar extends UIInput {
+
+ public static final String COMPONENT_TYPE = "org.richfaces.Calendar";
+
private static final String COMPONENT_FAMILY = "org.richfaces.Calendar";
+
+ public abstract Locale getLocale();
+
+ public abstract void setLocale(Locale locale);
+
+ public abstract TimeZone getTimeZone();
+
+ public abstract void setTimeZone(TimeZone timeZone);
+
+ public abstract Date getPreloadDateRangeBegin();
+
+ public abstract void setPreloadDateRangeBegin(Date date);
+
+ public abstract Date getPreloadDateRangeEnd();
+
+ public abstract void setPreloadDateRangeEnd(Date date);
+
+ public abstract Date getCurrentDate();
+
+ public abstract void setCurrentDate(Date date);
+
+ public abstract CalendarDataModel getData();
+
+ public abstract void setData(CalendarDataModel dataModel);
+
+ // currentDate processing -------------------------------------------------
+
+ private Date currentDate = null;
+
+ public String getValueAsString(FacesContext context, UIComponent component)
+ throws IOException {
+ UICalendar calendar = (UICalendar) component;
+ Date valueString = calendar.getCurrentDate();
+ return valueString.toString();
+ }
+
+ public Date getConvertedValue(FacesContext context, String currentDateString)
+ throws ConverterException {
+
+ DateTimeConverter datetime = new DateTimeConverter();
+ datetime.setPattern("MM/yyyy");
+ Date newCurrentDate = (Date) datetime.getAsObject(context, this,
+ currentDateString);
+ return newCurrentDate;
+ }
+ public void updateCurrentDate(FacesContext context, Date currentDate) {
+
+ if (context == null) {
+ throw new NullPointerException();
+ }
+ try{
+ ValueBinding vb = getValueBinding("currentDate");
+ if (vb != null) {
+ vb.setValue(context, currentDate);
+ return;
+ }else{ setCurrentDate(currentDate);}
+ }catch (Exception e) {
+
+ String messageString = e.getMessage();
+ FacesMessage message = new FacesMessage(messageString);
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ context.addMessage(getClientId(context), message);
+ }
+ }
+
+ private int getLastDayOfWeek(Calendar calendar) {
+ int i = calendar.getFirstDayOfWeek();
+ if (i == calendar.getActualMinimum(Calendar.DAY_OF_WEEK)) {
+ i = calendar.getActualMaximum(Calendar.DAY_OF_WEEK);
+ } else {
+ i--;
+ }
+
+ return i;
+ }
+
+ protected Date getDefaultPreloadBegin(Date date) {
+ Calendar calendar = Calendar.getInstance(getTimeZone(), getLocale());
+ calendar.setTime(date);
+ calendar.set(Calendar.DATE, calendar.getActualMinimum(Calendar.DATE));
+ /*
+ * //force recalculation calendar.getTimeInMillis();
+ * calendar.set(Calendar.DAY_OF_WEEK, calendar.getFirstDayOfWeek());
+ */
+ return calendar.getTime();
+ }
+
+ protected Date getDefaultPreloadEnd(Date date) {
+ Calendar calendar = Calendar.getInstance(getTimeZone(), getLocale());
+ calendar.setTime(date);
+ calendar.set(Calendar.DATE, calendar.getActualMaximum(Calendar.DATE));
+ /*
+ * //force recalculation calendar.getTimeInMillis();
+ * calendar.set(Calendar.DAY_OF_WEEK, getLastDayOfWeek(calendar));
+ */
+ return calendar.getTime();
+ }
+
+ 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;
+ }
+
+ protected TimeZone getDefaultTimeZone() {
+ return TimeZone.getDefault();
+ }
+
+ public void broadcast(FacesEvent event) throws AbortProcessingException {
+ // TODO Auto-generated method stub
+ if (event instanceof AjaxEvent) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ AjaxContext ajaxContext = AjaxContext
+ .getCurrentInstance(facesContext);
+ ajaxContext.setResponseData(getPreload());
+ } else {
+ if (event instanceof CurrentDateChangeEvent) {
+ FacesContext facesContext = FacesContext.getCurrentInstance();
+ CurrentDateChangeEvent dateChangeEvent = (CurrentDateChangeEvent) event;
+ String currentDateString = dateChangeEvent.getCurrentDateString();
+
+ if (currentDateString != null) {
+ // if currentDateString is not null then event cames from apply request phase
+ try {
+ Date currentDate = getConvertedValue(facesContext, currentDateString);
+ CurrentDateChangeEvent newDateChangeEvent = new CurrentDateChangeEvent(this, currentDate);
+ newDateChangeEvent.queue();
+ } catch (Exception e) {
+ String messageString = e.getMessage();
+ FacesMessage message = new FacesMessage(messageString);
+ message.setSeverity(FacesMessage.SEVERITY_ERROR);
+ facesContext.addMessage(getClientId(facesContext), message);
+ }
+
+ }
+ else{
+ Date currentDate1 = dateChangeEvent.getCurrentDate();
+ Date currentDate2 = getCurrentDate();
+ if(!currentDate1.equals(currentDate2)){
+ updateCurrentDate(facesContext, currentDate1);
+ ValueChangeEvent changeEvent = new ValueChangeEvent(this,currentDate2,currentDate1);
+ changeEvent.queue();
+ //TODO Add ValueChange Events for currentDate
+
+ }
+
+ }
+ } else {
+ super.broadcast(event);
+ }
+
+ }
+
+ }
+
+ public Object getPreload() {
+ Date[] preloadDateRange = getPreloadDateRange();
+ if (preloadDateRange != null && preloadDateRange.length != 0) {
+ CalendarDataModel calendarDataModel = (CalendarDataModel) getData();
+ if (calendarDataModel != null) {
+ CalendarDataModelItem[] calendarDataModelItems = calendarDataModel
+ .getData(preloadDateRange);
+
+ HashMap args = new HashMap();
+ args.put("startDate", CalendarRendererBase
+ .formatDate(preloadDateRange[0]));
+ args
+ .put("days", new AdaptingCollection(
+ calendarDataModelItems));
+ return args;
+ }
+ }
+
+ return null;
+ }
+
+ public Date[] getPreloadDateRange() {
+ Date dateRangeBegin = this.getPreloadDateRangeBegin();
+ Date dateRangeEnd = this.getPreloadDateRangeEnd();
+
+ if (dateRangeBegin.after(dateRangeEnd)) {
+ // TODO add message
+ throw new IllegalArgumentException();
+ }
+
+ List dates = new ArrayList();
+
+ Calendar calendar = Calendar.getInstance(this.getTimeZone(), this
+ .getLocale());
+ Calendar calendar2 = (Calendar) calendar.clone();
+ calendar.setTime(dateRangeBegin);
+ calendar2.setTime(dateRangeEnd);
+
+ do {
+ dates.add(calendar.getTime());
+ calendar.add(Calendar.DATE, 1);
+ } while (!calendar.after(calendar2));
+
+ return (Date[]) dates.toArray(new Date[dates.size()]);
+ }
+
+ public void encodeAjaxChild(FacesContext context, String path, Set ids,
+ Set renderedAreas) throws IOException {
+
+ Renderer renderer = this.getRenderer(context);
+ if (renderer instanceof AjaxChildrenEncoder) {
+ ((AjaxChildrenEncoder) renderer).encodeAjaxChild(context, path,
+ ids, renderedAreas);
+ }
+ }
}
+
+class AdaptingCollection extends AbstractCollection {
+ private CalendarDataModelItem[] items;
+
+ public AdaptingCollection(CalendarDataModelItem[] items) {
+ super();
+ this.items = items;
+ }
+
+ public Iterator iterator() {
+ return new Iterator() {
+ private int idx = 0;
+
+ private CalendarDataModelItemAdaptor adaptor = new CalendarDataModelItemAdaptor();
+
+ public boolean hasNext() {
+ return idx < items.length;
+ }
+
+ public Object next() {
+ adaptor.setItem(items[idx++]);
+ return adaptor;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+
+ };
+ }
+
+ public int size() {
+ return this.items.length;
+ }
+}
Added: trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarDataModelItemAdaptor.java
===================================================================
--- trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarDataModelItemAdaptor.java (rev 0)
+++ trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarDataModelItemAdaptor.java 2007-07-19 19:23:27 UTC (rev 1707)
@@ -0,0 +1,49 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces 3.0 - 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.renderkit;
+
+import org.richfaces.component.CalendarDataModelItem;
+
+/**
+ * @author Nick Belaevski - mailto:nbelaevski@exadel.com
+ * created 04.07.2007
+ *
+ */
+public class CalendarDataModelItemAdaptor {
+ private CalendarDataModelItem item;
+
+ public void setItem(CalendarDataModelItem item) {
+ this.item = item;
+ }
+
+ public CalendarDataModelItem getItem() {
+ return item;
+ }
+
+ public Object getDate() {
+ return CalendarRendererBase.formatDate(item.getDate());
+ }
+
+ public Object getData() {
+ return item.getData();
+ }
+}
Modified: trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java
===================================================================
--- trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2007-07-19 18:53:25 UTC (rev 1706)
+++ trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CalendarRendererBase.java 2007-07-19 19:23:27 UTC (rev 1707)
@@ -21,19 +21,162 @@
package org.richfaces.renderkit;
+import java.io.IOException;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Map;
+
+import javax.faces.component.UIComponent;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.event.FacesEvent;
+import javax.faces.event.PhaseId;
+
+import org.ajax4jsf.framework.ajax.AjaxEvent;
+import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
+import org.ajax4jsf.framework.util.javascript.JSFunction;
+import org.ajax4jsf.framework.util.javascript.JSFunctionDefinition;
+import org.ajax4jsf.framework.util.javascript.JSReference;
+import org.ajax4jsf.framework.util.javascript.ScriptUtils;
import org.richfaces.component.UICalendar;
+import org.richfaces.component.util.HtmlUtil;
/**
- * @author Nick Belaevski - mailto:nbelaevski@exadel.com
- * created 08.06.2007
- *
+ * @author Nick Belaevski - mailto:nbelaevski@exadel.com created 08.06.2007
+ *
*/
public class CalendarRendererBase extends TemplateEncoderRendererBase {
- /* (non-Javadoc)
- * @see org.ajax4jsf.renderkit.RendererBase#getComponentClass()
+ public static final String DATE_SCROLL = "DateScroll";
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.ajax4jsf.framework.renderer.RendererBase#getComponentClass()
*/
protected Class getComponentClass() {
return UICalendar.class;
}
+
+ public String qualifySize(Object size) {
+ if (size == null) {
+ return "";
+ }
+ return HtmlUtil.qualifySize(size.toString());
+ }
+
+ public Date convertCurrentDate(String currentDateString) {
+
+ Calendar calendar = Calendar.getInstance();
+ calendar.clear();
+ calendar.set(Calendar.DATE, 1);
+ int idx = currentDateString.indexOf('/');
+ calendar.set(Calendar.MONTH, Integer.parseInt(currentDateString
+ .substring(0, idx)));
+ calendar.set(Calendar.YEAR, Integer.parseInt(currentDateString
+ .substring(idx + 1)));
+
+ return calendar.getTime();
+
+ }
+
+ protected void doDecode(FacesContext context, UIComponent component) {
+ // TODO Auto-generated method stub
+ super.doDecode(context, component);
+
+ String clientId = component.getClientId(context);
+
+ Map requestParameterMap = context.getExternalContext()
+ .getRequestParameterMap();
+
+ String currentDateString = (String) requestParameterMap.get(clientId
+ + DATE_SCROLL);
+
+ if (currentDateString != null) {
+// ((UICalendar) component)
+// .setCurrentDate(convertCurrentDate(currentDateString));
+ CurrentDateChangeEvent ev = new CurrentDateChangeEvent(component, currentDateString) ;
+ ev.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
+ ev.queue();
+
+ new AjaxEvent(component).queue();
+ }
+
+ }
+
+
+
+ public void encodeChildren(FacesContext context, UIComponent calendar)
+ throws IOException {
+
+ }
+
+ public void writeMarkupScriptBody(FacesContext context,
+ UIComponent component, boolean children) throws IOException {
+ ResponseWriter responseWriter = context.getResponseWriter();
+ responseWriter
+ .write("function (context) { return this.invoke('getContent', context).join('')");
+ responseWriter.write("}.bind(");
+ writeScriptBody(context, component, children);
+ responseWriter.write(")");
+ }
+
+ public void writePreloadBody(FacesContext context, UICalendar calendar)
+ throws IOException {
+ Object preload = calendar.getPreload();
+ if (preload != null) {
+ ResponseWriter writer = context.getResponseWriter();
+ writer.write(ScriptUtils.toScript(preload));
+ }
+ }
+
+ public void writeSubmitFunction(FacesContext context, UICalendar calendar)
+ throws IOException {
+ ResponseWriter writer = context.getResponseWriter();
+
+ String clientId = calendar.getClientId(context);
+
+ JSFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(calendar,
+ context, AjaxRendererUtils.AJAX_FUNCTION_NAME);
+ ajaxFunction.addParameter(JSReference.NULL);
+ Map options = AjaxRendererUtils.buildEventOptions(context, calendar);
+ options.put("calendar", JSReference.THIS);
+ // ajax single
+ options.put("control", new JSReference(JSReference.THIS.toScript(),
+ "id"));
+
+ String oncomplete = AjaxRendererUtils.getAjaxOncomplete(calendar);
+ JSFunctionDefinition oncompleteDefinition = new JSFunctionDefinition();
+ oncompleteDefinition.addParameter("request");
+ oncompleteDefinition.addParameter("event");
+ oncompleteDefinition.addParameter("data");
+ oncompleteDefinition.addToBody("this.calendar.load(data);");
+ if (oncomplete != null) {
+ oncompleteDefinition.addToBody(oncomplete);
+ }
+
+ options.put("oncomplete", oncompleteDefinition);
+ Map parametersMap = (Map) options.get("parameters");
+ JSReference requestValue = new JSReference("requestValue");
+ parametersMap.remove(clientId);
+ parametersMap.put(clientId + DATE_SCROLL, requestValue);
+ ajaxFunction.addParameter(options);
+ JSFunctionDefinition definition = new JSFunctionDefinition();
+ definition.addParameter(requestValue);
+ definition.addToBody(ajaxFunction);
+ writer.write(definition.toScript());
+ }
+
+ public static Object formatDate(Date date) {
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(date);
+ JSFunction result = new JSFunction("new Date");
+ result.addParameter(Integer.valueOf(calendar.get(Calendar.YEAR)));
+ result.addParameter(Integer.valueOf(calendar.get(Calendar.MONTH)));
+ result.addParameter(Integer.valueOf(calendar.get(Calendar.DATE)));
+
+ return result;
+ }
+
}
Added: trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CurrentDateChangeEvent.java
===================================================================
--- trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CurrentDateChangeEvent.java (rev 0)
+++ trunk/sandbox/ui/calendar/src/main/java/org/richfaces/renderkit/CurrentDateChangeEvent.java 2007-07-19 19:23:27 UTC (rev 1707)
@@ -0,0 +1,41 @@
+package org.richfaces.renderkit;
+
+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 Date currentDate = null;
+ private String currentDateString = null;
+
+ public CurrentDateChangeEvent(UIComponent component, Date curentDate) {
+ super(component);
+ this.currentDate = curentDate;
+
+ }
+ 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 String getCurrentDateString() {
+ return currentDateString;
+ }
+
+}
Added: trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss
===================================================================
--- trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss (rev 0)
+++ trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html/css/calendar.xcss 2007-07-19 19:23:27 UTC (rev 1707)
@@ -0,0 +1,236 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<f:template xmlns:f='http:/jsf.exadel.com/template'
+ xmlns:u='http:/jsf.exadel.com/template/util'
+ xmlns="http://www.w3.org/1999/xhtml" >
+ <f:verbatim><![CDATA[
+.calendar_exterior{
+ border : 1px solid #c0c0c0; /*panelBorderColor*/
+}
+.calendar_btn{
+ cursor : pointer;
+}
+.calendar_header{
+ border-bottom : 1px solid #c0c0c0; /*panelBorderColor*/
+ background : #C7D7EC; /*additionalBackgroundColor*/
+ font-size : 11px; /*generalSizeFont*/
+ font-family : verdana; /*generalFamilyFont*/
+ padding : 7px;
+ height : 22px;
+}
+
+.cell_size{
+ width : 25px;
+ height : 22px;
+}
+
+.calendar_cell{
+ background-color : #FFFFFF; /*generalBackgroundColor*/
+ border-bottom : 1px solid #c0c0c0; /*panelBorderColor*/
+ border-right : 1px solid #c0c0c0; /*panelBorderColor*/
+ font-size : 11px; /*generalSizeFont*/
+ font-family : verdana; /*generalFamilyFont*/
+ padding : 0px;
+ vertical-align : middle;
+ text-align : center;
+}
+
+.calendar_tool{
+ border-bottom : 1px solid #c0c0c0; /*panelBorderColor*/
+ background-color : #224986; /*headerBackgroundColor*/
+ font-size : 11px; /*headerSizeFont*/
+ font-family : verdana; /*headerFamilyFont*/
+ color : #ffffff; /*headerTextColor*/
+ font-weight : bold;
+ vertical-align : middle;
+ text-align : center;
+ width : 25px;
+ height : 22px;
+}
+
+.calendar_month{
+ border-bottom : 1px solid #c0c0c0; /*panelBorderColor*/
+ background-color : #224986; /*headerBackgroundColor*/
+ font-size : 11px; /*headerSizeFont*/
+ font-family : verdana; /*headerFamilyFont*/
+ color : #ffffff; /*headerTextColor*/
+ font-weight : bold;
+ vertical-align : middle;
+ text-align : center;
+}
+
+.calendar_days{
+ border-bottom : 1px solid #c0c0c0; /*panelBorderColor*/
+ border-right : 0px solid #c0c0c0; /*panelBorderColor*/
+ background : #C7D7EC; /*additionalBackgroundColor*/
+ font-size : 11px; /*generalSizeFont*/
+ font-family : verdana; /*generalFamilyFont*/
+ vertical-align : middle;
+ text-align : center;
+ height : 22px;
+}
+
+.calendar_week{
+ border-bottom : 1px solid #c0c0c0; /*panelBorderColor*/
+ border-right : 1px solid #c0c0c0; /*panelBorderColor*/
+ font-size : 11px; /*generalSizeFont*/
+ font-family : verdana; /*generalFamilyFont*/
+ background-color : #f5f5f5; /*unknown parameter - need to add*/
+ vertical-align : middle;
+ text-align : center;
+ width : 25px;
+}
+
+.calendar_holly{
+ background-color : #ffebda; /*unknown parameter - need to add*/
+ color : #ff7800; /*unknown parameter - need to add*/
+}
+
+/*.calendar_current{
+ background-color : #ff7800; /*unknown parameter - need to add*/
+ color : #ffebda; /*unknown parameter - need to add*/
+ font-weight : bold;
+}*/
+
+.calendar_spec{
+ background-color : #e4f5e2; /*unknown parameter - need to add*/
+}
+
+.calendar_select{
+ background-color : #224986; /*headerBackgroundColor*/
+ color : #FFFFFF; /*headerTextColor*/
+ font-weight : bold;
+}
+
+
+.right_cell{
+ border-right : 0px;
+}
+
+.bottom_cell{
+ border-bottom : 0px;
+}
+
+.calendar_toolfooter{
+ border-top : 1px solid #c0c0c0; /*panelBorderColor*/
+ border-right : 0px solid #c0c0c0; /*panelBorderColor*/
+ background : #C7D7EC; /*additionalBackgroundColor*/
+ font-size : 11px; /*generalSizeFont*/
+ font-family : verdana; /*generalFamilyFont*/
+ padding : 0px 7px 0px 7px;
+ height : 22px;
+}
+
+.calendar_footer{
+ border-top : 1px solid #c0c0c0; /*panelBorderColor*/
+ border-right : 0px solid #c0c0c0; /*panelBorderColor*/
+ background : #C7D7EC; /*additionalBackgroundColor*/
+ font-size : 11px; /*generalSizeFont*/
+ font-family : verdana; /*generalFamilyFont*/
+ padding : 7px;
+ height : 22px;
+}
+ ]]>
+ </f:verbatim>
+
+ <u:selector name=".calendar_exterior">
+ <u:style name="border-color" skin="panelBorderColor"/>
+ </u:selector>
+
+ <u:selector name=".calendar_header">
+ <u:style name="border-bottom" skin="panelBorderColor"/>
+ <u:style name="background" skin="additionalBackgroundColor"/>
+ <u:style name="font-size" skin="generalSizeFont"/>
+ <u:style name="font-family" skin="generalFamilyFont"/>
+ </u:selector>
+
+ <u:selector name=".calendar_cell">
+ <u:style name="border-bottom" skin="panelBorderColor"/>
+ <u:style name="border-right" skin="panelBorderColor"/>
+ <u:style name="background-color" skin="generalBackgroundColor"/>
+ <u:style name="font-size" skin="generalSizeFont"/>
+ <u:style name="font-family" skin="generalFamilyFont"/>
+ </u:selector>
+
+ <u:selector name=".calendar_tool">
+ <u:style name="border-bottom" skin="panelBorderColor"/>
+ <u:style name="background-color" skin="headerBackgroundColor"/>
+ <u:style name="font-size" skin="headerSizeFont"/>
+ <u:style name="font-family" skin="headerFamilyFont"/>
+ <u:style name="color" skin="headerTextColor"/>
+ </u:selector>
+
+ <u:selector name=".calendar_month">
+ <u:style name="border-bottom" skin="panelBorderColor"/>
+ <u:style name="background-color" skin="headerBackgroundColor"/>
+ <u:style name="font-size" skin="headerSizeFont"/>
+ <u:style name="font-family" skin="headerFamilyFont"/>
+ <u:style name="color" skin="headerTextColor"/>
+ </u:selector>
+
+ <u:selector name=".calendar_days">
+ <u:style name="border-bottom" skin="panelBorderColor"/>
+ <u:style name="border-right" skin="panelBorderColor"/>
+ <u:style name="background" skin="additionalBackgroundColor"/>
+ <u:style name="font-size" skin="generalSizeFont"/>
+ <u:style name="font-family" skin="generalFamilyFont"/>
+ </u:selector>
+
+/* background-color : #f5f5f5; unknown parameter - need to add*/
+ <u:selector name=".calendar_week">
+ <u:style name="border-bottom" skin="panelBorderColor"/>
+ <u:style name="border-right" skin="panelBorderColor"/>
+ <u:style name="font-size" skin="generalSizeFont"/>
+ <u:style name="font-family" skin="generalFamilyFont"/>
+ </u:selector>
+
+/*
+.calendar_holly{
+ background-color : #ffebda; /*unknown parameter - need to add
+ color : #ff7800; /*unknown parameter - need to add
+}
+*/
+/*
+.calendar_current{
+ background-color : #ff7800; /*unknown parameter - need to add
+ color : #ffebda; /*unknown parameter - need to add
+ font-weight : bold;
+}
+*/
+/*
+.calendar_spec{
+ background-color : #e4f5e2; /*unknown parameter - need to add
+}
+*/
+ <u:selector name=".calendar_current">
+ <u:style name="background-color" value="#ff7800"/> /*unknown parameter - need to add*/
+ <u:style name="color" value="#ffebda"/> /*unknown parameter - need to add*/
+ <u:style name="font-weight" value="bold"/>
+ </u:selector>
+
+ <u:selector name=".calendar_select">
+ <u:style name="background-color" skin="headerBackgroundColor"/>
+ <u:style name="color" skin="headerTextColor"/>
+ </u:selector>
+
+ <u:selector name=".calendar_select">
+ <u:style name="background-color" skin="headerBackgroundColor"/>
+ <u:style name="color" skin="headerTextColor"/>
+ </u:selector>
+
+ <u:selector name=".calendar_toolfooter">
+ <u:style name="border-top" skin="panelBorderColor"/>
+ <u:style name="border-right" skin="panelBorderColor"/>
+ <u:style name="background" skin="additionalBackgroundColor"/>
+ <u:style name="font-size" skin="generalSizeFont"/>
+ <u:style name="font-family" skin="generalFamilyFont"/>
+ </u:selector>
+
+ <u:selector name=".calendar_footer">
+ <u:style name="border-top" skin="panelBorderColor"/>
+ <u:style name="border-right" skin="panelBorderColor"/>
+ <u:style name="background" skin="additionalBackgroundColor"/>
+ <u:style name="font-size" skin="generalSizeFont"/>
+ <u:style name="font-family" skin="generalFamilyFont"/>
+ </u:selector>
+
+</f:template>
\ No newline at end of file
Added: trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
===================================================================
--- trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js (rev 0)
+++ trunk/sandbox/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2007-07-19 19:23:27 UTC (rev 1707)
@@ -0,0 +1,752 @@
+if(!window.LOG){
+ window.LOG = {warn:function(){}};
+}
+
+//if (!window.Richfaces) window.Richfaces={};
+
+Object.extend(Event, {
+ findElementByAttr : function(event, tagName, attribute, value, flag) {
+ var element = Event.findElement(event, tagName);
+ while (!element[attribute] || (flag ? element[attribute].indexOf(value)!=0 : element[attribute]!=value) )
+ {
+ element = element.parentNode;
+ }
+ return element;
+ }
+});
+
+Object.extend(Element, {
+ replaceClassName : function (element, whichClassName, toClassName) {
+ if (!(element = $(element))) return;
+ var e = Element.classNames(element);
+ e.remove(whichClassName);
+ e.add(toClassName);
+ return element;
+ }
+});
+
+/* Year:
+ * yy - 00-99
+ * y,yyy+ - 1999
+ * Month:
+ * M - 1-12
+ * MM - 01-12
+ * MMM - short (Jul)
+ * MMMM+ - long (July)
+ * Date:
+ * d - 1-31
+ * dd+ - 01-31 */
+Object.extend(Date.prototype, {
+ format : function(pattern, monthNames, monthNamesShort) {
+ if (!monthNames) monthNames = ['January','February','March','April','May','June','July','August','September','October','November','December'];
+ if (!monthNamesShort) monthNamesShort = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
+ var d = this; var mm; var dd;
+ return pattern.replace(/(yy^y|y+|M^M|MM^M|MMM^M|M+|d^d|d+)/g,
+ function($1) {
+ switch ($1) {
+ case 'yy': return d.getYear().toString().substr(-2);
+ case 'M': return d.getMonth()+1;
+ case 'MM': return (mm = d.getMonth()+1)<10 ? '0'+mm : mm;
+ case 'MMM': return monthNamesShort[d.getMonth()];
+ case 'd': return d.getDate();
+ }
+ // y+,M+,d+
+ var ch = $1.charAt(0);
+ if (ch=='y') return d.getFullYear();
+ if (ch=='M') return monthNames[d.getMonth()];
+ if (ch=='d') return (dd = d.getDate())<10 ? '0'+dd : dd;
+ }
+ );
+ }
+});
+
+function isLeapYear(year) {
+ return new Date(year, 1, 29).getDate()==29;
+}
+
+function daysInMonth(year,month) {
+ return 32 - new Date(year, month, 32).getDate();
+}
+
+function daysInMonthByDate(date) {
+ return 32 - new Date(date.getYear(), date.getMonth(), 32).getDate();
+}
+
+function getDay(date, firstWeekDay ) {
+ var value = date.getDay() - firstWeekDay;
+ if (value < 0) value = 7 + value;
+ return value;
+}
+
+function getFirstWeek(year, mdifw, fdow) {
+ var date = new Date(year,0,1);
+ var firstday = getDay(date, fdow);
+
+ var weeknumber = (7-firstday<mdifw) ? 0 : 1;
+
+ return {date:date, firstDay:firstday, weekNumber:weeknumber, mdifw:mdifw, fdow:fdow};
+}
+
+function getLastWeekOfPrevYear(o) {
+ var year = o.date.getFullYear()-1;
+ var days = (isLeapYear(year) ? 366 : 365);
+ var obj = getFirstWeek(year, o.mdifw, o.fdow);
+ days = (days - 7 + o.firstDay);
+ var weeks = Math.floor(days/7)+1;
+
+ return weeks+obj.weekNumber;
+}
+
+function weekNumber(year, month, mdifw, fdow) {
+
+ var o = getFirstWeek(year, mdifw, fdow);
+
+ if (month==0)
+ {
+ if (o.weekNumber==1) return 1;
+ return getLastWeekOfPrevYear(o);
+ }
+ var oneweek = 604800000;
+ var d = new Date(year, month,1);
+ d.setDate( 1+o.firstDay + (getDay(d,fdow)==0?1:0));
+
+ weeknumber = o.weekNumber + Math.floor((d.getTime() - o.date.getTime()) / oneweek);
+
+ return weeknumber;
+}
+
+Calendar = Class.create();
+Object.extend(Calendar.prototype, {
+ initialize: function(id,parameters) {
+
+ // dayListTableId, weekNumberBarId, weekDayBarId - 3 tables ids',
+ // dayListMarkup - day cell markup
+ // weekNumberMarkup - week number cell markup
+ // weekDayMarkup - week day cell markup
+
+ // currentDate - date to show month (day not used) (mm/yyyy)
+ // selectedDate - selected date (mm/dd/yyyy)
+ // weekDayLabels - collection of week day labels keyed by week day numbers
+ // minDaysInFirstWeek - locale-specific constant defining number of days in the first week
+ // firstWeekDay - (0..6) locale-specific constant defining number of the first week day
+ // showWeekDaysBar - show WeekDays Bar [default value is true]
+ // showWeeksBar - show Weeks numbers bar [default value is true]
+
+ // headerHtml - user defined header (optional)
+ // footeHtml - user defined footer (optional)
+
+ // direction - [top-left, top-right, bottom-left, bottom-right, auto]
+ // jointPoint
+ // popup - true
+ // userClasses - inputClass, inputDisabledClass, inputInvalidClass, buttonClass, buttonDisabledClass
+ // id+PopupButton, id+PopupInput,
+
+
+ this.id = id;
+ this.params = parameters;
+ if (!this.params.showWeekDaysBar) this.params.showWeekDaysBar = true;
+ if (!this.params.showWeeksBar) this.params.showWeeksBar = true;
+ if (this.params.monthLabels) this.params.monthLabels.push(this.params.monthLabels[0]);
+ if (!this.params.datePattern) this.params.datePattern = "MMM d, y"
+
+ this.currentDate = this.params.currentDate ? this.params.currentDate : new Date();
+ this.selectedDate = this.params.selectedDate;
+
+ this.todayDate = new Date();
+
+ this.selectedDateElement;
+
+ this.firstWeekendDayNumber = 6-this.params.firstWeekDay;
+ this.secondWeekendDayNumber = (this.params.firstWeekDay>0 ? 7-this.params.firstWeekDay : 0);
+
+ this.calendarContext = new CalendarContext(this);
+
+ /*this.ids = {
+ currentYearMonthId: this.id+':currentyearmonth'
+ };*/
+
+ this.daysData = {startDate:null, days:[]};
+ this.days = [];
+
+ var htmlTextHeader = '<input id="'+this.id+'InputSelectedDate" name="'+this.id+'InputSelectedDate" type="hidden" value="'+this.getSelectedDateString(this.params.datePattern)+'"/>\n' +
+ '<input id="'+this.id+'InputCurrentDate" name="'+this.id+'InputCurrentDate" type="hidden" value="'+this.getCurrentDate().format("MM/y")+'"/>\n' +
+ '<table border="0" cellpadding="0" cellspacing="0" class="calendar_exterior"><tbody>\n';
+ var colspan = (this.params.showWeeksBar ? "8" : "7");
+ var htmlHeaderOptional = (this.params.headerHtml && this.params.headerHtml!='') ? '<tr><td class="calendar_header" colspan="'+colspan+'">'+this.params.headerHtml+'</td></tr>' : '';
+ var htmlFooterOptional = (this.params.footerHtml && this.params.footerHtml!='') ? '<tr><td class="calendar_footer" colspan="'+colspan+'">'+this.params.footerHtml+'</td></tr>' : '';
+ var htmlControlsHeader = '<tr><td colspan="'+colspan+'" id="'+this.id+':header"></td></tr>'
+ var htmlControlsFooter = '<tr><td colspan="'+colspan+'" id="'+this.id+':footer"></td></tr>'
+ var htmlTextFooter = '</tbody></table>\n';
+
+ // days bar creation
+ var styleClass;
+ var bottomStyleClass;
+ var htmlTextWeekDayBar='';
+ if (this.params.showWeekDaysBar)
+ {
+ var htmlTextWeekDayBar = '<tr id="'+this.params.weekDayBarId+'">';
+ if (this.params.showWeeksBar) htmlTextWeekDayBar+='<td style="calendar_days"><br/></td>';
+ var weekDayCounter = this.params.firstWeekDay;
+ for (var i=0;i<7;i++)
+ {
+ var weekDayHtml = this.params.weekDayMarkup( {weekDayLabel: this.params.weekDayLabels[weekDayCounter], weekDayNumber:weekDayCounter, componentId:this.getWeekDayComponentId(i)} );
+ if (weekDayCounter==6) weekDayCounter=0; else weekDayCounter++;
+
+ styleClass = (i==this.firstWeekendDayNumber || i==this.secondWeekendDayNumber ? "Weekendclass" : "calendar_days");
+ if (i==6) styleClass +=" right_cell";
+ htmlTextWeekDayBar+='<td class="'+styleClass+'">'+weekDayHtml+'</td>';
+ }
+ htmlTextWeekDayBar+='</tr>\n';
+ }
+
+ // week & weekNumber creation
+ var htmlTextWeek='';
+ var p=0;
+
+ for (k=1;k<7;k++)
+ {
+ htmlTextWeek+='<tr id="'+this.params.weekNumberBarId+k+'">';
+ if (this.params.showWeeksBar)
+ {
+ var weekNumberHtml = this.params.weekNumberMarkup( {weekNumber: k, componentId:this.getWeekNumberComponentId(k-1)} );
+ htmlTextWeek+='<td class="calendar_week">'+weekNumberHtml+'</td>';
+ }
+
+ // day cells creation
+ bottomStyleClass = (k==6 ? "bottom_cell " : "");
+ for (var i=0;i<7;i++)
+ {
+ styleClass = bottomStyleClass+"cell_size calendar_cell calendar_btn";
+ if (i==this.firstWeekendDayNumber || i==this.secondWeekendDayNumber) styleClass+=" calendar_holly";
+ if (i==6) styleClass+=" right_cell";
+
+ htmlTextWeek+='<td class="'+styleClass+'" id="'+this.params.dayListTableId+'Cell'+p+'"></td>';
+ p++;
+ }
+ htmlTextWeek+='</tr>';
+ }
+
+ // footer
+
+
+ // set content
+ var obj=$(id);
+ obj.component = this;
+ obj.richfacesComponent="richfaces:calendar";
+ obj.innerHTML = htmlTextHeader+htmlHeaderOptional+htmlControlsHeader+htmlTextWeekDayBar+htmlTextWeek+htmlControlsFooter+htmlFooterOptional+htmlTextFooter;
+
+ this.submitFunction = this.params.submitFunction.bind(this);
+ this.prepareEvents();
+ },
+
+ getWeekDayComponentId: function (v) {
+ return this.id+"WeekDay"+v;
+ },
+
+ getWeekNumberComponentId: function (v) {
+ return this.id+"WeekNumber"+v;
+ },
+
+ getDateComponentId: function (v) {
+ return this.id+"Date"+v;
+ },
+
+ getCurrentDate: function() {
+ return this.currentDate;
+ },
+ getSelectedDate: function() {
+ if (!this.selectedDate) return null; else return this.selectedDate;
+ },
+ getSelectedDateString: function(pattern) {
+ if (!this.selectedDate) return "";
+ if (!pattern) pattern = "dd/MM/y";
+ return this.selectedDate.format(pattern, this.params.monthLabels, this.params.monthLabelsShort);
+ },
+
+ getPrevYear: function() {
+ var value = this.currentDate.getFullYear()-1;
+ if (value<0) value = 0;
+ return value;
+ },
+ getPrevMonth: function(asMonthLabel) {
+ var value = this.currentDate.getMonth()-1;
+ if (value < 0 ) value = 11;
+ if (asMonthLabel)
+ {
+ return this.params.monthLabels[value];
+ } else return value;
+ },
+ getCurrentYear: function() {
+ return this.currentDate.getFullYear();
+ },
+ getCurrentMonth: function(asMonthLabel) {
+ var value = this.currentDate.getMonth();
+ if (asMonthLabel)
+ {
+ return this.params.monthLabels[value];
+ } else return value;
+ },
+ getNextYear: function() {
+ return this.currentDate.getFullYear()+1;
+ },
+ getNextMonth: function(asMonthLabel) {
+ var value = this.currentDate.getMonth()+1;
+ if (value > 11 ) value = 0;
+ if (asMonthLabel)
+ {
+ return this.params.monthLabels[value];
+ } else return value;
+ },
+
+ isWeekend: function(weekday) {
+ return (weekday == this.firstWeekendDayNumber || weekday == this.secondWeekendDayNumber);
+ },
+
+ prepareEvents: function() {
+ this.eventCellOnClick = this.eventCellOnClick.bindAsEventListener(this);
+ this.eventCellOnMouseOver = this.eventCellOnMouseOver.bindAsEventListener(this);
+ this.eventCellOnMouseOut = this.eventCellOnMouseOut.bindAsEventListener(this);
+ },
+
+ setCellEvents: function(obj) {
+ Event.observe(obj, "click", this.eventCellOnClick, false);
+ Event.observe(obj, "mouseover", this.eventCellOnMouseOver, false);
+ Event.observe(obj, "mouseout", this.eventCellOnMouseOut, false);
+ },
+ stopCellEvents: function(obj) {
+ Event.stopObserving(obj, "click", this.eventCellOnClick, false);
+ Event.stopObserving(obj, "mouseover", this.eventCellOnMouseOver, false);
+ Event.stopObserving(obj, "mouseout", this.eventCellOnMouseOut, false);
+ },
+
+ eventCellOnClick: function (e) {
+ var idstr = this.params.dayListTableId+'Cell';
+ var obj = Event.findElementByAttr(e, "TD", "id", idstr, true);
+ if (obj)
+ {
+ var daydata = this.days[parseInt(obj.id.substr(idstr.length))];
+ if (daydata._month==0)
+ {
+ this.selectedDate=new Date(this.currentDate);
+ this.selectedDate.setDate(obj.data);
+ if (this.selectedDateElement) Element.removeClassName(this.selectedDateElement, "Selecteddayclass");
+ this.selectedDateElement = obj;
+ Element.addClassName(obj, "Selecteddayclass");
+
+ $(this.id+'InputSelectedDate').value=this.getSelectedDateString(this.params.datePattern);
+ this.renderFooter();
+ } else {
+ if (daydata._month==-1) this.prevMonth(); else this.nextMonth();
+ }
+ }
+ },
+
+ eventCellOnMouseOver: function (e) {
+ var idstr = this.params.dayListTableId+'Cell';
+ var obj = Event.findElementByAttr(e, "TD", "id", idstr, true);
+ if (obj)
+ {
+ var daydata = this.days[parseInt(obj.id.substr(idstr.length))];
+ if (daydata._month==0 && Element.hasClassName(obj,daydata._className)) Element.replaceClassName(obj,daydata._className, daydata._hoverClassName);
+ }
+ },
+
+ eventCellOnMouseOut: function (e) {
+ var idstr = this.params.dayListTableId+'Cell';
+ var obj = Event.findElementByAttr(e, "TD", "id", idstr, true);
+ if (obj)
+ {
+ var daydata = this.days[parseInt(obj.id.substr(idstr.length))];
+ if (daydata._month==0 && Element.hasClassName(obj,daydata._hoverClassName)) Element.replaceClassName(obj,daydata._hoverClassName, daydata._className);
+ }
+ },
+
+ load:function(daysData, isAjaxMode) {
+ // startDate,
+ // days:array[]
+ // {
+ // data
+ // enabled boolean or function
+ // isEnabled function
+ // text1: 'Meeting...',
+ // text2: 'Meeting...'
+ // tooltip
+ // hasTooltip
+ // dayStyleClass
+ // }
+
+ if (daysData) {
+ this.daysData = this.indexData(daysData, isAjaxMode);
+ } else {
+ this.daysData = null;
+ }
+
+ this.render();
+ },
+
+ indexData:function(daysData, isAjaxMode) {
+ var dateYear = daysData.startDate.getFullYear();
+ var dateMonth = daysData.startDate.getMonth();
+
+ daysData.index = [];
+ daysData.index[dateYear+'-'+dateMonth] = 0;
+ if (isAjaxMode)
+ {
+ this.currentDate = daysData.startDate;
+ this.currentDate.setDate(1);
+ return daysData;
+ }
+ var idx = daysInMonthByDate(daysData.startDate)-daysData.startDate.getDate()+1;
+
+ while (daysData.days[idx])
+ {
+ if (dateMonth==11) {dateYear++; dateMonth=0;} else dateMonth++;
+ daysData.index[dateYear+'-'+dateMonth] = idx;
+ idx+= (32 - new Date(dateYear, dateMonth, 32).getDate());
+ }
+ return daysData;
+ },
+
+ render:function() {
+ this.todayDate = new Date();
+
+ var currentYear = this.getCurrentYear();
+ var currentMonth = this.getCurrentMonth();
+
+ var todayflag = (currentYear == this.todayDate.getFullYear() && currentMonth == this.todayDate.getMonth());
+ var todaydate = this.todayDate.getDate();
+
+ var selectedflag = (currentYear == this.selectedDate.getFullYear() && currentMonth == this.selectedDate.getMonth())
+ var selecteddate = this.selectedDate.getDate();
+
+ var wd = getDay(this.currentDate, this.params.firstWeekDay);
+ var currentMonthDays = daysInMonthByDate(this.currentDate);
+ var previousMonthDays = daysInMonth(currentYear, currentMonth-1);
+
+ var p=0;
+ var month=-1;
+ this.days = [];
+ var dayCounter = previousMonthDays - wd + 1;
+
+ // previuos month days
+ if (wd>0) while (dayCounter<=previousMonthDays) {this.days.push({day:dayCounter, _isWeekend: this.isWeekend(p), _month:month, _className:"Disableddayclass"}); dayCounter++; p++; }
+ dayCounter = 1;
+ month=0;
+
+ // current month days
+ if (this.daysData && this.daysData.index[currentYear+'-'+currentMonth]!=undefined)
+ {
+ var idx = this.daysData.index[currentYear+'-'+currentMonth];
+ var firstDay = this.daysData.days[idx].day;
+ while (dayCounter<firstDay)
+ {
+ if (this.isWeekend(p%7))
+ this.days.push({day:dayCounter, _isWeekend: true, _month:month, _className:"Weekenddayclass", _hoverClassName:"Hoveredweekclass"});
+ else
+ this.days.push({day:dayCounter, _isWeekend: false, _month:month, _className:"Commondayclass", _hoverClassName:"Hovereddayclass"});
+
+ dayCounter++;
+ p++;
+ }
+
+ var len = this.daysData.days.length;
+ var obj;
+ var flag;
+ while (idx<len && dayCounter<=currentMonthDays)
+ {
+ flag = this.isWeekend(p%7);
+ obj = this.daysData.days[idx];
+ obj.day = dayCounter;
+ obj._isWeekend = flag;
+ obj._month = month;
+ if (flag) {obj._className = "Weekenddayclass"; obj._hoverClassName = "Hoveredweekclass";}
+ else {obj._className = "Commondayclass"; obj._hoverClassName = "Hovereddayclass";}
+ this.days.push(obj);
+ idx++;
+ dayCounter++;
+ p++;
+ }
+ }
+ while (p<42)
+ {
+ if (dayCounter>currentMonthDays) {dayCounter=1; month=1;}
+ if (this.isWeekend(p%7))
+ this.days.push({day:dayCounter, _isWeekend: true, _month:month, _className:"Weekenddayclass", _hoverClassName:"Hoveredweekclass"});
+ else
+ this.days.push({day:dayCounter, _isWeekend: false, _month:month, _className:"Commondayclass", _hoverClassName:"Hovereddayclass"});
+ dayCounter++;
+ p++;
+ }
+
+ // render
+ this.renderHeader();
+ this.renderFooter();
+
+ //days render
+ p=0;
+ var element;
+ var dataobj;
+ var wn;
+ if (this.params.showWeeksBar) wn = weekNumber(currentYear, currentMonth, this.params.minDaysInFirstWeek, this.params.firstWeekDay); /// fix it
+ this.selectedDayElement=null;
+ var weekflag=true;
+
+ var e;
+
+ //var _d=new Date();
+
+ for (var k=1;k<7;k++)
+ {
+ //
+ dataobj = this.days[p];
+
+ var obj = $(this.params.weekNumberBarId+k);
+ element = obj.firstChild;
+
+ // week number update
+ if (this.params.showWeeksBar)
+ {
+ if (weekflag && currentMonth==11 &&
+ (k==5||k==6) &&
+ (dataobj._month==1 || (currentMonthDays-dataobj.day+1)<this.params.minDaysInFirstWeek) )
+ {
+ wn=1;
+ weekflag=false;
+ }
+ element.innerHTML = this.params.weekNumberMarkup( {weekNumber: wn++, componentId:this.getWeekNumberComponentId(k-1)} );
+ if (k==1&&wn>52) wn=1;
+ element = element.nextSibling;
+ }
+
+ while (element)
+ {
+ // TODO calendar_spec class not implemented
+ // TODO fix start/stop event's calls
+ this.stopCellEvents(element);
+
+ element.data=dataobj.day;
+ dataobj.componentId=this.getDateComponentId(p);
+ element.innerHTML = this.params.dayListMarkup( dataobj );
+
+ // class styles
+ e = Element.classNames(element);
+ // ?? dataobj._className
+ // TODO make some optimization with calendar_current class
+ if (todayflag && dataobj._month==0 && dataobj.day==todaydate) e.add("calendar_current"); else e.remove("calendar_current");
+ if (selectedflag && dataobj._month==0 && dataobj.day==selecteddate) {
+ this.selectedDateElement = element;
+ e.add("Selecteddayclass");
+ }
+
+ this.setCellEvents(element);
+ p++;
+
+ dataobj = this.days[p];
+ element=element.nextSibling;
+ }
+ }
+ //alert(new Date().getTime()-_d.getTime());
+ },
+ renderHeader: function()
+ {
+ var header = $(this.id+":header");
+ if (header)
+ {
+ header.innerHTML = Calendar.header.getContent(this.calendarContext);
+ }
+ },
+
+ renderFooter: function()
+ {
+ var footer = $(this.id+":footer");
+ if (footer)
+ {
+ footer.innerHTML = Calendar.footer.getContent(this.calendarContext);
+ }
+ },
+
+ onUpdate: function()
+ {
+ $(this.id+'InputCurrentDate').value=this.getCurrentDate().format("MM/y");
+
+ if (this.submitFunction)
+ this.submitFunction(this.getCurrentMonth() + '/' + this.getCurrentYear());
+ else
+ this.render();
+ },
+
+ nextMonth: function() {
+ this.currentDate = new Date(this.currentDate.getFullYear(), this.currentDate.getMonth()+1,1);
+ this.onUpdate();
+ },
+
+ prevMonth: function() {
+ this.currentDate = new Date(this.currentDate.getFullYear(), this.currentDate.getMonth()-1,1);
+ this.onUpdate();
+ },
+
+ nextYear: function() {
+ this.currentDate = new Date(this.currentDate.getFullYear() + 1, this.currentDate.getMonth(),1);
+ this.onUpdate();
+ },
+
+ prevYear: function() {
+ this.currentDate = new Date(this.currentDate.getFullYear() - 1, this.currentDate.getMonth(),1);
+ this.onUpdate();
+ },
+
+ today: function() {
+ var now = new Date();
+ var nowyear = now.getFullYear();
+ var nowmonth = now.getMonth();
+ var nowdate = now.getDate();
+ var updateflag = false;
+
+ if (nowdate!=this.todayDate.getDate()) {updateflag=true; this.todayDate = now;}
+
+ if (nowyear != this.currentDate.getFullYear() || nowmonth != this.currentDate.getMonth() )
+ {
+ updateflag = true;
+ this.currentDate = new Date(nowyear, nowmonth, 1);
+ }
+
+ if (updateflag) this.onUpdate();
+ },
+
+ help: function() {
+ alert("Calendar help");
+ }
+
+});
+
+Calendar.getDayView = function(context) {
+ return Richfaces.evalSimpleMacro("day", context);
+};
+
+Calendar.getWeekNumberView = function(context) {
+ return Richfaces.evalSimpleMacro("weekNumber", context);
+};
+
+Calendar.getWeekDayView = function(context) {
+ return Richfaces.evalSimpleMacro("weekDayLabel", context);
+};
+
+Calendar.getControl = function(context, attributes, text, functionName) {
+ var attr = {
+ onclick: (functionName ? "Richfaces.invokeOnComponent('richfaces:calendar',this,'"+functionName+"');" : "")+"return false;",
+ width: "100%"
+ };
+
+ if (attributes) {
+ Object.extend(attr, attributes);
+ }
+ return new E('div',attr,[new T(text)]);
+};
+
+Calendar.nextYearControl = function(context) {
+ //return Calendar.getControl(context, null, ">> "+context.calendar.getNextYear(), "nextYear");
+ return Calendar.getControl(context, null, "��", "nextYear");
+};
+Calendar.previousYearControl = function(context) {
+ //return Calendar.getControl(context, null, context.calendar.getPrevYear()+" <<", "prevYear");
+ return Calendar.getControl(context, null, "��", "prevYear");
+};
+Calendar.nextMonthControl = function(context) {
+ //return Calendar.getControl(context, null, "> "+context.calendar.getNextMonth(true), "nextMonth");
+ return Calendar.getControl(context, null, "�", "nextMonth");
+};
+Calendar.previousMonthControl = function(context) {
+ //return Calendar.getControl(context, null, context.calendar.getPrevMonth(true)+" <", "prevMonth");
+ return Calendar.getControl(context, null, "�", "prevMonth");
+};
+Calendar.currentMonthControl = function(context) {
+ var value =context.calendar.getCurrentDate().format("MMMM, y", context.monthLabels, context.monthLabelsShort);
+ return value;
+};
+Calendar.todayControl = function(context) {
+ return Calendar.getControl(context, null, "Today", "today");
+};
+Calendar.selectedDateControl = function(context) {
+ var value = Calendar.getControl(context, null, context.calendar.getSelectedDateString(context.calendar.params.datePattern), "prevMonth");
+ return value;
+};
+Calendar.helpControl = function(context)
+{
+ return Calendar.getControl(context, null, "Help", "help");
+};
+
+
+Calendar.header =
+ new E('table',{'border': '0', 'cellpadding': '0', 'cellspacing': '0', 'width': '100%'},
+ [
+ new E('tbody',{},
+ [
+ new E('tr',{},
+ [
+ new E('td',{'class': 'calendar_tool calendar_btn'},
+ [
+ new ET(function (context) { return Richfaces.evalMacro("previousYearControl", context)})
+ ]),
+ new E('td',{'class': 'calendar_tool calendar_btn'},
+ [
+ new ET(function (context) { return Richfaces.evalMacro("previousMonthControl", context)})
+ ]),
+ new E('td',{'class': 'calendar_month'},
+ [
+ new ET(function (context) { return Richfaces.evalMacro("currentMonthControl", context)})
+ ]),
+ new E('td',{'class': 'calendar_tool calendar_btn'},
+ [
+ new ET(function (context) { return Richfaces.evalMacro("nextMonthControl", context)})
+ ]),
+ new E('td',{'class': 'calendar_tool calendar_btn'},
+ [
+ new ET(function (context) { return Richfaces.evalMacro("nextYearControl", context)})
+ ])
+ ])
+ ])
+ ]
+ );
+
+Calendar.footer =
+ new E('table',{'border': '0', 'cellpadding': '0', 'cellspacing': '0', 'width': '100%'},
+ [
+ new E('tbody',{},
+ [
+ new E('tr',{},
+ [
+ new E('td',{'class': 'calendar_toolfooter', 'style': 'white-space:nowrap'},
+ [
+ new ET(function (context) { return Richfaces.evalMacro("Calendar.selectedDateControl", context)})
+ ]),
+ new E('td',{'class': 'calendar_toolfooter calendar_btn', 'width': '100%'},
+ [
+ new ET(function (context) { return Richfaces.evalMacro("Calendar.helpControl", context)})
+ ]),
+ new E('td',{'class': 'calendar_toolfooter calendar_btn', 'align': 'right'},
+ [
+ new ET(function (context) { return Richfaces.evalMacro("Calendar.todayControl", context)})
+ ])
+ ])
+ ])
+ ]
+ );
+
+
+CalendarContext = Class.create();
+Object.extend(CalendarContext.prototype, {
+ initialize: function(calendar) {
+ this.calendar=calendar;
+ this.monthLabels=calendar.params.monthLabels;
+ this.monthLabelsShort=calendar.params.monthLabelsShort;
+ },
+
+ nextYearControl: Calendar.nextYearControl,
+ previousYearControl: Calendar.previousYearControl,
+ nextMonthControl: Calendar.nextMonthControl,
+ previousMonthControl: Calendar.previousMonthControl,
+ currentMonthControl: Calendar.currentMonthControl,
+ todayControl: Calendar.todayControl,
+ selectedDateControl: Calendar.selectedDateControl,
+ helpControl: Calendar.helpControl,
+});
\ No newline at end of file
Modified: trunk/sandbox/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
===================================================================
--- trunk/sandbox/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2007-07-19 18:53:25 UTC (rev 1706)
+++ trunk/sandbox/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2007-07-19 19:23:27 UTC (rev 1707)
@@ -1,21 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
-<f:root
- xmlns:f="http://ajax4jsf.org/cdk/template"
- xmlns:c=" http://java.sun.com/jsf/core"
+<f:root xmlns:f="http://ajax4jsf.org/cdk/template"
+ xmlns:c=" http://java.sun.com/jsf/core"
xmlns:ui=" http://ajax4jsf.org/cdk/ui"
xmlns:u=" http://ajax4jsf.org/cdk/u"
xmlns:x=" http://ajax4jsf.org/cdk/x"
xmlns:vcp=" http://ajax4jsf.org/cdk/vcp"
class="org.richfaces.renderkit.html.CalendarRenderer"
baseclass="org.richfaces.renderkit.CalendarRendererBase"
- component="org.richfaces.component.UICalendar"
- >
- <f:clientid var="clientId"/>
- <h:scripts>new org.ajax4jsf.javascript.PrototypeScript(),new org.ajax4jsf.javascript.AjaxScript(),/org/richfaces/renderkit/html/scripts/utils.js,/org/richfaces/renderkit/html/scripts/json/json-dom.js</h:scripts>
+ component="org.richfaces.component.UICalendar">
+ <f:clientid var="clientId" />
+ <h:scripts>new org.ajax4jsf.framework.resource.PrototypeScript(),new org.ajax4jsf.framework.ajax.AjaxScript(),/org/richfaces/renderkit/html/scripts/utils.js,/org/richfaces/renderkit/html/scripts/json/json-dom.js,/org/richfaces/renderkit/html/scripts/calendar.js</h:scripts>
+ <h:styles>/org/richfaces/renderkit/html/css/calendar.xcss</h:styles>
+
<div id="#{clientId}"
- x:passThruWithExclusions="value,name,type,id"
- >
-
- <vcp:body />
+ style="display:inline; width: #{this:qualifySize(component.attributes['width'])}; height: #{this:qualifySize(component.attributes['height'])}; #{component.attributes['style']}"
+ class="#{component.attributes['styleClass']}"
+ x:passThruWithExclusions="value,name,type,id"><script
+ type="text/javascript">
+ new Calendar('#{clientId}', {
+ submitFunction:
+ <jsp:scriptlet>/*<![CDATA[*/
+ writeSubmitFunction(context, component);
+ /*]]>*/</jsp:scriptlet>,
+ dayListTableId: '#{clientId}Day',
+ weekNumberBarId: '#{clientId}WeekNum',
+ weekDayBarId: '#{clientId}WeekDay',
+ currentDate: new Date(2007,6,1),
+ selectedDate: new Date(2007,4,5),
+ weekDayLabels: ['Sun','Mon','Tue','Wen','Thu','Fri','Sat'],
+ monthLabels: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
+ monthLabelsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
+ firstWeekDay: 0,
+ minDaysInFirstWeek: 4,
+ headerHtml: '<b>User defined header</b>',
+ footerHtml: 'User defined footer',
+ dayListMarkup:
+ <jsp:scriptlet>/*<![CDATA[*/
+ if (component.getChildCount() != 0) {
+ writeMarkupScriptBody(context, component, true);
+ } else {
+ /*]]>*/</jsp:scriptlet>
+ Calendar.getDayView
+ <jsp:scriptlet>/*<![CDATA[*/
+ }
+ /*]]>*/</jsp:scriptlet>
+ ,
+
+ weekDayMarkup: <jsp:scriptlet>/*<![CDATA[*/
+ UIComponent weekDayFacet = component.getFacet("weekDay");
+ if (weekDayFacet != null && weekDayFacet.isRendered()) {
+ writeMarkupScriptBody(context, weekDayFacet, false);
+ } else {
+ /*]]>*/</jsp:scriptlet>
+ Calendar.getWeekDayView
+ <jsp:scriptlet>/*<![CDATA[*/
+ }
+ /*]]>*/</jsp:scriptlet>
+ ,
+
+ weekNumberMarkup: <jsp:scriptlet>/*<![CDATA[*/
+ UIComponent weekNumberFacet = component.getFacet("weekNumber");
+ if (weekNumberFacet != null && weekNumberFacet.isRendered()) {
+ writeMarkupScriptBody(context, weekNumberFacet, false);
+ } else {
+ /*]]>*/</jsp:scriptlet>
+ Calendar.getWeekNumberView
+ <jsp:scriptlet>/*<![CDATA[*/
+ }
+ /*]]>*/</jsp:scriptlet>
+ }).load(
+ <jsp:scriptlet>/*<![CDATA[*/
+ writePreloadBody(context, component);
+ /*]]>*/</jsp:scriptlet>
+ );
+ </script> <jsp:scriptlet>
+ <![CDATA[
+ boolean popup = attributeToBoolean(component, "popup");
+ if (popup) {]]>
+ </jsp:scriptlet>
+ <span> <input
+ x:passThruWithExclusions="name,id"
+ value="#{this:getInputValue(context,component)}"
+ type="text"
+ readonly="#{component.attributes['readonly']}"
+ disabled="#{component.attributes['disabled']}"
+ accesskey="#{component.attributes['accesskey']}"
+ maxlength="#{component.attributes['maxlength']}"
+ onchange="#{component.attributes['onchange']}"
+ onselect="#{component.attributes['onselect']}"
+ onfocus="#{component.attributes['onfocus']}"
+ onblur="#{component.attributes['onblur']}"
+ size="#{component.attributes['inputSize']}"
+ style="#{component.attributes['style']}"
+ tabindex="#{component.attributes['tabindex']}"
+ class="#{component.attributes['class']}"
+ onclick="#{component.attributes['onclick']}">
+ </input>
+ <button id="#{clientId}Button"
+ accesskey="#{component.attributes['accesskey']}"
+ class="#{component.attributes['class']}"
+ name="#{clientId}"
+ onclick="#{component.attributes['onclick']}"
+ value="#{component.attributes['value']"
+ style="#{component.attributes['style']}"
+ tabindex="#{component.attributes['tabindex']}"
+ type="button">
+ </button>
+ </span>
+ <jsp:scriptlet>
+ <![CDATA[
+ }
+ ]]>
+ </jsp:scriptlet>
</div>
-</f:root>
\ No newline at end of file
+</f:root>
Modified: trunk/sandbox/ui/calendar/src/test/java/org/richfaces/component/CalendarComponentTest.java
===================================================================
--- trunk/sandbox/ui/calendar/src/test/java/org/richfaces/component/CalendarComponentTest.java 2007-07-19 18:53:25 UTC (rev 1706)
+++ trunk/sandbox/ui/calendar/src/test/java/org/richfaces/component/CalendarComponentTest.java 2007-07-19 19:23:27 UTC (rev 1707)
@@ -3,10 +3,14 @@
*/
package org.richfaces.component;
+import java.util.Calendar;
+import java.util.Date;
import java.util.List;
+import java.util.Locale;
import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
+import javax.faces.component.html.HtmlForm;
import javax.faces.component.html.HtmlOutputText;
import org.ajax4jsf.tests.AbstractAjax4JsfTestCase;
@@ -19,12 +23,35 @@
*
*/
public class CalendarComponentTest extends AbstractAjax4JsfTestCase {
+
+
+ private UIComponent form;
+ private UICalendar calendar;
+
public CalendarComponentTest(String name) {
super(name);
}
-
- public void testTidy() throws Exception {
+
+ public void setUp()throws Exception{
+
+ super.setUp();
+
+ form = new HtmlForm();
+ form.setId("form");
+ facesContext.getViewRoot().getChildren().add(form);
+
+ calendar = (UICalendar) application.createComponent(UICalendar.COMPONENT_TYPE);
+ calendar.setLocale(Locale.CHINESE);
+ Calendar calendarObject = Calendar.getInstance();
+ calendarObject.set(2001, Calendar.SEPTEMBER, 11);
+ calendar.setId("calendar");
+
+ form.getChildren().add(calendar);
+
+ }
+
+/* public void testTidy() throws Exception {
UIViewRoot viewRoot = facesContext.getViewRoot();
List children = viewRoot.getChildren();
UIComponent calendar = application.createComponent(UICalendar.COMPONENT_TYPE);
@@ -37,4 +64,71 @@
HtmlPage renderView = renderView();
System.out.println(renderView.asXml());
}
+*/
+ public void testPreloadRanges() throws Exception {
+ UICalendar calendar = (UICalendar) application.createComponent(UICalendar.COMPONENT_TYPE);
+ calendar.setLocale(Locale.FRENCH);
+ Calendar calendarObject = Calendar.getInstance();
+ calendarObject.set(2007, Calendar.JUNE, 10);
+
+ Calendar preloadRangeBegin = Calendar.getInstance();
+ preloadRangeBegin.setTime(calendar.getDefaultPreloadBegin(calendarObject.getTime()));
+ assertEquals(2007, preloadRangeBegin.get(Calendar.YEAR));
+ assertEquals(Calendar.MAY, preloadRangeBegin.get(Calendar.MONTH));
+ assertEquals(28, preloadRangeBegin.get(Calendar.DATE));
+
+ Calendar preloadRangeEnd = Calendar.getInstance();
+ preloadRangeEnd.setTime(calendar.getDefaultPreloadEnd(calendarObject.getTime()));
+ assertEquals(2007, preloadRangeEnd.get(Calendar.YEAR));
+ assertEquals(Calendar.JULY, preloadRangeEnd.get(Calendar.MONTH));
+ assertEquals(1, preloadRangeEnd.get(Calendar.DATE));
+
+ calendarObject.set(2007, Calendar.JANUARY, 1);
+ preloadRangeBegin.setTime(calendar.getDefaultPreloadBegin(calendarObject.getTime()));
+ assertEquals(2007, preloadRangeBegin.get(Calendar.YEAR));
+ assertEquals(Calendar.JANUARY, preloadRangeBegin.get(Calendar.MONTH));
+ assertEquals(1, preloadRangeBegin.get(Calendar.DATE));
+
+
+ calendarObject.set(2007, Calendar.JUNE, 10);
+ calendar.setLocale(Locale.US);
+
+ preloadRangeBegin.setTime(calendar.getDefaultPreloadBegin(calendarObject.getTime()));
+ assertEquals(2007, preloadRangeBegin.get(Calendar.YEAR));
+ assertEquals(Calendar.MAY, preloadRangeBegin.get(Calendar.MONTH));
+ assertEquals(27, preloadRangeBegin.get(Calendar.DATE));
+
+ preloadRangeEnd.setTime(calendar.getDefaultPreloadEnd(calendarObject.getTime()));
+ assertEquals(2007, preloadRangeEnd.get(Calendar.YEAR));
+ assertEquals(Calendar.JUNE, preloadRangeEnd.get(Calendar.MONTH));
+ assertEquals(30, preloadRangeEnd.get(Calendar.DATE));
+ }
+
+ public void testGetPreloadDateRange() throws Exception {
+ UICalendar calendar = (UICalendar) application.createComponent(UICalendar.COMPONENT_TYPE);
+ calendar.setLocale(Locale.FRENCH);
+ Calendar calendarObject = Calendar.getInstance();
+ calendarObject.set(2007, Calendar.JUNE, 10);
+ calendar.setCurrentDate(calendarObject.getTime());
+
+ Date[] range = calendar.getPreloadDateRange();
+ assertEquals(calendar.getPreloadDateRangeBegin(), range[0]);
+ assertEquals(calendar.getPreloadDateRangeEnd(), range[range.length - 1]);
+ assertEquals(35, range.length);
+ }
+
+ public void testCalendarRenderer()throws Exception{
+
+ HtmlPage page = renderView();
+ assertNotNull(page);
+ System.out.println(page.asXml());
+
+
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ form = null;
+ calendar = null;
+ }
}
Property changes on: trunk/sandbox/ui/message
___________________________________________________________________
Name: svn:ignore
+ .classpath
.project
.settings
target
Modified: trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-07-19 18:53:25 UTC (rev 1706)
+++ trunk/sandbox/ui/scrollable-grid/src/main/javascript/ClientUI/controls/grid/GridBody.js 2007-07-19 19:23:27 UTC (rev 1707)
@@ -44,6 +44,7 @@
*/
initialize: function(template, grid) {
this.grid = grid;
+ this.gridId = grid.getElement().id;
ClientUI.controls.grid.GridBody.parentClass.constructor().call(this, template);
// declare event listeners
@@ -86,7 +87,7 @@
var childs = template.childNodes;
for(var i=0; i<childs.length; i++) {
- if(childs[i].tagName && childs[i].tagName.toLowerCase() == "div") {
+ if(childs[i].id == this.gridId + ":bc") {
this.container = new ClientUI.common.box.Box(childs[i], null, true);
this.container.makeAbsolute();
this.container.setStyle({'z-index' : 20});
@@ -96,13 +97,10 @@
}
// create scroll box
- this.scrollBox = new ClientUI.common.box.ScrollableBox(null, this.getElement());
- this.scrollBox.makeAbsolute();
+ this.scrollBox = new ClientUI.common.box.ScrollableBox(this.gridId + ":scb", this.getElement());
this.scrollBox.setWidth(this.getWidth());
this.scrollBox.setHeight(this.getHeight());
- this.scrollBox.setStyle({'z-index' : 0});
- this.sizeBox = new ClientUI.common.box.Box(null, this.scrollBox.getElement());
- this.sizeBox.makeAbsolute();
+ this.sizeBox = new ClientUI.common.box.Box(this.gridId + ":sb", this.scrollBox.getElement());
var normal = null, frozen = null;
var childs = this.container.getElement().childNodes;
@@ -126,14 +124,8 @@
this.frozenContentBox = new ClientUI.common.box.Box(frozen);
this.frozenContentBox.makeAbsolute();
- this.helpObject1 = new ClientUI.common.box.Box($(document.createElement("span")), this.contentBox.getElement());
- this.helpObject1.setWidth(10);
- this.helpObject1.setHeight(10);
- this.helpObject1.makeAbsolute();
- this.helpObject2 = new ClientUI.common.box.Box($(document.createElement("span")), this.frozenContentBox.getElement());
- this.helpObject2.setWidth(10);
- this.helpObject2.setHeight(10);
- this.helpObject2.makeAbsolute();
+ this.helpObject1 = new ClientUI.common.box.Box(this.gridId + ":nho", this.contentBox.getElement());
+ this.helpObject2 = new ClientUI.common.box.Box(this.gridId + ":fho", this.frozenContentBox.getElement());
// create row template
var ch = this.frozenContentBox.getElement().firstChild;
@@ -191,9 +183,9 @@
this.rowsCount = Math.min(templNormal.rows.length, this.grid.dataModel.getCount());
var cell = templNormal.rows[0].cells[0];
this.defaultRowHeight = cell!=null ? Element.getHeight(cell) : 0;
- if(ClientUILib.isGecko) {
- this.defaultRowHeight -= this.getBorderWidth("tb") + this.getPadding("tb");
- }
+ //if(ClientUILib.isGecko) {
+ // this.defaultRowHeight -= this.getBorderWidth("tb") + this.getPadding("tb");
+ //}
this.helpObj = new ClientUI.common.box.Box(templFrozen, null, true);
this.countToLoad = 0;
this.startRow = 0;
@@ -212,9 +204,9 @@
},
updateSize: function() {
this.defaultRowHeight = Element.getHeight(this.templNormal.getElement().rows[0].cells[0]);
- if(ClientUILib.isGecko) {
- this.defaultRowHeight -= this.getBorderWidth("tb") + this.getPadding("tb");
- }
+ //if(ClientUILib.isGecko) {
+ // this.defaultRowHeight -= this.getBorderWidth("tb") + this.getPadding("tb");
+ //}
},
updateLayout: function() {
if(!this.controlCreated || !this.grid.controlCreated) {
@@ -620,7 +612,7 @@
setTimeout(function () {
this.rearrangeRows(options, true, true);
this.container.show();
- this.splash.hide();
+ if(this.splash) this.splash.hide();
this.updateStarted = false;
}.bind(this), 10);
Modified: trunk/sandbox/ui/scrollable-grid/src/main/resources/org/richfaces/renderkit/html/css/grid.xcss
===================================================================
--- trunk/sandbox/ui/scrollable-grid/src/main/resources/org/richfaces/renderkit/html/css/grid.xcss 2007-07-19 18:53:25 UTC (rev 1706)
+++ trunk/sandbox/ui/scrollable-grid/src/main/resources/org/richfaces/renderkit/html/css/grid.xcss 2007-07-19 19:23:27 UTC (rev 1707)
@@ -64,7 +64,6 @@
*/
.ClientUI_Grid_HR {
background-color: #ebeadb;
- height: 22px;
z-index:2;
}
@@ -85,7 +84,6 @@
white-space: nowrap;
border-bottom: 1px solid #cbc7b8;
border-right: 1px solid #ebeadb;
- height:30px !important;
}
.ClientUI_Grid_HC .sort-asc {
@@ -93,9 +91,8 @@
background-position: right;
background-repeat: no-repeat;
display: none;
- height: 14px;
- width: 16px;
- position: relative;
+ width: 16px !important;;
+ position: absolute;
}
.ClientUI_Grid_HC .sort-desc {
@@ -103,9 +100,8 @@
background-position: right;
background-repeat: no-repeat;
display: none;
- height: 14px;
- width: 16px;
- position: relative;
+ width: 16px !important;;
+ position: absolute;
}
/**
@@ -129,15 +125,14 @@
.ClientUI_Grid_HSplit {
width:1px;
border-right:1px dashed #6593cf;
- background:none;
cursor: col-resize;
- z-index: 70;
+ z-index: 100;
}
/**
* Header cell body
*/
-.ClientUI_Grid_HCBody1 {
+.ClientUI_Grid_HCBody {
cursor: default;
padding: 0px 0px;
white-space: nowrap;
@@ -145,24 +140,8 @@
display: block;
overflow: hidden;
width: 100%;
-}
-.ClientUI_Grid_HCBody {
- cursor: default;
font: normal 8pt arial;
- padding: 3px 5px;
- white-space: nowrap;
- position: relative;
- display: block;
- overflow: hidden;
}
-.ClientUI_Grid_HCBody span {
- font: normal 8pt arial;
- white-space: nowrap;
-}
-.ClientUI_Grid_HCBodyContent {
- font: normal 8pt arial;
- white-space: nowrap;
-}
.ClientUI_Grid_HC_Over{
border-bottom: 1px solid #fcc247;
@@ -277,12 +256,17 @@
/**
* Body row style
*/
+.ClientUI_Grid_HO {
+ position: absolute;
+ height: 10px;
+ width: 10px;
+}
+
.ClientUI_Grid_BR {
font: normal 8pt arial;
white-space: nowrap;
box-sizing: border-box;
-moz-box-sizing: border-box;
- height:21px !important;
}
.idg-row-selected-h {
@@ -308,23 +292,30 @@
.ClientUI_Grid_BCBody {
cursor: default;
font: normal 8pt arial;
- padding: 3px 5px;
- white-space: nowrap;
-}
-.ClientUI_Grid_BCBody1 {
- cursor: default;
- font: normal 8pt arial;
+ white-space: nowrap;
padding: 0px 0px;
- white-space: nowrap;
position: relative;
display: block;
- overflow: hidden;
+ overflow: hidden;
+ -o-text-overflow: ellipsis;
+ text-overflow: ellipsis;
+ -moz-box-sizing: border-box;
+ -moz-outline: none;
width: 100%;
+ height: 20px;
}
/**
* Helper classes for grid template
*/
+.ClientUI_Substrate {
+ filter:Alpha(opacity=0);
+ position:absolute;
+ top:0px;
+ left:0px;
+ display:block;
+}
+
.ClientUI_TmplBox {
display: block;
float:left;
Modified: trunk/sandbox/ui/tooltip/src/main/config/component/toolTip.xml
===================================================================
--- trunk/sandbox/ui/tooltip/src/main/config/component/toolTip.xml 2007-07-19 18:53:25 UTC (rev 1706)
+++ trunk/sandbox/ui/tooltip/src/main/config/component/toolTip.xml 2007-07-19 19:23:27 UTC (rev 1707)
@@ -1,25 +1,39 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE components PUBLIC "-//AJAX4JSF//CDK Generator config/EN" "https://ajax4jsf.dev.java.net/nonav/dtds/component-config.dtd" >
+<!--
+<!DOCTYPE components PUBLIC "-//EXADEL//Generator config/EN" "http://exadel.com/dtds/component-config.dtd" >
+ -->
+
+
+
<components>
<component>
<name>org.richfaces.component.ToolTip</name>
<family>org.richfaces.component.ToolTip</family>
- <description>Defines the menu on the page and the set of the child elements properties in layout.</description>
+ <classname>org.richfaces.component.html.HtmlToolTip</classname>
<superclass>org.richfaces.component.UIToolTip</superclass>
- <classname>org.richfaces.component.html.HtmlToolTip</classname>
+ <description><![CDATA[Defines tooltip for parent component.]]></description>
+ <test>
+ <classname>org.richfaces.component.html.HtmlToolTipTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
+
<renderer generate="true" override="true">
<name>org.richfaces.renderkit.html.ToolTipRenderer</name>
<template>org/richfaces/htmltooltip.jspx</template>
</renderer>
<tag>
<name>toolTip</name>
- <classname>org.richfaces.taglib.ToolTipTag</classname>
- <superclass>org.ajax4jsf.webapp.taglib.HtmlComponentTagBase</superclass>
+ <classname>org.richfaces.taglib.HtmlToolTipTag</classname>
+ <superclass>org.ajax4jsf.framework.taglib.HtmlComponentTagBase</superclass>
+ <test>
+ <classname>org.richfaces.taglib.HtmlToolTipTagTest</classname>
+ <superclassname>org.ajax4jsf.tests.AbstractAjax4JsfTestCase</superclassname>
+ </test>
</tag>
-
<property>
- <name>onactivate</name>
+ <name>oncomplete</name>
<classname>java.lang.String</classname>
<description></description>
<defaultvalue><![CDATA[""]]></defaultvalue>
@@ -31,7 +45,7 @@
<defaultvalue><![CDATA[""]]></defaultvalue>
</property>
<property>
- <name>ondeactivate</name>
+ <name>onhide</name>
<classname>java.lang.String</classname>
<description></description>
<defaultvalue><![CDATA[""]]></defaultvalue>
@@ -49,7 +63,7 @@
<name>event</name>
<classname>java.lang.String</classname>
<description>event that triggers the tooltip appearance (default = onmouseover)</description>
- <defaultvalue><![CDATA["onmouseover"]]></defaultvalue>
+ <defaultvalue><![CDATA["mouseover"]]></defaultvalue>
</property>
<property>
<name>mode</name>
@@ -58,7 +72,7 @@
<defaultvalue><![CDATA["client"]]></defaultvalue>
</property>
<property>
- <name>disabled</name>
+ <name>disabled</name>
<classname>boolean</classname>
<description>If false the components is rendered on the client but Js for calling – disabled.</description>
<defaultvalue>false</defaultvalue>
Modified: trunk/sandbox/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java
===================================================================
--- trunk/sandbox/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java 2007-07-19 18:53:25 UTC (rev 1706)
+++ trunk/sandbox/ui/tooltip/src/main/java/org/richfaces/renderkit/html/ToolTipRenderer.java 2007-07-19 19:23:27 UTC (rev 1707)
@@ -1,18 +1,20 @@
package org.richfaces.renderkit.html;
import java.io.IOException;
+import java.util.Map;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;
-import org.ajax4jsf.renderkit.AjaxComponentRendererBase;
-import org.richfaces.skin.Skin;
+import org.ajax4jsf.framework.ajax.AjaxEvent;
+import org.ajax4jsf.framework.renderer.AjaxComponentRendererBase;
+import org.ajax4jsf.framework.renderer.AjaxRendererUtils;
+import org.ajax4jsf.framework.skin.Skin;
+import org.ajax4jsf.framework.util.javascript.JSFunction;
+import org.ajax4jsf.framework.util.javascript.JSFunctionDefinition;
+import org.ajax4jsf.framework.util.javascript.JSReference;
import org.richfaces.component.UIToolTip;
-import org.richfaces.renderkit.html.image.cornerimages.BottomLeftToolTipCornerImage;
-import org.richfaces.renderkit.html.image.cornerimages.BottomRightToolTipCornerImage;
-import org.richfaces.renderkit.html.image.cornerimages.TopLeftToolTipCornerImage;
-import org.richfaces.renderkit.html.image.cornerimages.TopRightToolTipCornerImage;
public class ToolTipRenderer extends AjaxComponentRendererBase{
@@ -21,66 +23,6 @@
return org.richfaces.component.UIToolTip.class;
}
- public void encodeChildren(FacesContext context, UIComponent component)
- throws IOException {
- // TODO Auto-generated method stub
- super.encodeChildren(context, component);
- }
-
- /**
- *
- * @param context
- * @param component 'tl'-top left, 'tr'-top right, 'bl'-bottom left, 'br'-bottom right
- * @param position
- * @throws IOException
- */
- public void insertImage(FacesContext context, UIComponent component, Object position) throws IOException{
- //if(position == null) throw new IllegalArgumentException("Parameter passed is invalid, use \"0 - 3\"");
- String posStr = (String)position;
- drawImageElement(context, component, posStr);
- }
-
-
- /**
- *
- * @param writer
- * @param component
- * @param position 0-tl, 1-tr, 2-bl, 3-br
- * @throws IOException
- */
- private void drawImageElement(FacesContext context, UIComponent component, String position) throws IOException{
- String imageSrc = getImageSrc(context, component, position);
- ResponseWriter writer = context.getResponseWriter();
- int h = 15; //width(context);
- writer.startElement("img", component);
- writer.writeAttribute("src", imageSrc, null);
- writer.writeAttribute("alt", "", null);
- writer.writeAttribute("vspace", "0", null);
- writer.writeAttribute("hspace", "0", null);
- writer.writeAttribute("class", "corner", null);
- writer.writeAttribute("style", "display:block; ", null);
- writer.writeAttribute("width", String.valueOf(h), null);
- writer.writeAttribute("height", String.valueOf(h), null);
- writer.endElement("img");
- }
-
-
- protected String getImageSrc(FacesContext context, UIComponent component, String position){
- String color = getBgColor(context, component);
- String imageSource = null;
- if(position == null || position.equals("tl")) {
- imageSource = getResource(TopLeftToolTipCornerImage.class.getName()).getUri(context, color);
- } else if(position.equals("tr")){
- imageSource = getResource(TopRightToolTipCornerImage.class.getName()).getUri(context, color);
- } else if (position.equals("bl")){
- imageSource = getResource(BottomLeftToolTipCornerImage.class.getName()).getUri(context, color);
- } else if (position.equals("br")){
- imageSource = getResource(BottomRightToolTipCornerImage.class.getName()).getUri(context, color);
- }
-
- return imageSource;
- }
-
public String getBgColor(FacesContext context, UIComponent component){
Skin skin = getSkin(context);
String color = (String) skin.getParameter(context,"headerBackgroundColor");
@@ -100,29 +42,42 @@
context.getResponseWriter().write(value.toString());
}
}
-
- protected String getTopRightDivStyle(FacesContext context, UIComponent component){
- String trImgSrc = getImageSrc(context, component, "tr");
- return "background: url(" + trImgSrc + ") no-repeat top right;";
- }
- protected String getBottomRightDivStyle(FacesContext context, UIComponent component){
- String brImgSrc = getImageSrc(context, component, "br");
- return "background: url(" + brImgSrc + ") no-repeat top right;";
- }
-
- protected String getMainDivStyle(FacesContext context, UIComponent component){
- String style = "width: 250px;background-color:" + getBgColor(context, component) + ";color: " + getColor(context, component) + ";";
- return style;
- }
- protected String getTRImageSrc(FacesContext context, UIComponent component){
- return getImageSrc(context, component, "tr");
+ public String insertAjaxFunction(FacesContext context, UIComponent component){
+ JSFunction function = AjaxRendererUtils.buildAjaxFunction(component, context);
+ component.getClientId(context);
+
+ Map eventOptions = AjaxRendererUtils.buildEventOptions(context, component);
+
+ //after element is subsituted in DOM tree, we have to re-create
+ //it's JS-reference, cause old one is already invalid
+ String refreshTooltipInDOM = ";" + getJsVarName(context, component) + ".toolTip = $('" + component.getClientId(context) + "');" +
+ ";" + getJsVarName(context, component) + ".toolTipContent = $('" + component.getClientId(context) + "content');";
+
+ String showNewToolTip = ";" + getJsVarName(context, component) + ".displayDiv();";
+
+ //enable ajaxSingle mode, i.e. we do not need to submit all form controls to get tooltip content
+ eventOptions.put("control", JSReference.THIS);
+
+ if(eventOptions.containsKey("oncomplete")){
+ JSFunctionDefinition onComplete = (JSFunctionDefinition)eventOptions.get("oncomplete");
+ onComplete.addToBody(refreshTooltipInDOM + showNewToolTip);
+ eventOptions.put("oncomplete", onComplete);
+ } else {
+ JSFunctionDefinition onComplete = new JSFunctionDefinition();
+ onComplete.addParameter("request");
+ onComplete.addParameter("event");
+ onComplete.addParameter("data");
+ onComplete.addToBody(refreshTooltipInDOM + showNewToolTip);
+ eventOptions.put("oncomplete", onComplete);
+ }
+
+ function.addParameter(eventOptions);
+
+ return function.toScript();
}
- protected String getBRImageSrc(FacesContext context, UIComponent component){
- return getImageSrc(context, component, "br");
- }
public void insertScript(FacesContext context, UIComponent component) throws IOException{
@@ -136,27 +91,62 @@
String quot = "\"";
StringBuffer script = new StringBuffer();
//
- script.append("var tooltip1 = ").
+ String event = toolTip.getEvent();
+ if(event.startsWith("on")){
+ event = event.substring(2);
+ }
+ String events = "{event:\"" + event + "\",onshow:\"" + toolTip.getOnshow() +
+ "\",oncomplete:\"" + toolTip.getOncomplete() + "\",onhide:\"" + toolTip.getOnhide() +
+ "\"}";
+ //script.append("var tooltip1 = ").
- append("new ToolTip(").append(quot).append("tooltip" + toolTip.getClientId(context).toString()).append(quot).append(comma).
+ script.append(getJsVarName(context, toolTip) + " = ").
+ append("new ToolTip(" + events).append(comma).append(quot).append( toolTip.getClientId(context)).append(quot).append(comma).
append(quot).append(parentClientId).append(quot).append(comma).
append(quot).append(toolTip.getMode()).append(quot).append(comma).
append(toolTip.isDisabled()).append(comma).
append(quot).append(toolTip.getDirection()).append(quot).append(comma).
append(toolTip.isFollowMouse()).append(comma).
append(toolTip.getHorizontalOffset()).append(comma).
- append(toolTip.getVerticalOffset()).append(");\n");
+ append(toolTip.getVerticalOffset()).append(comma).
+ append("\"").append(insertAjaxFunction(context, component)).append("\");\n");
ret.append(script.toString());
//
//ret.append("function toolTipAttach(){tooltip1.attachParentEvents() }\n");
ret.append("\n</script>");
-
ResponseWriter writer = context.getResponseWriter();
writer.write(ret.toString());
}
+
+ private String getJsVarName(FacesContext context, UIComponent component){
+ return "window.tooltip" + component.getClientId(context).replaceAll("[^A-Za-z0-9_]", "_");
+ }
+
+ protected void doDecode(FacesContext context, UIComponent component) {
+
+ UIToolTip tooltip = (UIToolTip)component;
+
+ String clientId = tooltip.getClientId(context);
+
+ if(context.getExternalContext().getRequestParameterMap().containsKey(clientId)){
+ if("ajax".equals(tooltip.getMode())){
+ new AjaxEvent(component).queue();
+ }
+ }
+ }
+
+ public void encodeTooltipText(FacesContext context, UIToolTip component) throws IOException {
+ ResponseWriter responseWriter = context.getResponseWriter();
+ responseWriter.startElement("span", component);
+ responseWriter.writeAttribute("id", component.getClientId(context) + "content", null);
+ responseWriter.write(component.getValue() != null ? component.getValue() : "");
+ super.renderChildren(context, component);
+ responseWriter.endElement("span");
+ }
+
}
Modified: trunk/sandbox/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/css/tooltip.xcss
===================================================================
--- trunk/sandbox/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/css/tooltip.xcss 2007-07-19 18:53:25 UTC (rev 1706)
+++ trunk/sandbox/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/css/tooltip.xcss 2007-07-19 19:23:27 UTC (rev 1707)
@@ -4,13 +4,16 @@
xmlns:u="http://jsf.exadel.com/template/util"
xmlns="http://www.w3.org/1999/xhtml">
-<f:verbatim>
-img.corner {
- width: 15px;
- height: 15px;
- border: none;
- display: block !important;
-}
-</f:verbatim>
+ <u:selector name=".dr-rich-tool-tip">
+ <u:style name="background-color" skin="tipBackgroundColor"/>
+ <u:style name="padding" value="7px"/>
+ <u:style name="border" value="1px solid"/>
+ <u:style name="border-color" skin="tipBorderColor"/>
+ <u:style name="font-size" skin="generalSizeFont"/>
+ <u:style name="font-family" skin="generalFamilyFont"/>
+ <u:style name="color" skin="generalFontColor"/>
+ <u:style name="float" value="left"/>
+ </u:selector>
+
</f:template>
Modified: trunk/sandbox/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js
===================================================================
--- trunk/sandbox/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js 2007-07-19 18:53:25 UTC (rev 1706)
+++ trunk/sandbox/ui/tooltip/src/main/resources/org/richfaces/renderkit/html/scripts/tooltip.js 2007-07-19 19:23:27 UTC (rev 1707)
@@ -2,39 +2,15 @@
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false;
-// If NS -- that is, !IE -- then set up for mouse capture
-if (!IE) document.captureEvents(Event.MOUSEMOVE)
-
-// Temporary variables to hold mouse x-y pos.s
-var cursorX = 0;
-var cursorY = 0;
-
-// Main function to retrieve mouse x-y pos.s
-
-function getMouseXY(e) {
-if (IE) { // grab the x-y pos.s if browser is IE
-cursorX = event.clientX + document.body.scrollLeft;
-cursorY = event.clientY + document.body.scrollTop;
-} else { // grab the x-y pos.s if browser is NS
-cursorX = e.pageX;
-cursorY = e.pageY;
-}
-// catch possible negative values in NS4
-if (cursorX < 0){cursorX = 0;}
-if (cursorY < 0){cursorY = 0;}
-// show the position values in the form named Show
-// in the text fields named MouseX and MouseY
-return true;
-}
-
-// Set-up to use getMouseXY function onMouseMove
-document.onmousemove = getMouseXY;
-
-
ToolTip = Class.create();
ToolTip.prototype = {
- initialize:function(id, parentId, mode, disabled, direction, followMouse, horizontalOffset, verticalOffset){
+ initialize:function(events, id, parentId, mode, disabled, direction, followMouse, horizontalOffset, verticalOffset, ajaxFunction){
+ this.event = events.event;
+ this.onshow = events.onshow;
+ this.oncomplete = events.oncomplete;
+ this.onhide = events.onhide;
+
this.id = id;
this.parentId = parentId;
this.mode = mode;
@@ -43,48 +19,127 @@
this.followMouse = followMouse;
this.horizontalOffset = horizontalOffset;
this.verticalOffset = verticalOffset;
+ this.ajaxExecuteString = ajaxFunction;
this.toolTip = $(id);
- this.toolTipW = this.toolTip.clientWidth;
- this.toolTipH = this.toolTip.clientHeight;
+ this.toolTipContent = $(id + 'content');
+ this.toolTipDefaultContent = $(id + 'defaultContent');
+
+ this.toolTip.style.visibility='hidden';
+ this.toolTip.style.display='block';
+
+ this.toolTipOffsetW = this.toolTip.offsetWidth;
+ this.toolTipOffsetH = this.toolTip.offsetHeight;
+
+ this.toolTipW = this.toolTip.getWidth();
+ this.toolTipH = this.toolTip.getHeight();
+
+ this.toolTipBorderHeight = (this.toolTipOffsetH - this.toolTipH) / 2;
+ this.toolTipBorderWidth = (this.toolTipOffsetW - this.toolTipW) / 2;
+ this.toolTip.style.visibility = 'visible';
this.toolTip.style.display = "none";
this.parentAttached = false;
+ this.hintParentElement = null;
- //document.body.attachEvent("load", this.attachOnLoadEvents);
- //document.body.onload = this.attachOnLoadEvents.bindAsEventListener(this);
-
- Event.observe(document.getElementsByTagName("body")[0], "mousemove", this.attachOnLoadEvents.bindAsEventListener(this), true);
+ // mouse could be overed while ajax request is still in process,
+ // so, after DOM-element replaced, we should not display it
+ this.isMouseOvered = false;
+
+ if(IE){
+ var toolTipZindex = parseInt(this.toolTip.style.zIndex);
+ new Insertion.Before(this.toolTip,
+ "<iframe src=\"javascript:''\" frameborder=\"0\" scrolling=\"no\" id=\"" + this.id + "iframe\"" +
+ "style=\"position: absolute; width: " + this.toolTipOffsetW + "px; height: " + this.toolTipOffsetH + "px; display: none;background-color:black; z-index: " +
+ + (toolTipZindex-1) + ";\">" + "</iframe>");
+ this.iframe = $(this.id + 'iframe');
+ }
+
+ if(!this.disabled) Event.observe(document.getElementsByTagName("body")[0], "mousemove", this.attachOnLoadEvents.bindAsEventListener(this), true);
},
attachOnLoadEvents: function(){
- //alert('onload');
if(!this.parentAttached){
this.parent = $(this.parentId);
if(this.parent != null && !this.disabled){
this.attachParentEvents();
this.parentAttached = true;
}
+ Event.stopObserving(document.getElementsByTagName("body")[0], "mousemove", this.attachOnLoadEvents.bindAsEventListener(this), false);
}
},
attachParentEvents: function(){
if(this.followMouse){
- Event.observe(this.parent, "mousemove", this.doShow.bindAsEventListener(this), false);
- } else {
- Event.observe(this.parent, "mouseover", this.doShow.bindAsEventListener(this), false);
+ Event.observe(this.parent, 'mousemove', this.setToolTipPosition.bindAsEventListener(this), false);
}
+ Event.observe(this.parent, this.event, this.doShow.bindAsEventListener(this), false);
+ Event.observe(this.parent, "mouseout", this.doHide.bindAsEventListener(this), false);
- Event.observe(this.parent, "mouseout", this.doHide.bindAsEventListener(this), false);
+ Event.observe(this.toolTip, 'mouseout', this.leaveToolTip.bindAsEventListener(this), false)
},
- doShow: function(){
-
- this.setToolTipPosition();
- this.toolTip.style.display = "block";
-
+
+ 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);
},
+
+
+ leaveToolTip: function(e) {
+
+ var hintNotLeft = false;
- doHide: function(){
- this.toolTip.style.display = "none";
+ // detect mouse move from hint to owner
+ // if mouse entered the just the owner hintNotLeft is set true
+ hintNotLeft = this.detectAncestorNode(e.toElement,this.hintParentElement);
+ hintNotLeft = hintNotLeft || this.detectAncestorNode(e.relatedTarget,this.hintParentElement);
+
+ if (!hintNotLeft){
+ this.doHide(e);
+ this.isMouseOvered = false;
+ }
},
+
+
+
+ doShow: function(e){
+ this.isMouseOvered = true;
+ if (e.target)
+ this.hintParentElement = e.target;
+ if (e.srcElement)
+ this.hintParentElement = e.srcElement;
+
+
+ this.setToolTipPosition(e);
+ if(this.mode == 'ajax'){
+ if(this.toolTipDefaultContent){
+ this.toolTipContent.innerHTML = this.toolTipDefaultContent.innerHTML;
+ }
+ var event = e;
+ eval(this.ajaxExecuteString);
+ }
+ this.displayDiv(e);
+ },
+
+ doHide: function(e){
+ var fakeEvent = false;
+ fakeEvent = this.detectAncestorNode(e.toElement,this.toolTip);
+ fakeEvent = fakeEvent || this.detectAncestorNode(e.relatedTarget,this.toolTip);
+
+
+ if (!fakeEvent) {
+ this.isMouseOvered = false;
+ this.toolTip.style.display = "none";
+ if(this.iframe){
+ this.iframe.style.display = "none";
+ }
+ this.hintParentElement = null;
+ this.isMouseOvered = false;
+ }
+
+ },
+
doEnable: function(){
this.disabled = false;
},
@@ -92,14 +147,20 @@
this.disabled = true;
},
- setToolTipPosition: function(){
+ setToolTipPosition: function(e){
var windowDim = this.windowSize();
-
+ var cursorX = e.clientX + document.body.scrollLeft;
+ var cursorY = e.clientY + document.body.scrollTop;
+
+ this.toolTipH = this.toolTip.getHeight();
+ this.toolTipW = this.toolTip.getWidth();
+
+
if(this.direction == "top-left"){
- if(cursorY - this.verticalOffset - this.toolTip.clientHeight < 0){
+ if(cursorY - this.verticalOffset - this.toolTipH < 0){
+ this.toolTip.style.top = cursorY + this.verticalOffset - this.toolTipH;
+ } else {
this.toolTip.style.top = cursorY - this.verticalOffset - this.toolTipH;
- } else {
- this.toolTip.style.top = cursorY + this.verticalOffset;
}
if(cursorX - this.horizontalOffset - this.toolTipW < 0){
this.toolTip.style.left = cursorX + this.horizontalOffset;
@@ -108,7 +169,7 @@
}
} else if(this.direction == "bottom-left"){
- if(cursorY + this.verticalOffset - this.toolTipH > windowDim[1]){
+ if(cursorY + this.verticalOffset + this.toolTipH > windowDim[1]){
this.toolTip.style.top = cursorY - this.verticalOffset - this.toolTipH;
} else {
this.toolTip.style.top = cursorY + this.verticalOffset;
@@ -116,7 +177,7 @@
if(cursorX - this.horizontalOffset - this.toolTipW < 0){
this.toolTip.style.left = cursorX + this.horizontalOffset ;
} else {
- this.toolTip.style.left = cursorX - this.horizontalOffset - this.toolTopW;
+ this.toolTip.style.left = cursorX - this.horizontalOffset - this.toolTipW;
}
} else if(this.direction == "top-right"){
if(cursorY - this.verticalOffset - this.toolTipH < 0){
@@ -161,9 +222,16 @@
wHeight = document.body.clientHeight;
}
return [wWidth,wHeight];
+ },
+
+ displayDiv: function(e){
+ if(this.isMouseOvered){
+ this.toolTip.style.display = "block";
+ if(this.iframe){
+ this.iframe.style.top = parseInt(this.toolTip.style.top) - this.toolTipBorderHeight;
+ this.iframe.style.left = parseInt(this.toolTip.style.left) - this.toolTipBorderWidth;
+ this.iframe.style.display = "block";
+ }
+ }
}
-
-
- //
-
}
\ No newline at end of file
17 years, 5 months
JBoss Rich Faces SVN: r1706 - branches/3.0.2/sandbox/tooltip/src/main/templates/org/richfaces.
by richfaces-svn-commits@lists.jboss.org
Author: dbiatenia
Date: 2007-07-19 14:53:25 -0400 (Thu, 19 Jul 2007)
New Revision: 1706
Modified:
branches/3.0.2/sandbox/tooltip/src/main/templates/org/richfaces/htmltooltip.jspx
Log:
Modified: branches/3.0.2/sandbox/tooltip/src/main/templates/org/richfaces/htmltooltip.jspx
===================================================================
--- branches/3.0.2/sandbox/tooltip/src/main/templates/org/richfaces/htmltooltip.jspx 2007-07-19 16:47:25 UTC (rev 1705)
+++ branches/3.0.2/sandbox/tooltip/src/main/templates/org/richfaces/htmltooltip.jspx 2007-07-19 18:53:25 UTC (rev 1706)
@@ -23,7 +23,8 @@
<f:clientid var="clientId"/>
- <div id="#{clientId}" style="position: absolute; display : none;z-index:99" class="dr-rich-tool-tip rich-tool-tip">
+ <div id="#{clientId}" style="position: absolute; display : none;z-index:99; #{component.attributes['style']}" class="dr-rich-tool-tip rich-tool-tip #{component.attributes['styleClass']}">
+ <f:call name="utils.encodePassThru" />
<span id="#{clientId}defaultContent" style="display:none">
<u:insertFacet name="defaultContent" />
</span>
17 years, 5 months