pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark R. Chambers" <m...@mrchambers.org>
Subject Speeding up Apache Pivot For embedded Application
Date Wed, 26 Mar 2014 10:02:47 GMT
Hi All,

SUMMARY:
Is there anyway to make sun.awt.GlobalCursorManager$NativeUpdater.run()
more efficient?

DETAILS:
I am using apache pivot in an embedded application, and currently it is
running a little bit sluggish. Misses some mouse clicks etc...
After running VisualVM it seems that a lot of processor (62%) of the program
is used in:
sun.awt.GlobalCursorManager$NativeUpdater.run()
I assume this is what reads in the Mouse movements etc.
I am running VisualVM on windows, but application on linux:/ (Will profile
on linux after I get running well under windows...)
Any ideas on how to make this more efficient?

Regards,
Mark.
-----Original Message-----
From: Roger Whitcomb [mailto:Roger.Whitcomb@actian.com] 
Sent: Tuesday, 25 March 2014 7:18 AM
To: user@pivot.apache.org
Subject: RE: Unserialize an object in class constructor

Right.

-----Original Message-----
From: Ilya Zimnovich [mailto:zimnovich@gmail.com]
Sent: Monday, March 24, 2014 12:42 PM
To: user@pivot.apache.org
Subject: Re: Unserialize an object in class constructor

Hi Roger,

So you mean I can put some child control of the FinanceWindow class into a
FinanceWindow.bxml file, then create this child control using
BXMLSerializer's readObject method and attach it to a FinanceWindow instance
in the constructor, right? As far as I understand the FinanceWindow.bxml
file can contain only one root element. Something like BoxPane or TablePane.
This way it will be possible to just do a "new FinanceWindow" in the
Application derived object.

Why do I want to do it? Well, I would like to properly decompose my
application, just like it is done in wxWidgets or QT C++ frameworks I used
to work with. Below is how it is done in wxWidgets (C++):

class TestWnd_Base : public wxFrame
{
protected:
    wxTextCtrl* A;
    wxButton* B;

public:
    TestWnd::TestWnd()
    {
        wxXmlResource::Get()->LoadObject(this, NULL, "TestWnd", "wxFrame");
        A = XRCCTRL(*this, "A", wxTextCtrl);
        B = XRCCTRL(*this, "B", wxButton);
    }
};

Well, don't forget the Android Activities:

public class SetWallpaperActivity extends FragmentActivity {
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        // Inflate XML layout
        setContentView(R.layout.set_wallpaper_activity);
    }
}

I sure that it is the Window object itself who should take the
responsibility to create the children objects and to load its localization
resources. The other windows and panels should also load their localization
resources and create their children from bxml file.
Of course I do understand that it's a matter of ones taste!

Best Regards,
Ilya A. Zimnovich

On 24.03.2014 21:42, Roger Whitcomb wrote:
> Hi Ilya,
> 	Well, the answer is yes, but ....  If your FinanceWindow.bxml has
the top-level object as a FinanceWindow, then if in the FinanceWindow
constructor you load that bxml file, you will get into an infinite
recursion.  But, if your FinanceWindow.bxml has just the content of your
window and you create the top-level Window object some other way (i.e. just
do a "new FinanceWindow" in the startup code as you have it), then you could
just read the contents of the window and set the window's child from the
BXML file (which is NOT what you have in your code), then that should work.
> 	I'm curious why you want to do this?  It is pretty much the same
code either way, but if you let the BXMLSerializer create all the objects
(including the top-level window) it is a tiny bit less work in your code.
Or is there a design pattern you're trying to achieve?
>
> HTH,
> ~Roger
>
> -----Original Message-----
> From: Ilya Zimnovich [mailto:zimnovich@gmail.com]
> Sent: Monday, March 24, 2014 9:26 AM
> To: user@pivot.apache.org
> Subject: Unserialize an object in class constructor
>
> Dear Apache Pivot experts,
>
> All the Apache Pivot examples unserialize an objects with BXMLSerializer's
readObject method:
>
> ....
>     public void startup(Display display, Map<String, String> properties)
throws Exception
>     {
>         String language = properties.get("language");
>         Locale locale = (language == null) ? Locale.getDefault() : new
Locale(language);
>         Resources resources = new
> Resources(FinanceWindow.class.getName(), locale);
>        
>         BXMLSerializer bxmlSerializer = new BXMLSerializer();
>         window =
> (FinanceWindow)bxmlSerializer.readObject(getClass().getResource("Finan
> ceWindow.bxml"),
> resources);
>         window.open(display);
>     }
> ....
>
> Is there a way to unserialize the object in its constructor? I mean
something like the below:
>
> ....
>     public void startup(Display display, Map<String, String> properties)
throws Exception
>     {
>         window = new FinanceWindow();
>         window.open(display);
>     }
> ....
>
> public class FinanceWindow extends Frame implements Bindable { ....
>
>     public FinanceWindow()
>     {
>         BXMLSerializer bxmlSerializer = new BXMLSerializer();
>
>         // Load localized resources and unserialize the object
>         String language = properties.get("language");
>         Locale locale = (language == null) ? Locale.getDefault() : new
Locale(language);
>         Resources resources = new Resources(getClass().getName(), 
> locale);
>
>         bxmlSerializer.readObjectXXXX(this, "FinanceWindow.bxml");
>
> ....
>
>
> Best Regards,
> Ilya A. Zimnovich
>
>




Mime
View raw message