hiding roassal elements

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

hiding roassal elements

Natalia Tymchuk
Hello.
Is there some way to implement the hiding and showing some roassal elements? For example if I want to have the buttons in my view which will give me this opportunity.

Best regards,
Natalia
_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: hiding roassal elements

abergel
Hi Natalia,

Glad to see you around!

Yes, this is easy. You can simply send #remove or #removeWithItsConnectedEdges  to an element or an edge to see it removed. You can add it back by adding to the view again.

Consider this example:

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
v := RTView new.
v @ RTDraggableView.

v addMenu: '+ shapes' callback: [
        previousElements := v elements.
        b := RTMondrian new.
        b view: v.
        newElements := b nodes: RTShape withAllSubclasses.
        b edges connectFrom: #superclass.
        b layout tree.
        b build.
        v signalUpdate.
       
        TRConstraint move: newElements onTheRightOf: previousElements.
].
v addMenu: '+ layouts' callback: [
        previousElements := v elements.
        b := RTMondrian new.
        b view: v.
        newElements := b nodes: RTLayout withAllSubclasses.
        b edges connectFrom: #superclass.
        b layout tree.
        b build.
        v signalUpdate.
       
        TRConstraint move: newElements onTheRightOf: previousElements. ].

v addMenu: '- layouts' callback: [
        (v elements select: [ :el | el model == RTLayout or: [ el model inheritsFrom: RTLayout ] ]) do: #removeWithItsConnectedEdges.
        v signalUpdate ].

v addMenu: '- shapes' callback: [
        (v elements select: [ :el | el model == RTShape or: [ el model inheritsFrom: RTShape ] ]) do: #removeWithItsConnectedEdges.
        v signalUpdate ].
v
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Cheers,
Alexandre


> On Jan 19, 2015, at 1:08 PM, Natalia Tymchuk <[hidden email]> wrote:
>
> Hello.
> Is there some way to implement the hiding and showing some roassal elements? For example if I want to have the buttons in my view which will give me this opportunity.
>
> Best regards,
> Natalia
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: hiding roassal elements

Natalia Tymchuk
Hello, Alex.

Thank you)
It is really nice.

Best regards,
Natalia

> On 19 Jan 2015, at 20:18, Alexandre Bergel <[hidden email]> wrote:
>
> Hi Natalia,
>
> Glad to see you around!
>
> Yes, this is easy. You can simply send #remove or #removeWithItsConnectedEdges  to an element or an edge to see it removed. You can add it back by adding to the view again.
>
> Consider this example:
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> v := RTView new.
> v @ RTDraggableView.
>
> v addMenu: '+ shapes' callback: [
> previousElements := v elements.
> b := RTMondrian new.
> b view: v.
> newElements := b nodes: RTShape withAllSubclasses.
> b edges connectFrom: #superclass.
> b layout tree.
> b build.
> v signalUpdate.
>
> TRConstraint move: newElements onTheRightOf: previousElements.
> ].
> v addMenu: '+ layouts' callback: [
> previousElements := v elements.
> b := RTMondrian new.
> b view: v.
> newElements := b nodes: RTLayout withAllSubclasses.
> b edges connectFrom: #superclass.
> b layout tree.
> b build.
> v signalUpdate.
>
> TRConstraint move: newElements onTheRightOf: previousElements. ].
>
> v addMenu: '- layouts' callback: [
> (v elements select: [ :el | el model == RTLayout or: [ el model inheritsFrom: RTLayout ] ]) do: #removeWithItsConnectedEdges.
> v signalUpdate ].
>
> v addMenu: '- shapes' callback: [
> (v elements select: [ :el | el model == RTShape or: [ el model inheritsFrom: RTShape ] ]) do: #removeWithItsConnectedEdges.
> v signalUpdate ].
> v
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
>
> Cheers,
> Alexandre
>
>
>> On Jan 19, 2015, at 1:08 PM, Natalia Tymchuk <[hidden email]> wrote:
>>
>> Hello.
>> Is there some way to implement the hiding and showing some roassal elements? For example if I want to have the buttons in my view which will give me this opportunity.
>>
>> Best regards,
>> Natalia
>> _______________________________________________
>> Moose-dev mailing list
>> [hidden email]
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> --
> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
> Alexandre Bergel  http://www.bergel.eu
> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>
>
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev