Browse Source

Pull request #3246: REPORT-45689 顶部参数界面样式优化

Merge in DESIGN/design from ~HADES/design:release/10.0 to release/10.0

* commit '3fd24c84b31da1c055df2bcf7a04e8bad9f39df8':
  REPORT-45689 添加注解
  REPORT-45689 顶部参数界面样式优化
feature/big-screen
Hades 4 years ago
parent
commit
543ab0bb4c
  1. 37
      designer-base/src/main/java/com/fr/design/fun/MobileParamUIProvider.java
  2. 25
      designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileParamUIProvider.java
  3. 33
      designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/DefaultMobileParamUIProvider.java
  4. 43
      designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/EmptyMobileParamUIProvider.java
  5. 42
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileParamDefinePane.java
  6. 47
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/EmptyMobileParamDefinePane.java
  7. 55
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamDefinePane.java
  8. 150
      designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java
  9. 34
      designer-base/src/main/java/com/fr/design/mainframe/widget/wrappers/MobileParamWrapper.java
  10. 48
      designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleMobileParamEditor.java
  11. 76
      designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java

37
designer-base/src/main/java/com/fr/design/fun/MobileParamUIProvider.java

@ -0,0 +1,37 @@
package com.fr.design.fun;
import com.fr.design.beans.BasicBeanPane;
import com.fr.form.ui.mobile.MobileParamStyle;
import com.fr.stable.fun.mark.Mutable;
/**
* @author hades
* @version 10.0
* Created by hades on 2020/12/30
*/
public interface MobileParamUIProvider extends Mutable {
String XML_TAG = "MobileParamUIProvider";
int CURRENT_LEVEL = 1;
/**
* 扩展项的参数面板样式
* @return
*/
Class<? extends MobileParamStyle> classForMobileParamStyle();
/**
* 移动端参数面板中扩展项的面板
* @return
*/
Class<? extends BasicBeanPane<MobileParamStyle>> classForMobileParamAppearance();
/**
* 扩展项的名称描述
* @return
*/
String displayName();
}

25
designer-base/src/main/java/com/fr/design/fun/impl/AbstractMobileParamUIProvider.java

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

33
designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/DefaultMobileParamUIProvider.java

@ -0,0 +1,33 @@
package com.fr.design.mainframe.mobile.provider;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.fun.impl.AbstractMobileParamUIProvider;
import com.fr.design.mainframe.mobile.ui.DefaultMobileParamDefinePane;
import com.fr.form.ui.mobile.MobileParamStyle;
import com.fr.form.ui.mobile.impl.DefaultMobileParameterStyle;
import com.fr.locale.InterProviderFactory;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/1/4
*/
public class DefaultMobileParamUIProvider extends AbstractMobileParamUIProvider {
@Override
public Class<? extends MobileParamStyle> classForMobileParamStyle() {
return DefaultMobileParameterStyle.class;
}
@Override
public Class<? extends BasicBeanPane<MobileParamStyle>> classForMobileParamAppearance() {
return DefaultMobileParamDefinePane.class;
}
@Override
public String displayName() {
return InterProviderFactory.getProvider().getLocText("Fine-Engine_Report_DEFAULT");
}
}

43
designer-base/src/main/java/com/fr/design/mainframe/mobile/provider/EmptyMobileParamUIProvider.java

@ -0,0 +1,43 @@
package com.fr.design.mainframe.mobile.provider;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.fun.impl.AbstractMobileParamUIProvider;
import com.fr.design.mainframe.mobile.ui.EmptyMobileParamDefinePane;
import com.fr.form.ui.mobile.MobileParamStyle;
import com.fr.report.fun.MobileParamStyleProvider;
import com.fr.report.mobile.EmptyMobileParamStyle;
/**
* 作为MobileParamStyleProvider接口实现兼容转换层
*
* @author hades
* @version 10.0
* Created by hades on 2021/1/4
*/
public class EmptyMobileParamUIProvider extends AbstractMobileParamUIProvider {
private MobileParamStyleProvider styleProvider;
public EmptyMobileParamUIProvider(MobileParamStyleProvider styleProvider) {
this.styleProvider = styleProvider;
}
@Override
public Class<? extends MobileParamStyle> classForMobileParamStyle() {
return EmptyMobileParamStyle.class;
}
@Override
public Class<? extends BasicBeanPane<MobileParamStyle>> classForMobileParamAppearance() {
return EmptyMobileParamDefinePane.class;
}
@Override
public String displayName() {
return styleProvider.descriptor();
}
public MobileParamStyleProvider getStyleProvider() {
return styleProvider;
}
}

42
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/DefaultMobileParamDefinePane.java

@ -0,0 +1,42 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.mobile.MobileParamStyle;
import com.fr.form.ui.mobile.impl.DefaultMobileParameterStyle;
import java.awt.BorderLayout;
import javax.swing.JPanel;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/1/4
*/
public class DefaultMobileParamDefinePane extends BasicBeanPane<MobileParamStyle> {
public DefaultMobileParamDefinePane() {
initComponents();
}
private void initComponents() {
this.setLayout(new BorderLayout());
JPanel centerPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Set"));
this.add(centerPane);
}
@Override
public void populateBean(MobileParamStyle ob) {
// do nothing
}
@Override
public MobileParamStyle updateBean() {
return new DefaultMobileParameterStyle();
}
@Override
protected String title4PopupWindow() {
return null;
}
}

47
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/EmptyMobileParamDefinePane.java

@ -0,0 +1,47 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.mobile.MobileParamStyle;
import com.fr.report.fun.MobileParamStyleProvider;
import com.fr.report.mobile.EmptyMobileParamStyle;
import java.awt.BorderLayout;
import javax.swing.JPanel;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/1/4
*/
public class EmptyMobileParamDefinePane extends BasicBeanPane<MobileParamStyle> {
private final MobileParamStyleProvider styleProvider;
public EmptyMobileParamDefinePane(MobileParamStyleProvider styleProvider) {
this.styleProvider = styleProvider;
initComponents();
}
private void initComponents() {
this.setLayout(new BorderLayout());
JPanel centerPane = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Design_Report_Set"));
this.add(centerPane);
}
@Override
public void populateBean(MobileParamStyle ob) {
}
@Override
public MobileParamStyle updateBean() {
return new EmptyMobileParamStyle(styleProvider);
}
@Override
protected String title4PopupWindow() {
return null;
}
}

55
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamDefinePane.java

@ -0,0 +1,55 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.fun.MobileParamUIProvider;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.mobile.provider.EmptyMobileParamUIProvider;
import com.fr.form.ui.mobile.MobileParamStyle;
import com.fr.general.ComparatorUtils;
import com.fr.invoke.Reflect;
import com.fr.report.mobile.EmptyMobileParamStyle;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/1/4
*/
public class MobileParamDefinePane extends BasicBeanPane<MobileParamStyle> {
private BasicBeanPane<MobileParamStyle> customBeanPane;
public MobileParamDefinePane(MobileParamUIProvider provider) {
if (provider == null || provider.classForMobileParamAppearance() == null || provider.classForMobileParamAppearance() == null) {
return;
}
if (ComparatorUtils.equals(provider.classForMobileParamStyle(), EmptyMobileParamStyle.class)) {
EmptyMobileParamUIProvider emptyMobileParamUIProvider = (EmptyMobileParamUIProvider) provider;
this.customBeanPane = Reflect.on(provider.classForMobileParamAppearance()).create(emptyMobileParamUIProvider.getStyleProvider()).get();
} else {
this.customBeanPane = Reflect.on(provider.classForMobileParamAppearance()).create().get();
}
initComponents();
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.add(customBeanPane);
}
@Override
public void populateBean(MobileParamStyle ob) {
this.customBeanPane.populateBean(ob);
}
@Override
public MobileParamStyle updateBean() {
return this.customBeanPane.updateBean();
}
@Override
protected String title4PopupWindow() {
return "MobileParamDefinePane";
}
}

150
designer-base/src/main/java/com/fr/design/mainframe/mobile/ui/MobileParamSettingPane.java

@ -0,0 +1,150 @@
package com.fr.design.mainframe.mobile.ui;
import com.fr.design.ExtraDesignClassManager;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.BasicPane;
import com.fr.design.fun.MobileParamUIProvider;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.mobile.provider.DefaultMobileParamUIProvider;
import com.fr.design.mainframe.mobile.provider.EmptyMobileParamUIProvider;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.form.ui.mobile.MobileParamStyle;
import com.fr.general.ComparatorUtils;
import com.fr.report.ExtraReportClassManager;
import com.fr.report.fun.MobileParamStyleProvider;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JPanel;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/1/4
*/
public class MobileParamSettingPane extends BasicPane {
private DefaultListModel<String> listModel;
private JPanel right;
private CardLayout card;
private JList paramStyleList;
private Map<String, BasicBeanPane<MobileParamStyle>> map = new HashMap<>();
public MobileParamSettingPane() {
initComponents();
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
listModel = new DefaultListModel<>();
card = new CardLayout();
right = FRGUIPaneFactory.createCardLayout_S_Pane();
right.setLayout(card);
MobileParamUIProvider[] mobileParamUIProviders = getMobileParamUIProviders();
for (MobileParamUIProvider provider : mobileParamUIProviders) {
addShowPane(provider);
}
initLeftPane();
initRightPane();
}
private void initLeftPane() {
paramStyleList = new JList<>(listModel);
paramStyleList.setCellRenderer(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 MobileParamStyle) {
MobileParamStyle style = (MobileParamStyle) value;
this.setText(style.toString());
}
return this;
}
});
paramStyleList.addListSelectionListener(e -> {
String selectedValue = (String) paramStyleList.getSelectedValue();
card.show(right, selectedValue);
});
JPanel leftPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
leftPane.add(paramStyleList);
leftPane.setPreferredSize(new Dimension(100, 500));
this.add(leftPane, BorderLayout.WEST);
}
private void initRightPane() {
JPanel centerPane = FRGUIPaneFactory.createBorderLayout_L_Pane();
JPanel attrConfPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
centerPane.setPreferredSize(new Dimension(500, 500));
attrConfPane.add(right, BorderLayout.CENTER);
centerPane.add(attrConfPane, BorderLayout.CENTER);
this.add(centerPane, BorderLayout.CENTER);
}
public void populate(MobileParamStyle mobileParamStyle) {
if (mobileParamStyle != null) {
MobileParamUIProvider[] mobileParamUIProviders = getMobileParamUIProviders();
for (int i = 0; i < mobileParamUIProviders.length; i++) {
MobileParamUIProvider provider = mobileParamUIProviders[i];
if (ComparatorUtils.equals(mobileParamStyle.disPlayName(), provider.displayName())) {
String displayName = provider.displayName();
paramStyleList.setSelectedIndex(i);
map.get(displayName).populateBean(mobileParamStyle);
card.show(right, displayName);
return;
}
}
}
paramStyleList.setSelectedIndex(0);
}
private void addShowPane(MobileParamUIProvider provider) {
String displayName = provider.displayName();
listModel.addElement(provider.displayName());
BasicBeanPane<MobileParamStyle> paramStyleBasicBeanPane = new MobileParamDefinePane(provider);
right.add(displayName, paramStyleBasicBeanPane);
map.put(displayName, paramStyleBasicBeanPane);
}
public MobileParamStyle update() {
return map.get(paramStyleList.getSelectedValue()).updateBean();
}
@Override
protected String title4PopupWindow() {
return null;
}
private MobileParamUIProvider[] getMobileParamUIProviders() {
Set<MobileParamUIProvider> paramUIProviders = ExtraDesignClassManager.getInstance().getArray(MobileParamUIProvider.XML_TAG);
List<MobileParamUIProvider> result = new ArrayList<>();
result.add(new DefaultMobileParamUIProvider());
result.addAll(paramUIProviders);
Set<String> nameSets = paramUIProviders.stream().map(MobileParamUIProvider::displayName).collect(Collectors.toSet());
// 兼容老接口
Set<MobileParamStyleProvider> paramStyleProviders = ExtraReportClassManager.getInstance().getArray(MobileParamStyleProvider.MARK_STRING);
paramStyleProviders = paramStyleProviders.stream().filter(provider -> !nameSets.contains(provider.descriptor())).collect(Collectors.toSet());
for (MobileParamStyleProvider provider : paramStyleProviders) {
result.add(new EmptyMobileParamUIProvider(provider));
}
return result.toArray(new MobileParamUIProvider[0]);
}
}

34
designer-base/src/main/java/com/fr/design/mainframe/widget/wrappers/MobileParamWrapper.java

@ -0,0 +1,34 @@
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;
import com.fr.locale.InterProviderFactory;
import org.jetbrains.annotations.Nullable;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/1/4
*/
public class MobileParamWrapper implements Encoder, Decoder {
@Nullable
@Override
public Object decode(String txt) {
return null;
}
@Override
public void validate(String txt) throws ValidationException {
// do nothing
}
@Override
public String encode(Object v) {
if (v == null) {
return InterProviderFactory.getProvider().getLocText("Fine-Engine_Report_DEFAULT");
}
return v.toString();
}
}

48
designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleMobileParamEditor.java

@ -0,0 +1,48 @@
package com.fr.design.mainframe.widget.accessibles;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.mobile.ui.MobileParamSettingPane;
import com.fr.design.mainframe.widget.wrappers.MobileParamWrapper;
import com.fr.form.ui.container.WParameterLayout;
import com.fr.form.ui.mobile.MobileParamStyle;
import com.fr.report.mobile.EmptyMobileParamStyle;
import javax.swing.SwingUtilities;
/**
* @author hades
* @version 10.0
* Created by hades on 2021/1/4
*/
public class AccessibleMobileParamEditor extends UneditableAccessibleEditor {
private MobileParamSettingPane mobileParamSettingPane;
public AccessibleMobileParamEditor(MobileParamSettingPane mobileParamSettingPane) {
super(new MobileParamWrapper());
this.mobileParamSettingPane = mobileParamSettingPane;
}
@Override
protected void showEditorPane() {
mobileParamSettingPane.setPreferredSize(BasicDialog.MEDIUM);
BasicDialog dlg = mobileParamSettingPane.showWindow(SwingUtilities.getWindowAncestor(this));
dlg.addDialogActionListener(new DialogActionAdapter() {
@Override
public void doOk() {
MobileParamStyle mobileParamStyle = mobileParamSettingPane.update();
setValue(mobileParamStyle);
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
WParameterLayout wParameterLayout = (WParameterLayout) formDesigner.getSelectionModel().getSelection().getSelectedCreator().toData();
if (mobileParamStyle instanceof EmptyMobileParamStyle) {
wParameterLayout.setProvider(((EmptyMobileParamStyle) mobileParamStyle).getProvider());
}
fireStateChanged();
}
});
mobileParamSettingPane.populate((MobileParamStyle) getValue());
dlg.setVisible(true);
}
}

76
designer-form/src/main/java/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java

@ -5,11 +5,9 @@ import com.fr.design.designer.IntervalConstants;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.properties.PropertyTab; import com.fr.design.designer.properties.PropertyTab;
import com.fr.design.designer.properties.items.Item;
import com.fr.design.foldablepane.UIExpandablePane; import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.fun.ParameterExpandablePaneUIProvider; import com.fr.design.fun.ParameterExpandablePaneUIProvider;
import com.fr.design.gui.frpane.AttributeChangeListener; import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.icombobox.UIComboBox;
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;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
@ -17,25 +15,21 @@ import com.fr.design.layout.TableLayoutHelper;
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.mainframe.mobile.ui.MobileParamSettingPane;
import com.fr.design.mainframe.widget.accessibles.AccessibleMobileParamEditor;
import com.fr.form.ui.container.WParameterLayout; import com.fr.form.ui.container.WParameterLayout;
import com.fr.form.ui.container.WSortLayout; import com.fr.form.ui.container.WSortLayout;
import com.fr.form.ui.mobile.MobileParamStyle;
import com.fr.general.CloudCenter; import com.fr.general.CloudCenter;
import com.fr.general.ComparatorUtils;
import com.fr.general.SiteCenter;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import com.fr.report.ExtraReportClassManager;
import com.fr.report.fun.MobileParamStyleProvider;
import com.fr.report.mobile.DefaultMobileParamStyle;
import com.fr.report.mobile.EmptyMobileParamStyle;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Desktop; import java.awt.Desktop;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.net.URI; import java.net.URI;
@ -47,10 +41,9 @@ import java.util.Set;
public class ParaMobileDefinePane extends MobileWidgetDefinePane { public class ParaMobileDefinePane extends MobileWidgetDefinePane {
private XCreator paraCreator; private XCreator paraCreator;
private FormDesigner designer; private FormDesigner designer;
private Item[] items;
private UIComboBox paramLocationComboBox;
private AttributeChangeListener changeListener; private AttributeChangeListener changeListener;
private MobileWidgetListPane mobileWidgetListPane; private MobileWidgetListPane mobileWidgetListPane;
private AccessibleMobileParamEditor mobileParamEditor;
public ParaMobileDefinePane(XCreator xCreator) { public ParaMobileDefinePane(XCreator xCreator) {
this.paraCreator = xCreator; this.paraCreator = xCreator;
@ -81,18 +74,15 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane {
// 手机属性 // 手机属性
private UIExpandablePane getMobilePropertyPane() { private UIExpandablePane getMobilePropertyPane() {
paramLocationComboBox = getParamLocationComboBox(); mobileParamEditor = new AccessibleMobileParamEditor(new MobileParamSettingPane());
UILabel tipLabel = getTipLabel(); UILabel tipLabel = getTipLabel();
double f = TableLayout.FILL; double f = TableLayout.FILL;
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p, p}; double[] rowSize = {p, p};
double[] columnSize = {p, f}; double[] columnSize = {p, f};
int[][] rowCount = {{1, 1}, {1, 1}}; int[][] rowCount = {{1, 1}, {1, 1}};
if (ExtraReportClassManager.getInstance().getArray(MobileParamStyleProvider.MARK_STRING).isEmpty()) {
((WParameterLayout) (paraCreator.toData())).setProvider((MobileParamStyleProvider) ((Item) paramLocationComboBox.getItemAt(0)).getValue());
}
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Parameter_Panel")), paramLocationComboBox}, new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Parameter_Panel")), mobileParamEditor},
new Component[]{tipLabel, null}, new Component[]{tipLabel, null},
}; };
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, IntervalConstants.INTERVAL_W0, IntervalConstants.INTERVAL_L1);
@ -102,18 +92,6 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane {
return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Properties_Mobile"), 280, 20, jPanel); return new UIExpandablePane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Properties_Mobile"), 280, 20, jPanel);
} }
private Item[] getItems() {
Set<MobileParamStyleProvider> pluginCreators = ExtraReportClassManager.getInstance().getArray(MobileParamStyleProvider.MARK_STRING);
Item[] items = new Item[pluginCreators.size() + 1];
MobileParamStyleProvider provider = new DefaultMobileParamStyle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default"));
items[0] = new Item(provider.descriptor(), provider);
int i = 1;
for (MobileParamStyleProvider mobileParamStyleProvider : pluginCreators) {
items[i++] = new Item(mobileParamStyleProvider.descriptor(), mobileParamStyleProvider);
}
return items;
}
private UILabel getTipLabel() { private UILabel getTipLabel() {
UILabel tipLabel = new UILabel(); UILabel tipLabel = new UILabel();
StringBuilder text = new StringBuilder(); StringBuilder text = new StringBuilder();
@ -156,21 +134,6 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane {
return tipLabel; return tipLabel;
} }
private UIComboBox getParamLocationComboBox() {
items = getItems();
UIComboBox paramLocationComoBox = new UIComboBox(items);
paramLocationComoBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
((WParameterLayout) (paraCreator.toData())).setProvider((MobileParamStyleProvider) ((Item) e.getItem()).getValue());
}
}
});
return paramLocationComoBox;
}
// 控件顺序 // 控件顺序
private UIExpandablePane getMobileWidgetListPane() { private UIExpandablePane getMobileWidgetListPane() {
mobileWidgetListPane = new MobileWidgetListPane(designer, (WSortLayout) paraCreator.toData()); mobileWidgetListPane = new MobileWidgetListPane(designer, (WSortLayout) paraCreator.toData());
@ -205,27 +168,20 @@ public class ParaMobileDefinePane extends MobileWidgetDefinePane {
// 设置监听 // 设置监听
this.bindListeners2Widgets(); this.bindListeners2Widgets();
this.addAttributeChangeListener(changeListener); this.addAttributeChangeListener(changeListener);
int index = 0; WParameterLayout wParameterLayout = (WParameterLayout) paraCreator.toData();
try { this.mobileParamEditor.setValue(wParameterLayout.getMobileParamStyle());
MobileParamStyleProvider provider = ((WParameterLayout) paraCreator.toData()).getProvider();
String currentQueryType = provider.createJSON().getString("queryType");
for (int i = 0; i < items.length; i++) {
String existedQueryType = ((MobileParamStyleProvider) items[i].getValue()).createJSON().getString("queryType");
if (ComparatorUtils.equals(existedQueryType, currentQueryType)) {
index = i;
break;
}
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
paramLocationComboBox.setSelectedIndex(index);
} }
@Override @Override
public void update() { public void update() {
mobileWidgetListPane.updateToDesigner(); mobileWidgetListPane.updateToDesigner();
WParameterLayout wParameterLayout = (WParameterLayout) paraCreator.toData();
MobileParamStyle mobileParamStyle = (MobileParamStyle) this.mobileParamEditor.getValue();
if (mobileParamStyle instanceof EmptyMobileParamStyle) {
wParameterLayout.setProvider(((EmptyMobileParamStyle) mobileParamStyle).getProvider());
}
wParameterLayout.setMobileParamStyle(mobileParamStyle);
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED); designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED);
} }
} }

Loading…
Cancel
Save