Browse Source

REPORT-19462

research/11.0
Hades 5 years ago
parent
commit
d1b2e791e4
  1. 51
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java
  2. 27
      designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java
  3. 40
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java
  4. 19
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java
  5. 92
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java
  6. 18
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentLayoutIntervalPane.java
  7. 10
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentMarginPane.java

51
designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UICheckListPopup.java

@ -7,12 +7,25 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.gui.imenu.UIPopupMenu;
import com.fr.design.icon.IconPathConstants; import com.fr.design.icon.IconPathConstants;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.IOUtils;
import javax.swing.*;
import java.awt.*; import javax.swing.JCheckBox;
import java.awt.event.*; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
public class UICheckListPopup extends UIPopupMenu { public class UICheckListPopup extends UIPopupMenu {
private List<ActionListener> listeners = new ArrayList<ActionListener>(); private List<ActionListener> listeners = new ArrayList<ActionListener>();
@ -66,10 +79,10 @@ public class UICheckListPopup extends UIPopupMenu {
} }
addSelectListener(); addSelectListener();
jScrollPane.setPreferredSize(new Dimension(200, checkBoxList.size() * CHECKBOX_HEIGHT + 10)); jScrollPane.setPreferredSize(new Dimension(130, checkBoxList.size() * CHECKBOX_HEIGHT + 10));
//超过1页的数量时显示滚动条 //超过1页的数量时显示滚动条
if (checkBoxList.size() > maxDisplayNumber) { if (checkBoxList.size() > maxDisplayNumber) {
jScrollPane.setPreferredSize(new Dimension(200, maxDisplayNumber * CHECKBOX_HEIGHT)); jScrollPane.setPreferredSize(new Dimension(130, maxDisplayNumber * CHECKBOX_HEIGHT));
} }
checkboxPane.repaint(); checkboxPane.repaint();
jScrollPane.repaint(); jScrollPane.repaint();
@ -77,11 +90,11 @@ public class UICheckListPopup extends UIPopupMenu {
private void addOneCheckValue(Object checkValue) { private void addOneCheckValue(Object checkValue) {
JPanel checkPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); JPanel checkPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane();
checkPane.setPreferredSize(new Dimension(185, CHECKBOX_HEIGHT)); checkPane.setPreferredSize(new Dimension(120, CHECKBOX_HEIGHT));
final JCheckBox temp = createCheckbox(); final JCheckBox temp = createCheckbox();
final UILabel label = new UILabel(checkValue.toString()); final UILabel label = new UILabel(checkValue.toString());
label.setBackground(Color.WHITE); label.setBackground(Color.WHITE);
label.setPreferredSize(new Dimension(156, 20)); label.setPreferredSize(new Dimension(80, 20));
checkPane.setBackground(Color.WHITE); checkPane.setBackground(Color.WHITE);
checkPane.add(temp); checkPane.add(temp);
checkPane.add(label); checkPane.add(label);
@ -95,8 +108,8 @@ public class UICheckListPopup extends UIPopupMenu {
JCheckBox checkBox = new JCheckBox(); JCheckBox checkBox = new JCheckBox();
checkBox.setPreferredSize(new Dimension(20, 20)); checkBox.setPreferredSize(new Dimension(20, 20));
checkBox.setBackground(Color.WHITE); checkBox.setBackground(Color.WHITE);
checkBox.setIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_NORMAL)); checkBox.setIcon(IOUtils.readIcon(IconPathConstants.CHECKBOX_NORMAL));
checkBox.setSelectedIcon(BaseUtils.readIcon(IconPathConstants.CHECKBOX_SELECTED)); checkBox.setSelectedIcon(IOUtils.readIcon(IconPathConstants.CHECKBOX_SELECTED));
return checkBox; return checkBox;
} }
@ -109,10 +122,12 @@ public class UICheckListPopup extends UIPopupMenu {
*/ */
private void addMouseListener(final JCheckBox checkBox, final UILabel label) { private void addMouseListener(final JCheckBox checkBox, final UILabel label) {
label.addMouseListener(new MouseAdapter() { label.addMouseListener(new MouseAdapter() {
@Override
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
label.setBackground(Color.WHITE); label.setBackground(Color.WHITE);
} }
@Override
public void mouseEntered(MouseEvent e) { public void mouseEntered(MouseEvent e) {
label.setOpaque(true); label.setOpaque(true);
label.setBackground(mouseEnteredColor); label.setBackground(mouseEnteredColor);
@ -133,6 +148,7 @@ public class UICheckListPopup extends UIPopupMenu {
JCheckBox checkBox = checkBoxList.get(i); JCheckBox checkBox = checkBoxList.get(i);
if (i == 0) { if (i == 0) {
checkBox.addItemListener(new ItemListener() { checkBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
//全选checkbox事件 //全选checkbox事件
doSelectAll(checkBoxList.get(0).isSelected()); doSelectAll(checkBoxList.get(0).isSelected());
@ -140,6 +156,7 @@ public class UICheckListPopup extends UIPopupMenu {
}); });
} else { } else {
checkBox.addItemListener(new ItemListener() { checkBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) { public void itemStateChanged(ItemEvent e) {
//do半选判断放在commit事件里 //do半选判断放在commit事件里
commit(); commit();
@ -157,8 +174,17 @@ public class UICheckListPopup extends UIPopupMenu {
private void doSelectAll(boolean isSelected) { private void doSelectAll(boolean isSelected) {
for (int i = 1; i < checkBoxList.size(); i++) { for (int i = 1; i < checkBoxList.size(); i++) {
//全选和反全选都不考虑全选按钮本身 //全选和反全选都不考虑全选按钮本身
if (!SELECT_ALL.equals(checkBoxList.get(i).getText())) if (!SELECT_ALL.equals(checkBoxList.get(i).getText())) {
checkBoxList.get(i).setSelected(isSelected); checkBoxList.get(i).setSelected(isSelected);
}
}
}
public void setSelectedValue(Map<Object, Boolean> selectedValues) {
List<Object> allValue = Arrays.asList(values);
for (Object value : selectedValues.keySet()) {
int index = allValue.indexOf(value);
checkBoxList.get(index + 1).setSelected(selectedValues.get(value));
} }
} }
@ -214,8 +240,9 @@ public class UICheckListPopup extends UIPopupMenu {
} }
public void addActionListener(ActionListener listener) { public void addActionListener(ActionListener listener) {
if (!listeners.contains(listener)) if (!listeners.contains(listener)) {
listeners.add(listener); listeners.add(listener);
}
} }
public void removeActionListener(ActionListener listener) { public void removeActionListener(ActionListener listener) {

27
designer-base/src/main/java/com/fr/design/gui/icombocheckbox/UIComboCheckBox.java

@ -11,14 +11,23 @@ import com.fr.design.icon.IconPathConstants;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.Icon;
import java.awt.*; import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.FontMetrics;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 设计器下拉复选框组件 * 设计器下拉复选框组件
@ -125,7 +134,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
private UITextField createEditor() { private UITextField createEditor() {
UITextField editor = new UITextField(); UITextField editor = new UITextField();
editor.setEditable(false); editor.setEditable(false);
editor.setPreferredSize(new Dimension(180, 20)); editor.setPreferredSize(new Dimension(110, 20));
addPopupListener(editor); addPopupListener(editor);
return editor; return editor;
@ -138,6 +147,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
*/ */
private void addPopupListener(Component component) { private void addPopupListener(Component component) {
component.addMouseListener(new MouseAdapter() { component.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
togglePopup(); togglePopup();
} }
@ -166,6 +176,7 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
private class PopupAction implements ActionListener { private class PopupAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals(UICheckListPopup.COMMIT_EVENT)) { if (e.getActionCommand().equals(UICheckListPopup.COMMIT_EVENT)) {
selectedValues = popup.getSelectedValues(); selectedValues = popup.getSelectedValues();
@ -292,13 +303,15 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
} }
public void addActionListener(ActionListener listener) { public void addActionListener(ActionListener listener) {
if (!listeners.contains(listener)) if (!listeners.contains(listener)) {
listeners.add(listener); listeners.add(listener);
}
} }
public void removeActionListener(ActionListener listener) { public void removeActionListener(ActionListener listener) {
if (listeners.contains(listener)) if (listeners.contains(listener)) {
listeners.remove(listener); listeners.remove(listener);
}
} }
protected void fireActionPerformed(ActionEvent e) { protected void fireActionPerformed(ActionEvent e) {
@ -307,6 +320,10 @@ public class UIComboCheckBox extends JComponent implements UIObserver, GlobalNam
} }
} }
public void setSelectedValues(Map<Object, Boolean> map) {
popup.setSelectedValue(map);
}
/** /**
* 简单的测试demo * 简单的测试demo
* @param args * @param args

40
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java

@ -11,7 +11,8 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.MobileWidgetListPane; import com.fr.design.mainframe.MobileWidgetListPane;
import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.widget.ui.designer.mobile.component.MobileComponentAdvancePane; import com.fr.design.widget.ui.designer.mobile.component.MobileComponentFrozenPane;
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.MobileComponentLayoutIntervalPane;
import com.fr.form.ui.RichStyleWidgetProvider; import com.fr.form.ui.RichStyleWidgetProvider;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WFitLayout;
@ -30,8 +31,11 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane {
private AttributeChangeListener changeListener; private AttributeChangeListener changeListener;
private UICheckBox appRelayoutCheck; private UICheckBox appRelayoutCheck;
private MobileWidgetListPane mobileWidgetListPane; private MobileWidgetListPane mobileWidgetListPane;
private MobileComponentAdvancePane advancePane; private MobileComponentMarginPane marginPane;
private MobileComponentLayoutIntervalPane intervalPane; private MobileComponentLayoutIntervalPane intervalPane;
private MobileComponentFrozenPane frozenPane;
private UIExpandablePane advancePane;
private UIExpandablePane layoutPane;
public BodyMobileDefinePane(XCreator xCreator) { public BodyMobileDefinePane(XCreator xCreator) {
this.bodyCreator = xCreator; this.bodyCreator = xCreator;
@ -89,16 +93,23 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane {
private JPanel createNorthPane() { private JPanel createNorthPane() {
JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane();
holder.add(getMobilePropertyPane(), BorderLayout.NORTH); holder.add(getMobilePropertyPane(), BorderLayout.NORTH);
marginPane = new MobileComponentMarginPane(FormBodyPaddingAttrMark.XML_TAG);
advancePane = new MobileComponentAdvancePane(FormBodyPaddingAttrMark.XML_TAG);
intervalPane = new MobileComponentLayoutIntervalPane(FormBodyPaddingAttrMark.XML_TAG); intervalPane = new MobileComponentLayoutIntervalPane(FormBodyPaddingAttrMark.XML_TAG);
frozenPane = new MobileComponentFrozenPane();
JPanel wrapLayoutPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
wrapLayoutPane.add(intervalPane, BorderLayout.NORTH);
wrapLayoutPane.add(frozenPane, BorderLayout.CENTER);
advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, marginPane);
layoutPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, wrapLayoutPane);
//高级 //高级
holder.add(advancePane, BorderLayout.CENTER); holder.add(advancePane, BorderLayout.CENTER);
//布局 //布局
holder.add(intervalPane, BorderLayout.SOUTH); holder.add(layoutPane, BorderLayout.SOUTH);
advancePane.setVisible(!shouldHidePadding(designer)); boolean flag = !shouldHidePadding(designer);
intervalPane.setVisible(!shouldHidePadding(designer)); advancePane.setVisible(flag);
layoutPane.setVisible(flag);
frozenPane.setVisible(appRelayoutCheck.isSelected());
return holder; return holder;
} }
@ -137,13 +148,12 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane {
public void populate(FormDesigner designer) { public void populate(FormDesigner designer) {
this.designer = designer; this.designer = designer;
appRelayoutCheck.setSelected(FormDesignerUtils.isAppRelayout(designer)); appRelayoutCheck.setSelected(FormDesignerUtils.isAppRelayout(designer));
// 数据 populate 完成后,再设置监听 // 数据 populate 完成后,再设置监听
this.bindListeners2Widgets(); this.bindListeners2Widgets();
this.addAttributeChangeListener(changeListener); this.addAttributeChangeListener(changeListener);
marginPane.populate((RichStyleWidgetProvider) getBodyCreator().toData());
advancePane.populate((RichStyleWidgetProvider) getBodyCreator().toData());
intervalPane.populate((RichStyleWidgetProvider) getBodyCreator().toData()); intervalPane.populate((RichStyleWidgetProvider) getBodyCreator().toData());
frozenPane.populate(designer.getSelectionModel().getSelection().getSelectedCreator());
} }
@Override @Override
@ -152,15 +162,19 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane {
setAppRelayout(appRelayoutCheck.isSelected()); setAppRelayout(appRelayoutCheck.isSelected());
boolean appPaddingVisible = appRelayout || !FormDesignerUtils.isBodyAbsolute(designer); boolean appPaddingVisible = appRelayout || !FormDesignerUtils.isBodyAbsolute(designer);
advancePane.setVisible(appPaddingVisible); advancePane.setVisible(appPaddingVisible);
intervalPane.setVisible(appPaddingVisible); layoutPane.setVisible(appPaddingVisible);
frozenPane.setVisible(appRelayout);
mobileWidgetListPane.updateToDesigner(); mobileWidgetListPane.updateToDesigner();
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED); designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED);
if (advancePane.isVisible()) { if (advancePane.isVisible()) {
advancePane.update((RichStyleWidgetProvider) getBodyCreator().toData()); marginPane.update((RichStyleWidgetProvider) getBodyCreator().toData());
} }
if (intervalPane.isVisible()) { if (layoutPane.isVisible()) {
intervalPane.update((RichStyleWidgetProvider) getBodyCreator().toData()); intervalPane.update((RichStyleWidgetProvider) getBodyCreator().toData());
} }
if (appRelayout) {
frozenPane.update(designer.getSelectionModel().getSelection().getSelectedCreator());
}
} }
} }

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

@ -4,6 +4,7 @@ import com.fr.base.iofile.attr.FormTabPaddingAttrMark;
import com.fr.design.constants.LayoutConstants; import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -13,7 +14,7 @@ import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.accessibles.AccessibleTemplateStyleEditor; import com.fr.design.mainframe.widget.accessibles.AccessibleTemplateStyleEditor;
import com.fr.design.mainframe.widget.accessibles.MobileTemplateStylePane; import com.fr.design.mainframe.widget.accessibles.MobileTemplateStylePane;
import com.fr.design.widget.ui.designer.mobile.component.MobileComponentAdvancePane; 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.MobileComponentLayoutIntervalPane;
import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WCardTagLayout;
import com.fr.general.cardtag.mobile.MobileTemplateStyle; import com.fr.general.cardtag.mobile.MobileTemplateStyle;
@ -27,7 +28,7 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
private FormDesigner designer; // 当前设计器 private FormDesigner designer; // 当前设计器
private AccessibleTemplateStyleEditor templateStyleEditor; private AccessibleTemplateStyleEditor templateStyleEditor;
private AttributeChangeListener changeListener; private AttributeChangeListener changeListener;
private MobileComponentAdvancePane advancePane; private MobileComponentMarginPane marginPane;
private MobileComponentLayoutIntervalPane intervalPane; private MobileComponentLayoutIntervalPane intervalPane;
public TabMobileWidgetDefinePane(XCreator xCreator) { public TabMobileWidgetDefinePane(XCreator xCreator) {
@ -61,12 +62,14 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane();
holder.add(jPanel, BorderLayout.NORTH); holder.add(jPanel, BorderLayout.NORTH);
if (!shouldHidePadding(designer)) { if (!shouldHidePadding(designer)) {
advancePane = new MobileComponentAdvancePane(FormTabPaddingAttrMark.XML_TAG); marginPane = new MobileComponentMarginPane(FormTabPaddingAttrMark.XML_TAG);
intervalPane = new MobileComponentLayoutIntervalPane(FormTabPaddingAttrMark.XML_TAG); intervalPane = new MobileComponentLayoutIntervalPane(FormTabPaddingAttrMark.XML_TAG);
UIExpandablePane advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, marginPane);
UIExpandablePane layoutPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, intervalPane);
//高级 //高级
holder.add(advancePane, BorderLayout.CENTER); holder.add(advancePane, BorderLayout.CENTER);
//布局 //布局
holder.add(intervalPane, BorderLayout.SOUTH); holder.add(layoutPane, BorderLayout.SOUTH);
} }
this.add(holder, BorderLayout.NORTH); this.add(holder, BorderLayout.NORTH);
@ -78,8 +81,8 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
// 数据 populate 完成后,再设置监听 // 数据 populate 完成后,再设置监听
this.bindListeners2Widgets(); this.bindListeners2Widgets();
this.addAttributeChangeListener(changeListener); this.addAttributeChangeListener(changeListener);
if (advancePane != null) {//业务层面可以写成shouldHidePadding但是这样写应该性能差点 if (marginPane != null) {//业务层面可以写成shouldHidePadding但是这样写应该性能差点
advancePane.populate((WCardTagLayout) xCreator.toData()); marginPane.populate((WCardTagLayout) xCreator.toData());
} }
if (intervalPane != null) { if (intervalPane != null) {
intervalPane.populate((WCardTagLayout) xCreator.toData()); intervalPane.populate((WCardTagLayout) xCreator.toData());
@ -90,8 +93,8 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
public void update() { public void update() {
((WCardTagLayout) xCreator.toData()).setMobileTemplateStyle((MobileTemplateStyle) templateStyleEditor.getValue()); ((WCardTagLayout) xCreator.toData()).setMobileTemplateStyle((MobileTemplateStyle) templateStyleEditor.getValue());
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来 DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来
if (advancePane != null) { if (marginPane != null) {
advancePane.update((WCardTagLayout) xCreator.toData()); marginPane.update((WCardTagLayout) xCreator.toData());
} }
if (intervalPane != null) { if (intervalPane != null) {
intervalPane.update((WCardTagLayout) xCreator.toData()); intervalPane.update((WCardTagLayout) xCreator.toData());

92
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java

@ -0,0 +1,92 @@
package com.fr.design.widget.ui.designer.mobile.component;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.dialog.BasicPane;
import com.fr.design.gui.icombocheckbox.UIComboCheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WSortLayout;
import com.fr.stable.ArrayUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author Hades
* @date 2019/8/14
*/
public class MobileComponentFrozenPane extends BasicPane {
private UIComboCheckBox uiComboCheckBox;
public MobileComponentFrozenPane() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel frozenLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Component_Frozen"));
uiComboCheckBox = new UIComboCheckBox(initData());
JPanel wrapJPanel = UIComponentUtils.wrapWithBorderLayoutPane(uiComboCheckBox);
Component[][] components = new Component[][]{
new Component[]{frozenLabel, wrapJPanel}
};
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
centerPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L5, 10, 0));
JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane();
holder.add(centerPane, BorderLayout.NORTH);
this.add(holder, BorderLayout.NORTH);
}
private String[] initData() {
FormDesigner designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
XCreator selectedCreator = designer.getSelectionModel().getSelection().getSelectedCreator();
Widget selectedModel = selectedCreator != null ? selectedCreator.toData() : null;
if (selectedModel == null || !selectedModel.acceptType(WSortLayout.class)) {
return ArrayUtils.EMPTY_STRING_ARRAY;
}
List<String> widgetList = ((WSortLayout) selectedModel).getNonContainerWidgetList();
return widgetList.toArray(new String[0]);
}
public void update(XCreator xCreator) {
List<String> selected = new ArrayList<>();
WSortLayout wSortLayout = ((WSortLayout) xCreator.toData());
Object[] values = uiComboCheckBox.getSelectedValues();
for (Object widgetName : values) {
selected.add((String) widgetName);
}
wSortLayout.updateFrozenWidgets(selected);
}
public void populate(XCreator xCreator) {
WSortLayout wSortLayout = ((WSortLayout) xCreator.toData());
List<String> all = wSortLayout.getNonContainerWidgetList();
List<String> selected = wSortLayout.getFrozenWidgets();
Map<Object, Boolean> map = new LinkedHashMap<>();
for (String value : selected) {
map.put(value, true);
}
all.removeAll(selected);
for (String value : all) {
map.put(value, false);
}
uiComboCheckBox.setSelectedValues(map);
}
@Override
protected String title4PopupWindow() {
return "ComponentFrozenPane";
}
}

18
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentLayoutIntervalPane.java

@ -3,7 +3,6 @@ package com.fr.design.widget.ui.designer.mobile.component;
import com.fr.base.iofile.attr.AttrMarkFactory; import com.fr.base.iofile.attr.AttrMarkFactory;
import com.fr.base.iofile.attr.FormBodyPaddingAttrMark; import com.fr.base.iofile.attr.FormBodyPaddingAttrMark;
import com.fr.design.designer.IntervalConstants; import com.fr.design.designer.IntervalConstants;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UISpinner; import com.fr.design.gui.ispinner.UISpinner;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -29,24 +28,17 @@ public class MobileComponentLayoutIntervalPane extends XmlRelationedBasicPane {
super(xmlTag); super(xmlTag);
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
UILabel intervalLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Component_Interval")); UILabel intervalLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Component_Interval"));
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p};
double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}};
componentIntervel = new UISpinner(0, Integer.MAX_VALUE, 1, FormBodyPaddingAttrMark.DEFAULT_SIZE); componentIntervel = new UISpinner(0, Integer.MAX_VALUE, 1, FormBodyPaddingAttrMark.DEFAULT_SIZE);
JPanel componentIntervelPane = UIComponentUtils.wrapWithBorderLayoutPane(componentIntervel); JPanel componentIntervalPane = UIComponentUtils.wrapWithBorderLayoutPane(componentIntervel);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{intervalLabel, componentIntervelPane} new Component[]{intervalLabel, componentIntervalPane}
}; };
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1); JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane(components, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, IntervalConstants.INTERVAL_L1);
centerPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L5, 0, 0)); centerPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L5, 10, 0));
JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel holder = FRGUIPaneFactory.createBorderLayout_S_Pane();
holder.add(centerPane, BorderLayout.NORTH); holder.add(centerPane, BorderLayout.NORTH);
UIExpandablePane layoutExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, holder); this.add(holder, BorderLayout.NORTH);
this.add(layoutExpandablePane, BorderLayout.NORTH);
} }
@Override @Override

10
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentAdvancePane.java → designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentMarginPane.java

@ -2,7 +2,6 @@ package com.fr.design.widget.ui.designer.mobile.component;
import com.fr.base.iofile.attr.AttrMarkFactory; import com.fr.base.iofile.attr.AttrMarkFactory;
import com.fr.base.iofile.attr.FormBodyPaddingAttrMark; import com.fr.base.iofile.attr.FormBodyPaddingAttrMark;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.widget.ui.designer.XmlRelationedBasicPane; import com.fr.design.widget.ui.designer.XmlRelationedBasicPane;
import com.fr.design.widget.ui.designer.component.PaddingBoundPane; import com.fr.design.widget.ui.designer.component.PaddingBoundPane;
@ -13,20 +12,19 @@ import java.awt.BorderLayout;
/** /**
* 只有内边距设置的高级设置 * 只有内边距设置的高级设置
*/ */
public class MobileComponentAdvancePane extends XmlRelationedBasicPane { public class MobileComponentMarginPane extends XmlRelationedBasicPane {
private PaddingBoundPane paddingBound; private PaddingBoundPane paddingBound;
public MobileComponentAdvancePane(String xmlTag) { public MobileComponentMarginPane(String xmlTag) {
super(xmlTag); super(xmlTag);
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
paddingBound = new PaddingBoundPane(FormBodyPaddingAttrMark.DEFAULT_SIZE, FormBodyPaddingAttrMark.DEFAULT_SIZE, FormBodyPaddingAttrMark.DEFAULT_SIZE, FormBodyPaddingAttrMark.DEFAULT_SIZE); paddingBound = new PaddingBoundPane(FormBodyPaddingAttrMark.DEFAULT_SIZE, FormBodyPaddingAttrMark.DEFAULT_SIZE, FormBodyPaddingAttrMark.DEFAULT_SIZE, FormBodyPaddingAttrMark.DEFAULT_SIZE);
UIExpandablePane advanceExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, paddingBound); this.add(paddingBound, BorderLayout.NORTH);
this.add(advanceExpandablePane, BorderLayout.NORTH);
} }
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return "ComponentAdvancePane"; return "ComponentMarginPane";
} }
public void update(RichStyleWidgetProvider marginWidget) { public void update(RichStyleWidgetProvider marginWidget) {
Loading…
Cancel
Save