import oic.simulator.serviceprovider.listener.IResourceModelChangedUIListener;
import oic.simulator.serviceprovider.listener.IResourceSelectionChangedUIListener;
import oic.simulator.serviceprovider.manager.ResourceManager;
-import oic.simulator.serviceprovider.resource.ModelChangeNotificationType;
import oic.simulator.serviceprovider.resource.LocalResourceAttribute;
+import oic.simulator.serviceprovider.resource.ModelChangeNotificationType;
import oic.simulator.serviceprovider.resource.SimulatorResource;
import oic.simulator.serviceprovider.utils.Constants;
private ResourceManager resourceManager;
- private static final Image CHECKED = Activator
- .getDefault()
- .getImage(
- "icons/checked.gif");
-
- private static final Image UNCHECKED = Activator
- .getDefault()
- .getImage(
- "icons/unchecked.gif");
-
public AttributeView() {
resourceManager = Activator.getDefault().getResourceManager();
@Override
public void run() {
if (null != attTblViewer) {
- updateViewer(checkSelection());
+ updateViewer(getData());
SimulatorResource resource = resourceManager
.getCurrentResourceInSelection();
Table tbl = attTblViewer.getTable();
public void onResourceModelChange(
final ModelChangeNotificationType notificationType,
final String resourceURI,
- final Set<LocalResourceAttribute> changeSet) {
+ final Set<LocalResourceAttribute> valueChangeSet) {
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
return;
}
if (!resourceURI.equals(resource.getResourceURI())) {
+ // This notification is for a different resource
+ // whose attributes are not
+ // currently not being shown in UI. So ignoring this
+ // notification.
return;
}
// Refresh the table viewers which will display
if (null != attTblViewer) {
if (notificationType == ModelChangeNotificationType.ATTRIBUTE_ADDED
|| notificationType == ModelChangeNotificationType.ATTRIBUTE_REMOVED) {
- attTblViewer.refresh();
+ updateViewer(getData());
+ } else if (notificationType == ModelChangeNotificationType.NO_ATTRIBUTES_IN_MODEL) {
+ attTblViewer.setInput(null);
} else if (notificationType == ModelChangeNotificationType.ATTRIBUTE_VALUE_CHANGED) {
- if (null != changeSet) {
- attTblViewer.update(changeSet.toArray(),
- null);
+ if (null != valueChangeSet) {
+ attTblViewer.update(
+ valueChangeSet.toArray(), null);
}
}
}
@Override
public void run() {
- System.out.println("onAutomationcomplete Impl: uri:"
- + resourceURI + ",attname:" + attName);
if (null == resourceURI) {
return;
}
LocalResourceAttribute att = resourceManager
.getAttributeByResourceURI(resourceURI,
attName);
- System.out.println(att == null);
if (null == att) {
return;
} else {
addManagerListeners();
// Check whether there is any resource selected already
- List<LocalResourceAttribute> propertyList = checkSelection();
+ List<LocalResourceAttribute> propertyList = getData();
if (null != propertyList) {
updateViewer(propertyList);
}
public Image getImage(Object element) {
LocalResourceAttribute att = (LocalResourceAttribute) element;
if (att.isAutomationInProgress()) {
- return CHECKED;
+ return Activator.getDefault().getImageRegistry()
+ .get(Constants.CHECKED);
} else {
- return UNCHECKED;
+ return Activator.getDefault().getImageRegistry()
+ .get(Constants.UNCHECKED);
}
}
});
resourceManager.addAutomationUIListener(automationUIListener);
}
- private List<LocalResourceAttribute> checkSelection() {
+ private List<LocalResourceAttribute> getData() {
SimulatorResource resourceInSelection = resourceManager
.getCurrentResourceInSelection();
if (null != resourceInSelection) {