New form plugin

Started by Hervé, November 28, 2016, 19:36:35 PM

Previous topic - Next topic

Chris Usher

Hi Hervé,

I thought I'd try your form plugin as I have a many parameters to enter in my models.
The plugin works for me on small models but seems to hang on a larger model.

Running a trace, the plugin hangs while adding a line for a relationship.  These are the last lines from the trace which is 142740 lines long for requesting properties of a single element:

Quote
.
.
.
2017-08-17 16:59:38 TRACE 1307:FormDialog                     - Found relationship
2017-08-17 16:59:38 TRACE 2755:FormDialog                     -    filter ${class}("AssociationRelationship") matches ".*Relationship" --> true
2017-08-17 16:59:38 TRACE 1343:FormDialog                     -    adding line for AssociationRelationship ""
2017-08-17 16:59:38 TRACE 1354:FormDialog                     -       adding label cell with value "AssociationRelationship"
2017-08-17 16:59:38 TRACE   57:FormVariable                   -          getting real EObject the expression "${class}" refers to (from AssociationRelationship:""(c658d844))
2017-08-17 16:59:38 TRACE   73:FormVariable                   -          --> itself
2017-08-17 16:59:38 TRACE 1380:FormDialog                     -       adding text cell with value ""
2017-08-17 16:59:38 TRACE   57:FormVariable                   -          getting real EObject the expression "${name}" refers to (from AssociationRelationship:""(c658d844))
2017-08-17 16:59:38 TRACE   73:FormVariable                   -          --> itself
2017-08-17 16:59:38 TRACE 1380:FormDialog                     -       adding text cell with value ""
2017-08-17 16:59:38 TRACE   57:FormVariable                   -          getting real EObject the expression "${documentation}" refers to (from AssociationRelationship:""(c658d844))
2017-08-17 16:59:38 TRACE   73:FormVariable                   -          --> itself
2017-08-17 16:59:38 TRACE 1307:FormDialog                     - Found relationship
2017-08-17 16:59:38 TRACE 2755:FormDialog                     -    filter ${class}("AssociationRelationship") matches ".*Relationship" --> true
2017-08-17 16:59:38 TRACE 1343:FormDialog                     -    adding line for AssociationRelationship ""
2017-08-17 16:59:38 TRACE 1354:FormDialog                     -       adding label cell with value "AssociationRelationship"

The form isn't shown at all but the pointer shows the application is still busy.

Running on Windows 7, I tried with plugin version 1.4 and 1.5.4 against archimate 4.0.1 and 4.0.3-beta1 all with the same behaviour.

Is there a limit on the number of elements the model can contain?
Any assistance would be most helpful.

Hervé

Hi Chris,

I use my form plugin every week at work on a Windows 7 (32 bit) laptop.

I know that the trace mode is very verbose (because I use this mode it to debug my plugin) but I never generated such 142000 lines long files.

The fact that the form does not show is quite normal, because I wait until all the form controls are created before showing it (not doing so would be slower) but that does not explain why the plugin hangs ...

Unfortunately, the trace log  file is not of any help to me because I do not have any error message  :( But may be, the plugin does not hang but is very slow on your huge model ...

The only thing I can suggest is to wait longer:
   - either an error message is eventually added to the log file
   - either the form eventually shows up

While waiting, could you please have a look on the cpu consumption (it may indicate if the plugin really hangs on an event or if there is a loop somewhere).

Best regards
Hervé

Chris Usher

Hi Hervé,

Thank you for replying.

I was using the test form you provided (org.aricontribs.form.conf), and I found that changing
"refers": "model"
to "selected" or "view" produced the viewable form instantly.

That would suggest there is some element in my model that is causing the issue.  The issue does not occur when only scanning a single view or selected elements.

I can work with this until I come across the element causing the issue.  However, it means I can't use the form as I intended - to edit or export lists of elements contained in the whole model.


One other error that popped up was this:
Quote...
In table "tab"
Attribute "lines"

Failed to generate lines for unknown object class "DiagramModelConnection"

I have a note connected to a node, when I remove the note from the node the error disappears. This suggests the plugin (or my configuration) is not able to handle notes.

Thank you for making this plugin available.

Chris

Hervé

Hi Chris,

Regarding the "refers": "model" part, I unfortunately cannot help you further without an error message. If your form is not confidential, you may sent it to me by mail or in a private message on this forum. I can try it on my models but it is not sure that I can reproduce the same behaviour.

Regarding the error message you sent me, it is clearly a but that I will investigate. Thanks for pointing it out to me.

Best regards
Hervé

Chris Usher

Hi Hervé,

I monitored resource usage while executing the "refers": "model" variant and with logging set to DEBUG, CPU usage for Archi rose to ~60% for approximately 10 seconds, then returned to ~0%, however the process does not render the dialog and no error message is produced.

I suspect there is some issue with the content of my model.  The model has been through many transformations, has a mix of old and new style id's, has been exported and imported from the database plugin and also post-processed as XML with my own code to bulk update the XML, so there may be some inconsistencies in the model with orphaned relationships or connections.  Unless I could guarantee the model to be clean and consistent it would be unwise to spend further time looking for the cause of the error.  When I have more time I shall attempt to validate the XML and clean up the model before trying again.

My search for the culprit element continues...!

If I find a reason for the problem I shall let you know.


The more I look into the configuration with its filters for source and target relationships, I begin to see the full potential of this plugin. Thank you.

Chris.

Hervé

Hi Chris,

I do not believe it comes from your model because Archi is able to handle it so my plugin should be able to handle it. Please do not hesitate if you need me to investigate. If you find something on your side, please do not hesitate to tell me that I can correct my plugin.

Thanks a lot for your encouragement.

As few people required it, I'm currently developping a graphical interface to generate the configuration file. As it is quite very complex, I know that it is very difficult to get into it.

Best regards
Hervé

Hervé

Dear all,

I'm please to announce the version 1.6 of my form plugin. It is available on GitHub : https://github.com/archi-contribs/form-plugin

To install it, as usual you may download the .jar file and copy it to Archi's plugins folder. Alternatively, if you already have got the form plugin installed, you may click on the "check for update" button to automatically download and install the new version.

The key updates are:

  • I've created the long time waited configuration file graphical editor, meaning that one does not need to manually edit the JSON configuration files anymore
  • to acheive this, each configuration file should now contain a single form (while before it could contain many)
  • the undo/redo has been rewritten to be more reliable

To migrate your configuration files to this new version, you just need to do the three following updated :

  • Replace the "version" value from "2" to "3"
  • if your configuration file contains a single form, then remove the brackets around the "org.archicontribs.form" value to convert the JSONArray to a JSONObject
  • if your configuration file contains several forms, then split it to several files, one form per file

If you haven't got any configuration file, you can of course create a new one using the configuration file graphical editor.

You are more than welcome to drop me a line on this forum or on GitHub, should you have any question, comment, or a new functionality request.

Best regards
Hervé

Jean-Baptiste Sarrodie

Hi Hervé,

I'll test soon, but did you fix the issue with nested elements not being listed in the form (when used on view content) ?

Regards,

JB
If you value and use Archi please consider making a donation! https://www.archimatetool.com/donate

Hervé

Hi JB,

Yes, the nested elements bug has been solved.

Unfortunately, I'd forgotten that the getChildren() method on a container only gives the elements and not the relationships. I just released the version 1.6.1 to add the relationships  :-[

As I've rewritten more than half the code that parses the JSON file and that manages the widgets, I'm sure that I introduced other bugs. My plugin works well with my test forms but I cannot test 100% of the cases. I need to find a way to automate the testing to reduce the numbers of bug but I did not find a solution as my plugin relies heavily on the graphical interface.

Best regards
Hervé

Jose-Carlos

Hi Hervé,
I have used this plugin to display a form having all nodes with properties (typically CPU, RAM, Disk, ...).
The goal is to easy set values for all nodes.
Unfortunately, all nodes are displayed twice. It seems to be retreived from the model structure, but I'm unable to retreive in a unique row.
Is there some unique option or additional filter to get the short list of nodes?

Here is the configuration file and a screenshot in attachment.

{
"version": 3,
    "org.archicontribs.form":
{
"name": "Update Nodes properties for ${class} ${name}",
"refers": "model",
"width": 900,
"height": 400,
"spacing": 4,
"background": "250, 250, 250",
"buttonOk": "Ok",
"buttonCancel": "Cancel",
"buttonExport": "Export to Excel",
"variableSeparator": ":",
"whenEmpty": "ignore",
"tabs": [
{
"name": "Elements in the container",
"background": "200, 200, 200",
"controls": [
{
"class": "table",
"x": 10,
"y": 10,
"width": 870,
"height": 300,
"background": "255, 255, 255",
"foreground": "0, 0, 0",
"tooltip": "This table contains all the elements present in the view",
"excelSheet": "elements",
"excelFirstLine": 1,
"columns": [
{"name": "Class",         "ExcelColumn": "A",  "excelCellType": "string", "excelDefault": "zero", "width": 100,  "class": "label",  "fontItalic": true },
{"name": "Name",          "ExcelColumn": "B",  "excelCellType": "string", "excelDefault": "zero", "width": 100,  "class": "text",   "fontBold": true   },
{"name": "Documentation", "ExcelColumn": "C",  "excelCellType": "string", "excelDefault": "zero", "width": 100,  "class": "text",   "default": "${property:documentation_${model:property:language}}", "forceDefault": true },
{"name": "CPU",           "ExcelColumn": "D",  "excelCellType": "string", "excelDefault": "zero", "width": 50,  "class": "text",   "default": "${property:CPU_${model:property:language}}", "forceDefault": true },
{"name": "RAM",           "ExcelColumn": "E",  "excelCellType": "string", "excelDefault": "zero", "width": 50,  "class": "text",   "default": "${property:RAM_${model:property:language}}", "forceDefault": true },
{"name": "Disk",          "ExcelColumn": "F",  "excelCellType": "string", "excelDefault": "zero", "width": 50,  "class": "text",   "default": "${property:Disk_${model:property:language}}", "forceDefault": true },
{"name": "Other",         "ExcelColumn": "F",  "excelCellType": "string", "excelDefault": "zero", "width": 50,  "class": "text",   "default": "${property:Other_${model:property:language}}", "forceDefault": true },
],
"lines": [
{
"generate": true,
"cells": ["${class}", "${name}", "${documentation}", "${property:CPU}", "${property:RAM}", "${property:Disk}", , "${property:Other}"],
"filter": {
"genre": "OR",
"tests": [
{ "attribute": "${class}", "operation": "iequals", "value": "Node" },
{ "attribute": "${class}", "operation": "iequals", "value": "Device" }
]
}
}
]
}
]
}
]
}
}



Hervé

Hi Jose Carlos,

No, you should definitievly have the elements only once. Thanks for sharing your configuration file. I'll do some testing tonight and let you know.

Best regards
Hervé

Jose-Carlos

Hi Hervé,
thanks a lot for your support and your creative work!

I have activated the trace for form-plugin. The output is in attachment.
It looks that properties are loaded twice because it's coming from classes ArchimateModel and ArchimateDiagramModel:

2017-09-28 17:15:47 TRACE  907:FormJsonParser                 -    filter ${class}("ArchimateModel") equals (ignore case) "Node" --> false
2017-09-28 17:15:47 TRACE  907:FormJsonParser                 -    filter ${class}("ArchimateModel") equals (ignore case) "Device" --> false
2017-09-28 17:15:47 DEBUG  778:FormJsonParser                 - Creating table item
...
2017-09-28 17:15:47 TRACE  907:FormJsonParser                 -   filter ${class}("ArchimateDiagramModel") equals (ignore case) "Node" --> false
2017-09-28 17:15:47 TRACE  907:FormJsonParser                 -    filter ${class}("ArchimateDiagramModel") equals (ignore case) "Device" --> false
2017-09-28 17:15:47 DEBUG  778:FormJsonParser                 - Creating table item
....


Is it possible to add a filter on configuration file?

Regards

Hervé

Hi Jose-Carlos,

In fact, ArchimateModel is the model itself whereas ArchimateDiagramModel is a view. They are completely different objects so the error does not come from this.

My error comes from the fact that you apply your form to the whole model ("refers": "model").

So I consider all the folders (Strategy, Business, Application, ...) one by one and I recursively find all the elements and relationships. My bug is that, in your case, I did the same on the "views" folder. Therefore, I also found all the elements and relationships that were in one of your views ... and consequently leading to duplicates.


Regarding the filter on the configuration file, in fact my plugin already allows to specify a filter on the form but it has just been forgotten in the graphical editor. I just added it.


You will find the release 1.6.2 on GitHub in few minutes  :)

Thanks for pointing me these bugs. Please do not hesitate to drop me a line should you discover others  ;)

Best regards
Hervé

Jose-Carlos

Hi Hervé,
thanks a lot for your new version and reactivity. It's working fine!

I have one question about the usage: is it possible to filter objects only for the current view and not the overall model? I tried to change the item refers in configuration file, but not sure which value to set...

Thanks for your help.

Best regards.

Hervé

Hi Jose-Carlos,

If you use the graphical editor to manage your form, you have a combo with the list of valid value for the "refers" keyword.

One of them is "view"  ;D

Best regards
Hervé