Closed nbrugger-tgm closed 3 years ago
Creating a wrapper class that catches add
and remove
operation on a list and binds such events to the regarding UI equivalents
Code in mind Usage:
ReactiveList<Task> todoList = ReactiveList.create(new ArrayList<>());
TodoListView view = new TodoListView();
view.setData(todoList);
UI:
ReactiveListModel<Task> listModel = new ReactiveListModel();`
JList<Task> taskList = new JList(listModel.swing());
Binding:
listModel.bind(binder);
ReactiveList
would be an interface extending Reactable
and List
Non swing usage
GenericPanel panel = . . . ;
ReactiveListModel<Task> listModel = new ReactiveListModel(panel::addEntry,panel::removeEntry);
I am myself not satisfied with the way list support was done.
Working on a redesign at the branch list-rework
.
Drop your ideas what to change and how to make the system better
Creating lists is now even easier!
Extending from the ReactiveListView
class gives you a simple way for list support by just implementing the methods
addElementAt
createElement
and removeElement
!
The branch list-rework
contains working list examples as of the 685ba94afa7b7c8f6864f681cbbbfbac50b97541 commit
Branch list-rework
now contains support for "basic lists" (for example with just strings in it) fd2c3f36e0f76bab8c15d879620f7562f037ec6b
Found in src\test\java\com\niton\reactj\examples\simplelist\StringListApp.java
ReactiveList<String> someArray = ReactiveList.create(new ArrayList<>());
JFrame frame = new JFrame(); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.setLayout(new GridLayout());
SwingListView
frame.add(view.getView()); frame.pack(); frame.setVisible(true);
someArray.add("Can you see me?");
This is *fully runnable* :)
2.2.2
is now available as pre-release
Due to #37 parts of the list system will be rewritten. It might just be a technical change but maybe it affects usage too
The changes to the list system are sever, therefore usage will be affected.
After the next release the list system should perform better, be way more flexible and userfriendly
List support is implemented as of v4.0.0b7
. There are no MVC components implemented yet, but hence they do not belong to list support this feature is completed.
List MVC components will be part of the core-mvc rework
It should be easy to create nested components.
For example: A task-list has tasks in it
You create a
TaskListView
and bind it to the Array of Tasks, Then you create aTaskView
which should be bound to an element of the List