Updating individual branches using a TableTree
Hello Everyone: I am looking for a way to leverage the TableTreehttps://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/tree/TableTree.html component while getting the Ajax updating behavior of the NestedTreehttps://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/tree/NestedTree.html component. The following posthttp://stackoverflow.com/questions/19790545/stop-wicket-from-repainting-the-whole-page-after-each-ajax-call/19806978#19806978 states that when using a TableTreehttps://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/tree/TableTree.html, the TableTree#updateBranchhttps://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/tree/TableTree.html#updateBranch(T,%20org.apache.wicket.ajax.AjaxRequestTarget) causes the entire table to be updated when expanding a node. In contrast, the NestedTreehttps://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/tree/NestedTree.html component overrides the updateBranchhttps://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/tree/NestedTree.html#updateBranch(T,%20org.apache.wicket.ajax.AjaxRequestTarget) method so that the table will appear with the sub-nodes expanded without having to refresh the entire table when expanding a node. If I try to override the TableTree#updateBranchhttps://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/tree/TableTree.html#updateBranch(T,%20org.apache.wicket.ajax.AjaxRequestTarget) with the same type of Visitor functionality in the NestedTree#updateBranchhttps://github.com/apache/wicket/blob/master/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/tree/NestedTree.java method to add back only the Item or RowItem component when the node is expanded, only the parent node appears with the expanded icon, but the sub-node does not appear. This makes sense because the TableTreehttps://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/tree/TableTree.html component presents sub-nodes as new rows in the table. Is it possible to override the behavior of the TableTreehttps://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/tree/TableTree.html component such that the entire table need not be updated when expanding a node? Or am I better off using the NestedTreehttps://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/tree/NestedTree.html component? Thank you in advance, - Ephraim
Re: Updating individual branches using a TableTree
Hi, NestedTree utilizes its hierarchical markup to update the expanded branch only. This is not possible with a tabular markup. Either you - use NestedTree if you don't need columns and get partial updates for free - use TableTree because of needed columns and live with complete updates (similar to changes of sorting order in a DataTable) - or invent a solution that replicates the magic of the old (deprecated) tree implementation (it was able to update a subset or rows with a lot of specialized rendering code) Have fun Sven On 26.08.2015 21:20, Ephraim Rosenfeld wrote: Hello Everyone: I am looking for a way to leverage the TableTreehttps://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/tree/TableTree.html component while getting the Ajax updating behavior of the NestedTreehttps://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/tree/NestedTree.html component. The following posthttp://stackoverflow.com/questions/19790545/stop-wicket-from-repainting-the-whole-page-after-each-ajax-call/19806978#19806978 states that when using a TableTreehttps://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/tree/TableTree.html, the TableTree#updateBranchhttps://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/tree/TableTree.html#updateBranch(T,%20org.apache.wicket.ajax.AjaxRequestTarget) causes the entire table to be updated when expanding a node. In contrast, the NestedTreehttps://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/tree/NestedTree.html component overrides the updateBranchhttps://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/tree/NestedTree.html#updateBranch(T,%20org.apache.wicket.ajax.AjaxRequestTarget) method so that the table will appear with the sub-nodes expanded without having to refresh the entire table when expanding a node. If I try to override the TableTree#updateBranchhttps://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/tree/TableTree.html#updateBranch(T,%20org.apache.wicket.ajax.AjaxRequestTarget) with the same type of Visitor functionality in the NestedTree#updateBranchhttps://github.com/apache/wicket/blob/master/wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/tree/NestedTree.java method to add back only the Item or RowItem component when the node is expanded, only the parent node appears with the expanded icon, but the sub-node does not appear. This makes sense because the TableTreehttps://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/tree/TableTree.html component presents sub-nodes as new rows in the table. Is it possible to override the behavior of the TableTreehttps://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/tree/TableTree.html component such that the entire table need not be updated when expanding a node? Or am I better off using the NestedTreehttps://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/extensions/markup/html/repeater/tree/NestedTree.html component? Thank you in advance, - Ephraim - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Inserting/Persisting data into the DB
Having trouble getting my setTestValue method to persist my data in the db .. i do not see any exceptions but data is not hitting the database.. I am using Hibernate and postgres db @Transactional(propagation = Propagation.SUPPORTS, readOnly = true) @Service public class TestValueService implements ITestValueService { /** * */ private static final long serialVersionUID = -1027211428586214287L; @Autowired GenericDao genericDao; private static final Logger LOG = Logger.getLogger(TestValueService.class); private TestValue defaultValue; public TestValueService() { } @Transactional(readOnly = false) private void setTestValue(TestValue defaultValue){ genericDao.makePersistent(defaultValue); LOG.info(ballingss); } /* * Method to read the defaults csv file and store into the common table */ @Override //@Transactional(readOnly = false) public void readCSVFile(String fileLocation, Long clientJobId){ String csvFile = fileLocation; BufferedReader br = null; String line = ; String cvsSplitBy = ,; try { br = new BufferedReader(new FileReader(csvFile)); while ((line = br.readLine()) != null) { // use comma as separator String[] currentLine = line.split(cvsSplitBy); TestValue defaultValue = new TestValue(); Date date = new Date(); defaultValue.setClient_job_id(clientJobId); defaultValue.setCreate_dt(date); defaultValue.setActive(true); defaultValue.setDef_keyfield(currentLine[0].toUpperCase()); defaultValue.setDef_value(currentLine[1].toUpperCase()); setTestValue(defaultValue); } } catch (FileNotFoundException e) { LOG.error(File Not found ); } catch (IOException e) { e.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } } } here is the table object: @Entity @Table(name = TEST_VALUE) public class TestValue implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO, generator = default_values_def_id_seq) @SequenceGenerator(name = default_values_def_id_seq, sequenceName = default_values_def_id_seq) private Long def_id; private Long client_job_id; @Temporal(TemporalType.TIMESTAMP) private Date create_dt; @Basic private String def_keyfield; @Basic private String def_value; @Basic boolean active = false; public Long getDef_id() { return def_id; } public void setDef_id(Long def_id) { this.def_id = def_id; } public Long getClient_job_id() { return client_job_id; } public void setClient_job_id(Long client_job_id) { this.client_job_id = client_job_id; } public Date getCreate_dt() { return create_dt; } public void setCreate_dt(Date create_dt) { this.create_dt = create_dt; } public String getDef_keyfield() { return def_keyfield; } public void setDef_keyfield(String def_keyfield) { this.def_keyfield = def_keyfield; } public String getDef_value() { return def_value; } public void setDef_value(String def_value) { this.def_value = def_value; } public boolean isActive() { return active; } public void setActive(boolean active) { this.active = active; } public static long getSerialversionuid() { return serialVersionUID; } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Inserting-Persisting-data-into-the-DB-tp4671856.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Wicket page test 3.0.1 is now available (for Wicket 7.0 and 6.x)
Dear all, Wicket page test 3.0.1 is now available. It now works with Wicket 7 (and 6.x) and can reliably wait for the loading of the response page. It is a library allowing you to unit test your Wicket pages easily, supporting AJAX and Javascript without changes to your pages. It's available from maven central. Check out the tutorial at http://wicketpagetest.sourceforge.net to get started! -- Kent Tong IT author and consultant, child education coach