How to set the #addLinkTo:

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

How to set the #addLinkTo:

garduino
Hi:

I'm working with a model that has a main collection and other instvar
to store choices for the main collection.

Such #choices is a Dictionary that can have differente things as
elements, by example:

* A simple preloaded array:

brands
        ^self choices at: #brands ifAbsentPut: [Array with: 'IBM' with:
'Hewlett Packard' with: 'Clon']

* A collection of full objects, as:

serverTypes
        ^self choices at: #serverTypes ifAbsentPut: [Set new]

ServerType in this case is an object with several instvars (name,
brand, machine model, etc)

Then, on server collection of the main class (the system) each server
have an instvar named #serverType
who has the #name of the server type object of the serverTypes
collection stored on the dictionary
choices.

I'm adding server types on the serverTypes collection on the way:

addServerType: aServerType
        ^self serverTypes add: aServerType
       

The main view of the system is as follow:

viewMain

        | e entryList |

        e := WebElement new.
        e addTextH1: 'Server List'.
        entryList := WebGrid new.
        entryList columnNames: #('' 'Name' 'Role' 'Company' 'Status' 'Server Type');
                setNumbering;
                columnFilters: #(nil nil nil true true nil);
                sortOn: 2;
                collection: self observee servers;
                columnAspects: #(nil #name #role #company #status #serverTypeName);
                column: 6 addBlock: [ :each |
                        (WebElement new) addLinkTo: each text: each serverTypeName].
        e add: entryList.
        e addBreak.
        e addButtonText: 'Add a new server'.
        self pageFrameWith: e title: 'Server List'.

My goal is provide a link on server type column that show all the data
of such server type.

The text I show is #serverTypeName because I must to show the name of
server type object, as follow:

serverTypeName
        ^ serverType name

The question is what should code at addLinkTo: (on the column 6 of
above text) to link the ServerTypeApp
that shows the server type data which name is #serverTypeName?

May be that I'm not setting a #parent: on #addServerType above? I'm
not sure neither of the proper
use of parent.

I hope the mail be clear and sorry by the long post.

Cheers.

--
Germán S. Arduino
http://www.arsol.biz
http://www.arsol.net
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: How to set the #addLinkTo:

garduino
I should add that another doubt is how the app know which instance of
its observee is that it most show?

And searching on the image I found (on a Scribo class) the following:

        self redirectTo: self observee repository documentSystem view: #main
parameter: 'folderid' value: self observee uuid

Seems that is possible to pass a paramter to the view to permit it
show the desired object?

Mmmmm, I must continue investigating.


2009/1/15 Germán Arduino <[hidden email]>:

> Hi:
>
> I'm working with a model that has a main collection and other instvar
> to store choices for the main collection.
>
> Such #choices is a Dictionary that can have differente things as
> elements, by example:
>
> * A simple preloaded array:
>
> brands
>        ^self choices at: #brands ifAbsentPut: [Array with: 'IBM' with:
> 'Hewlett Packard' with: 'Clon']
>
> * A collection of full objects, as:
>
> serverTypes
>        ^self choices at: #serverTypes ifAbsentPut: [Set new]
>
> ServerType in this case is an object with several instvars (name,
> brand, machine model, etc)
>
> Then, on server collection of the main class (the system) each server
> have an instvar named #serverType
> who has the #name of the server type object of the serverTypes
> collection stored on the dictionary
> choices.
>
> I'm adding server types on the serverTypes collection on the way:
>
> addServerType: aServerType
>        ^self serverTypes add: aServerType
>
>
> The main view of the system is as follow:
>
> viewMain
>
>        | e entryList |
>
>        e := WebElement new.
>        e addTextH1: 'Server List'.
>        entryList := WebGrid new.
>        entryList columnNames: #('' 'Name' 'Role' 'Company' 'Status' 'Server Type');
>                setNumbering;
>                columnFilters: #(nil nil nil true true nil);
>                sortOn: 2;
>                collection: self observee servers;
>                columnAspects: #(nil #name #role #company #status #serverTypeName);
>                column: 6 addBlock: [ :each |
>                        (WebElement new) addLinkTo: each text: each serverTypeName].
>        e add: entryList.
>        e addBreak.
>        e addButtonText: 'Add a new server'.
>        self pageFrameWith: e title: 'Server List'.
>
> My goal is provide a link on server type column that show all the data
> of such server type.
>
> The text I show is #serverTypeName because I must to show the name of
> server type object, as follow:
>
> serverTypeName
>        ^ serverType name
>
> The question is what should code at addLinkTo: (on the column 6 of
> above text) to link the ServerTypeApp
> that shows the server type data which name is #serverTypeName?
>
> May be that I'm not setting a #parent: on #addServerType above? I'm
> not sure neither of the proper
> use of parent.
>
> I hope the mail be clear and sorry by the long post.
>
> Cheers.
>
> --
> Germán S. Arduino
> http://www.arsol.biz
> http://www.arsol.net
>



--
Germán S. Arduino
http://www.arsol.biz
http://www.arsol.net
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: How to set the #addLinkTo:

Janko Mivšek
In reply to this post by garduino
Hi Germán,

Sorry for so late answer. Let me try to help you below.

Germán Arduino pravi:

> I'm working with a model that has a main collection and other instvar
> to store choices for the main collection.
>
> Such #choices is a Dictionary that can have differente things as
> elements, by example:
>
> * A simple preloaded array:
>
> brands
> ^self choices at: #brands ifAbsentPut: [Array with: 'IBM' with:
> 'Hewlett Packard' with: 'Clon']
>
> * A collection of full objects, as:
>
> serverTypes
> ^self choices at: #serverTypes ifAbsentPut: [Set new]
>
> ServerType in this case is an object with several instvars (name,
> brand, machine model, etc)
>
> Then, on server collection of the main class (the system) each server
> have an instvar named #serverType
> who has the #name of the server type object of the serverTypes
> collection stored on the dictionary
> choices.
>
> I'm adding server types on the serverTypes collection on the way:
>
> addServerType: aServerType
> ^self serverTypes add: aServerType
>
>
> The main view of the system is as follow:
>
> viewMain
>
> | e entryList |
>
> e := WebElement new.
> e addTextH1: 'Server List'.
> entryList := WebGrid new.
> entryList columnNames: #('' 'Name' 'Role' 'Company' 'Status' 'Server Type');
> setNumbering;
> columnFilters: #(nil nil nil true true nil);
> sortOn: 2;
> collection: self observee servers;
> columnAspects: #(nil #name #role #company #status #serverTypeName);
> column: 6 addBlock: [ :each |
> (WebElement new) addLinkTo: each text: each serverTypeName].
> e add: entryList.
> e addBreak.
> e addButtonText: 'Add a new server'.
>         self pageFrameWith: e title: 'Server List'.

> My goal is provide a link on server type column that show all the data
> of such server type.
>
> The text I show is #serverTypeName because I must to show the name of
> server type object, as follow:
>
> serverTypeName
> ^ serverType name
>
> The question is what should code at addLinkTo: (on the column 6 of
> above text) to link the ServerTypeApp
> that shows the server type data which name is #serverTypeName?

I think the solution is simply:
      column: 6 addBlock: [:each |
  (WebElement new)
                addLinkTo: each serverType text: each serverTypeName].

or better:
        ...
        WebLink text: each serverTypeName linkTo: each serverType

Block argument #each namely points to current webGrid row object, that
is a server in your case.

I hope this helps a bit
Janko


--
Janko Mivšek
Svetovalec za informatiko
Eranova d.o.o.
Ljubljana, Slovenija
www.eranova.si
tel:  01 514 22 55
faks: 01 514 22 56
gsm: 031 674 565
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: How to set the #addLinkTo:

garduino
Thanks by the response, I will try asap.

Cheers.


2009/1/24 Janko Mivšek <[hidden email]>
Hi Germán,

Sorry for so late answer. Let me try to help you below.

Germán Arduino pravi:

> I'm working with a model that has a main collection and other instvar
> to store choices for the main collection.
>
> Such #choices is a Dictionary that can have differente things as
> elements, by example:
>
> * A simple preloaded array:
>
> brands
>       ^self choices at: #brands ifAbsentPut: [Array with: 'IBM' with:
> 'Hewlett Packard' with: 'Clon']
>
> * A collection of full objects, as:
>
> serverTypes
>       ^self choices at: #serverTypes ifAbsentPut: [Set new]
>
> ServerType in this case is an object with several instvars (name,
> brand, machine model, etc)
>
> Then, on server collection of the main class (the system) each server
> have an instvar named #serverType
> who has the #name of the server type object of the serverTypes
> collection stored on the dictionary
> choices.
>
> I'm adding server types on the serverTypes collection on the way:
>
> addServerType: aServerType
>       ^self serverTypes add: aServerType
>
>
> The main view of the system is as follow:
>
> viewMain
>
>       | e entryList |
>
>       e := WebElement new.
>       e addTextH1: 'Server List'.
>       entryList := WebGrid new.
>       entryList columnNames: #('' 'Name' 'Role' 'Company' 'Status' 'Server Type');
>               setNumbering;
>               columnFilters: #(nil nil nil true true nil);
>               sortOn: 2;
>               collection: self observee servers;
>               columnAspects: #(nil #name #role #company #status #serverTypeName);
>               column: 6 addBlock: [ :each |
>                       (WebElement new) addLinkTo: each text: each serverTypeName].
>       e add: entryList.
>       e addBreak.
>       e addButtonText: 'Add a new server'.
>         self pageFrameWith: e title: 'Server List'.

> My goal is provide a link on server type column that show all the data
> of such server type.
>
> The text I show is #serverTypeName because I must to show the name of
> server type object, as follow:
>
> serverTypeName
>       ^ serverType name
>
> The question is what should code at addLinkTo: (on the column 6 of
> above text) to link the ServerTypeApp
> that shows the server type data which name is #serverTypeName?

I think the solution is simply:
     column: 6 addBlock: [:each |
       (WebElement new)
               addLinkTo: each serverType text: each serverTypeName].

or better:
       ...
       WebLink text: each serverTypeName linkTo: each serverType

Block argument #each namely points to current webGrid row object, that
is a server in your case.

I hope this helps a bit
Janko


--
Janko Mivšek
Svetovalec za informatiko
Eranova d.o.o.
Ljubljana, Slovenija
www.eranova.si
tel:  01 514 22 55
faks: 01 514 22 56
gsm: 031 674 565
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida




_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida