01 /*
02 * Copyright 2014-2016 the original author or authors.
03 *
04 * Licensed under the Apache License, Version 2.0 (the "License");
05 * you may not use this file except in compliance with the License.
06 * You may obtain a copy of the License at
07 *
08 * http://www.apache.org/licenses/LICENSE-2.0
09 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package griffon.plugins.glazedlists.javafx.gui;
17
18 import javafx.scene.control.TableCell;
19 import javafx.scene.control.TableColumn;
20 import javafx.scene.control.cell.TextFieldTableCell;
21
22 import javax.annotation.Nonnull;
23
24 /**
25 * @author Andres Almiray
26 */
27 public interface TableCellFactory {
28 public static final TableCellFactory DEFAULT_NON_EDITABLE = new TableCellFactory() {
29 @Nonnull
30 @Override
31 public <E, T> TableCell<E, T> createTableCell(@Nonnull TableColumn<E, T> tableColumn) {
32 TableCell<E, T> cell = new TableCell<>();
33 cell.setEditable(false);
34 return cell;
35 }
36 };
37
38 public static final TableCellFactory DEFAULT_EDITABLE = new TableCellFactory() {
39 @Nonnull
40 @Override
41 @SuppressWarnings("unchecked")
42 public <E, T> TableCell<E, T> createTableCell(@Nonnull TableColumn<E, T> tableColumn) {
43 return (TableCell<E, T>) TextFieldTableCell.forTableColumn().call((TableColumn<Object, String>) tableColumn);
44 }
45 };
46
47 @Nonnull
48 <E, T> TableCell<E, T> createTableCell(@Nonnull TableColumn<E, T> tableColumn);
49 }
|