Commit cdf9e894 authored by Kai-Holger Brassel's avatar Kai-Holger Brassel
Browse files

Generic master detail UI

parent 25674a38
......@@ -58,3 +58,15 @@ _UI_LifeCycle_disposalDescription_feature = Disposal Description
_UI_WindowType__feature =
_UI_LifeCycle__feature =
_UI_LifeCycle_type_feature = Type
_UI_WindowType_embodiedEnergy_feature = Embodied Energy
_UI_WindowType_embodiedCarbon_feature = Embodied Carbon
_UI_WindowType_constructionDescription_feature = Construction Description
_UI_WindowType_disposalEnergy_feature = Disposal Energy
_UI_WindowType_disposalCarbon_feature = Disposal Carbon
_UI_WindowType_disposalDescription_feature = Disposal Description
_UI_Material_embodiedEnergy_feature = Embodied Energy
_UI_Material_embodiedCarbon_feature = Embodied Carbon
_UI_Material_constructionDescription_feature = Construction Description
_UI_Material_disposalEnergy_feature = Disposal Energy
_UI_Material_disposalCarbon_feature = Disposal Carbon
_UI_Material_disposalDescription_feature = Disposal Description
......@@ -3,6 +3,7 @@
package de.hftstuttgart.buildingphysics.provider;
import de.hftstuttgart.cityunits.model.quantities.provider.QuantitiesEditPlugin;
import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.util.ResourceLocator;
......
......@@ -210,29 +210,6 @@ public class BuildingPhysicsItemProviderAdapterFactory extends BuildingPhysicsAd
return materialItemProvider;
}
/**
* This keeps track of the one adapter used for all {@link de.hftstuttgart.buildingphysics.LifeCycle} instances.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected LifeCycleItemProvider lifeCycleItemProvider;
/**
* This creates an adapter for a {@link de.hftstuttgart.buildingphysics.LifeCycle}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Adapter createLifeCycleAdapter() {
if (lifeCycleItemProvider == null) {
lifeCycleItemProvider = new LifeCycleItemProvider(this);
}
return lifeCycleItemProvider;
}
/**
* This returns the root adapter factory that contains this factory.
* <!-- begin-user-doc -->
......@@ -350,8 +327,6 @@ public class BuildingPhysicsItemProviderAdapterFactory extends BuildingPhysicsAd
materialCategoryItemProvider.dispose();
if (materialItemProvider != null)
materialItemProvider.dispose();
if (lifeCycleItemProvider != null)
lifeCycleItemProvider.dispose();
}
}
/**
*/
package de.hftstuttgart.buildingphysics.provider;
import de.hftstuttgart.buildingphysics.BuildingPhysicsPackage;
import de.hftstuttgart.buildingphysics.LifeCycle;
import de.hftstuttgart.cityunits.model.NullableQuantity;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemProviderAdapter;
import org.eclipse.emf.edit.provider.ViewerNotification;
/**
* This is the item provider adapter for a {@link de.hftstuttgart.buildingphysics.LifeCycle} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class LifeCycleItemProvider extends ItemProviderAdapter implements IEditingDomainItemProvider,
IStructuredItemContentProvider, ITreeItemContentProvider, IItemLabelProvider, IItemPropertySource {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LifeCycleItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
addEmbodiedEnergyPropertyDescriptor(object);
addEmbodiedCarbonPropertyDescriptor(object);
addConstructionDescriptionPropertyDescriptor(object);
addDisposalEnergyPropertyDescriptor(object);
addDisposalCarbonPropertyDescriptor(object);
addDisposalDescriptionPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
* This adds a property descriptor for the Embodied Energy feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addEmbodiedEnergyPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(), getString("_UI_LifeCycle_embodiedEnergy_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_LifeCycle_embodiedEnergy_feature",
"_UI_LifeCycle_type"),
BuildingPhysicsPackage.Literals.LIFE_CYCLE__EMBODIED_ENERGY, true, false, false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}
/**
* This adds a property descriptor for the Embodied Carbon feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addEmbodiedCarbonPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(), getString("_UI_LifeCycle_embodiedCarbon_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_LifeCycle_embodiedCarbon_feature",
"_UI_LifeCycle_type"),
BuildingPhysicsPackage.Literals.LIFE_CYCLE__EMBODIED_CARBON, true, false, false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}
/**
* This adds a property descriptor for the Construction Description feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addConstructionDescriptionPropertyDescriptor(Object object) {
itemPropertyDescriptors.add(createItemPropertyDescriptor(
((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(),
getString("_UI_LifeCycle_constructionDescription_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_LifeCycle_constructionDescription_feature",
"_UI_LifeCycle_type"),
BuildingPhysicsPackage.Literals.LIFE_CYCLE__CONSTRUCTION_DESCRIPTION, true, true, false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}
/**
* This adds a property descriptor for the Disposal Energy feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addDisposalEnergyPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(), getString("_UI_LifeCycle_disposalEnergy_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_LifeCycle_disposalEnergy_feature",
"_UI_LifeCycle_type"),
BuildingPhysicsPackage.Literals.LIFE_CYCLE__DISPOSAL_ENERGY, true, false, false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}
/**
* This adds a property descriptor for the Disposal Carbon feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addDisposalCarbonPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(), getString("_UI_LifeCycle_disposalCarbon_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_LifeCycle_disposalCarbon_feature",
"_UI_LifeCycle_type"),
BuildingPhysicsPackage.Literals.LIFE_CYCLE__DISPOSAL_CARBON, true, false, false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}
/**
* This adds a property descriptor for the Disposal Description feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addDisposalDescriptionPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(), getString("_UI_LifeCycle_disposalDescription_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_LifeCycle_disposalDescription_feature",
"_UI_LifeCycle_type"),
BuildingPhysicsPackage.Literals.LIFE_CYCLE__DISPOSAL_DESCRIPTION, true, true, false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}
/**
* This returns LifeCycle.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/LifeCycle"));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected boolean shouldComposeCreationImage() {
return true;
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
NullableQuantity labelValue = ((LifeCycle) object).getEmbodiedEnergy();
String label = labelValue == null ? null : labelValue.toString();
return label == null || label.length() == 0 ? getString("_UI_LifeCycle_type")
: getString("_UI_LifeCycle_type") + " " + label;
}
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(LifeCycle.class)) {
case BuildingPhysicsPackage.LIFE_CYCLE__EMBODIED_ENERGY:
case BuildingPhysicsPackage.LIFE_CYCLE__EMBODIED_CARBON:
case BuildingPhysicsPackage.LIFE_CYCLE__CONSTRUCTION_DESCRIPTION:
case BuildingPhysicsPackage.LIFE_CYCLE__DISPOSAL_ENERGY:
case BuildingPhysicsPackage.LIFE_CYCLE__DISPOSAL_CARBON:
case BuildingPhysicsPackage.LIFE_CYCLE__DISPOSAL_DESCRIPTION:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
}
super.notifyChanged(notification);
}
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
}
/**
* Return the resource locator for this item provider's resources.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ResourceLocator getResourceLocator() {
return BuildingPhysicsEditPlugin.INSTANCE;
}
}
......@@ -58,6 +58,12 @@ public class MaterialItemProvider extends ItemProviderAdapter implements IEditin
addDensityPropertyDescriptor(object);
addHeatCapacityPropertyDescriptor(object);
addConductivityPropertyDescriptor(object);
addEmbodiedEnergyPropertyDescriptor(object);
addEmbodiedCarbonPropertyDescriptor(object);
addConstructionDescriptionPropertyDescriptor(object);
addDisposalEnergyPropertyDescriptor(object);
addDisposalCarbonPropertyDescriptor(object);
addDisposalDescriptionPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
......@@ -141,6 +147,102 @@ public class MaterialItemProvider extends ItemProviderAdapter implements IEditin
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}
/**
* This adds a property descriptor for the Embodied Energy feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addEmbodiedEnergyPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(), getString("_UI_Material_embodiedEnergy_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Material_embodiedEnergy_feature",
"_UI_Material_type"),
BuildingPhysicsPackage.Literals.MATERIAL__EMBODIED_ENERGY, true, false, false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}
/**
* This adds a property descriptor for the Embodied Carbon feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addEmbodiedCarbonPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(), getString("_UI_Material_embodiedCarbon_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Material_embodiedCarbon_feature",
"_UI_Material_type"),
BuildingPhysicsPackage.Literals.MATERIAL__EMBODIED_CARBON, true, false, false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}
/**
* This adds a property descriptor for the Construction Description feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addConstructionDescriptionPropertyDescriptor(Object object) {
itemPropertyDescriptors.add(createItemPropertyDescriptor(
((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(),
getString("_UI_Material_constructionDescription_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Material_constructionDescription_feature",
"_UI_Material_type"),
BuildingPhysicsPackage.Literals.MATERIAL__CONSTRUCTION_DESCRIPTION, true, false, false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}
/**
* This adds a property descriptor for the Disposal Energy feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addDisposalEnergyPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(), getString("_UI_Material_disposalEnergy_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Material_disposalEnergy_feature",
"_UI_Material_type"),
BuildingPhysicsPackage.Literals.MATERIAL__DISPOSAL_ENERGY, true, false, false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}
/**
* This adds a property descriptor for the Disposal Carbon feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addDisposalCarbonPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(), getString("_UI_Material_disposalCarbon_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Material_disposalCarbon_feature",
"_UI_Material_type"),
BuildingPhysicsPackage.Literals.MATERIAL__DISPOSAL_CARBON, true, false, false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}
/**
* This adds a property descriptor for the Disposal Description feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addDisposalDescriptionPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(), getString("_UI_Material_disposalDescription_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Material_disposalDescription_feature",
"_UI_Material_type"),
BuildingPhysicsPackage.Literals.MATERIAL__DISPOSAL_DESCRIPTION, true, false, false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}
/**
* This returns Material.gif.
* <!-- begin-user-doc -->
......@@ -192,6 +294,12 @@ public class MaterialItemProvider extends ItemProviderAdapter implements IEditin
case BuildingPhysicsPackage.MATERIAL__DENSITY:
case BuildingPhysicsPackage.MATERIAL__HEAT_CAPACITY:
case BuildingPhysicsPackage.MATERIAL__CONDUCTIVITY:
case BuildingPhysicsPackage.MATERIAL__EMBODIED_ENERGY:
case BuildingPhysicsPackage.MATERIAL__EMBODIED_CARBON:
case BuildingPhysicsPackage.MATERIAL__CONSTRUCTION_DESCRIPTION:
case BuildingPhysicsPackage.MATERIAL__DISPOSAL_ENERGY:
case BuildingPhysicsPackage.MATERIAL__DISPOSAL_CARBON:
case BuildingPhysicsPackage.MATERIAL__DISPOSAL_DESCRIPTION:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
}
......
......@@ -2,7 +2,6 @@
*/
package de.hftstuttgart.buildingphysics.provider;
import de.hftstuttgart.buildingphysics.BuildingPhysicsFactory;
import de.hftstuttgart.buildingphysics.BuildingPhysicsPackage;
import de.hftstuttgart.buildingphysics.WindowType;
......@@ -14,7 +13,6 @@ import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
......@@ -61,6 +59,12 @@ public class WindowTypeItemProvider extends ItemProviderAdapter implements IEdit
addGValuePropertyDescriptor(object);
addGlazingNumberPropertyDescriptor(object);
addFrameRatioPropertyDescriptor(object);
addEmbodiedEnergyPropertyDescriptor(object);
addEmbodiedCarbonPropertyDescriptor(object);
addConstructionDescriptionPropertyDescriptor(object);
addDisposalEnergyPropertyDescriptor(object);
addDisposalCarbonPropertyDescriptor(object);
addDisposalDescriptionPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
......@@ -162,33 +166,99 @@ public class WindowTypeItemProvider extends ItemProviderAdapter implements IEdit
}
/**
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
* This adds a property descriptor for the Embodied Energy feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) {
if (childrenFeatures == null) {
super.getChildrenFeatures(object);
childrenFeatures.add(BuildingPhysicsPackage.Literals.WINDOW_TYPE__LIFE_CYCLE);
}
return childrenFeatures;
protected void addEmbodiedEnergyPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(), getString("_UI_WindowType_embodiedEnergy_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_WindowType_embodiedEnergy_feature",
"_UI_WindowType_type"),
BuildingPhysicsPackage.Literals.WINDOW_TYPE__EMBODIED_ENERGY, true, false, false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}
/**
* This adds a property descriptor for the Embodied Carbon feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EStructuralFeature getChildFeature(Object object, Object child) {
// Check the type of the specified child object and return the proper feature to use for
// adding (see {@link AddCommand}) it as a child.
protected void addEmbodiedCarbonPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(), getString("_UI_WindowType_embodiedCarbon_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_WindowType_embodiedCarbon_feature",
"_UI_WindowType_type"),
BuildingPhysicsPackage.Literals.WINDOW_TYPE__EMBODIED_CARBON, true, false, false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}
/**
* This adds a property descriptor for the Construction Description feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addConstructionDescriptionPropertyDescriptor(Object object) {
itemPropertyDescriptors.add(createItemPropertyDescriptor(
((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(),
getString("_UI_WindowType_constructionDescription_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_WindowType_constructionDescription_feature",
"_UI_WindowType_type"),
BuildingPhysicsPackage.Literals.WINDOW_TYPE__CONSTRUCTION_DESCRIPTION, true, false, false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null));
}
/**
* This adds a property descriptor for the Disposal Energy feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addDisposalEnergyPropertyDescriptor(Object object) {
itemPropertyDescriptors
.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(),
getResourceLocator(), getString("_UI_WindowType_disposalEnergy_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_WindowType_disposalEnergy_feature",
"_UI_WindowType_type"),
BuildingPhysicsPackage.Literals.WINDOW_TYPE__DISPOSAL_ENERGY, true, false, false,