Skip to content

Commit 9e69dd3

Browse files
committed
added description to usage of helper classes
1 parent 09f9384 commit 9e69dd3

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ For cross cutting functionality, these soft references can be the solution here.
5656

5757
| Platform Version | Add-on Version |
5858
| ---------------- | -------------- |
59+
| 7.0.x | 0.5.x |
5960
| 6.10.x | 0.4.x |
6061
| 6.9.x | 0.3.x |
6162
| 6.8.x | 0.1.x - 0.2.x |
@@ -72,3 +73,46 @@ Add custom application component to your project:
7273
## Example usage
7374

7475
To see this application component in action, check out this example: [cuba-example-using-taggable](https://github.com/mariodavid/cuba-example-using-entity-soft-reference).
76+
77+
## Usage
78+
79+
### Soft references as Table columns
80+
81+
In order to use a soft reference as a Table column, there is a class `de.diedavids.cuba.entitysoftreference.web.SoftReferenceInstanceNameTableColumnGenerator` which can be used
82+
to create a column which renders the soft reference as a link with the instance name into the table.
83+
84+
Usage:
85+
86+
87+
```
88+
@Subscribe
89+
protected void onInit(InitEvent event) {
90+
myTable.addGeneratedColumn("softReferenceColumnId",
91+
new SoftReferenceInstanceNameTableColumnGenerator(
92+
"softReferenceColumnName",
93+
uiComponents,
94+
metadataTools,
95+
screenBuilders,
96+
this
97+
)
98+
);
99+
}
100+
```
101+
102+
### Soft references as Form fields
103+
104+
With CUBA 7 the form components is the new standard way of rendering forms. In order to render a soft reference into a form,
105+
there is a Spring bean `de.diedavids.cuba.entitysoftreference.web.SoftReferenceFormFieldGenerator` which can be utilized.
106+
107+
Usage (in an editor screen):
108+
109+
```
110+
@Inject
111+
private SoftReferenceFormFieldGenerator softReferenceFormFieldGenerator;
112+
113+
@Subscribe
114+
protected void onInit(InitEvent event) {
115+
softReferenceFormFieldGenerator.initSoftReferenceFormField(form, myFormInstanceContainer, "mySoftReferenceProperty");
116+
}
117+
```
118+

0 commit comments

Comments
 (0)