- Composite columnComposite = new Composite(parent, SWT.NONE);
- columnComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- columnComposite.setLayout(new GridLayout(1, false));
- addFormLabel(columnComposite, label);
- Text txt = addFormTextField(columnComposite, text, null);
+// Composite columnComposite = new Composite(parent, SWT.NONE);
+// columnComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+// columnComposite.setLayout(new GridLayout(1, false));
+ addFormLabel(parent, label);
+ Text txt = addFormTextField(parent, text, null);
+ txt.setEditable(false);
+ txt.setLayoutData(CmsUiUtils.fillWidth());
+ return txt;
+ }
+
+ public static Text addFormColumn(Composite parent, String label, Node node, String property,
+ CmsEditable cmsEditable) {
+// Composite columnComposite = new Composite(parent, SWT.NONE);
+// columnComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+// columnComposite.setLayout(new GridLayout(1, false));
+ addFormLabel(parent, label);
+ String text = Jcr.get(node, property);
+// int style = cmsEditable.isEditing() ? SWT.WRAP : SWT.WRAP;
+ Text txt = addFormTextField(parent, text, null, SWT.WRAP);
+ if (cmsEditable != null && cmsEditable.isEditing()) {
+ txt.addModifyListener((e) -> {
+ Jcr.set(node, property, txt.getText());
+ Jcr.save(node);
+ });
+ } else {
+ txt.setEditable(false);
+ }