About: Bubble Sort of Tree Cells   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : 134.155.108.49:8890 associated with source dataset(s)

In working with Trees in JavaFX, you might have a need to alpha sort child TreeCells in the event that a label is edited or a new tree cell is inserted. This example uses a simple Bubble Sort implementation to trigger the sort of TreeCells that are the child of the indicated parent. For this example, I am using a subclass of TreeCell that adopts a new operation called sortCells() which can be called upon it at any time. --Rcasey 00:18, 17 November 2007 (UTC)

AttributesValues
rdfs:label
  • Bubble Sort of Tree Cells
rdfs:comment
  • In working with Trees in JavaFX, you might have a need to alpha sort child TreeCells in the event that a label is edited or a new tree cell is inserted. This example uses a simple Bubble Sort implementation to trigger the sort of TreeCells that are the child of the indicated parent. For this example, I am using a subclass of TreeCell that adopts a new operation called sortCells() which can be called upon it at any time. --Rcasey 00:18, 17 November 2007 (UTC)
dcterms:subject
abstract
  • In working with Trees in JavaFX, you might have a need to alpha sort child TreeCells in the event that a label is edited or a new tree cell is inserted. This example uses a simple Bubble Sort implementation to trigger the sort of TreeCells that are the child of the indicated parent. For this example, I am using a subclass of TreeCell that adopts a new operation called sortCells() which can be called upon it at any time. public class MyTreeCell extends TreeCell { public operation sortCells(); // trigger sorting of child cells } operation MyTreeCell.sortCells() { if (sizeof this.cells > 1) { // bubble sort for (i in [0..(sizeof this.cells)-2]) { for (j in [(sizeof this.cells)-1..i+1]) { var cell1 = this.cells[j-1]; var cell2 = this.cells[j]; if (cell1.text.compareToIgnoreCase(cell2.text) > 0) { //swap( A[ j ], A[ j - 1 ] ) insert cell2 before this.cells[j-1]; delete this.cells[j+1]; } } } } } --Rcasey 00:18, 17 November 2007 (UTC)
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software