+ /*
+ * CONTENT
+ */
+ public static String toLink(Content content) {
+ return content != null ? "#" + CmsSwtUtils.cleanPathForUrl(SwtArgeoApp.nodeToState(content)) : null;
+ }
+
+ public static Text addFormLine(Composite parent, Localized label, Content content, QNamed property,
+ CmsEditable cmsEditable) {
+ return addFormLine(parent, label.lead(), content, property.qName(), cmsEditable);
+ }
+
+ public static Text addFormLine(Composite parent, String label, Content content, QName property,
+ CmsEditable cmsEditable) {
+ Composite lineComposite = SuiteSwtUtils.addLineComposite(parent, 2);
+ SuiteSwtUtils.addFormLabel(lineComposite, label);
+ String text = content.attr(property);
+ Text txt = SuiteSwtUtils.addFormTextField(lineComposite, text, null, SWT.WRAP);
+ if (cmsEditable != null && cmsEditable.isEditing()) {
+ txt.addModifyListener((e) -> {
+ content.put(property, txt.getText());
+ });
+ } else {
+ txt.setEditable(false);
+ }
+ txt.setLayoutData(CmsSwtUtils.fillWidth());
+ return txt;
+ }
+
+ public static Text addFormColumn(Composite parent, Localized label, Content content, QNamed property,
+ CmsEditable cmsEditable) {
+ return addFormColumn(parent, label.lead(), content, property.qName(), cmsEditable);
+ }
+
+ public static Text addFormColumn(Composite parent, String label, Content content, QName property,
+ CmsEditable cmsEditable) {
+ SuiteSwtUtils.addFormLabel(parent, label);
+ String text = content.attr(property);
+ Text txt = SuiteSwtUtils.addFormTextField(parent, text, null, SWT.WRAP);
+ if (cmsEditable != null && cmsEditable.isEditing()) {
+ txt.addModifyListener((e) -> {
+ content.put(property, txt.getText());
+ });
+ } else {
+ txt.setEditable(false);
+ }
+ txt.setLayoutData(CmsSwtUtils.fillWidth());
+ return txt;
+ }
+