You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by al...@synacom.com.bo on 2010/04/14 21:12:59 UTC
Setting the initial window state in a Desktop App
Hi,
I'm developing a Desktop app, and I want start my app in a
particular state(e.g. maximized), searching on the mailing list I found this
thread:
http://mail-archives.apache.org/mod_mbox//incubator-pivot-user/200906.mbox/%
3CDD124263-D8F1-4C8D-BC35-00765DAB36D9@mac.com%3E
<http://mail-archives.apache.org/mod_mbox/incubator-pivot-user/200906.mbox/%
3CDD124263-D8F1-4C8D-BC35-00765DAB36D9@mac.com%3E>
There is no way to start a window(AWT) in a particular state in Pivot's
current version?
Looking in the code I found the DesktopApplicationContext class where the
hostFrame(AWT frame) properties are assigned, there are some arguments such
as CENTER_ARGUMENT, RESIZABLE_ARGUMENT, FULL_SCREEN_ARGUMENT and so on.
Then, it would be possible to add an extra argument as "initial state" to
allow the application start with that state?
For example (DesktopApplicationContext.java):
...
private static final String FULL_SCREEN_ARGUMENT = "fullScreen";
private static final String INITIAL_STATE_ARGUMENT = "initialState";
.
boolean fullScreen = false;
int initialState = 0; //Normal Frame State
.
else if (key.equals(FULL_SCREEN_ARGUMENT)) {
fullScreen = Boolean.parseBoolean(value);
} else if (key.equals(INITIAL_STATE_ARGUMENT)) {
initialState = Integer.parseInt(value);
}
...
windowedHostFrame.setExtendedState(initialState);
and use something like(e.g. maximized): --initialState=6
Cheers,
Alejandro
Re: Setting the initial window state in a Desktop App
Posted by Greg Brown <gk...@mac.com>.
You could submit a patch. You would need to add the MAXIMIZED_ARGUMENT constant and modify main() to call setExtendedState() on the host frame. You can submit your patch via a JIRA ticket (enter it as a new feature).
On Apr 14, 2010, at 8:12 PM, alejandro.vilar@synacom.com.bo wrote:
> Hi Greg, I agree with you,… so this argument will be included? There a way that I can to help on this?
>
> Thanks
> -a
>
> From: Greg Brown [mailto:gkbrown@mac.com]
> Sent: Miércoles, 14 de Abril de 2010 04:05 p.m.
> To: user@pivot.apache.org
> Subject: Re: Setting the initial window state in a Desktop App
>
> Might a --maximized=true argument be sufficient?
>
> On Apr 14, 2010, at 3:12 PM, alejandro.vilar@synacom.com.bo wrote:
>
>
> Hi,
> I’m developing a Desktop app, and I want start my app in a particular state(e.g. maximized), searching on the mailing list I found this thread:
> http://mail-archives.apache.org/mod_mbox//incubator-pivot-user/200906.mbox/%3CDD124263-D8F1-4C8D-BC35-00765DAB36D9@mac.com%3E
>
> There is no way to start a window(AWT) in a particular state in Pivot’s current version?
>
> Looking in the code I found the DesktopApplicationContext class where the hostFrame(AWT frame) properties are assigned, there are some arguments such as CENTER_ARGUMENT, RESIZABLE_ARGUMENT, FULL_SCREEN_ARGUMENT and so on… Then, it would be possible to add an extra argument as "initial state" to allow the application start with that state?
>
> For example (DesktopApplicationContext.java):
> ...
> private static final String FULL_SCREEN_ARGUMENT = "fullScreen";
> private static final String INITIAL_STATE_ARGUMENT = "initialState";
> …
> boolean fullScreen = false;
> int initialState = 0; //Normal Frame State
> …
> else if (key.equals(FULL_SCREEN_ARGUMENT)) {
> fullScreen = Boolean.parseBoolean(value);
> } else if (key.equals(INITIAL_STATE_ARGUMENT)) {
> initialState = Integer.parseInt(value);
> }
> …..
> windowedHostFrame.setExtendedState(initialState);
>
>
> and use something like(e.g. maximized): --initialState=6
>
>
> Cheers,
> Alejandro
>
RE: Setting the initial window state in a Desktop App
Posted by al...@synacom.com.bo.
Hi Greg, I agree with you,
so this argument will be included? There a way
that I can to help on this?
Thanks
-a
From: Greg Brown [mailto:gkbrown@mac.com]
Sent: Miércoles, 14 de Abril de 2010 04:05 p.m.
To: user@pivot.apache.org
Subject: Re: Setting the initial window state in a Desktop App
Might a --maximized=true argument be sufficient?
On Apr 14, 2010, at 3:12 PM, alejandro.vilar@synacom.com.bo wrote:
Hi,
Im developing a Desktop app, and I want start my app in a
particular state(e.g. maximized), searching on the mailing list I found this
thread:
http://mail-archives.apache.org/mod_mbox//incubator-pivot-user/200906.mbox/%
3CDD124263-D8F1-4C8D-BC35-00765DAB36D9@mac.com%3E
<http://mail-archives.apache.org/mod_mbox/incubator-pivot-user/200906.mbox/%
3CDD124263-D8F1-4C8D-BC35-00765DAB36D9@mac.com%3E>
There is no way to start a window(AWT) in a particular state in Pivots
current version?
Looking in the code I found the DesktopApplicationContext class where the
hostFrame(AWT frame) properties are assigned, there are some arguments such
as CENTER_ARGUMENT, RESIZABLE_ARGUMENT, FULL_SCREEN_ARGUMENT and so on
Then, it would be possible to add an extra argument as "initial state" to
allow the application start with that state?
For example (DesktopApplicationContext.java):
...
private static final String FULL_SCREEN_ARGUMENT = "fullScreen";
private static final String INITIAL_STATE_ARGUMENT = "initialState";
boolean fullScreen = false;
int initialState = 0; //Normal Frame State
else if (key.equals(FULL_SCREEN_ARGUMENT)) {
fullScreen = Boolean.parseBoolean(value);
} else if (key.equals(INITIAL_STATE_ARGUMENT)) {
initialState = Integer.parseInt(value);
}
..
windowedHostFrame.setExtendedState(initialState);
and use something like(e.g. maximized): --initialState=6
Cheers,
Alejandro
Re: Setting the initial window state in a Desktop App
Posted by Greg Brown <gk...@mac.com>.
Might a --maximized=true argument be sufficient?
On Apr 14, 2010, at 3:12 PM, alejandro.vilar@synacom.com.bo wrote:
> Hi,
> I’m developing a Desktop app, and I want start my app in a particular state(e.g. maximized), searching on the mailing list I found this thread:
> http://mail-archives.apache.org/mod_mbox//incubator-pivot-user/200906.mbox/%3CDD124263-D8F1-4C8D-BC35-00765DAB36D9@mac.com%3E
>
> There is no way to start a window(AWT) in a particular state in Pivot’s current version?
>
> Looking in the code I found the DesktopApplicationContext class where the hostFrame(AWT frame) properties are assigned, there are some arguments such as CENTER_ARGUMENT, RESIZABLE_ARGUMENT, FULL_SCREEN_ARGUMENT and so on… Then, it would be possible to add an extra argument as "initial state" to allow the application start with that state?
>
> For example (DesktopApplicationContext.java):
> ...
> private static final String FULL_SCREEN_ARGUMENT = "fullScreen";
> private static final String INITIAL_STATE_ARGUMENT = "initialState";
> …
> boolean fullScreen = false;
> int initialState = 0; //Normal Frame State
> …
> else if (key.equals(FULL_SCREEN_ARGUMENT)) {
> fullScreen = Boolean.parseBoolean(value);
> } else if (key.equals(INITIAL_STATE_ARGUMENT)) {
> initialState = Integer.parseInt(value);
> }
> …..
> windowedHostFrame.setExtendedState(initialState);
>
>
> and use something like(e.g. maximized): --initialState=6
>
>
> Cheers,
> Alejandro
Re: Form setLabel
Posted by Shahzad Bhatti <sb...@peak6.com>.
Got it, thanks.
On 4/14/10 3:44 PM, "Greg Brown" <gk...@mac.com> wrote:
This example works because the <Label> tags are direct descendants of <Form.Section>. In your example, they were descendants of the <Border>.
On Apr 14, 2010, at 6:42 PM, Shahzad Bhatti wrote:
> Thanks, I modeled it after stocktracker.detail.wtkx that uses similar Label with Form.label, such as:
>
>
> <BoxPane wtkx:id="rootPane" orientation="vertical" styles="{fill:true}"
> xmlns:wtkx="http://pivot.apache.org/wtkx"
> xmlns="org.apache.pivot.wtk">
> <Label textKey="companyName" styles="{font:{size:12, bold:true}}"/>
> <Separator/>
> <Form styles="{rightAlignLabels:true, fill:true}">
> <sections>
> <Form.Section>
> <Label Form.label="%value" textKey="value"
> styles="{horizontalAlignment:'right'}"/>
> <Label wtkx:id="changeLabel" Form.label="%change" textKey="change"
> styles="{horizontalAlignment:'right'}"/>
> <Label Form.label="%openingValue" textKey="openingValue"
> styles="{horizontalAlignment:'right'}"/>
> <Label Form.label="%highValue" textKey="highValue"
> styles="{horizontalAlignment:'right'}"/>
> <Label Form.label="%lowValue" textKey="lowValue"
> styles="{horizontalAlignment:'right'}"/>
> <Label Form.label="%volume" textKey="volume"
> styles="{horizontalAlignment:'right'}"/>
> </Form.Section>
> </sections>
> </Form>
> </BoxPane>
>
> Why does above example work? Also, I removed Border and replaced with BoxPane.
>
>
> On 4/14/10 3:30 PM, "Greg Brown" <gk...@mac.com> wrote:
>
> I assume you are using Pivot 1.4? The problem is that the Label instances are not direct descendants of the Form.Section. In Pivot 1.4 and earlier, this throws an exception. In Pivot 1.5+, an exception is not thrown, but you still won't see the labels attached to your Label elements - forms only recognize labels attached to section children.
>
> Also, a Border can only have one content element. You'll need to nest a layout container in the Border instance if you want to display multiple child elements.
>
> On Apr 14, 2010, at 6:07 PM, Shahzad Bhatti wrote:
>
>> I am trying to use Label along with Form such as
>> <BoxPane styles="{horizontalAlignment:'left'}">
>> <Form wtkx:id="form" styles="{rightAlignLabels:true, fill:true}">
>> <sections>
>> <Form.Section>
>> <Border styles="{backgroundColor:null, padding:2}">
>> <content>
>> <Label Form.label="name" textKey="name" styles="{font:{size:12, bold:true}}"/>
>> </content>
>> </Border>
>> </Form.Section>
>> <Form.Section>
>> <Border styles="{backgroundColor:null, padding:2}">
>> <content>
>> <Label Form.label="symbol" textKey="symbol" styles="{horizontalAlignment:'right'}"/>
>> <Label Form.label="bid" textKey="bid" styles="{horizontalAlignment:'right'}"/>
>> <Label Form.label="ask" textKey="ask" styles="{horizontalAlignment:'right'}"/>
>> <Label wtkx:id="changeLabel" Form.label="change" textKey="change" styles="{horizontalAlignment:'right'}"/>
>> <Label Form.label="isExchangeDelayed" textKey="exchangeDelayed" styles="{horizontalAlignment:'right'}"/>
>> </content>
>> </Border>
>> </Form.Section>
>> ...
>>
>>
>> But I am getting following error:
>> Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) ... 19 more Caused by: java.lang.IllegalStateException at org.apache.pivot.wtk.Form.setLabel(Unknown Source) ... 23 more
>>
>>
>> Looking at the source, this happens when the attributes of component are null. Any idea how to fix it?
>>
>> Thanks.
>>
>>
>> ______________________________________________
>>
>> See http://www.peak6.com/email_disclaimer.php
>> for terms and conditions related to this email
>
>
Re: Form setLabel
Posted by Greg Brown <gk...@mac.com>.
This example works because the <Label> tags are direct descendants of <Form.Section>. In your example, they were descendants of the <Border>.
On Apr 14, 2010, at 6:42 PM, Shahzad Bhatti wrote:
> Thanks, I modeled it after stocktracker.detail.wtkx that uses similar Label with Form.label, such as:
>
>
> <BoxPane wtkx:id="rootPane" orientation="vertical" styles="{fill:true}"
> xmlns:wtkx="http://pivot.apache.org/wtkx"
> xmlns="org.apache.pivot.wtk">
> <Label textKey="companyName" styles="{font:{size:12, bold:true}}"/>
> <Separator/>
> <Form styles="{rightAlignLabels:true, fill:true}">
> <sections>
> <Form.Section>
> <Label Form.label="%value" textKey="value"
> styles="{horizontalAlignment:'right'}"/>
> <Label wtkx:id="changeLabel" Form.label="%change" textKey="change"
> styles="{horizontalAlignment:'right'}"/>
> <Label Form.label="%openingValue" textKey="openingValue"
> styles="{horizontalAlignment:'right'}"/>
> <Label Form.label="%highValue" textKey="highValue"
> styles="{horizontalAlignment:'right'}"/>
> <Label Form.label="%lowValue" textKey="lowValue"
> styles="{horizontalAlignment:'right'}"/>
> <Label Form.label="%volume" textKey="volume"
> styles="{horizontalAlignment:'right'}"/>
> </Form.Section>
> </sections>
> </Form>
> </BoxPane>
>
> Why does above example work? Also, I removed Border and replaced with BoxPane.
>
>
> On 4/14/10 3:30 PM, "Greg Brown" <gk...@mac.com> wrote:
>
> I assume you are using Pivot 1.4? The problem is that the Label instances are not direct descendants of the Form.Section. In Pivot 1.4 and earlier, this throws an exception. In Pivot 1.5+, an exception is not thrown, but you still won't see the labels attached to your Label elements - forms only recognize labels attached to section children.
>
> Also, a Border can only have one content element. You'll need to nest a layout container in the Border instance if you want to display multiple child elements.
>
> On Apr 14, 2010, at 6:07 PM, Shahzad Bhatti wrote:
>
>> I am trying to use Label along with Form such as
>> <BoxPane styles="{horizontalAlignment:'left'}">
>> <Form wtkx:id="form" styles="{rightAlignLabels:true, fill:true}">
>> <sections>
>> <Form.Section>
>> <Border styles="{backgroundColor:null, padding:2}">
>> <content>
>> <Label Form.label="name" textKey="name" styles="{font:{size:12, bold:true}}"/>
>> </content>
>> </Border>
>> </Form.Section>
>> <Form.Section>
>> <Border styles="{backgroundColor:null, padding:2}">
>> <content>
>> <Label Form.label="symbol" textKey="symbol" styles="{horizontalAlignment:'right'}"/>
>> <Label Form.label="bid" textKey="bid" styles="{horizontalAlignment:'right'}"/>
>> <Label Form.label="ask" textKey="ask" styles="{horizontalAlignment:'right'}"/>
>> <Label wtkx:id="changeLabel" Form.label="change" textKey="change" styles="{horizontalAlignment:'right'}"/>
>> <Label Form.label="isExchangeDelayed" textKey="exchangeDelayed" styles="{horizontalAlignment:'right'}"/>
>> </content>
>> </Border>
>> </Form.Section>
>> ...
>>
>>
>> But I am getting following error:
>> Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) ... 19 more Caused by: java.lang.IllegalStateException at org.apache.pivot.wtk.Form.setLabel(Unknown Source) ... 23 more
>>
>>
>> Looking at the source, this happens when the attributes of component are null. Any idea how to fix it?
>>
>> Thanks.
>>
>>
>> ______________________________________________
>>
>> See http://www.peak6.com/email_disclaimer.php
>> for terms and conditions related to this email
>
>
Re: Form setLabel
Posted by Shahzad Bhatti <sb...@peak6.com>.
Thanks, I modeled it after stocktracker.detail.wtkx that uses similar Label with Form.label, such as:
<BoxPane wtkx:id="rootPane" orientation="vertical" styles="{fill:true}"
xmlns:wtkx="http://pivot.apache.org/wtkx"
xmlns="org.apache.pivot.wtk">
<Label textKey="companyName" styles="{font:{size:12, bold:true}}"/>
<Separator/>
<Form styles="{rightAlignLabels:true, fill:true}">
<sections>
<Form.Section>
<Label Form.label="%value" textKey="value"
styles="{horizontalAlignment:'right'}"/>
<Label wtkx:id="changeLabel" Form.label="%change" textKey="change"
styles="{horizontalAlignment:'right'}"/>
<Label Form.label="%openingValue" textKey="openingValue"
styles="{horizontalAlignment:'right'}"/>
<Label Form.label="%highValue" textKey="highValue"
styles="{horizontalAlignment:'right'}"/>
<Label Form.label="%lowValue" textKey="lowValue"
styles="{horizontalAlignment:'right'}"/>
<Label Form.label="%volume" textKey="volume"
styles="{horizontalAlignment:'right'}"/>
</Form.Section>
</sections>
</Form>
</BoxPane>
Why does above example work? Also, I removed Border and replaced with BoxPane.
On 4/14/10 3:30 PM, "Greg Brown" <gk...@mac.com> wrote:
I assume you are using Pivot 1.4? The problem is that the Label instances are not direct descendants of the Form.Section. In Pivot 1.4 and earlier, this throws an exception. In Pivot 1.5+, an exception is not thrown, but you still won't see the labels attached to your Label elements - forms only recognize labels attached to section children.
Also, a Border can only have one content element. You'll need to nest a layout container in the Border instance if you want to display multiple child elements.
On Apr 14, 2010, at 6:07 PM, Shahzad Bhatti wrote:
> I am trying to use Label along with Form such as
> <BoxPane styles="{horizontalAlignment:'left'}">
> <Form wtkx:id="form" styles="{rightAlignLabels:true, fill:true}">
> <sections>
> <Form.Section>
> <Border styles="{backgroundColor:null, padding:2}">
> <content>
> <Label Form.label="name" textKey="name" styles="{font:{size:12, bold:true}}"/>
> </content>
> </Border>
> </Form.Section>
> <Form.Section>
> <Border styles="{backgroundColor:null, padding:2}">
> <content>
> <Label Form.label="symbol" textKey="symbol" styles="{horizontalAlignment:'right'}"/>
> <Label Form.label="bid" textKey="bid" styles="{horizontalAlignment:'right'}"/>
> <Label Form.label="ask" textKey="ask" styles="{horizontalAlignment:'right'}"/>
> <Label wtkx:id="changeLabel" Form.label="change" textKey="change" styles="{horizontalAlignment:'right'}"/>
> <Label Form.label="isExchangeDelayed" textKey="exchangeDelayed" styles="{horizontalAlignment:'right'}"/>
> </content>
> </Border>
> </Form.Section>
> ...
>
>
> But I am getting following error:
> Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) ... 19 more Caused by: java.lang.IllegalStateException at org.apache.pivot.wtk.Form.setLabel(Unknown Source) ... 23 more
>
>
> Looking at the source, this happens when the attributes of component are null. Any idea how to fix it?
>
> Thanks.
>
>
> ______________________________________________
>
> See http://www.peak6.com/email_disclaimer.php
> for terms and conditions related to this email
Re: Form setLabel
Posted by Greg Brown <gk...@mac.com>.
I assume you are using Pivot 1.4? The problem is that the Label instances are not direct descendants of the Form.Section. In Pivot 1.4 and earlier, this throws an exception. In Pivot 1.5+, an exception is not thrown, but you still won't see the labels attached to your Label elements - forms only recognize labels attached to section children.
Also, a Border can only have one content element. You'll need to nest a layout container in the Border instance if you want to display multiple child elements.
On Apr 14, 2010, at 6:07 PM, Shahzad Bhatti wrote:
> I am trying to use Label along with Form such as
> <BoxPane styles="{horizontalAlignment:'left'}">
> <Form wtkx:id="form" styles="{rightAlignLabels:true, fill:true}">
> <sections>
> <Form.Section>
> <Border styles="{backgroundColor:null, padding:2}">
> <content>
> <Label Form.label="name" textKey="name" styles="{font:{size:12, bold:true}}"/>
> </content>
> </Border>
> </Form.Section>
> <Form.Section>
> <Border styles="{backgroundColor:null, padding:2}">
> <content>
> <Label Form.label="symbol" textKey="symbol" styles="{horizontalAlignment:'right'}"/>
> <Label Form.label="bid" textKey="bid" styles="{horizontalAlignment:'right'}"/>
> <Label Form.label="ask" textKey="ask" styles="{horizontalAlignment:'right'}"/>
> <Label wtkx:id="changeLabel" Form.label="change" textKey="change" styles="{horizontalAlignment:'right'}"/>
> <Label Form.label="isExchangeDelayed" textKey="exchangeDelayed" styles="{horizontalAlignment:'right'}"/>
> </content>
> </Border>
> </Form.Section>
> ...
>
>
> But I am getting following error:
> Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) ... 19 more Caused by: java.lang.IllegalStateException at org.apache.pivot.wtk.Form.setLabel(Unknown Source) ... 23 more
>
>
> Looking at the source, this happens when the attributes of component are null. Any idea how to fix it?
>
> Thanks.
>
>
> ______________________________________________
>
> See http://www.peak6.com/email_disclaimer.php
> for terms and conditions related to this email
Form setLabel
Posted by Shahzad Bhatti <sb...@peak6.com>.
I am trying to use Label along with Form such as
<BoxPane styles="{horizontalAlignment:'left'}">
<Form wtkx:id="form" styles="{rightAlignLabels:true, fill:true}">
<sections>
<Form.Section>
<Border styles="{backgroundColor:null, padding:2}">
<content>
<Label Form.label="name" textKey="name" styles="{font:{size:12, bold:true}}"/>
</content>
</Border>
</Form.Section>
<Form.Section>
<Border styles="{backgroundColor:null, padding:2}">
<content>
<Label Form.label="symbol" textKey="symbol" styles="{horizontalAlignment:'right'}"/>
<Label Form.label="bid" textKey="bid" styles="{horizontalAlignment:'right'}"/>
<Label Form.label="ask" textKey="ask" styles="{horizontalAlignment:'right'}"/>
<Label wtkx:id="changeLabel" Form.label="change" textKey="change" styles="{horizontalAlignment:'right'}"/>
<Label Form.label="isExchangeDelayed" textKey="exchangeDelayed" styles="{horizontalAlignment:'right'}"/>
</content>
</Border>
</Form.Section>
...
But I am getting following error:
Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) ... 19 more Caused by: java.lang.IllegalStateException at org.apache.pivot.wtk.Form.setLabel(Unknown Source) ... 23 more
Looking at the source, this happens when the attributes of component are null. Any idea how to fix it?
Thanks.
______________________________________________
See http://www.peak6.com/email_disclaimer.php
for terms and conditions related to this email