[jira] [Commented] (TOBAGO-986) Sheet can only sort UIOutput - Nothing happend with UILinkCommand and UIButtonCommand

2012-02-15 Thread Helmut Swaczinna (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/TOBAGO-986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13208292#comment-13208292
 ] 

Helmut Swaczinna commented on TOBAGO-986:
-

Since this fix sorting does not work anymore when a tc:out is embedded in a 
tc:link. Example:

  tc:column 
label=Label
sortable=true
tc:link 
  tc:out 
value=#{var.property}/
/tc:link
  /tc:column

Exception:
java.lang.ClassCastException: xxx cannot be cast to java.lang.Comparable
at java.util.Arrays.mergeSort(Arrays.java:1144)
at java.util.Arrays.sort(Arrays.java:1208)
at java.util.Collections.sort(Collections.java:159)
at org.apache.myfaces.tobago.component.Sorter.invoke(Sorter.java:148)

Please reopen the issue. The probem is that the tc:out will never be found by 
getFirstSortableChild()
I will try to find a fix. In the meantime I'm forced to switch back to the old 
code.


 Sheet can only sort UIOutput - Nothing happend with UILinkCommand and 
 UIButtonCommand
 -

 Key: TOBAGO-986
 URL: https://issues.apache.org/jira/browse/TOBAGO-986
 Project: MyFaces Tobago
  Issue Type: Improvement
  Components: Core
Affects Versions: 1.0.35
Reporter: Sven Bunge
Assignee: Bernd Bohmann
Priority: Minor
 Fix For: 1.0.36, 1.5.0-beta-1, 1.5.0

 Attachments: 
 Patch_for_TOBAGO-986__Make_UILinkCommand_and_UIButtonCommand_sortable.patch


 If a column in a sheet is filled with a tc:link (UILinkCommand) or tc:button 
 (UIButtonCommand) the Sorter-class is unable to sort the sheet.
 There are several problems with the method Sorter#getFirstSortableChild(..):
 * The children of a UICommand are recursive searched for a tc:out - the 
 algorithm look into the tc:link and tc:button.
 * Only tc:out's are returned from the method
 * .. the caller method invoke(..) get only the value-binding named value - 
 The UILinkCommand and UIButtonCommand have no value-field. 
 I optimized the getFirstSortableChild(..)-Method and introduced a new method 
 how returns the ValueBinding.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (TOBAGO-986) Sheet can only sort UIOutput - Nothing happend with UILinkCommand and UIButtonCommand

2012-02-15 Thread Helmut Swaczinna (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/TOBAGO-986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13208343#comment-13208343
 ] 

Helmut Swaczinna commented on TOBAGO-986:
-

This should work for both cases:

  private UIComponent getFirstSortableChild(List children) {
UIComponent child = null;

for (Iterator iter = children.iterator(); iter.hasNext();) {
  child = (UIComponent) iter.next();
  if (child instanceof UISelectMany
  || child instanceof UISelectOne
  || child instanceof UISelectBoolean
  || (child instanceof UIInput  
TobagoConstants.RENDERER_TYPE_HIDDEN.equals(child.getRendererType( {
continue;
// look for a better component if any
  }
  if (child instanceof UIOutput) {
break;
  }
  if (child instanceof javax.faces.component.UICommand  
child.getChildren().isEmpty()) {
// use label attribute of UICommand
break;
  }
  if (child instanceof javax.faces.component.UICommand
  || child instanceof javax.faces.component.UIPanel) {
child = getFirstSortableChild(child.getChildren());
if (child instanceof UIOutput) {
  break;
}
  }
}
return child;
  }


 Sheet can only sort UIOutput - Nothing happend with UILinkCommand and 
 UIButtonCommand
 -

 Key: TOBAGO-986
 URL: https://issues.apache.org/jira/browse/TOBAGO-986
 Project: MyFaces Tobago
  Issue Type: Improvement
  Components: Core
Affects Versions: 1.0.35
Reporter: Sven Bunge
Assignee: Bernd Bohmann
Priority: Minor
 Fix For: 1.0.36, 1.5.0-beta-1, 1.5.0

 Attachments: 
 Patch_for_TOBAGO-986__Make_UILinkCommand_and_UIButtonCommand_sortable.patch


 If a column in a sheet is filled with a tc:link (UILinkCommand) or tc:button 
 (UIButtonCommand) the Sorter-class is unable to sort the sheet.
 There are several problems with the method Sorter#getFirstSortableChild(..):
 * The children of a UICommand are recursive searched for a tc:out - the 
 algorithm look into the tc:link and tc:button.
 * Only tc:out's are returned from the method
 * .. the caller method invoke(..) get only the value-binding named value - 
 The UILinkCommand and UIButtonCommand have no value-field. 
 I optimized the getFirstSortableChild(..)-Method and introduced a new method 
 how returns the ValueBinding.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira