* [ 1662486 ] Lazy loading tab not set window size for greatest tab

This commit is contained in:
Heng Sin Low 2007-02-22 12:16:15 +00:00
parent 13445f27c1
commit b606979670
2 changed files with 52 additions and 7 deletions

View File

@ -21,6 +21,7 @@ import java.awt.event.*;
import java.sql.*;
import java.util.logging.*;
import javax.swing.*;
import org.compiere.apps.form.*;
import org.compiere.model.*;
import org.compiere.util.*;
@ -231,17 +232,24 @@ public class AMenuStartItem extends Thread implements ActionListener
return;
SwingUtilities.invokeLater(m_updatePB); // 2
frame.pack();
if (Ini.isPropertyBool(Ini.P_OPEN_WINDOW_MAXIMIZED) )
if (Ini.isPropertyBool(Ini.P_OPEN_WINDOW_MAXIMIZED) )
{
frame.pack();
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
}
// Center the window
SwingUtilities.invokeLater(m_updatePB); // 3
if (Ini.isPropertyBool(Ini.P_OPEN_WINDOW_MAXIMIZED) ) {
if (Ini.isPropertyBool(Ini.P_OPEN_WINDOW_MAXIMIZED) )
{
frame.setVisible(true);
frame.toFront();
} else
}
else
{
frame.validate();
AEnv.showCenterScreen(frame);
}
m_menu.getWindowManager().add(frame);
@ -340,5 +348,5 @@ public class AMenuStartItem extends Thread implements ActionListener
} else
AEnv.showCenterScreen(ff);
} // startForm
} // StartItem
} // StartItem

View File

@ -646,6 +646,8 @@ public final class APanel extends CPanel
// Size
if (windowSize != null)
setPreferredSize(windowSize);
else
revalidate();
Dimension size = getPreferredSize();
log.info( "fini - " + size);
m_curWinTab.requestFocusInWindow();
@ -1033,7 +1035,12 @@ public final class APanel extends CPanel
}
else // Cur Tab Setting
{
m_mWorkbench.getMWindow(0).initTab(m_curTabIndex);
boolean needValidate = false;
if (m_mWorkbench.getMWindow(0).isTabInitialized(m_curTabIndex) == false)
{
m_mWorkbench.getMWindow(0).initTab(m_curTabIndex);
needValidate = true;
}
m_curGC.activate();
m_curTab = m_curGC.getMTab();
@ -1074,6 +1081,32 @@ public final class APanel extends CPanel
m_curTab.navigateCurrent(); // updates counter
m_curGC.dynamicDisplay(0);
}
if (needValidate)
{
JFrame frame = Env.getFrame(APanel.this);
if (frame != null)
{
//not sure why, the following lines is needed to make dynamic resize work
//tested on jdk1.5, 1.6 using jgoodies look and feel
frame.getPreferredSize();
if (frame.getExtendedState() != JFrame.MAXIMIZED_BOTH)
{
frame.setMinimumSize(frame.getSize());
revalidate();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFrame frame = Env.getFrame(APanel.this);
frame.validate();
AEnv.showCenterScreen(frame);
frame.setMinimumSize(null);
}
});
}
}
}
// else ##CHANGE
// m_curTab.navigateCurrent();
}
@ -2025,7 +2058,11 @@ public final class APanel extends CPanel
this, m_curWindowNo, vButton.getProcess_ID(), table_ID,
record_ID, startWOasking);
if (dialog.isValid())
{
dialog.validate();
dialog.pack();
AEnv.showCenterWindow(Env.getWindow(m_curWindowNo), dialog);
}
} // actionButton