pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alejandro Vilar <alejandro.vi...@synacom.com.bo>
Subject Re: Question about porting resources from wtkx to bxml
Date Fri, 05 Nov 2010 21:58:24 GMT
Hi Greg, I have an example here, the button and the window's title shows
"some.button.label" instead "Foo"

(Compiled with the last svn revision)

JSON:

{
    "some":{
        "button":{
            "label":"Foo"
        }
    }
}


BXML:

<?xml version="1.0" encoding="UTF-8"?>
<Frame xmlns:bxml="http://pivot.apache.org/wtkx"
xmlns="org.apache.pivot.wtk"
    bxml:id="frame" maximized="true" title="%some.button.label">
    <content>
        <PushButton buttonData="%some.button.label"/>
    </content>
</Frame>


Java:

package sample;
import org.apache.pivot.beans.*;
import org.apache.pivot.collections.Map;
import org.apache.pivot.util.Resources;
import org.apache.pivot.wtk.*;

public class Main implements Application {

    private Window window;
    @BXML private Frame frame;

    public static void main(String[] args) {
        DesktopApplicationContext.main(Main.class, args);
    }

    public void startup(Display display, Map<String, String> properties)
throws Exception {
        Resources resources = new Resources("sample/bundle");
        BXMLSerializer serializer = new BXMLSerializer();
        serializer.setResources(resources);
        serializer.readObject(Main.class.getResource("main.bxml"));
        serializer.bind(this, Main.class);
        window = new Window();
        window.open(display);
        frame.open(window);
    }

    public boolean shutdown(boolean optional) throws Exception {
        if (window != null) {
            window.close();
        }
        return false;
    }

    public void suspend() throws Exception {
    }

    public void resume() throws Exception {
    }
}

Regards,

Alejandro

El vie, 05-11-2010 a las 15:30 -0400, Greg Brown escribió:
> No, that should still work. Can you share a code sample that demonstrates the problem?
> 
> On Nov 5, 2010, at 2:47 PM, Alejandro Vilar wrote:
> 
> > Hi all,
> > 	We have a pivot app based on version 1.4, now we are planning to port
> > it to version 2.0 (when released) in the middle time we are working with
> > lastest svn revision. Now the problem is with the resources usages in
> > bxml files, eg:
> > 
> > <PushButton buttonData="%some.button.label">
> > 
> > This shows "some.button.label" instead the real value in the json file.
> > So this feature is no longer supported? or is there a better way to
> > acomplish this task?
> > 
> > Thanks in advance,
> > 
> > -A
> > 
> 



Mime
View raw message