DefaultDialogDockableBarHolder problem

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.

DefaultDialogDockableBarHolder problem

Postby nicola.gioia » Wed Jul 18, 2007 3:35 am

I have a problem using the DefaultDialogDockableBarHolder class.
I create a subclass of DefaultDialogDockableBarHolder to create a modal dialog.
In this modal dialog I have a problem: tha layout is not saved, because when I try to save the layout the variable _loadingLayoutData of the class AbstractLayoutPersistence has the true value (because the loading is never ended in the modal dialog I think).
I have writed a wrong code, or the problem is elsewere?
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.swing.*;

public class DockableBarBug extends DefaultDialogDockableBarHolder {
   private static final String PROFILE_NAME = "ppppprofile";

   public DockableBarBug(Frame parent) {
      super(parent);
      getLayoutPersistence().setProfileKey(PROFILE_NAME);

      DockableBarManager dbm = this.getDockableBarManager();
      dbm.setProfileKey(PROFILE_NAME);
      getLayoutPersistence().beginLoadLayoutData();
         dbm.addDockableBar(createCommandBar());
         ((ContentContainer)getContentPane().getComponent(0)).add(new JTextArea("test test test\ntest test test\ntest test"));
         setLocationRelativeTo(parent);
         setDefaultCloseOperation(DISPOSE_ON_CLOSE);
         //save the last used layout on closing
         addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
               getLayoutPersistence().saveLayoutData();
            }
         });
         setModal(true);
   
         pack();
         JideSwingUtilities.globalCenterWindow(this);
      getLayoutPersistence().loadLayoutData();

   }
   
   private CommandBar createCommandBar() {
      CommandBar argr = new CommandBar();
      
      argr.setInitSide(DockableBarContext.DOCK_SIDE_NORTH);
      argr.setInitMode(DockableBarContext.STATE_HORI_DOCKED);
      argr.setInitIndex(1);
      argr.setFloatable(true);
      
      JideButton bt = new JideButton("b1");
      argr.add(bt);
      bt = new JideButton("b2");
      argr.add(bt);
      argr.addSeparator();
      bt = new JideButton("b3");
      argr.add(bt);
      bt = new JideButton("b4");
      argr.add(bt);
      return argr;
   }
   
   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");
            
            b.addActionListener(new ActionListener(){
               public void actionPerformed(ActionEvent e) {
                  SwingUtilities.invokeLater(new Runnable(){
                     public void run() {
                        new DockableBarBug(f);
                     }
                  });
               }
            });
            f.getContentPane().setLayout(new FlowLayout());
            f.getContentPane().add(b);
            
            f.pack();
            JideSwingUtilities.globalCenterWindow(f);
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.setVisible(true);
         }
      });
   }
}
nicola.gioia
 
Posts: 60
Joined: Tue Sep 20, 2005 6:57 am

Postby JIDE Support » Wed Jul 18, 2007 7:29 am

If you use modal dialog, loadLayoutData will never end. That's why _loadingLayoutData is true. The workaround is to ask loadLayoutData not set the dialog visible and we manually make it visible after layout is loaded.

Code: Select all
      getDockableBarManager().setShowInitial(false);
      getLayoutPersistence().loadLayoutData();
      getDockableBarManager().showInitial();
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Postby nicola.gioia » Wed Jul 18, 2007 9:06 am

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

Postby nicola.gioia » Fri Jul 20, 2007 1:40 am

another question...
If I use a DefaultDialogDockableBarDockableHolder instead of a DefaultDialogDockableBarDockableHolder the procedure is
Code: Select all
getDockableBarManager().setShowInitial(false);
getDockingManager().setShowInitial(false);
getLayoutPersistence().loadLayoutData();
getDockableBarManager().showInitial();
getDockingManager().showInitial();


or there is another procedure?
(this procedure cause the open of the dialog 2 times instead of one)

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

Postby JIDE Support » Fri Jul 20, 2007 7:32 am

You only use one of it.

Code: Select all
getDockingManager().setShowInitial(false);
getLayoutPersistence().loadLayoutData();
getDockingManager().showInitial();
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 37219
Joined: Sun Sep 14, 2003 10:49 am

Postby nicola.gioia » Tue Jul 24, 2007 6:01 am

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


Return to Product Suggestions

Who is online

Users browsing this forum: No registered users and 9 guests

cron