Skip to content

Commit

Permalink
Property UI for overwrite and calculated values
Browse files Browse the repository at this point in the history
  • Loading branch information
franzTobiasDLR committed Aug 24, 2023
1 parent 69416b0 commit d4486af
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,14 @@ public String getColumnText(Object object, int columnIndex) {
CategoryAssignment ca = getCategoryAssignment(object);
redirectNotification(ca, object);

if (ca.getSuperTis().isEmpty()) {
colOverrie.getColumn().setWidth(0);
if (ca == null || ca.getType() == null) {
return null;
}

if (ca.getType().getFullQualifiedName().equals(Parameter.FULL_QUALIFIED_CATEGORY_NAME)) {
if (ca.getSuperTis().isEmpty()) {
colOverrie.getColumn().setWidth(0);
}
Parameter parameterBean = new Parameter(ca);
redirectNotification(parameterBean.getDefaultValueBean().getTypeInstance(), ca);
if (column == colOne.getColumn()) {
Expand All @@ -104,6 +107,9 @@ public String getColumnText(Object object, int columnIndex) {
} else if (column == colOverrie.getColumn()) {
column.setWidth(UiSnippetCefTreeTableImpl.OVERRIDE_COLUMN_SIZE);
Boolean overwrite = parameterBean.getDefaultValueBean().getTypeInstance().isOverride();
if (parameterBean.getDefaultValueBean().getIsCalculated()) {
return "<<calculated>>";
}
return overwrite.toString();
}
} else if (ca.getType().getFullQualifiedName().equals(Value.FULL_QUALIFIED_CATEGORY_NAME)) {
Expand Down Expand Up @@ -197,13 +203,17 @@ private Image getColumnImageForParameter(CategoryAssignment ca, int columnIndex)
if (problemImage != null) {
return problemImage;
} else {
PropertyInstanceHelper piHelper = new PropertyInstanceHelper();
return piHelper.isCalculated(ca) ? imageCalculated : super.getColumnImage(ca, columnIndex);
return super.getColumnImage(ca, columnIndex);
}
} else if (columnIndex == 1) {
APropertyInstance propertyInstance = ca.getPropertyInstances().get(0);
PropertyInstanceHelper piHelper = new PropertyInstanceHelper();
Image problemImage = mip.getProblemImageForEObject(propertyInstance);
return (problemImage != null) ? problemImage : null;
if (problemImage != null) {
return problemImage;
} else if (piHelper.isCalculated(ca)) {
return imageCalculated;
}
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ public class UiSnippetCefTreeTableImpl extends UiSnippetGenericTreeTableImpl {
protected TreeViewerColumn colValue;
protected TreeViewerColumn colOverride;
protected AUiSnippetGenericTable thisTable;
public static final int OVERRIDE_COLUMN_SIZE = 100;
public static final int OVERRIDE_COLUMN_SIZE = 140;
public static final int NAME_COLUMN_SIZE = 300;
public static final String NAME_OVERRIDE = "Override";
public static final String DESCRIPTION_OVERRIDE = "Specifies if the property is inherited from the prodcut tree or overritten here";

/**
* Constructor of the CEF Tree Table Implementation
Expand All @@ -77,8 +79,25 @@ protected boolean canEdit(Object element) {
return false;
}
});

colValue = (TreeViewerColumn) createDefaultColumn("Value");
MultiPropertyEditingSupport editingSupportValue = new MultiPropertyEditingSupport(columnViewer);

AProperty defaultValueProperty = acHelper.getProperty(Activator.PLUGIN_ID, Parameter.class.getSimpleName(), Parameter.PROPERTY_DEFAULTVALUE); //Parameter.class.getSimpleName() = non fully qualified name, e.g. "Parameter"
editingSupportValue.registerEditingSupport(new ValuePropertyCellEditingSupport(editingDomain, columnViewer, defaultValueProperty));

AProperty valueProperty = acHelper.getProperty(Activator.PLUGIN_ID, Value.class.getSimpleName(), Value.PROPERTY_VALUE);
editingSupportValue.registerEditingSupport(new ValuePropertyCellEditingSupport(editingDomain, columnViewer, valueProperty));
colValue.setEditingSupport(editingSupportValue);

colUnit = (TreeViewerColumn) createDefaultColumn("Unit");
MultiPropertyEditingSupport editingSupportUnit = new MultiPropertyEditingSupport(columnViewer);
editingSupportUnit.registerEditingSupport(new QudvUnitCellEditingSupport(editingDomain, columnViewer, defaultValueProperty));
editingSupportUnit.registerEditingSupport(new QudvUnitCellEditingSupport(editingDomain, columnViewer, valueProperty));
colUnit.setEditingSupport(editingSupportUnit);

colOverride = (TreeViewerColumn) createDefaultColumn("Override");
colOverride.getColumn().setToolTipText(DESCRIPTION_OVERRIDE);
colOverride.getColumn().setWidth(0);
colOverride.setEditingSupport(new EBooleanCellEditingSupport(editingDomain, columnViewer, InheritancePackage.Literals.IOVERRIDABLE_INHERITANCE_LINK__OVERRIDE) {
@Override
Expand Down Expand Up @@ -111,22 +130,6 @@ protected boolean canEdit(Object element) {
return false;
}
});

colValue = (TreeViewerColumn) createDefaultColumn("Value");
MultiPropertyEditingSupport editingSupportValue = new MultiPropertyEditingSupport(columnViewer);

AProperty defaultValueProperty = acHelper.getProperty(Activator.PLUGIN_ID, Parameter.class.getSimpleName(), Parameter.PROPERTY_DEFAULTVALUE); //Parameter.class.getSimpleName() = non fully qualified name, e.g. "Parameter"
editingSupportValue.registerEditingSupport(new ValuePropertyCellEditingSupport(editingDomain, columnViewer, defaultValueProperty));

AProperty valueProperty = acHelper.getProperty(Activator.PLUGIN_ID, Value.class.getSimpleName(), Value.PROPERTY_VALUE);
editingSupportValue.registerEditingSupport(new ValuePropertyCellEditingSupport(editingDomain, columnViewer, valueProperty));
colValue.setEditingSupport(editingSupportValue);

colUnit = (TreeViewerColumn) createDefaultColumn("Unit");
MultiPropertyEditingSupport editingSupportUnit = new MultiPropertyEditingSupport(columnViewer);
editingSupportUnit.registerEditingSupport(new QudvUnitCellEditingSupport(editingDomain, columnViewer, defaultValueProperty));
editingSupportUnit.registerEditingSupport(new QudvUnitCellEditingSupport(editingDomain, columnViewer, valueProperty));
colUnit.setEditingSupport(editingSupportUnit);
}

@Override
Expand Down

0 comments on commit d4486af

Please sign in to comment.