Browse Source

MOBILE-25397 折叠展开样式设计器部分

feature/big-screen
Hades 5 years ago
parent
commit
6d96de4b77
  1. 62
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java
  2. 125
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStylePane.java
  3. 100
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileComboBoxDialogEditor.java
  4. 23
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java
  5. 21
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java

62
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStyleExpandPane.java

@ -0,0 +1,62 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.widget.UITitleSplitLine;
import com.fr.form.ui.mobile.MobileCollapsedStyle;
import com.fr.form.ui.mobile.MobileFormCollapsedStyle;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/2/13
*/
public class MobileCollapsedStyleExpandPane extends MobileCollapsedStylePane {
private UISpinner rowSpinner;
public MobileCollapsedStyleExpandPane() {
}
@Override
protected JPanel createLinePane() {
UITitleSplitLine splitLine = new UITitleSplitLine(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Line_Number"), 520);
splitLine.setPreferredSize(new Dimension(520, 20));
this.rowSpinner = new UISpinner(1, Integer.MAX_VALUE, 1, 1);
JPanel panel = new JPanel();
panel.setLayout(FRGUIPaneFactory.createBoxFlowLayout());
panel.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Start_From")));
panel.add(rowSpinner);
panel.add(new UILabel("Fine-Design_Mobile_Collapse_Row_To_Fold"));
JPanel linePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
linePane.add(splitLine, BorderLayout.NORTH);
linePane.add(panel, BorderLayout.CENTER);
return linePane;
}
@Override
public void populateBean(MobileCollapsedStyle ob) {
super.populateBean(ob);
rowSpinner.setValue(((MobileFormCollapsedStyle) ob).getLineAttr().getNumber());
}
@Override
public MobileCollapsedStyle updateBean() {
MobileCollapsedStyle style = super.updateBean();
((MobileFormCollapsedStyle) style).getLineAttr().setNumber((int) rowSpinner.getValue());
return style;
}
@Override
protected MobileCollapsedStyle updateDiffBean() {
return new MobileFormCollapsedStyle();
}
}

125
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileCollapsedStylePane.java

@ -0,0 +1,125 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.constants.LayoutConstants;
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.gui.itextfield.UITextField;
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.layout.VerticalFlowLayout;
import com.fr.design.mainframe.widget.UITitleSplitLine;
import com.fr.design.style.color.NewColorSelectBox;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.ui.mobile.CollapseState;
import com.fr.form.ui.mobile.MobileChartCollapsedStyle;
import com.fr.form.ui.mobile.MobileCollapsedStyle;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/2/13
*/
public class MobileCollapsedStylePane extends BasicBeanPane<MobileCollapsedStyle> {
private UICheckBox showButtonCheck;
private NewColorSelectBox buttonColorBox;
private UITextField foldedTextFiled;
private UITextField unfoldedTextFiled;
private ModeButtonGroup<CollapseState> buttonGroup;
public MobileCollapsedStylePane() {
TitledBorder titledBorder = GUICoreUtils.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Set"), null);
VerticalFlowLayout layout = new VerticalFlowLayout(FlowLayout.LEADING, 0, 10);
layout.setAlignLeft(true);
this.setBorder(titledBorder);
this.setLayout(layout);
this.add(createLinePane());
this.add(createSettingPane());
}
private JPanel createSettingPane() {
JPanel settingPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
UITitleSplitLine splitLine = new UITitleSplitLine(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Button"), 520);
splitLine.setPreferredSize(new Dimension(520, 20));
UILabel showButtonLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Show_Button"));
showButtonCheck = new UICheckBox(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Show_Button_On_Right"));
UILabel buttonColorLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Button_Color"));
buttonColorBox = new NewColorSelectBox(137);
UILabel foldedLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Folded_Hint"));
foldedTextFiled = new UITextField();
UILabel unfoldedLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_UnFolded_Hint"));
unfoldedTextFiled = new UITextField();
UILabel defaultStateLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Default_State"));
buttonGroup = new ModeButtonGroup<>();
UIRadioButton foldedButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Fold"));
foldedButton.setSelected(true);
UIRadioButton unfoldedButton = new UIRadioButton(Toolkit.i18nText("Fine-Design_Mobile_Collapse_Unfold"));
buttonGroup.put(CollapseState.FOLDED, foldedButton);
buttonGroup.put(CollapseState.UNFOLDED, unfoldedButton);
JPanel flowLeftPane = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane();
flowLeftPane.add(foldedButton);
flowLeftPane.add(unfoldedButton);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p};
double[] colSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
Component[][] components = new Component[][] {
new Component[] {showButtonLabel, showButtonCheck},
new Component[] {buttonColorLabel, buttonColorBox},
new Component[] {foldedLabel, foldedTextFiled},
new Component[] {unfoldedLabel, unfoldedTextFiled},
new Component[] {defaultStateLabel, flowLeftPane},
};
JPanel buttonPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, colSize, rowCount, LayoutConstants.VGAP_MEDIUM, LayoutConstants.VGAP_MEDIUM);
settingPane.add(splitLine, BorderLayout.NORTH);
settingPane.add(buttonPane, BorderLayout.CENTER);
return settingPane;
}
protected JPanel createLinePane() {
return FRGUIPaneFactory.createBorderLayout_S_Pane();
}
@Override
public void populateBean(MobileCollapsedStyle ob) {
showButtonCheck.setSelected(ob.getCollapseButton().isShowButton());
buttonColorBox.setSelectObject(ob.getCollapseButton().getButtonColor());
foldedTextFiled.setText(ob.getCollapseButton().getFoldedHint());
unfoldedTextFiled.setText(ob.getCollapseButton().getUnfoldedHint());
buttonGroup.setSelectButton(ob.getCollapseButton().getDefaultState());
}
@Override
public MobileCollapsedStyle updateBean() {
MobileCollapsedStyle style = updateDiffBean();
style.getCollapseButton().setShowButton(showButtonCheck.isSelected());
style.getCollapseButton().setButtonColor(buttonColorBox.getSelectObject());
style.getCollapseButton().setFoldedHint(foldedTextFiled.getText());
style.getCollapseButton().setUnfoldedHint(unfoldedTextFiled.getText());
style.getCollapseButton().setDefaultState(buttonGroup.getCurrentSelected());
return style;
}
protected MobileCollapsedStyle updateDiffBean() {
return new MobileChartCollapsedStyle();
}
@Override
protected String title4PopupWindow() {
return Toolkit.i18nText("Fine-Design_Mobile_Collapse_Expand");
}
}

100
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileComboBoxDialogEditor.java

@ -0,0 +1,100 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.i18n.Toolkit;
import com.fr.form.ui.mobile.MobileCollapsedStyle;
import com.fr.general.ComparatorUtils;
import javax.swing.SwingUtilities;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/2/13
*/
public class MobileComboBoxDialogEditor extends BasicPane {
private static final Dimension DEFAULT_DIMENSION = new Dimension(600, 400);
private static final Dimension COMBOX_DIMENSION = new Dimension(135,20);
private static final String NONE = Toolkit.i18nText("无");
private static final String CUSTOM = Toolkit.i18nText("自定义");
private MobileCollapsedStyle style;
private MobileCollapsedStylePane stylePane;
private UIComboBox comboBox;
private ActionListener listener;
public MobileComboBoxDialogEditor(MobileCollapsedStylePane stylePane) {
this.stylePane = stylePane;
this.comboBox = new UIComboBox(new Object[] {NONE, CUSTOM});
this.comboBox.setPreferredSize(COMBOX_DIMENSION);
this.comboBox.setSelectedItem(NONE);
listener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (ComparatorUtils.equals(MobileComboBoxDialogEditor.this.comboBox.getSelectedItem(), CUSTOM)) {
showEditorPane();
}
}
};
this.comboBox.addActionListener(listener);
this.add(comboBox);
}
public boolean isSelectedCustom() {
return ComparatorUtils.equals(CUSTOM, this.comboBox.getSelectedItem());
}
public void setSelected(boolean selectedCustom) {
this.comboBox.removeActionListener(listener);
this.comboBox.setSelectedItem(selectedCustom ? CUSTOM : NONE);
this.comboBox.addActionListener(listener);
}
private void showEditorPane() {
stylePane.setPreferredSize(DEFAULT_DIMENSION);
BasicDialog dialog = stylePane.showWindow(SwingUtilities.getWindowAncestor(this));
dialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
MobileCollapsedStyle style = stylePane.updateBean();
style.setCollapsedWork(true);
setStyle(style);
MobileComboBoxDialogEditor.this.firePropertyChanged();
}
});
stylePane.populateBean(getStyle());
dialog.setVisible(true);
}
protected void firePropertyChanged() {
HistoryTemplateListCache.getInstance().getCurrentEditingTemplate().fireTargetModified();
}
public MobileCollapsedStyle getStyle() {
return style;
}
public void setStyle(MobileCollapsedStyle style) {
this.style = style;
}
@Override
protected String title4PopupWindow() {
return null;
}
}

23
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java

@ -20,7 +20,11 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.mobile.ui.MobileCollapsedStylePane;
import com.fr.design.mainframe.mobile.ui.MobileComboBoxDialogEditor;
import com.fr.form.ui.BaseChartEditor;
import com.fr.form.ui.ChartEditor;
import com.fr.form.ui.mobile.MobileCollapsedStyle;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
@ -49,6 +53,7 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
private UILabel tipLabel;
private UICheckBox allowFullCheckBox;//允许全屏
private UICheckBox functionalWhenUnactivatedCheckBox;//组件未激活时可使用组件内功能
private MobileComboBoxDialogEditor mobileCollapsedStyleEditor;
public ChartEditorDefinePane(XCreator xCreator) {
this.xCreator = xCreator;
@ -102,10 +107,17 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
updateTipLabel();
allowFullCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Allow_Full_Screen"));
functionalWhenUnactivatedCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Functional_When_Unactivated"), true);
mobileCollapsedStyleEditor = new MobileComboBoxDialogEditor(new MobileCollapsedStylePane()) {
@Override
protected void firePropertyChanged() {
ChartEditorDefinePane.this.update();
}
};
Component[][] components = new Component[][]{
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Zoom_In_Logic"), SwingConstants.LEFT), new UILabel(ChartMobileFitAttrState.PROPORTION.description())},
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Zoom_Out_Logic"), SwingConstants.LEFT), zoomOutComboBox},
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Collapse_Expand")), mobileCollapsedStyleEditor},
new Component[] {tipLabel, null},
new Component[] {allowFullCheckBox, null},
new Component[] {functionalWhenUnactivatedCheckBox, null}
@ -113,9 +125,9 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p};
double[] rowSize = {p, p, p, p, p, p};
double[] columnSize = {p,f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 30, LayoutConstants.VGAP_LARGE);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -186,6 +198,10 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
}
}
});
MobileCollapsedStyle style = ((ChartEditor) xCreator.toData()).getMobileCollapsedStyle();
this.mobileCollapsedStyleEditor.setStyle(style);
this.mobileCollapsedStyleEditor.setSelected(style.isCollapsedWork());
}
@Override
@ -200,6 +216,9 @@ public class ChartEditorDefinePane extends MobileWidgetDefinePane {
mobileAttr.setAllowFullScreen(allowFullCheckBox.isSelected());
mobileAttr.setFunctionalWhenUnactivated(!functionalWhenUnactivatedCheckBox.isSelected());
}
MobileCollapsedStyle style = this.mobileCollapsedStyleEditor.getStyle();
((ChartEditor) xCreator.toData()).setMobileCollapsedStyle(style);
style.setCollapsedWork(this.mobileCollapsedStyleEditor.isSelectedCustom());
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来
}
}

21
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ElementCaseDefinePane.java

@ -16,8 +16,11 @@ import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.mobile.ui.MobileCollapsedStyleExpandPane;
import com.fr.design.mainframe.mobile.ui.MobileComboBoxDialogEditor;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.form.ui.mobile.MobileCollapsedStyle;
import com.fr.stable.StringUtils;
import javax.swing.BorderFactory;
@ -51,6 +54,7 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane {
private AttributeChangeListener changeListener;
private UICheckBox allowFullCheckBox;
private UICheckBox functionalWhenUnactivatedCheckBox;
private MobileComboBoxDialogEditor mobileCollapsedStyleEditor;
public ElementCaseDefinePane(XCreator xCreator) {
this.xCreator = xCreator;
@ -90,9 +94,17 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane {
functionalWhenUnactivatedCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Functional_When_Unactivated"), true);
mobileCollapsedStyleEditor = new MobileComboBoxDialogEditor(new MobileCollapsedStyleExpandPane()) {
@Override
protected void firePropertyChanged() {
ElementCaseDefinePane.this.update();
}
};
Component[][] components = new Component[][]{
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Horizontal"), SwingConstants.LEFT), hComboBox},
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Vertical"), SwingConstants.LEFT), vComboBox},
new Component[] {new UILabel(com.fr.design.i18n.Toolkit.i18nText("展开收起")), mobileCollapsedStyleEditor},
new Component[] {heightRestrictCheckBox, null},
new Component[] {allowFullCheckBox, null},
new Component[] {functionalWhenUnactivatedCheckBox, null},
@ -100,9 +112,9 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane {
};
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p, p, p, p};
double[] rowSize = {p, p, p, p, p, p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}, {1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 30, LayoutConstants.VGAP_LARGE);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane();
@ -144,6 +156,8 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane {
this.maxHeightSpinner.setValue(elementCaseEditor.getHeightPercent());
this.allowFullCheckBox.setSelected(elementCaseEditor.isAllowFullScreen());
this.functionalWhenUnactivatedCheckBox.setSelected(!elementCaseEditor.isFunctionalWhenUnactivated());
this.mobileCollapsedStyleEditor.setStyle(elementCaseEditor.getMobileCollapsedStyle());
this.mobileCollapsedStyleEditor.setSelected(elementCaseEditor.getMobileCollapsedStyle().isCollapsedWork());
}
@Override
@ -172,6 +186,9 @@ public class ElementCaseDefinePane extends MobileWidgetDefinePane {
case "functionalWhenUnactivatedCheckBox":
((ElementCaseEditor) xCreator.toData()).setFunctionalWhenUnactivated(!functionalWhenUnactivatedCheckBox.isSelected());
}
MobileCollapsedStyle style = this.mobileCollapsedStyleEditor.getStyle();
style.setCollapsedWork(this.mobileCollapsedStyleEditor.isSelectedCustom());
((ElementCaseEditor) xCreator.toData()).setMobileCollapsedStyle(style);
}
private void setGlobalNames() {

Loading…
Cancel
Save