|
|
|
@ -4,6 +4,7 @@ import java.awt.Dimension;
|
|
|
|
|
import java.awt.event.ActionEvent; |
|
|
|
|
import java.awt.event.ActionListener; |
|
|
|
|
|
|
|
|
|
import com.fr.base.GraphHelper; |
|
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
|
import com.fr.design.gui.ilable.UILabel; |
|
|
|
|
|
|
|
|
@ -15,6 +16,20 @@ import com.fr.design.gui.itoolbar.UIToolbar;
|
|
|
|
|
public class MaxMemRowCountPanel extends UIToolbar { |
|
|
|
|
private static final int ALL_IN_MEMORY = 0; |
|
|
|
|
private static final int MAX_IN_MEMORY = 1; |
|
|
|
|
private static final String[] CACHE_LIST = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Save_All_Records_In_Memory"), |
|
|
|
|
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Max_Mem_Row_Count") }; |
|
|
|
|
private static final int MAX_WIDTH = getMaxComBoBoxWidth() > 200 ? 350 : 250; |
|
|
|
|
|
|
|
|
|
private static int getMaxComBoBoxWidth() { |
|
|
|
|
int maxWidth = GraphHelper.getWidth(CACHE_LIST[0]); |
|
|
|
|
for (int i = 1; i < CACHE_LIST.length; i++) { |
|
|
|
|
int width = GraphHelper.getWidth(CACHE_LIST[i]); |
|
|
|
|
if (width > maxWidth) { |
|
|
|
|
maxWidth = width; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return maxWidth; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private UISpinner numberSpinner; |
|
|
|
|
private UIComboBox switchCache; |
|
|
|
@ -44,7 +59,7 @@ public class MaxMemRowCountPanel extends UIToolbar {
|
|
|
|
|
@Override |
|
|
|
|
public Dimension getPreferredSize() { |
|
|
|
|
Dimension dim = super.getPreferredSize(); |
|
|
|
|
dim.width = 340; |
|
|
|
|
dim.width = MAX_WIDTH; |
|
|
|
|
return dim; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -52,8 +67,7 @@ public class MaxMemRowCountPanel extends UIToolbar {
|
|
|
|
|
this.setFloatable(false); |
|
|
|
|
this.setRollover(true); |
|
|
|
|
this.setBackground(UIConstants.NORMAL_BACKGROUND); |
|
|
|
|
String[] cacheList = { com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Save_All_Records_In_Memory"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Max_Mem_Row_Count") }; |
|
|
|
|
switchCache = new UIComboBox(cacheList); |
|
|
|
|
switchCache = new UIComboBox(CACHE_LIST); |
|
|
|
|
switchCache.addActionListener(switchStateL); |
|
|
|
|
numberSpinner = new UISpinner(0, Integer.MAX_VALUE, 1); |
|
|
|
|
} |
|
|
|
|