From: Jean-Marc V. <jea...@gm...> - 2012-03-14 10:44:12
|
EulerGUI : enhance the table view Now we have a new table view for each N3 source. Currently the class TableModelFromN3 takes as argument a list of triples from which row and columns are computed. Currently it has several flaws: 1. it only offers a snapshot of the given triples, it does not allow dynamics updates or removals, following model-view design pattern 2. the order of rows, and columns, is determined arbitrarily by the underlying Drools working memory; it is not possible for the user to change the order of rows (preferably by drag and drop), and the changes are not reflected in the KB 3. URI resources should have a relevant look-and-feel: either shown as hyperlinks, or show tooltip with properties for this URI, or give choice to download the URI, and highlight other occurences in current table 4. no possibility of showing multi-valued properties for a given resource Some enhancements are already possible by the framework: - add a column of derived values by adding a rule like : { ?X ... } => { ?X :newProperty ?COMPUTED_VALUE }. - change order of rows by clicking on columns (but not kept in the KB) - change order of columns (but not kept in the KB) - edit a cell (but changes not kept in the KB) For point 1. , the design explained in previous post in the list must be used. More precisely, there will be a new class N3TableModel extending DefaultTableModel, and with methods : /** populate the table with rows made of all triples ?uri ?P ?V */ void setRows( List<String> uri ); List<String> uri getRows(); List<String> uri getColumns(); /** add at the end of table a row made of all triples ?uri ?P ?V */ void add( String uri ); void remove( String uri ); /** add in table after given Uri a row made of all triples ?uri ?P ?V */ void add( String uri, String afterUri ); void add( String uri ); /** add a cell in the table; several cases: - if cell exists but is empty, it is filled - if cell exists but is not empty, a new colunm will be added - if cell does not exist, a new colunm will be added */ void addElement( ITriple t ); void removeElement( ITriple t ); For implementation, we will extract methods from TableModelFromN3. For point 2., the above API offers methods. For implemeting drag and drop for columns, there is no obvious way, cf this Google search: *move rows by clicking jtable* One thing is sure, by default sorters in JTable manipulate the view, and the table model remains unchanged by default, see : http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#sortin -- Jean-Marc Vanel Déductions SARL - Consulting, services, training, Rule-based programming, Semantic Web http://jmvanel.free.fr/ - EulerGUI, a turntable GUI for Semantic Web + rules, XML, UML, eCore, Java bytecode +33 (0)6 89 16 29 52 chat : irc://irc.freenode.net#eulergui |