grey window with jide 2.1

This forum is used by users to request and discuss new product features. Please do not use this forum for technical support including bug reports.

Moderator: JIDE Support

Forum rules
Product suggestions only. Please do not use this forum for technical support including bug reports.

grey window with jide 2.1

Postby nicola.gioia » Mon Jul 09, 2007 7:21 am

I have created an application using jide, and developed it using various version of jide product.
Now I have tried to pass from the 1.9.4 version to the 2.1 just released.
But starting the application I see only a grey window.
I have delete all the old layout reference, to remove all the dockableFrame to try to locate the cause of the problem.. but the problem is still present.
There is some big change from the 1.9.4 to the 2.1 version on the manageing of the dockable context or in some similiar component that can cause this problem?

thanks!
nicola.gioia
 
Posts: 60
Joined: Tue Sep 20, 2005 6:57 am

Postby JIDE Support » Mon Jul 09, 2007 7:45 am

That's strange. I am not aware of this. Do you have a test case to reproduce it?

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Postby nicola.gioia » Mon Jul 09, 2007 8:34 am

Sorry for the wrong signal... but I have tried to found the problem for 5 hours and I found the solution only now.
I have found a code to reproduce the problem... founding the workaround to solve my problem.
If in the code on the DefaultDockableBarDockableHolder i do a setLayout(new BorderLayout()) before to load the layout the window become gray. If i don't set the layout the problem is not present.
I have removed the setLayout from the code because it have no sense. It was in a previous method no more needed.
The code to reproduce the problem is:


Code: Select all
import java.awt.*;
import java.awt.event.*;

import javax.swing.*;

import com.jidesoft.action.*;
import com.jidesoft.docking.DockableFrame;
import com.jidesoft.swing.*;


public class DefaultDockableBarDockableHolderBug extends DefaultDockableBarDockableHolder{

   public DefaultDialogDockableBarDockableHolderBug(boolean initLayout) {
      super();
      init(initLayout);
   }

   private void init(boolean initLayout) {
      if(initLayout)
         setLayout(new BorderLayout());
      setDefaultCloseOperation(EXIT_ON_CLOSE);
      getLayoutPersistence().setProfileKey("bug.test");
      
      getLayoutPersistence().beginLoadLayoutData();
      this.getDockableBarManager().addDockableBar(CommandBarFactory.createLookAndFeelCommandBar(this));
      this.getDockableBarManager().addDockableBar(getMyMenuBar());
         
         JTextArea ta = new JTextArea("test test test test\n test test test test\n"+
               "test test test test\n test test test test\n"+
               "test test test test\n test test test test\n"+
               "test test test test\n test test test test\n");

         getDockingManager().setShowWorkspace(false);
         DockableFrame df = new DockableFrame("eeeee");
         df.add(ta);
         getDockingManager().addFrame(df);
      getLayoutPersistence().loadLayoutData();
      
      
   }
   
   private CommandBar getMyMenuBar() {
      CommandBar commandBar = new CommandMenuBar("Menu Bar");
      commandBar.setInitSide(DockableBarContext.DOCK_SIDE_NORTH);
      commandBar.setInitIndex(0);
      commandBar.setPaintBackground(false);
      commandBar.setStretch(true);
      commandBar.setFloatable(true);
      commandBar.setHidable(false);
      
      JideMenu file= new JideMenu("File");
      
      AbstractAction a = new AbstractAction("SaveLayout"){
         public void actionPerformed(ActionEvent e) {
            getLayoutPersistence().saveLayoutData();
            JOptionPane.showMessageDialog(DefaultDialogDockableBarDockableHolderBug.this, "Layout saved");
         }
      };
      
      a.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_DOWN_MASK));
      
      JMenuItem i = new JMenuItem(a);

      file.add(i);
      commandBar.add(file);
      
      commandBar.getContext().setInitMode(DockableBarContext.STATE_HORI_DOCKED);
      return commandBar;
   }
   public static void main(String[] args) {
      SwingUtilities.invokeLater(new Runnable(){
         public void run() {
            final JFrame f = new JFrame("test");
            JButton b = new JButton("show dialog");
            final JCheckBox cb = new JCheckBox("setLayout before");
            
            b.addActionListener(new ActionListener(){
               public void actionPerformed(ActionEvent e) {
                  SwingUtilities.invokeLater(new Runnable(){
                     public void run() {
                        new DefaultDockableBarDockableHolderBug(cb.isSelected());
                     }
                  });
               }
            });
            f.getContentPane().setLayout(new FlowLayout());
            f.getContentPane().add(b);
            
            f.getContentPane().add(cb);
            f.pack();
            JideSwingUtilities.globalCenterWindow(f);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setVisible(true);
         }
      });
   }
}


Thanks
nicola.gioia
 
Posts: 60
Joined: Tue Sep 20, 2005 6:57 am

Postby JIDE Support » Mon Jul 09, 2007 10:52 am

It is not surprise as setLayout will erase all components on the content pane. That's why you see a gray empty panel.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am


Return to Product Suggestions

Who is online

Users browsing this forum: Google [Bot] and 15 guests