How can i implement an interface like BB Messenger showing a tree with a list of complex field items that are shown only if the tree item expands.??
Use a ListField for the contents of the collapsible area (you control how each row is painted), and use some other focusable field for the header. Add both to a VerticalFieldManager. When you click on the header once, remove the ListField from the Manager. When you click on it again, add it back.
I think you are talking about tree view. for that you can try this.
Create a field to display a tree view
Related
I have a TreeGrid with a hierarchy and I want to add a Drag and Drop functionality to it.
My problem is, I only want two types of elements to be draggable, and they can only be dropped on into these two types and the root element.
So far I could manage to only allow these elements to be dragged, by returning the dragStartEvent when the element is a different type of element.
But how can I customize the allowed dropTargets when it is a Grid?
Right now the user can drop the element at any other grid element, and the only thing I can do is show an errormessage if the dropTarget is not the desired type, but this is not a good solution, they should see while dragging the item that its not droppable there.
The grid has a Drag and a Drop Filter that you can use to decide if drag or drop.
void setDragFilter(SerializablePredicate<T> dragFilter)
Sets the drag filter for this drag source.
void setDropFilter(SerializablePredicate<T> dropFilter)
Sets the drop filter for this drag target.
Please checkout the documentation https://vaadin.com/components/vaadin-grid/java-examples/drag-and-drop
I want to create several controls just like the ones below the date time picker in the alarm app. They look like label controls, but they have a title on the left, the currently selected data value on the right, and an arrow all the way to the right. The Snooze control does not have an arrow, but I believe it is the same control. What type of control would I use to do this?
Any samples out there for this in Swift?
Thanks in advance.
It sounds like you are talking about different styles of cells of a table view.
The first control you mentioned (label on left, selected data value on right) is simply a table view cell with the RightDetail style and Disclosure Indicator accessory view.
The control with the switch is not a default cell style so you will have to make your own custom Table View cell. There are plenty of tutorials online that show how to make your own style of Table View cells. The item on the right is just a regular Switch.
In my application, I have a menu that is defined as follows. Each item on the menu is a node that has the following data attributes:
MenuText : (the text that would appear for that item)
isView : Whether this item is a leaf level item or not
subMenus : if isView is false, then there are multiple menu items under this attribute.
Thus, it is a tree structure that can go till any depth. The items in the menu can change periodically and hence the implementation has to be kept flexible. This data is stored in a plist file and read into an NSArray in the code (already implemented).
I now need to create a slide out menu on the left that will be populated by this data hierarchy. I have created the menu pane and added swipe gestures to it, all of which work fine. The menu has to be a collapsible one where clicking on one menu item expands the subViews below it. If the item clicked on is a view, then a new view is loaded on the rest of the screen with appropriate data.
The problem I am facing is the logic to populate the menu (which is a UITableView) from the NSArray data. The following are the two approaches I came up with.
Create a UITableView with as many sections as there are items at the top level of the menu. Then iterate through the menu items recursively. For each menu item that is not a view (i.e. it has subMenus), create a new section with number of rows equal to the number of subMenus under it. When I come across a menu item that is a view and has no further subMenus, add it as a row to the subsection created for the menu one level above it.
Create a menu with one section and as many rows as the number of menu items at the top level. When a menu item is clicked, insert rows under it to represent its sub-menus. When another menu item on the same level is clicked, collapse the previously expanded menu by deleting the inserted rows. When a menu item with no sub menus is clicked, the rest of the screen is populated with data.
I have tried both the approaches and not been able to go beyond the initial steps. For the first method, I understand that I need to add a UITableView as a part of UITableViewCells, which is good, but I need to do that recursively. For the second approach, I need to know the indexPath of each item clicked which can go to many levels.
I would like some suggestions here about which approach I should take and some guidance over how to go about it. Also, if there is any better way to do this, kindly advice. Thanks.
In my opinion, using UINavigationController is the easiest way. You can push as many UITableViews as you want.
If it doesn't fit your design requirement, you can try expandable UITableViews. There are few open sources:
JKExpandTableView
SDNestedTable
iOS-Tree-Component
Thanks for the responses. I ended up doing this using the following control:
Accordion for iOS
It has served my purpose beautifully and I posted it here so that someone with the same requirement may find it.
Take a look at TLIndexPathTools. It has a "Tree" extension that can do this. Try running the Outline sample project. The main task in adapting the sample project would be to write a recursive function to convert your array of nodes into an array of TLIndexPathTreeItem objects. All of the code in the controller:willChangeNode: method is examples of lazy loading and it doesn't sound like you'd need any of that.
One of the cells in my DBTreeListView is bound to a repository item that is a progress bar.
I want to be able to edit the progress displayed by clicking on this cell. At this stage my application should change its cell to another repository item: a text field where I'll be able to insert a value. Once focus is changed to another cell, my progress bar should be displayed again, showing a new value. How do I do this?
DBTreeListView has column events OnGetEditingProperty and OnGetEditProperties. I'll probably use one (or both) of them, but can't come up with any good idea.
This can be simply. You should handle click on this progress bar and display editor over it. You need to handle scrolling and clicking in another place to get rid of editor. And in case that scrolling too far - editor should be hidden.
Steps:
Create hidden editor for progress
Handle OnClick for tree view item
Display editor and set focus
On editor enter (or tab) save progress information
On click on form or another part of tree view - hide editor (saving/discarding changes how specified by your policy)
On scroll tree view move the editor and when bounds of parent does not overlap bounds of editor - hide it
Best regards,
Vladimir
I've a requirement to modify a primefaces datatable as the changes are made in another datatable. It should perform like the split window, where the user can type in the top window and he can see changes in the bottom window.
Can't you use the Collector widget?