You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "Sandro Martini (JIRA)" <ji...@apache.org> on 2009/08/27 15:27:59 UTC

[jira] Created: (PIVOT-243) Add Startup Property in KitchenSink Tutorial to load a custom json file for the Skin Colors to use

Add Startup Property in KitchenSink Tutorial to load a custom json file for the Skin Colors to use
--------------------------------------------------------------------------------------------------

                 Key: PIVOT-243
                 URL: https://issues.apache.org/jira/browse/PIVOT-243
             Project: Pivot
          Issue Type: New Feature
          Components: demos
            Reporter: Sandro Martini
            Assignee: Sandro Martini
            Priority: Minor
             Fix For: 1.3.1


This is useful to show people not only how to use a different color scheme, but what every single component will look like in a different color
scheme, which is why you want to put this in the kitchen sink demo. 

Note that loading a new Theme after the default has been loaded takes a noticeable amount of
time (something like 500ms IIRC), so make sure that your code only runs if the startup property specifies to do so.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (PIVOT-243) Add Startup Property in KitchenSink Tutorial to load a custom json file for the Skin Colors to use

Posted by Sandro Martini <sa...@gmail.com>.
Hi Todd,
thanks for the hints ... I'll commit in a few minutes.

Tell me if you like this feature.
In the code i put also a comment on how to do to use it, and for
users, the json file is commented so it's more clear what palette
colors are used by the TerraTheme..

Bye

Re: [jira] Commented: (PIVOT-243) Add Startup Property in KitchenSink Tutorial to load a custom json file for the Skin Colors to use

Posted by Todd Volkert <tv...@gmail.com>.
> - i put the code at the beginning of the startup method, but maybe
> this could go before the open of the display ... is it a right place,
> so leave where it is ?
>

Yep - I'd leave it at the beginning of startup.


> - if the given file is not found, at the moment i write an error
> message to the console, but do you think we could show it in an Alert
> instead (to show also this approach) ?
>

The application already shows the use of Alert, so I'd leave it as a
sys-out, but I could go either way.


> - loading the other TerraTheme_test.json (already in wtk sources)
> doesn't give too much visual differences from the standard colors, so
> what do you think if I'd add my test for dark colors in the same dir
> of KitchenSink ?
>

The test should probably eventually move anyway, so I'd add yours next to
the kitchen sink.

Re: [jira] Commented: (PIVOT-243) Add Startup Property in KitchenSink Tutorial to load a custom json file for the Skin Colors to use

Posted by Sandro Martini <sa...@gmail.com>.
Hi Todd,
thanks for the help (I didn't looked right at upper classes :-) ), and
I wrote a simple description in JIRA to help me remember what to do
...

Now it's ready, but one question:
- i put the code at the beginning of the startup method, but maybe
this could go before the open of the display ... is it a right place,
so leave where it is ?
- if the given file is not found, at the moment i write an error
message to the console, but do you think we could show it in an Alert
instead (to show also this approach) ?
- loading the other TerraTheme_test.json (already in wtk sources)
doesn't give too much visual differences from the standard colors, so
what do you think if I'd add my test for dark colors in the same dir
of KitchenSink ?

Bye

[jira] Resolved: (PIVOT-243) Add Startup Property in KitchenSink Tutorial to load a custom json file for the Skin Colors to use

Posted by "Sandro Martini (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIVOT-243?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sandro Martini resolved PIVOT-243.
----------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: 1.3.1)
                   1.3

As by Todd hint, the feature has been implemented.

A sample Terra json file has been submitted (with a dark color scheme, visually different from the standard one), to use as a sample.


> Add Startup Property in KitchenSink Tutorial to load a custom json file for the Skin Colors to use
> --------------------------------------------------------------------------------------------------
>
>                 Key: PIVOT-243
>                 URL: https://issues.apache.org/jira/browse/PIVOT-243
>             Project: Pivot
>          Issue Type: New Feature
>          Components: demos
>            Reporter: Sandro Martini
>            Assignee: Sandro Martini
>            Priority: Minor
>             Fix For: 1.3
>
>
> This is useful to show people not only how to use a different color scheme, but what every single component will look like in a different color
> scheme, which is why you want to put this in the kitchen sink demo. 
> Note that loading a new Theme after the default has been loaded takes a noticeable amount of
> time (something like 500ms IIRC), so make sure that your code only runs if the startup property specifies to do so.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PIVOT-243) Add Startup Property in KitchenSink Tutorial to load a custom json file for the Skin Colors to use

Posted by "Todd Volkert (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-243?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12752112#action_12752112 ] 

Todd Volkert commented on PIVOT-243:
------------------------------------

No - this is already all done for you; that's what the "properties" are that are passed to Application.startup().

> Add Startup Property in KitchenSink Tutorial to load a custom json file for the Skin Colors to use
> --------------------------------------------------------------------------------------------------
>
>                 Key: PIVOT-243
>                 URL: https://issues.apache.org/jira/browse/PIVOT-243
>             Project: Pivot
>          Issue Type: New Feature
>          Components: demos
>            Reporter: Sandro Martini
>            Assignee: Sandro Martini
>            Priority: Minor
>             Fix For: 1.3.1
>
>
> This is useful to show people not only how to use a different color scheme, but what every single component will look like in a different color
> scheme, which is why you want to put this in the kitchen sink demo. 
> Note that loading a new Theme after the default has been loaded takes a noticeable amount of
> time (something like 500ms IIRC), so make sure that your code only runs if the startup property specifies to do so.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (PIVOT-243) Add Startup Property in KitchenSink Tutorial to load a custom json file for the Skin Colors to use

Posted by "Sandro Martini (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/PIVOT-243?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12752095#action_12752095 ] 

Sandro Martini commented on PIVOT-243:
--------------------------------------

To do this I have to parse the command-line arguments of the main(), handling a new argument like --terraColors=file.json  .
But In the main() implementation inside DesktopApplicationContext (called usually by other mains), that custom property will not be handled and a console warning will be written. And this works only for Desktop Applications.

So, a first version could be simply to add a custom parseArguments(args) inside the application who want this feature, in this case the Kitchen Sink. I don't think this could be a common flag (for the Terra Theme is makes sense, but form others  could not have ...), or maybe we could handle it as common, and let others skin to throw some Exception when for example is given an argument for this but it isn't supported.

Then, if the flag has been given, in the startup method (at the start of that method), load it by forcing the Terra theme to load it (in a try/catch with a dialog if some exception occurs, like file not found) 
        Theme.setTheme(new TerraTheme(terraColorsCustomFile));  // sample

Ok ?


Later, maybe we should think on a common method for handling and parsing Command-line arguments (also in the case of Applets), like consuming standard flags and values (as currently), and then put all (or only those not handled directly) in a read-only Map, visible to user code.
After a quick look at the BrowserApplicationContext, is seems that startup properties are handled, but not like others in DesktopApplicationContext ... probably because width, height, fullscreen, etc have a minor utility in Applets (could be useful only in few cases).

Comments ?


Sandro


> Add Startup Property in KitchenSink Tutorial to load a custom json file for the Skin Colors to use
> --------------------------------------------------------------------------------------------------
>
>                 Key: PIVOT-243
>                 URL: https://issues.apache.org/jira/browse/PIVOT-243
>             Project: Pivot
>          Issue Type: New Feature
>          Components: demos
>            Reporter: Sandro Martini
>            Assignee: Sandro Martini
>            Priority: Minor
>             Fix For: 1.3.1
>
>
> This is useful to show people not only how to use a different color scheme, but what every single component will look like in a different color
> scheme, which is why you want to put this in the kitchen sink demo. 
> Note that loading a new Theme after the default has been loaded takes a noticeable amount of
> time (something like 500ms IIRC), so make sure that your code only runs if the startup property specifies to do so.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.