List Views in Remote Phlow

This page looks at List views in Remote Phlow.

The data for creating a list view is modeled using GtPhlowListViewSpecification GtPhlowListingViewSpecification subclass: #GtPhlowListViewSpecification instanceVariableNames: '' classVariableNames: '' package: 'GToolkit-RemotePhlow-DeclarativeViews' . The specification is initialized with a phlow data source responsible with accessing items in the list.

Example

We use the bytecode view of a compiled method as an example.

targetObject := Object >>#copy
  

Create an inspector wrapper for the object.

inspectorWrapper := GtRemotePhlowViewedObject object: targetObject
  

Inspect the declarative views of this object.

inspectorWrapper getDeclarativeViewMethodNames
  

We can inspect the wrapper object to see what has been initialized.

inspectorWrapper
  

Directly accesing the view specification

We can get the view specification object for the bytecode view directly from the inspector wrapper. This will be an instance of GtPhlowListViewSpecification GtPhlowListingViewSpecification subclass: #GtPhlowListViewSpecification instanceVariableNames: '' classVariableNames: '' package: 'GToolkit-RemotePhlow-DeclarativeViews' , or a proxy in case the inspector wrapper is itself a proxy.

viewSpecification := inspectorWrapper 
	getDeclarativeViewFor: #gtBytecodeFor:
  

Here we get the content of the view directly from the view specification.

viewSpecification 
	retrieveItems: 2 
	fromIndex: 2
  

As an example we can also get all the items or the number of items

viewSpecification retriveFormattedItems
  
viewSpecification totalItemsCount
  

Constructing the view specification locally

What the inspector does when needing to show a list view is to ask the data of the specification from the inspector wrapper, create a new instance of the specification locally, and link it with the remote instance of the view specification.

First we get the data

viewSpecificationData := inspectorWrapper getViewDeclaration: #gtBytecodeFor:
  

And then we instantiate and configure the view specification.

localViewSpecification := GtPhlowViewSpecification 
	fromDictionary: viewSpecificationData.
localViewSpecification
	methodSelector: #gtBytecodeFor:;
	initializeFromInspector: inspectorWrapper.
  

We can not use the same methods as before to access the list items.

In this case we make the call to the local view specification, that delegates the call to the remove instance of the view specification, that knows how to get the items from the remove view.

localViewSpecification 
	retrieveItems: 2 
	fromIndex: 2
  
localViewSpecification retriveFormattedItems
  
localViewSpecification totalItemsCount
  

Using a simulation

We can also simulate how this object is inspected remotely.

GtRemoteInspectionSimulation openOn: targetObject