Hi Michel,
There is one more thing needed -- there is a list of DisplayHost objects that is maintained for purposes of dispatching events. We added a method/hook to be able to add your new object to this list. I don't have the code right in front of me -- but I will dig it out and let you know.

~Roger Whitcomb

On 5/27/14 10:42 AM, Michel Eisenmann wrote:
Hi,

I'm integrating Pivot in my Swing application successfully except for the
transition/animation part.

The way I've been doing things is the following:

- I've created my own ApplicationContext to ensure that the Pivot Timer was
properly created.

public class LocalApplicationContext extends ApplicationContext {
   static public LocalApplicationContext singleton = null;

   public LocalApplicationContext() {
     createTimer();
   }

   static public LocalApplicationContext GetOrCreate() {
     if (singleton != null) return singleton;
     singleton = new LocalApplicationContext();
     return singleton;
   }


- Then I use this singleton everytime I need to create a JPanel that
contains some Pivot widgets:

   public static NewPlanAreaBXML InitializePanel(JPanel panel,
SchemaCollector coll) {
     LocalApplicationContext.GetOrCreate();
     BXMLSerializer bxmlSerializer = new BXMLSerializer();
     ApplicationContext.DisplayHost displayHost = new
ApplicationContext.DisplayHost();
     try {
       panel.setLayout(new BorderLayout());
       // the BXML that will be inserted in the JPanel
       NewPlanAreaBXML window = (NewPlanAreaBXML)
bxmlSerializer.readObject(NewPlanAreaBXML.class
           .getResource(getXmlFile()));
       //
       window.open(displayHost.getDisplay());
       window.setCollector(coll);
       panel.add(displayHost);
       panel.setPreferredSize(new Dimension(getDefaultWidth(),
getDefaultHeight()));
       return window;
     } catch (IOException e) {
       e.printStackTrace();
     } catch (SerializationException e) {
       e.printStackTrace();
     }
     return null;
   }

This is working pretty well for most of what I need. Except for
animations/transitions that seem to be triggered *ONLY* if I move the mouse.

For example, I've built an accordion based on the tutorial example and when
I click on the next button, the actual change happens only when I move my
mouse. If I don't move my mouse, nothing happens.

It looks like some event loop related issue but... well. Ideas are welcome.

Thanks in advance
Michel





--
View this message in context: 
http://apache-pivot-users.399431.n3.nabble.com/Swing-and-Pivot-Integration-using-JPanel-tp4022931.html
Sent from the Apache Pivot - Users mailing list archive at Nabble.com.



Reply via email to