protected final TermsManager termsManager;
protected final Typology typology;
- protected final boolean editable;
+ private final boolean editable;
private CmsIcon deleteIcon;
private CmsIcon addIcon;
private Composite highlight;
protected final CmsTheme theme;
-
+
public AbstractTermsPart(Composite parent, int style, Item item, TermsManager termsManager, String typology) {
super(parent, style, item);
if (item == null)
highlightColor = parent.getDisplay().getSystemColor(SWT.COLOR_GRAY);
}
+ public boolean isEditable() {
+ return editable;
+ }
+
protected void createHighlight(Composite block) {
highlight = new Composite(block, SWT.NONE);
highlight.setBackground(highlightColor);
String display = getTermLabel(value);
lbl.setText(display);
CmsUiUtils.style(lbl, style == null ? FormStyle.propertyText.style() : style);
- if (editable)
+ if (isEditable())
lbl.addMouseListener((MouseDoubleClick) (e) -> {
startEditing();
});
}
}
else {// empty
- if (editable && !isEditing()) {
+ if (isEditable() && !isEditing()) {
ToolBar toolBar = new ToolBar(placeholder, SWT.HORIZONTAL);
ToolItem addItem = new ToolItem(toolBar, SWT.FLAT);
styleAdd(addItem);
String display = getTermLabel(currentValue);
lbl.setText(display);
CmsUiUtils.style(lbl, style == null ? FormStyle.propertyText.style() : style);
-
- lbl.addMouseListener((MouseDoubleClick) (e) -> {
- startEditing();
- });
+ if (isEditable()) {
+ lbl.addMouseListener((MouseDoubleClick) (e) -> {
+ startEditing();
+ });
+ }
} else {
- ToolBar toolBar = new ToolBar(block, SWT.HORIZONTAL);
- ToolItem addItem = new ToolItem(toolBar, SWT.FLAT);
- styleAdd(addItem);
- addItem.addSelectionListener((Selected) (e) -> {
- startEditing();
- });
+ if (isEditable()) {
+ ToolBar toolBar = new ToolBar(block, SWT.HORIZONTAL);
+ ToolItem addItem = new ToolItem(toolBar, SWT.FLAT);
+ styleAdd(addItem);
+ addItem.addSelectionListener((Selected) (e) -> {
+ startEditing();
+ });
+ }
}
return block;
}