FXWritableTableFormat.java
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 javax.annotation.Nonnull;
19 
20 /**
21  @author Andres Almiray
22  */
23 public interface FXWritableTableFormat<E> extends FXTableFormat<E> {
24     /**
25      * For editing fields. This returns true if the specified Object in the
26      * specified column can be edited by the user.
27      *
28      @param column the column to test.
29      @return true if the object and column are editable, false otherwise.
30      */
31     boolean isEditable(@Nonnull E baseObject, int column);
32 
33     /**
34      * Sets the specified field of the base object to the edited value. When
35      * a column of a table is edited, this method is called so that the user
36      * can specify how to modify the base object for each column.
37      *
38      @param baseObject  the Object to be edited. This will be the original
39      *                    Object from the source list.
40      @param editedValue the newly constructed value for the edited column
41      @param column      the column which has been edited
42      @return the revised Object, or null if the revision shall be discarded.
43      * If not null, the EventTableModel will set() this revised value in
44      * the list and overwrite the previous value.
45      */
46     @Nonnull
47     E setColumnValue(@Nonnull E baseObject, Object editedValue, int column);
48 }