Using a simulation for inspecting objects

A simulation provides an environment for developing and testing remote object inspection within a single image by converting the views to their specification in the inspector, like it happens when inspecting a proxy.

The main simulation class is GtRemoteInspectionSimulation Object subclass: #GtRemoteInspectionSimulation uses: TGtRemoteLanguageProxyViewsAttachment + TGtRemoteLanguageProxySpecificViews instanceVariableNames: 'object inspectorProxy' classVariableNames: '' package: 'GToolkit-RemoteGt-Development' . Another version is GtRemotePlainInspectionSimulation GtRemoteInspectionSimulation subclass: #GtRemotePlainInspectionSimulation instanceVariableNames: '' classVariableNames: '' package: 'GToolkit-RemoteGt-Development' that should be used to simulate creating views using the API provided by GtRemotePhlowProtoView Object subclass: #GtRemotePhlowProtoView instanceVariableNames: '' classVariableNames: '' package: 'GToolkit-RemotePhlow-PhlowViews' . This API is used from GemStone and plain Pharo.

From the perspective of the inspector a simulation acts as a proxy to a remote object with inspection support. This is the same support for inspection provided by GtRsrProxyServiceClient GtRsrProxyService subclass: #GtRsrProxyServiceClient uses: TGtRemoteLanguageProxyViewsAttachment + TGtRemoteLanguageProxySpecificViews instanceVariableNames: 'gtSession' classVariableNames: 'ObjectMap' package: 'GToolkit-GemStone-Pharo-Client' or LanguageLinkProxyObject Object subclass: #LanguageLinkProxyObject uses: TGtPharoLinkPlayground instanceVariableNames: 'application remoteClass name' classVariableNames: '' package: 'PharoLink-Core' .

Internally the simulation uses a proxy to an inspector wrapper (GtRemotePhlowViewedObject Object subclass: #GtRemotePhlowViewedObject instanceVariableNames: 'object declarativeViewsBySelector' classVariableNames: '' package: 'GToolkit-RemotePhlow-InspectorCore' when the remote side is Glamorous Toolkit, GemStone or Pharo) and attaches views to the inspector in the same way that provy objects do.

simulation := GtRemoteInspectionSimulation 
	openOn: GtRemotePhlowDeclarativeTestInspectable new.
simulation := GtRemotePlainInspectionSimulation 
	openOn: GtRemotePhlowDeclarativeTestInspectable new.

As in the case of a proxy object we can ask the simulation for the view specifications of the object.

simulation declarativeViews 

We can also just get the raw data from for the view specifications.

simulation getViewsDeclarations

We can the use the simulation to create a view specification and link it with the remote view.

First we get the data of the view specification.

viewSpecificationData := simulation getViewDeclaration: #gtListFor:

Then from the data we instantiate and initialize a local view specification object.

viewSpecification := GtPhlowViewSpecification 
	fromDictionary: viewSpecificationData.
	methodSelector: #gtListFor:;
	initializeFromInspector: simulation.

We can then use this view specification to retrieve the items in the list view.

	retrieveItems: 2 
	fromIndex: 2