Browse Source

Pull request #2145: MOBILE-28888 Tab手势样式设计器端开发

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

* commit '8798ac45205dcba229dc6c75c57a4f969525d0f8':
  DefaultMobileTemplateStyle 现在也有了通用面板属性 需要调用父类createJson方法 一些笔误
  接口使用调整
  合理import
  MOBILE-28888 Tab手势样式设计器端开发 1. 移动端Tab属性面板新增三个tab通用属性,显示标题,滑动切换,显示圆点指示器(通用样式设置) 2. 兼容旧模版,转换Tab旧样式分散的属性到Tab属性面板的通用属性 3. 移动端共用pc端轮播属性 4. 新增中英文翻译 (amend修改方法修饰符,删除误修改)
  MOBILE-28888 Tab手势样式设计器端开发 1. 移动端Tab属性面板新增三个tab通用属性,显示标题,滑动切换,显示圆点指示器(通用样式设置) 2. 兼容旧模版,转换Tab就样式分散的属性到Tab属性面板的通用属性 3. 新增中英文翻译
feature/big-screen
Hans 4 years ago
parent
commit
840bb35a0f
  1. 12
      designer-base/src/main/java/com/fr/design/style/color/NewColorSelectBox.java
  2. 13
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java
  3. 203
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTabCommonSettingPane.java

12
designer-base/src/main/java/com/fr/design/style/color/NewColorSelectBox.java

@ -30,11 +30,18 @@ public class NewColorSelectBox extends AbstractSelectBox<Color> implements UIObs
iniListener();
}
private void iniListener(){
protected void iniListener(){
if(shouldResponseChangeListener()){
this.addSelectChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
attributeChange();
}
});
}
}
protected void attributeChange() {
if(uiObserverListener == null){
return;
}
@ -43,9 +50,6 @@ public class NewColorSelectBox extends AbstractSelectBox<Color> implements UIObs
}
uiObserverListener.doChange();
}
});
}
}
/**
* 初始化下拉面板

13
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java

@ -19,6 +19,7 @@ import com.fr.design.widget.ui.designer.mobile.component.MobileAdvanceInnerPane;
import com.fr.design.widget.ui.designer.mobile.component.MobileBookMarkUsePane;
import com.fr.design.widget.ui.designer.mobile.component.MobileComponentMarginPane;
import com.fr.design.widget.ui.designer.mobile.component.MobileComponentLayoutIntervalPane;
import com.fr.design.widget.ui.designer.mobile.component.MobileTabCommonSettingPane;
import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
@ -34,6 +35,7 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
private MobileComponentMarginPane marginPane;
private MobileComponentLayoutIntervalPane intervalPane;
private MobileBookMarkUsePane mobileBookMarkUsePane;
private MobileTabCommonSettingPane mobileTabCommonSettingPane;
public TabMobileWidgetDefinePane(XCreator xCreator) {
this.xCreator = xCreator;
@ -73,6 +75,8 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
mobileBookMarkUsePane = new MobileBookMarkUsePane();
innerAdvancePane.add(mobileBookMarkUsePane, BorderLayout.CENTER);
}
mobileTabCommonSettingPane = new MobileTabCommonSettingPane();
innerAdvancePane.add(mobileTabCommonSettingPane, BorderLayout.SOUTH);
innerAdvancePane.add(marginPane, BorderLayout.NORTH);
UIExpandablePane advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, innerAdvancePane);
UIExpandablePane layoutPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, intervalPane);
@ -88,7 +92,8 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
@Override
public void populate(FormDesigner designer) {
WCardTagLayout wCardTagLayout = (WCardTagLayout) xCreator.toData();
templateStyleEditor.setValue((wCardTagLayout).getMobileTemplateStyle());
MobileTemplateStyle mobileTemplateStyle = wCardTagLayout.getMobileTemplateStyle();
templateStyleEditor.setValue(mobileTemplateStyle);
// 数据 populate 完成后,再设置监听
this.bindListeners2Widgets();
this.addAttributeChangeListener(changeListener);
@ -101,6 +106,9 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
if (mobileBookMarkUsePane != null) {
mobileBookMarkUsePane.populate(xCreator);
}
if (mobileTabCommonSettingPane != null) {
mobileTabCommonSettingPane.populate(mobileTemplateStyle);
}
}
@Override
@ -117,5 +125,8 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
if (mobileBookMarkUsePane != null) {
mobileBookMarkUsePane.update(xCreator);
}
if (mobileTabCommonSettingPane != null) {
mobileTabCommonSettingPane.update(wCardTagLayout.getMobileTemplateStyle());
}
}
}

203
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileTabCommonSettingPane.java

@ -0,0 +1,203 @@
package com.fr.design.widget.ui.designer.mobile.component;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.ibutton.ModeButtonGroup;
import com.fr.design.gui.ibutton.UIRadioButton;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.general.cardtag.mobile.MobileTemplateStyle;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JComponent;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
public class MobileTabCommonSettingPane extends BasicPane {
private UICheckBox showTabTitleCheck;
private UICheckBox tabSlideCheck;
private UICheckBox showTabDotIndicatorCheck;
private ModeButtonGroup<Integer> buttonGroup;
private NewColorSelectBox initDotColorBox;
private NewColorSelectBox selectDotColorBox;
public MobileTabCommonSettingPane() {
initComponent();
}
private void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.showTabTitleCheck = new UICheckBox(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Show_Title"), true) {
@Override
protected void initListener() {
this.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
attributeChange();
}
});
}
};
this.tabSlideCheck = new UICheckBox(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Slide"), true) {
@Override
protected void initListener() {
this.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
attributeChange();
}
});
}
};
this.showTabDotIndicatorCheck = new UICheckBox(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Show_Indicator"), true) {
@Override
protected void initListener() {
this.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
attributeChange();
}
});
}
};
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Show_Indicator_type"));
JPanel dotIndicatorShowTypePane = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane();
addIndicatorShowTypeButton(dotIndicatorShowTypePane);
UILabel initColorLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Init_Fill"));
UILabel selectColor = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Select_Fill"));
initDotColorBox = new NewColorSelectBox(0){
@Override
protected void iniListener() {
}
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
this.attributeChange();
}
};
selectDotColorBox = new NewColorSelectBox(0){
@Override
protected void iniListener() {
}
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
this.attributeChange();
}
};
JPanel initDotColorPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initColorLabel, initDotColorBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
JPanel selectDotColorPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectColor, selectDotColorBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM);
double[] rowSize = {TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED};
double[] columnSize = {TableLayout.FILL};
int[][] rowCount = {{1}, {1}, {1}};
double[] verticalGaps = {10, 10, 10};
double[] dotSettingColumnSize = {TableLayout.PREFERRED, TableLayout.FILL};
Component[][] components = new Component[][]{
new Component[]{this.showTabTitleCheck},
new Component[]{this.tabSlideCheck},
new Component[]{this.showTabDotIndicatorCheck}
};
JPanel tabBaseConfigPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount,
IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1);
tabBaseConfigPane.setBorder(BorderFactory.createEmptyBorder(0, 0, IntervalConstants.INTERVAL_L1, 0));
JPanel dotIndicatorSettingPanel = TableLayoutHelper.createDiffVGapTableLayoutPane(new JComponent[][]{
{label, dotIndicatorShowTypePane},
{initColorLabel, initDotColorPane},
{selectColor, selectDotColorPane}}, rowSize, dotSettingColumnSize, 0, verticalGaps);
dotIndicatorSettingPanel.setBorder(
BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L2, IntervalConstants.INTERVAL_L1, 0)
);
final JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane();
jPanel.add(tabBaseConfigPane, BorderLayout.NORTH);
jPanel.add(dotIndicatorSettingPanel, BorderLayout.CENTER);
this.add(jPanel, BorderLayout.CENTER);
showTabDotIndicatorCheck.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
dotIndicatorSettingPanel.setVisible(showTabDotIndicatorCheck.isSelected());
}
});
}
public void populate(MobileTemplateStyle mobileTemplateStyle) {
this.showTabTitleCheck.setSelected(mobileTemplateStyle.isShowTabTitle());
this.showTabDotIndicatorCheck.setSelected(mobileTemplateStyle.isShowDotIndicator());
this.tabSlideCheck.setSelected(mobileTemplateStyle.canSlide());
Color initDotColor = mobileTemplateStyle.getIndicatorInitialColor();
Color selectDotColor = mobileTemplateStyle.getIndicatorSelectColor();
int dotIndicatorShowType = mobileTemplateStyle.getDotIndicatorShowType();
this.populateColorBox(initDotColorBox, initDotColor, MobileTemplateStyle.DEFAULT_INITIAL_DOT_COLOR);
this.populateColorBox(selectDotColorBox, selectDotColor, MobileTemplateStyle.DEFAULT_SELECT_DOT_COLOR);
if (dotIndicatorShowType != buttonGroup.getCurrentSelected()) {
this.buttonGroup.setSelectButton(dotIndicatorShowType);
}
}
public void update(MobileTemplateStyle mobileTemplateStyle) {
mobileTemplateStyle.setShowTabTitle(showTabTitleCheck.isSelected());
mobileTemplateStyle.setShowDotIndicator(showTabDotIndicatorCheck.isSelected());
mobileTemplateStyle.setCanSlide(tabSlideCheck.isSelected());
mobileTemplateStyle.setIndicatorInitialColor(initDotColorBox.getSelectObject());
mobileTemplateStyle.setIndicatorSelectColor(selectDotColorBox.getSelectObject());
mobileTemplateStyle.setDotIndicatorShowType(buttonGroup.getCurrentSelected());
WidgetPropertyPane.getInstance().getEditingFormDesigner().getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED);
}
@Override
protected String title4PopupWindow() {
return "MobileTabCommonSettingPane";
}
private void addIndicatorShowTypeButton(JPanel dotIndicatorShowTypePane) {
UIRadioButton holderPlaceButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Mobile_Tab_Holder_Place"));
holderPlaceButton.setSelected(true);
UIRadioButton floatButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Tab_Float"));
dotIndicatorShowTypePane.add(holderPlaceButton);
dotIndicatorShowTypePane.add(floatButton);
dotIndicatorShowTypePane.setBorder(
BorderFactory.createEmptyBorder(0, IntervalConstants.INTERVAL_L1, 0, 0)
);
buttonGroup = new ModeButtonGroup<>();
buttonGroup.put(MobileTemplateStyle.TYPE_PLACEHOLDER_DOT_INDICATOR, holderPlaceButton);
buttonGroup.put(MobileTemplateStyle.TYPE_FLOAT_DOT_INDICATOR, floatButton);
}
private void populateColorBox(NewColorSelectBox colorBox, Color color, Color defaultColor) {
if (color == null) {
color = defaultColor;
}
if (color != colorBox.getSelectObject()) {
colorBox.setSelectObject(color);
}
}
}
Loading…
Cancel
Save