facebook

[Closed] Need Help With Matisse – Develop a "real"

  1. MyEclipse Archived
  2.  > 
  3. Matisse/Swing UI Development
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #271241 Reply

    Glenn Puckett
    Participant

    Hello,

    I have MyEclipse 5.5.1.GA installed over Eclipse 3.2.2.

    I admit I am a J2EE developer trying to learn how to develop applications for a windows environment. So I have to rely heavily on examples, documentation, tutorials, etc, etc. All I need usually is one good tutorial and I can make good progress. In the current case, it’s just not happening.

    I am really struggling figuring out how to develop my application using M4M. In the tutorials and documents all I can find is an extremely simple example of a single screen application. That’s not exactly “real life”. I need to figure out how to show different forms, information screens, formatted data, etc based on which options I select from the menus at the top.

    It appears that layers is the way to go and I have found a few examples of developing layered components using Java. But I can’t figure out how to do this using M4M. I have tried adding code to the generated modules that attempt to manage the layers but so far am unable to do that.

    What I have tried so far is to set up my main class with the menu bar and a JDesktopPane under that. I then added a number of regular JPanes to the JDesktopPane. Each JPane is set to DefaultLayer. I then added code to the events from the menu bar that would call moveToBack() the current JPane and moveToFront() the JPane representing the selected menu option. This didn’t work. So I added a setLayer() but was just guessing which layer numbers. I also added setVisible(x) to the appropriate panes. So far I can’t get anything to display in the area representing the JDesktopPane, even at startup.

    My intention once I get the “navigation” working is to build individual class files for each of the JPanels and add them to the layers using the Matisse Custom Palette. But I can’t get to the point where I can make the different “views” work.

    I sure could use some suggestions, help and/or examples.

    Glenn Puckett
    Lexington, KY

    #271244 Reply

    Glenn Puckett
    Participant

    I forgot to include the following:

    *** Date: Thu Jun 07 13:31:51 EDT 2007

    *** Platform Details:

    *** System properties:
    ErrorManager.minimum=18
    awt.toolkit=sun.awt.windows.WToolkit
    eclipse.buildId=M20070212-1330
    eclipse.commands=-os
    win32
    -ws
    win32
    -arch
    x86
    -launcher
    C:\Java\eclipse\eclipse.exe
    -name
    Eclipse
    -showsplash
    600
    -exitdata
    26c0_78
    -product
    com.genuitec.myeclipse.product.ide
    -vm
    C:\PROGRA~1\java\JDK15~1.0_1\bin\javaw.exe
    eclipse.ee.install.verify=false
    eclipse.product=org.eclipse.sdk.ide
    eclipse.startTime=1181237468460
    eclipse.vm=C:\PROGRA~1\java\JDK15~1.0_1\bin\javaw.exe
    eclipse.vmargs=-Duser.language=en
    -Xms128M
    -Xmx512M
    -XX:PermSize=64M
    -XX:MaxPermSize=128M
    -jar
    C:\Java\eclipse\startup.jar

    SNIP, please use MyEclipse > Installation Summary > Installation Details next time

    #271259 Reply

    Riyad Kalla
    Member

    Glenn,
    You are doing exactly the right things here, it’s just a trick of knowing which layout manager to use. The JDesktopPane you are using right now isn’t meant to be used how you are using it (it *can* be used that way, but it’s not intended for it). What you want is a normal JPanel that has a layout manager of CardLayout. CardLayout maintains a list of child components with only one visible (on the “top”) at a time. For an example of how that works, think of an installation wizard… as you hit the Next button the body of the wizard changes to a new panel, etc. This is how the CardLayout will work.

    FYI: http://java.sun.com/javase/6/docs/api/java/awt/CardLayout.html

    #271277 Reply

    Glenn Puckett
    Participant

    That is what I was trying to do. Actually I originally developed this little application using VisualAge for Java about 4 years ago. I used CardLayout and it worked pretty nice. But I need to upgrade it and get it up to a more current JVM. VisualAge is not an alternative now. Since you can’t import an application into the IDE I was trying to re-develop the GUI using M4M.

    After a great deal of trial and error I do have some of the navigation working using JDesktop but, as you stated, it’s really not the proper environment. I will start again and see what I can do with CardLayout.

    I am a great fan of MyEclipse. And I know that Eclipse itself was originally developed by IBM as it’s replacement for VisualAge. However, I was much more comfortable with figuring out new concepts in VisualAge than I am Eclipse. The J2EE examples and tutorials on the MyEclipse web site is very helpful and made a big difference when I first started working with my J2EE developments in MyEclipse. Hopefully there will be similar support for M4M in the future.

    #271285 Reply

    Riyad Kalla
    Member

    Glenn,
    I put together this project for you, I hope it gets you started on the right foot with M4M.

    Attachments:
    You must be logged in to view attached files.
    #271345 Reply

    Glenn Puckett
    Participant

    @support-rkalla wrote:

    Glenn,
    I put together this project for you, I hope it gets you started on the right foot with M4M.

    I really appreciate the time you took to put this together. I will be looking at this to compare to how I have my code constructed. I have made some progress, but I did run into a problem.

    My current configuration is a main application class with a menu bar and a JPanel in the center. I called the JPanel variable appPanel and assigned it the CardLayout.

    Then I created “stub” JPanel classes for each panel represented in the navigation defined by the Menu Bar and it’s menu items. I added the stub classes to the Matisse Pallete as custom objects. Then I proceeded to add these custom objects to the appPanel.

    In the generated code I added a method called managePanels. From the actionEvent of each menu item I added a call to managePanels with the argument a code identifying the specific panel I want to display from that menu selection. In managePanels(x) it determines which panel is currently active and calls setVisible(false). Following that it determines which panel should now be displayed and calls setVisible(true) on that object. It all seems completely logical to me. But I had some very, very wierd.

    At this point I only have an actual form built for one of the panels. The rest only have a lable identifying what that stub panel represents. Because of setup logic the module is currently defaulting to the one panel that has a form implemented. The problem I was having is that, even though it was obvious I was on the correct panel, only a few of the input fields were being displayed and NONE of the label fields were displayed. And as I moved my mouse pointer around that panel other input fields popped into view. Obviously the mouseOver even was being recognized which caused each object to appear.

    After a great deal of trial and error, checking examples and testing of various scenarios I finally determined that it was being caused by the initial instantiation of each panel not being explicitly set to not visible. And even more significant it had to be set to not visible AFTER the generated code added the object to the appPanel. So I updated the constructor to set each panel to setVisible(false) after the initialize method was executed. Then, WALA!! the app started working as expected.

    I have been struggling with the opinion that this is a problem with Matisse. The reason I say that is when I added a panel to the appPanel there is no visible option on the properties for that panel. I really do think it should have a visible property option. In addition, Matisse should be smart enough to set the object to not visible AFTER adding to the CardLayout object. As a matter of fact I can’t find a visible option on any of the Swing objects. IMHO they really should have that. I gives me the ability to define elements on a screen that I may only want to make visible given specific situations. Obviously I can do that manually in my code. But the whole objective of an IDE is to generate as much of the code as possible, isn’t it?

    Now I have progressed to a new situation. In the little application I am building when I bring up one panel I have a situation where I want to fire an event that will cause a totally separate panel to be displayed. An example is that I am updating installation details. When I am finished and click on “SAVE” I want to close that panel and open the options panel. Since I am inside the instantiation of one panel I have to cause control to go back to the main application class by firing an event and then code the main app to catch that event, make the current panel not visible and then make the desired panel visible.

    I am just now investigating this but would appreciate some guidance on how to accomplish it.

    Thanks again for your help.

    Glenn Puckett

    #271370 Reply

    Glenn Puckett
    Participant

    I asked that last question improperly. I was attempting to ask if M4M has a facility to build and handle custom events. In VisualAge I could “promote” an event and VisualAge would handle building the proper listeners to implement the event in the calling module. This capability is obviously not available in M4M. I have investigated the technique of implementing this manually and have sucessfully added it to my code. Since that is a critical part of a real life application it would seem to me to be an important aspect of M4M. Hopefully it will be in a future release.

    The true mettle of an graphical IDE is how much of the application it will handle graphically. If it generates all the code necessary to handle all the user interface and all I have to do is add specific business logic then it is a pretty good tool. M4M has made a great start. Hopefully as it matures it will be enhanced with these sorts of capabilitites.

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: [Closed] Need Help With Matisse – Develop a "real"

You must be logged in to post in the forum log in