Search Results

Search found 6 results on 1 pages for 'banang'.

Page 1/1 | 1 

  • SmartGWT TreeGrid, adding and editing

    - by Banang
    I'm trying to programmatically add a new TreeNode to a TreeGrid, and then turn on editing for the newly added node. This is my data source: DataSource ds = new DataSource(); DataSourceTextField idField = new DataSourceTextField("key", "Id"); DataSourceTextField nameField = new DataSourceTextField("name", "Name"); DataSourceTextField keyField = new DataSourceTextField("id", "Key"); keyField.setPrimaryKey(true); ds.setFields(idField, keyField, nameField); ds.setClientOnly(true); My fields: TreeGridField name = new TreeGridField("name", "Name"); TreeGridField id = new TreeGridField("id", "Id"); TreeGridField key = new TreeGridField("key", "Key"); key.setHidden(true); id.setHidden(true); And my code for adding a new record: TreeNode parent = (TreeNode) treeGrid.getSelectedRecord(); if (parent == null) parent = treeGrid.getData().getRoot(); Tree data = treeGrid.getData(); node = data.add(node, parent); Now, how on earth do I switch on editing for the added node? I've tried startEditing(), but that defaults to the first node, and I don't see any way of obtaining the row number for the newly added node, which would allow me to use startEditing(rowNum, colNum, suppressFocus). Using startEditNew() is not an option for many reasons, mainly because that method adds the new node to the bottom of the tree, which doesn't work at all with my app. How do I do this? Grateful for any help you guys can give me.

    Read the article

  • Unit testing JSON output module, best practices

    - by Banang
    I am currently working on a module that takes one of our business objects and returns a json representation of that object to the caller. Due to limitations in our environment I am unable to use any existing json writer, so I have written my own, which is then used by the business object writer to serialize my objects. The json writer is tested in a way similar to this @Test public void writeEmptyArrayTest() { String expected = "[ ]"; writer.array().endArray(); assertEquals(expected, writer.toString()); } which is only manageable because of the small output each instruction produces, even though I keep feeling there must be a better way. The problem I am now facing is writing tests for the object writer module, where the output is much larger and much less manageable. The risk of spelling mistakes in the expected strings mucking up my tests seem too great, and writing code in this fashion seems both silly and unmanageable in a long term perspective. I keep feeling like I want to write tests to ensure that my tests are behaving correctly, and this feeling worries me. Therefore, is there a better way of doing this? Surely there must be? Does anyone know of any good literature in regard to this specific case (doesn't have to be json, but you know what I mean)? Grateful for all help.

    Read the article

  • Query on object id in VQL

    - by Banang
    I'm currently working with the versant object database (using jvi), and have a case where I need to query the database based on an object id. What I'm trying to achieve is something along the lines of Employee employee = new Employee("Mr. Pickles"); session.commit(); FundVQLQuery q = new FundVQLQuery(session, "select * from Employee employee where employee = $1"); q.bind(employee); q.execute(); However, I'm finding out the hard way (I get an EVJ_NOT_A_VALID_KEY_TYPE error thrown at me) that this is infact not the way to do it. Anyone got any experience in working with VQL? Your help is much apreciated! A small clarification: The problem is I'm running some performance tests on the database using the pole position framework, and one of the tests in that framework requires me to fetch an object from the database using either an object reference or a low level object id. Thus, I'm not allowed to reference specific fields in the employee object, but must perform the query on the object in its entirety. So, it's not allowed for me to go "select * from Employee e where e.id = 4", I need it to use the entire object. Accepted answer: Since there is some sort of lunacy magic built into SO that prevents me to mark an accepted answer after a bounty has run out, readers should know that the answer posted by Chris Holmes solves this issue. Readers are encouraged to up-vote his post to further signalize the correctness of his answer to any future readers of this thread.

    Read the article

  • Classloader issue (GWT)

    - by Banang
    I'm currently working on a gwt app, where the server uses a few third party libs. recently I discovered that one of these libs isn't being properly loaded when running my app in deployed mode, and I just can't seem to figure out what out is I'm doing wrong. In my build script I have the following classpath declaration: <path id="project.class.path"> <pathelement location="${war.dir}/WEB-INF/classes"/> <fileset dir="${war.dir}/WEB-INF/lib" includes="**/*.jar"/> </path> and in a later target I copy the jar I need to the right location: <copy todir="${war.dir}/WEB-INF/lib" file="someJar.jar" /> The project builds as it should, without any errors. The jars are copied to where the should be, and are included in the resulting war file. In development mode everything is working as it should, everything gets loaded properly and I hear no complaints. However, in the deployed version I get this thrown at me: java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException java.lang.ClassLoader.defineClass1(Native Method) java.lang.ClassLoader.defineClass(ClassLoader.java:621) java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2331) org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:976) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1451) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1329) java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320) my.package.server.util.SomeUtils.doSomethingFantastic(SomeUtils.java:84) Line 84 in SomeUtils is trying to instantiate a class from someJar.jar. I know very little about how the class loader for gwt works, and I sure could use a hand. Anyone got any ideas on how to solve this?

    Read the article

  • Is there any danger in committing to a component library such as SmartGwt or Swing?

    - by Banang
    Since February this year I have been working on an app that's built using SmartGWT components. Generally, I find the components very nice to work with, and the fact that they're open source and free to use is just fantastic. However, I can't seem to shake the feeling that it's not a durable way of developing, but I can't quite explain why. Maybe it's because I know that any minute now the team developing it could decide to stop, which would leave me and my team in a bit of a pickle, but I'm sure there must be something more. I have been trying to find ways of explaining this feeling to myself, but to no avail. Therefore I turn to you, dear community, to ask if you can come up with a good reason why committing to building your app (that's supposed to be around for many more years to come) using a component library such as SmartGWT is a bad idea? Is there any reason I should just have developed the components myself? Or did I make the right choice when deciding not to reinvent the wheel and just go for what was readily available?

    Read the article

  • Permuting a binary tree without the use of lists

    - by Banang
    I need to find an algorithm for generating every possible permutation of a binary tree, and need to do so without using lists (this is because the tree itself carries semantics and restraints that cannot be translated into lists). I've found an algorithm that works for trees with the height of three or less, but whenever I get to greater hights, I loose one set of possible permutations per height added. Each node carries information about its original state, so that one node can determine if all possible permutations have been tried for that node. Also, the node carries information on weather or not it's been 'swapped', i.e. if it has seen all possible permutations of it's subtree. The tree is left-centered, meaning that the right node should always (except in some cases that I don't need to cover for this algorithm) be a leaf node, while the left node is always either a leaf or a branch. The algorithm I'm using at the moment can be described sort of like this: if the left child node has been swapped swap my right node with the left child nodes right node set the left child node as 'unswapped' if the current node is back to its original state swap my right node with the lowest left nodes' right node swap the lowest left nodes two childnodes set my left node as 'unswapped' set my left chilnode to use this as it's original state set this node as swapped return null return this; else if the left child has not been swapped if the result of trying to permute left child is null return the permutation of this node else return the permutation of the left child node if this node has a left node and a right node that are both leaves swap them set this node to be 'swapped' The desired behaviour of the algoritm would be something like this: branch / | branch 3 / | branch 2 / | 0 1 branch / | branch 3 / | branch 2 / | 1 0 <-- first swap branch / | branch 3 / | branch 1 <-- second swap / | 2 0 branch / | branch 3 / | branch 1 / | 0 2 <-- third swap branch / | branch 3 / | branch 0 <-- fourth swap / | 1 2 and so on... Sorry for the ridiculisly long and waddly explanation, would really, really apreciate any sort of help you guys could offer me. Thanks a bunch!

    Read the article

1