You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Scott Lanham <li...@sael.com.au> on 2009/08/04 23:50:30 UTC

Styles as an Element.

Howdy,

I am working through the WTKX Primer doc and saw the part about how properties 
could either be specified as an attribute or as an element. So I thought I 
would pull the styles property out into an element to see what happens:

<styles>{padding:10, horizontalAlignment:'center', 
verticalAlignment:'center'}</styles>

Except this gives a runtime error:

	org.apache.pivot.serialization.SerializationException: Unexpected characters 
in READ_ONLY_PROPERTY element.

I can't see why this shouldn't work, but that doesn't mean much ;-)

Many Thanks,

Scott.

Re: Styles as an Element.

Posted by Greg Brown <gk...@mac.com>.
That syntax doesn't work for styles. See the WTKX Primer for a  
complete explanation.
G

On Aug 4, 2009, at 5:50 PM, Scott Lanham wrote:

> Howdy,
>
> I am working through the WTKX Primer doc and saw the part about how  
> properties
> could either be specified as an attribute or as an element. So I  
> thought I
> would pull the styles property out into an element to see what  
> happens:
>
> <styles>{padding:10, horizontalAlignment:'center',
> verticalAlignment:'center'}</styles>
>
> Except this gives a runtime error:
>
> 	org.apache.pivot.serialization.SerializationException: Unexpected  
> characters
> in READ_ONLY_PROPERTY element.
>
> I can't see why this shouldn't work, but that doesn't mean much ;-)
>
> Many Thanks,
>
> Scott.


Re: Styles as an Element.

Posted by Greg Brown <gk...@mac.com>.
We started off that way, but we were able to eliminate the string  
setters when we came up with the type inference approach.  
Unfortunately (as you now know), it currently only works for bean  
elements. I'll think about how/if we might want to extend it to read- 
only dictionary property elements as well.

On Aug 4, 2009, at 10:46 PM, Scott Lanham wrote:

> My knowledge of Pivot is not very good but for what it's worth, I  
> maintain a
> generic java business objects library and have the problem of things  
> being
> transferred between UI and back end objects using strings even  
> though the
> native types are not always strings. I simply forced all business  
> objects to
> have a string setter function as standard and managed to make it  
> generic
> enough not to be a pain in the arse.
>
> On Wed, 5 Aug 2009 12:39:40 pm Greg Brown wrote:
>> Yeah. See my most recent reply. Suggesting the styles element was an
>> error on my part.  :-P  It works in some cases, but not here.
>>
>> We could potentially add a getType(K):Class<?> method to Dictionary,
>> but that doesn't seem right: Dictionary is already a generic, so we
>> should know what its value type is. We might define a TypedDictionary
>> interface that extends Dictionary, but that also seems a little  
>> hokey.
>> Maybe there is an elegant way to do it, though...I'll give it some
>> thought. Suggestions welcome.
>>
>> G
>>
>> On Aug 4, 2009, at 10:28 PM, Scott Lanham wrote:
>>> Yep the styles attribute worked. Using the styles element showed a
>>> runtime
>>> error of:
>>>
>>> 	padding" is not a valid style for org.apache.pivot.wtk.BoxPane#2
>>>
>>> On Wed, 5 Aug 2009 12:14:02 pm Greg Brown wrote:
>>>> Try setting it via the styles attribute and you should see the
>>>> expected behavior. Seems like there might be an issue setting it
>>>> via a
>>>> styles element.
>>>>
>>>> On Aug 4, 2009, at 7:47 PM, Scott Lanham wrote:
>>>>> Tried right/left top/bottom and the buttons were up against the
>>>>> window border.
>>>>>
>>>>> On Wed, 5 Aug 2009 09:22:34 am Greg Brown wrote:
>>>>>> You might not see the effect padding has since you are using  
>>>>>> center
>>>>>> alignments. Try right or left (or top/bottom).
>>>>>>
>>>>>> On Aug 4, 2009, at 6:43 PM, Scott Lanham wrote:
>>>>>>> I am playing with the Toggle Buttons part of the tutorial. After
>>>>>>> changes the
>>>>>>> WTKX file looks like:
>>>>>>>
>>>>>>> <Window title="Toggle Buttons" maximized="true"
>>>>>>> xmlns:wtkx="http://pivot.apache.org/wtkx"
>>>>>>> xmlns:content="org.apache.pivot.wtk.content"
>>>>>>> xmlns="org.apache.pivot.wtk">
>>>>>>> <content>
>>>>>>>     <BoxPane>
>>>>>>>         <styles padding="100" horizontalAlignment="center"
>>>>>>> verticalAlignment="center"/>
>>>>>>>         <PushButton toggleButton="true">
>>>>>>>             <buttonData>
>>>>>>>                 <content:ButtonData text="Anchor"
>>>>>>> icon="@clock.png"/>
>>>>>>>             </buttonData>
>>>>>>>         </PushButton>
>>>>>>>         <PushButton toggleButton="true">
>>>>>>>             <buttonData>
>>>>>>>                 <content:ButtonData text="Cup"/>
>>>>>>>             </buttonData>
>>>>>>>         </PushButton>
>>>>>>>         <PushButton toggleButton="true">
>>>>>>>             <buttonData>
>>>>>>>                 <content:ButtonData text="Star"/>
>>>>>>>             </buttonData>
>>>>>>>         </PushButton>
>>>>>>>     </BoxPane>
>>>>>>> </content>
>>>>>>> </Window>
>>>>>>>
>>>>>>> Even with a padding of 100 it doesn't appear to do anything
>>>>>>> different from not
>>>>>>> having padding specified at all.
>>>>>>>
>>>>>>> And yes I do like to try and break code, it makes it more fun to
>>>>>>> learn that
>>>>>>> way :-)
>>>>>>>
>>>>>>> On Wed, 5 Aug 2009 08:36:10 am Todd Volkert wrote:
>>>>>>>>> Just a quick question, what does padding do? I change the  
>>>>>>>>> values
>>>>>>>>> and
>>>>>>>>> nothing
>>>>>>>>> appears to change.
>>>>>>>>
>>>>>>>> To what component are you applying the padding style?  The
>>>>>>>> component's skin
>>>>>>>> defines what styles it supports, by virtue of providing bean
>>>>>>>> properties, so
>>>>>>>> note that there are some component's for which padding is not a
>>>>>>>> supported
>>>>>>>> style.  For containers that support it, it generally means that
>>>>>>>> the
>>>>>>>> child
>>>>>>>> component(s) will be laid out inset from the container, and for
>>>>>>>> non-containers that support it (such as Label), it generally
>>>>>>>> means
>>>>>>>> that
>>>>>>>> their content (such as a label's text) will be inset from the
>>>>>>>> boundaries of
>>>>>>>> the component.
>>>>>>>>
>>>>>>>> -T
>


Re: Styles as an Element.

Posted by Scott Lanham <li...@sael.com.au>.
My knowledge of Pivot is not very good but for what it's worth, I maintain a 
generic java business objects library and have the problem of things being 
transferred between UI and back end objects using strings even though the 
native types are not always strings. I simply forced all business objects to 
have a string setter function as standard and managed to make it generic 
enough not to be a pain in the arse.

On Wed, 5 Aug 2009 12:39:40 pm Greg Brown wrote:
> Yeah. See my most recent reply. Suggesting the styles element was an
> error on my part.  :-P  It works in some cases, but not here.
>
> We could potentially add a getType(K):Class<?> method to Dictionary,
> but that doesn't seem right: Dictionary is already a generic, so we
> should know what its value type is. We might define a TypedDictionary
> interface that extends Dictionary, but that also seems a little hokey.
> Maybe there is an elegant way to do it, though...I'll give it some
> thought. Suggestions welcome.
>
> G
>
> On Aug 4, 2009, at 10:28 PM, Scott Lanham wrote:
> > Yep the styles attribute worked. Using the styles element showed a
> > runtime
> > error of:
> >
> > 	padding" is not a valid style for org.apache.pivot.wtk.BoxPane#2
> >
> > On Wed, 5 Aug 2009 12:14:02 pm Greg Brown wrote:
> >> Try setting it via the styles attribute and you should see the
> >> expected behavior. Seems like there might be an issue setting it
> >> via a
> >> styles element.
> >>
> >> On Aug 4, 2009, at 7:47 PM, Scott Lanham wrote:
> >>> Tried right/left top/bottom and the buttons were up against the
> >>> window border.
> >>>
> >>> On Wed, 5 Aug 2009 09:22:34 am Greg Brown wrote:
> >>>> You might not see the effect padding has since you are using center
> >>>> alignments. Try right or left (or top/bottom).
> >>>>
> >>>> On Aug 4, 2009, at 6:43 PM, Scott Lanham wrote:
> >>>>> I am playing with the Toggle Buttons part of the tutorial. After
> >>>>> changes the
> >>>>> WTKX file looks like:
> >>>>>
> >>>>> <Window title="Toggle Buttons" maximized="true"
> >>>>>  xmlns:wtkx="http://pivot.apache.org/wtkx"
> >>>>>  xmlns:content="org.apache.pivot.wtk.content"
> >>>>>  xmlns="org.apache.pivot.wtk">
> >>>>>  <content>
> >>>>>      <BoxPane>
> >>>>>          <styles padding="100" horizontalAlignment="center"
> >>>>> verticalAlignment="center"/>
> >>>>>          <PushButton toggleButton="true">
> >>>>>              <buttonData>
> >>>>>                  <content:ButtonData text="Anchor"
> >>>>> icon="@clock.png"/>
> >>>>>              </buttonData>
> >>>>>          </PushButton>
> >>>>>          <PushButton toggleButton="true">
> >>>>>              <buttonData>
> >>>>>                  <content:ButtonData text="Cup"/>
> >>>>>              </buttonData>
> >>>>>          </PushButton>
> >>>>>          <PushButton toggleButton="true">
> >>>>>              <buttonData>
> >>>>>                  <content:ButtonData text="Star"/>
> >>>>>              </buttonData>
> >>>>>          </PushButton>
> >>>>>      </BoxPane>
> >>>>>  </content>
> >>>>> </Window>
> >>>>>
> >>>>> Even with a padding of 100 it doesn't appear to do anything
> >>>>> different from not
> >>>>> having padding specified at all.
> >>>>>
> >>>>> And yes I do like to try and break code, it makes it more fun to
> >>>>> learn that
> >>>>> way :-)
> >>>>>
> >>>>> On Wed, 5 Aug 2009 08:36:10 am Todd Volkert wrote:
> >>>>>>> Just a quick question, what does padding do? I change the values
> >>>>>>> and
> >>>>>>> nothing
> >>>>>>> appears to change.
> >>>>>>
> >>>>>> To what component are you applying the padding style?  The
> >>>>>> component's skin
> >>>>>> defines what styles it supports, by virtue of providing bean
> >>>>>> properties, so
> >>>>>> note that there are some component's for which padding is not a
> >>>>>> supported
> >>>>>> style.  For containers that support it, it generally means that
> >>>>>> the
> >>>>>> child
> >>>>>> component(s) will be laid out inset from the container, and for
> >>>>>> non-containers that support it (such as Label), it generally
> >>>>>> means
> >>>>>> that
> >>>>>> their content (such as a label's text) will be inset from the
> >>>>>> boundaries of
> >>>>>> the component.
> >>>>>>
> >>>>>> -T


Re: Styles as an Element.

Posted by Greg Brown <gk...@mac.com>.
Yeah. See my most recent reply. Suggesting the styles element was an  
error on my part.  :-P  It works in some cases, but not here.

We could potentially add a getType(K):Class<?> method to Dictionary,  
but that doesn't seem right: Dictionary is already a generic, so we  
should know what its value type is. We might define a TypedDictionary  
interface that extends Dictionary, but that also seems a little hokey.  
Maybe there is an elegant way to do it, though...I'll give it some  
thought. Suggestions welcome.

G


On Aug 4, 2009, at 10:28 PM, Scott Lanham wrote:

> Yep the styles attribute worked. Using the styles element showed a  
> runtime
> error of:
>
> 	padding" is not a valid style for org.apache.pivot.wtk.BoxPane#2
>
> On Wed, 5 Aug 2009 12:14:02 pm Greg Brown wrote:
>> Try setting it via the styles attribute and you should see the
>> expected behavior. Seems like there might be an issue setting it  
>> via a
>> styles element.
>>
>> On Aug 4, 2009, at 7:47 PM, Scott Lanham wrote:
>>> Tried right/left top/bottom and the buttons were up against the
>>> window border.
>>>
>>> On Wed, 5 Aug 2009 09:22:34 am Greg Brown wrote:
>>>> You might not see the effect padding has since you are using center
>>>> alignments. Try right or left (or top/bottom).
>>>>
>>>> On Aug 4, 2009, at 6:43 PM, Scott Lanham wrote:
>>>>> I am playing with the Toggle Buttons part of the tutorial. After
>>>>> changes the
>>>>> WTKX file looks like:
>>>>>
>>>>> <Window title="Toggle Buttons" maximized="true"
>>>>>  xmlns:wtkx="http://pivot.apache.org/wtkx"
>>>>>  xmlns:content="org.apache.pivot.wtk.content"
>>>>>  xmlns="org.apache.pivot.wtk">
>>>>>  <content>
>>>>>      <BoxPane>
>>>>>          <styles padding="100" horizontalAlignment="center"
>>>>> verticalAlignment="center"/>
>>>>>          <PushButton toggleButton="true">
>>>>>              <buttonData>
>>>>>                  <content:ButtonData text="Anchor"
>>>>> icon="@clock.png"/>
>>>>>              </buttonData>
>>>>>          </PushButton>
>>>>>          <PushButton toggleButton="true">
>>>>>              <buttonData>
>>>>>                  <content:ButtonData text="Cup"/>
>>>>>              </buttonData>
>>>>>          </PushButton>
>>>>>          <PushButton toggleButton="true">
>>>>>              <buttonData>
>>>>>                  <content:ButtonData text="Star"/>
>>>>>              </buttonData>
>>>>>          </PushButton>
>>>>>      </BoxPane>
>>>>>  </content>
>>>>> </Window>
>>>>>
>>>>> Even with a padding of 100 it doesn't appear to do anything
>>>>> different from not
>>>>> having padding specified at all.
>>>>>
>>>>> And yes I do like to try and break code, it makes it more fun to
>>>>> learn that
>>>>> way :-)
>>>>>
>>>>> On Wed, 5 Aug 2009 08:36:10 am Todd Volkert wrote:
>>>>>>> Just a quick question, what does padding do? I change the values
>>>>>>> and
>>>>>>> nothing
>>>>>>> appears to change.
>>>>>>
>>>>>> To what component are you applying the padding style?  The
>>>>>> component's skin
>>>>>> defines what styles it supports, by virtue of providing bean
>>>>>> properties, so
>>>>>> note that there are some component's for which padding is not a
>>>>>> supported
>>>>>> style.  For containers that support it, it generally means that  
>>>>>> the
>>>>>> child
>>>>>> component(s) will be laid out inset from the container, and for
>>>>>> non-containers that support it (such as Label), it generally  
>>>>>> means
>>>>>> that
>>>>>> their content (such as a label's text) will be inset from the
>>>>>> boundaries of
>>>>>> the component.
>>>>>>
>>>>>> -T
>


Re: Styles as an Element.

Posted by Greg Brown <gk...@mac.com>.
Yeah. See my most recent reply. Suggesting the styles element was an  
error on my part.  :-P  It works in some cases, but not here.

We could potentially add a getType(K):Class<?> method to Dictionary,  
but that doesn't seem right: Dictionary is already a generic, so we  
should know what its value type is. We might define a TypedDictionary  
interface that extends Dictionary, but that also seems a little hokey.  
Maybe there is an elegant way to do it, though...I'll give it some  
thought. Suggestions welcome.

G


On Aug 4, 2009, at 10:28 PM, Scott Lanham wrote:

> Yep the styles attribute worked. Using the styles element showed a  
> runtime
> error of:
>
> 	padding" is not a valid style for org.apache.pivot.wtk.BoxPane#2
>
> On Wed, 5 Aug 2009 12:14:02 pm Greg Brown wrote:
>> Try setting it via the styles attribute and you should see the
>> expected behavior. Seems like there might be an issue setting it  
>> via a
>> styles element.
>>
>> On Aug 4, 2009, at 7:47 PM, Scott Lanham wrote:
>>> Tried right/left top/bottom and the buttons were up against the
>>> window border.
>>>
>>> On Wed, 5 Aug 2009 09:22:34 am Greg Brown wrote:
>>>> You might not see the effect padding has since you are using center
>>>> alignments. Try right or left (or top/bottom).
>>>>
>>>> On Aug 4, 2009, at 6:43 PM, Scott Lanham wrote:
>>>>> I am playing with the Toggle Buttons part of the tutorial. After
>>>>> changes the
>>>>> WTKX file looks like:
>>>>>
>>>>> <Window title="Toggle Buttons" maximized="true"
>>>>>  xmlns:wtkx="http://pivot.apache.org/wtkx"
>>>>>  xmlns:content="org.apache.pivot.wtk.content"
>>>>>  xmlns="org.apache.pivot.wtk">
>>>>>  <content>
>>>>>      <BoxPane>
>>>>>          <styles padding="100" horizontalAlignment="center"
>>>>> verticalAlignment="center"/>
>>>>>          <PushButton toggleButton="true">
>>>>>              <buttonData>
>>>>>                  <content:ButtonData text="Anchor"
>>>>> icon="@clock.png"/>
>>>>>              </buttonData>
>>>>>          </PushButton>
>>>>>          <PushButton toggleButton="true">
>>>>>              <buttonData>
>>>>>                  <content:ButtonData text="Cup"/>
>>>>>              </buttonData>
>>>>>          </PushButton>
>>>>>          <PushButton toggleButton="true">
>>>>>              <buttonData>
>>>>>                  <content:ButtonData text="Star"/>
>>>>>              </buttonData>
>>>>>          </PushButton>
>>>>>      </BoxPane>
>>>>>  </content>
>>>>> </Window>
>>>>>
>>>>> Even with a padding of 100 it doesn't appear to do anything
>>>>> different from not
>>>>> having padding specified at all.
>>>>>
>>>>> And yes I do like to try and break code, it makes it more fun to
>>>>> learn that
>>>>> way :-)
>>>>>
>>>>> On Wed, 5 Aug 2009 08:36:10 am Todd Volkert wrote:
>>>>>>> Just a quick question, what does padding do? I change the values
>>>>>>> and
>>>>>>> nothing
>>>>>>> appears to change.
>>>>>>
>>>>>> To what component are you applying the padding style?  The
>>>>>> component's skin
>>>>>> defines what styles it supports, by virtue of providing bean
>>>>>> properties, so
>>>>>> note that there are some component's for which padding is not a
>>>>>> supported
>>>>>> style.  For containers that support it, it generally means that  
>>>>>> the
>>>>>> child
>>>>>> component(s) will be laid out inset from the container, and for
>>>>>> non-containers that support it (such as Label), it generally  
>>>>>> means
>>>>>> that
>>>>>> their content (such as a label's text) will be inset from the
>>>>>> boundaries of
>>>>>> the component.
>>>>>>
>>>>>> -T
>


Re: Styles as an Element.

Posted by Scott Lanham <li...@sael.com.au>.
Yep the styles attribute worked. Using the styles element showed a runtime 
error of: 

	padding" is not a valid style for org.apache.pivot.wtk.BoxPane#2

On Wed, 5 Aug 2009 12:14:02 pm Greg Brown wrote:
> Try setting it via the styles attribute and you should see the
> expected behavior. Seems like there might be an issue setting it via a
> styles element.
>
> On Aug 4, 2009, at 7:47 PM, Scott Lanham wrote:
> > Tried right/left top/bottom and the buttons were up against the
> > window border.
> >
> > On Wed, 5 Aug 2009 09:22:34 am Greg Brown wrote:
> >> You might not see the effect padding has since you are using center
> >> alignments. Try right or left (or top/bottom).
> >>
> >> On Aug 4, 2009, at 6:43 PM, Scott Lanham wrote:
> >>> I am playing with the Toggle Buttons part of the tutorial. After
> >>> changes the
> >>> WTKX file looks like:
> >>>
> >>> <Window title="Toggle Buttons" maximized="true"
> >>>   xmlns:wtkx="http://pivot.apache.org/wtkx"
> >>>   xmlns:content="org.apache.pivot.wtk.content"
> >>>   xmlns="org.apache.pivot.wtk">
> >>>   <content>
> >>>       <BoxPane>
> >>>           <styles padding="100" horizontalAlignment="center"
> >>> verticalAlignment="center"/>
> >>>           <PushButton toggleButton="true">
> >>>               <buttonData>
> >>>                   <content:ButtonData text="Anchor"
> >>> icon="@clock.png"/>
> >>>               </buttonData>
> >>>           </PushButton>
> >>>           <PushButton toggleButton="true">
> >>>               <buttonData>
> >>>                   <content:ButtonData text="Cup"/>
> >>>               </buttonData>
> >>>           </PushButton>
> >>>           <PushButton toggleButton="true">
> >>>               <buttonData>
> >>>                   <content:ButtonData text="Star"/>
> >>>               </buttonData>
> >>>           </PushButton>
> >>>       </BoxPane>
> >>>   </content>
> >>> </Window>
> >>>
> >>> Even with a padding of 100 it doesn't appear to do anything
> >>> different from not
> >>> having padding specified at all.
> >>>
> >>> And yes I do like to try and break code, it makes it more fun to
> >>> learn that
> >>> way :-)
> >>>
> >>> On Wed, 5 Aug 2009 08:36:10 am Todd Volkert wrote:
> >>>>> Just a quick question, what does padding do? I change the values
> >>>>> and
> >>>>> nothing
> >>>>> appears to change.
> >>>>
> >>>> To what component are you applying the padding style?  The
> >>>> component's skin
> >>>> defines what styles it supports, by virtue of providing bean
> >>>> properties, so
> >>>> note that there are some component's for which padding is not a
> >>>> supported
> >>>> style.  For containers that support it, it generally means that the
> >>>> child
> >>>> component(s) will be laid out inset from the container, and for
> >>>> non-containers that support it (such as Label), it generally means
> >>>> that
> >>>> their content (such as a label's text) will be inset from the
> >>>> boundaries of
> >>>> the component.
> >>>>
> >>>> -T


Re: Styles as an Element.

Posted by Greg Brown <gk...@mac.com>.
Try setting it via the styles attribute and you should see the  
expected behavior. Seems like there might be an issue setting it via a  
styles element.

On Aug 4, 2009, at 7:47 PM, Scott Lanham wrote:

> Tried right/left top/bottom and the buttons were up against the  
> window border.
>
> On Wed, 5 Aug 2009 09:22:34 am Greg Brown wrote:
>> You might not see the effect padding has since you are using center
>> alignments. Try right or left (or top/bottom).
>>
>> On Aug 4, 2009, at 6:43 PM, Scott Lanham wrote:
>>> I am playing with the Toggle Buttons part of the tutorial. After
>>> changes the
>>> WTKX file looks like:
>>>
>>> <Window title="Toggle Buttons" maximized="true"
>>>   xmlns:wtkx="http://pivot.apache.org/wtkx"
>>>   xmlns:content="org.apache.pivot.wtk.content"
>>>   xmlns="org.apache.pivot.wtk">
>>>   <content>
>>>       <BoxPane>
>>>           <styles padding="100" horizontalAlignment="center"
>>> verticalAlignment="center"/>
>>>           <PushButton toggleButton="true">
>>>               <buttonData>
>>>                   <content:ButtonData text="Anchor"
>>> icon="@clock.png"/>
>>>               </buttonData>
>>>           </PushButton>
>>>           <PushButton toggleButton="true">
>>>               <buttonData>
>>>                   <content:ButtonData text="Cup"/>
>>>               </buttonData>
>>>           </PushButton>
>>>           <PushButton toggleButton="true">
>>>               <buttonData>
>>>                   <content:ButtonData text="Star"/>
>>>               </buttonData>
>>>           </PushButton>
>>>       </BoxPane>
>>>   </content>
>>> </Window>
>>>
>>> Even with a padding of 100 it doesn't appear to do anything
>>> different from not
>>> having padding specified at all.
>>>
>>> And yes I do like to try and break code, it makes it more fun to
>>> learn that
>>> way :-)
>>>
>>> On Wed, 5 Aug 2009 08:36:10 am Todd Volkert wrote:
>>>>> Just a quick question, what does padding do? I change the values  
>>>>> and
>>>>> nothing
>>>>> appears to change.
>>>>
>>>> To what component are you applying the padding style?  The
>>>> component's skin
>>>> defines what styles it supports, by virtue of providing bean
>>>> properties, so
>>>> note that there are some component's for which padding is not a
>>>> supported
>>>> style.  For containers that support it, it generally means that the
>>>> child
>>>> component(s) will be laid out inset from the container, and for
>>>> non-containers that support it (such as Label), it generally means
>>>> that
>>>> their content (such as a label's text) will be inset from the
>>>> boundaries of
>>>> the component.
>>>>
>>>> -T
>


Re: Styles as an Element.

Posted by Greg Brown <gk...@mac.com>.
OK, scratch the styles element suggestion. It doesn't work - I knew I  
should have done a little more due diligence before replying to your  
email.  :-)

When an element refers to a read-only dictionary, we can't determine  
the type of the properties referred to by the element's attributes  
(because Dictionary doesn't provide a "getType()" method). So, we  
can't coerce it to the appropriate type. As a result, read-only  
dictionary properties are set as strings, since that is how attribute  
values are inherently typed. You should be seeing an error in the  
console telling you that "padding is not a valid style" - correct?  
That's because we're trying to call a string setter for padding, and  
it doesn't exist.

So, kudos to you for pushing WTKX to see what you can and can't do.  
Unfortunately, you can't do this.  :-)

On Aug 4, 2009, at 7:47 PM, Scott Lanham wrote:

> Tried right/left top/bottom and the buttons were up against the  
> window border.
>
> On Wed, 5 Aug 2009 09:22:34 am Greg Brown wrote:
>> You might not see the effect padding has since you are using center
>> alignments. Try right or left (or top/bottom).
>>
>> On Aug 4, 2009, at 6:43 PM, Scott Lanham wrote:
>>> I am playing with the Toggle Buttons part of the tutorial. After
>>> changes the
>>> WTKX file looks like:
>>>
>>> <Window title="Toggle Buttons" maximized="true"
>>>   xmlns:wtkx="http://pivot.apache.org/wtkx"
>>>   xmlns:content="org.apache.pivot.wtk.content"
>>>   xmlns="org.apache.pivot.wtk">
>>>   <content>
>>>       <BoxPane>
>>>           <styles padding="100" horizontalAlignment="center"
>>> verticalAlignment="center"/>
>>>           <PushButton toggleButton="true">
>>>               <buttonData>
>>>                   <content:ButtonData text="Anchor"
>>> icon="@clock.png"/>
>>>               </buttonData>
>>>           </PushButton>
>>>           <PushButton toggleButton="true">
>>>               <buttonData>
>>>                   <content:ButtonData text="Cup"/>
>>>               </buttonData>
>>>           </PushButton>
>>>           <PushButton toggleButton="true">
>>>               <buttonData>
>>>                   <content:ButtonData text="Star"/>
>>>               </buttonData>
>>>           </PushButton>
>>>       </BoxPane>
>>>   </content>
>>> </Window>
>>>
>>> Even with a padding of 100 it doesn't appear to do anything
>>> different from not
>>> having padding specified at all.
>>>
>>> And yes I do like to try and break code, it makes it more fun to
>>> learn that
>>> way :-)
>>>
>>> On Wed, 5 Aug 2009 08:36:10 am Todd Volkert wrote:
>>>>> Just a quick question, what does padding do? I change the values  
>>>>> and
>>>>> nothing
>>>>> appears to change.
>>>>
>>>> To what component are you applying the padding style?  The
>>>> component's skin
>>>> defines what styles it supports, by virtue of providing bean
>>>> properties, so
>>>> note that there are some component's for which padding is not a
>>>> supported
>>>> style.  For containers that support it, it generally means that the
>>>> child
>>>> component(s) will be laid out inset from the container, and for
>>>> non-containers that support it (such as Label), it generally means
>>>> that
>>>> their content (such as a label's text) will be inset from the
>>>> boundaries of
>>>> the component.
>>>>
>>>> -T
>


Re: Styles as an Element.

Posted by Scott Lanham <li...@sael.com.au>.
Tried right/left top/bottom and the buttons were up against the window border.

On Wed, 5 Aug 2009 09:22:34 am Greg Brown wrote:
> You might not see the effect padding has since you are using center
> alignments. Try right or left (or top/bottom).
>
> On Aug 4, 2009, at 6:43 PM, Scott Lanham wrote:
> > I am playing with the Toggle Buttons part of the tutorial. After
> > changes the
> > WTKX file looks like:
> >
> > <Window title="Toggle Buttons" maximized="true"
> >    xmlns:wtkx="http://pivot.apache.org/wtkx"
> >    xmlns:content="org.apache.pivot.wtk.content"
> >    xmlns="org.apache.pivot.wtk">
> >    <content>
> >        <BoxPane>
> >            <styles padding="100" horizontalAlignment="center"
> > verticalAlignment="center"/>
> >            <PushButton toggleButton="true">
> >                <buttonData>
> >                    <content:ButtonData text="Anchor"
> > icon="@clock.png"/>
> >                </buttonData>
> >            </PushButton>
> >            <PushButton toggleButton="true">
> >                <buttonData>
> >                    <content:ButtonData text="Cup"/>
> >                </buttonData>
> >            </PushButton>
> >            <PushButton toggleButton="true">
> >                <buttonData>
> >                    <content:ButtonData text="Star"/>
> >                </buttonData>
> >            </PushButton>
> >        </BoxPane>
> >    </content>
> > </Window>
> >
> > Even with a padding of 100 it doesn't appear to do anything
> > different from not
> > having padding specified at all.
> >
> > And yes I do like to try and break code, it makes it more fun to
> > learn that
> > way :-)
> >
> > On Wed, 5 Aug 2009 08:36:10 am Todd Volkert wrote:
> >>> Just a quick question, what does padding do? I change the values and
> >>> nothing
> >>> appears to change.
> >>
> >> To what component are you applying the padding style?  The
> >> component's skin
> >> defines what styles it supports, by virtue of providing bean
> >> properties, so
> >> note that there are some component's for which padding is not a
> >> supported
> >> style.  For containers that support it, it generally means that the
> >> child
> >> component(s) will be laid out inset from the container, and for
> >> non-containers that support it (such as Label), it generally means
> >> that
> >> their content (such as a label's text) will be inset from the
> >> boundaries of
> >> the component.
> >>
> >> -T


Re: Styles as an Element.

Posted by Greg Brown <gk...@mac.com>.
You might not see the effect padding has since you are using center  
alignments. Try right or left (or top/bottom).

On Aug 4, 2009, at 6:43 PM, Scott Lanham wrote:

> I am playing with the Toggle Buttons part of the tutorial. After  
> changes the
> WTKX file looks like:
>
> <Window title="Toggle Buttons" maximized="true"
>    xmlns:wtkx="http://pivot.apache.org/wtkx"
>    xmlns:content="org.apache.pivot.wtk.content"
>    xmlns="org.apache.pivot.wtk">
>    <content>
>        <BoxPane>
>            <styles padding="100" horizontalAlignment="center"
> verticalAlignment="center"/>
>            <PushButton toggleButton="true">
>                <buttonData>
>                    <content:ButtonData text="Anchor"  
> icon="@clock.png"/>
>                </buttonData>
>            </PushButton>
>            <PushButton toggleButton="true">
>                <buttonData>
>                    <content:ButtonData text="Cup"/>
>                </buttonData>
>            </PushButton>
>            <PushButton toggleButton="true">
>                <buttonData>
>                    <content:ButtonData text="Star"/>
>                </buttonData>
>            </PushButton>
>        </BoxPane>
>    </content>
> </Window>
>
> Even with a padding of 100 it doesn't appear to do anything  
> different from not
> having padding specified at all.
>
> And yes I do like to try and break code, it makes it more fun to  
> learn that
> way :-)
>
> On Wed, 5 Aug 2009 08:36:10 am Todd Volkert wrote:
>>> Just a quick question, what does padding do? I change the values and
>>> nothing
>>> appears to change.
>>
>> To what component are you applying the padding style?  The  
>> component's skin
>> defines what styles it supports, by virtue of providing bean  
>> properties, so
>> note that there are some component's for which padding is not a  
>> supported
>> style.  For containers that support it, it generally means that the  
>> child
>> component(s) will be laid out inset from the container, and for
>> non-containers that support it (such as Label), it generally means  
>> that
>> their content (such as a label's text) will be inset from the  
>> boundaries of
>> the component.
>>
>> -T
>


Re: Styles as an Element.

Posted by Scott Lanham <li...@sael.com.au>.
I am playing with the Toggle Buttons part of the tutorial. After changes the 
WTKX file looks like:

<Window title="Toggle Buttons" maximized="true"
    xmlns:wtkx="http://pivot.apache.org/wtkx"
    xmlns:content="org.apache.pivot.wtk.content"
    xmlns="org.apache.pivot.wtk">
    <content>
        <BoxPane>
            <styles padding="100" horizontalAlignment="center" 
verticalAlignment="center"/>
            <PushButton toggleButton="true">
                <buttonData>
                    <content:ButtonData text="Anchor" icon="@clock.png"/>
                </buttonData>
            </PushButton>
            <PushButton toggleButton="true">
                <buttonData>
                    <content:ButtonData text="Cup"/>
                </buttonData>
            </PushButton>
            <PushButton toggleButton="true">
                <buttonData>
                    <content:ButtonData text="Star"/>
                </buttonData>
            </PushButton>
        </BoxPane>
    </content>
</Window>

Even with a padding of 100 it doesn't appear to do anything different from not 
having padding specified at all.

And yes I do like to try and break code, it makes it more fun to learn that 
way :-)

On Wed, 5 Aug 2009 08:36:10 am Todd Volkert wrote:
> > Just a quick question, what does padding do? I change the values and
> > nothing
> > appears to change.
>
> To what component are you applying the padding style?  The component's skin
> defines what styles it supports, by virtue of providing bean properties, so
> note that there are some component's for which padding is not a supported
> style.  For containers that support it, it generally means that the child
> component(s) will be laid out inset from the container, and for
> non-containers that support it (such as Label), it generally means that
> their content (such as a label's text) will be inset from the boundaries of
> the component.
>
> -T


Re: Styles as an Element.

Posted by Todd Volkert <tv...@gmail.com>.
> Just a quick question, what does padding do? I change the values and
> nothing
> appears to change.


To what component are you applying the padding style?  The component's skin
defines what styles it supports, by virtue of providing bean properties, so
note that there are some component's for which padding is not a supported
style.  For containers that support it, it generally means that the child
component(s) will be laid out inset from the container, and for
non-containers that support it (such as Label), it generally means that
their content (such as a label's text) will be inset from the boundaries of
the component.

-T

Re: Styles as an Element.

Posted by Scott Lanham <li...@sael.com.au>.
Thanks, that works. I didn't get that far in the doc before trying to mess 
with the code.

Just a quick question, what does padding do? I change the values and nothing 
appears to change.

On Wed, 5 Aug 2009 08:04:48 am Greg Brown wrote:
> Just a little more detail - the reason is that the "styles" property
> refers to a read-only dictionary. Text node content is only supported
> for string setter properties.
>
> But, you could set your styles like this:
>
> <styles padding="10" horizontalAlignment="center"
> verticalAlignment="center"/>
>
> On Aug 4, 2009, at 5:50 PM, Scott Lanham wrote:
> > Howdy,
> >
> > I am working through the WTKX Primer doc and saw the part about how
> > properties
> > could either be specified as an attribute or as an element. So I
> > thought I
> > would pull the styles property out into an element to see what
> > happens:
> >
> > <styles>{padding:10, horizontalAlignment:'center',
> > verticalAlignment:'center'}</styles>
> >
> > Except this gives a runtime error:
> >
> > 	org.apache.pivot.serialization.SerializationException: Unexpected
> > characters
> > in READ_ONLY_PROPERTY element.
> >
> > I can't see why this shouldn't work, but that doesn't mean much ;-)
> >
> > Many Thanks,
> >
> > Scott.


Re: Styles as an Element.

Posted by Greg Brown <gk...@mac.com>.
Just a little more detail - the reason is that the "styles" property  
refers to a read-only dictionary. Text node content is only supported  
for string setter properties.

But, you could set your styles like this:

<styles padding="10" horizontalAlignment="center"  
verticalAlignment="center"/>


On Aug 4, 2009, at 5:50 PM, Scott Lanham wrote:

> Howdy,
>
> I am working through the WTKX Primer doc and saw the part about how  
> properties
> could either be specified as an attribute or as an element. So I  
> thought I
> would pull the styles property out into an element to see what  
> happens:
>
> <styles>{padding:10, horizontalAlignment:'center',
> verticalAlignment:'center'}</styles>
>
> Except this gives a runtime error:
>
> 	org.apache.pivot.serialization.SerializationException: Unexpected  
> characters
> in READ_ONLY_PROPERTY element.
>
> I can't see why this shouldn't work, but that doesn't mean much ;-)
>
> Many Thanks,
>
> Scott.