Browse Source

MOBILE-26198 && MOBILE-26189

feature/big-screen
hades 5 years ago
parent
commit
8c88dc76c0
  1. 3
      designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java
  2. 137
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java
  3. 15
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/TabMobileWidgetDefinePane.java
  4. 169
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileAdvanceInnerPane.java
  5. 19
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java

3
designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java

@ -6,6 +6,7 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.designer.properties.EventPropertyTable;
import com.fr.design.designer.properties.mobile.MobileBookMarkPropertyUI;
import com.fr.design.designer.properties.mobile.MobileStylePropertyUI;
@ -179,7 +180,7 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
if (selection != null && xCreator != null) {
embeddedPropertyUIProviders = selection.getSelectedCreator().getWidgetPropertyUIProviders();
if(!designer.getDesignerMode().isFormParameterEditor()) {
if (!xCreator.acceptType(XWAbsoluteLayout.class, XWFitLayout.class) && FormDesignerUtils.isAppRelayout(designer)) {
if (!xCreator.acceptType(XWAbsoluteLayout.class, XWFitLayout.class, XWCardTagLayout.class) && FormDesignerUtils.isAppRelayout(designer)) {
embeddedPropertyUIProviders = ArrayUtils.insert(0, embeddedPropertyUIProviders, new MobileBookMarkPropertyUI(xCreator));
}
if (xCreator.supportMobileStyle()) {

137
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java

@ -1,40 +1,14 @@
package com.fr.design.widget.ui.designer.mobile;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AttributeChangeListener;
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.layout.FRGUIPaneFactory;
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.form.main.Form;
import com.fr.form.ui.FormWidgetHelper;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.container.WSortLayout;
import com.fr.form.ui.mobile.MobileBookMark;
import com.fr.form.ui.widget.CRBoundsWidget;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.stable.StringUtils;
import com.fr.design.widget.ui.designer.mobile.component.MobileAdvanceInnerPane;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.Iterator;
import java.util.List;
/**
* @author hades
@ -44,8 +18,7 @@ import java.util.List;
public class MobileAdvanceDefinePane extends MobileWidgetDefinePane {
private XCreator xCreator;
private UICheckBox useBookMarkCheck;
private UITextField bookMarkNameField;
private MobileAdvanceInnerPane innerPane;
public MobileAdvanceDefinePane(XCreator xCreator) {
this.xCreator = xCreator;
@ -54,71 +27,13 @@ public class MobileAdvanceDefinePane extends MobileWidgetDefinePane {
@Override
public void initPropertyGroups(Object source) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.useBookMarkCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Use_BookMark"), false);
this.bookMarkNameField = new UITextField() {
@Override
protected void initListener() {
if (shouldResponseChangeListener()) {
addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
attributeChange();
}
});
addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
attributeChange();
}
}
});
}
}
};
JPanel useBookMarkPane = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{useBookMarkCheck}},
TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.HGAP_LARGE);
final JPanel bookMarkNamePane = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{new UILabel(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark_Name")), bookMarkNameField}},
TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.HGAP_LARGE);
this.useBookMarkCheck.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
boolean selected = MobileAdvanceDefinePane.this.useBookMarkCheck.isSelected();
Widget widget = MobileAdvanceDefinePane.this.xCreator.toData();
MobileBookMark bookMark = widget.getMobileBookMark();
bookMarkNamePane.setVisible(selected);
if (selected && StringUtils.isEmpty(bookMark.getBookMarkName())) {
String name = widget.getWidgetName();
MobileAdvanceDefinePane.this.bookMarkNameField.setText(name);
bookMark.setBookMarkName(name);
}
}
});
bookMarkNamePane.setVisible(xCreator.toData().getMobileBookMark().isUseBookMark());
contentPane.add(useBookMarkPane, BorderLayout.NORTH);
contentPane.add(bookMarkNamePane, BorderLayout.CENTER);
UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark"), 280, 20, contentPane);
this.innerPane = new MobileAdvanceInnerPane(xCreator);
UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark"), 280, 20, innerPane);
JPanel wrapPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
wrapPane.add(uiExpandablePane, BorderLayout.NORTH);
this.add(wrapPane, BorderLayout.NORTH);
initData();
}
private void initData() {
MobileBookMark bookMark = xCreator.toData().getMobileBookMark();
String bookMarkName = bookMark.getBookMarkName();
if (StringUtils.isEmpty(bookMarkName)) {
String widgetName = xCreator.toData().getWidgetName();
this.bookMarkNameField.setText(widgetName);
bookMark.setBookMarkName(widgetName);
} else {
this.bookMarkNameField.setText(bookMarkName);
}
}
private void bindListeners2Widgets() {
reInitAllListeners();
@ -147,53 +62,13 @@ public class MobileAdvanceDefinePane extends MobileWidgetDefinePane {
@Override
public void populate(FormDesigner designer) {
MobileBookMark bookMark = xCreator.toData().getMobileBookMark();
this.bookMarkNameField.setText(bookMark.getBookMarkName());
if (bookMark.isFrozen()) {
this.useBookMarkCheck.setSelected(false);
this.useBookMarkCheck.setEnabled(false);
} else {
this.useBookMarkCheck.setSelected(bookMark.isUseBookMark());
}
this.innerPane.populate();
this.bindListeners2Widgets();
}
@Override
public void update() {
MobileBookMark bookMark = xCreator.toData().getMobileBookMark();
bookMark.setUseBookMark(this.useBookMarkCheck.isSelected());
String newBookMarkName = this.bookMarkNameField.getText();
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
if (ComparatorUtils.equals(newBookMarkName, bookMark.getBookMarkName())) {
return;
}
if (!isExist(newBookMarkName)) {
bookMark.setBookMarkName(newBookMarkName);
} else {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark_Rename_Failure"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News"),
JOptionPane.ERROR_MESSAGE, IOUtils.readIcon("com/fr/design/form/images/joption_failure.png"));
this.bookMarkNameField.setText(bookMark.getBookMarkName());
}
}
private boolean isExist(String name) {
Form form = WidgetPropertyPane.getInstance().getEditingFormDesigner().getTarget();
WLayout container = form.getContainer();
WSortLayout wSortLayout = (WSortLayout) container.getWidget(container.getWidgetCount() - 1);
List<String> list = wSortLayout.getOrderedMobileWidgetList();
for (String value : list) {
Widget widget = form.getWidgetByName(value);
if (widget != null && ComparatorUtils.equals(widget.getMobileBookMark().getBookMarkName(), name)) {
return true;
}
CRBoundsWidget boundsWidget = (CRBoundsWidget) wSortLayout.getWidget(value);
if (boundsWidget != null && ComparatorUtils.equals(boundsWidget.getWidget().getMobileBookMark().getBookMarkName(), name)) {
return true;
}
}
return false;
this.innerPane.update();
}
}

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

@ -15,6 +15,7 @@ import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.accessibles.AccessibleTemplateStyleEditor;
import com.fr.design.mainframe.widget.accessibles.MobileTemplateStylePane;
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;
@ -33,6 +34,7 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
private MobileComponentMarginPane marginPane;
private MobileComponentLayoutIntervalPane intervalPane;
private MobileBookMarkUsePane mobileBookMarkUsePane;
private MobileAdvanceInnerPane mobileAdvanceInnerPane;
public TabMobileWidgetDefinePane(XCreator xCreator) {
this.xCreator = xCreator;
@ -70,9 +72,12 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
intervalPane = new MobileComponentLayoutIntervalPane(FormTabPaddingAttrMark.XML_TAG);
if (FormDesignerUtils.isAppRelayout(designer)) {
mobileBookMarkUsePane = new MobileBookMarkUsePane();
innerAdvancePane.add(mobileBookMarkUsePane, BorderLayout.SOUTH);
mobileAdvanceInnerPane = new MobileAdvanceInnerPane(xCreator);
innerAdvancePane.add(mobileBookMarkUsePane, BorderLayout.CENTER);
innerAdvancePane.add(mobileAdvanceInnerPane, BorderLayout.SOUTH);
}
innerAdvancePane.add(marginPane, BorderLayout.CENTER);
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);
//高级
@ -100,6 +105,9 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
if (mobileBookMarkUsePane != null) {
mobileBookMarkUsePane.populate(xCreator);
}
if (mobileAdvanceInnerPane != null) {
mobileAdvanceInnerPane.populate();
}
}
@Override
@ -116,5 +124,8 @@ public class TabMobileWidgetDefinePane extends MobileWidgetDefinePane {
if (mobileBookMarkUsePane != null) {
mobileBookMarkUsePane.update(xCreator);
}
if (mobileAdvanceInnerPane != null) {
this.mobileAdvanceInnerPane.update();
}
}
}

169
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileAdvanceInnerPane.java

@ -0,0 +1,169 @@
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.creator.XCreator;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.FineJOptionPane;
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.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.form.main.Form;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.container.WSortLayout;
import com.fr.form.ui.mobile.MobileBookMark;
import com.fr.form.ui.widget.CRBoundsWidget;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.stable.StringUtils;
import javax.swing.*;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.List;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/4/17
*/
public class MobileAdvanceInnerPane extends BasicPane {
private XCreator xCreator;
private UICheckBox useBookMarkCheck;
private UITextField bookMarkNameField;
public MobileAdvanceInnerPane(XCreator xCreator) {
this.xCreator = xCreator;
this.setLayout(FRGUIPaneFactory.createBorderLayout());
initComponent();
}
private void initComponent() {
JPanel contentPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.useBookMarkCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Use_BookMark"), false);
this.bookMarkNameField = new UITextField() {
@Override
protected void initListener() {
if (shouldResponseChangeListener()) {
addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
attributeChange();
}
});
addKeyListener(new KeyAdapter() {
@Override
public void keyTyped(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
attributeChange();
}
}
});
}
}
};
JPanel useBookMarkPane = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{useBookMarkCheck}},
TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.HGAP_LARGE);
final JPanel bookMarkNamePane = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{new UILabel(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark_Name")), bookMarkNameField}},
TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.HGAP_LARGE);
this.useBookMarkCheck.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
boolean selected = MobileAdvanceInnerPane.this.useBookMarkCheck.isSelected();
Widget widget = MobileAdvanceInnerPane.this.xCreator.toData();
MobileBookMark bookMark = widget.getMobileBookMark();
bookMarkNamePane.setVisible(selected);
if (selected && StringUtils.isEmpty(bookMark.getBookMarkName())) {
String name = widget.getWidgetName();
MobileAdvanceInnerPane.this.bookMarkNameField.setText(name);
bookMark.setBookMarkName(name);
}
}
});
bookMarkNamePane.setVisible(xCreator.toData().getMobileBookMark().isUseBookMark());
contentPane.add(useBookMarkPane, BorderLayout.NORTH);
contentPane.add(bookMarkNamePane, BorderLayout.CENTER);
this.add(contentPane);
initData();
}
private void initData() {
MobileBookMark bookMark = xCreator.toData().getMobileBookMark();
String bookMarkName = bookMark.getBookMarkName();
if (StringUtils.isEmpty(bookMarkName)) {
String widgetName = xCreator.toData().getWidgetName();
this.bookMarkNameField.setText(widgetName);
bookMark.setBookMarkName(widgetName);
} else {
this.bookMarkNameField.setText(bookMarkName);
}
}
public void populate() {
MobileBookMark bookMark = xCreator.toData().getMobileBookMark();
this.bookMarkNameField.setText(bookMark.getBookMarkName());
if (bookMark.isFrozen()) {
this.useBookMarkCheck.setSelected(false);
this.useBookMarkCheck.setEnabled(false);
} else {
this.useBookMarkCheck.setSelected(bookMark.isUseBookMark());
}
}
public void update() {
MobileBookMark bookMark = xCreator.toData().getMobileBookMark();
bookMark.setUseBookMark(this.useBookMarkCheck.isSelected());
String newBookMarkName = this.bookMarkNameField.getText();
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
if (ComparatorUtils.equals(newBookMarkName, bookMark.getBookMarkName())) {
return;
}
if (!isExist(newBookMarkName)) {
bookMark.setBookMarkName(newBookMarkName);
} else {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark_Rename_Failure"),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News"),
JOptionPane.ERROR_MESSAGE, IOUtils.readIcon("com/fr/design/form/images/joption_failure.png"));
this.bookMarkNameField.setText(bookMark.getBookMarkName());
}
}
private boolean isExist(String name) {
Form form = WidgetPropertyPane.getInstance().getEditingFormDesigner().getTarget();
WLayout container = form.getContainer();
WSortLayout wSortLayout = (WSortLayout) container.getWidget(container.getWidgetCount() - 1);
List<String> list = wSortLayout.getOrderedMobileWidgetList();
for (String value : list) {
Widget widget = form.getWidgetByName(value);
if (widget != null && ComparatorUtils.equals(widget.getMobileBookMark().getBookMarkName(), name)) {
return true;
}
CRBoundsWidget boundsWidget = (CRBoundsWidget) wSortLayout.getWidget(value);
if (boundsWidget != null && ComparatorUtils.equals(boundsWidget.getWidget().getMobileBookMark().getBookMarkName(), name)) {
return true;
}
}
return false;
}
@Override
protected String title4PopupWindow() {
return "MobileAdvanceInnerPane";
}
}

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

@ -11,9 +11,12 @@ 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.main.Form;
import com.fr.form.ui.FormWidgetHelper;
import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WLayout;
import com.fr.form.ui.container.WSortLayout;
import com.fr.form.ui.widget.CRBoundsWidget;
import com.fr.stable.ArrayUtils;
import javax.swing.BorderFactory;
@ -97,6 +100,22 @@ public class MobileComponentFrozenPane extends BasicPane {
map.put(value, false);
}
uiComboCheckBox.setSelectedValues(map);
if (ArrayUtils.isEmpty(uiComboCheckBox.getSelectedValues()) || !uiComboCheckBox.isEnabled()) {
uiComboCheckBox.setEnabled(!shouldFrozen());
}
}
private boolean shouldFrozen() {
Form form = WidgetPropertyPane.getInstance().getEditingFormDesigner().getTarget();
WLayout container = form.getContainer();
WSortLayout wSortLayout = (WSortLayout) container.getWidget(container.getWidgetCount() - 1);
boolean frozen = false;
List<String> list = wSortLayout.getOrderedMobileWidgetList();
for (String value : list) {
CRBoundsWidget boundsWidget = (CRBoundsWidget) wSortLayout.getWidget(value);
frozen = frozen || boundsWidget.getWidget().getMobileBookMark().isUseBookMark();
}
return frozen;
}
@Override

Loading…
Cancel
Save