Browse Source

Pull request #1739: MOBILE-27254 联排按钮Tab样式支持上下边距调整

Merge in DESIGN/design from ~STARRYI/design:release/10.0 to release/10.0

* commit 'b82e174ae31d479d14b0e0b88f0dfe84b4012e4e':
  MOBILE-27254 联排按钮Tab样式支持上下边距调整
  MOBILE-27254 联排按钮Tab样式支持上下边距调整
feature/big-screen
starryi 5 years ago
parent
commit
66809a2981
  1. 2
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java
  2. 26
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java
  3. 39
      designer-base/src/test/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePaneTest.java

2
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileTemplateStyleDefinePane.java

@ -109,7 +109,7 @@ public abstract class MobileTemplateStyleDefinePane extends BasicBeanPane<Mobile
UILabel tabStyleLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Style"));
tabStyleLabel.setPreferredSize(new Dimension(55, 20));
JPanel jPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{tabStyleLabel, custom}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
jPanel.setPreferredSize(new Dimension(200, 20));
jPanel.setPreferredSize(new Dimension(212, 20));
outPanel.add(jPanel);
scrollPanel.add(outPanel, BorderLayout.NORTH);

26
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePane.java

@ -33,6 +33,8 @@ public class UniteStyleDefinePane extends MobileTemplateStyleDefinePane {
private UnsignedIntUISpinner paddingLeftSpinner;
private UnsignedIntUISpinner paddingRightSpinner;
private UnsignedIntUISpinner paddingTopSpinner;
private UnsignedIntUISpinner paddingBottomSpinner;
private NewColorSelectBox initialBackgroundColorBox;
private NewColorSelectBox selectedBackgroundColorBox;
@ -77,6 +79,15 @@ public class UniteStyleDefinePane extends MobileTemplateStyleDefinePane {
}
private JPanel createPaddingConfPane() {
this.paddingTopSpinner = new UnsignedIntUISpinner(0, 30, 1, UniteStyle.DEFAULT_PADDING_TOP);
this.paddingTopSpinner.setPreferredSize(new Dimension(62, LINE_COMPONENT_HEIGHT));
this.paddingBottomSpinner = new UnsignedIntUISpinner(0, 30, 1, UniteStyle.DEFAULT_PADDING_BOTTOM);
this.paddingBottomSpinner.setPreferredSize(new Dimension(62, LINE_COMPONENT_HEIGHT));
UILabel paddingTopLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Base_Top") + ":", SwingConstants.RIGHT);
paddingTopLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT));
UILabel paddingBottomLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Base_Bottom") + ":", SwingConstants.RIGHT);
paddingBottomLabel.setPreferredSize(new Dimension(LABEL_WIDTH / 2, LINE_COMPONENT_HEIGHT));
this.paddingLeftSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, UniteStyle.DEFAULT_PADDING_LEFT);
this.paddingLeftSpinner.setPreferredSize(new Dimension(62, LINE_COMPONENT_HEIGHT));
@ -86,11 +97,12 @@ public class UniteStyleDefinePane extends MobileTemplateStyleDefinePane {
UILabel paddingLeftLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Left") + ":", SwingConstants.RIGHT);
paddingLeftLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT));
UILabel paddingRightLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Right") + ":", SwingConstants.RIGHT);
paddingLeftLabel.setPreferredSize(new Dimension(LABEL_WIDTH, LINE_COMPONENT_HEIGHT));
paddingLeftLabel.setPreferredSize(new Dimension(LABEL_WIDTH / 2, LINE_COMPONENT_HEIGHT));
JPanel paddingPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{
paddingLeftLabel, paddingLeftSpinner, paddingRightLabel,paddingRightSpinner
}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
JPanel paddingPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{
new Component[]{ paddingTopLabel, paddingTopSpinner, paddingBottomLabel, paddingBottomSpinner},
new Component[]{ paddingLeftLabel, paddingLeftSpinner, paddingRightLabel,paddingRightSpinner}
}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
paddingPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 20));
return paddingPanel;
@ -164,6 +176,8 @@ public class UniteStyleDefinePane extends MobileTemplateStyleDefinePane {
@Override
protected void initDefaultConfig() {
this.paddingTopSpinner.setValue(UniteStyle.DEFAULT_PADDING_TOP);
this.paddingBottomSpinner.setValue(UniteStyle.DEFAULT_PADDING_BOTTOM);
this.paddingLeftSpinner.setValue(UniteStyle.DEFAULT_PADDING_LEFT);
this.paddingRightSpinner.setValue(UniteStyle.DEFAULT_PADDING_RIGHT);
@ -191,6 +205,8 @@ public class UniteStyleDefinePane extends MobileTemplateStyleDefinePane {
@Override
public void populateSubStyle(MobileTemplateStyle ob) {
UniteStyle style = (UniteStyle) ob;
this.paddingTopSpinner.setValue(style.getPaddingTop());
this.paddingBottomSpinner.setValue(style.getPaddingBottom());
this.paddingLeftSpinner.setValue(style.getPaddingLeft());
this.paddingRightSpinner.setValue(style.getPaddingRight());
@ -208,6 +224,8 @@ public class UniteStyleDefinePane extends MobileTemplateStyleDefinePane {
@Override
public MobileTemplateStyle updateSubStyle() {
UniteStyle style = new UniteStyle();
style.setPaddingTop((int) this.paddingTopSpinner.getValue());
style.setPaddingBottom((int) this.paddingBottomSpinner.getValue());
style.setPaddingLeft((int) this.paddingLeftSpinner.getValue());
style.setPaddingRight((int) this.paddingRightSpinner.getValue());

39
designer-base/src/test/java/com/fr/design/mainframe/mobile/ui/UniteStyleDefinePaneTest.java

@ -0,0 +1,39 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.cardtag.mobile.UniteStyle;
import com.fr.invoke.Reflect;
import junit.framework.TestCase;
import org.junit.Test;
import java.awt.*;
public class UniteStyleDefinePaneTest extends TestCase {
@Test
public void testDefaultConfig() {
UniteStyleDefinePane definePane = new UniteStyleDefinePane(new WCardTagLayout());
Reflect.on(definePane).call("initDefaultConfig");
double paddingTop = Reflect.on(definePane).field("paddingTopSpinner").call("getValue").get();
assertEquals((int)paddingTop, UniteStyle.DEFAULT_PADDING_TOP);
double paddingBottom = Reflect.on(definePane).field("paddingBottomSpinner").call("getValue").get();
assertEquals((int)paddingBottom, UniteStyle.DEFAULT_PADDING_BOTTOM);
double paddingLeft = Reflect.on(definePane).field("paddingLeftSpinner").call("getValue").get();
assertEquals((int)paddingLeft, UniteStyle.DEFAULT_PADDING_LEFT);
double paddingRight = Reflect.on(definePane).field("paddingRightSpinner").call("getValue").get();
assertEquals((int)paddingRight, UniteStyle.DEFAULT_PADDING_RIGHT);
Color initialBackgroundColor = Reflect.on(definePane).field("initialBackgroundColorBox").call("getSelectObject").get();
assertEquals(initialBackgroundColor, UniteStyle.DEFAULT_INITIAL_BACKGROUND_COLOR);
Color selectedBackgroundColor = Reflect.on(definePane).field("selectedBackgroundColorBox").call("getSelectObject").get();
assertEquals(selectedBackgroundColor, UniteStyle.DEFAULT_SELECTED_BACKGROUND_COLOR);
int lineStyle = Reflect.on(definePane).field("borderWidthComboBox").call("getSelectedLineStyle").get();
assertEquals(lineStyle, UniteStyle.DEFAULT_BORDER_LINE.lineStyle);
Color borderColor = Reflect.on(definePane).field("borderColorBox").call("getSelectObject").get();
assertEquals(borderColor, UniteStyle.DEFAULT_BORDER_LINE.color);
double borderRadius = Reflect.on(definePane).field("borderRadiusSpinner").call("getValue").get();
assertEquals((int)borderRadius, UniteStyle.DEFAULT_BORDER_RADIUS);
}
}
Loading…
Cancel
Save