231 public ChoiceBoxListCell(StringConverter<T> converter, ObservableList<T> items) { 232 this.getStyleClass().add("choice-box-list-cell"); 233 this.items = items; 234 setConverter(converter != null ? converter : CellUtils.<T>defaultStringConverter()); 235 } 236 237 238 239 /*************************************************************************** 240 * * 241 * Properties * 242 * * 243 **************************************************************************/ 244 245 // --- converter 246 private ObjectProperty<StringConverter<T>> converter = 247 new SimpleObjectProperty<StringConverter<T>>(this, "converter"); 248 249 /** 250 * The {@link StringConverter} property. 251 */ 252 public final ObjectProperty<StringConverter<T>> converterProperty() { 253 return converter; 254 } 255 256 /** 257 * Sets the {@link StringConverter} to be used in this cell. 258 */ 259 public final void setConverter(StringConverter<T> value) { 260 converterProperty().set(value); 261 } 262 263 /** 264 * Returns the {@link StringConverter} used in this cell. 265 */ 266 public final StringConverter<T> getConverter() { 267 return converterProperty().get(); 268 } 269 270 271 272 /*************************************************************************** 273 * * 274 * Public API * 275 * * 276 **************************************************************************/ 277 278 /** 279 * Returns the items to be displayed in the ChoiceBox when it is showing. 280 */ 281 public ObservableList<T> getItems() { 282 return items; 283 } 284 285 /** {@inheritDoc} */ 286 @Override public void startEdit() { 287 if (! isEditable() || ! getListView().isEditable()) { 288 return; 289 } 290 291 if (choiceBox == null) { 292 choiceBox = createChoiceBox(this, items, converterProperty()); 293 } 294 295 choiceBox.getSelectionModel().select(getItem()); 296 297 super.startEdit(); 298 299 if (isEditing()) { | 231 public ChoiceBoxListCell(StringConverter<T> converter, ObservableList<T> items) { 232 this.getStyleClass().add("choice-box-list-cell"); 233 this.items = items; 234 setConverter(converter != null ? converter : CellUtils.<T>defaultStringConverter()); 235 } 236 237 238 239 /*************************************************************************** 240 * * 241 * Properties * 242 * * 243 **************************************************************************/ 244 245 // --- converter 246 private ObjectProperty<StringConverter<T>> converter = 247 new SimpleObjectProperty<StringConverter<T>>(this, "converter"); 248 249 /** 250 * The {@link StringConverter} property. 251 * @return the {@link StringConverter} property 252 */ 253 public final ObjectProperty<StringConverter<T>> converterProperty() { 254 return converter; 255 } 256 257 /** 258 * Sets the {@link StringConverter} to be used in this cell. 259 * @param value the {@link StringConverter} to be used in this cell 260 */ 261 public final void setConverter(StringConverter<T> value) { 262 converterProperty().set(value); 263 } 264 265 /** 266 * Returns the {@link StringConverter} used in this cell. 267 * @return the {@link StringConverter} used in this cell 268 */ 269 public final StringConverter<T> getConverter() { 270 return converterProperty().get(); 271 } 272 273 274 275 /*************************************************************************** 276 * * 277 * Public API * 278 * * 279 **************************************************************************/ 280 281 /** 282 * Returns the items to be displayed in the ChoiceBox when it is showing. 283 * @return the items to be displayed in the ChoiceBox when it is showing 284 */ 285 public ObservableList<T> getItems() { 286 return items; 287 } 288 289 /** {@inheritDoc} */ 290 @Override public void startEdit() { 291 if (! isEditable() || ! getListView().isEditable()) { 292 return; 293 } 294 295 if (choiceBox == null) { 296 choiceBox = createChoiceBox(this, items, converterProperty()); 297 } 298 299 choiceBox.getSelectionModel().select(getItem()); 300 301 super.startEdit(); 302 303 if (isEditing()) { |