Author: alexsmirnov
Date: 2010-10-11 13:10:02 -0400 (Mon, 11 Oct 2010)
New Revision: 19524
Modified:
branches/RF-8742/
branches/RF-8742/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java
branches/RF-8742/ui/input/api/src/main/java/org/richfaces/component/InplaceState.java
branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java
branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js
branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
Log:
Merged revisions 19517-19519 via svnmerge from
https://svn.jboss.org/repos/richfaces/trunk
.......
r19517 | abelevich | 2010-10-11 05:22:58 -0700 (Mon, 11 Oct 2010) | 1 line
refactor scripts
.......
r19518 | abelevich | 2010-10-11 06:16:22 -0700 (Mon, 11 Oct 2010) | 1 line
https://jira.jboss.org/browse/RF-9431
.......
r19519 | abelevich | 2010-10-11 07:13:05 -0700 (Mon, 11 Oct 2010) | 1 line
add license headers, add events for the inplaceSelect component
.......
Property changes on: branches/RF-8742
___________________________________________________________________
Name: svnmerge-integrated
- /trunk:1-19508
+ /trunk:1-19522
Modified:
branches/RF-8742/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java
===================================================================
---
branches/RF-8742/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java 2010-10-11
16:35:28 UTC (rev 19523)
+++
branches/RF-8742/ui/input/api/src/main/java/org/richfaces/component/InplaceComponent.java 2010-10-11
17:10:02 UTC (rev 19524)
@@ -1,6 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
package org.richfaces.component;
+/**
+ * @author Anton Belevich
+ *
+ */
public interface InplaceComponent {
public String getDefaultLabel();
Modified:
branches/RF-8742/ui/input/api/src/main/java/org/richfaces/component/InplaceState.java
===================================================================
---
branches/RF-8742/ui/input/api/src/main/java/org/richfaces/component/InplaceState.java 2010-10-11
16:35:28 UTC (rev 19523)
+++
branches/RF-8742/ui/input/api/src/main/java/org/richfaces/component/InplaceState.java 2010-10-11
17:10:02 UTC (rev 19524)
@@ -19,8 +19,15 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
*/
+
package org.richfaces.component;
+
+/**
+ * @author Anton Belevich
+ *
+ */
+
public enum InplaceState {
ready,
edit,
Modified:
branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java
===================================================================
---
branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java 2010-10-11
16:35:28 UTC (rev 19523)
+++
branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceInput.java 2010-10-11
17:10:02 UTC (rev 19524)
@@ -103,41 +103,41 @@
@Attribute(events=@EventName("mouseup"))
public abstract String getOnmouseup();
- @Attribute(events=@EventName("inputClick"))
- public abstract String getOnInputClick();
+ @Attribute(events=@EventName("inputclick"))
+ public abstract String getOninputclick();
- @Attribute(events=@EventName("inputDblclick"))
- public abstract String getOnInputDblclick();
+ @Attribute(events=@EventName("inputdblclick"))
+ public abstract String getOninputdblclick();
- @Attribute(events=@EventName("inputMousedown"))
- public abstract String getOnInputMousedown();
+ @Attribute(events=@EventName("inputmousedown"))
+ public abstract String getOninputmousedown();
- @Attribute(events=@EventName("inputMousemove"))
- public abstract String getOnInputMousemove();
+ @Attribute(events=@EventName("inputmousemove"))
+ public abstract String getOninputmousemove();
- @Attribute(events=@EventName("inputMouseout"))
- public abstract String getOnInputMouseout();
+ @Attribute(events=@EventName("inputmouseout"))
+ public abstract String getOninputmouseout();
- @Attribute(events=@EventName("inputMouseover"))
- public abstract String getOnInputMouseover();
+ @Attribute(events=@EventName("inputmouseover"))
+ public abstract String getOninputmouseover();
- @Attribute(events=@EventName("inputMouseup"))
- public abstract String getOnInputMouseup();
+ @Attribute(events=@EventName("inputmouseup"))
+ public abstract String getOninputmouseup();
- @Attribute(events=@EventName("inputKeydown"))
- public abstract String getOnInputKeydown();
+ @Attribute(events=@EventName("inputkeydown"))
+ public abstract String getOninputkeydown();
- @Attribute(events=@EventName("inputKeypress"))
- public abstract String getOnInputKeypress();
+ @Attribute(events=@EventName("inputkeypress"))
+ public abstract String getOninputkeypress();
- @Attribute(events=@EventName("oninputKeyup"))
- public abstract String getOnInputKeypup();
+ @Attribute(events=@EventName("oninputkeyup"))
+ public abstract String getOninputkeypup();
- @Attribute(events=@EventName("inputFocus"))
- public abstract String getOnInputFocus();
+ @Attribute(events=@EventName("inputfocus"))
+ public abstract String getOninputfocus();
- @Attribute(events=@EventName("inputBlur"))
- public abstract String getOnInputBlur();
+ @Attribute(events=@EventName("inputblur"))
+ public abstract String getOninputblur();
@Attribute(events=@EventName("select"))
public abstract String getOnselect();
Modified:
branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java
===================================================================
---
branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java 2010-10-11
16:35:28 UTC (rev 19523)
+++
branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/component/AbstractInplaceSelect.java 2010-10-11
17:10:02 UTC (rev 19524)
@@ -1,3 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
package org.richfaces.component;
import javax.faces.component.UISelectOne;
@@ -3,4 +25,5 @@
import org.richfaces.cdk.annotations.Attribute;
+import org.richfaces.cdk.annotations.EventName;
import org.richfaces.cdk.annotations.JsfComponent;
import org.richfaces.cdk.annotations.JsfRenderer;
@@ -46,4 +69,47 @@
@Attribute(defaultValue="click")
public abstract String getEditEvent();
+
+ @Attribute(events=@EventName("blur"))
+ public abstract String getOnblur();
+
+ @Attribute(events=@EventName("click"))
+ public abstract String getOnclick();
+
+ @Attribute(events=@EventName("ondblclick"))
+ public abstract String getOndblclick();
+
+ @Attribute(events=@EventName("focus"))
+ public abstract String getOnfocus();
+
+ @Attribute(events=@EventName("keydown"))
+ public abstract String getOnkeydown();
+
+ @Attribute(events=@EventName("keypress"))
+ public abstract String getOnkeypress();
+
+ @Attribute(events=@EventName("keyup"))
+ public abstract String getOnkeypup();
+
+ @Attribute(events=@EventName("mousedown"))
+ public abstract String getOnmousedown();
+
+ @Attribute(events=@EventName("mousemove"))
+ public abstract String getOnmousemove();
+
+ @Attribute(events=@EventName("mouseout"))
+ public abstract String getOnmouseout();
+
+ @Attribute(events=@EventName("mouseover"))
+ public abstract String getOnmouseover();
+
+ @Attribute(events=@EventName("mouseup"))
+ public abstract String getOnmouseup();
+
+ @Attribute(events=@EventName("select"))
+ public abstract String getOnselect();
+
+ @Attribute(events=@EventName("change"))
+ public abstract String getOnchange();
+
}
Modified:
branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
===================================================================
---
branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-10-11
16:35:28 UTC (rev 19523)
+++
branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-10-11
17:10:02 UTC (rev 19524)
@@ -81,30 +81,30 @@
private static final Map<String, ComponentAttribute>
INPLACEINPUT_HANDLER_ATTRIBUTES = Collections
.unmodifiableMap(ComponentAttribute.createMap(
- new
ComponentAttribute(HtmlConstants.ONCLICK_ATTRIBUTE).setEventNames("inputClick").
- setComponentAttributeName("onInputClick"),
- new
ComponentAttribute(HtmlConstants.ONDBLCLICK_ATTRIBUTE).setEventNames("inputDblclick").
- setComponentAttributeName("onInputDblclick"),
- new
ComponentAttribute(HtmlConstants.ONMOUSEDOWN_ATTRIBUTE).setEventNames("inputMousedown").
- setComponentAttributeName("onInputMousedown"),
- new
ComponentAttribute(HtmlConstants.ONMOUSEUP_ATTRIBUTE).setEventNames("inputMouseup").
- setComponentAttributeName("onInputMouseup"),
- new
ComponentAttribute(HtmlConstants.ONMOUSEOVER_ATTRIBUTE).setEventNames("inputMouseover").
- setComponentAttributeName("onInputMouseover"),
- new
ComponentAttribute(HtmlConstants.ONMOUSEMOVE_ATTRIBUTE).setEventNames("inputMousemove").
- setComponentAttributeName("onInputMousemove"),
- new
ComponentAttribute(HtmlConstants.ONMOUSEOUT_ATTRIBUTE).setEventNames("inputMouseout").
- setComponentAttributeName("onInputMouseout"),
- new
ComponentAttribute(HtmlConstants.ONKEYPRESS_ATTRIBUTE).setEventNames("inputKeypress").
- setComponentAttributeName("onInputKeypress"),
- new
ComponentAttribute(HtmlConstants.ONKEYDOWN_ATTRIBUTE).setEventNames("inputKeydown").
- setComponentAttributeName("onInputKeydown"),
- new
ComponentAttribute(HtmlConstants.ONKEYUP_ATTRIBUTE).setEventNames("inputKeyup").
- setComponentAttributeName("onInputKeyup"),
- new
ComponentAttribute(HtmlConstants.ONBLUR_ATTRIBUTE).setEventNames("inputBlur").
- setComponentAttributeName("onInputBlur"),
- new
ComponentAttribute(HtmlConstants.ONFOCUS_ATTRIBUTE).setEventNames("inputFocus").
- setComponentAttributeName("onInputFocus"),
+ new
ComponentAttribute(HtmlConstants.ONCLICK_ATTRIBUTE).setEventNames("inputclick").
+ setComponentAttributeName("oninputclick"),
+ new
ComponentAttribute(HtmlConstants.ONDBLCLICK_ATTRIBUTE).setEventNames("inputdblclick").
+ setComponentAttributeName("oninputdblclick"),
+ new
ComponentAttribute(HtmlConstants.ONMOUSEDOWN_ATTRIBUTE).setEventNames("inputmousedown").
+ setComponentAttributeName("oninputmousedown"),
+ new
ComponentAttribute(HtmlConstants.ONMOUSEUP_ATTRIBUTE).setEventNames("inputmouseup").
+ setComponentAttributeName("oninputmouseup"),
+ new
ComponentAttribute(HtmlConstants.ONMOUSEOVER_ATTRIBUTE).setEventNames("inputmouseover").
+ setComponentAttributeName("oninputmouseover"),
+ new
ComponentAttribute(HtmlConstants.ONMOUSEMOVE_ATTRIBUTE).setEventNames("inputmousemove").
+ setComponentAttributeName("oninputmousemove"),
+ new
ComponentAttribute(HtmlConstants.ONMOUSEOUT_ATTRIBUTE).setEventNames("inputmouseout").
+ setComponentAttributeName("oninputmouseout"),
+ new
ComponentAttribute(HtmlConstants.ONKEYPRESS_ATTRIBUTE).setEventNames("inputkeypress").
+ setComponentAttributeName("oninputkeypress"),
+ new
ComponentAttribute(HtmlConstants.ONKEYDOWN_ATTRIBUTE).setEventNames("inputkeydown").
+ setComponentAttributeName("oninputkeydown"),
+ new
ComponentAttribute(HtmlConstants.ONKEYUP_ATTRIBUTE).setEventNames("inputkeyup").
+ setComponentAttributeName("oninputkeyup"),
+ new
ComponentAttribute(HtmlConstants.ONBLUR_ATTRIBUTE).setEventNames("inputblur").
+ setComponentAttributeName("oninputblur"),
+ new
ComponentAttribute(HtmlConstants.ONFOCUS_ATTRIBUTE).setEventNames("inputfocus").
+ setComponentAttributeName("oninputfocus"),
new
ComponentAttribute(HtmlConstants.ONCHANGE_ATTRIBUTE).setEventNames("change").
setComponentAttributeName("onchange"),
new
ComponentAttribute(HtmlConstants.ONSELECT_ATTRIBUTE).setEventNames("select").
Modified:
branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
===================================================================
---
branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2010-10-11
16:35:28 UTC (rev 19523)
+++
branches/RF-8742/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2010-10-11
17:10:02 UTC (rev 19524)
@@ -1,3 +1,25 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
package org.richfaces.renderkit;
import java.io.IOException;
@@ -2,2 +24,3 @@
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
@@ -95,7 +118,16 @@
+ "}";
}
}
+
+ private static final Map<String, ComponentAttribute>
INPLACESELECT_HANDLER_ATTRIBUTES = Collections
+ .unmodifiableMap(ComponentAttribute.createMap(
+ new
ComponentAttribute(HtmlConstants.ONCHANGE_ATTRIBUTE).setEventNames("change").
+ setComponentAttributeName("onchange"),
+ new
ComponentAttribute(HtmlConstants.ONSELECT_ATTRIBUTE).setEventNames("select").
+ setComponentAttributeName("onselect")
+ ));
+
@Override
protected String getScriptName() {
return "new RichFaces.ui.InplaceSelect";
@@ -116,8 +148,13 @@
}
return clientSelectItems;
}
-
+
@Override
+ protected void renderInputHandlers(FacesContext facesContext, UIComponent component)
throws IOException {
+ RenderKitUtils.renderPassThroughAttributesOptimized(facesContext, component,
INPLACESELECT_HANDLER_ATTRIBUTES);
+ }
+
+ @Override
public void addToOptions(FacesContext facesContext, UIComponent component,
Map<String, Object> options, Object additional) {
options.put(OPTIONS_ITEM_CLASS, "rf-is-opt");
Modified:
branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js
===================================================================
---
branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js 2010-10-11
16:35:28 UTC (rev 19523)
+++
branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceBase.js 2010-10-11
17:10:02 UTC (rev 19524)
@@ -32,7 +32,6 @@
this.editEvent = options.editEvent;
this.noneCss = options.noneCss;
this.changedCss = options.changedCss;
- this.showControls = options.showControls;
this.defaultLabel = options.defaultLabel;
this.element = $(document.getElementById(id));
@@ -43,12 +42,6 @@
this.isSaved = false;
this.useDefaultLabel = false;
- if(this.showControls) {
- this.okbtn = $(document.getElementById(options.okbtn));
- this.cancelbtn = $(document.getElementById(options.cancelbtn));
- this.okbtn.bind("mousedown", $.proxy(this.__saveBtnHandler, this));
- this.cancelbtn.bind("mousedown", $.proxy(this.__cancelBtnHandler,
this));
- }
};
rf.BaseComponent.extend(rf.ui.InplaceBase);
@@ -84,6 +77,10 @@
getNamespace: function() {
},
+ isValueSaved: function() {
+ return this.isSaved;
+ },
+
save: function() {
var value = this.getValue()
if(value.length > 0) {
@@ -99,14 +96,6 @@
this.__hide();
},
- __applyChangedStyles: function() {
- if(this.isValueChanged()) {
- this.element.addClass(this.changedCss);
- } else {
- this.element.removeClass(this.changedCss);
- }
- },
-
cancel: function(){
var text = "";
if(!this.useDefaultLabel) {
@@ -117,14 +106,14 @@
this.__hide();
},
- isValueSaved: function() {
- return this.isSaved;
+ __applyChangedStyles: function() {
+ if(this.isValueChanged()) {
+ this.element.addClass(this.changedCss);
+ } else {
+ this.element.removeClass(this.changedCss);
+ }
},
- __saveValue: function(value) {
-
- },
-
__show: function() {
this.scrollElements = rf.Event.bindScrollEventHandlers(this.id, this.__scrollHandler,
this);
this.onshow();
@@ -143,18 +132,7 @@
this.isSaved = false;
this.editContainer.removeClass(this.noneCss);
this.__show();
- },
-
- __saveBtnHandler: function(e) {
- this.save();
- return false;
- },
-
- __cancelBtnHandler: function(e) {
- this.cancel();
- return false;
- },
-
+ },
__scrollHandler: function(e) {
this.cancel();
},
Modified:
branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
===================================================================
---
branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-10-11
16:35:28 UTC (rev 19523)
+++
branches/RF-8742/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-10-11
17:10:02 UTC (rev 19524)
@@ -12,12 +12,20 @@
var inputLabel = this.input.val();
this.initialValue = (label == inputLabel) ? label : "";
this.saveOnBlur = options.saveOnBlur;
+ this.showControls = options.showControls;
this.input.bind("focus", $.proxy(this.__editHandler, this));
this.input.bind("change", $.proxy(this.__changeHandler, this));
this.input.bind("blur", $.proxy(this.__blurHandler, this));
this.input.bind("keydown", $.proxy(this.__keydownHandler, this));
+ if(this.showControls) {
+ this.okbtn = $(document.getElementById(options.okbtn));
+ this.cancelbtn = $(document.getElementById(options.cancelbtn));
+ this.okbtn.bind("mousedown", $.proxy(this.__saveBtnHandler,
this));
+ this.cancelbtn.bind("mousedown", $.proxy(this.__cancelBtnHandler,
this));
+ }
+
this.focusElement = $(document.getElementById(options.focusElement));
};
@@ -73,6 +81,16 @@
this.input.focus();
this.input.bind("focus", $.proxy(this.__editHandler, this));
},
+
+ __saveBtnHandler: function(e) {
+ this.save();
+ return false;
+ },
+
+ __cancelBtnHandler: function(e) {
+ this.cancel();
+ return false;
+ },
getValue: function() {
return this.input.val();