Creating Web Parts With Connections Scott Ruble

35
Creating Web Parts with Connections

description

 

Transcript of Creating Web Parts With Connections Scott Ruble

Page 1: Creating Web Parts With Connections   Scott Ruble

Creating Web Parts with Connections

Page 2: Creating Web Parts With Connections   Scott Ruble

Agenda• Previous Technology• Web Part Connections Concept• Connection Framework• Scenarios• Connecting Parts Demo• Supported Interfaces• Interface Details• Compatibility• Cross Page Connections• Connectable Microsoft Web Parts• Code Flow• Code Walk Through Demo/Lab

Page 3: Creating Web Parts With Connections   Scott Ruble

Previous Technology

• Hardwired solutions• Parts need intimate knowledge of each

other– DDSC.RegisterForEvent, DDSC.RaiseEvent – Parameterized Hyperlinks

• Lack of flexibility• Developer-driven

Page 4: Creating Web Parts With Connections   Scott Ruble

Web Part ConnectionsConcept

Page 5: Creating Web Parts With Connections   Scott Ruble

Connections Framework

• Allows Web Parts to send & receive basic types of data; e.g., Cell, Row, List, etc.

• Uses standardized set of interfaces• Allows completely independent parts

to connect• Enables end users to form connections

– Browser– FrontPage

Page 6: Creating Web Parts With Connections   Scott Ruble

Scenarios

• Master/Detail• Parent/Child• Data Entry and Filter• Calculations• Alternate Views• Data Enhancement

Page 7: Creating Web Parts With Connections   Scott Ruble

ScenariosMaster Detail

Page 8: Creating Web Parts With Connections   Scott Ruble

ScenariosParent/Child

Page 9: Creating Web Parts With Connections   Scott Ruble

ScenariosData Entry and Filtering

Page 10: Creating Web Parts With Connections   Scott Ruble

ScenariosCalculations

Page 11: Creating Web Parts With Connections   Scott Ruble

ScenariosAlternate Views

Page 12: Creating Web Parts With Connections   Scott Ruble

ScenariosData Enhancement

Page 13: Creating Web Parts With Connections   Scott Ruble

Connecting Parts

Page 14: Creating Web Parts With Connections   Scott Ruble

Supported Interfaces

• ICellProvider, ICellConsumer • IRowProvider, IRowConsumer • IListProvider, IListConsumer • IFilterProvider, IFilterConsumer

• IParametersOutProvider, IParametersOutConsumer • IParametersInProvider, IParametersInConsumer

Page 15: Creating Web Parts With Connections   Scott Ruble

Interface DetailsCell Scenario

Page 16: Creating Web Parts With Connections   Scott Ruble

Interface DetailsCell Interfaces

ICellProvider– Events

• CellProviderInit()• CellReady()

– Event Handlers• CellConsumerInit()

ICellConsumer– Events

• CellConsumerInit()

– Event Handlers• CellProviderInit()• CellReady()

Page 17: Creating Web Parts With Connections   Scott Ruble

Interface DetailsRow Scenario

Page 18: Creating Web Parts With Connections   Scott Ruble

Interface DetailsRow Interfaces

IRowProvider– Events

• RowProviderInit()• RowReady()

– Event Handlers• None

IRowConsumer– Events

• None

– Event Handlers• RowProviderInit()• RowReady()

Page 19: Creating Web Parts With Connections   Scott Ruble

Interface Details List Scenario

Page 20: Creating Web Parts With Connections   Scott Ruble

Interface Details List Interfaces

IListProvider– Events

• ListProviderInit()• ListReady()• PartialListReady()

– Event Handlers• None

IListConsumer– Events

• None

– Event Handlers• ListProviderInit()• ListReady()• PartialListReady()

Page 21: Creating Web Parts With Connections   Scott Ruble

Interface DetailsFilter Scenario

Page 22: Creating Web Parts With Connections   Scott Ruble

Interface DetailsFilter Interfaces

IFilterProvider– Events

• SetFilter()• ClearFilter()• NoFilter()

– Event Handlers• FilterConsumerInit()

IFilterConsumer– Events

• FilterConsumerInit()

– Event Handlers• SetFilter()• ClearFilter()• NoFilter()

Page 23: Creating Web Parts With Connections   Scott Ruble

Interface DetailsParamsOut Scenario

Page 24: Creating Web Parts With Connections   Scott Ruble

Interface DetailsParamsOut Interfaces

IParmetersOutProvider– Events

• ParametersOutProviderInit()• ParametersOutReady()

– Event Handlers• None

IParametersOutConsumer– Events

• None

– Event Handlers• ParametersOutProviderInit()• ParametersOutReady()

Page 25: Creating Web Parts With Connections   Scott Ruble

Interface DetailsParamsIn Scenario

IParametersOutProvider IParametersInConsumerTransformer

Page 26: Creating Web Parts With Connections   Scott Ruble

Interface DetailsParamsIn Interfaces

IParmetersInProvider– Events

• ParametersInReady()

– Event Handlers• ParametersInConsumerInit()

IParametersInConsumer– Events

• ParametersInConsumerInit()

– Event Handlers• ParametersInReady()

Page 27: Creating Web Parts With Connections   Scott Ruble

Transformers

Transformer Connectable in Browser

Connectable in FrontPage

IRowProvider to ICellConsumer *

Yes Yes

IRowProvider to IFilterConsumer

Yes Yes

IParametersOutProvider to IParametersInConsumer

No Yes

IRowProvider to IParametersInConsumer

No Yes

Transformers allow different interfaces to be connected to one another.

**Not supported for cross page connections.

Page 28: Creating Web Parts With Connections   Scott Ruble

Compatibility

InterfacesInterfaces

Web PartsWeb Parts

Page 29: Creating Web Parts With Connections   Scott Ruble

CompatibilityRules • Reciprocal pairs or transformer exist• MaxConnections not exceeded• RunAt matches• Connect over only one interface• No circular connections

Page 30: Creating Web Parts With Connections   Scott Ruble

Cross Page ConnectionsFeatures

• Allow connecting parts on different pages• Can only be created in FrontPage• Certain interfaces supported

Page 1 (Source)Page 1 (Source) Page 2 (Target)Page 2 (Target)

Page 31: Creating Web Parts With Connections   Scott Ruble

Cross Page ConnectionsSupported Interfaces

Supported cross page connections. In some cases, a transformer is used.

Source Page Interface Target Page InterfaceIRowProvider IFilterConsumer

IRowProvider IParametersInConsumer

IFilterProvider IFilterConsumer

IParametersOutProvider IParametersInConsumer

IParametersInProvider IParametersInConsumer

Page 32: Creating Web Parts With Connections   Scott Ruble

Connectable Microsoft Parts

Web Part RunAt ICe

llPro

vid

er

ICe

llCo

ns

um

er

IRo

wP

rov

ide

rIR

ow

Co

ns

um

er

ILis

tPro

vid

er

ILis

tCo

ns

um

er

IFilt

erP

rov

ide

rIF

ilte

rCo

ns

um

er

IPa

ram

ete

rsO

utP

rov

ide

rIP

ara

me

ters

Ou

tCo

ns

um

er

IPa

ram

ete

rsIn

Pro

vid

er

IPa

ram

ete

rsIn

Co

ns

um

er

Data View Web Part Server x x xImage Web Part Server xForm Web Part Server xSpreadsheet Client x x x x xSales Dashboard - (multiple parts) Client x x x xInventory Dashboard - (multiple parts) Client x xPaystub - (multiple parts) Client x xOffice PivotView Client x x x x x xOffice DataSheet Client x x x x x xOffice PivotChart Client x x x x x xOffice PivotTable Client x x x x x xDatasheet View (ListViewWebPart) Both x x x

Page 33: Creating Web Parts With Connections   Scott Ruble

Code Flow• EnsureInterfaces()

– RegisterInterface()• CanRunAt()• PartCommunicationConnect()• PartCommunicationInit()

– Fire Init Events; e.g., CellProviderInit()• PartCommunicationMain()

– Fire Remaining Events; e.g., CellReady()• GetInitEventArgs()*

*Only needed for interfaces that require transformers.

Page 34: Creating Web Parts With Connections   Scott Ruble

Creating Connectable Creating Connectable PartsPartsCode Walk Through

Page 35: Creating Web Parts With Connections   Scott Ruble

Questions?