X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=core%2Forg.argeo.entity.ui%2Fsrc%2Forg%2Fargeo%2Fentity%2Fui%2Fforms%2FMultiTermsPart.java;h=395e7ef8a87375cd7dc12093b4aa56949cb5f8f8;hb=e1b66c8ac6ce9fae8ffc894d809a44a6b184b788;hp=436cc17b89457e9e99c62ccfd65fca6249873953;hpb=b933bfdb833cdde38bd5d9797ff43a7ee7068dcf;p=gpl%2Fargeo-suite.git diff --git a/core/org.argeo.entity.ui/src/org/argeo/entity/ui/forms/MultiTermsPart.java b/core/org.argeo.entity.ui/src/org/argeo/entity/ui/forms/MultiTermsPart.java index 436cc17..395e7ef 100644 --- a/core/org.argeo.entity.ui/src/org/argeo/entity/ui/forms/MultiTermsPart.java +++ b/core/org.argeo.entity.ui/src/org/argeo/entity/ui/forms/MultiTermsPart.java @@ -20,7 +20,9 @@ import org.argeo.jcr.Jcr; import org.eclipse.swt.SWT; import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.FocusListener; +import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.layout.RowData; import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -41,11 +43,14 @@ public class MultiTermsPart extends AbstractTermsPart { @Override protected Control createControl(Composite box, String style) { Composite placeholder = new Composite(box, SWT.NONE); - RowLayout rl = new RowLayout(SWT.HORIZONTAL); - rl.wrap = true; + + boolean vertical = SWT.VERTICAL == (getStyle() & SWT.VERTICAL); + RowLayout rl = new RowLayout(vertical ? SWT.VERTICAL : SWT.HORIZONTAL); +// rl.wrap = true; +// rl.justify = true; placeholder.setLayout(rl); List currentValue = getValue(); - if (currentValue != null && !currentValue.isEmpty()) + if (currentValue != null && !currentValue.isEmpty()) { for (Term value : currentValue) { Composite block = new Composite(placeholder, SWT.NONE); block.setLayout(CmsUiUtils.noSpaceGridLayout(3)); @@ -53,7 +58,8 @@ public class MultiTermsPart extends AbstractTermsPart { String display = getTermLabel(value); lbl.setText(display); CmsUiUtils.style(lbl, style == null ? FormStyle.propertyText.style() : style); - if (editable) + processTermListLabel(value, lbl); + if (isEditable()) lbl.addMouseListener((MouseDoubleClick) (e) -> { startEditing(); }); @@ -76,8 +82,8 @@ public class MultiTermsPart extends AbstractTermsPart { } } - else {// empty - if (editable && !isEditing()) { + } else {// empty + if (isEditable() && !isEditing()) { ToolBar toolBar = new ToolBar(placeholder, SWT.HORIZONTAL); ToolItem addItem = new ToolItem(toolBar, SWT.FLAT); styleAdd(addItem); @@ -181,7 +187,7 @@ public class MultiTermsPart extends AbstractTermsPart { terms: for (String str : curr) { Term term = termsManager.getTerm(str); if (term == null) { - log.warn("Ignoring term " + str + " as it was not found."); + log.warn("Ignoring term " + str + " for " + getNode() + ", as it was not found."); continue terms; } res.add(term);