JBoss Rich Faces SVN: r7730 - in branches/3.1.x/ui/calendar/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: vbaranov
Date: 2008-04-10 06:16:43 -0400 (Thu, 10 Apr 2008)
New Revision: 7730
Modified:
branches/3.1.x/ui/calendar/src/main/config/component/calendar.xml
branches/3.1.x/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
branches/3.1.x/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
Log:
http://jira.jboss.com/jira/browse/RF-2757
Modified: branches/3.1.x/ui/calendar/src/main/config/component/calendar.xml
===================================================================
--- branches/3.1.x/ui/calendar/src/main/config/component/calendar.xml 2008-04-10 09:58:14 UTC (rev 7729)
+++ branches/3.1.x/ui/calendar/src/main/config/component/calendar.xml 2008-04-10 10:16:43 UTC (rev 7730)
@@ -335,6 +335,11 @@
<description>onCurrentDateSelect event handler</description>
</property>
<property>
+ <name>oncurrentdateselected</name>
+ <classname>java.lang.String</classname>
+ <description>onCurrentDateSelected event handler</description>
+ </property>
+ <property>
<name>onexpand</name>
<classname>java.lang.String</classname>
<description>onExpand event handler</description>
Modified: branches/3.1.x/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
===================================================================
--- branches/3.1.x/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2008-04-10 09:58:14 UTC (rev 7729)
+++ branches/3.1.x/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2008-04-10 10:16:43 UTC (rev 7730)
@@ -1739,25 +1739,31 @@
if (this.getCurrentMonth()!=month || this.getCurrentYear()!=year)
{
var date = new Date(year, month,1);
- // fix for RF-2450.
- // Wrong sequence: at first the hidden input with current date value
- // should be updated in function onUpdate()
- // and then the "currentdateselect" Event should be fired.
- this.currentDate = date;
- this.onUpdate();
- this.invokeEvent("currentdateselect", $(this.id), null, date);
+ if(this.invokeEvent("currentdateselect", $(this.id), null, date))
+ {
+ // fix for RF-2450.
+ // Additional event is fired: after the hidden input with current date
+ // value is updated in function onUpdate() and then
+ // the "currentdateselected" Event is fired.
+ this.currentDate = date;
+ this.onUpdate();
+ this.invokeEvent("currentdateselected", $(this.id), null, date);
+ }
}
},
changeCurrentDateOffset: function(yearOffset, monthOffset) {
var date = new Date(this.currentDate.getFullYear()+yearOffset, this.currentDate.getMonth()+monthOffset,1);
- // fix for RF-2450.
- // Wrong sequence: at first the hidden input with current date value
- // should be updated in function onUpdate()
- // and then the "currentdateselect" Event should be fired.
- this.currentDate = date;
- this.onUpdate();
- this.invokeEvent("currentdateselect", $(this.id), null, date);
+ if(this.invokeEvent("currentdateselect", $(this.id), null, date))
+ {
+ // fix for RF-2450.
+ // Additional event is fired: after the hidden input with current date
+ // value is updated in function onUpdate() and then
+ // the "currentdateselected" Event is fired.
+ this.currentDate = date;
+ this.onUpdate();
+ this.invokeEvent("currentdateselected", $(this.id), null, date);
+ }
},
today: function(noUpdate, noHighlight) {
Modified: branches/3.1.x/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
===================================================================
--- branches/3.1.x/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2008-04-10 09:58:14 UTC (rev 7729)
+++ branches/3.1.x/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2008-04-10 10:16:43 UTC (rev 7730)
@@ -208,6 +208,7 @@
<f:call name="writeEventHandlerFunction"><f:parameter value="onexpand" /></f:call>
<f:call name="writeEventHandlerFunction"><f:parameter value="oncollapse" /></f:call>
<f:call name="writeEventHandlerFunction"><f:parameter value="oncurrentdateselect" /></f:call>
+ <f:call name="writeEventHandlerFunction"><f:parameter value="oncurrentdateselected" /></f:call>
<jsp:scriptlet>/*<![CDATA[*/
if (component.getChildCount() != 0) {
16 years, 9 months
JBoss Rich Faces SVN: r7729 - in trunk/ui/calendar/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: vbaranov
Date: 2008-04-10 05:58:14 -0400 (Thu, 10 Apr 2008)
New Revision: 7729
Modified:
trunk/ui/calendar/src/main/config/component/calendar.xml
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
Log:
http://jira.jboss.com/jira/browse/RF-2450
Modified: trunk/ui/calendar/src/main/config/component/calendar.xml
===================================================================
--- trunk/ui/calendar/src/main/config/component/calendar.xml 2008-04-10 09:00:00 UTC (rev 7728)
+++ trunk/ui/calendar/src/main/config/component/calendar.xml 2008-04-10 09:58:14 UTC (rev 7729)
@@ -336,6 +336,11 @@
<description>onCurrentDateSelect event handler</description>
</property>
<property>
+ <name>oncurrentdateselected</name>
+ <classname>java.lang.String</classname>
+ <description>onCurrentDateSelected event handler</description>
+ </property>
+ <property>
<name>onexpand</name>
<classname>java.lang.String</classname>
<description>onExpand event handler</description>
Modified: trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
===================================================================
--- trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2008-04-10 09:00:00 UTC (rev 7728)
+++ trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2008-04-10 09:58:14 UTC (rev 7729)
@@ -1752,26 +1752,32 @@
if (this.getCurrentMonth()!=month || this.getCurrentYear()!=year)
{
var date = new Date(year, month,1);
- // fix for RF-2450.
- // Wrong sequence: at first the hidden input with current date value
- // should be updated in function onUpdate()
- // and then the "currentdateselect" Event should be fired.
- this.currentDate = date;
- this.onUpdate();
- this.invokeEvent("currentdateselect", $(this.id), null, date);
+ if (this.invokeEvent("currentdateselect", $(this.id), null, date))
+ {
+ // fix for RF-2450.
+ // Additional event is fired: after the hidden input with current date
+ // value is updated in function onUpdate() and then
+ // the "currentdateselected" Event is fired.
+ this.currentDate = date;
+ this.onUpdate();
+ this.invokeEvent("currentdateselected", $(this.id), null, date);
+ }
}
},
changeCurrentDateOffset: function(yearOffset, monthOffset) {
var date = new Date(this.currentDate.getFullYear()+yearOffset, this.currentDate.getMonth()+monthOffset,1);
- // fix for RF-2450.
- // Wrong sequence: at first the hidden input with current date value
- // should be updated in function onUpdate()
- // and then the "currentdateselect" Event should be fired.
- this.currentDate = date;
- this.onUpdate();
- this.invokeEvent("currentdateselect", $(this.id), null, date);
+ if (this.invokeEvent("currentdateselect", $(this.id), null, date))
+ {
+ // fix for RF-2450.
+ // Additional event is fired: after the hidden input with current date
+ // value is updated in function onUpdate() and then
+ // the "currentdateselected" Event is fired.
+ this.currentDate = date;
+ this.onUpdate();
+ this.invokeEvent("currentdateselected", $(this.id), null, date);
+ }
},
today: function(noUpdate, noHighlight) {
Modified: trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
===================================================================
--- trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2008-04-10 09:00:00 UTC (rev 7728)
+++ trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2008-04-10 09:58:14 UTC (rev 7729)
@@ -208,6 +208,7 @@
<f:call name="writeEventHandlerFunction"><f:parameter value="onexpand" /></f:call>
<f:call name="writeEventHandlerFunction"><f:parameter value="oncollapse" /></f:call>
<f:call name="writeEventHandlerFunction"><f:parameter value="oncurrentdateselect" /></f:call>
+ <f:call name="writeEventHandlerFunction"><f:parameter value="oncurrentdateselected" /></f:call>
<jsp:scriptlet>/*<![CDATA[*/
if (component.getChildCount() != 0) {
16 years, 9 months
JBoss Rich Faces SVN: r7728 - in trunk/ui/combobox/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2008-04-10 05:00:00 -0400 (Thu, 10 Apr 2008)
New Revision: 7728
Modified:
trunk/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java
trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/comboboxUtils.js
Log:
code reviewed
Modified: trunk/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java
===================================================================
--- trunk/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java 2008-04-10 08:58:09 UTC (rev 7727)
+++ trunk/ui/combobox/src/main/java/org/richfaces/renderkit/ComboBoxBaseRenderer.java 2008-04-10 09:00:00 UTC (rev 7728)
@@ -131,10 +131,7 @@
}
protected boolean isAcceptableComponent(UIComponent component) {
- if (component instanceof UIComboBox) {
- return true;
- }
- return false;
+ return component != null && this.getComponentClass().isAssignableFrom(component.getClass());
}
public String getItemsTextAsJSArray(FacesContext context, UIComponent component, List items) {
Modified: trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/comboboxUtils.js
===================================================================
--- trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/comboboxUtils.js 2008-04-10 08:58:09 UTC (rev 7727)
+++ trunk/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/comboboxUtils.js 2008-04-10 09:00:00 UTC (rev 7728)
@@ -68,7 +68,7 @@
}
return val;
}
-
+//TODO: jsDoc this Satanism
Richfaces.borders = {l: 'border-left-width', r: 'border-right-width', t: 'border-top-width', b: 'border-bottom-width'},
Richfaces.paddings = {l: 'padding-left', r: 'padding-right', t: 'padding-top', b: 'padding-bottom'},
Richfaces.margins = {l: 'margin-left', r: 'margin-right', t: 'margin-top', b: 'margin-bottom'}
\ No newline at end of file
16 years, 9 months
JBoss Rich Faces SVN: r7727 - in trunk/ui/inplaceSelect/src/main: java/org/richfaces/renderkit and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2008-04-10 04:58:09 -0400 (Thu, 10 Apr 2008)
New Revision: 7727
Modified:
trunk/ui/inplaceSelect/src/main/java/org/richfaces/component/UIInplaceSelect.java
trunk/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
trunk/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
Log:
code reviewed
Modified: trunk/ui/inplaceSelect/src/main/java/org/richfaces/component/UIInplaceSelect.java
===================================================================
--- trunk/ui/inplaceSelect/src/main/java/org/richfaces/component/UIInplaceSelect.java 2008-04-10 08:58:03 UTC (rev 7726)
+++ trunk/ui/inplaceSelect/src/main/java/org/richfaces/component/UIInplaceSelect.java 2008-04-10 08:58:09 UTC (rev 7727)
@@ -5,18 +5,23 @@
import javax.faces.component.UIComponent;
import javax.faces.component.UISelectOne;
import javax.faces.context.FacesContext;
+import javax.faces.model.SelectItem;
import org.ajax4jsf.util.SelectUtils;
/**
* UI implementation of ComboBox component
+ * TODO: description here
* @author Anton Belevich
* @since 3.2.0
*
*/
public class UIInplaceSelect extends UISelectOne{
+
+ //TODO: Abstract class?
- public List getSelectItems(FacesContext context, UIComponent component) {
+ //TODO: remove
+ public List<SelectItem> getSelectItems(FacesContext context, UIComponent component) {
return SelectUtils.getSelectItems(context, component);
}
}
Modified: trunk/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java
===================================================================
--- trunk/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2008-04-10 08:58:03 UTC (rev 7726)
+++ trunk/ui/inplaceSelect/src/main/java/org/richfaces/renderkit/InplaceSelectBaseRenderer.java 2008-04-10 08:58:09 UTC (rev 7727)
@@ -28,11 +28,12 @@
public class InplaceSelectBaseRenderer extends ComboBoxBaseRenderer{
private static Log logger = LogFactory.getLog(InplaceSelectBaseRenderer.class);
+ //TODO: move duplicate constants to superclass
private static final String RICH_INPLACE_SELECT_CLASSES = "rich-inplace-select-item rich-inplace-select-font";
private static final String CONTROLS_FACET = "controls";
private static final String EMPTY_DEFAULT_LABEL = "   ";
-
+ //Check copyPaste
@Override
protected void doDecode(FacesContext context, UIComponent component) {
UIInplaceSelect inplaceInput = null;
@@ -67,6 +68,8 @@
}
}
+ //TODO: base on super method:
+ //return component != null ? this.getComponentClass().isAssignableFrom(component.getClass()) : false;
protected boolean isAcceptableComponent(UIComponent component) {
if (component instanceof UIInplaceSelect) {
return true;
@@ -80,11 +83,13 @@
return null;
}
+ //TODO generify
List parentList = new ArrayList();
UIInplaceSelect inplaceSelect = (UIInplaceSelect)component;
List <String> labels = new ArrayList<String>();
ResponseWriter writer = context.getResponseWriter();
List<SelectItem> selectItems = SelectUtils.getSelectItems(context, inplaceSelect);
+ //TODO use foreach
if (!selectItems.isEmpty()) {
for (Iterator<SelectItem> iterator = selectItems.iterator(); iterator.hasNext();) {
SelectItem selectItem = iterator.next();
@@ -94,7 +99,8 @@
encodeSuggestion(writer, inplaceSelect, label, RICH_INPLACE_SELECT_CLASSES);
- List childList = new ArrayList();
+ //TODO: review
+ List childList = new ArrayList(2); //new Object[2]
childList.add(label);
childList.add(value);
parentList.add(childList);
@@ -122,8 +128,9 @@
return UIInplaceSelect.class;
}
+ //TODO: review
public String getSelectedItemLabel(FacesContext context, UIInplaceSelect component) {
- String defaultLabel = null;
+ //TODO: submitted value should be converted before searching for label
Object value = component.getSubmittedValue();
if (value == null) {
value = component.getAttributes().get("value");
@@ -131,7 +138,8 @@
if (value == null) {
return createDefaultLabel(component);
}
- defaultLabel = getItemLabel(context, component, value);
+
+ String defaultLabel = getItemLabel(context, component, value);
if (defaultLabel == null) {
return createDefaultLabel(component);
}
@@ -140,19 +148,25 @@
protected String getItemLabel(FacesContext context, UIComponent component, Object value) {
String itemLabel = null;
+ //TODO: SelectUtils.getSelectItems is called minimum twice during encode
List<SelectItem> selectItems = SelectUtils.getSelectItems(context, component);
if (!selectItems.isEmpty()) {
for(SelectItem item : selectItems) {
if (value.equals(item.getValue())) {
itemLabel = item.getLabel();
+ //TODO break
}
}
}
+
+ //TODO exception if item hasn't been found
+
return itemLabel;
}
protected String createDefaultLabel(UIComponent component) {
String defaultLabel = (String) component.getAttributes().get("defaultLabel");
+ //TODO use length()
if (defaultLabel == null || defaultLabel.equals("")) {
defaultLabel = EMPTY_DEFAULT_LABEL;
}
@@ -160,7 +174,8 @@
}
protected boolean isEmptyDefaultLabel(String defaultLabel) {
- if (defaultLabel != null && EMPTY_DEFAULT_LABEL.equals(defaultLabel)) {
+ //TODO review
+ if (defaultLabel != null && EMPTY_DEFAULT_LABEL.equals(defaultLabel)) {
return true;
}
return false;
Modified: trunk/ui/inplaceSelect/src/main/templates/inplaceselect.jspx
===================================================================
--- trunk/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-04-10 08:58:03 UTC (rev 7726)
+++ trunk/ui/inplaceSelect/src/main/templates/inplaceselect.jspx 2008-04-10 08:58:09 UTC (rev 7727)
@@ -53,7 +53,7 @@
if (cancelIcon != null && cancelIcon.length() != 0 ) {
variables.setVariable("cancelIcon", cancelIcon);
}
-
+ //TODO use EL exprs.
String controlClass = (String)component.getAttributes().get("controlClass");
variables.setVariable("controlClass", controlClass);
String controlHoveredClass = (String)component.getAttributes().get("controlHoveredClass");
@@ -78,6 +78,7 @@
<jsp:scriptlet>
if (layout.equals("inline")) {
</jsp:scriptlet>
+ <!-- TODO #{component.attributes['viewClass']} -->
<span id="#{clientId}" class="rich-inplace-select rich-inplace-select-view" x:passThruWithExclusions="id,styleClass,class,style">
<jsp:scriptlet>
} else {
@@ -138,6 +139,7 @@
</div>
<div id="listParent#{clientId}" class="rich-inplace-select-width-list" style="display: none; position : absolute; height : 100px; left : 0px; top: 13px">
<div class="rich-inplace-select-list-shadow">
+ <!-- TODO welcome magic numbers! -->
<table id="shadow#{clientId}" cellpadding="0" cellspacing="0" border="0" width="257" height="109">
<tr>
<td class="rich-inplace-select-shadow-tl">
@@ -211,6 +213,7 @@
} else {
writer.writeText(convertToString(variables.getVariable("fieldLabel")),null);
}
+ //TODO !layout.equals("inline")
if (layout.equals("block")) {
</jsp:scriptlet>
</div>
16 years, 9 months
JBoss Rich Faces SVN: r7726 - in trunk/ui/inplaceInput/src/main: resources/org/richfaces/renderkit/html/css and 1 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: maksimkaszynski
Date: 2008-04-10 04:58:03 -0400 (Thu, 10 Apr 2008)
New Revision: 7726
Modified:
trunk/ui/inplaceInput/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/css/inplaceinput.xcss
trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js
Log:
code reviewed
Modified: trunk/ui/inplaceInput/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java
===================================================================
--- trunk/ui/inplaceInput/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2008-04-10 08:42:40 UTC (rev 7725)
+++ trunk/ui/inplaceInput/src/main/java/org/richfaces/renderkit/InplaceInputBaseRenderer.java 2008-04-10 08:58:03 UTC (rev 7726)
@@ -76,20 +76,28 @@
return;
}
+ //TODO:
+ //First check NULL clientId
+
if (InputUtils.isDisabled(inplaceInput) || InputUtils.isReadOnly(inplaceInput)) {
if (logger.isDebugEnabled()) {
logger.debug(("No decoding necessary since the component "
+ component.getId() + " is disabled"));
}
+ //TODO: return?
}
String clientId = component.getClientId(context);
+ //TODO: NULL is NULL?
if (clientId == null) {
throw new NullPointerException("component " + inplaceInput.getClientId(context) + " client id is NULL" );
}
-
+ //TODO:
+ //Should use clientId instead?
clientId = clientId + UIInplaceInput.VALUE_SUFFIX;
Map request = context.getExternalContext().getRequestParameterMap();
+ //TODO:
+ //Request.get is enough
if (request.containsKey(clientId)) {
String newValue = (String)request.get(clientId);
if (newValue != null) {
@@ -98,6 +106,8 @@
}
}
+ //TODO:
+ //Move that code to template, maybe?
public void encodeControlsFacet(FacesContext context, UIComponent component) throws IOException {
UIComponent facet = component.getFacet(CONTROLS_FACET);
if ((facet != null) && (facet.isRendered())) {
@@ -114,12 +124,15 @@
}
public String encodeScriptAttributes(FacesContext context, UIComponent component) {
+ //TODO:
+ //Use string builder instead
StringBuffer attributes = new StringBuffer();
attributes.append("var attributes = ");
ScriptOptions options = new ScriptOptions(component);
String defaultLabel = (String)component.getAttributes().get("defaultLabel");
+ //TODO: length()==0
if (defaultLabel == null || defaultLabel.equals("")) {
defaultLabel = EMPTY_DEFAULT_LABEL;
}
@@ -176,6 +189,7 @@
return cssMap.toString();
}
+ //TODO: use enum?
private String buildCss(UIComponent component, int key, String suffix) {
Object value;
StringBuffer stringBuffer = new StringBuffer();
@@ -214,6 +228,7 @@
return stringBuffer.toString();
}
+ //TODO: remove?
public String getAsEventHandler(FacesContext context, UIComponent component, String attributeName) {
String event = (String) component.getAttributes().get(attributeName);
String result = null;
@@ -242,6 +257,7 @@
}
protected boolean isEmptyDefaultLabel(String defaultLabel) {
+ //TODO: remove != null?
if (defaultLabel != null && EMPTY_DEFAULT_LABEL.equals(defaultLabel)) {
return true;
}
Modified: trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/css/inplaceinput.xcss
===================================================================
--- trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/css/inplaceinput.xcss 2008-04-10 08:42:40 UTC (rev 7725)
+++ trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/css/inplaceinput.xcss 2008-04-10 08:58:03 UTC (rev 7726)
@@ -7,6 +7,11 @@
<f:verbatim>
<![CDATA[
+ /***
+ TODO: check for duplicates!!
+ ***/
+
+
.rich-inplace {
/*position:relative;*/
}
Modified: trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js
===================================================================
--- trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js 2008-04-10 08:42:40 UTC (rev 7725)
+++ trunk/ui/inplaceInput/src/main/resources/org/richfaces/renderkit/html/scripts/inplaceinput.js 2008-04-10 08:58:03 UTC (rev 7726)
@@ -3,7 +3,7 @@
Richfaces.InplaceInput.prototype = {
-
+ //TODO: remove $$$$$
initialize: function(clientId, temValueKeepId, valueKeepId, tabberId, attributes, events, classes, barParams) {
this.inplaceInput = $(clientId);
this.inplaceInput.component = this;
@@ -15,7 +15,7 @@
this.events = events;
this.classes = classes;
-
+ //TODO: static methods are preferred to be called within constructor
this.currentText = this.getCurrentText();
this.value = this.valueKeeper.value;
@@ -23,9 +23,11 @@
this.prevState = Richfaces.InplaceInput.STATES[0];
if (this.attributes.showControls) {
+ //TODO: Consider passing attributes by name instead of by index
this.bar = new Richfaces.InplaceInputBar(barParams[0], barParams[1], barParams[2], barParams[3], barParams[4],
this.attributes.verticalPosition, this.attributes.horizontalPosition);
}
+ //TODO: move converting 'on'-event to prototype style to utils
this.editEvent = this.attributes.editEvent.substring(2,this.attributes.editEvent.length);
@@ -37,16 +39,17 @@
},
+ //TODO: more cleanup here - remove references to DOM elements
destroy: function() {
this.inplaceInput.component = null;
},
initHandlers : function() {
- this.inplaceInput.observe(this.editEvent, function(e){this.switchingStatesHandler(e);}.bindAsEventListener(this));
- this.inplaceInput.observe("mouseout", function(e){this.inplaceMouseOutHandler(e);}.bindAsEventListener(this));
- this.inplaceInput.observe("mouseover", function(e){this.inplaceMouseOverHandler(e);}.bindAsEventListener(this));
+ this.inplaceInput.observe(this.editEvent, this.switchingStatesHandler.bindAsEventListener(this));
+ this.inplaceInput.observe("mouseout", this.inplaceMouseOutHandler.bindAsEventListener(this));
+ this.inplaceInput.observe("mouseover", this.inplaceMouseOverHandler.bindAsEventListener(this));
-
+ //TODO: do like above - no need to create extra functions
this.tempValueKeeper.observe("blur", function(e){this.tmpValueBlurHandler(e);}.bindAsEventListener(this));
this.tempValueKeeper.observe("keydown", function(e){this.tmpValueKeyDownHandler(e);}.bindAsEventListener(this));
@@ -79,6 +82,7 @@
*/
inplaceMouseOverHandler : function(e) {
+ //TODO: Nick recommends regexp
var className = this.inplaceInput.className;
if (this.currentState == Richfaces.InplaceInput.STATES[0]) {
if (className.indexOf(this.classes.COMPONENT.VIEW.HOVERED) == -1) {
@@ -100,6 +104,7 @@
}
},
+ //TODO: Event.element here?
switchingStatesHandler : function(e) {
var el = (e.srcElement) ? e.srcElement : e.target;
if ((el.id == this.inplaceInput.id) || (e.type == "focus")) {
@@ -120,6 +125,8 @@
}
}
+//DONT TUCH THIZ CODE
+
if (this.invokeEvent(this.events.oneditactivation, this.inplaceInput, "rich:oneditactivation", {oldValue : this.valueKeeper.value, value : this.tempValueKeeper.value})) {
var textSize = this.inplaceInput.offsetWidth;
@@ -210,6 +217,7 @@
}
if (this.attributes.selectOnEdit) {
+ //TODO: implement Select all method?
Richfaces.InplaceInput.textboxSelect(this.tempValueKeeper, 0, this.tempValueKeeper.value.length);
}
this.tempValueKeeper.focus();
@@ -221,6 +229,7 @@
this.createNewText(this.currentText);
this.inplaceInput.className = this.classes.COMPONENT.VIEW.NORMAL;
+ //TODO: see above
this.inplaceInput.observe("mouseover", function(e){this.inplaceMouseOverHandler(e);}.bindAsEventListener(this));
},
@@ -238,7 +247,9 @@
* UTILITIES
*/
+ //TODO: rename parameter to textWidth?
setInputWidth : function(textSize) {
+ //TODO: use constants here
if (this.currentState != 1) {
return;
}
@@ -335,7 +346,8 @@
}
}
},
-
+ //TODO: remove Bucks
+ //TODO: to shared library
invokeEvent : function(eventFunc, element, eventName, memo) {
var result = false;
if (eventFunc) {
@@ -370,7 +382,7 @@
this.inplaceInput.removeChild(text);
}
},
-
+ //TODO: search within childNodes for textNode.value().trim().length == 0?
getCurrentText : function() {
return this.inplaceInput.childNodes[4];
},
@@ -398,6 +410,7 @@
},
initDimensions : function() {
+ //TODO: Crap code magic numbers - I propose 325 and 675
/*this.bar.style.visibility = "hidden";
this.bar.show();*/
@@ -467,6 +480,7 @@
Richfaces.InplaceInput.textboxSelect = function(oTextbox, iStart, iEnd) {
if (Prototype.Browser.IE) {
+ //TODO: dont check 4 browser. Check for capability instead.
var oRange = oTextbox.createTextRange();
oRange.moveStart("character", iStart);
oRange.moveEnd("character", -oTextbox.value.length + iEnd);
16 years, 9 months
JBoss Rich Faces SVN: r7725 - trunk/ui/dataTable/src/main/config/component.
by richfaces-svn-commits@lists.jboss.org
Author: cluts
Date: 2008-04-10 04:42:40 -0400 (Thu, 10 Apr 2008)
New Revision: 7725
Modified:
trunk/ui/dataTable/src/main/config/component/dataTable.xml
Log:
RF-2880 - corrected description for "sortPriority" attribute
Modified: trunk/ui/dataTable/src/main/config/component/dataTable.xml
===================================================================
--- trunk/ui/dataTable/src/main/config/component/dataTable.xml 2008-04-10 08:41:22 UTC (rev 7724)
+++ trunk/ui/dataTable/src/main/config/component/dataTable.xml 2008-04-10 08:42:40 UTC (rev 7725)
@@ -190,7 +190,7 @@
<property>
<name>sortPriority</name>
<classname>java.util.Collection</classname>
- <description>Defines a set of column ids in the order the columns could be set</description>
+ <description>Defines a set of columns ids in the sorting order</description>
</property>
<property hidden="true" existintag="false" exist="false" >
<name>sortFields</name>
16 years, 9 months
JBoss Rich Faces SVN: r7724 - trunk/docs/userguide/en/src/main/docbook/included.
by richfaces-svn-commits@lists.jboss.org
Author: cluts
Date: 2008-04-10 04:41:22 -0400 (Thu, 10 Apr 2008)
New Revision: 7724
Modified:
trunk/docs/userguide/en/src/main/docbook/included/column.desc.xml
trunk/docs/userguide/en/src/main/docbook/included/columns.desc.xml
trunk/docs/userguide/en/src/main/docbook/included/dataTable.desc.xml
trunk/docs/userguide/en/src/main/docbook/included/scrollableDataTable.desc.xml
Log:
RF-1740 - corrected "key features" for column, columns, dataTable, scrollableDataTable components.
Modified: trunk/docs/userguide/en/src/main/docbook/included/column.desc.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/column.desc.xml 2008-04-09 22:31:31 UTC (rev 7723)
+++ trunk/docs/userguide/en/src/main/docbook/included/column.desc.xml 2008-04-10 08:41:22 UTC (rev 7724)
@@ -23,8 +23,8 @@
<listitem>Completely skinned table rows and child elements</listitem>
<listitem>Possibility to combine columns with the help of <emphasis ><property>"colspan"</property></emphasis></listitem>
<listitem>Possibility to combine rows with the help of <emphasis ><property>"rowspan"</property></emphasis> and <emphasis ><property>"breakBefore"</property></emphasis></listitem>
- <listitem>Sorting column values</listitem>
- <listitem>Filtering column values</listitem>
+ <listitem><link linkend="sortAndFilter">Sorting column values</link></listitem>
+ <listitem><link linkend="sortAndFilter">Filtering column values</link></listitem>
</itemizedlist>
</section>
-</section>
\ No newline at end of file
+</section>
Modified: trunk/docs/userguide/en/src/main/docbook/included/columns.desc.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/columns.desc.xml 2008-04-09 22:31:31 UTC (rev 7723)
+++ trunk/docs/userguide/en/src/main/docbook/included/columns.desc.xml 2008-04-10 08:41:22 UTC (rev 7724)
@@ -28,7 +28,8 @@
<listitem>Dynamic tables creation</listitem>
<listitem>Possibility to combine columns with the help of <emphasis ><property>"colspan"</property></emphasis> and <emphasis ><property>"breakBefore"</property></emphasis></listitem>
<listitem>Possibility to combine rows with the help of <emphasis ><property>"rowspan"</property></emphasis> </listitem>
- <listitem>Possibility to sort and to filter of columns</listitem>
+ <listitem><link linkend="sortAndFilter">Sorting column values</link></listitem>
+ <listitem><link linkend="sortAndFilter">Filtering column values</link></listitem>
</itemizedlist>
</section>
</section>
Modified: trunk/docs/userguide/en/src/main/docbook/included/dataTable.desc.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/dataTable.desc.xml 2008-04-09 22:31:31 UTC (rev 7723)
+++ trunk/docs/userguide/en/src/main/docbook/included/dataTable.desc.xml 2008-04-10 08:41:22 UTC (rev 7724)
@@ -27,6 +27,8 @@
<property>"subTable"</property></listitem>
<listitem>Possibility to update a limited set of strings with AJAX</listitem>
<listitem>Possibility to sort and to filter of columns</listitem>
+ <listitem><link linkend="sortAndFilter">Sorting column values</link></listitem>
+ <listitem><link linkend="sortAndFilter">Filtering column values</link></listitem>
</itemizedlist>
</section>
</section>
Modified: trunk/docs/userguide/en/src/main/docbook/included/scrollableDataTable.desc.xml
===================================================================
--- trunk/docs/userguide/en/src/main/docbook/included/scrollableDataTable.desc.xml 2008-04-09 22:31:31 UTC (rev 7723)
+++ trunk/docs/userguide/en/src/main/docbook/included/scrollableDataTable.desc.xml 2008-04-10 08:41:22 UTC (rev 7724)
@@ -33,7 +33,7 @@
<listitem>Fixed one or more left columns when table is scrolled horizontally</listitem>
<listitem>One and multi-selection rows mode</listitem>
<listitem>Built-it drag-n-drop support</listitem>
- <listitem>Possibility to sort of columns</listitem>
+ <listitem><link linkend="sortAndFilter">Sorting column values</link></listitem>
</itemizedlist>
</section>
</section>
16 years, 9 months
JBoss Rich Faces SVN: r7721 - in branches/3.1.x: ui/inputnumber-slider/src/main/config and 4 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: nbelaevski
Date: 2008-04-09 15:50:51 -0400 (Wed, 09 Apr 2008)
New Revision: 7721
Removed:
branches/3.1.x/ui/inputnumber-slider/src/main/config/resources/
branches/3.1.x/ui/menu-components/src/main/config/resources/
branches/3.1.x/ui/scrollableDataTable/src/main/config/resources/
branches/3.1.x/ui/tabPanel/src/main/config/resources/
branches/3.1.x/ui/tree/src/main/config/resources/
Modified:
branches/3.1.x/cdk/generator/src/main/java/org/ajax4jsf/builder/generator/ResourcesConfigGenerator.java
Log:
http://jira.jboss.com/jira/browse/RF-1716
Modified: branches/3.1.x/cdk/generator/src/main/java/org/ajax4jsf/builder/generator/ResourcesConfigGenerator.java
===================================================================
--- branches/3.1.x/cdk/generator/src/main/java/org/ajax4jsf/builder/generator/ResourcesConfigGenerator.java 2008-04-09 18:34:05 UTC (rev 7720)
+++ branches/3.1.x/cdk/generator/src/main/java/org/ajax4jsf/builder/generator/ResourcesConfigGenerator.java 2008-04-09 19:50:51 UTC (rev 7721)
@@ -27,19 +27,26 @@
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
+import java.io.StringReader;
import java.io.Writer;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
import java.util.List;
+import java.util.Set;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;
import org.ajax4jsf.builder.config.BuilderConfig;
import org.ajax4jsf.builder.config.ComponentBean;
-import org.ajax4jsf.builder.config.ComponentBaseBean;
import org.ajax4jsf.builder.config.RendererBean;
import org.ajax4jsf.templatecompiler.builder.CompilationContext;
import org.ajax4jsf.templatecompiler.builder.CompilationException;
@@ -50,6 +57,10 @@
import org.ajax4jsf.templatecompiler.elements.vcp.HeaderResourceElement;
import org.apache.velocity.Template;
import org.apache.velocity.VelocityContext;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
/**
* @author Nick - mailto:nbelaevski@exadel.com
@@ -61,6 +72,8 @@
private File resourcesConfig;
private File templatesDirectory;
+ private static final SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+
public ResourcesConfigGenerator(JSFGeneratorConfiguration task, Logger log) {
super(task, log);
}
@@ -254,13 +267,57 @@
}
}
+ private void parseXCSSResource(String resourcePath, final ResourcesConfigGeneratorBean bean) throws SAXException, IOException, ParserConfigurationException {
+ InputStream resourceStream = getClassLoader().getResourceAsStream(resourcePath);
+ if (resourceStream != null) {
+ debug("XCSS file exists in classpath");
+
+ try {
+ SAXParser parser = parserFactory.newSAXParser();
+ parser.parse(resourceStream, new DefaultHandler() {
+ @Override
+ public void startElement(String uri,
+ String localName, String name,
+ Attributes attributes)
+ throws SAXException {
+
+ super.startElement(uri, localName, name, attributes);
+
+ if ("f:resource".equals(name)) {
+ String value = attributes.getValue("f:key");
+
+ if (value != null) {
+ debug("Adding resource: " + value);
+
+ addResource(value, "", bean);
+ }
+ }
+ }
+ });
+
+ } finally {
+ try {
+ resourceStream.close();
+ } catch (IOException e) {
+ getLog().error(e.getLocalizedMessage(), e);
+ }
+ }
+ } else {
+ getLog().error("Resource " + resourcePath + " hasn't been found!");
+ }
+ }
+
+ private boolean isXCSSPath(String resourcePath) {
+ return resourcePath != null && resourcePath.endsWith(".xcss");
+ }
+
public void createFiles(BuilderConfig config) throws GeneratorException {
VelocityContext context = new VelocityContext();
Template template = getTemplate();
try {
// Put common properties
- ResourcesConfigGeneratorBean bean = new ResourcesConfigGeneratorBean();
+ final ResourcesConfigGeneratorBean bean = new ResourcesConfigGeneratorBean();
List<ComponentBean> components = config.getComponents();
for (ComponentBean componentBean : components) {
@@ -274,9 +331,73 @@
addResources(bean, rendererBean, config);
}
+ String includedContent = getIncludeContent();
+ if (includedContent != null && includedContent.length() != 0) {
+ String parseableContent = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><resource-config>" + includedContent +
+ "</resource-config>";
+
+ SAXParser parser = parserFactory.newSAXParser();
+ parser.parse(new InputSource(new StringReader(parseableContent)), new DefaultHandler() {
+ private StringBuilder path;
+
+ @Override
+ public void startElement(String uri,
+ String localName, String name,
+ Attributes attributes)
+ throws SAXException {
+
+ super.startElement(uri, localName, name, attributes);
+
+ if ("path".equals(name)) {
+ this.path = new StringBuilder();
+ }
+ }
+
+ public void characters(char[] ch, int start, int length) throws SAXException {
+ if (this.path != null) {
+ this.path.append(ch, start, length);
+ }
+ };
+
+ @Override
+ public void endElement(String uri, String localName, String name) throws SAXException {
+ super.endElement(uri, localName, name);
+
+ if ("resource".equals(name)) {
+ if (this.path != null && this.path.length() != 0) {
+ String resourcePath = this.path.toString().trim();
+ if (isXCSSPath(resourcePath)) {
+ debug("XCSS file detected: " + resourcePath);
+ try {
+ parseXCSSResource(resourcePath, bean);
+ } catch (IOException e) {
+ throw new SAXException(e.getLocalizedMessage(), e);
+ } catch (ParserConfigurationException e) {
+ throw new SAXException(e.getLocalizedMessage(), e);
+ }
+ }
+ }
+ this.path = null;
+ }
+ }
+ });
+ }
+
+ Set<String> pathResourcesSet = new LinkedHashSet<String>(bean.getPathResources().values());
+ for (Iterator<String> iterator = pathResourcesSet.iterator(); iterator
+ .hasNext();) {
+ String resourcePath = iterator.next();
+
+ if (isXCSSPath(resourcePath)) {
+ debug("XCSS file detected: " + resourcePath);
+ parseXCSSResource(resourcePath, bean);
+ }
+ }
+
context.put("classResources", bean.getClassResources());
context.put("pathResources", bean.getPathResources());
context.put("resourcesConfig", this);
+
File configFile = getResourcesConfig();
File javaDir = configFile.getParentFile();
if (!javaDir.exists()) {
16 years, 9 months