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/09/07 13:15:57 UTC

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

    [ 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.