how to add new stylesheet

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

how to add new stylesheet

jhancock
I'm trying to add blueprintScreenCss instead of the iliadCss.
I have created a class ILMemoryDirectory subclass:
#KNRStylesheetsDirectory and added a blueprintScreenCss method.

I ran the following in a workspace to get my class recognized:
KNRStylesheetsDirectory initialize

But no luck.  My pages load and properly reference stylesheets/
blueprintScreen.css but pharo doesn't serve it up.  I"ve thought about
just adding the blueprintScreenCss method to the class
ILPharoStylesheetsDirectory but I don't know how to manage code like
this.  I assume I'd need to put it in the category "files" but since
I'm modifying a class outside my monticello package, I don't know how
to save it correctly.

anbother thing I"m finding a bit puzzling is that most stylesheet
"frameworks" have separate filers for print, screen, etc...  I don't
see any way the set this.  For example, ,y apps, updatePage method is:

updatePage: aPage
        super updatePage: aPage.
        aPage head stylesheet href: '/stylesheets/blueprintScreen.css'


Any advice is welcome...thanks, Jon
Reply | Threaded
Open this post in threaded view
|

Re: how to add new stylesheet

Nicolas Petton
Hi Jon,

> I'm trying to add blueprintScreenCss instead of the iliadCss.

The default CSS files in Iliad examples are just meant to be used with
the examples.

> I have created a class ILMemoryDirectory subclass:
> #KNRStylesheetsDirectory and added a blueprintScreenCss method.

ILMemoryDirectory subclasses must implement the #path method, see
existing subclasses of ILMemoryDirectory.

>
> I ran the following in a workspace to get my class recognized:
> KNRStylesheetsDirectory initialize
>
> But no luck.  My pages load and properly reference stylesheets/
> blueprintScreen.css but pharo doesn't serve it up.  I"ve thought about
> just adding the blueprintScreenCss method to the class
> ILPharoStylesheetsDirectory but I don't know how to manage code like
> this.  I assume I'd need to put it in the category "files" but since
> I'm modifying a class outside my monticello package, I don't know how
> to save it correctly.

By putting your methods in a "*MyPackage" protocol, it will be saved
with Monticello into MyPackage. However, I suggest subclassing
ILMemoryDirectory instead of extending existing classes.


>
> anbother thing I"m finding a bit puzzling is that most stylesheet
> "frameworks" have separate filers for print, screen, etc...  I don't
> see any way the set this.  For example, ,y apps, updatePage method is:
>
> updatePage: aPage
> super updatePage: aPage.
> aPage head stylesheet href: '/stylesheets/blueprintScreen.css'

Something like the following will work:

aPage head stylesheet
    href: '/myfiles/screen.css';
    media: 'screen'.

See ILLinkElement for more informations about the link tag.

HTH,
Nico

Reply | Threaded
Open this post in threaded view
|

Re: how to add new stylesheet

jhancock
Nico, I do have the path method.  It is the same path as in
ILPharoStylesheetsDirectory though, 'stylesheets'.  Is it  a problem for
two ILMemoryDirectory subclasses to have the same path?
thanks, Jon

On 12/22/10 8:19 PM, Nicolas Petton wrote:

> Hi Jon,
>
>> I'm trying to add blueprintScreenCss instead of the iliadCss.
> The default CSS files in Iliad examples are just meant to be used with
> the examples.
>
>> I have created a class ILMemoryDirectory subclass:
>> #KNRStylesheetsDirectory and added a blueprintScreenCss method.
> ILMemoryDirectory subclasses must implement the #path method, see
> existing subclasses of ILMemoryDirectory.
>
>> I ran the following in a workspace to get my class recognized:
>> KNRStylesheetsDirectory initialize
>>
>> But no luck.  My pages load and properly reference stylesheets/
>> blueprintScreen.css but pharo doesn't serve it up.  I"ve thought about
>> just adding the blueprintScreenCss method to the class
>> ILPharoStylesheetsDirectory but I don't know how to manage code like
>> this.  I assume I'd need to put it in the category "files" but since
>> I'm modifying a class outside my monticello package, I don't know how
>> to save it correctly.
> By putting your methods in a "*MyPackage" protocol, it will be saved
> with Monticello into MyPackage. However, I suggest subclassing
> ILMemoryDirectory instead of extending existing classes.
>
>
>> anbother thing I"m finding a bit puzzling is that most stylesheet
>> "frameworks" have separate filers for print, screen, etc...  I don't
>> see any way the set this.  For example, ,y apps, updatePage method is:
>>
>> updatePage: aPage
>> super updatePage: aPage.
>> aPage head stylesheet href: '/stylesheets/blueprintScreen.css'
> Something like the following will work:
>
> aPage head stylesheet
>      href: '/myfiles/screen.css';
>      media: 'screen'.
>
> See ILLinkElement for more informations about the link tag.
>
> HTH,
> Nico
>

Reply | Threaded
Open this post in threaded view
|

Re: how to add new stylesheet

Nicolas Petton
Le jeudi 23 décembre 2010 à 08:54 -0500, Jon Hancock a écrit :
> Nico, I do have the path method.  It is the same path as in
> ILPharoStylesheetsDirectory though, 'stylesheets'.  Is it  a problem for
> two ILMemoryDirectory subclasses to have the same path?

Yes it is. Each ILMemoryDirectory subclass should have an unique path.

HTH,
Nico

Reply | Threaded
Open this post in threaded view
|

Re: how to add new stylesheet

garduino
2010/12/24 Nicolas Petton <[hidden email]>:

> Le jeudi 23 décembre 2010 à 08:54 -0500, Jon Hancock a écrit :
>> Nico, I do have the path method.  It is the same path as in
>> ILPharoStylesheetsDirectory though, 'stylesheets'.  Is it  a problem for
>> two ILMemoryDirectory subclasses to have the same path?
>
> Yes it is. Each ILMemoryDirectory subclass should have an unique path.
>
> HTH,
> Nico
>
>

mmm, hard to guess.

I'm having similar problems trying to show some graphics I added on an
own class subclassed from ILPharoImagesDirectory. If I add the same
graphics on ILPharoImagesDirectory then it works, but I can't find in
the debugging I did until now were is binded such class (for example
can't find references to it).

I'm using Iliad 0.9.1, Pharo 1.1.1 and Cog 2316.

Cheers.


--
=================================================
Germán S. Arduino  <gsa @ arsol.net>   Twitter: garduino
Arduino Software & Web Hosting   http://www.arduinosoftware.com
PasswordsPro  http://www.passwordspro.com
=================================================
Reply | Threaded
Open this post in threaded view
|

Re: how to add new stylesheet

Nicolas Petton
I guess a chapter on the documentation would help here :)

Let's take an example:

- Create a subclass of ILMemoryDirectory named MyStaticDirectory.
- set its path to 'static' with the #path method:

path
    ^'static'

- Add some files to it. You can do it by hand or import files from disk
with maintenance methods from ILMemoryDirectory class. Here I add a
method in the 'files' protocol that answers a string:

exampleTxt
    ^'this is an example'

- Now you can use it from Iliad applications. You can check if its
working by requesting the file http://localhost:8888/static/example.txt

HTH,
Nico

Le vendredi 24 décembre 2010 à 12:48 -0300, Germán Arduino a écrit :

> 2010/12/24 Nicolas Petton <[hidden email]>:
> > Le jeudi 23 décembre 2010 à 08:54 -0500, Jon Hancock a écrit :
> >> Nico, I do have the path method.  It is the same path as in
> >> ILPharoStylesheetsDirectory though, 'stylesheets'.  Is it  a problem for
> >> two ILMemoryDirectory subclasses to have the same path?
> >
> > Yes it is. Each ILMemoryDirectory subclass should have an unique path.
> >
> > HTH,
> > Nico
> >
> >
>
> mmm, hard to guess.
>
> I'm having similar problems trying to show some graphics I added on an
> own class subclassed from ILPharoImagesDirectory. If I add the same
> graphics on ILPharoImagesDirectory then it works, but I can't find in
> the debugging I did until now were is binded such class (for example
> can't find references to it).
>
> I'm using Iliad 0.9.1, Pharo 1.1.1 and Cog 2316.
>
> Cheers.
>
>


Reply | Threaded
Open this post in threaded view
|

Re: how to add new stylesheet

Nicolas Petton
In reply to this post by garduino
Le vendredi 24 décembre 2010 à 12:48 -0300, Germán Arduino a écrit :
> I'm having similar problems trying to show some graphics I added on an
> own class subclassed from ILPharoImagesDirectory. If I add the same
> graphics on ILPharoImagesDirectory then it works, but I can't find in
> the debugging I did until now were is binded such class (for example
> can't find references to it).

German,

You shouldn't subclass ILPharoImagesDirectory, but ILMemoryDirectory.

Maybe the class name ILPharoImagesDirectory is confusing, as this class
is just meant to be used in Iliad examples.

Cheers,
Nico

Reply | Threaded
Open this post in threaded view
|

Re: how to add new stylesheet

garduino
Well I subclassed because the ajaxloader...

Also I tried subclassing ILMemoryDirectory, but don't worked. To put
my question in terms of Iliad examples (for example
ILApplicationBrowse), how is related with ILPharoImagesDirectory?

Cheers.


2010/12/24 Nicolas Petton <[hidden email]>:

> Le vendredi 24 décembre 2010 à 12:48 -0300, Germán Arduino a écrit :
>> I'm having similar problems trying to show some graphics I added on an
>> own class subclassed from ILPharoImagesDirectory. If I add the same
>> graphics on ILPharoImagesDirectory then it works, but I can't find in
>> the debugging I did until now were is binded such class (for example
>> can't find references to it).
>
> German,
>
> You shouldn't subclass ILPharoImagesDirectory, but ILMemoryDirectory.
>
> Maybe the class name ILPharoImagesDirectory is confusing, as this class
> is just meant to be used in Iliad examples.
>
> Cheers,
> Nico
>
>



--
=================================================
Germán S. Arduino  <gsa @ arsol.net>   Twitter: garduino
Arduino Software & Web Hosting   http://www.arduinosoftware.com
PasswordsPro  http://www.passwordspro.com
=================================================
Reply | Threaded
Open this post in threaded view
|

Re: how to add new stylesheet

garduino
In reply to this post by Nicolas Petton
Hi:

This exact example don't works on my image. (Pharo 1.1.1/Cog). I
allways get a 404 error, also in the case of graphics (png or so).

Germán.


2010/12/24 Nicolas Petton <[hidden email]>:

> I guess a chapter on the documentation would help here :)
>
> Let's take an example:
>
> - Create a subclass of ILMemoryDirectory named MyStaticDirectory.
> - set its path to 'static' with the #path method:
>
> path
>    ^'static'
>
> - Add some files to it. You can do it by hand or import files from disk
> with maintenance methods from ILMemoryDirectory class. Here I add a
> method in the 'files' protocol that answers a string:
>
> exampleTxt
>    ^'this is an example'
>
> - Now you can use it from Iliad applications. You can check if its
> working by requesting the file http://localhost:8888/static/example.txt
>
> HTH,
> Nico
>
Reply | Threaded
Open this post in threaded view
|

Re: how to add new stylesheet

Nicolas Petton
Le samedi 25 décembre 2010 à 19:05 -0300, Germán Arduino a écrit :
> Hi:
>
> This exact example don't works on my image. (Pharo 1.1.1/Cog). I
> allways get a 404 error, also in the case of graphics (png or so).

Strange, maybe I wrote something wrong in my example :)
I'll test it tomorrow.

Cheers,
Nico

Reply | Threaded
Open this post in threaded view
|

Re: how to add new stylesheet

Nicolas Petton
In reply to this post by garduino
If I forget half of the code in the example, it can't work :)
To make the previous example work, you need to register an instance of the directory in the file handler:

ILFileHandler addDirectory: MyStaticDirectory new

Everything should work now.

Cheers,
Nico
Reply | Threaded
Open this post in threaded view
|

Re: how to add new stylesheet

garduino
2010/12/29 nicolas petton <[hidden email]>:
> If I forget half of the code in the example, it can't work :)
> To make the previous example work, you need to register an instance of the
> directory in the file handler:
> ILFileHandler addDirectory: MyStaticDirectory new
> Everything should work now.
> Cheers,
> Nico
>


Yes, seems to work now.