Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MNU when using component list as input port in custom presenter #1463

Merged
merged 1 commit into from
Oct 16, 2023

Conversation

hernanmd
Copy link
Member

This PR handles a case with transmissions along a component list in custom presenters. There is an issue in transmitTo:transform: method when connecting a transmission between presenters where the target presenter has defined an input port as a SpListItemPort with a component list .

defaultInputPort 

	^ SpListItemsPort newPresenter: componentListPresenter

The PR includes a case with a test to reproduce the problem:

SpComplexComponentListExample open.

To fix it, the PR specializes transmitTo:transform: to handle problem with connecting presenters with component list.

Specialize transmitTo:transform: to handle problem with connecting presenters with component list.
@Ducasse Ducasse merged commit 4cfda80 into pharo-spec:Pharo12 Oct 16, 2023
2 checks passed
@estebanlm
Copy link
Member

sorry but this fix is wrong.

@estebanlm
Copy link
Member

estebanlm commented Oct 17, 2023

transmissions do not work between presenters but between ports OutputPortA connects to InputPortB
the method transmitTo: (and family) present in SpPresenter are convenience methods to connect the default output port of a presenter with the default input port of another presenter, in that sense, doing:

aPresenter transmitTo: otherPresenter

is the same as doing:

aPresenter defaultOutputPort transmitTo: otherPresenter defaultInputPort

but you cannot take a port and connect it to a presenter.

EDIT: basically, you cannot use a presenter as input port.

@estebanlm
Copy link
Member

I made a revert:

#1464

@hernanmd
Copy link
Member Author

transmissions do not work between presenters but between ports OutputPortA connects to InputPortB the method transmitTo: (and family) present in SpPresenter are convenience methods to connect the default output port of a presenter with the default input port of another presenter, in that sense, doing:

aPresenter transmitTo: otherPresenter

is the same as doing:

aPresenter defaultOutputPort transmitTo: otherPresenter defaultInputPort

but you cannot take a port and connect it to a presenter.

EDIT: basically, you cannot use a presenter as input port.

The documentation isn't exactly clear about what's the difference between "using as" and "connecting".

The documentation mentions that "a transmission connects a presenter's output port with a presenter's input port," whereas you wrote, "transmissions do not work between presenters but between ports." This is contradictory because the documentation implies that the transmission connects presenters indirectly through their ports, whereas you suggest that the transmission works only between ports, not presenters.

Additionally you've mentioned "you cannot take a port and connect it to a presenter," which contradicts the information in the documentation, where it is shown that a port can be connected to a presenter's default input port, as in the example "list defaultOutputPort transmitTo: detail defaultInputPort".

I provided an connectPresenters use case where following the documentation does not work.
What do you suggest to modify in order to run it without errors?

@estebanlm
Copy link
Member

this part or your case:

defaultOutputPort 

    ^ self categoryListPresenter

is wrong. You cannot answer a presenter as a port.

@demarey
Copy link
Collaborator

demarey commented Oct 17, 2023

There is a draft chapter on transmissions Using transmissions and ports in the Spec2 book: https://github.com/SquareBracketAssociates/BuildingApplicationWithSpec2/releases/download/latest/Spec2-wip.pdf

You can simply define #defaultOutputPort as follows:

defaultOutputPort 

    ^ self categoryListPresenter defaultOutputPort

@hernanmd
Copy link
Member Author

There is a draft chapter on transmissions Using transmissions and ports in the Spec2 book: https://github.com/SquareBracketAssociates/BuildingApplicationWithSpec2/releases/download/latest/Spec2-wip.pdf

You can simply define #defaultOutputPort as follows:

defaultOutputPort 

    ^ self categoryListPresenter defaultOutputPort

Thanks @demarey ! That's exactly what I was looking for.

@hernanmd hernanmd deleted the component_list_mnu branch November 19, 2024 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants