Browse Source

Pull request #15182: REPORT-138579 fix: ComboBox宽度重复缩放导致布局异常

Merge in DESIGN/design from ~LEVY.XIE/design:fbp/master to fbp/master

* commit '15d8625836eaef2aa8b64903a26ecd71d54a0638':
  REPORT-138579 fix: ComboBox宽度重复缩放导致布局异常
  REPORT-138579 fix: ComboBox宽度重复缩放导致布局异常
fbp/master
Levy.Xie-解安森 2 months ago
parent
commit
51a9b40320
  1. 6
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java
  2. 2
      designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBox.java

6
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/MaxMemRowCountPanel.java

@ -17,6 +17,7 @@ import com.fr.stable.StringUtils;
import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX; import static com.fine.theme.utils.FineClientProperties.ADAPTIVE_COMBO_BOX;
import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE; import static com.fine.theme.utils.FineClientProperties.COMBO_BOX_TYPE;
import static com.fine.theme.utils.FineUIScale.scale;
public class MaxMemRowCountPanel extends UIToolbar { public class MaxMemRowCountPanel extends UIToolbar {
@ -24,9 +25,9 @@ public class MaxMemRowCountPanel extends UIToolbar {
private static final int MAX_IN_MEMORY = 1; 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"), 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") }; com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Max_Mem_Row_Count") };
private static final int MAX_WIDTH = getMaxComBoBoxWidth() > 200 ? 350 : 280; private static final int MAX_WIDTH = getMaxWidth();
private static final int MAX_COMPONENT_COUNT_OF_MAX_MEMORY = 4; private static final int MAX_COMPONENT_COUNT_OF_MAX_MEMORY = 4;
private static int getMaxComBoBoxWidth() { private static int getMaxWidth() {
int maxWidth = GraphHelper.getWidth(CACHE_LIST[0]); int maxWidth = GraphHelper.getWidth(CACHE_LIST[0]);
for (int i = 1; i < CACHE_LIST.length; i++) { for (int i = 1; i < CACHE_LIST.length; i++) {
int width = GraphHelper.getWidth(CACHE_LIST[i]); int width = GraphHelper.getWidth(CACHE_LIST[i]);
@ -34,6 +35,7 @@ public class MaxMemRowCountPanel extends UIToolbar {
maxWidth = width; maxWidth = width;
} }
} }
maxWidth = maxWidth > scale(200) ? scale(350) : scale(280);
return maxWidth; return maxWidth;
} }

2
designer-base/src/main/java/com/fr/design/gui/icombobox/UIComboBox.java

@ -162,7 +162,7 @@ public class UIComboBox extends JComboBox implements UIObserver, GlobalNameObser
int renderFix = FineUIScale.scale(5); int renderFix = FineUIScale.scale(5);
int comboHeight = FineUIUtils.getAndScaleInt("ComboBox.comboHeight", 24); int comboHeight = FineUIUtils.getAndScaleInt("ComboBox.comboHeight", 24);
//renderFix的原因在于:render里,每一个项前面了空了一格,要多几像素 //renderFix的原因在于:render里,每一个项前面了空了一格,要多几像素
return new Dimension(FineUIScale.scale(super.getPreferredSize().width) + renderFix, comboHeight); return new Dimension(super.getPreferredSize().width + renderFix, comboHeight);
} }
public void refreshBoxItems(List list) { public void refreshBoxItems(List list) {

Loading…
Cancel
Save