SE401:Group19:Feature:Library toolbox
Description
A common action which is performed within FBench is to add new function blocks to a function block diagram (such as a resource or application). Currently a tedious process is used to do this:
- The user right clicks.
- Selects "Add Function Block" from drop down menu.
- Enter a function block name.
- Browse for the function block type.
- Click Add.
We want to offer an alternative:
- The user has access to a tree view of the function block library. This can be built into the UI, or as a separate window.
- From this tree view, the user can browse to the specific function blocks that they wish to add to the diagram.
- The user can simply drag and drop onto the diagram.
- FBench asks the user to enter a name, and they click Add.
This has the following benefits:
- It does not take the user two clicks to bring up the Add Function Block dialog.
- The user does not have to browse to the function block type they want - this is specified by the drag action.
- The user can quickly create multiple blocks of the same type by dragging from the same place - the old system retains no memory of the previous block type(s) that were selected.
Development
A number of steps were taken to achieve this feature:
- A new subclass of JTree was created (ToolboxTree). This defines a custom node type which will populate from a given Directory, and a custom node renderer which applies icons to certain file types.
- A new menu item is added to open a new window containing a ToolboxTree element.
- fbench.graph.GraphViewTransfer is updated to cope with various GraphView types (FBNetwork, Resource), and open up the Add Function Block dialog when a function block type is dragged onto them.
- All parts of the system are linked together so that a drag and drop action from a ToolboxTree element triggers the GraphViewTransfer class and the user is prompted to provide a name for a new function block.