Browse Source

Merge pull request #1373 in DESIGN/design from ~HADES/design:release/10.0 to release/10.0

* commit '860f6319edb8807e787c7b9f582d9c3b99aa9347':
  调整
  MOBILE-24587 组件快速定位 &&  DesignTableManager 判空
feature/big-screen
Hades 5 years ago
parent
commit
06c1970335
  1. 6
      designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java
  2. 34
      designer-base/src/main/java/com/fr/design/fun/MobileBookMarkStyleProvider.java
  3. 24
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileBookMarkStyleProvider.java
  4. 27
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileBookMarkStyleCustomDefinePane.java
  5. 29
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileBookMarkStyleProvider.java
  6. 57
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStyleDefinePane.java
  7. 136
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStylePane.java
  8. 30
      designer-base/src/main/java/com/fr/design/mainframe/widget/wrappers/MobileBookMarkStyleWrapper.java
  9. 36
      designer-form/src/main/java/com/fr/design/designer/properties/mobile/MobileBookMarkPropertyUI.java
  10. 10
      designer-form/src/main/java/com/fr/design/mainframe/WidgetPropertyPane.java
  11. 18
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java
  12. 167
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java
  13. 2
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileWidgetStyleDefinePane.java
  14. 117
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkSettingPane.java
  15. 10
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileComponentFrozenPane.java

6
designer-base/src/main/java/com/fr/design/data/DesignTableDataManager.java

@ -228,7 +228,11 @@ public abstract class DesignTableDataManager {
} }
public static void removeSelectedColumnNames(String dsName) { public static void removeSelectedColumnNames(String dsName) {
columnCache.get(getEditingTableDataSource()).remove(dsName); Map<String, String[]> map = columnCache.get(getEditingTableDataSource());
if (map == null) {
return;
}
map.remove(dsName);
} }
public static void addDsColumnNames(String dsName, String[] columnNames) { public static void addDsColumnNames(String dsName, String[] columnNames) {

34
designer-base/src/main/java/com/fr/design/fun/MobileBookMarkStyleProvider.java

@ -0,0 +1,34 @@
package com.fr.design.fun;
import com.fr.design.beans.BasicBeanPane;
import com.fr.form.ui.mobile.MobileBookMarkStyle;
import com.fr.stable.fun.mark.Mutable;
/**
* 移动端书签样式扩展接口
*
* @author hades
* @version 10.0
* Created by hades on 2019/12/23
*/
public interface MobileBookMarkStyleProvider extends Mutable {
String XML_TAG = "MobileBookMarkStyleProvider";
int CURRENT_LEVEL = 1;
/**
* 书签样式
* @return
*/
Class<? extends MobileBookMarkStyle> classForMobileBookMarkStyle();
/**
* 书签样式面板
* @return
*/
Class<? extends BasicBeanPane<MobileBookMarkStyle>> classForMobileBookMarkStyleAppearance();
String displayName();
}

24
designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileBookMarkStyleProvider.java

@ -0,0 +1,24 @@
package com.fr.design.fun.impl;
import com.fr.design.fun.MobileBookMarkStyleProvider;
import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API;
/**
* @author hades
* @version 10.0
* Created by hades on 2019/12/24
*/
@API(level = MobileBookMarkStyleProvider.CURRENT_LEVEL)
public abstract class AbstractMobileBookMarkStyleProvider extends AbstractProvider implements MobileBookMarkStyleProvider {
@Override
public int currentAPILevel() {
return CURRENT_LEVEL;
}
@Override
public String mark4Provider() {
return getClass().getName();
}
}

27
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileBookMarkStyleCustomDefinePane.java

@ -0,0 +1,27 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.beans.BasicBeanPane;
import com.fr.form.ui.mobile.MobileBookMarkStyle;
/**
* @author hades
* @version 10.0
* Created by hades on 2019/12/24
*/
public class DefaultMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<MobileBookMarkStyle> {
@Override
public void populateBean(MobileBookMarkStyle ob) {
}
@Override
public MobileBookMarkStyle updateBean() {
return null;
}
@Override
protected String title4PopupWindow() {
return null;
}
}

29
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileBookMarkStyleProvider.java

@ -0,0 +1,29 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.fun.impl.AbstractMobileBookMarkStyleProvider;
import com.fr.form.ui.mobile.impl.DefaultMobileBookMarkStyle;
import com.fr.form.ui.mobile.MobileBookMarkStyle;
/**
* @author hades
* @version 10.0
* Created by hades on 2019/12/24
*/
public class DefaultMobileBookMarkStyleProvider extends AbstractMobileBookMarkStyleProvider {
@Override
public Class<? extends MobileBookMarkStyle> classForMobileBookMarkStyle() {
return DefaultMobileBookMarkStyle.class;
}
@Override
public Class<? extends BasicBeanPane<MobileBookMarkStyle>> classForMobileBookMarkStyleAppearance() {
return DefaultMobileBookMarkStyleCustomDefinePane.class;
}
@Override
public String displayName() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_None_BookMark_Style");
}
}

57
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStyleDefinePane.java

@ -0,0 +1,57 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.fun.MobileBookMarkStyleProvider;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.mobile.MobileBookMarkStyle;
import com.fr.general.ComparatorUtils;
import com.fr.invoke.Reflect;
import javax.swing.*;
import java.awt.*;
/**
* @author hades
* @version 10.0
* Created by hades on 2019/12/23
*/
public class MobileBookMarkStyleDefinePane extends BasicBeanPane<MobileBookMarkStyle> {
private BasicBeanPane<MobileBookMarkStyle> customDefinePane;
private String displayName;
MobileBookMarkStyleDefinePane(MobileBookMarkStyleProvider bookMarkStyleProvider) {
this.customDefinePane = Reflect.on(
bookMarkStyleProvider.classForMobileBookMarkStyleAppearance()).create().get();
this.displayName = bookMarkStyleProvider.displayName();
initComponent();
}
private void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel settingPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
if (!ComparatorUtils.equals(displayName, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_None_BookMark_Style"))) {
UILabel hintLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Hint"));
hintLabel.setForeground(Color.GRAY);
settingPane.add(hintLabel, BorderLayout.NORTH);
}
settingPane.add(this.customDefinePane, BorderLayout.CENTER);
this.add(settingPane, BorderLayout.CENTER);
}
@Override
public void populateBean(MobileBookMarkStyle ob) {
this.customDefinePane.populateBean(ob);
}
@Override
public MobileBookMarkStyle updateBean() {
return this.customDefinePane.updateBean();
}
@Override
protected String title4PopupWindow() {
return "MobileBookMarkStyleDefinePane";
}
}

136
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileBookMarkStylePane.java

@ -0,0 +1,136 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.fun.MobileBookMarkStyleProvider;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.mobile.MobileBookMarkStyle;
import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author hades
* @version 10.0
* Created by hades on 2019/12/23
*/
public class MobileBookMarkStylePane extends BasicBeanPane<MobileBookMarkStyle> {
public static ListCellRenderer renderer = new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected,
boolean cellHasFocus) {
super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof MobileBookMarkStyle) {
this.setText((value.toString()));
}
return this;
}
};
private DefaultListModel<String> listModel;
private JList bookMarkList;
private JPanel rightPane;
private CardLayout card;
private Map<String, BasicBeanPane<MobileBookMarkStyle>> map = new HashMap<>();
public MobileBookMarkStylePane() {
initComponent();
}
private void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.listModel = new DefaultListModel<>();
this.card = new CardLayout();
this.rightPane = FRGUIPaneFactory.createCardLayout_S_Pane();
this.rightPane.setLayout(card);
initDefaultAndExtraPanel();
initLeftListPanel();
initRightPanel();
}
private void initDefaultAndExtraPanel() {
List<MobileBookMarkStyleProvider> list = getMobileBookMarkStyleProvider();
for (MobileBookMarkStyleProvider bookMarkStyleProvider : list) {
String displayName = bookMarkStyleProvider.displayName();
MobileBookMarkStyleDefinePane mobileBookMarkStyleDefinePane = new MobileBookMarkStyleDefinePane(
bookMarkStyleProvider);
listModel.addElement(displayName);
rightPane.add(displayName, mobileBookMarkStyleDefinePane);
map.put(displayName, mobileBookMarkStyleDefinePane);
}
}
private void initLeftListPanel() {
bookMarkList = new JList<>(listModel);
bookMarkList.setCellRenderer(renderer);
bookMarkList.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
card.show(rightPane, (String) bookMarkList.getSelectedValue());
}
});
JPanel leftPanel = FRGUIPaneFactory.createBorderLayout_L_Pane();
leftPanel.add(bookMarkList, BorderLayout.CENTER);
leftPanel.setPreferredSize(new Dimension(100, 500));
this.add(leftPanel, BorderLayout.WEST);
}
private void initRightPanel() {
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
centerPane.setPreferredSize(new Dimension(500, 500));
centerPane.add(rightPane, BorderLayout.CENTER);
this.add(centerPane, BorderLayout.CENTER);
}
private List<MobileBookMarkStyleProvider> getMobileBookMarkStyleProvider() {
DefaultMobileBookMarkStyleProvider defaultMobileBookMarkStyleProvider = new DefaultMobileBookMarkStyleProvider();
Set<MobileBookMarkStyleProvider> mobileBookMarkStyleProviders = ExtraDesignClassManager.getInstance().getArray(
MobileBookMarkStyleProvider.XML_TAG);
List<MobileBookMarkStyleProvider> list = new ArrayList<>();
list.add(defaultMobileBookMarkStyleProvider);
list.addAll(mobileBookMarkStyleProviders);
return Collections.unmodifiableList(list);
}
@Override
protected String title4PopupWindow() {
return null;
}
@Override
public void populateBean(MobileBookMarkStyle mobileBookMarkStyle) {
if (mobileBookMarkStyle != null) {
List<MobileBookMarkStyleProvider> bookMarkStyleProviders = getMobileBookMarkStyleProvider();
int i = 0;
for (MobileBookMarkStyleProvider bookMarkStyleProvider : bookMarkStyleProviders) {
if (mobileBookMarkStyle.getClass() == bookMarkStyleProvider.classForMobileBookMarkStyle()) {
String displayName = bookMarkStyleProvider.displayName();
bookMarkList.setSelectedIndex(i);
map.get(displayName).populateBean(mobileBookMarkStyle);
card.show(rightPane, displayName);
return;
}
i++;
}
}
bookMarkList.setSelectedIndex(0);
}
@Override
public MobileBookMarkStyle updateBean() {
return map.get(bookMarkList.getSelectedValue()).updateBean();
}
}

30
designer-base/src/main/java/com/fr/design/mainframe/widget/wrappers/MobileBookMarkStyleWrapper.java

@ -0,0 +1,30 @@
package com.fr.design.mainframe.widget.wrappers;
import com.fr.design.Exception.ValidationException;
import com.fr.design.designer.properties.Decoder;
import com.fr.design.designer.properties.Encoder;
/**
* @author hades
* @version 10.0
* Created by hades on 2019/12/24
*/
public class MobileBookMarkStyleWrapper implements Encoder, Decoder {
@Override
public Object decode(String txt) {
return null;
}
@Override
public void validate(String txt) throws ValidationException {
}
@Override
public String encode(Object v) {
if (v == null) {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_None_BookMark_Style");
}
return v.toString();
}
}

36
designer-form/src/main/java/com/fr/design/designer/properties/mobile/MobileBookMarkPropertyUI.java

@ -0,0 +1,36 @@
package com.fr.design.designer.properties.mobile;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.dialog.BasicPane;
import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider;
import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.design.widget.ui.designer.mobile.MobileAdvanceDefinePane;
/**
* @author hades
* @version 10.0
* Created by hades on 2019/12/24
*/
public class MobileBookMarkPropertyUI extends AbstractWidgetPropertyUIProvider {
private XCreator xCreator;
public MobileBookMarkPropertyUI(XCreator xCreator) {
this.xCreator = xCreator;
}
@Override
public AbstractPropertyTable createWidgetAttrTable() {
return null;
}
@Override
public BasicPane createWidgetAttrPane() {
return new MobileAdvanceDefinePane(xCreator);
}
@Override
public String tableTitle() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr");
}
}

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

@ -7,6 +7,7 @@ import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.*; import com.fr.design.designer.creator.*;
import com.fr.design.designer.properties.EventPropertyTable; import com.fr.design.designer.properties.EventPropertyTable;
import com.fr.design.designer.properties.mobile.MobileBookMarkPropertyUI;
import com.fr.design.designer.properties.mobile.MobileStylePropertyUI; import com.fr.design.designer.properties.mobile.MobileStylePropertyUI;
import com.fr.design.fun.WidgetPropertyUIProvider; import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.ibutton.UIHeadGroup; import com.fr.design.gui.ibutton.UIHeadGroup;
@ -176,8 +177,13 @@ public class WidgetPropertyPane extends FormDockView implements BaseWidgetProper
XCreator xCreator = selection.getSelectedCreator(); XCreator xCreator = selection.getSelectedCreator();
if (selection != null && xCreator != null) { if (selection != null && xCreator != null) {
embeddedPropertyUIProviders = selection.getSelectedCreator().getWidgetPropertyUIProviders(); embeddedPropertyUIProviders = selection.getSelectedCreator().getWidgetPropertyUIProviders();
if(!designer.getDesignerMode().isFormParameterEditor() && xCreator.supportMobileStyle()) { if(!designer.getDesignerMode().isFormParameterEditor()) {
embeddedPropertyUIProviders = ArrayUtils.insert(0, embeddedPropertyUIProviders, new MobileStylePropertyUI(xCreator)); if (!xCreator.acceptType(XWAbsoluteLayout.class, XWFitLayout.class)) {
embeddedPropertyUIProviders = ArrayUtils.insert(0, embeddedPropertyUIProviders, new MobileBookMarkPropertyUI(xCreator));
}
if (xCreator.supportMobileStyle()) {
embeddedPropertyUIProviders = ArrayUtils.insert(0, embeddedPropertyUIProviders, new MobileStylePropertyUI(xCreator));
}
} }
} }
Set<WidgetPropertyUIProvider> set = ExtraDesignClassManager.getInstance().getArray(WidgetPropertyUIProvider.XML_TAG); Set<WidgetPropertyUIProvider> set = ExtraDesignClassManager.getInstance().getArray(WidgetPropertyUIProvider.XML_TAG);

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

@ -11,6 +11,7 @@ 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.MobileBookMarkSettingPane;
import com.fr.design.widget.ui.designer.mobile.component.MobileComponentFrozenPane; 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.MobileComponentMarginPane;
import com.fr.design.widget.ui.designer.mobile.component.MobileComponentLayoutIntervalPane; import com.fr.design.widget.ui.designer.mobile.component.MobileComponentLayoutIntervalPane;
@ -34,6 +35,7 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane {
private MobileComponentMarginPane marginPane; private MobileComponentMarginPane marginPane;
private MobileComponentLayoutIntervalPane intervalPane; private MobileComponentLayoutIntervalPane intervalPane;
private MobileComponentFrozenPane frozenPane; private MobileComponentFrozenPane frozenPane;
private MobileBookMarkSettingPane bookMarkSettingPane;
private UIExpandablePane advancePane; private UIExpandablePane advancePane;
private UIExpandablePane layoutPane; private UIExpandablePane layoutPane;
@ -96,10 +98,14 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane {
marginPane = new MobileComponentMarginPane(FormBodyPaddingAttrMark.XML_TAG); marginPane = new MobileComponentMarginPane(FormBodyPaddingAttrMark.XML_TAG);
intervalPane = new MobileComponentLayoutIntervalPane(FormBodyPaddingAttrMark.XML_TAG); intervalPane = new MobileComponentLayoutIntervalPane(FormBodyPaddingAttrMark.XML_TAG);
frozenPane = new MobileComponentFrozenPane(); frozenPane = new MobileComponentFrozenPane();
bookMarkSettingPane = new MobileBookMarkSettingPane();
JPanel wrapLayoutPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel wrapLayoutPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel wrapAdvancePane = FRGUIPaneFactory.createBorderLayout_S_Pane();
wrapLayoutPane.add(intervalPane, BorderLayout.NORTH); wrapLayoutPane.add(intervalPane, BorderLayout.NORTH);
wrapLayoutPane.add(frozenPane, BorderLayout.CENTER); wrapLayoutPane.add(frozenPane, BorderLayout.CENTER);
advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, marginPane); wrapAdvancePane.add(marginPane, BorderLayout.CENTER);
wrapAdvancePane.add(bookMarkSettingPane, BorderLayout.SOUTH);
advancePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, wrapAdvancePane);
layoutPane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Layout"), 280, 20, wrapLayoutPane); 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);
@ -110,7 +116,7 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane {
advancePane.setVisible(flag); advancePane.setVisible(flag);
layoutPane.setVisible(flag); layoutPane.setVisible(flag);
frozenPane.setVisible(appRelayoutCheck.isSelected()); frozenPane.setVisible(appRelayoutCheck.isSelected());
bookMarkSettingPane.setVisible(appRelayoutCheck.isSelected());
return holder; return holder;
} }
@ -147,13 +153,15 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane {
@Override @Override
public void populate(FormDesigner designer) { public void populate(FormDesigner designer) {
this.designer = designer; this.designer = designer;
XCreator xCreator = designer.getSelectionModel().getSelection().getSelectedCreator();
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()); marginPane.populate((RichStyleWidgetProvider) getBodyCreator().toData());
intervalPane.populate((RichStyleWidgetProvider) getBodyCreator().toData()); intervalPane.populate((RichStyleWidgetProvider) getBodyCreator().toData());
frozenPane.populate(designer.getSelectionModel().getSelection().getSelectedCreator()); frozenPane.populate(xCreator);
bookMarkSettingPane.populate(xCreator);
} }
@Override @Override
@ -174,7 +182,9 @@ public class BodyMobileDefinePane extends MobileWidgetDefinePane {
intervalPane.update((RichStyleWidgetProvider) getBodyCreator().toData()); intervalPane.update((RichStyleWidgetProvider) getBodyCreator().toData());
} }
if (appRelayout) { if (appRelayout) {
frozenPane.update(designer.getSelectionModel().getSelection().getSelectedCreator()); XCreator xCreator = designer.getSelectionModel().getSelection().getSelectedCreator();
frozenPane.update(xCreator);
bookMarkSettingPane.update(xCreator);
} }
} }
} }

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

@ -0,0 +1,167 @@
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.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.Iterator;
/**
* @author hades
* @version 10.0
* Created by hades on 2019/12/24
*/
public class MobileAdvanceDefinePane extends MobileWidgetDefinePane {
private XCreator xCreator;
private UICheckBox useBookMarkCheck;
private UITextField bookMarkNameField;
public MobileAdvanceDefinePane(XCreator xCreator) {
this.xCreator = xCreator;
}
@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"));
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) {
bookMarkNamePane.setVisible(MobileAdvanceDefinePane.this.useBookMarkCheck.isSelected());
}
});
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);
JPanel wrapPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
wrapPane.add(uiExpandablePane, BorderLayout.NORTH);
this.add(wrapPane, BorderLayout.NORTH);
}
private void bindListeners2Widgets() {
reInitAllListeners();
AttributeChangeListener changeListener = new AttributeChangeListener() {
@Override
public void attributeChange() {
update();
}
};
this.addAttributeChangeListener(changeListener);
}
private void reInitAllListeners() {
initListener(this);
}
@Override
public Dimension getPreferredSize() {
return new Dimension(super.getPreferredSize().width, 80);
}
@Override
public Dimension getMaximumSize() {
return new Dimension(400, 200);
}
@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.bindListeners2Widgets();
}
@Override
public void update() {
MobileBookMark bookMark = xCreator.toData().getMobileBookMark();
bookMark.setUseBookMark(this.useBookMarkCheck.isSelected());
String newBookMarkName = this.bookMarkNameField.getText();
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);
Iterator<String> iterator = wSortLayout.getMobileWidgetIterator();
while (iterator.hasNext()) {
Widget widget = form.getWidgetByName(iterator.next());
if (widget != null && ComparatorUtils.equals(widget.getMobileBookMark().getBookMarkName(), name)) {
return true;
}
}
return false;
}
}

2
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileWidgetStyleDefinePane.java

@ -66,7 +66,7 @@ public class MobileWidgetStyleDefinePane extends MobileWidgetDefinePane {
@Override @Override
public Dimension getMaximumSize() { public Dimension getMaximumSize() {
return new Dimension(400, 200); return new Dimension(400, 30);
} }
private void bindListeners2Widgets() { private void bindListeners2Widgets() {

117
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkSettingPane.java

@ -0,0 +1,117 @@
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.BasicDialog;
import com.fr.design.dialog.BasicPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
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.mainframe.mobile.ui.MobileBookMarkStylePane;
import com.fr.design.mainframe.widget.accessibles.UneditableAccessibleEditor;
import com.fr.design.mainframe.widget.wrappers.MobileBookMarkStyleWrapper;
import com.fr.form.ui.container.WSortLayout;
import com.fr.form.ui.mobile.MobileBookMarkStyle;
import javax.swing.*;
import java.awt.*;
/**
* @author hades
* @version 10.0
* Created by hades on 2019/12/18
*/
public class MobileBookMarkSettingPane extends BasicPane {
private AccessibleMobileBookMarkStyleEditor mobileBookMarkStyleEditor;
private UICheckBox showHierarchicalBookmarksCheck;
public MobileBookMarkSettingPane() {
initComponent();
}
private void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.mobileBookMarkStyleEditor = new AccessibleMobileBookMarkStyleEditor(new MobileBookMarkStylePane());
this.showHierarchicalBookmarksCheck = new UICheckBox(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Show_BookMark"));
JPanel booKMarkPane = TableLayoutHelper.createGapTableLayoutPane(
new Component[][]{new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText(
"Fine-Design_Mobile_BookMark_Style")), this.mobileBookMarkStyleEditor}},
TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.HGAP_LARGE
);
UILabel hintLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Show_BookMark_Hint"));
hintLabel.setForeground(Color.GRAY);
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p};
double[] columnSize = {f};
int[][] rowCount = {{1}, {1}};
Component[][] components = new Component[][]{
new Component[]{this.showHierarchicalBookmarksCheck},
new Component[]{hintLabel}
};
JPanel wrapPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
JPanel showBookMarkPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount,
IntervalConstants.INTERVAL_L1,
IntervalConstants.INTERVAL_L1);
showBookMarkPane.setBorder(
BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, IntervalConstants.INTERVAL_L1, 0));
wrapPane.add(booKMarkPane, BorderLayout.NORTH);
wrapPane.add(showBookMarkPane, BorderLayout.CENTER);
this.add(wrapPane, BorderLayout.CENTER);
}
@Override
protected String title4PopupWindow() {
return "MobileBookMarkSettingPane";
}
public void populate(XCreator xCreator) {
WSortLayout wSortLayout = ((WSortLayout) xCreator.toData());
this.mobileBookMarkStyleEditor.setValue(wSortLayout.getMobileBookMarkStyle());
this.showHierarchicalBookmarksCheck.setSelected(wSortLayout.isShowBookmarks());
}
public void update(XCreator xCreator) {
WSortLayout wSortLayout = ((WSortLayout) xCreator.toData());
wSortLayout.setMobileBookMarkStyle((MobileBookMarkStyle) mobileBookMarkStyleEditor.getValue());
wSortLayout.setShowBookmarks(showHierarchicalBookmarksCheck.isSelected());
}
class AccessibleMobileBookMarkStyleEditor extends UneditableAccessibleEditor {
private MobileBookMarkStylePane mobileBookMarkStylePane;
public AccessibleMobileBookMarkStyleEditor(MobileBookMarkStylePane mobileBookMarkStylePane) {
super(new MobileBookMarkStyleWrapper());
this.mobileBookMarkStylePane = mobileBookMarkStylePane;
}
@Override
public void showEditorPane() {
mobileBookMarkStylePane.setPreferredSize(BasicDialog.MEDIUM);
BasicDialog dialog = mobileBookMarkStylePane.showWindow(SwingUtilities.getWindowAncestor(this));
dialog.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
MobileBookMarkStyle mobileBookMarkStyle = mobileBookMarkStylePane.updateBean();
WSortLayout wSortLayout = (WSortLayout) WidgetPropertyPane.getInstance().getEditingFormDesigner().getSelectionModel().getSelection().getSelectedCreator().toData();
setValue(mobileBookMarkStyle);
wSortLayout.setMobileBookMarkStyle(mobileBookMarkStyle);
fireStateChanged();
}
});
mobileBookMarkStylePane.populateBean((MobileBookMarkStyle) getValue());
dialog.setVisible(true);
}
}
}

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

@ -11,6 +11,7 @@ import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.utils.gui.UIComponentUtils;
import com.fr.design.widget.FRWidgetFactory; import com.fr.design.widget.FRWidgetFactory;
import com.fr.form.ui.FormWidgetHelper;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WSortLayout; import com.fr.form.ui.container.WSortLayout;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
@ -64,8 +65,13 @@ public class MobileComponentFrozenPane extends BasicPane {
List<String> selected = new ArrayList<>(); List<String> selected = new ArrayList<>();
WSortLayout wSortLayout = ((WSortLayout) xCreator.toData()); WSortLayout wSortLayout = ((WSortLayout) xCreator.toData());
Object[] values = uiComboCheckBox.getSelectedValues(); Object[] values = uiComboCheckBox.getSelectedValues();
for (Object widgetName : values) { for (Object value : values) {
selected.add((String) widgetName); String widgetName = (String) value;
selected.add(widgetName);
Widget widget = FormWidgetHelper.findWidgetWithBound(wSortLayout, widgetName);
if (widget != null) {
widget.getMobileBookMark().setFrozen(true);
}
} }
wSortLayout.updateFrozenWidgets(selected); wSortLayout.updateFrozenWidgets(selected);
} }

Loading…
Cancel
Save