I am using Vaadin 8 and I want to make some sort of confusion matrix. I was wondering if I can fill the values of the table/grid manually according to the cell position, instead of data provider.
referenceTable.addColumn(reference -> String.valueOf(reference.getId())).setId(REFERENCE_ID).setCaption(REFERENCE_ID).setMinimumWidth(100).setMaximumWidth(200);
referenceTable.addColumn(reference -> String.valueOf(reference.getTitle())).setId(TITLE_COLUMN).setCaption(TITLE_COLUMN).setMinimumWidth(100).setMaximumWidth(500);
I don't have any specific model which I can use.
Something like this, I want
Typically Grid in Vaadin is typed with POJO type bean and the API is optimized for that use case. However you can potentially use Grid with any valid type parameter. You can e.g. use List or HashMap<String,String> just to name few.
In GitHub there is Vaadin 8 example of Grid using ArrayList, which makes possible to use index to access the data for the column. The full code is too extensive to be featured here. The example contains also demonstrator for style generator.
Related
Is it possible to set the output format of my custom node to any object i created inside my node? or are there restrictions?
Your output should implement PortObject, and also have a PortObjectSerializer and PortObjectSpec (also with PortObjectSpecSerializer). You need to register that with an extension point, just like this. After that, you can use them.
I would recommend using existing port objects though. For example PMMLPortObject might be a good alternative if you need tree-like data structures, BufferedDataTable for tabular data, and the ImagePortObject for images. You might consider creating special cell types and store them in regular BufferedDataTables.
The current java API for elastic search documentation does not say anything about creating an index template.
I know I can create an index template using crud, but my elastic search index is going grow depending on the data I get. The data I have right now, it may be possible that the data may change. So instead of manually making an index and a template, I want to know if it can be done through writing a code in Java.
You can use the IndicesAdminClient to create a template
node.client().admin().indices().putTemplate(
new PutIndexTemplateRequest("templatename").source(templateString)
);
PutIndexTemplateRequest has other methods to programatically build the template if you'd prefer to build it as a Java map, etc.
I need a way to filter a JTable by clicking on the column header. Ideally, a click on a column header would show a drop-down list with unique values corresponding to that column. One or more values can then be selected to filter the JTable.
I did a bit of research and came across the swingbits library, which does the job. But I was wondering if there were any other built in (or external) java libraries that would allow me to accomplish this.
Could not find any in-built libraries that provided the required functionality. Found another external library called TableFilter that has a pretty good set of features. But it does have some short comings like the inability to select multiple values for a filter and the filter not actually being on the table header.
Went ahead with Swing Bits which is the closest match for my needs.
I'd like to list all labels in my neo4j database.
For example, in my site, I have 'songs' which I'd like to tag with labels such as 'jazz', 'classical', 'hiphop', or 'funk'. I can do this, but then I also want to let users know which tags already exist by returning all the labels (aka tags) in my database.
I could use nodes for tags instead, but I thought tagging would be a good use case for labels. Am I missing something?
GlobalGraphOperations.getAllLabels() is your friend.
I'm trying to wrap my head around this. My language is Java using PlayFramework but I think any answer using php, or ruby on rails would get me in the right direction. Basically the user can add or take away number of pallets in this form. There needs to be some javavscript calculations per tab also. Everything is fired using a input change jquery event so there is no submit buttons. My first mockup used UUID's but that seemed to get me nowhere.
What happens is each tab is reponsible for doing calculations like perimeter. My first question is how to call javascript for the specific tab. I first did it with UUID's and separate scripts for each tab. This didn't seem correct.
My second problem is submitting this data. Obviously the name parameters need to be different. So I'm scratching my head on this. Every pallet would be tagged with an id so I'm not worried about the backend as much as I'm trying to figure out how structure the front end and the controllers.
Any help would be great. Thanks.
On the javascript part, assuming all the tabs have the same structure, create a generic method that receives and id (id of the tab) as parameter, and then retrieves the proper fields form the calculation. Something like:
function doCalc(tabId){ //assumes jquery
var tab = $("#"+tabId);
var field1 = $("#"+tabId+"_field1");
var field2 = $("#"+tabId+"_field2");
//...etc to retrieve tabs
}
The method assumes that when you create a tab "tabId" and its elements, you generate the id of the elements with the formula "tabId_", which will facilitate finding them.
About the submission, using Play! you should check this section about Ajax requests. It could be as simple as doing the calculation (the method above) and at the end call a Play method via Ajax. This method would get all the parameters (id, values, etc) of a pallet (the pallet of the given tab) and save it.
For submission, I assume you are trying to figure out how to hold and pass the data in a bean. What about having a field as below:
LinkedHashMap<String, LinkedHashMap<String, Object>> field;
The inner maps would be the listing of the fields on a Pallet. The outter maps are the Pallets.