1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
def configCellFactory: function ():javafx.scene.control.ListCell =
function ():javafx.scene.control.ListCell {
def cell: ListCell = ListCell { styleClass: "config-cell" }
var offset = 5;
var itemWidth = cell.listView.width;
var name: String;
var create: String;
var modif: String;
var comment: String;
def dateFormat = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, Locale.FRANCE);
def ci: ConfigInfo = bind cell.item as ConfigInfo on replace {
if(ci != null) {
name = StringEscapeUtils.unescapeXml(ci.getName());
create = dateFormat.format(ci.getCreate());
modif = dateFormat.format(ci.getLast());
comment = StringEscapeUtils.unescapeXml(ci.getComment());
}
}
def box = VBox {
visible: bind not cell.empty
spacing: offset
content: [
Label {
styleClass: "config-name-label"
hpos: HPos.CENTER
textAlignment: TextAlignment.CENTER
text: bind name
}
Label {
id: "create-label"
text: bind "Création: {create}"
}
Label {
id: "modif-label"
text: bind "Modification: {modif}"
}
HBox {
content: [
Label {
text: "Commentaire:"
}
Label {
id: "comment-label"
text: bind comment
}
]
}
]
}
cell.node = box;
return cell;
} |
Partager