pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michel Eisenmann <michel.eisenm...@fr.ibm.com>
Subject Swing and Pivot Integration using JPanel
Date Tue, 27 May 2014 17:42:27 GMT
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.

Mime
View raw message