Browse Source

Merge pull request #491 in DESIGN/design from ~JU/design:feature/10.0 to feature/10.0

* commit '4fd2434ae255cce8d815da2805411e7f9112a34c':
  REPORT-11155 10.0 丢失功能点补充
  static方法拿出来
  国际化
  update
  CHART-2912 && CHART-2969 扩展接口 自定义字段名
  REPORT-11257
  修改数据面板
research/10.0
ju 6 years ago
parent
commit
a97ac301c3
  1. 81
      designer-base/src/main/java/com/fr/start/server/ServerTray.java
  2. 27
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/AbstractTableDataContentPane.java
  3. 84
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/DataPaneHelper.java
  4. 43
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java
  5. 39
      designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java
  6. 45
      designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java
  7. 74
      designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartTableDataPane.java
  8. 380
      designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java
  9. 20
      designer-chart/src/main/java/com/fr/van/chart/gantt/designer/data/data/component/ComboBoxWithButtonPane.java
  10. 22
      designer-form/src/main/java/com/fr/design/designer/beans/actions/FormWidgetEditAction.java
  11. 10
      designer-form/src/main/java/com/fr/design/mainframe/actions/FormMobileAttrAction.java
  12. 10
      designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleBodyWatermarkEditor.java
  13. 9
      designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java
  14. 10
      designer-realize/src/main/java/com/fr/design/actions/report/ReportWatermarkAction.java

81
designer-base/src/main/java/com/fr/start/server/ServerTray.java

@ -17,32 +17,32 @@ import java.awt.event.MouseEvent;
* Create server tray. * Create server tray.
*/ */
public class ServerTray { public class ServerTray {
private static ServerTray INSTANCE; private static ServerTray INSTANCE;
private MenuItem startMenu; private MenuItem startMenu;
private MenuItem stopMenu; private MenuItem stopMenu;
private Image trayStartedImage = BaseUtils.readImage("/com/fr/base/images/oem/trayStarted.png"); private Image trayStartedImage = BaseUtils.readImage("/com/fr/base/images/oem/trayStarted.png");
private Image trayStoppedImage = BaseUtils.readImage("/com/fr/base/images/oem/trayStopped.png"); private Image trayStoppedImage = BaseUtils.readImage("/com/fr/base/images/oem/trayStopped.png");
private ServerManageFrame serverManageFrame; private ServerManageFrame serverManageFrame;
private TrayIcon trayIcon; private TrayIcon trayIcon;
private ServerTray() { private ServerTray() {
listen(); listen();
//p:首先构建右键菜单 //p:首先构建右键菜单
PopupMenu popup = new PopupMenu(); PopupMenu popup = new PopupMenu();
MenuItem manangeMenu = new MenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Open_Service_Manager")); MenuItem manangeMenu = new MenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Open_Service_Manager"));
manangeMenu.addActionListener(new ActionListener() { manangeMenu.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
serverManageFrame = ServerManageFrame.getServerManageFrame(); serverManageFrame = ServerManageFrame.getServerManageFrame();
if (!serverManageFrame.isVisible()) { if (!serverManageFrame.isVisible()) {
serverManageFrame.setVisible(true); serverManageFrame.setVisible(true);
@ -55,9 +55,9 @@ public class ServerTray {
MenuItem exitMenu = new MenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_M_Exit")); MenuItem exitMenu = new MenuItem(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_M_Exit"));
//创建打开监听器 //创建打开监听器
ActionListener startListener = new ActionListener() { ActionListener startListener = new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
try { try {
FineEmbedServer.start(); FineEmbedServer.start();
} catch (Exception exp) { } catch (Exception exp) {
@ -66,9 +66,9 @@ public class ServerTray {
} }
}; };
ActionListener stopListener = new ActionListener() { ActionListener stopListener = new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
try { try {
FineEmbedServer.stop(); FineEmbedServer.stop();
} catch (Throwable exp) { } catch (Throwable exp) {
@ -80,13 +80,13 @@ public class ServerTray {
stopMenu.addActionListener(stopListener); stopMenu.addActionListener(stopListener);
//创建退出菜单监听器 //创建退出菜单监听器
ActionListener exitListener = new ActionListener() { ActionListener exitListener = new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
exit(); exit();
} }
}; };
exitMenu.addActionListener(exitListener); exitMenu.addActionListener(exitListener);
popup.add(manangeMenu); popup.add(manangeMenu);
popup.addSeparator(); popup.addSeparator();
@ -94,18 +94,18 @@ public class ServerTray {
popup.add(stopMenu); popup.add(stopMenu);
popup.addSeparator(); popup.addSeparator();
popup.add(exitMenu); popup.add(exitMenu);
//p:开始创建托盘. //p:开始创建托盘.
trayIcon = new TrayIcon(trayStartedImage, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Embedded_Server"), popup); trayIcon = new TrayIcon(trayStartedImage, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Server_Embedded_Server"), popup);
trayIcon.setImageAutoSize(true); trayIcon.setImageAutoSize(true);
trayIcon.addMouseListener(new MouseAdapter() { trayIcon.addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if (e.getClickCount() < 2) { if (e.getClickCount() < 2) {
return; return;
} }
ServerManageFrame serverManageFrame = ServerManageFrame.getServerManageFrame(); ServerManageFrame serverManageFrame = ServerManageFrame.getServerManageFrame();
if (!serverManageFrame.isVisible()) { if (!serverManageFrame.isVisible()) {
serverManageFrame.setVisible(true); serverManageFrame.setVisible(true);
@ -113,56 +113,56 @@ public class ServerTray {
serverManageFrame.toFront();//p:到第一个. serverManageFrame.toFront();//p:到第一个.
} }
}); });
TrayIcon[] icons = SystemTray.getSystemTray().getTrayIcons(); TrayIcon[] icons = SystemTray.getSystemTray().getTrayIcons();
for (TrayIcon icon : icons) { for (TrayIcon icon : icons) {
SystemTray.getSystemTray().remove(icon); SystemTray.getSystemTray().remove(icon);
} }
try { try {
SystemTray.getSystemTray().add(trayIcon); SystemTray.getSystemTray().add(trayIcon);
} catch (AWTException e) { } catch (AWTException e) {
System.err.println("Can not create the System Tray:" + e); System.err.println("Can not create the System Tray:" + e);
} }
checkPopupMenuItemEnabled(); checkPopupMenuItemEnabled();
} }
private void listen() { private void listen() {
ListenerAdaptor listenerAdaptor = new ListenerAdaptor() { ListenerAdaptor listenerAdaptor = new ListenerAdaptor() {
@Override @Override
protected void on(Event event) { protected void on(Event event) {
checkPopupMenuItemEnabled(); checkPopupMenuItemEnabled();
} }
}; };
EventDispatcher.listen(EmbedServerEvent.AfterStart, listenerAdaptor); EventDispatcher.listen(EmbedServerEvent.AfterStart, listenerAdaptor);
EventDispatcher.listen(EmbedServerEvent.AfterStop, listenerAdaptor); EventDispatcher.listen(EmbedServerEvent.AfterStop, listenerAdaptor);
} }
private void exit() { private void exit() {
FineEmbedServer.stop(); FineEmbedServer.stop();
SystemTray.getSystemTray().remove(trayIcon); SystemTray.getSystemTray().remove(trayIcon);
} }
private void checkPopupMenuItemEnabled() { private void checkPopupMenuItemEnabled() {
try { try {
if (FineEmbedServer.isRunning()) { if (FineEmbedServer.isRunning()) {
startMenu.setEnabled(false); startMenu.setEnabled(false);
stopMenu.setEnabled(true); stopMenu.setEnabled(true);
trayIcon.setImage(trayStartedImage); trayIcon.setImage(trayStartedImage);
} else { } else {
startMenu.setEnabled(true); startMenu.setEnabled(true);
stopMenu.setEnabled(false); stopMenu.setEnabled(false);
trayIcon.setImage(trayStoppedImage); trayIcon.setImage(trayStoppedImage);
} }
if (serverManageFrame != null) { if (serverManageFrame != null) {
serverManageFrame.checkButtonEnabled(); serverManageFrame.checkButtonEnabled();
serverManageFrame.repaint(); serverManageFrame.repaint();
@ -171,10 +171,9 @@ public class ServerTray {
FRContext.getLogger().error(exp.getMessage(), exp); FRContext.getLogger().error(exp.getMessage(), exp);
} }
} }
public static void init() { public static void init() {
if (INSTANCE == null)
INSTANCE = new ServerTray(); INSTANCE = new ServerTray();
} }
} }

27
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/AbstractTableDataContentPane.java

@ -5,8 +5,8 @@ import com.fr.design.beans.BasicBeanPane;
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TableDataWrapper;
import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIComboBox;
import javax.swing.*; import javax.swing.JSeparator;
import java.awt.*; import java.awt.Dimension;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.List; import java.util.List;
@ -47,31 +47,16 @@ public abstract class AbstractTableDataContentPane extends BasicBeanPane<ChartCo
* 刷新Box的选项. * 刷新Box的选项.
*/ */
protected void refreshBoxItems(UIComboBox box, List list) { protected void refreshBoxItems(UIComboBox box, List list) {
if(box == null) { DataPaneHelper.refreshBoxItems(box, list);
return;
}
Object ob = box.getSelectedItem();
box.removeAllItems();
int length = list.size();
for(int i = 0; i < length; i++) {
box.addItem(list.get(i));
}
box.getModel().setSelectedItem(ob);
} }
/** /**
* 清空box里所有东西 * 清空box里所有东西
* @param box 容器 * @param box 容器
*/ */
protected void clearBoxItems(UIComboBox box){ protected void clearBoxItems(UIComboBox box) {
if(box == null){ DataPaneHelper.clearBoxItems(box);
return; }
}
box.removeAllItems();
}
protected ItemListener tooltipListener = new ItemListener() { protected ItemListener tooltipListener = new ItemListener() {

84
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/DataPaneHelper.java

@ -0,0 +1,84 @@
package com.fr.design.mainframe.chart.gui.data.table;
import com.fr.data.util.function.DataFunction;
import com.fr.data.util.function.NoneFunction;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import java.util.List;
/**
* Created by shine on 2018/9/14.
*/
public class DataPaneHelper {
/**
* 刷新Box的选项.
*/
public static void refreshBoxItems(UIComboBox box, List list) {
if (box == null) {
return;
}
Object ob = box.getSelectedItem();
box.removeAllItems();
int length = list.size();
for (int i = 0; i < length; i++) {
box.addItem(list.get(i));
}
box.getModel().setSelectedItem(ob);
}
/**
* 清空box里所有东西
*
* @param box 容器
*/
public static void clearBoxItems(UIComboBox box) {
if (box != null) {
box.removeAllItems();
}
}
/**
* 根据公式 获取 公式组件下拉框选项
*
* @param function
* @return
*/
public static String getFunctionString(DataFunction function) {
for (int i = 0; i < CalculateComboBox.CLASS_ARRAY.length; i++) {
Class tmp = function.getClass();
if (ComparatorUtils.equals(tmp, CalculateComboBox.CLASS_ARRAY[i])) {
return CalculateComboBox.CALCULATE_ARRAY[i];
}
}
return CalculateComboBox.CALCULATE_ARRAY[0];
}
/**
* 根据公式组件下拉选中项 获取对应公式
*
* @param name
* @return
*/
public static DataFunction getFunctionByName(String name) {
int index = 0;
for (int i = 0; i < CalculateComboBox.CALCULATE_ARRAY.length; i++) {
if (ComparatorUtils.equals(name, CalculateComboBox.CALCULATE_ARRAY[i])) {
index = i;
}
}
try {
return (DataFunction) CalculateComboBox.CLASS_ARRAY[index].newInstance();
} catch (InstantiationException e) {
FineLoggerFactory.getLogger().error("Function Error");
} catch (IllegalAccessException e) {
FineLoggerFactory.getLogger().error("Function Error");
}
return new NoneFunction();
}
}

43
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldNamePane.java

@ -5,7 +5,6 @@ import com.fr.base.chart.chartdata.TopDefinitionProvider;
import com.fr.chart.chartattr.ChartCollection; import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartdata.ChartSummaryColumn; import com.fr.chart.chartdata.ChartSummaryColumn;
import com.fr.chart.chartdata.MoreNameCDDefinition; import com.fr.chart.chartdata.MoreNameCDDefinition;
import com.fr.data.util.function.DataFunction;
import com.fr.data.util.function.NoneFunction; import com.fr.data.util.function.NoneFunction;
import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.event.UIObserver; import com.fr.design.event.UIObserver;
@ -18,14 +17,15 @@ import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox; import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.general.ComparatorUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeEvent;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
@ -198,7 +198,7 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
List<Object[]> list = new ArrayList<Object[]>(); List<Object[]> list = new ArrayList<Object[]>();
for (int i = 0; i < chartSummaryColumnArray.length; i++) { for (int i = 0; i < chartSummaryColumnArray.length; i++) {
ChartSummaryColumn column = chartSummaryColumnArray[i]; ChartSummaryColumn column = chartSummaryColumnArray[i];
String[] nameArray = {column.getName(), column.getCustomName(), getFunctionString(column.getFunction())}; String[] nameArray = {column.getName(), column.getCustomName(), DataPaneHelper.getFunctionString(column.getFunction())};
list.add(nameArray); list.add(nameArray);
} }
seriesDataPane.populateBean(list); seriesDataPane.populateBean(list);
@ -212,16 +212,6 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
this.populateBean(collection,true); this.populateBean(collection,true);
} }
private String getFunctionString(DataFunction function) {
for (int i = 0; i < CalculateComboBox.CLASS_ARRAY.length; i++) {
Class tmp = function.getClass();
if (ComparatorUtils.equals(tmp, CalculateComboBox.CLASS_ARRAY[i])) {
return CalculateComboBox.CALCULATE_ARRAY[i];
}
}
return CalculateComboBox.CALCULATE_ARRAY[0];
}
protected MoreNameCDDefinition createMoreNameCDDefinition() { protected MoreNameCDDefinition createMoreNameCDDefinition() {
return new MoreNameCDDefinition(); return new MoreNameCDDefinition();
} }
@ -246,7 +236,7 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
String second = Utils.objectToString(line[1]); String second = Utils.objectToString(line[1]);
if(isNeedSummary){ if(isNeedSummary){
String third = Utils.objectToString(line[2]); String third = Utils.objectToString(line[2]);
dataArray[i] = new ChartSummaryColumn(first, second, getFcuntionByName(third)); dataArray[i] = new ChartSummaryColumn(first, second, DataPaneHelper.getFunctionByName(third));
} else{ } else{
dataArray[i] = new ChartSummaryColumn(first,second,new NoneFunction()); dataArray[i] = new ChartSummaryColumn(first,second,new NoneFunction());
} }
@ -255,23 +245,6 @@ public class SeriesNameUseFieldNamePane extends FurtherBasicBeanPane<ChartCollec
collection.getSelectedChart().setFilterDefinition(moreDefinition); collection.getSelectedChart().setFilterDefinition(moreDefinition);
} }
private DataFunction getFcuntionByName(String name) {
int index = 0;
for (int i = 0; i < CalculateComboBox.CALCULATE_ARRAY.length; i++) {
if (ComparatorUtils.equals(name, CalculateComboBox.CALCULATE_ARRAY[i])) {
index = i;
}
}
try {
return (DataFunction) CalculateComboBox.CLASS_ARRAY[index].newInstance();
} catch (InstantiationException e) {
FineLoggerFactory.getLogger().error("Function Error");
} catch (IllegalAccessException e) {
FineLoggerFactory.getLogger().error("Function Error");
}
return new NoneFunction();
}
/** /**
* 保存为新的ChartCollection * 保存为新的ChartCollection
*/ */

39
designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/table/SeriesNameUseFieldValuePane.java

@ -15,9 +15,12 @@ import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import javax.swing.BorderFactory;
import javax.swing.*; import javax.swing.ComboBoxModel;
import java.awt.*; import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ItemEvent; import java.awt.event.ItemEvent;
import java.awt.event.ItemListener; import java.awt.event.ItemListener;
import java.util.List; import java.util.List;
@ -155,22 +158,16 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
* @param list 列表 * @param list 列表
*/ */
public void refreshBoxListWithSelectTableData(List list) { public void refreshBoxListWithSelectTableData(List list) {
refreshBoxItems(seriesName, list); DataPaneHelper.refreshBoxItems(seriesName, list);
refreshBoxItems(seriesValue, list); DataPaneHelper.refreshBoxItems(seriesValue, list);
} }
/** /**
* 清空所有的box设置 * 清空所有的box设置
*/ */
public void clearAllBoxList(){ public void clearAllBoxList(){
clearBoxItems(seriesName); DataPaneHelper.clearBoxItems(seriesName);
clearBoxItems(seriesValue); DataPaneHelper.clearBoxItems(seriesValue);
}
private void clearBoxItems(UIComboBox box){
if(box != null){
box.removeAllItems();
}
} }
private boolean boxItemsContainsObject(UIComboBox box,Object item){ private boolean boxItemsContainsObject(UIComboBox box,Object item){
@ -187,22 +184,6 @@ public class SeriesNameUseFieldValuePane extends FurtherBasicBeanPane<ChartColle
return false; return false;
} }
private void refreshBoxItems(UIComboBox box, List list) {
if (box == null) {
return;
}
Object ob = box.getSelectedItem();
box.removeAllItems();
int length = list.size();
for (int i = 0; i < length; i++) {
box.addItem(list.get(i));
}
box.getModel().setSelectedItem(ob);
}
/** /**
* 判断界面是否接受 * 判断界面是否接受
* @param ob 接受的对象 * @param ob 接受的对象

45
designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java

@ -11,15 +11,20 @@ import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPa
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.FlowLayout;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
/** /**
* Created by shine on 2018/3/7. * Created by shine on 2018/3/7.
*/ */
public abstract class AbstractExtendedChartReportDataPane<T extends AbstractDataConfig> extends AbstractReportDataContentPane { public abstract class AbstractExtendedChartReportDataPane<T extends AbstractDataConfig> extends AbstractReportDataContentPane {
private TinyFormulaPane seriesPane;
private TinyFormulaPane valuePane;
public AbstractExtendedChartReportDataPane() { public AbstractExtendedChartReportDataPane() {
initComponents(); initComponents();
} }
@ -30,23 +35,38 @@ public abstract class AbstractExtendedChartReportDataPane<T extends AbstractData
int len = Math.min(labels.length, formulaPanes.length); int len = Math.min(labels.length, formulaPanes.length);
Component[][] components = new Component[len][2]; Component[][] components = new Component[len + (hasCustomFieldPane() ? 2 : 0)][2];
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), formulaPanes[i]}; components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), formulaPanes[i]};
} }
if (hasCustomFieldPane()) {
seriesPane = new TinyFormulaPane();
valuePane = new TinyFormulaPane();
components[len] = new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name"), SwingConstants.LEFT), seriesPane};
components[len + 1] = new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Value"), SwingConstants.LEFT), valuePane};
}
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double f = TableLayout.FILL; double f = TableLayout.FILL;
double[] columnSize = {f, COMPONENT_WIDTH}; double[] columnSize = {f, COMPONENT_WIDTH};
double[] rowSize = new double[len]; double[] rowSize = new double[len + (hasCustomFieldPane() ? 2 : 0)];
Arrays.fill(rowSize, p); Arrays.fill(rowSize, p);
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 24, 6); JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, 24, 6);
panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 15)); panel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 15));
this.setLayout(new FlowLayout());
this.add(panel);
this.add(addSouthPane());
}
protected JPanel addSouthPane() {
return new JPanel();
}
this.setLayout(new BorderLayout()); protected boolean hasCustomFieldPane() {
this.add(panel, BorderLayout.CENTER); return false;
} }
protected Component[] fieldComponents() { protected Component[] fieldComponents() {
@ -74,6 +94,11 @@ public abstract class AbstractExtendedChartReportDataPane<T extends AbstractData
if (dataConfig != null) { if (dataConfig != null) {
populate((T) dataConfig); populate((T) dataConfig);
if (hasCustomFieldPane() && dataConfig.getCustomFields().size() == 2) {
populateField(seriesPane, dataConfig.getCustomFields().get(0));
populateField(valuePane, dataConfig.getCustomFields().get(1));
}
} }
} }
} }
@ -86,7 +111,15 @@ public abstract class AbstractExtendedChartReportDataPane<T extends AbstractData
if (chart != null) { if (chart != null) {
ExtendedReportDataSet dataSet = new ExtendedReportDataSet(); ExtendedReportDataSet dataSet = new ExtendedReportDataSet();
dataSet.setDataConfig(update()); AbstractDataConfig dataConfig = update();
dataSet.setDataConfig(dataConfig);
List<ExtendedField> fieldList = new ArrayList<ExtendedField>();
if (hasCustomFieldPane()) {
fieldList.add(new ExtendedField(seriesPane.updateBean()));
fieldList.add(new ExtendedField(valuePane.updateBean()));
}
dataConfig.setCustomFields(fieldList);
chart.setFilterDefinition(dataSet); chart.setFilterDefinition(dataSet);
} }

74
designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartTableDataPane.java

@ -11,11 +11,11 @@ import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane;
import com.fr.general.GeneralUtils; import com.fr.general.GeneralUtils;
import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -24,7 +24,7 @@ import java.util.List;
*/ */
public abstract class AbstractExtendedChartTableDataPane<T extends AbstractDataConfig> extends AbstractTableDataContentPane { public abstract class AbstractExtendedChartTableDataPane<T extends AbstractDataConfig> extends AbstractTableDataContentPane {
private CalculateComboBox function; private ExtendedCustomFieldComboBoxPane customFieldComboBoxPane;
public AbstractExtendedChartTableDataPane() { public AbstractExtendedChartTableDataPane() {
initComponents(); initComponents();
@ -37,28 +37,27 @@ public abstract class AbstractExtendedChartTableDataPane<T extends AbstractDataC
int len = Math.min(labels.length, fieldComponents.length); int len = Math.min(labels.length, fieldComponents.length);
Component[][] components = new Component[len + (hasFunction() ? 1 : 0)][2]; Component[][] components = new Component[len][2];
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
Component fieldComponent = fieldComponents[i]; components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), fieldComponents[i]};
fieldComponent.setPreferredSize(new Dimension(100, 20));
components[i] = new Component[]{new UILabel(labels[i], SwingConstants.LEFT), fieldComponent};
}
if (hasFunction()) {
function = new CalculateComboBox();
components[len] = new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Summary_Method"), SwingConstants.LEFT), function};
} }
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] columnSize = {p, p}; double[] columnSize = {TableLayout.FILL, 120};
double[] rowSize = new double[len + (hasFunction() ? 1 : 0)]; double[] rowSize = new double[len];
Arrays.fill(rowSize, p); Arrays.fill(rowSize, p);
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout()); this.setLayout(new BorderLayout(0, 6));
this.add(panel, BorderLayout.CENTER); this.setBorder(BorderFactory.createEmptyBorder(2, 24, 0, 15));
this.add(panel, BorderLayout.NORTH);
if (hasCustomFieldPane()) {
customFieldComboBoxPane = new ExtendedCustomFieldComboBoxPane();
this.add(customFieldComboBoxPane, BorderLayout.CENTER);
}
this.add(addSouthPane(), BorderLayout.SOUTH); this.add(addSouthPane(), BorderLayout.SOUTH);
} }
@ -66,7 +65,7 @@ public abstract class AbstractExtendedChartTableDataPane<T extends AbstractDataC
return new JPanel(); return new JPanel();
} }
protected boolean hasFunction() { protected boolean hasCustomFieldPane() {
return false; return false;
} }
@ -96,10 +95,10 @@ public abstract class AbstractExtendedChartTableDataPane<T extends AbstractDataC
AbstractDataConfig dataConfig = dataSet.getDataConfig(); AbstractDataConfig dataConfig = dataSet.getDataConfig();
if (dataConfig != null) { if (dataConfig != null) {
populate((T) dataConfig); populate((T) dataConfig);
}
if (hasFunction()) { if (hasCustomFieldPane()) {
function.populateBean((AbstractDataFunction) dataSet.getDataFunction()); customFieldComboBoxPane.populateBean(dataConfig);
}
} }
} }
@ -116,8 +115,8 @@ public abstract class AbstractExtendedChartTableDataPane<T extends AbstractDataC
ExtendedTableDataSet dataSet = new ExtendedTableDataSet(); ExtendedTableDataSet dataSet = new ExtendedTableDataSet();
dataSet.setDataConfig(update()); dataSet.setDataConfig(update());
if (hasFunction()) { if (hasCustomFieldPane()) {
dataSet.setDataFunction(function.updateBean()); customFieldComboBoxPane.updateBean(dataSet.getDataConfig());
} }
chart.setFilterDefinition(dataSet); chart.setFilterDefinition(dataSet);
@ -127,8 +126,11 @@ public abstract class AbstractExtendedChartTableDataPane<T extends AbstractDataC
@Override @Override
public void checkBoxUse(boolean hasUse) { public void checkBoxUse(boolean hasUse) {
for (UIComboBox comboBox : filedComboBoxes()) { for (Component component : fieldComponents()) {
comboBox.setEnabled(hasUse); component.setEnabled(hasUse);
}
if (customFieldComboBoxPane != null) {
customFieldComboBoxPane.checkBoxUse(hasUse);
} }
} }
@ -137,6 +139,9 @@ public abstract class AbstractExtendedChartTableDataPane<T extends AbstractDataC
for (UIComboBox comboBox : filedComboBoxes()) { for (UIComboBox comboBox : filedComboBoxes()) {
clearBoxItems(comboBox); clearBoxItems(comboBox);
} }
if (customFieldComboBoxPane != null) {
customFieldComboBoxPane.clearAllBoxList();
}
} }
@Override @Override
@ -144,14 +149,33 @@ public abstract class AbstractExtendedChartTableDataPane<T extends AbstractDataC
for (UIComboBox comboBox : filedComboBoxes()) { for (UIComboBox comboBox : filedComboBoxes()) {
refreshBoxItems(comboBox, columnNameList); refreshBoxItems(comboBox, columnNameList);
} }
if (customFieldComboBoxPane != null) {
customFieldComboBoxPane.refreshBoxListWithSelectTableData(columnNameList);
}
} }
protected void populateField(UIComboBox comboBox, ExtendedField field) { protected void populateField(UIComboBox comboBox, ExtendedField field) {
comboBox.setSelectedItem(field.getFieldName()); populateFunctionField(comboBox, null, field);
} }
protected void updateField(UIComboBox comboBox, ExtendedField field) { protected void updateField(UIComboBox comboBox, ExtendedField field) {
updateFunctionField(comboBox, null, field);
}
protected void populateFunctionField(UIComboBox comboBox, CalculateComboBox calculateComboBox, ExtendedField field) {
comboBox.setSelectedItem(field.getFieldName());
if (calculateComboBox != null) {
calculateComboBox.populateBean((AbstractDataFunction) field.getDataFunction());
}
}
protected void updateFunctionField(UIComboBox comboBox, CalculateComboBox calculateComboBox, ExtendedField field) {
field.setFieldName(GeneralUtils.objectToString(comboBox.getSelectedItem())); field.setFieldName(GeneralUtils.objectToString(comboBox.getSelectedItem()));
if (calculateComboBox != null) {
field.setDataFunction(calculateComboBox.updateBean());
} else {
field.setDataFunction(null);
}
} }
} }

380
designer-chart/src/main/java/com/fr/extended/chart/ExtendedCustomFieldComboBoxPane.java

@ -0,0 +1,380 @@
package com.fr.extended.chart;
import com.fr.base.Utils;
import com.fr.data.util.function.AbstractDataFunction;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.frpane.UIComboBoxPane;
import com.fr.design.gui.frpane.UICorrelationPane;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itable.UITable;
import com.fr.design.gui.itable.UITableEditor;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.chart.gui.data.CalculateComboBox;
import com.fr.design.mainframe.chart.gui.data.table.DataPaneHelper;
import com.fr.stable.StringUtils;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.ArrayList;
import java.util.List;
/**
* Created by shine on 2018/9/12.
*/
public class ExtendedCustomFieldComboBoxPane extends UIComboBoxPane<AbstractDataConfig> {
private static final String[] HEADS = {com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Field_Name"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Summary_Method")};
private UseFieldValuePane useFieldValuePane;
private CustomFieldNamePane customFieldNamePane;
private List<String> fieldList = new ArrayList<String>();
@Override
protected void initLayout() {
this.setLayout(new BorderLayout(0, 6));
JPanel northPane = new JPanel(new BorderLayout());
northPane.add(jcb, BorderLayout.CENTER);
UILabel label = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Series_Name_From"));
label.setPreferredSize(new Dimension(82, 20));
northPane.add(label, BorderLayout.WEST);
this.add(northPane, BorderLayout.NORTH);
this.add(cardPane, BorderLayout.CENTER);
}
@Override
protected List<FurtherBasicBeanPane<? extends AbstractDataConfig>> initPaneList() {
useFieldValuePane = new UseFieldValuePane();
customFieldNamePane = new CustomFieldNamePane();
List<FurtherBasicBeanPane<? extends AbstractDataConfig>> list = new ArrayList<FurtherBasicBeanPane<? extends AbstractDataConfig>>();
list.add(useFieldValuePane);
list.add(customFieldNamePane);
return list;
}
@Override
protected String title4PopupWindow() {
return StringUtils.EMPTY;
}
public void checkBoxUse(boolean hasUse) {
jcb.setEnabled(hasUse);
useFieldValuePane.checkBoxUse(hasUse);
}
public void clearAllBoxList() {
useFieldValuePane.clearAllBoxList();
fieldList.clear();
}
protected void refreshBoxListWithSelectTableData(List columnNameList) {
useFieldValuePane.refreshBoxListWithSelectTableData(columnNameList);
fieldList = columnNameList;
}
@Override
public void populateBean(AbstractDataConfig ob) {
if (ob.isCustomName()) {
customFieldNamePane.populateBean(ob);
jcb.setSelectedIndex(1);
} else {
useFieldValuePane.populateBean(ob);
jcb.setSelectedIndex(0);
}
}
@Override
public void updateBean(AbstractDataConfig ob) {
if (jcb.getSelectedIndex() == 0) {
ob.setCustomName(false);
useFieldValuePane.updateBean(ob);
} else {
ob.setCustomName(true);
customFieldNamePane.updateBean(ob);
}
}
private class UseFieldValuePane extends FurtherBasicBeanPane<AbstractDataConfig> {
private UIComboBox series;
private UIComboBox value;
private CalculateComboBox function;
private UseFieldValuePane() {
initComponents();
}
private void initComponents() {
series = new UIComboBox();
value = new UIComboBox();
function = new CalculateComboBox();
Component[][] components = new Component[][]{
new Component[]{new UILabel(HEADS[1], SwingConstants.LEFT), series},
new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Value"), SwingConstants.LEFT), value},
new Component[]{new UILabel(HEADS[2], SwingConstants.LEFT), function},
};
double p = TableLayout.PREFERRED;
double[] columnSize = {76, 120};
double[] rowSize = {p, p, p};
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout(0, 6));
this.add(panel, BorderLayout.CENTER);
}
public void checkBoxUse(boolean hasUse) {
series.setEnabled(hasUse);
value.setEnabled(hasUse);
function.setEnabled(hasUse);
}
public void clearAllBoxList() {
DataPaneHelper.clearBoxItems(series);
DataPaneHelper.clearBoxItems(value);
}
public void refreshBoxListWithSelectTableData(List columnNameList) {
DataPaneHelper.refreshBoxItems(series, columnNameList);
DataPaneHelper.refreshBoxItems(value, columnNameList);
}
@Override
public void populateBean(AbstractDataConfig ob) {
List<ExtendedField> list = ob.getCustomFields();
if (list.size() == 2) {
series.setSelectedItem(list.get(0).getFieldName());
value.setSelectedItem(list.get(1).getFieldName());
function.populateBean((AbstractDataFunction) list.get(1).getDataFunction());
}
}
@Override
public void updateBean(AbstractDataConfig ob) {
List<ExtendedField> list = new ArrayList<ExtendedField>();
list.add(new ExtendedField(Utils.objectToString(series.getSelectedItem())));
ExtendedField field = new ExtendedField(Utils.objectToString(value.getSelectedItem()));
field.setDataFunction(function.updateBean());
list.add(field);
ob.setCustomFields(list);
}
@Override
public boolean accept(Object ob) {
return true;
}
@Override
public void reset() {
}
@Override
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Enable_Field_Value");
}
@Override
public AbstractDataConfig updateBean() {
return null;
}
}
private class CustomFieldNamePane extends FurtherBasicBeanPane<AbstractDataConfig> {
private UICorrelationPane correlationPane;
public CustomFieldNamePane() {
initComponents();
}
private void initComponents() {
correlationPane = new UICorrelationPane(HEADS) {
@Override
protected ActionListener getAddButtonListener() {
return new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
tablePane.addLine(new String[]{StringUtils.EMPTY, StringUtils.EMPTY, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_None")});
fireTargetChanged();
}
};
}
public UITableEditor createUITableEditor() {
return new Editor() {
@Override
protected UICorrelationPane getParent() {
return correlationPane;
}
};
}
};
this.setLayout(new BorderLayout());
this.add(correlationPane, BorderLayout.CENTER);
}
@Override
public void populateBean(AbstractDataConfig ob) {
List<ExtendedField> customFields = ob.getCustomFields();
List<Object[]> list = new ArrayList<Object[]>();
for (ExtendedField field : customFields) {
String[] array = {field.getFieldName(), field.getCustomName(), DataPaneHelper.getFunctionString(field.getDataFunction())};
list.add(array);
}
correlationPane.populateBean(list);
}
@Override
public void updateBean(AbstractDataConfig ob) {
List<Object[]> list = correlationPane.updateBean();
List<ExtendedField> customFields = new ArrayList<ExtendedField>();
for (Object[] line : list) {
ExtendedField field = new ExtendedField(Utils.objectToString(line[0]));
field.setCustomName(Utils.objectToString(line[1]));
if (line.length > 2) {
field.setDataFunction(DataPaneHelper.getFunctionByName(Utils.objectToString(line[2])));
}
customFields.add(field);
}
ob.setCustomFields(customFields);
}
@Override
public boolean accept(Object ob) {
return true;
}
@Override
public void reset() {
}
@Override
public String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Enable_Field_Name");
}
@Override
public AbstractDataConfig updateBean() {
return null;
}
}
private abstract class Editor extends UITableEditor {
private JComponent editorComponent;
protected abstract UICorrelationPane getParent();
@Override
public Object getCellEditorValue() {
if (editorComponent instanceof UIComboBox) {
return ((UIComboBox) editorComponent).getSelectedItem();
} else if (editorComponent instanceof UITextField) {
return ((UITextField) editorComponent).getText();
} else if (editorComponent instanceof CalculateComboBox) {
return ((CalculateComboBox) editorComponent).getSelectedItem();
}
return super.getCellEditorValue();
}
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, final int row, int column) {
switch (column) {
case 0:
editorComponent = createComboBoxEdit(row, value);
break;
case 1:
editorComponent = createTextEdit(value);
break;
default:
editorComponent = createCalculateComboBox(value);
break;
}
return editorComponent;
}
private void setDefaultName(int row) {
UITable table = getParent().getTable();
Object object = table.getValueAt(row, 0);
if (object != null) {
table.setValueAt(object, row, 1);
}
}
private UIComboBox createComboBoxEdit(final int row, Object value) {
UIComboBox uiComboBox = new UIComboBox(fieldList.toArray());
uiComboBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
getParent().stopCellEditing();
getParent().fireTargetChanged();
setDefaultName(row);
}
});
if (value != null && StringUtils.isNotEmpty(value.toString())) {
uiComboBox.getModel().setSelectedItem(value);
} else {
uiComboBox.getModel().setSelectedItem(value);
}
return uiComboBox;
}
private UITextField createTextEdit(Object value) {
UITextField uiTextField = new UITextField();
if (value != null) {
uiTextField.setText(value.toString());
}
uiTextField.registerChangeListener(new UIObserverListener() {
@Override
public void doChange() {
getParent().fireTargetChanged();
}
});
return uiTextField;
}
private CalculateComboBox createCalculateComboBox(Object value) {
CalculateComboBox calculateComboBox = new CalculateComboBox();
if (value != null) {
calculateComboBox.setSelectedItem(value);
}
calculateComboBox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
getParent().stopCellEditing();
getParent().fireTargetChanged();
}
});
return calculateComboBox;
}
}
}

20
designer-chart/src/main/java/com/fr/van/chart/gantt/designer/data/data/component/ComboBoxWithButtonPane.java

@ -4,6 +4,7 @@ import com.fr.design.event.UIObserverListener;
import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icombobox.UIComboBox; 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.mainframe.chart.gui.data.table.DataPaneHelper;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.Icon; import javax.swing.Icon;
@ -62,29 +63,14 @@ public abstract class ComboBoxWithButtonPane extends JPanel {
* 刷新Box的选项. * 刷新Box的选项.
*/ */
public void refreshBoxItems(java.util.List list) { public void refreshBoxItems(java.util.List list) {
if(comboBoxName == null) { DataPaneHelper.refreshBoxItems(comboBoxName, list);
return;
}
Object ob = comboBoxName.getSelectedItem();
comboBoxName.removeAllItems();
int length = list.size();
for(int i = 0; i < length; i++) {
comboBoxName.addItem(list.get(i));
}
comboBoxName.getModel().setSelectedItem(ob);
} }
/** /**
* 清空box里所有东西 * 清空box里所有东西
*/ */
public void clearBoxItems(){ public void clearBoxItems(){
if(comboBoxName == null){ DataPaneHelper.clearBoxItems(comboBoxName);
return;
}
comboBoxName.removeAllItems();
} }

22
designer-form/src/main/java/com/fr/design/designer/beans/actions/FormWidgetEditAction.java

@ -3,9 +3,14 @@ package com.fr.design.designer.beans.actions;
import com.fr.design.actions.TemplateComponentAction; import com.fr.design.actions.TemplateComponentAction;
import com.fr.design.designer.beans.actions.behavior.UpdateBehavior; import com.fr.design.designer.beans.actions.behavior.UpdateBehavior;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.record.analyzer.EnableMetrics;
import javax.swing.JButton;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@EnableMetrics
public abstract class FormWidgetEditAction extends TemplateComponentAction<FormDesigner> { public abstract class FormWidgetEditAction extends TemplateComponentAction<FormDesigner> {
private UpdateBehavior updateBehavior = new UpdateBehavior<FormWidgetEditAction>() { private UpdateBehavior updateBehavior = new UpdateBehavior<FormWidgetEditAction>() {
@ -27,9 +32,24 @@ public abstract class FormWidgetEditAction extends TemplateComponentAction<FormD
@Override @Override
public void actionPerformed(ActionEvent evt) { public void actionPerformed(ActionEvent evt) {
super.actionPerformed(evt); super.actionPerformed(evt);
if (evt.getSource() instanceof JButton) {
recordFunction4Toolbar();
} else {
recordFunction4PopupMenu();
}
}
@Focus(id = "com.fr.form.widget_edit_toolbar", text = "Fine-Design_Function_Form_Widget_Edit_Toolbar", source = Original.EMBED)
private void recordFunction4Toolbar() {
// do nothing
}
@Focus(id = "com.fr.form.widget_edit_popupmenu", text = "Fine-Design_Function_Form_Widget_Edit_Popup_Menu", source = Original.EMBED)
private void recordFunction4PopupMenu() {
// do nothing
} }
public void setUpdateBehavior(UpdateBehavior updateBehavior) { void setUpdateBehavior(UpdateBehavior updateBehavior) {
this.updateBehavior = updateBehavior; this.updateBehavior = updateBehavior;
} }

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

@ -14,6 +14,9 @@ import com.fr.design.menu.MenuKeySet;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.form.main.mobile.FormMobileAttr; import com.fr.form.main.mobile.FormMobileAttr;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.record.analyzer.EnableMetrics;
import javax.swing.*; import javax.swing.*;
@ -22,6 +25,7 @@ import java.awt.event.ActionEvent;
/** /**
* Created by fanglei on 2016/11/14. * Created by fanglei on 2016/11/14.
*/ */
@EnableMetrics
public class FormMobileAttrAction extends JTemplateAction<JForm> { public class FormMobileAttrAction extends JTemplateAction<JForm> {
public FormMobileAttrAction(JForm jf) { public FormMobileAttrAction(JForm jf) {
@ -64,6 +68,7 @@ public class FormMobileAttrAction extends JTemplateAction<JForm> {
// 放到后面。如果提前 return 了,则仍然处于未设置状态,不要添加 // 放到后面。如果提前 return 了,则仍然处于未设置状态,不要添加
jf.getTarget().addAttrMark(new MobileOnlyTemplateAttrMark()); jf.getTarget().addAttrMark(new MobileOnlyTemplateAttrMark());
} }
recordFunction();
// 设置移动端属性并刷新界面 // 设置移动端属性并刷新界面
formTpl.setFormMobileAttr(formMobileAttr); // 会调整 body 的自适应布局,放到最后 formTpl.setFormMobileAttr(formMobileAttr); // 会调整 body 的自适应布局,放到最后
((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified(); ((FormArea)jf.getFormDesign().getParent()).onMobileAttrModified();
@ -74,6 +79,11 @@ public class FormMobileAttrAction extends JTemplateAction<JForm> {
dialog.setVisible(true); dialog.setVisible(true);
} }
@Focus(id = "com.fr.mobile.mobile_template_frm", text = "Fine-Design_Function_Mobile_Template_Frm", source = Original.EMBED)
private void recordFunction() {
// do nothing
}
private static final MenuKeySet REPORT_APP_ATTR = new MenuKeySet() { private static final MenuKeySet REPORT_APP_ATTR = new MenuKeySet() {
@Override @Override
public char getMnemonic() { public char getMnemonic() {

10
designer-form/src/main/java/com/fr/design/mainframe/widget/accessibles/AccessibleBodyWatermarkEditor.java

@ -7,6 +7,9 @@ import com.fr.design.mainframe.widget.editors.ITextComponent;
import com.fr.design.mainframe.widget.renderer.WatermarkRenderer; import com.fr.design.mainframe.widget.renderer.WatermarkRenderer;
import com.fr.design.mainframe.widget.wrappers.WatermarkWrapper; import com.fr.design.mainframe.widget.wrappers.WatermarkWrapper;
import com.fr.design.report.WatermarkPane; import com.fr.design.report.WatermarkPane;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.record.analyzer.EnableMetrics;
import javax.swing.*; import javax.swing.*;
import java.awt.*; import java.awt.*;
@ -15,6 +18,7 @@ import java.awt.*;
* Created by plough on 2018/5/15. * Created by plough on 2018/5/15.
*/ */
@EnableMetrics
public class AccessibleBodyWatermarkEditor extends UneditableAccessibleEditor { public class AccessibleBodyWatermarkEditor extends UneditableAccessibleEditor {
private WatermarkPane watermarkPane; private WatermarkPane watermarkPane;
@ -40,9 +44,15 @@ public class AccessibleBodyWatermarkEditor extends UneditableAccessibleEditor {
public void doOk() { public void doOk() {
setValue(watermarkPane.update()); setValue(watermarkPane.update());
fireStateChanged(); fireStateChanged();
recordFunction();
} }
}); });
watermarkPane.populate((WatermarkAttr) getValue()); watermarkPane.populate((WatermarkAttr) getValue());
dlg.setVisible(true); dlg.setVisible(true);
} }
@Focus(id = "com.fr.watermark", text = "Fine-Design_Form_WaterMark", source = Original.EMBED)
private void recordFunction() {
// do nothing
}
} }

9
designer-realize/src/main/java/com/fr/design/actions/report/ReportMobileAttrAction.java

@ -11,7 +11,9 @@ import com.fr.design.report.mobile.ReportMobileAttrPane;
import com.fr.file.FILE; import com.fr.file.FILE;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.intelli.record.Focus;
import com.fr.main.TemplateWorkBook; import com.fr.main.TemplateWorkBook;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.report.mobile.ElementCaseMobileAttr; import com.fr.report.mobile.ElementCaseMobileAttr;
import javax.swing.*; import javax.swing.*;
@ -22,6 +24,7 @@ import java.awt.event.ActionEvent;
* *
* Created by Administrator on 2016/5/12/0012. * Created by Administrator on 2016/5/12/0012.
*/ */
@EnableMetrics
public class ReportMobileAttrAction extends JWorkBookAction{ public class ReportMobileAttrAction extends JWorkBookAction{
public ReportMobileAttrAction(JWorkBook jwb) { public ReportMobileAttrAction(JWorkBook jwb) {
@ -64,6 +67,7 @@ public class ReportMobileAttrAction extends JWorkBookAction{
// 放到后面。如果提前 return 了,则仍然处于未设置状态,不要添加 // 放到后面。如果提前 return 了,则仍然处于未设置状态,不要添加
wbTpl.addAttrMark(new MobileOnlyTemplateAttrMark()); wbTpl.addAttrMark(new MobileOnlyTemplateAttrMark());
} }
recordFunction();
// 设置移动端属性并刷新界面 // 设置移动端属性并刷新界面
wbTpl.setReportMobileAttr(elementCaseMobileAttr); // 会同时修改页面设置,放到最后 wbTpl.setReportMobileAttr(elementCaseMobileAttr); // 会同时修改页面设置,放到最后
jwb.fireTargetModified(); jwb.fireTargetModified();
@ -72,6 +76,11 @@ public class ReportMobileAttrAction extends JWorkBookAction{
dialog.setVisible(true); dialog.setVisible(true);
} }
@Focus(id = "com.fr.mobile.mobile_template_cpt", text = "Fine-Design_Function_Mobile_Template_Cpt")
private void recordFunction() {
// do nothing
}
private static final MenuKeySet REPORT_APP_ATTR = new MenuKeySet() { private static final MenuKeySet REPORT_APP_ATTR = new MenuKeySet() {
@Override @Override
public char getMnemonic() { return 'P'; } public char getMnemonic() { return 'P'; }

10
designer-realize/src/main/java/com/fr/design/actions/report/ReportWatermarkAction.java

@ -8,7 +8,10 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JWorkBook; import com.fr.design.mainframe.JWorkBook;
import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.KeySetUtils;
import com.fr.design.report.WatermarkPane; import com.fr.design.report.WatermarkPane;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.main.impl.WorkBook; import com.fr.main.impl.WorkBook;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.report.core.ReportUtils; import com.fr.report.core.ReportUtils;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
@ -16,6 +19,7 @@ import java.awt.event.ActionEvent;
/** /**
* Created by plough on 2018/5/15. * Created by plough on 2018/5/15.
*/ */
@EnableMetrics
public class ReportWatermarkAction extends JWorkBookAction { public class ReportWatermarkAction extends JWorkBookAction {
public ReportWatermarkAction(JWorkBook jwb) { public ReportWatermarkAction(JWorkBook jwb) {
super(jwb); super(jwb);
@ -42,7 +46,13 @@ public class ReportWatermarkAction extends JWorkBookAction {
public void doOk() { public void doOk() {
wbTpl.addAttrMark(watermarkPane.update()); wbTpl.addAttrMark(watermarkPane.update());
jwb.fireTargetModified(); jwb.fireTargetModified();
recordFunction();
} }
}).setVisible(true); }).setVisible(true);
} }
@Focus(id = "com.fr.watermark", text = "Fine-Design_Form_WaterMark", source = Original.EMBED)
private void recordFunction() {
// do nothing
}
} }

Loading…
Cancel
Save