Loading ...
Sorry, an error occurred while loading the content.

de-gui-ing the CharacterFacade

Expand Messages
  • Chris Dolan
    I m still fighting memory usage, but I m switching gears to look at dependencies on the GUI classes. My current problem is
    Message 1 of 3 , Feb 2, 2013
    • 0 Attachment
      I'm still fighting memory usage, but I'm switching gears to look at dependencies on the GUI classes.

      My current problem is pcgen.gui2.facade.CharacterAbilities.updateAbilityCategoryLater() which calls SwingUtiities.invokeLater(), which gives me a ClassNotFoundException. This is a callback invoked from the CharacterFacadeImpl on changes to the PC. I'd like to implement a GUI-less version of this, and would like some advice about how to do it. The CharacterFacadeImpl class is HUGE so I don't want to reimplement it if I can help it. Should I instead use the PlayerCharacter class directly without the facade? Of course, I'd need to reimplement some kind of a facade for my Android UI, but it would likely be much less extensive that what the desktop GUI requires.

      Chris
    • Connor Petty
      Hi Chris, The best way to deal with it would be to create an invokeLater() method in the UIDelegate. That way such event thread behavior could be implemented
      Message 2 of 3 , Feb 2, 2013
      • 0 Attachment
        Hi Chris,
        The best way to deal with it would be to create an invokeLater() method in the UIDelegate. That way such event thread behavior could be implemented for different systems. The facade implementations should be UI independent so catching these kind of dependencies is a good thing. If you find any other swing dependency issues try to delegate them out through the UIDelegate.
        That said, I still think there are some swing dependencies that will need to be handled differently. IIRC a lot of facade implementations use javax.swing.event.EventListenerList. Something like that will probably need a local implementation as a replacement. Looks like the UndoManager will give you some problems in the CharacterFacadeImpl, you can just ignore that for now, it is not currently used. There are likely some more gotchas you will find but hopefully you will not need to resort to a custom facade implementation.

        You are making great progress and I look forward to seeing the results.
        Best Regards,
        Connor Petty


        On Sat, Feb 2, 2013 at 3:50 PM, Chris Dolan <chris@...> wrote:
         

        I'm still fighting memory usage, but I'm switching gears to look at dependencies on the GUI classes.

        My current problem is pcgen.gui2.facade.CharacterAbilities.updateAbilityCategoryLater() which calls SwingUtiities.invokeLater(), which gives me a ClassNotFoundException. This is a callback invoked from the CharacterFacadeImpl on changes to the PC. I'd like to implement a GUI-less version of this, and would like some advice about how to do it. The CharacterFacadeImpl class is HUGE so I don't want to reimplement it if I can help it. Should I instead use the PlayerCharacter class directly without the facade? Of course, I'd need to reimplement some kind of a facade for my Android UI, but it would likely be much less extensive that what the desktop GUI requires.

        Chris


      • Chris Dolan
        Thanks, Connor. UIDelegate makes a lot of sense. I ll try that. I ll start with a survey of the pcgen.gui2.facade classes and see which are using Swing/AWT and
        Message 3 of 3 , Feb 2, 2013
        • 0 Attachment
          Thanks, Connor. UIDelegate makes a lot of sense. I'll try that. I'll start with a survey of the pcgen.gui2.facade classes and see which are using Swing/AWT and which are depending on other pcgen.gui2 packages, and see what we can delegate.

          As for EventListener, I already did that replacement for the non-pcgen.gui classes.

          Chris

          On Feb 2, 2013, at 8:04 PM, Connor Petty <mistercpp2000@...> wrote:



          Hi Chris,
          The best way to deal with it would be to create an invokeLater() method in the UIDelegate. That way such event thread behavior could be implemented for different systems. The facade implementations should be UI independent so catching these kind of dependencies is a good thing. If you find any other swing dependency issues try to delegate them out through the UIDelegate.
          That said, I still think there are some swing dependencies that will need to be handled differently. IIRC a lot of facade implementations use javax.swing.event.EventListenerList. Something like that will probably need a local implementation as a replacement. Looks like the UndoManager will give you some problems in the CharacterFacadeImpl, you can just ignore that for now, it is not currently used. There are likely some more gotchas you will find but hopefully you will not need to resort to a custom facade implementation.

          You are making great progress and I look forward to seeing the results.
          Best Regards,
          Connor Petty


          On Sat, Feb 2, 2013 at 3:50 PM, Chris Dolan <chris@...> wrote:
           

          I'm still fighting memory usage, but I'm switching gears to look at dependencies on the GUI classes.

          My current problem is pcgen.gui2.facade.CharacterAbilities.updateAbilityCategoryLater() which calls SwingUtiities.invokeLater(), which gives me a ClassNotFoundException. This is a callback invoked from the CharacterFacadeImpl on changes to the PC. I'd like to implement a GUI-less version of this, and would like some advice about how to do it. The CharacterFacadeImpl class is HUGE so I don't want to reimplement it if I can help it. Should I instead use the PlayerCharacter class directly without the facade? Of course, I'd need to reimplement some kind of a facade for my Android UI, but it would likely be much less extensive that what the desktop GUI requires.

          Chris





        Your message has been successfully submitted and would be delivered to recipients shortly.