You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by pan peter <pa...@gmail.com> on 2011/10/26 14:11:49 UTC

how to make a login window before main window?

i need to provide a login page before main window, if login succeeds, open
main window, otherwise show errors, how to do that?
seems if i put it inside start(), pivot will open a big window
automatically. if i put it in main(), then how can i get the display?

--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/how-to-make-a-login-window-before-main-window-tp3454273p3454273.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: how to make a login window before main window?

Posted by Greg Brown <gk...@verizon.net>.
start() would be the right place to do it. Just make sure that the dialog isn't maximized and has no owner.

Another option is to open your main window first, but not show any content until the dialog closes.

On Oct 26, 2011, at 8:11 AM, pan peter wrote:

> i need to provide a login page before main window, if login succeeds, open
> main window, otherwise show errors, how to do that?
> seems if i put it inside start(), pivot will open a big window
> automatically. if i put it in main(), then how can i get the display?
> 
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/how-to-make-a-login-window-before-main-window-tp3454273p3454273.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.


Re: how to make a login window before main window?

Posted by Greg Brown <gk...@verizon.net>.
> i think it's not good to have a shaddow gray frame behind the login dialog. 

Sure - but as I suggested earlier, you don't have to implement it that way. You could open your main window and show some nice background image while the login dialog is open. Then when the user logs in, you replace the image with your actual main UI.


Re: how to make a login window before main window?

Posted by pan peter <pa...@gmail.com>.
i think it's not good to have a shaddow gray frame behind the login dialog. 

yes, the look and feel will be different for sure.

--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/how-to-make-a-login-window-before-main-window-tp3454273p3454754.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: how to make a login window before main window?

Posted by Sandro Martini <sa...@gmail.com>.
Hi all,
or can you try with the Java 6 Update 10 (and higher, now standard in
Java 7) window transparency features ?
Pivot doesn't support them directly, but should work ... or you could
make the pre-login phase with this (maybe with Pivot, or otherwise
directly with Swing), and them go with your Pivot application.

I don't know if can work in your case, but just as an idea ...

Bye

Re: how to make a login window before main window?

Posted by Greg Brown <gk...@verizon.net>.
I have no idea how Pivot might interact with RCP. It may work, but it was not designed to support that.

Any reason you can't simply use a Pivot dialog within your main host frame? Is there a reason you need a native dialog? If so, you may have better luck implementing your login in AWT or Swing. However, the L&F will be different once the user logs in, so this may not provide the best user experience. (I imagine the same would apply to an RCP-based login dialog)

On Oct 26, 2011, at 10:43 AM, pan peter wrote:

> O.K. That's too bad. i really need a small Dialog that allows user to enter
> user name andd password, as we did before with RCP client. 
> Currently I can make it work in this way:  show RCP login composite from
> main(), then no background frame at all. 
> but later in the main pivot window, i would like to open other RCP composite
> (we would like to re-use those GUI pages), RCP complains that illegal thread
> access, as RCP GUI page can only be accessed through main GUI thread. If I
> don't launch that login page first, then no problem to open other pages from
> pivot menu action listeners.
> I tried to open those RCP composites through new thread, then I cannot see
> them at all.
> 
> any suggestions?
> 
> 
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/how-to-make-a-login-window-before-main-window-tp3454273p3454671.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.


Re: how to make a login window before main window?

Posted by pan peter <pa...@gmail.com>.
O.K. That's too bad. i really need a small Dialog that allows user to enter
user name andd password, as we did before with RCP client. 
Currently I can make it work in this way:  show RCP login composite from
main(), then no background frame at all. 
but later in the main pivot window, i would like to open other RCP composite
(we would like to re-use those GUI pages), RCP complains that illegal thread
access, as RCP GUI page can only be accessed through main GUI thread. If I
don't launch that login page first, then no problem to open other pages from
pivot menu action listeners.
I tried to open those RCP composites through new thread, then I cannot see
them at all.

any suggestions?


--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/how-to-make-a-login-window-before-main-window-tp3454273p3454671.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: how to make a login window before main window?

Posted by Greg Brown <gk...@verizon.net>.
When you say "Pivot window", do you mean the native application frame that hosts the Pivot display? If so, this is by design - all Pivot windows are hosted within a single native frame.

You can open multiple native frames (i.e. multiple displays) using DesktopApplicationContext#createDisplay(). However, there is currently no way to open a "dialog" display host before your main display.

On Oct 26, 2011, at 10:12 AM, pan peter wrote:

> here is the dialog.bxml,
> 
> <Dialog bxml:id="dialog" title="Dialog" modal="false"
>    xmlns:bxml="http://pivot.apache.org/bxml"
>    xmlns="org.apache.pivot.wtk"> 
>    <TablePane preferredWidth="320" preferredHeight="210"> 
>        <columns> 
>            <TablePane.Column width="1*"/> 
>        </columns> 
>        <TablePane.Row height="1*"> 
>            <Label text="This is a dialog."
>                preferredWidth="320" preferredHeight="210"
>                styles="{horizontalAlignment:'center',
> verticalAlignment:'center'}"/> 
>        </TablePane.Row> 
> 
>        <TablePane.Row height="-1"> 
>            <BoxPane styles="{horizontalAlignment:'right'}"> 
>                <PushButton buttonData="Close"
>                    ButtonPressListener.buttonPressed="dialog.close()"/> 
>            </BoxPane> 
>        </TablePane.Row> 
>    </TablePane> 
> </Dialog> 
> 
> Here is my startup()
> 
> public void startup(Display display, Map<String, String> properties)  
> throws Exception     {   
>    	BXMLSerializer bxmlSerializer = new BXMLSerializer(); 
>    	Dialog myDialog = (Dialog)
> bxmlSerializer.readObject(ClientApplication.class, "resource/dialog.bxml");
>    	myDialog.open(display);
> } 
> 
> it always open a big pivot window behind the dialog :-(
> 
> 
> 
> --
> View this message in context: http://apache-pivot-users.399431.n3.nabble.com/how-to-make-a-login-window-before-main-window-tp3454273p3454547.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.


Re: how to make a login window before main window?

Posted by pan peter <pa...@gmail.com>.
here is the dialog.bxml,

<Dialog bxml:id="dialog" title="Dialog" modal="false"
    xmlns:bxml="http://pivot.apache.org/bxml"
    xmlns="org.apache.pivot.wtk"> 
    <TablePane preferredWidth="320" preferredHeight="210"> 
        <columns> 
            <TablePane.Column width="1*"/> 
        </columns> 
        <TablePane.Row height="1*"> 
            <Label text="This is a dialog."
                preferredWidth="320" preferredHeight="210"
                styles="{horizontalAlignment:'center',
verticalAlignment:'center'}"/> 
        </TablePane.Row> 
 
        <TablePane.Row height="-1"> 
            <BoxPane styles="{horizontalAlignment:'right'}"> 
                <PushButton buttonData="Close"
                    ButtonPressListener.buttonPressed="dialog.close()"/> 
            </BoxPane> 
        </TablePane.Row> 
    </TablePane> 
</Dialog> 

Here is my startup()

public void startup(Display display, Map<String, String> properties)  
throws Exception     {   
    	BXMLSerializer bxmlSerializer = new BXMLSerializer(); 
    	Dialog myDialog = (Dialog)
bxmlSerializer.readObject(ClientApplication.class, "resource/dialog.bxml");
    	myDialog.open(display);
} 

it always open a big pivot window behind the dialog :-(



--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/how-to-make-a-login-window-before-main-window-tp3454273p3454547.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: how to make a login window before main window?

Posted by Greg Brown <gk...@verizon.net>.
> Then I pass a null as
> display, then got null pointer exception for display.

You need to pass the display that is passed to your startup() method.

> Even only contains
> these code in start up, it still opens a big pivot window, 

Make sure you don't have maximized="true" in your dialog markup.


Re: how to make a login window before main window?

Posted by pan peter <pa...@gmail.com>.
First, without argument, the open() won't be allowed. Then I pass a null as
display, then got null pointer exception for display. Even only contains
these code in start up, it still opens a big pivot window, 

public void startup(Display display, Map<String, String> properties){
BXMLSerializer bxmlSerializer = new BXMLSerializer(); 
Dialog myDialog = (Dialog)
bxmlSerializer.readObject(ClientApplication.class, "resource/dialog.bxml");
myDialog.setModal(false);
myDialog.open((Display)null);
}

anything wrong here? I expect only a small dialog.



--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/how-to-make-a-login-window-before-main-window-tp3454273p3454483.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.

Re: how to make a login window before main window?

Posted by Greg Brown <gk...@verizon.net>.
> how to create a dialog without owner? 

Don't pass an owner to open().

> when i do it in startup(), it always open a big pivot window, then shows the
> dialog.

Don't open your main window before opening the dialog.


Re: how to make a login window before main window?

Posted by pan peter <pa...@gmail.com>.
how to create a dialog without owner? 
when i do it in startup(), it always open a big pivot window, then shows the
dialog.


--
View this message in context: http://apache-pivot-users.399431.n3.nabble.com/how-to-make-a-login-window-before-main-window-tp3454273p3454417.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.