Author: abelevich
Date: 2010-08-12 13:43:25 -0400 (Thu, 12 Aug 2010)
New Revision: 18596
Added:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/bg_shadow.png
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/ico_cancel.gif
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/ico_ok.gif
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/mark_changed.gif
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/mark_list.gif
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/spacer.gif
Removed:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/css/
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/images/
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/script/
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml
Log:
move resources to the org.richfaces, add ok/cancel button support
Modified:
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
===================================================================
---
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-08-12
15:15:56 UTC (rev 18595)
+++
trunk/ui/input/ui/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2010-08-12
17:43:25 UTC (rev 18596)
@@ -46,8 +46,8 @@
@ResourceDependencies({ @ResourceDependency(library = "javax.faces", name =
"jsf.js"),
@ResourceDependency(name = "jquery.js"), @ResourceDependency(name =
"richfaces.js"),
@ResourceDependency(name = "richfaces-event.js"),
- @ResourceDependency(library="org.richfaces.script", name =
"inplaceInput.js"),
- @ResourceDependency(library="org.richfaces.css", name =
"inplaceInput.ecss") })
+ @ResourceDependency(library="org.richfaces", name =
"inplaceInput.js"),
+ @ResourceDependency(library="org.richfaces", name =
"inplaceInput.ecss") })
public class InplaceInputBaseRenderer extends RendererBase {
public static final String OPTIONS_STATE = "state";
Added:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/bg_shadow.png
===================================================================
(Binary files differ)
Property changes on:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/bg_shadow.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/ico_cancel.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/ico_cancel.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/ico_ok.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/ico_ok.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss
===================================================================
---
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss
(rev 0)
+++
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.ecss 2010-08-12
17:43:25 UTC (rev 18596)
@@ -0,0 +1,155 @@
+input.rf-ii-f {
+ background-image: none;
+ background-color : '#{richSkin.editBackgroundColor}';
+ border-bottom-width : 10px;
+ border-bottom-style: solid;
+ border-bottom-color: '#{richSkin.editBackgroundColor}';
+ padding : 0px 0px 0px 0px;
+ border : 0px;
+ margin : 0px;
+ width : 100%;
+ height : 100%;
+ font-family:inherit;
+ font-size : inherit;
+}
+
+.rf-ii-d-s {
+ display : inline-block;
+ white-space : nowrap;
+ background-color : '#{richSkin.editorBackgroundColor}';
+ border-bottom-width : 1px;
+ border-bottom-style : dashed;
+ border-bottom-color : '#{richSkin.generalTextColor}';
+ padding-left : 3px;
+ padding-right : 3px;
+ display : inline-block;
+ position : relative;
+}
+
+.rf-ii-c-s {
+ display : inline-block;
+ background-image :
url("#{resource['org.richfaces:mark_changed.gif']}");
+ background-position : top left;
+ background-repeat : no-repeat;
+}
+
+.rf-ii-e-s {
+ position : absolute;
+ top : 0px;
+ left : 0px;
+ display : inline-block;
+}
+
+.rf-ii-f {
+ background-color : '#{richSkin.editBackgroundColor}';
+ border-bottom-width : 10px;
+ border-bottom-style: solid;
+ border-bottom-color: '#{richSkin.editBackgroundColor}';
+ padding : 0px 0px 0px 0px;
+ border : 0px;
+ margin : 0px;
+ width : 100%;
+ height : 100%
+}
+
+.rf-ii-strut {
+ width : 100px;
+ height : 1px
+}
+
+.rf-ii-btn {
+ background-image :
"url(#{resource['org.richfaces.renderkit.html.images.InplaceComponentButtonGradientImage']})";
+ background-position: top;
+ background-repeat: repeat-x;
+ background-color: '#{richSkin.tabBackgroundColor}';
+ border-width : 1px;
+ border-style: outset;
+ border-color: '#{richSkin.panelBorderColor}';
+ padding : 0px;
+ margin : 0px;
+}
+
+.rf-ii-btn-p {
+ background-image :
"url(#{resource['org.richfaces.renderkit.html.images.InplaceComponentPressButtonGradientImage']})";
+ background-position: top;
+ background-repeat: repeat-x;
+ background-color: '#{richSkin.tabBackgroundColor}';
+ border-width : 1px;
+ border-style : inset;
+ border-color : '#{richSkin.panelBorderColor}';
+ padding : 0px;
+ margin : 0px;
+}
+
+.rf-ii-btn-set {
+ position : absolute;
+ top:0px;
+ left : 100px;
+ white-space : nowrap;
+}
+
+.rf-ii-btn-prepos {
+ position : absolute;
+ bottom : 0px;
+ right : 0px;
+ wigth : 1px;
+ height : 1px;
+}
+
+.rf-ii-btn-pos {
+ position : absolute;
+ top : 1px;
+ right : 0px;
+ white-space : nowrap;
+}
+
+.rf-ii-btn-shadow {
+ position: relative;
+ padding : 6px 6px 6px 6px;
+ top : -6px;
+ right : -6px;
+}
+
+.rf-ii-btn-shadow-t {
+ background-position : top left;
+ background-image : url("#{resource['org.richfaces:bg_shadow.png']}");
+ position : absolute;
+ width : 6px;
+ top : 0px;
+ bottom : 6px;
+ left : 0px
+}
+
+.rf-ii-btn-shadow-l {
+ background-position : bottom left;
+ background-image : url("#{resource['org.richfaces:bg_shadow.png']}");
+ position : absolute;
+ height : 6px;
+ bottom : 0px;
+ left : 0px;
+ right : 6px;
+}
+
+.rf-ii-btn-shadow-r {
+ background-position : bottom right;
+ background-image : url("#{resource['org.richfaces:bg_shadow.png']}");
+ position: absolute;
+ width: 6px;
+ top: 6px;
+ bottom: 0px;
+ right: 0px;
+}
+
+.rf-ii-btn-shadow-b {
+ background-position : right top;
+ background-image : url("#{resource['org.richfaces:bg_shadow.png']}");
+ position: absolute;
+ height: 6px;
+ top: 0px;
+ left: 6px;
+ right: 0px;
+}
+
+.rf-ii-none {
+ display: none;
+}
\ No newline at end of file
Added:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
===================================================================
--- trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js
(rev 0)
+++
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/inplaceInput.js 2010-08-12
17:43:25 UTC (rev 18596)
@@ -0,0 +1,106 @@
+(function ($, richfaces) {
+
+ richfaces.ui = richfaces.ui || {};
+
+ richfaces.ui.InplaceInput = function(id, options) {
+ this.currentState = options.state;
+ this.editEvent = options.editEvent;
+ this.noneCss = options.noneCss;
+ this.changedCss = options.changedCss;
+ this.showControls = options.showControls;
+
+
+ this.element = $(document.getElementById(id));
+ this.editContainer = $(document.getElementById(options.editContainer));
+ this.input = $(document.getElementById(options.input));
+ this.label = $(document.getElementById(options.label));
+ this.initialValue = this.label.text();
+
+ richfaces.Event.bind(this.element, this.editEvent, this.editState, this);
+ richfaces.Event.bind(this.input, "change", this.changedState,
this);
+ richfaces.Event.bind(this.input, "blur", this.readyState, this);
+
+ if(this.showControls) {
+ this.okbtn = $(document.getElementById(options.okbtn));
+ this.cancelbtn = $(document.getElementById(options.cancelbtn));
+ richfaces.Event.bind(this.okbtn, "mousedown", this.clickOk,
this);
+ richfaces.Event.bind(this.cancelbtn, "mousedown",
this.clickCancel, this);
+ }
+ };
+
+ $.extend(richfaces.ui.InplaceInput, {
+ READY : "ready",
+ EDIT : "edit",
+ CHANGED : "changed"
+ });
+
+ $.extend(richfaces.ui.InplaceInput.prototype, ( function () {
+ return {
+ name : "RichFaces.ui.InplaceInput",
+
+ switchToState: function(state) {
+ if(this.currentState != state) {
+ var states = RichFaces.ui.InplaceInput;
+ switch(state) {
+ case states.READY: this.doReady(); break;
+ case states.EDIT: this.doEdit(); break;
+ case states.CHANGED: this.doChanged(); break;
+ default:
+ }
+ this.currentState = state;
+ }
+ },
+
+ editState: function(){
+ this.switchToState(RichFaces.ui.InplaceInput.EDIT);
+ },
+
+ changedState: function(){
+ this.switchToState(RichFaces.ui.InplaceInput.CHANGED);
+ },
+
+ readyState: function() {
+ if(!this.showControls) {
+ this.switchToState(RichFaces.ui.InplaceInput.READY);
+ }
+ },
+
+ doEdit: function() {
+ this.editContainer.removeClass(this.noneCss);
+ this.input.focus();
+ },
+
+ doChanged: function() {
+ var inputValue = this.input.val();
+ if(inputValue.length > 0) {
+ this.label.text(inputValue);
+ }
+
+ if(inputValue != this.initialValue) {
+ this.element.addClass(this.changedCss);
+ } else {
+ this.element.removeClass(this.changedCss);
+ }
+ },
+
+ doReady: function() {
+ this.editContainer.addClass(this.noneCss);
+ },
+
+ clickOk: function() {
+ this.changedState();
+ this.switchToState(RichFaces.ui.InplaceInput.READY);
+ return false;
+ },
+
+ clickCancel: function() {
+ var text = this.label.text();
+ this.input.val(text);
+ this.switchToState(RichFaces.ui.InplaceInput.READY);
+ return false;
+ }
+ }
+ })());
+
+})(jQuery, window.RichFaces);
+
Added:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/mark_changed.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/mark_changed.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/mark_list.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/mark_list.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/spacer.gif
===================================================================
(Binary files differ)
Property changes on:
trunk/ui/input/ui/src/main/resources/META-INF/resources/org.richfaces/spacer.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml
===================================================================
--- trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-08-12 15:15:56 UTC
(rev 18595)
+++ trunk/ui/input/ui/src/main/templates/inplaceInput.template.xml 2010-08-12 17:43:25 UTC
(rev 18596)
@@ -24,7 +24,7 @@
#{inplaceValue}
</span>
<div id="#{clientId}:edit" class="#{getEditStyleClass(component,
inplaceState)}">
- <input id="#{clientId}:input" name="#{clientId}:input"
type="text" value="#{inplaceValue}" class="rf-ii-f" />
+ <input id="#{clientId}:input" autocomplete="off"
name="#{clientId}:input" type="text" value="#{inplaceValue}"
class="rf-ii-f" />
<c:if test="#{component.attributes['showControls']}">
<div class="rf-ii-btn-prepos">
@@ -38,12 +38,12 @@
<div id="#{clientId}:btn" style="position : relative">
<input type="image"
id="#{clientId}:okbtn"
- src="#{getResourcePath(facesContext, 'images/ico_ok.gif')}"
+ src="#{getResourcePath(facesContext,
'org.richfaces/ico_ok.gif')}"
class="rf-ii-btn"
onmousedown="this.className='rf-ii-btn-p'"
onmouseout="this.className='rf-ii-btn'"
onmouseup="this.className='rf-ii-btn'" />
<input type="image"
id="#{clientId}:cancelbtn"
- src="#{getResourcePath(facesContext,'images/ico_cancel.gif')}"
+ src="#{getResourcePath(facesContext,'org.richfaces/ico_cancel.gif')}"
class="rf-ii-btn"
onmousedown="this.className='rf-ii-btn-press'"
onmouseout="this.className='rf-ii-btn'"
onmouseup="this.className='rf-ii-btn'" />
<br />