JBoss Rich Faces SVN: r6167 - trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-02-19 09:28:19 -0500 (Tue, 19 Feb 2008)
New Revision: 6167
Modified:
trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js
Log:
Richfaces.removeNode() method added
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 2008-02-19 14:21:16 UTC (rev 6166)
+++ trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js 2008-02-19 14:28:19 UTC (rev 6167)
@@ -366,3 +366,12 @@
return n;
};
+
+Richfaces.removeNode = function(node) {
+ if (node) {
+ var parentNode = node.parentNode;
+ if (parentNode) {
+ parentNode.removeChild(node);
+ }
+ }
+}
18 years, 2 months
JBoss Rich Faces SVN: r6166 - in trunk/samples/richfaces-demo/src/main: java/org/richfaces/demo/common and 9 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2008-02-19 09:21:16 -0500 (Tue, 19 Feb 2008)
New Revision: 6166
Modified:
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/CalendarBean.java
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/common/Environment.java
trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/gmap/Bean.java
trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml
trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/web.xml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/examples/calSample.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/usage.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/dragSupport/examples/dnd.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/gmap/examples/mapUsage.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/toolTip/examples/tooltipUsage.xhtml
trunk/samples/richfaces-demo/src/main/webapp/richfaces/toolTip/examples/withTable.xhtml
trunk/samples/richfaces-demo/src/main/webapp/templates/include/header.xhtml
trunk/samples/richfaces-demo/src/main/webapp/templates/main.xhtml
Log:
merged demo with 3.1.x branch
Modified: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/CalendarBean.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/CalendarBean.java 2008-02-19 13:50:09 UTC (rev 6165)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/calendar/CalendarBean.java 2008-02-19 14:21:16 UTC (rev 6166)
@@ -12,7 +12,7 @@
private boolean popup;
private String pattern;
private Date selectedDate;
-
+ private boolean showApply=true;
private boolean useCustomDayLabels;
public Locale getLocale() {
@@ -43,7 +43,7 @@
locale = Locale.US;
popup = true;
- pattern = "MMM d, yyyy";
+ pattern = "MMM d, yyyy, HH:mm";
}
public void selectLocale(ValueChangeEvent event) {
@@ -72,4 +72,12 @@
this.selectedDate = selectedDate;
}
+ public boolean isShowApply() {
+ return showApply;
+ }
+
+ public void setShowApply(boolean showApply) {
+ this.showApply = showApply;
+ }
+
}
\ No newline at end of file
Modified: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/common/Environment.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/common/Environment.java 2008-02-19 13:50:09 UTC (rev 6165)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/common/Environment.java 2008-02-19 14:21:16 UTC (rev 6166)
@@ -3,9 +3,12 @@
import java.util.HashMap;
import java.util.Map;
+import javax.faces.application.Application;
+import javax.faces.context.FacesContext;
+
public class Environment {
private Map params = new HashMap();
-
+ private String version;
public Map getParams() {
return params;
}
@@ -14,4 +17,8 @@
this.params = params;
}
+ public String getVersion() {
+ String shortVersion = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{a4j.version}", String.class).getValue(FacesContext.getCurrentInstance().getELContext()).toString();
+ return shortVersion.substring(0, shortVersion.indexOf("$Date"));
+ }
}
Modified: trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/gmap/Bean.java
===================================================================
--- trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/gmap/Bean.java 2008-02-19 13:50:09 UTC (rev 6165)
+++ trunk/samples/richfaces-demo/src/main/java/org/richfaces/demo/gmap/Bean.java 2008-02-19 14:21:16 UTC (rev 6166)
@@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
@@ -10,7 +11,7 @@
public class Bean {
- private ArrayList point;
+ private List<Place> point;
private String currentId;
private int zoom;
private String gmapkey;
@@ -28,7 +29,7 @@
- public ArrayList getPoint() {
+ public List<Place> getPoint() {
if (point == null)
initData();
return point;
@@ -36,15 +37,15 @@
- public void setPoint(ArrayList point) {
+ public void setPoint(List<Place> point) {
this.point = point;
}
public Place getCurrentPlace() {
- Iterator it = point.iterator();
+ Iterator<Place> it = point.iterator();
while (it.hasNext()) {
- Place pl = (Place)it.next();
+ Place pl = it.next();
if (currentId.equals(pl.getId())) {
zoom = pl.getZoom(); //sync with zoom of new place
return pl;
@@ -54,7 +55,7 @@
}
private void initData() {
- point = new ArrayList();
+ point = new ArrayList<Place>();
point.add(new Place ("goldengate", "/org/richfaces/demo/gmap/images/gold.gif", "37.81765", "-122.477603" , 14,
"Golden Gate Bridge, San Francisco"));
point.add(new Place ("eiffeltower", "/org/richfaces/demo/gmap/images//tower.gif", "48.858489", "2.295295" , 17,
Modified: trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml 2008-02-19 13:50:09 UTC (rev 6165)
+++ trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/faces-config.xml 2008-02-19 14:21:16 UTC (rev 6166)
@@ -73,7 +73,7 @@
<managed-bean>
<managed-bean-name>dataTableScrollerBean</managed-bean-name>
<managed-bean-class>org.richfaces.datatablescroller.DataTableScrollerBean</managed-bean-class>
- <managed-bean-scope>application</managed-bean-scope>
+ <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>toggleBean</managed-bean-name>
@@ -251,7 +251,7 @@
<managed-bean>
<managed-bean-name>updateBean</managed-bean-name>
<managed-bean-class>org.richfaces.datatable.UpdateBean</managed-bean-class>
- <managed-bean-scope>session</managed-bean-scope>
+ <managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>panelMenu</managed-bean-name>
@@ -264,7 +264,7 @@
</managed-property>
<managed-property>
<property-name>singleMode</property-name>
- <property-class>java.lang.Boolean</property-class>
+ <property-class>boolean</property-class>
<value>true</value>
</managed-property>
</managed-bean>
Modified: trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/web.xml 2008-02-19 13:50:09 UTC (rev 6165)
+++ trunk/samples/richfaces-demo/src/main/webapp/WEB-INF/web.xml 2008-02-19 14:21:16 UTC (rev 6166)
@@ -37,6 +37,10 @@
</context-param>
<context-param>
<param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
+ <param-value>true</param-value>
+ </context-param>
+ <context-param>
+ <param-name>org.ajax4jsf.COMPRESS_STYLE</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
@@ -46,11 +50,11 @@
<!--context-param>
<param-name>org.richfaces.LoadStyleStrategy</param-name>
<param-value>DEFAULT</param-value>
- </context-param>
+ </context-param-->
<context-param>
<param-name>org.richfaces.LoadScriptStrategy</param-name>
<param-value>DEFAULT</param-value>
- </context-param-->
+ </context-param>
<filter>
<display-name>Ajax4jsf Filter</display-name>
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/examples/calSample.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/examples/calSample.xhtml 2008-02-19 13:50:09 UTC (rev 6165)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/examples/calSample.xhtml 2008-02-19 14:21:16 UTC (rev 6166)
@@ -8,6 +8,9 @@
<style type="text/css">
.ecol1 { width:250px; vertical-align: top; }
.ecol2 { vertical-align: top; border-left:1px solid #CCC; }
+ .rich-calendar-tool-btn{
+ font-family: Arial, Verdana;
+ }
</style>
<h:form>
@@ -18,7 +21,7 @@
locale="#{calendarBean.locale}"
popup="#{calendarBean.popup}"
datePattern="#{calendarBean.pattern}"
- />
+ showApplyButton="#{calendarBean.showApply}"/>
</a4j:outputPanel>
@@ -27,7 +30,10 @@
<h:selectBooleanCheckbox value="#{calendarBean.popup}">
<a4j:support event="onclick" reRender="calendar"/>
</h:selectBooleanCheckbox>
-
+ <h:outputText value="Apply Button:" />
+ <h:selectBooleanCheckbox value="#{calendarBean.showApply}">
+ <a4j:support event="onclick" reRender="calendar"/>
+ </h:selectBooleanCheckbox>
<h:outputText value="Select Locale" />
<h:selectOneRadio value="en/US" valueChangeListener="#{calendarBean.selectLocale}">
<a4j:support event="onclick" reRender="calendar"/>
@@ -40,8 +46,8 @@
<h:outputText value="Select Date Pattern:"/>
<h:selectOneMenu value="#{calendarBean.pattern}">
<a4j:support event="onchange" reRender="calendar"/>
- <f:selectItem itemLabel="d/M/yy" itemValue="d/M/yy"/>
- <f:selectItem itemLabel="dd/M/yy" itemValue="dd/M/yy"/>
+ <f:selectItem itemLabel="d/M/yy HH:mm" itemValue="d/M/yy HH:mm"/>
+ <f:selectItem itemLabel="dd/M/yy hh:mm a" itemValue="dd/M/yy hh:mm a"/>
<f:selectItem itemLabel="d/MMM/y" itemValue="d/MMM/y"/>
<f:selectItem itemLabel="MMM d, yyyy" itemValue="MMM d, yyyy"/>
</h:selectOneMenu>
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/usage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/usage.xhtml 2008-02-19 13:50:09 UTC (rev 6165)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/calendar/usage.xhtml 2008-02-19 14:21:16 UTC (rev 6166)
@@ -8,8 +8,8 @@
<ui:composition template="/templates/component-sample.xhtml">
<ui:define name="sample">
- <p>
- rich:calendar allows to select the date using monthly calendar elements on pages.
+ <p><b>
+ rich:calendar</b> allows to select the date using monthly calendar elements on pages.
It is possible to use the component in a popup and inline code. At a popup mode Calendar
is initially rendered as input for date and button on the right side to call a popup.
In case of an inline mode, the monthly calendar is located on a page initially.
@@ -23,9 +23,13 @@
</ui:include>
</div>
+ <p>Calendar component allows to work with <b>time</b> also. You should just define time in pattern ( for example "<i>d/M/yy HH:mm</i>" as it's defined in this sample by default)
+ </p>
+ <p>After you choose some date, you'll be able to manage time for this date. Spinner will be called after click on the time fields to edit them.</p>
+ <p>Calendar could be used without "Apply" button (will be closed after date selected)</p>
<p>
<b>locale</b> attribute is defined as a Locale. The default value is set to the Locale of the current page.
- The name of the month and week days names depend of the Locale.
+ The name of the month and week days depend on the Locale.
</p>
<p>
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/dragSupport/examples/dnd.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/dragSupport/examples/dnd.xhtml 2008-02-19 13:50:09 UTC (rev 6165)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/dragSupport/examples/dnd.xhtml 2008-02-19 14:21:16 UTC (rev 6166)
@@ -23,7 +23,7 @@
<h:panelGrid columnClasses="panelc" columns="4" width="100%">
- <rich:panel style="width:100px">
+ <rich:panel style="width:133px">
<f:facet name="header">
<h:outputText value="Source List" />
</f:facet>
@@ -31,7 +31,7 @@
var="fm" >
<h:column>
- <a4j:outputPanel style="border:1px solid gray;padding:2px;"
+ <a4j:outputPanel style="width:100px;border:1px solid gray;padding:2px"
layout="block">
<rich:dragSupport dragIndicator=":indicator"
dragType="#{fm.family}" dragValue="#{fm}">
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/gmap/examples/mapUsage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/gmap/examples/mapUsage.xhtml 2008-02-19 13:50:09 UTC (rev 6165)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/gmap/examples/mapUsage.xhtml 2008-02-19 14:21:16 UTC (rev 6166)
@@ -11,9 +11,8 @@
height:30px;
}
</style>
-
<h:panelGrid columns="2">
- <rich:gmap gmapVar="map" zoom="#{gmBean.zoom}" style="width:400px;height:400px" gmapKey="#{gmBean.gmapkey}" />
+ <rich:gmap gmapVar="map" zoom="#{gmBean.zoom}" style="width:400px;height:400px" gmapKey="#{gmBean.gmapkey}" id="gmap"/>
<h:panelGroup>
<rich:tabPanel switchType="ajax" width="350" height="400">
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/toolTip/examples/tooltipUsage.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/toolTip/examples/tooltipUsage.xhtml 2008-02-19 13:50:09 UTC (rev 6165)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/toolTip/examples/tooltipUsage.xhtml 2008-02-19 14:21:16 UTC (rev 6166)
@@ -36,7 +36,7 @@
</p>
</rich:panel>
<rich:panel id="sample2" styleClass="tooltip-text">
- <rich:toolTip followMouse="true" direction="top-right" delay="500" styleClass="tooltip" style="width:250px">
+ <rich:toolTip followMouse="true" direction="top-right" showDelay="500" styleClass="tooltip">
<span style="white-space:nowrap">
This tool-tip content also <strong>pre-rendered</strong> to the page.<br/>
However, the look of this tool-tip is customized<br/>
Modified: trunk/samples/richfaces-demo/src/main/webapp/richfaces/toolTip/examples/withTable.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/richfaces/toolTip/examples/withTable.xhtml 2008-02-19 13:50:09 UTC (rev 6165)
+++ trunk/samples/richfaces-demo/src/main/webapp/richfaces/toolTip/examples/withTable.xhtml 2008-02-19 14:21:16 UTC (rev 6166)
@@ -45,7 +45,7 @@
<h:outputText value="Make"/>
</f:facet>
<h:outputText id="make" value="#{vehicle.make}" >
- <rich:toolTip direction="top-right" mode="ajax" delay="30" styleClass="tooltip" immediate="true" layout="block">
+ <rich:toolTip direction="top-right" mode="ajax" showDelay="300" styleClass="tooltip" immediate="true" layout="block">
<a4j:actionparam name="key" value="#{row}" assignTo="#{toolTipData.currentVehicleIndex}" />
<h:panelGrid columns="4">
Modified: trunk/samples/richfaces-demo/src/main/webapp/templates/include/header.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/templates/include/header.xhtml 2008-02-19 13:50:09 UTC (rev 6165)
+++ trunk/samples/richfaces-demo/src/main/webapp/templates/include/header.xhtml 2008-02-19 14:21:16 UTC (rev 6166)
@@ -114,12 +114,14 @@
<f:param value="DEFAULT" name="s"/>
</h:outputLink>
</td>
+ <ui:remove>
<td>
<h:outputLink value="#{componentNavigator.currentComponent.contextRelativeDemoLocation}">
Null
<f:param value="NULL" name="s"/>
</h:outputLink>
</td>
+ </ui:remove>
<td class="control">
<rich:toggleControl for="skin_chooser" value="« less" />
</td>
Modified: trunk/samples/richfaces-demo/src/main/webapp/templates/main.xhtml
===================================================================
--- trunk/samples/richfaces-demo/src/main/webapp/templates/main.xhtml 2008-02-19 13:50:09 UTC (rev 6165)
+++ trunk/samples/richfaces-demo/src/main/webapp/templates/main.xhtml 2008-02-19 14:21:16 UTC (rev 6166)
@@ -48,7 +48,7 @@
<!-- tabpanel end -->
<rich:spacer style="height:10px;" />
<rich:separator style="height:1px" />
- <div style="float:right" class="footer-text">${a4j.version}</div>
+ <div style="float:right;" class="footer-text">#{environment.version}</div>
<div style="float:none">
<a href="http://jboss.com/index.html?module=bb&op=viewtopic&t=104575"
style="color:#000; display:block" class="footer-text">RichFaces. Most Important Links</a>
18 years, 2 months
JBoss Rich Faces SVN: r6164 - trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-02-19 08:49:18 -0500 (Tue, 19 Feb 2008)
New Revision: 6164
Added:
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/EditIcon.java
trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/saveControlIcon.java
Log:
icons for inplace components
Added: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/CancelControlIcon.java 2008-02-19 13:49:18 UTC (rev 6164)
@@ -0,0 +1,122 @@
+/**
+ *
+ */
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.GradientPaint;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.util.Date;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.resource.GifRenderer;
+import org.ajax4jsf.resource.InternetResourceBuilder;
+import org.ajax4jsf.resource.Java2Dresource;
+import org.ajax4jsf.resource.ResourceContext;
+import org.ajax4jsf.util.HtmlColor;
+import org.ajax4jsf.util.Zipper2;
+
+/**
+ * implementation of the default CANCEL icon renderer
+ * @author Anton Belevich
+ * @since 3.2.0
+ *
+ */
+public class CancelControlIcon extends Java2Dresource {
+
+ protected static final String ICON_COLOR = "#971715";
+ protected static final String ICON_BORDER = "#FFFFFF";
+ protected static final String ALTERNATE_COLOR = "#ED6161";
+
+ private static final Dimension dimensions = new Dimension(11, 11);
+
+ public CancelControlIcon() {
+ setRenderer(new GifRenderer());
+ setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+ }
+
+ public Dimension getDimensions(FacesContext facesContext, Object data) {
+ return dimensions;
+ }
+
+ protected Dimension getDimensions(ResourceContext resourceContext) {
+ return dimensions;
+ }
+
+ protected Object deserializeData(byte[] objectArray) {
+ if (objectArray == null) {
+ return null;
+ }
+ Zipper2 zipper = new Zipper2(objectArray);
+ return new Color[] {zipper.nextColor(), zipper.nextColor()};
+ }
+
+ protected Object getDataToStore(FacesContext context, Object data){
+
+ byte [] ret = new byte[6];
+
+ Color color = null;
+ Zipper2 zipper = new Zipper2(ret);
+
+ color = HtmlColor.decode(ICON_COLOR);
+ zipper.addColor(color);
+
+ color = HtmlColor.decode(ICON_BORDER);
+ zipper.addColor(color);
+
+ return ret;
+ }
+
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+ Color [] data = (Color[]) restoreData(context);
+
+ Color iconColor = data[0];
+ Color iconBorder = data[1];
+
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
+// g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
+// g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_DEFAULT);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_DEFAULT);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_DEFAULT);
+
+ g2d.setColor(iconColor);
+
+ Color altenateColor = HtmlColor.decode(ALTERNATE_COLOR);
+ GradientPaint gradient = new GradientPaint(2,3,altenateColor,3,9,iconColor);
+ g2d.setPaint(gradient);
+
+ // draw cross
+ g2d.drawLine(2, 3, 7, 8);
+ g2d.drawLine(3, 3, 7, 7);
+ g2d.drawLine(3, 2, 8, 7);
+
+ g2d.drawLine(2, 7, 7, 2);
+ g2d.drawLine(3, 7, 7, 3);
+ g2d.drawLine(3, 8, 8, 3);
+
+ //draw border
+ g2d.setColor(iconBorder);
+ g2d.drawLine(1, 3, 3, 5);
+ g2d.drawLine(3, 5, 1, 7);
+ g2d.drawLine(1, 7, 3, 9);
+ g2d.drawLine(3, 9, 5, 7);
+ g2d.drawLine(5, 7, 7, 9);
+ g2d.drawLine(7, 9, 9, 7);
+ g2d.drawLine(9, 7, 7, 5);
+ g2d.drawLine(7, 5, 9, 3);
+ g2d.drawLine(9, 3, 7, 1);
+ g2d.drawLine(7, 1, 5, 3);
+ g2d.drawLine(5, 3, 3, 1);
+ g2d.drawLine(3, 1, 1, 3);
+
+
+ }
+}
+
Added: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/EditIcon.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/EditIcon.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/EditIcon.java 2008-02-19 13:49:18 UTC (rev 6164)
@@ -0,0 +1,76 @@
+/**
+ *
+ */
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.util.Date;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.resource.GifRenderer;
+import org.ajax4jsf.resource.InternetResourceBuilder;
+import org.ajax4jsf.resource.Java2Dresource;
+import org.ajax4jsf.resource.ResourceContext;
+import org.ajax4jsf.util.HtmlColor;
+import org.ajax4jsf.util.Zipper2;
+
+/**
+ * implementation of the EDIT icon renderer
+ * @author Anton Belevich
+ * @since 3.2.0
+ *
+ */
+public class EditIcon extends Java2Dresource {
+
+ protected static final String ICON_COLOR = "#FF0000";
+
+ private static final Dimension dimensions = new Dimension(4, 4);
+
+ public EditIcon() {
+ setRenderer(new GifRenderer());
+ setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+ }
+
+ public Dimension getDimensions(FacesContext facesContext, Object data) {
+ return dimensions;
+ }
+
+ protected Dimension getDimensions(ResourceContext resourceContext) {
+ return dimensions;
+ }
+
+ protected Object deserializeData(byte[] objectArray) {
+ if (objectArray == null) {
+ return null;
+ }
+ Zipper2 zipper = new Zipper2(objectArray);
+ return new Color[] {zipper.nextColor()};
+ }
+
+ protected Object getDataToStore(FacesContext context, Object data){
+
+ byte [] ret = new byte[3];
+
+ Color color = null;
+ Zipper2 zipper = new Zipper2(ret);
+
+ color = HtmlColor.decode(ICON_COLOR);
+ zipper.addColor(color);
+
+ return ret;
+ }
+
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+ Color [] data = (Color[]) restoreData(context);
+ Color iconColor = data[0];
+
+ g2d.setColor(iconColor);
+ g2d.drawLine(0, 0, 0, 4);
+ g2d.drawLine(0, 0, 4, 0);
+ g2d.drawLine(1, 0, 1, 2);
+ g2d.drawLine(2, 0, 2, 1);
+ }
+}
Added: trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/saveControlIcon.java
===================================================================
--- trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/saveControlIcon.java (rev 0)
+++ trunk/framework/impl/src/main/java/org/richfaces/renderkit/html/images/saveControlIcon.java 2008-02-19 13:49:18 UTC (rev 6164)
@@ -0,0 +1,125 @@
+/**
+ *
+ */
+package org.richfaces.renderkit.html.images;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.RenderingHints;
+import java.util.Date;
+
+import javax.faces.context.FacesContext;
+
+import org.ajax4jsf.resource.GifRenderer;
+import org.ajax4jsf.resource.InternetResourceBuilder;
+import org.ajax4jsf.resource.Java2Dresource;
+import org.ajax4jsf.resource.ResourceContext;
+import org.ajax4jsf.util.HtmlColor;
+import org.ajax4jsf.util.Zipper2;
+
+/**
+ * implementation of the default OK icon renderer
+ * @author Anton Belevich
+ * @since 3.2.0
+ *
+ */
+public class saveControlIcon extends Java2Dresource {
+
+ protected static final String ICON_COLOR = "#5BC248";
+ protected static final String ICON_SHADOW = "#006406";
+ protected static final String ICON_BORDER = "#FFFFFF";
+
+ private static final Dimension dimensions = new Dimension(11, 11);
+
+ public Dimension getDimensions(FacesContext facesContext, Object data) {
+ return dimensions;
+ }
+
+
+ protected Dimension getDimensions(ResourceContext resourceContext) {
+ return dimensions;
+ }
+ public saveControlIcon() {
+ setRenderer(new GifRenderer());
+ setLastModified(new Date(InternetResourceBuilder.getInstance().getStartTime()));
+ }
+
+ protected Object deserializeData(byte[] objectArray) {
+ if (objectArray == null) {
+ return null;
+ }
+ Zipper2 zipper = new Zipper2(objectArray);
+ return new Color[] {zipper.nextColor(), zipper.nextColor(), zipper.nextColor()};
+ }
+
+ protected Object getDataToStore(FacesContext context, Object data){
+
+ byte [] ret = new byte[9];
+
+ Color color = null;
+ Zipper2 zipper = new Zipper2(ret);
+
+ color = HtmlColor.decode(ICON_COLOR);
+ zipper.addColor(color);
+
+ color = HtmlColor.decode(ICON_SHADOW);
+ zipper.addColor(color);
+
+ color = HtmlColor.decode(ICON_BORDER);
+ zipper.addColor(color);
+
+ return ret;
+ }
+
+ protected void paint(ResourceContext context, Graphics2D g2d) {
+ Color [] data = (Color[]) restoreData(context);
+
+ Color iconColor = data[0];
+ Color iconShadow = data[1];
+ Color borderColor = data[2];
+
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
+ g2d.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
+ g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
+ g2d.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
+ g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
+
+ g2d.setColor(iconColor);
+ g2d.drawLine(1, 6, 4, 9);
+ g2d.drawLine(4, 9, 4, 8);
+ g2d.drawLine(4, 8, 2, 6);
+ g2d.drawLine(2, 5, 5, 8);
+ g2d.drawLine(5, 8, 5, 6);
+ g2d.drawLine(5, 6, 9, 2);
+ g2d.drawLine(9, 2, 9, 3);
+ g2d.drawLine(9, 3, 5, 7);
+
+ //draw shadow
+ g2d.setColor(iconShadow);
+ g2d.drawLine(3, 5, 4, 6);
+ g2d.drawLine(5, 9, 6, 8);
+ g2d.drawLine(6, 8, 6, 7);
+ g2d.drawLine(6, 7, 9, 4);
+
+ // draw border
+ g2d.setColor(borderColor);
+ g2d.drawLine(0, 6, 4, 10);
+ g2d.drawLine(4, 10, 5,10);
+ g2d.drawLine(5,10,7,8);
+ g2d.drawLine(7,8,7,7);
+ g2d.drawLine(7,7,10,4);
+ g2d.drawLine(10,4,10,1);
+ g2d.drawLine(10,1,9,1);
+ g2d.drawLine(9,1,5,5);
+ g2d.drawLine(5,5,4,5);
+ g2d.drawLine(4,5,3,4);
+ g2d.drawLine(3,4,2,4);
+ g2d.drawLine(2,4,0,6);
+
+
+
+ }
+}
18 years, 2 months
JBoss Rich Faces SVN: r6163 - in trunk/ui/combobox/src/main: templates and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-02-19 08:49:17 -0500 (Tue, 19 Feb 2008)
New Revision: 6163
Modified:
trunk/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java
trunk/ui/combobox/src/main/templates/combobox.jspx
Log:
items conversation is corrected
Modified: trunk/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java
===================================================================
--- trunk/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java 2008-02-19 13:47:57 UTC (rev 6162)
+++ trunk/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java 2008-02-19 13:49:17 UTC (rev 6163)
@@ -199,11 +199,7 @@
}
public String getItemsTextAsJSArray(FacesContext context, UIComponent component) {
- String script = "";
- if (valuesList != null) {
- script = ScriptUtils.toScript(valuesList);
- }
- return script;
+ return ScriptUtils.toScript(valuesList);
}
public String getAsEventHandler(FacesContext context, UIComponent component, String attributeName) {
Modified: trunk/ui/combobox/src/main/templates/combobox.jspx
===================================================================
--- trunk/ui/combobox/src/main/templates/combobox.jspx 2008-02-19 13:47:57 UTC (rev 6162)
+++ trunk/ui/combobox/src/main/templates/combobox.jspx 2008-02-19 13:49:17 UTC (rev 6163)
@@ -210,7 +210,11 @@
style="width:#{correction}; #{inputStyle}"
autocomplete="off"
/>
- <input id="comboBoxButtonBG#{clientId}" readonly="true" type="text" value="" class="rich-combobox-font-inactive rich-combobox-button-background rich-combobox-button-inactive"/>
+ <input id="comboBoxButtonBG#{clientId}"
+ readonly="true"
+ type="text"
+ value=""
+ class="rich-combobox-font-inactive rich-combobox-button-background rich-combobox-button-inactive"/>
<input id="comboboxButton#{clientId}" readonly="true" disabled="#{disabled}" type="text" value="" style="#{buttonStyle}; background-image: #{buttonIconNormal};"
class="rich-combobox-font-inactive rich-combobox-button-icon-inactive rich-combobox-button-inactive #{buttonDisabledClass}"/>
<div class="rich-combobox-strut rich-combobox-font" style="width:#{correction}">Strut</div>
18 years, 2 months
JBoss Rich Faces SVN: r6162 - trunk/sandbox/ui/inplaceSelect/src/main/templates.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-02-19 08:47:57 -0500 (Tue, 19 Feb 2008)
New Revision: 6162
Modified:
trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
Log:
InplaceSelect component
Modified: trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-02-19 13:47:05 UTC (rev 6161)
+++ trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-02-19 13:47:57 UTC (rev 6162)
@@ -13,7 +13,10 @@
<h:styles>css/inplaceselect.xcss</h:styles>
<h:scripts>
- new org.ajax4jsf.javascript.PrototypeScript()
+ new org.ajax4jsf.javascript.PrototypeScript(),
+ scripts/comboboxUtils.js,
+ scripts/combobox.js,
+ scripts/inplaceselect.js
</h:scripts>
<f:clientid var="clientId" />
@@ -77,16 +80,7 @@
<div id="listPosition#{clientId}" class="cb_list_position">
<div id="listDecoration#{clientId}" class="cb_list_decoration">
<div id="list#{clientId}" class="cb_list_scroll">
- <div class="cb_option cb_font">Option 1</div>
- <div class="cb_option cb_font">Option 2</div>
- <div class="cb_option cb_font">Option 3</div>
- <div class="cb_option cb_font">Option 4</div>
- <div class="cb_option cb_font cb_select">Opt</div>
- <div class="cb_option cb_font">Option 6</div>
- <div class="cb_option cb_font">Option 7</div>
- <div class="cb_option cb_font">Option 8</div>
- <div class="cb_option cb_font">Option 9</div>
- <div class="cb_option cb_font">Option 0</div>
+ <f:call name="encodeItems"/>
</div>
</div>
</div>
@@ -130,7 +124,7 @@
onviewactivated : #{this:getAsEventHandler(context, component, "onviewactivated")}};
var richInplaceList = new Richfaces.ComboBoxList('list#{clientId}', 'listParent#{clientId}', false,
- Richfaces.InplaceSelect.CLASSES, '100px', '100px', itemsText, null,
+ Richfaces.InplaceSelect.CLASSES, '100px', '100px', #{this:getItemsTextAsJSArray(context, component)}, null,
'#{clientId}inplaceTmpValue', 'shadow#{clientId}', 0, 0);
var richInplaceSelect = new Richfaces.InplaceSelect(richInplaceList, '#{clientId}', '#{clientId}inplaceTmpValue',
'#{clientId}inplaceValue', '#{clientId}tabber', '#{clientId}inplaceStrut',
18 years, 2 months
JBoss Rich Faces SVN: r6161 - in trunk/sandbox/ui/inplaceInput/src/main: resources/org/richfaces/renderkit/html/css and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-02-19 08:47:05 -0500 (Tue, 19 Feb 2008)
New Revision: 6161
Modified:
trunk/sandbox/ui/inplaceInput/src/main/config/resources/resource-config.xml
trunk/sandbox/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/css/inplaceinput.xcss
trunk/sandbox/ui/inplaceInput/src/main/templates/inplaceinput.jspx
Log:
move rich save, edit,cancel icons to the rich-impl
Modified: trunk/sandbox/ui/inplaceInput/src/main/config/resources/resource-config.xml
===================================================================
--- trunk/sandbox/ui/inplaceInput/src/main/config/resources/resource-config.xml 2008-02-19 13:17:46 UTC (rev 6160)
+++ trunk/sandbox/ui/inplaceInput/src/main/config/resources/resource-config.xml 2008-02-19 13:47:05 UTC (rev 6161)
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<resource-config>
- <resource class="org.richfaces.renderkit.images.saveControlIcon">
- <name>org.richfaces.renderkit.images.saveControlIcon</name>
+ <resource class="org.richfaces.renderkit.html.images.saveControlIcon">
+ <name>org.richfaces.renderkit.html.images.saveControlIcon</name>
</resource>
- <resource class="org.richfaces.renderkit.images.EditIcon">
- <name>org.richfaces.renderkit.images.EditIcon</name>
+ <resource class="org.richfaces.renderkit.html.images.EditIcon">
+ <name>org.richfaces.renderkit.html.images.EditIcon</name>
</resource>
- <resource class="org.richfaces.renderkit.images.CancelControlIcon">
- <name>org.richfaces.renderkit.images.CancelControlIcon</name>
+ <resource class="org.richfaces.renderkit.html.images.CancelControlIcon">
+ <name>org.richfaces.renderkit.html.images.CancelControlIcon</name>
</resource>
<resource class="org.richfaces.renderkit.html.images.SpinnerButtonGradient">
<name>org.richfaces.renderkit.html.images.SpinnerButtonGradient</name>
Modified: trunk/sandbox/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/css/inplaceinput.xcss
===================================================================
--- trunk/sandbox/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/css/inplaceinput.xcss 2008-02-19 13:17:46 UTC (rev 6160)
+++ trunk/sandbox/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/css/inplaceinput.xcss 2008-02-19 13:47:05 UTC (rev 6161)
@@ -114,7 +114,7 @@
<u:selector name=".rich-inplace-changed">
<u:style name="background-image">
- <f:resource f:key="org.richfaces.renderkit.images.EditIcon"/>
+ <f:resource f:key="org.richfaces.renderkit.html.images.EditIcon"/>
</u:style>
</u:selector>
Modified: trunk/sandbox/ui/inplaceInput/src/main/templates/inplaceinput.jspx
===================================================================
--- trunk/sandbox/ui/inplaceInput/src/main/templates/inplaceinput.jspx 2008-02-19 13:17:46 UTC (rev 6160)
+++ trunk/sandbox/ui/inplaceInput/src/main/templates/inplaceinput.jspx 2008-02-19 13:47:05 UTC (rev 6161)
@@ -16,8 +16,8 @@
new org.ajax4jsf.javascript.PrototypeScript(),
scripts/inplaceinput.js
</h:scripts>
- <f:resource var="saveIcon" name="org.richfaces.renderkit.images.saveControlIcon"/>
- <f:resource var="cancelIcon" name="org.richfaces.renderkit.images.CancelControlIcon"/>
+ <f:resource var="saveIcon" name="org.richfaces.renderkit.html.images.saveControlIcon"/>
+ <f:resource var="cancelIcon" name="org.richfaces.renderkit.html.images.CancelControlIcon"/>
<f:resource var="spacer" name="images/spacer.gif"/>
18 years, 2 months
JBoss Rich Faces SVN: r6160 - in trunk/sandbox/ui/inplaceSelect/src/main: resources/org/richfaces/renderkit/html/css and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: vmolotkov
Date: 2008-02-19 08:17:46 -0500 (Tue, 19 Feb 2008)
New Revision: 6160
Modified:
trunk/sandbox/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/css/inplaceselect.xcss
trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
Log:
InplaceSelect component
Modified: trunk/sandbox/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2008-02-19 12:25:41 UTC (rev 6159)
+++ trunk/sandbox/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2008-02-19 13:17:46 UTC (rev 6160)
@@ -16,6 +16,10 @@
import javax.faces.convert.ConverterException;
import javax.faces.model.SelectItem;
+import org.ajax4jsf.javascript.JSFunctionDefinition;
+import org.ajax4jsf.javascript.JSReference;
+import org.ajax4jsf.javascript.ScriptString;
+import org.ajax4jsf.javascript.ScriptUtils;
import org.ajax4jsf.util.InputUtils;
import org.ajax4jsf.util.SelectUtils;
import org.apache.commons.logging.Log;
@@ -107,4 +111,22 @@
protected Class <? extends UIComponent> getComponentClass() {
return UIInplaceSelect.class;
}
+
+ public String getAsEventHandler(FacesContext context, UIComponent component, String attributeName) {
+ String event = (String) component.getAttributes().get(attributeName);
+ ScriptString result = JSReference.NULL;
+
+ if (event != null) {
+ event = event.trim();
+
+ if (event.length() != 0) {
+ JSFunctionDefinition function = new JSFunctionDefinition();
+ function.addParameter("event");
+ function.addToBody(event);
+
+ result = function;
+ }
+ }
+ return ScriptUtils.toScript(result);
+ }
}
Modified: trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/css/inplaceselect.xcss
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/css/inplaceselect.xcss 2008-02-19 12:25:41 UTC (rev 6159)
+++ trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/css/inplaceselect.xcss 2008-02-19 13:17:46 UTC (rev 6160)
@@ -1,3 +1,11 @@
+<?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[
+
*{font-family : verdana; font-size:11px;}
body{padding : 30px;}
fieldset{padding : 30px; border : 1px solid #c0c0c0;}
@@ -41,4 +49,8 @@
.cb_shadow_tl{ background : url(images/bg_shadow.png) repeat-x top left;}
.cb_shadow_tr{ background : url(images/bg_shadow.png) repeat-x top right;}
.cb_shadow_bl{ background : url(images/bg_shadow.png) repeat-x bottom left;}
-.cb_shadow_br{ background : url(images/bg_shadow.png) repeat-x bottom right;}
\ No newline at end of file
+.cb_shadow_br{ background : url(images/bg_shadow.png) repeat-x bottom right;}
+]]>
+</f:verbatim>
+
+</f:template>
\ No newline at end of file
Modified: trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2008-02-19 12:25:41 UTC (rev 6159)
+++ trunk/sandbox/ui/inplaceSelect/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceselect.js 2008-02-19 13:17:46 UTC (rev 6160)
@@ -0,0 +1,28 @@
+if(!window.Richfaces) window.Richfaces = {};
+Richfaces.InplaceSelect = Class.create(Richfaces.Input, {
+ inizialize : function($super, listObj, clientId, temValueKeepId, valueKeepId, tabberId, strutId, attributes, events, classes, barParams) {
+ $super(clientId, temValueKeepId, valueKeepId, tabberId, strutId, attributes, events, classes, barParams);
+ this.comboList = listObj;
+ },
+
+ initHandlers : function() {
+ this.comboList.list.observe("click", function(e){this.listClickHandler(e);}.bindAsEventListener(this));
+ this.tempValueKeeper.observe("blur", function(e){this.tmpValueBlurHandler(e);}.bindAsEventListener(this));
+ this.tempValueKeeper.observe("blur", function(e){this.tempKeeperClickHandler(e);}.bindAsEventListener(this));
+ },
+
+ tempKeeperClickHandler : function() {
+ this.insList.showWithDelay();
+ },
+
+ tmpValueBlurHandler : function(event) {
+ $super(event);
+ this.comboList.hideWithDelay();
+ },
+
+ listClickHandler : function(event) {
+ this.tempValueKeeper.focus();
+ this.inputProcessing();
+ this.comboList.hideWithDelay();
+ }
+});
Modified: trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-02-19 12:25:41 UTC (rev 6159)
+++ trunk/sandbox/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-02-19 13:17:46 UTC (rev 6160)
@@ -9,66 +9,74 @@
baseclass="org.richfaces.renderkit.InplaceSelectBaseRenderer"
class="org.richfaces.renderkit.html.InplaceSelectRenderer"
component="org.richfaces.component.UIInplaceSelect">
+
+<h:styles>css/inplaceselect.xcss</h:styles>
+<h:scripts>
+ new org.ajax4jsf.javascript.PrototypeScript()
+</h:scripts>
+
<f:clientid var="clientId" />
<f:resource var="spacer" name="images/spacer.gif"/>
- <span id="#{clientId}" class="insel_edit_state">
- <img src="images/spacer.gif" class="insel_strut"/>
- <input readonly="readonly" type="Text" value="New York" class="insel_field"/>
- <div class="insel_btn_set">
- <div class="insel_shadow">
- <table cellpadding="0" cellspacing="0" border="0" class="insel_shadow_size">
- <tr>
- <td class="insel_shadow_tl">
- <img src="#{spacer}" width="10" height="1" alt="" border="0"/><br/>
- </td>
- <td class="insel_shadow_tr">
- <img src="images/spacer.gif" width="1" height="10" alt="" border="0"/><br/>
- </td>
- </tr>
- <tr>
- <td class="insel_shadow_bl">
- <img src="#{spacer}" width="1" height="10" alt="" border="0"/><br/>
- </td>
- <td class="insel_shadow_br">
- <img src="#{spacer}" width="10" height="1" alt="" border="0"/><br/>
- </td>
- </tr>
- </table>
- </div>
- <div style="position : relative">
- <input type="image" src="images/ico_ok.gif" class="insel_btn" onmousedown="this.className='insel_btn_press'" onmouseout="this.className='insel_btn'" onmouseup="this.className='insel_btn'"/>
- <input type="image" src="images/ico_cancel.gif" class="insel_btn" onmousedown="this.className='insel_btn_press'" onmouseout="this.className='insel_btn'" onmouseup="this.className='insel_btn'"/>
- </div>
+<span id="#{clientId}" class="insel_edit_state">
+ <input id="#{clientId}tabber" type="button" value="" style="width: 1px; position: absolute; left: -32767px;" />
+ <img id="#{clientId}inplaceStrut" src="#{spacer}" class="is_strut"/>
+ <input id="#{clientId}inplaceTmpValue" readonly="readonly" type="Text" value="New York" class="insel_field"/>
+ <input id='#{clientId}inplaceValue' name='#{clientId}value' type='hidden' value='#{fieldValue}'/>
+ <div class="insel_btn_set">
+ <div class="insel_shadow">
+ <table cellpadding="0" cellspacing="0" border="0" class="insel_shadow_size">
+ <tr>
+ <td class="insel_shadow_tl">
+ <img src="#{spacer}" width="10" height="1" alt="" border="0"/><br/>
+ </td>
+ <td class="insel_shadow_tr">
+ <img src="#{spacer}" width="1" height="10" alt="" border="0"/><br/>
+ </td>
+ </tr>
+ <tr>
+ <td class="insel_shadow_bl">
+ <img src="#{spacer}" width="1" height="10" alt="" border="0"/><br/>
+ </td>
+ <td class="insel_shadow_br">
+ <img src="#{spacer}" width="10" height="1" alt="" border="0"/><br/>
+ </td>
+ </tr>
+ </table>
</div>
+ <div style="position : relative">
+ <input type="image" src="images/ico_ok.gif" class="insel_btn" onmousedown="this.className='insel_btn_press'" onmouseout="this.className='insel_btn'" onmouseup="this.className='insel_btn'"/>
+ <input type="image" src="images/ico_cancel.gif" class="insel_btn" onmousedown="this.className='insel_btn_press'" onmouseout="this.className='insel_btn'" onmouseup="this.className='insel_btn'"/>
+ </div>
+ </div>
- <div class="cb_width_list" style="position : absolute; height : 100px; left : 0px; top: 13px">
- <iframe class="cb_width_list cb_list_scroll cb_list_position" frameborder="0"></iframe>
+ <div id="listParent#{clientId}" class="cb_width_list" style="position : absolute; height : 100px; left : 0px; top: 13px">
+ <iframe class="cb_width_list cb_list_scroll cb_list_position" frameborder="0"></iframe>
<div class="cb_shadow">
- <table cellpadding="0" cellspacing="0" border="0" width="257" height="109">
+ <table id="shadow#{clientId}" cellpadding="0" cellspacing="0" border="0" width="257" height="109">
<tr>
<td class="cb_shadow_tl">
- <img src="images/spacer.gif" width="10" height="1" alt="" border="0"/><br/>
+ <img src="#{spacer}" width="10" height="1" alt="" border="0"/><br/>
</td>
<td class="cb_shadow_tr">
- <img src="images/spacer.gif" width="1" height="10" alt="" border="0"/><br/>
+ <img src="#{spacer}" width="1" height="10" alt="" border="0"/><br/>
</td>
</tr>
<tr>
<td class="cb_shadow_bl">
- <img src="images/spacer.gif" width="1" height="10" alt="" border="0"/><br/>
+ <img src="#{spacer}" width="1" height="10" alt="" border="0"/><br/>
</td>
<td class="cb_shadow_br">
- <img src="images/spacer.gif" width="10" height="10" alt="" border="0"/><br/>
+ <img src="#{spacer}" width="10" height="10" alt="" border="0"/><br/>
</td>
</tr>
</table>
</div>
- <div class="cb_list_position">
- <div class="cb_list_decoration">
- <div class="cb_list_scroll cb_width_list">
+ <div id="listPosition#{clientId}" class="cb_list_position">
+ <div id="listDecoration#{clientId}" class="cb_list_decoration">
+ <div id="list#{clientId}" class="cb_list_scroll">
<div class="cb_option cb_font">Option 1</div>
<div class="cb_option cb_font">Option 2</div>
<div class="cb_option cb_font">Option 3</div>
@@ -82,8 +90,52 @@
</div>
</div>
</div>
-
- </div>
- </span>
+ </div>
+</span>
+<script type="text/javascript">
+ Richfaces.InplaceSelect.CLASSES = {
+ FIELD : {CLASSES:
+ {NORMAL : "rich-combobox-font-inactive rich-combobox-input-inactive #{inputInactiveClass}",
+ ACTIVE : "rich-combobox-font rich-combobox-input #{inputClass}",
+ DISABLED : "rich-combobox-font-disabled rich-combobox-input-disabled #{inputDisabledClass}"},
+ STYLE :
+ {NORMAL : "#{inputStyle}",
+ ACTIVE : "#{inputStyle}",
+ DISABLED : "#{inputDisabledStyle}"}
+ },
+ COMBO_LIST : {
+ LIST : {CLASSES :{ACTIVE : "rich-combobox-list-cord rich-combobox-list-scroll rich-combobox-list-decoration rich-combobox-list-position #{listClass}"},
+ STYLE : {ACTIVE: "#{listStyle}"}
+ },
+ ITEM : {NORMAL : "rich-combobox-item #{itemClass}",
+ SELECTED : "rich-combobox-item rich-combobox-item-selected #{itemSelectedClass}"
+ }
+ }
+ }
+ var richInplaceSelAttributes = {defaultLabel : '#{component.attributes["defaultLabel"]}',
+ showControls : #{component.attributes["showControls"]},
+ applyFromControlsOnly : #{component.attributes["applyFromControlsOnly"]},
+ editEvent : '#{component.attributes["editEvent"]}',
+ verticalPosition : '#{component.attributes["controlsPosition"]}',
+ horizontalPosition : '#{component.attributes["controlsHorizontalAlign"]}',
+ inputWidth : '#{component.attributes["inputWidth"]}',
+ inputMinWidth : '#{component.attributes["inputMinWidth"]}',
+ inputMaxWidth : '#{component.attributes["inputMaxWidth"]}'
+ };
+
+ var richInplaceSelEvents = {oneditactivation : #{this:getAsEventHandler(context, component, "oneditactivation")},
+ onviewactivation : #{this:getAsEventHandler(context, component, "onviewactivation")},
+ oneditactivated : #{this:getAsEventHandler(context, component, "oneditactivated")},
+ onviewactivated : #{this:getAsEventHandler(context, component, "onviewactivated")}};
+
+ var richInplaceList = new Richfaces.ComboBoxList('list#{clientId}', 'listParent#{clientId}', false,
+ Richfaces.InplaceSelect.CLASSES, '100px', '100px', itemsText, null,
+ '#{clientId}inplaceTmpValue', 'shadow#{clientId}', 0, 0);
+ var richInplaceSelect = new Richfaces.InplaceSelect(richInplaceList, '#{clientId}', '#{clientId}inplaceTmpValue',
+ '#{clientId}inplaceValue', '#{clientId}tabber', '#{clientId}inplaceStrut',
+ richInplaceSelAttributes, richInplaceSelEvents, Richfaces.InplaceSelect.CLASSES,
+ ['#{clientId}bar', '#{clientId}ok', '#{clientId}cancel', '#{clientId}buttons']);
+</script>
+
</f:root>
\ No newline at end of file
18 years, 2 months
JBoss Rich Faces SVN: r6159 - in trunk/sandbox/ui/inplaceSelect: src/main/java/org/richfaces/renderkit and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-02-19 07:25:41 -0500 (Tue, 19 Feb 2008)
New Revision: 6159
Modified:
trunk/sandbox/ui/inplaceSelect/pom.xml
trunk/sandbox/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
Log:
extends inplaceSelect from combobox
Modified: trunk/sandbox/ui/inplaceSelect/pom.xml
===================================================================
--- trunk/sandbox/ui/inplaceSelect/pom.xml 2008-02-19 12:23:34 UTC (rev 6158)
+++ trunk/sandbox/ui/inplaceSelect/pom.xml 2008-02-19 12:25:41 UTC (rev 6159)
@@ -50,6 +50,12 @@
<groupId>org.richfaces.framework</groupId>
<artifactId>richfaces-api</artifactId>
<version>3.2.0-SNAPSHOT</version>
- </dependency>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>combobox</artifactId>
+ <version>3.2.0-SNAPSHOT</version>
+ </dependency>
+
</dependencies>
</project>
\ No newline at end of file
Modified: trunk/sandbox/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
===================================================================
--- trunk/sandbox/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2008-02-19 12:23:34 UTC (rev 6158)
+++ trunk/sandbox/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2008-02-19 12:25:41 UTC (rev 6159)
@@ -3,21 +3,108 @@
*/
package org.richfaces.renderkit;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.context.ResponseWriter;
+import javax.faces.convert.Converter;
+import javax.faces.convert.ConverterException;
+import javax.faces.model.SelectItem;
-import org.ajax4jsf.renderkit.HeaderResourcesRendererBase;
+import org.ajax4jsf.util.InputUtils;
+import org.ajax4jsf.util.SelectUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.richfaces.component.UIInplaceSelect;
/**
* @author Anton Belevich
*
*/
-public class InplaceSelectBaseRenderer extends HeaderResourcesRendererBase{
+public class InplaceSelectBaseRenderer extends ComboBoxBaseRenderer{
+
+ private static Log logger = LogFactory.getLog(InplaceSelectBaseRenderer.class);
+ private static final String RICH_INPLACE_SELECT_CLASSES = "rich-iselect-item rich-iselect-item-normal";
+ private ArrayList <String> valuesList = null;
- protected Class<? extends UIComponent> getComponentClass() {
- return UIInplaceSelect.class;
+ @Override
+ protected void doDecode(FacesContext context, UIComponent component) {
+ UIInplaceSelect inplaceInput = null;
+
+ if (component instanceof UIInplaceSelect) {
+ inplaceInput = (UIInplaceSelect) component;
+ } else {
+ if (logger.isDebugEnabled()) {
+ logger.debug("No decoding necessary since the component "
+ + component.getId() +
+ " is not an instance or a sub class of UIComboBox");
+ }
+ return;
+ }
+
+ if (InputUtils.isDisabled(inplaceInput) || InputUtils.isReadOnly(inplaceInput)) {
+ if (logger.isDebugEnabled()) {
+ logger.debug(("No decoding necessary since the component "
+ + component.getId() + " is disabled"));
+ }
+ }
+
+ String clientId = component.getClientId(context);
+ if (clientId == null) {
+ throw new NullPointerException("component " + inplaceInput.getClientId(context) + " client id is NULL" );
+ }
+
+ clientId = clientId + "inplaceValue";
+ Map request = context.getExternalContext().getRequestParameterMap();
+ if (request.containsKey(clientId)) {
+ String newValue = (String)request.get(clientId);
+ inplaceInput.setSubmittedValue(newValue);
+ }
}
+ @Override
+ public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException {
+ UIInplaceSelect select = null;
+ Converter converter = null;
+ if (component instanceof UIInplaceSelect) {
+ select = (UIInplaceSelect)component;
+ converter = select.getConverter();
+ }
+ return getConvertedValue(context, component, submittedValue, converter);
+ }
-
+ public void encodeItems( FacesContext context, UIComponent component) throws IOException {
+ valuesList = new ArrayList<String>();
+ ResponseWriter writer = context.getResponseWriter();
+
+ List <SelectItem> selectItems = SelectUtils.getSelectItems(context, component);
+ if(!selectItems.isEmpty()) {
+ for (Iterator <SelectItem> iterator = selectItems.iterator(); iterator.hasNext();) {
+ SelectItem selectItem = iterator.next();
+ String value = getConvertedStringValue(context, component, selectItem.getValue());
+ valuesList.add(value);
+ encodeSuggestion(writer, component, value, RICH_INPLACE_SELECT_CLASSES);
+ }
+ }
+ }
+
+ @Override
+ protected String getConvertedStringValue(FacesContext context, UIComponent component, Object value) {
+ UIInplaceSelect select = null;
+ Converter converter = null;
+ if (component instanceof UIInplaceSelect) {
+ select = (UIInplaceSelect)component;
+ converter = select.getConverter();
+ }
+ return getConvertedStringValue(context, component, value, converter);
+ }
+
+ protected Class <? extends UIComponent> getComponentClass() {
+ return UIInplaceSelect.class;
+ }
}
18 years, 2 months
JBoss Rich Faces SVN: r6158 - trunk/ui/combobox/src/main/java/org/richfaces/renderkit.
by richfaces-svn-commits@lists.jboss.org
Author: abelevich
Date: 2008-02-19 07:23:34 -0500 (Tue, 19 Feb 2008)
New Revision: 6158
Modified:
trunk/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java
Log:
code refactoring for inplaceSelect needs
Modified: trunk/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java
===================================================================
--- trunk/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java 2008-02-19 11:55:26 UTC (rev 6157)
+++ trunk/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java 2008-02-19 12:23:34 UTC (rev 6158)
@@ -37,10 +37,11 @@
public class ComboBoxBaseRenderer extends HeaderResourcesRendererBase {
private ArrayList <String> valuesList = null;
+ private final String RICH_COMBOBOX_ITEM_CLASSES = "rich-combobox-item rich-combobox-item-normal";
private static Log logger = LogFactory.getLog(ComboBoxBaseRenderer.class);
- protected Class<UIComboBox> getComponentClass() {
+ protected Class<? extends UIComponent> getComponentClass() {
return UIComboBox.class;
}
@@ -89,14 +90,14 @@
for (Iterator iterator = ((Collection)suggestionValues).iterator(); iterator.hasNext();) {
String value = getConvertedStringValue(context, comboBox, iterator.next()) ;
valuesList.add(value);
- encodeSuggestion(writer, comboBox, value);
+ encodeSuggestion(writer, comboBox, value, RICH_COMBOBOX_ITEM_CLASSES);
}
} else if (suggestionValues.getClass().isArray()) {
Object [] suggestions = (Object [])suggestionValues;
for (int i = 0; i < suggestions.length; i++) {
String value = getConvertedStringValue(context, comboBox, suggestions[i]);
valuesList.add(value);
- encodeSuggestion(writer, comboBox, value );
+ encodeSuggestion(writer, comboBox, value, RICH_COMBOBOX_ITEM_CLASSES );
}
} else {
throw new IllegalArgumentException("suggestionValues should be Collection or array");
@@ -110,22 +111,30 @@
SelectItem selectItem = iterator.next();
String value = getConvertedStringValue(context, comboBox, selectItem.getValue());
valuesList.add(value);
- encodeSuggestion(writer, comboBox, value);
+ encodeSuggestion(writer, comboBox, value, RICH_COMBOBOX_ITEM_CLASSES);
}
}
}
@Override
public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue) throws ConverterException {
+ UIComboBox comboBox = null;
+ Converter converter = null;
+
+ if(component instanceof UIComboBox) {
+ comboBox = (UIComboBox)component;
+ converter = comboBox.getConverter();
+ }
+
+ return getConvertedValue(context, component, submittedValue, converter);
+ }
+
+ public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue, Converter converter) {
Object convertedValue = null;
- UIComboBox comboBox = null;
String newValue = (String)submittedValue;
+
+ ValueExpression valueExpression = component.getValueExpression("value");
- comboBox = (UIComboBox)component;
-
- Converter converter = comboBox.getConverter();
- ValueExpression valueExpression = component.getValueExpression("value");
-
if (converter == null) {
if (valueExpression != null) {
Class valueType = valueExpression.getType(context.getELContext());
@@ -140,7 +149,6 @@
throw new ConverterException(Messages.getMessage(Messages.NO_CONVERTER_FOUND_ERROR, valueType.getName()));
}
}
-
}
}
@@ -150,11 +158,20 @@
convertedValue = newValue;
}
return convertedValue;
+
+
}
- protected String getConvertedStringValue(FacesContext context, UIComboBox comboBox, Object value) {
- Converter converter = comboBox.getConverter();
-
+ protected String getConvertedStringValue(FacesContext context, UIComponent component, Object value) {
+ Converter converter = null;
+ if (component instanceof UIComboBox) {
+ UIComboBox comboBox = (UIComboBox)component;
+ converter = comboBox.getConverter();
+ }
+ return getConvertedStringValue(context, component, value, converter);
+ }
+
+ protected String getConvertedStringValue(FacesContext context, UIComponent component, Object value, Converter converter) {
if (converter == null) {
if (value == null) {
return "";
@@ -171,12 +188,12 @@
return value.toString();
}
}
- return converter.getAsString(context, comboBox, value);
+ return converter.getAsString(context, component, value);
}
- public void encodeSuggestion(ResponseWriter writer, UIComboBox comboBox, String value) throws IOException{
- writer.startElement(HTML.DIV_ELEM, comboBox);
- writer.writeAttribute(HTML.class_ATTRIBUTE, "rich-combobox-item rich-combobox-item-normal", null);
+ public void encodeSuggestion(ResponseWriter writer, UIComponent component, String value, String classes) throws IOException{
+ writer.startElement(HTML.DIV_ELEM, component);
+ writer.writeAttribute(HTML.class_ATTRIBUTE, classes, null);
writer.write(value);
writer.endElement(HTML.DIV_ELEM);
}
18 years, 2 months