You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by pan peter <pa...@gmail.com> on 2011/10/12 12:15:23 UTC

can we use css style sheet in pivot?

is it possible to use css directly define the component style? now i can
define style per label or text field, can i define it globally through a css
file?



--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/can-we-use-css-style-sheet-in-pivot-tp3415299p3415299.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: can we use css style sheet in pivot?

Posted by pan peter <pa...@gmail.com>.
i made the styles.json that contains

{
    border: {
        color: "#00aa00",
        padding :"1"
    }
}

and put
    <Border styleName="border">
in the bxml file, using 
    public static void main(String[] args) 
    { 
        String[] newArgs = new String[args.length + 1];
        newArgs[0] = "ClientApplication";
        newArgs[1] = "--stylesheet=/resource/styles.json";
        org.apache.pivot.wtk.DesktopApplicationContext.main(newArgs);
    } 
but got 
    Named style "border" does not exist.
I have also tried the relative path for styles.json like
resource/styles.json, which doesn't work as well.

--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/can-we-use-css-style-sheet-in-pivot-tp3415299p3418382.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: can we use css style sheet in pivot?

Posted by Sandro Martini <sa...@gmail.com>.
Hi,

extract from http://pivot.apache.org/tutorials/platform-overview.html

Skins can be "styled" in a manner similar to CSS. Through the
component, a skin may expose a set of style properties such as "color"
and "font" that a user can change to achieve a custom application
appearance without having to write a new skin. By default, all
components use the skin classes defined by the Terra look and feel.
The skins in this package provide considerable flexibility in setting
style properties. Almost every aspect of a Terra skin's appearance can
be varied via a style property. Terra also provides customizable
"color schemes" that allow a designer to easily replace the color
palette for an entire application.

Take a look even here:
http://pivot.apache.org/tutorials/component-and-container.html


Our styles have a json structure, and can be put inside bxml files
(the styles attribute) and/or the equivalent setter in Java code.
Since 2.0 there is even support for named styles (or global defaults
for styles), for example some info here:
http://apache-pivot-users.399431.n3.nabble.com/Applying-a-style-to-all-elements-of-a-control-td2713309.html

Probably we should write something more specific in Tutorials ... suggestions ?

Bye,
Sandro


2011/10/12 pan peter <pa...@gmail.com>:
> is it possible to use css directly define the component style? now i can
> define style per label or text field, can i define it globally through a css
> file?
>
>
>
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/can-we-use-css-style-sheet-in-pivot-tp3415299p3415299.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.
>

Re: can we use css style sheet in pivot?

Posted by pan peter <pa...@gmail.com>.
actually even i put the full path to the styles.json, it still complains 
    Named style "border" does not exist.
any suggestions?

--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/can-we-use-css-style-sheet-in-pivot-tp3415299p3418419.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: can we use css style sheet in pivot?

Posted by Sandro Martini <sa...@gmail.com>.
Good ...

For a discussion (and sample) on stylesheet from command line, take a
look even here:
http://apache-pivot-users.399431.n3.nabble.com/Applying-a-style-to-all-elements-of-a-control-td2713309.html
but it's an old discussion, just if can be useful ... for example this:

>
>http://svn.apache.org/repos/asf/pivot/trunk/examples/src/org/apache/pivot/examples/styles/styles.json
>http://svn.apache.org/repos/asf/pivot/trunk/examples/src/org/apache/pivot/examples/styles/stylesheet_example.bxml
>java org.apache.pivot.wtk.ScriptApplication --src=/org/apache/pivot/examples/styles/stylesheet_example.bxml --stylesheet=/org/apache/pivot/examples/styles/styles.json
>


Bye

Re: can we use css style sheet in pivot?

Posted by pan peter <pa...@gmail.com>.
o.k. now it works with 

        DesktopApplicationContext.applyStylesheet("/resource/styles.json");
        DesktopApplicationContext.main(ClientApplication.class, args);

in main method.

--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/can-we-use-css-style-sheet-in-pivot-tp3415299p3418444.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.