Suppose a data list is created for holding infomation for one workflow. Is is needed to hide this data list - e.g. prevent it from addinig, creating data to it, and more over creating new data list type from UI. Is there a way to do this?
The easiest way to prevent users from adding, removing and editing data would be to set custom permissions on the datalist items using a java behaviour.
Related
When changing the number of columns and rows of natTable
After clearing the column list of DataProvider, create a new column item and change the column item list of columnPropertyAccessor.
Then, put the new data model into the filter list and refresh it.
When the 7-column nattable is sorted (ascending or descending) and clicked, it is changed to a different data model (4 columns) as above, but if it is sorted, "CurrentModificationException" and "IndezxOutOfBoundException" occur.
If you exchange data models without sorting, there is no problem.
I don't know which part is causing it.
Is my way of replacing the filter list wrong when changing the data model?
If anyone has encountered a similar error and has solved it, please help.
Well you don't show how you are doing things, so I can't tell any details. But to answer your question, yes I think you are doing things wrong.
In short, if you have a state applied according to a column like sorting or filtering and you change the underlying data structure, things will break as the states does match the structure anymore. Not sure why you think this should work automatically.
If you change the underlying data structure you need to clear structure based states in advance.
There is an example in the NatTable examples application that shows how to change the data provider dynamically. Not sure if the example covers the clearing of states or if this is handled automatically when you are doing things correctly.
In my java application, I have a dropdown box which needs to be populated with values from a table games.
There is a separate functionality to add a game. (i:e. an insert in the table games)
The values of the dropdown wont be changing unless someone adds something in the database.
To develop the functionality to populate the dropdown box,
One way is to -
Hit the table everytime a page load happens and fetch the data to populate the dropdown.
Is this an effective way? Can someone suggest me a better alternative design?
You could use a cache... everytime a game is added you simply update your cache.
Implementing a cache is simple.
If inserting data and retrieving it for the dropdown are performed in the same java application, then we might implement a kind of cache for the list of values.
So, we need a structure to store last list of games fetched from database, for example List<Game>, and a flag that is essentially an indicator for the event "someone added row to database".
Each time the page with dropdown is requested, we first check the indicator - if it is true, then we need to reload the list from database and set it back to false, if it is false - we can return the cached list.
Each time user adds entry to database, we set this indicator to true.
Also please be advised of possible concurrency problems when implementing that kind of cache.
I need to be able to store a list of many bitmaps with multiple values for each, for instance a string name, a int resource ID and a boolean flag. Because of this I am leaning towards using SQLite to store this data and retrieve what I need into a list on demand. Currently I am handling these bitmap lists by syncing multiple ArrayLists with the values so the nameList, resourceIDList and flagList indexes are synced across. This works but the class I created to create these lists have several hundred items per list and when I need to add a new entry it can be a real pain as I have to update each list. This method also feels sloppy so if anyone can chime in on a better solution I am all ears!
Why don't you use android sqlite to store and retrieve your data. Then you can conveniently display the retrieved data on the list. Below I have provided some useful links.
http://www.vogella.com/tutorials/AndroidSQLite/article.html
http://www.androidhive.info/2011/11/android-sqlite-database-tutorial/
I display a list of db table rows which are editable. I would like to allow users to edit the data in the displayed table and save all updates at the same time. How should I get back the list of updates to the controller?
As Play can bind to POJO's and also bind to Lists, it should be possible to simply create a list of POJOs.
See here for more details http://www.playframework.org/documentation/1.2.2/controllers#array.
It does not give this as an explicit example, but it should work.
If it does not, then the other options you have is to create your own custom binder (also described on the page linked to above).
I have a web service that holds information for users. Each user has a list of items, possibly thousands. I want to add an item to the list without loading the entire list. Is there a list implementation that allows you to add elements to the list without bringing the entire list into memory?
A Doubly Linked List. By definition it's not necessary to traverse the list to add something to the end since it contains a pointer to the end.
the list is on a remote database. –
Lumpy
So the list is in a database, so it's not really a Java List? It's just a bunch of database rows? In that case why not just do an insert into the database to add another row?
INSERT INTO list VALUES 1, 2, 3;
Lazy proxies. You can use a JDK dynamic proxy (java.lang.reflect.Proxy) where you store only the information needed for retrieving the items from the database, not the items themselves. Only when calling the get(..), size(), contains(..) methods - fetch the data.
However I have a feeling that you are doing things the wrong way. Give more details about your implementation.
None that I know.
With middlewares such as Terracotta, some collections (such as maps) can be loaded on-demand and partially, but this doesn't exist as-is in the standart JDK.