Browse Source

MOBILE-25111 默认UI调整

feature/big-screen
Hades 5 years ago
parent
commit
e362e333fe
  1. 20
      designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java
  2. 12
      designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java
  3. 11
      designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java
  4. 36
      designer-form/src/main/java/com/fr/design/designer/properties/mobile/MobileBooKMarkUsePropertyUI.java
  5. 14
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileAdvanceDefinePane.java
  6. 62
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileBookMarkDefinePane.java
  7. 25
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkSettingPane.java
  8. 86
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkUsePane.java

20
designer-base/src/main/java/com/fr/design/gui/icheckbox/UICheckBox.java

@ -59,24 +59,28 @@ public class UICheckBox extends JCheckBox implements UIObserver, GlobalNameObser
initListener();
}
private void initListener() {
protected void initListener() {
if (shouldResponseChangeListener()) {
this.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (uiObserverListener == null) {
return;
}
if (globalNameListener != null && shouldResponseNameListener()) {
globalNameListener.setGlobalName(checkboxName);
}
uiObserverListener.doChange();
attributeChange();
}
});
}
}
protected void attributeChange() {
if (uiObserverListener == null) {
return;
}
if (globalNameListener != null && shouldResponseNameListener()) {
globalNameListener.setGlobalName(checkboxName);
}
uiObserverListener.doChange();
}
/**
* 给组件登记一个观察者监听事件
*

12
designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java

@ -13,8 +13,11 @@ import com.fr.design.designer.beans.adapters.layout.FRAbsoluteLayoutAdapter;
import com.fr.design.designer.beans.location.Direction;
import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.designer.properties.mobile.MobileBooKMarkUsePropertyUI;
import com.fr.design.form.layout.FRAbsoluteLayout;
import com.fr.design.form.util.FormDesignerUtils;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.icon.IconPathConstants;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EditingMouseListener;
@ -590,4 +593,13 @@ public class XWAbsoluteLayout extends XLayoutContainer {
public boolean isSupportShared() {
return true;
}
@Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
if (FormDesignerUtils.isAppRelayout(WidgetPropertyPane.getInstance().getEditingFormDesigner())) {
return new WidgetPropertyUIProvider[] {new MobileBooKMarkUsePropertyUI(this)};
} else {
return super.getWidgetPropertyUIProviders();
}
}
}

11
designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java

@ -16,7 +16,10 @@ import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWBorderLayout;
import com.fr.design.designer.creator.XWidgetCreator;
import com.fr.design.designer.properties.mobile.MobileBooKMarkUsePropertyUI;
import com.fr.design.form.util.FormDesignerUtils;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.icon.IconPathConstants;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.EditingMouseListener;
@ -512,4 +515,12 @@ public class XWCardMainBorderLayout extends XWBorderLayout {
return true;
}
@Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
if (FormDesignerUtils.isAppRelayout(WidgetPropertyPane.getInstance().getEditingFormDesigner())) {
return new WidgetPropertyUIProvider[] {new MobileBooKMarkUsePropertyUI(this)};
} else {
return super.getWidgetPropertyUIProviders();
}
}
}

36
designer-form/src/main/java/com/fr/design/designer/properties/mobile/MobileBooKMarkUsePropertyUI.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.MobileBookMarkDefinePane;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/2/12
*/
public class MobileBooKMarkUsePropertyUI extends AbstractWidgetPropertyUIProvider {
private XCreator xCreator;
public MobileBooKMarkUsePropertyUI(XCreator xCreator) {
this.xCreator = xCreator;
}
@Override
public AbstractPropertyTable createWidgetAttrTable() {
return null;
}
@Override
public BasicPane createWidgetAttrPane() {
return new MobileBookMarkDefinePane(xCreator);
}
@Override
public String tableTitle() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr");
}
}

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

@ -53,7 +53,7 @@ public class MobileAdvanceDefinePane extends MobileWidgetDefinePane {
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.useBookMarkCheck = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Use_BookMark"), false);
this.bookMarkNameField = new UITextField() {
@Override
protected void initListener() {
@ -85,9 +85,18 @@ public class MobileAdvanceDefinePane extends MobileWidgetDefinePane {
this.useBookMarkCheck.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
bookMarkNamePane.setVisible(MobileAdvanceDefinePane.this.useBookMarkCheck.isSelected());
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);
@ -144,6 +153,7 @@ public class MobileAdvanceDefinePane extends MobileWidgetDefinePane {
}
if (!isExist(newBookMarkName)) {
bookMark.setBookMarkName(newBookMarkName);
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified();
} else {
FineJOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_BookMark_Rename_Failure"),

62
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/MobileBookMarkDefinePane.java

@ -0,0 +1,62 @@
package com.fr.design.widget.ui.designer.mobile;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.widget.ui.designer.mobile.component.MobileBookMarkUsePane;
import javax.swing.JPanel;
import java.awt.BorderLayout;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/2/12
*/
public class MobileBookMarkDefinePane extends MobileWidgetDefinePane {
private XCreator xCreator;
private MobileBookMarkUsePane mobileBookMarkUsePane;
public MobileBookMarkDefinePane(XCreator xCreator) {
this.xCreator = xCreator;
}
@Override
public void initPropertyGroups(Object source) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.mobileBookMarkUsePane = new MobileBookMarkUsePane();
UIExpandablePane uiExpandablePane = new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, mobileBookMarkUsePane);
panel.add(uiExpandablePane);
this.add(panel, 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 void populate(FormDesigner designer) {
this.mobileBookMarkUsePane.populate(xCreator);
this.bindListeners2Widgets();
}
@Override
public void update() {
this.mobileBookMarkUsePane.update(xCreator);
}
}

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

@ -29,7 +29,7 @@ import java.awt.*;
public class MobileBookMarkSettingPane extends BasicPane {
private AccessibleMobileBookMarkStyleEditor mobileBookMarkStyleEditor;
private UICheckBox showHierarchicalBookmarksCheck;
private MobileBookMarkUsePane showBookMarkPane;
public MobileBookMarkSettingPane() {
initComponent();
@ -38,30 +38,13 @@ public class MobileBookMarkSettingPane extends BasicPane {
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"), true);
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}
};
this.showBookMarkPane = new MobileBookMarkUsePane();
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);
@ -75,13 +58,13 @@ public class MobileBookMarkSettingPane extends BasicPane {
public void populate(XCreator xCreator) {
WSortLayout wSortLayout = ((WSortLayout) xCreator.toData());
this.mobileBookMarkStyleEditor.setValue(wSortLayout.getMobileBookMarkStyle());
this.showHierarchicalBookmarksCheck.setSelected(wSortLayout.isShowBookmarks());
this.showBookMarkPane.populate(xCreator);
}
public void update(XCreator xCreator) {
WSortLayout wSortLayout = ((WSortLayout) xCreator.toData());
wSortLayout.setMobileBookMarkStyle((MobileBookMarkStyle) mobileBookMarkStyleEditor.getValue());
wSortLayout.setShowBookmarks(showHierarchicalBookmarksCheck.isSelected());
this.showBookMarkPane.update(xCreator);
}

86
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/component/MobileBookMarkUsePane.java

@ -0,0 +1,86 @@
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.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.form.ui.container.WLayout;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/2/12
*/
public class MobileBookMarkUsePane extends BasicPane {
private UICheckBox showHierarchicalBookmarksCheck;
public MobileBookMarkUsePane() {
initComponent();
}
private void initComponent() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.showHierarchicalBookmarksCheck = new UICheckBox(
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Mobile_Show_BookMark"), true) {
@Override
protected void initListener() {
this.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
attributeChange();
}
});
}
};
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(showBookMarkPane, BorderLayout.CENTER);
this.add(showBookMarkPane, BorderLayout.CENTER);
}
public void populate(XCreator xCreator) {
WLayout wLayout = ((WLayout) xCreator.toData());
this.showHierarchicalBookmarksCheck.setSelected(wLayout.isShowBookmarks());
}
public void update(XCreator xCreator) {
WLayout wLayout = ((WLayout) xCreator.toData());
wLayout.setShowBookmarks(showHierarchicalBookmarksCheck.isSelected());
}
@Override
protected String title4PopupWindow() {
return "MobileBookMarkUsePane";
}
}
Loading…
Cancel
Save