I understand your confusion. That particular overload of readObject() is not
especially clear. The class argument basically just identifies the name of the
resource bundle - it has nothing to do with Bindable.
Your BXML looks fine - to make the frame stay on top of the window, you just
need to open the frame with the window as its owner.
On Dec 18, 2010, at 10:39 AM, Luiz Gustavo wrote:
> Hi,
>
> I'm writing an application, and I'm facing problems to meka a frame stay in
> front of a Window. I'm following the examples in the tutorial, specifically
> that one related to Window.
> I still can not understand what is exactly the relation between the bxml file
> and the base class passed to the BXMLSerializer.readObject method. I'll show
> what Im doing:
>
> I have a main class, the entry point to my application:
>
> public class Main implements Application {
>
> private Display display = null;
> private Window window = null;
> BXMLSerializer bxmlSerializer;
> public static final String LANGUAGE_KEY = "language";
>
> ...
>
>
> public Main(){
>
>
> Action.getNamedActions().put("abrirCategorias", new Action() {
> @Override
> public void perform(Component source) {
> try {
> Categoria categoria = (Categoria)
> bxmlSerializer.readObject(Categoria.class, "categoria.bxml");
> categoria.open(display);
> }
> catch (IOException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> catch (SerializationException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
> });
>
>
> }
> ...
>
>
> }
>
> Among other Actions, I have that one defined in the construtor, that is used
> to open a frame in front of my main Window.
> The case, as I said before, is that when this action is fired, the frame stay
> behind the main window.
>
> This is the Class used for the frame (this is still quite simple):
>
>
> public class Categoria extends Frame implements Bindable {
>
> private TextInput descricao;
>
>
> @Override
> public void initialize(Map<String, Object> arg0, URL arg1, Resources arg2) {
> // TODO Auto-generated method stub
>
> }
> }
>
>
> and this is the BXML file:
>
>
> <jm:Categoria icon="@application_form.png" title="Categorias"
> xmlns:bxml="http://pivot.apache.org/bxml"
> xmlns:content="org.apache.pivot.wtk.content"
> xmlns="org.apache.pivot.wtk"
> xmlns:jm="jm.pivot.app.controle" maximized="false"
> styles="{padding:{top:0, left:4, bottom:4, right:4},
> showWindowControls:true}">
>
>
> <Border styles="{backgroundColor:null, padding:2}">
> <BoxPane>
> <Label text="Descricao:"/>
> <TextInput bxml:id="descricao"/>
> </BoxPane>
> </Border>
>
> </jm:Categoria>
>
>
> Now, I'd like to undestand if I'm doing the right thing, passing the
> Categoria.class in the readObject method, since Categoria class implements
> Bindable.
>
> How can i make Categoria Frame stay in front of Window?
>
>
> Thanks in advance!