True, but it is also more complex than JSON, which so far has worked well for us. JSON property names and value types map nicely to the Java bean property names and values used by the skin classes. Also, we already have a JSONSerializer - we'd have to write additional support for CSS, and I'm not sure that is justified.
On Jul 2, 2010, at 9:51 PM, Michael Allman wrote: > It would be very premature for me to provide a good example. I've barely > started my first Pivot app. Also, I can say that this can't be done with > Flex apps either. So I never used it there. Doesn't mean it might not have > come in handy once or twice... I dunno. It may be practically useless. > Although I have seen it used many times in html. > > This comes back to my earlier post. Why not support a subset of CSS syntax > itself? It's a very mature spec for styling declarative ui stuff. > > Cheers, > > Michael > > > On Fri, 2 Jul 2010, Greg Brown wrote: > >> I have been thinking about that and I have some ideas. But I would like to >> understand how often that use case actually comes up. I know CSS supports >> it, but in practice (in Pivot specifically) I wonder how important it is? >> >> >> On Jul 2, 2010, at 7:30 PM, Michael Allman wrote: >> >>> Hi Greg, >>> >>> How would one specify multiple named styles for a component element? Like >>> >>> <PushButton styles="redButton bigFont"/> >>> >>> Cheers, >>> >>> Michael >>> >>> On Fri, 2 Jul 2010, Greg Brown wrote: >>> >>>> Hi all, >>>> >>>> I have been thinking about this and I think I have a fairly elegant >>>> solution that will also significantly extend the capabilities of >>>> BXMLSerializer. I am thinking of extending the <bxml:include> tag to >>>> support loading of arbitrary content. Currently, it only supports includes >>>> of other BXML files, but there is no reason that it couldn't be modified >>>> to include other types, such as JSON, XML, or even images. All we'd have >>>> to do is determine an appropriate serializer to use for the include - this >>>> could be inferred based on file extension or could be specified explicitly >>>> via a "mimeType" attribute to the include tag. The MIME type-to-serializer >>>> mappings could be configurable such that an include could literally be >>>> used to load any type of object. >>>> >>>> One application of such an extension would be styling. <bxml:include> >>>> could be used to load a "stylesheet" - a JSON file containing a "map of >>>> maps". The format of this file would be identical to the format I had been >>>> considering for the "named styles" approach - each key/value pair in the >>>> file would essentially represent a "style class". For example, the >>>> following JSON file would define a "redButton" class: >>>> >>>> { redButton: { >>>> backgroundColor: "#aa0000", >>>> color: "#ffffff" >>>> } >>>> } >>>> >>>> In a BXML document, this file could be included as follows: >>>> >>>> <bxml:include bxml:id="styles" src="styles.json"/> >>>> >>>> The "redButton" style could then be applied to a button as follows: >>>> >>>> <PushButton styles="$styles.redButton"/> >>>> >>>> Unlike the previous solution I proposed, this approach would require no >>>> changes to the Component or Container classes whatsoever. With the >>>> exception of extending the <bxml:include> tag, it relies entirely on >>>> existing functionality (and existing BXML syntax, so developers will >>>> already be familiar with it). >>>> >>>> There are obviously other applications as well. Some simple examples: >>>> >>>> <TableView> >>>> <tableData> >>>> <bxml:include src="table_data.json"/> >>>> </tableData> >>>> </TableView> >>>> >>>> <TreeView> >>>> <treeData> >>>> <bxml:include src="tree_data.xml"/> >>>> </treeData> >>>> </TreeView> >>>> >>>> One challenge might be how to specify the MIME/serializer mapping for an >>>> include (we won't want BXMLSerializer to include all possible mappings by >>>> default). This could be inherited from the parent serializer, but I think >>>> that a BXML syntax for specifying it in markup is probably a good idea. >>>> >>>> Anyway, I think this would be an extremely flexible and useful addition to >>>> the serializer, and I think it also handles the styling case pretty well. >>>> Let me know what you think. >>>> >>>> G >>>> >>>> >>>> On Jul 2, 2010, at 1:34 PM, Greg Brown wrote: >>>> >>>>> FYI, named styles are turning out to be a lot more challenging than I >>>>> expected. The solution I proposed the other day doesn't work - elements >>>>> in BXML aren't added to the parent element until the end tag is >>>>> processed. So, given the following structure: >>>>> >>>>> <Window styleClasses="{foo:{...}}"> >>>>> <BoxPane> >>>>> <PushButton styleClass="foo"/> >>>>> </BoxPane> >>>>> </Window> >>>>> >>>>> when the styleClass attribute of the PushButton is processed, the BoxPane >>>>> hasn't yet been added to the Window, so the "foo" style class name >>>>> resolves to null. :-( >>>>> >>>>> I'll keep thinking about it, though. Suggestions are welcome. >>>>> >>>>> Thanks, >>>>> G >>>>> >>>> >>