pivot-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gkbr...@mac.com>
Subject Re: RowEditor and db
Date Thu, 14 Oct 2010 15:56:20 GMT
I just looked into this a bit more closely. I definitely see what you mean about the ease of
use issue - I think the current editor API is probably a bit more complex than it needs to
be.

I just prototyped a simpler version for ListView.ItemEditor that I think will also work for
TableView and TreeView (as well as ListButton and Spinner, which don't currently support editors
but should). The updated interface consists of a single method:

public interface ItemEditor {
    public void edit(ListView listView, int itemIndex);
}

This simplified interface obviously makes it much easier to implement custom editors. The
default ListViewItemEditor class now extends Window and implements ListView.ItemEditor (see
attached). The implementation of the edit() method simply sets up the editor and calls the
base open() method to show the popup. It overrides close() to update the list data. 

By default, the editor does not perform any validation. However, this can easily be applied
at the application level by overriding the close(boolean) method. This approach is consistent
with other means of collecting user input in a Pivot application (e.g. dialogs and sheets),
which also often override close() to perform validation. 

An application could also override close() to perform DB updates. Alternatively, this could
be done in response to change events fired by the model. Which approach is best depends on
the requirements of the application.

TableView's editor interface would look like this:

public interface RowEditor {
    public void edit(TableView tableView, int rowIndex, int columnIndex);
}

and TreeView's like this:

public interface NodeEditor {
    public void edit(TreeView treeView, Path path);
}

Comments are welcome.

G

On Oct 14, 2010, at 10:08 AM, Greg Brown wrote:

>> After writing this, I think I should rather write a jira ticket!
> 
> That's a good idea. It sounds like you might have some good ideas as to how the editing
process could be improved, and JIRA is the best way to track issues like this.
> 
> G
> 


Mime
View raw message